:root {
    color-scheme: dark;
    --bg: #0f1020;
    --card: rgba(255, 255, 255, 0.075);
    --card-strong: rgba(255, 255, 255, 0.13);
    --text: #f7f3ff;
    --muted: #b8aecb;
    --accent: #8b5cf6;
    --accent-2: #22d3ee;
    --danger: #fb7185;
    --ok: #34d399;
    font-family: Inter, "PingFang SC", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.34), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(34, 211, 238, 0.18), transparent 32rem),
        var(--bg);
    color: var(--text);
}

body:has(.compact-shell) {
    display: grid;
    place-items: center;
}

.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0; }

.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 28px; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.035em; font-weight: 850; line-height: 1.08; }
.eyebrow { color: var(--accent-2); text-transform: uppercase; font-size: 12px; letter-spacing: 0.18em; font-weight: 800; }

nav { display: flex; gap: 10px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; padding: 10px 14px; border-radius: 999px; background: rgba(255,255,255,0.06); }
nav a.active, nav a:hover { color: white; background: rgba(139, 92, 246, 0.45); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { background: linear-gradient(180deg, rgba(255,255,255,0.095), rgba(255,255,255,0.058)); border: 1px solid rgba(255,255,255,0.13); border-radius: 28px; padding: 24px; box-shadow: 0 24px 80px rgba(0,0,0,0.24); backdrop-filter: blur(18px); }
.card h2 { margin: 0 0 10px; font-size: 24px; }
.muted { color: var(--muted); line-height: 1.7; }

.form-stack { display: grid; gap: 16px; margin-top: 20px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
input, textarea { width: 100%; border: 1px solid rgba(255,255,255,0.16); background: rgba(6, 10, 26, 0.68); color: var(--text); border-radius: 16px; padding: 15px 17px; font: inherit; outline: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.05); }
input:focus, textarea:focus { border-color: rgba(34, 211, 238, 0.72); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12), 0 0 24px rgba(34, 211, 238, 0.08); }
textarea { resize: vertical; }
code { color: #e9d5ff; background: rgba(255,255,255,0.09); border-radius: 8px; padding: 2px 6px; }

button { border: 0; border-radius: 16px; padding: 14px 18px; color: white; background: linear-gradient(135deg, #9b7cff 0%, #7c3aed 46%, #5b21b6 100%); cursor: pointer; font-weight: 800; font-size: 15px; box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 0 28px rgba(124, 58, 237, 0.24), 0 18px 42px rgba(91, 33, 182, 0.20), inset 0 1px 0 rgba(255,255,255,0.22); transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease; }
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 0 36px rgba(139, 92, 246, 0.36), 0 20px 52px rgba(91, 33, 182, 0.26), inset 0 1px 0 rgba(255,255,255,0.25); }
button.secondary { background: rgba(255,255,255,0.12); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.check-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.check-row input { width: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.status { display: inline-flex; margin: 10px 0 16px; padding: 9px 13px; border-radius: 999px; background: rgba(125, 211, 252, 0.08); color: #dbeafe; border: 1px solid rgba(125, 211, 252, 0.16); font-weight: 700; }
.status.ok { color: #bbf7d0; background: rgba(34, 197, 94, 0.14); border-color: rgba(52, 211, 153, 0.32); }
.status.error { color: #fecdd3; background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.34); }
.status.loading { color: #a5f3fc; background: rgba(34, 211, 238, 0.13); border-color: rgba(34, 211, 238, 0.28); }
.result-box { display: grid; gap: 12px; padding: 16px; background: rgba(255,255,255,0.045); border: 1px dashed rgba(255,255,255,0.13); border-radius: 20px; }
.label { color: var(--muted); font-size: 13px; }
.mono { font-family: Inter, "PingFang SC", "Segoe UI", ui-sans-serif, system-ui, sans-serif; overflow-wrap: anywhere; text-align: center; font-size: 18px; font-weight: 700; }
.code { font-family: Inter, "PingFang SC", "Segoe UI", ui-sans-serif, system-ui, sans-serif; font-size: 18px; line-height: 1.3; font-weight: 700; letter-spacing: 0; color: white; text-align: center; }
.code.placeholder { font-size: 18px; font-weight: 700; }
.placeholder { color: rgba(184, 174, 203, 0.66) !important; letter-spacing: 0; }
.logs { min-height: 160px; max-height: 340px; overflow: auto; padding: 16px; border-radius: 18px; background: rgba(0,0,0,0.28); color: #d7cff0; white-space: pre-wrap; }
.settings-card { max-width: 900px; margin: 0 auto; }
.settings-layout { display: grid; gap: 18px; width: min(980px, 100%); margin: 0 auto; }
.settings-layout > .form-stack { margin-top: 0; }
.account-settings-card, .services-panel { display: grid; gap: 16px; }
.card-header-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.card-header-row h2 { margin: 0 0 6px; font-size: 22px; }
.card-header-row p { margin: 0; }
.legacy-hidden, .legacy-hidden * { display: none !important; }
.table-container { overflow-x: auto; border-radius: 18px; border: 1px solid rgba(255,255,255,0.1); }
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); vertical-align: middle; }
.data-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; background: rgba(255,255,255,0.06); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.045); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.empty-state { padding: 18px; text-align: center; color: var(--muted); }
.type-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: rgba(139, 92, 246, 0.28); color: #e9d5ff; font-weight: 800; font-size: 12px; }
.status-dot { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-dot.ok { color: #bbf7d0; background: rgba(34, 197, 94, 0.16); }
.status-dot.muted { color: var(--muted); background: rgba(255,255,255,0.08); }
.email-cell { max-width: 220px; overflow-wrap: anywhere; }
.service-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.service-title { font-weight: 850; color: white; }
.service-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.service-meta span { padding: 5px 9px; border-radius: 999px; background: rgba(255,255,255,0.06); }
.service-actions, .table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-actions button { padding: 8px 10px; border-radius: 11px; font-size: 12px; }
.danger-btn { background: rgba(251, 113, 133, 0.18) !important; color: #fecdd3; box-shadow: none; }
.modal { display: none; position: fixed; inset: 0; z-index: 30; align-items: center; justify-content: center; padding: 20px; background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(8px); }
.modal.active { display: flex; }
.modal-content { width: min(760px, 100%); max-height: 88vh; overflow: hidden; border-radius: 24px; background: rgba(15, 16, 32, 0.98); border: 1px solid rgba(255,255,255,0.16); box-shadow: 0 30px 90px rgba(0,0,0,0.46); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.modal-header h3 { margin: 0; }
.modal-close { width: 34px; height: 34px; padding: 0; border-radius: 12px; background: rgba(255,255,255,0.1); box-shadow: none; }
.modal-body { padding: 20px; max-height: calc(88vh - 72px); overflow-y: auto; }
.compact-shell { width: min(760px, calc(100% - 32px)); padding: 32px 0; }
.compact-topbar { margin-bottom: 51px; justify-content: center; text-align: center; }
.single-card { padding: 32px; }
.email-form { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
.email-form label { gap: 10px; }
.email-form input { min-height: 58px; font-size: 17px; }
.email-form button { min-height: 58px; padding-inline: 28px; border-radius: 16px; }
.hidden { display: none; }
.progress-panel { margin-top: 26px; display: grid; gap: 16px; }
.progress-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.percent { font-size: 24px; font-weight: 900; color: white; }
.progress-track { height: 5px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,0.055); border: 1px solid rgba(255,255,255,0.06); box-shadow: inset 0 1px 4px rgba(0,0,0,0.22); }
.progress-bar { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22d3ee, #8b5cf6 55%, #a78bfa); box-shadow: 0 0 18px rgba(34, 211, 238, 0.42); transition: width 0.35s ease; position: relative; overflow: hidden; }
.progress-bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.34) 44%, transparent 72%); transform: translateX(-100%); animation: shimmer 1.45s infinite; }
.result-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; min-height: 74px; border-radius: 16px; background: rgba(3, 7, 18, 0.28); border: 1px solid rgba(255,255,255,0.08); }
.result-item > div:first-child { display: grid; gap: 8px; }
.result-item .label { justify-self: start; }
.result-item .mono,
.result-item .code { justify-self: start; text-align: left; }
.code-item { align-items: end; }
.copy-btn { padding: 9px 12px; border-radius: 12px; font-size: 13px; background: rgba(255,255,255,0.11); color: #e9d5ff; box-shadow: none; }
.copy-btn:hover:not(:disabled) { box-shadow: none; background: rgba(139, 92, 246, 0.28); }
@keyframes shimmer { to { transform: translateX(100%); } }
.compact-result { margin-top: 2px; }

@media (max-width: 820px) {
    .topbar, .section-heading, .service-header { align-items: flex-start; flex-direction: column; }
    .data-table { min-width: 680px; }
    .grid, .two-col { grid-template-columns: 1fr; }
    .email-form { grid-template-columns: 1fr; }
    .card { padding: 18px; border-radius: 22px; }
    .code { font-size: 34px; }
    .result-item { grid-template-columns: 1fr; }
}
