:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #273449;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border: #334155;
    --success: #22c55e;
    --radius: 8px;
}

* { box-sizing: border-box; }

/* The HTML [hidden] attribute must win over class-level display rules
   (e.g. .modal { display: flex }, .centered { display: flex }).
   Without this, hiding such elements via element.hidden = true has no effect. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3 { margin: 0 0 0.6em 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); font-size: 0.9rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
button.ghost:hover { background: var(--surface-2); }

button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-hover); }

input, select {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.centered {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.centered .card { width: 340px; max-width: 90vw; }
.centered input { width: 100%; margin-bottom: 10px; }
.centered button { width: 100%; }

.error {
    color: var(--danger);
    margin-top: 10px;
    font-size: 0.9rem;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; }
.topbar .tabs { flex: 1; display: flex; gap: 4px; }
.topbar .tab {
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 500;
}
.topbar .tab:hover { background: var(--surface-2); color: var(--text); }
.topbar .tab.active { background: var(--surface-2); color: var(--text); }

.tab-panel {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 24px;
}

.search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.search-row select { flex: 0 0 180px; }
.search-row input { flex: 1; }

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.row-end {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.user-card { margin-bottom: 14px; }
.user-card .fields {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 6px 16px;
    margin: 10px 0 14px 0;
}
.user-card .fields .label {
    color: var(--muted);
    font-size: 0.88rem;
}
.user-card .fields .value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88rem;
    word-break: break-all;
}
.user-card .fields .value.none { color: var(--muted); font-style: italic; }

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.pill.ok { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.pill.no { background: rgba(148, 163, 184, 0.15); color: var(--muted); }

.promo-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 12px;
}
.code-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.code-list li {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--surface-2);
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}
.code-list li.empty { background: transparent; color: var(--muted); font-style: italic; font-family: inherit; }

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
.help-table th, .help-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.help-table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.help-table code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88rem;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-content { width: 420px; max-width: 90vw; margin: 0; }

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 12px 18px;
    border-radius: var(--radius);
    z-index: 200;
    animation: slide-in 0.2s ease-out;
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }
@keyframes slide-in {
    from { transform: translateY(10px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
