@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #ffffff;
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: #dbeafe;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.06);
    --shadow-strong: 0 18px 40px rgba(37, 99, 235, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.06), transparent 22%),
        linear-gradient(180deg, #f8fafc 0%, #f3f4f6 100%);
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
.brandmark__name,
.workspace-badge,
.button,
.toggle__button {
    font-family: "Manrope", "Segoe UI", sans-serif;
}

.hidden {
    display: none !important;
}

.shell {
    width: min(1120px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 20px 0 40px;
}

.shell--narrow {
    width: min(760px, calc(100vw - 24px));
}

.topbar,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 18px;
}

.topbar__copy {
    display: grid;
    gap: 8px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 1.8rem);
    line-height: 1.1;
}

.topbar__subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar__link {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.topbar__link:hover {
    color: var(--ink);
}

.brandmark {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brandmark__copy {
    display: grid;
    gap: 3px;
}

.brandmark__logo {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
}

.brandmark__name {
    display: block;
    font-size: 0.98rem;
    line-height: 1.1;
    font-weight: 800;
}

.brandmark__subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.workspace-badge {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.eyebrow {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

.stack {
    display: grid;
    gap: 24px;
    margin-top: 24px;
}

.stack--auth {
    margin-top: 44px;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 420px);
    gap: 40px;
    align-items: center;
}

.auth-copy {
    max-width: 580px;
    padding: 0 8px;
}

.auth-copy h1 {
    margin: 12px 0 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
    max-width: 11ch;
}

.auth-copy__subtitle {
    margin: 16px 0 0;
    max-width: 38ch;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.auth-stack {
    display: grid;
    gap: 16px;
}

.panel {
    border-radius: 20px;
    padding: 24px;
}

.panel--login {
    display: grid;
    gap: 18px;
}

.panel--dashboard {
    padding: 28px;
}

.panel--donate-page {
    background: var(--surface-strong);
}

.panel__header,
.dashboard-head,
.table-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.panel__header--tight {
    align-items: center;
}

.panel__header h2,
.dashboard-head h2,
.table-head h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.panel__lead {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.toggle {
    display: inline-flex;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.toggle__button {
    border: 0;
    background: transparent;
    color: var(--muted);
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.toggle__button.is-active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.login-form,
.otp-form {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 7px;
}

.field span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.field input {
    width: 100%;
    padding: 14px 15px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--ink);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input::placeholder {
    color: #9ca3af;
}

.field input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.6);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.button--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.18);
}

.button--primary:hover {
    background: var(--accent-strong);
}

.button--ghost {
    background: #fff;
    color: var(--ink);
    border-color: var(--line);
}

.button--ghost:hover {
    background: #f9fafb;
}

.button--danger {
    background: #fff;
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.16);
}

.button--danger:hover {
    background: rgba(220, 38, 38, 0.04);
}

.button--compact {
    min-height: 38px;
    padding: 8px 12px;
}

.login-form .button,
.otp-form .button {
    width: 100%;
}

.status-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.9rem;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #9ca3af;
    box-shadow: 0 0 0 6px rgba(156, 163, 175, 0.14);
}

.status-dot[data-state="authenticated"] {
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(5, 150, 105, 0.14);
}

.status-dot[data-state="pending"] {
    background: var(--warning);
    box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.14);
}

.status-dot[data-state="failed"] {
    background: var(--danger);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.14);
}

.otp-copy {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.dashboard-head {
    gap: 18px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-summary {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
    gap: 18px;
    margin-top: 20px;
}

.stats {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
    min-height: 138px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.stat-card__label {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-size: 1.28rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.stat-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.token-panel {
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
}

.token-panel__header,
.doc-grid {
    display: grid;
    gap: 12px;
}

.token-panel__header {
    grid-template-columns: 1fr auto;
    align-items: start;
}

.token-panel__header h3 {
    margin: 4px 0 0;
    font-size: 1rem;
    line-height: 1.2;
}

.token-copy {
    margin: 12px 0 10px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.token-value,
.code-block {
    display: block;
    width: 100%;
    overflow: auto;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #bfdbfe;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.84rem;
    line-height: 1.55;
}

.token-value {
    word-break: break-all;
}

.code-block {
    margin: 0;
    white-space: pre-wrap;
}

.code-block--small {
    padding: 12px;
    font-size: 0.8rem;
}

.doc-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.table-head {
    margin-top: 22px;
    align-items: center;
}

.table-head h3 {
    margin: 0;
}

.table-shell {
    margin-top: 12px;
    overflow: auto;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

th {
    background: #f9fafb;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

.empty-cell {
    text-align: center;
    color: var(--muted);
}

.footer-linkbar {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.footer-cta {
    width: min(760px, 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.footer-cta__eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
}

.footer-cta__copy {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.5;
}

.donate-page {
    display: grid;
    justify-items: center;
    gap: 18px;
    text-align: center;
}

.donate-page__qr img {
    width: min(100%, 320px);
    padding: 16px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.donate-page__caption {
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.toast-stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: grid;
    gap: 10px;
    z-index: 50;
}

.toast {
    min-width: 220px;
    max-width: 340px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.94);
    color: #fff;
    box-shadow: 0 18px 36px rgba(17, 24, 39, 0.16);
}

.toast[data-tone="success"] {
    background: rgba(5, 150, 105, 0.95);
}

.toast[data-tone="error"] {
    background: rgba(220, 38, 38, 0.95);
}

@media (max-width: 980px) {
    .auth-layout,
    .dashboard-summary {
        grid-template-columns: 1fr;
    }

    .auth-copy {
        max-width: 100%;
        text-align: center;
        padding: 0;
    }

    .auth-copy h1,
    .auth-copy__subtitle {
        max-width: none;
    }

    .auth-stack {
        max-width: 480px;
        margin: 0 auto;
        width: 100%;
    }
}

@media (max-width: 760px) {
    .shell,
    .shell--narrow {
        width: min(100vw - 16px, 100%);
        padding: 12px 0 24px;
    }

    .topbar,
    .panel,
    .panel--dashboard {
        padding: 18px;
    }

    .topbar,
    .panel__header,
    .dashboard-head,
    .table-head,
    .topbar__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .toggle {
        width: 100%;
    }

    .toggle__button {
        flex: 1 1 0;
    }

    .actions,
    .footer-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .stats,
    .doc-grid {
        grid-template-columns: 1fr;
    }

    .token-panel__header {
        grid-template-columns: 1fr;
    }

    .workspace-badge {
        white-space: normal;
    }
}
