/* =========================================================
   Auth pages (static SSR, no MudBlazor)
   ========================================================= */
:root {
    --auth-brand: #4f46e5;
    --auth-brand-dark: #3730a3;
    --auth-brand-2: #7c3aed;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-bg: #f8fafc;
    --auth-danger: #b91c1c;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    font-family: Inter, Roboto, system-ui, sans-serif;
    color: var(--auth-text);
    background: var(--auth-bg);
}

@media (min-width: 960px) {
    .auth-page { grid-template-columns: minmax(420px, 1fr) minmax(480px, 1fr); }
}

/* Brand side */
.auth-brand {
    display: none;
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .14), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(124, 58, 237, .55), transparent 45%),
        linear-gradient(150deg, var(--auth-brand) 0%, var(--auth-brand-dark) 100%);
}

@media (min-width: 960px) {
    .auth-brand { display: flex; }
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: linear-gradient(180deg, transparent, #000 60%);
    pointer-events: none;
}

.auth-brand-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 36px;
    padding: 48px 56px;
    max-width: 560px;
    margin: auto;
}

.auth-logo { font-size: 1.35rem; text-decoration: none; color: inherit; letter-spacing: -.01em; }
.auth-logo strong { font-weight: 800; }
.auth-brand .auth-logo strong { color: #c7d2fe; }

.auth-brand-copy h2 { font-size: 2.1rem; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; }
.auth-brand-copy p { margin: 0; font-size: 1.05rem; color: rgba(255, 255, 255, .82); line-height: 1.6; }

.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.auth-feature-icon {
    width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: rgba(255, 255, 255, .18); font-size: .8rem;
}

.auth-preview {
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 16px;
    padding: 8px 18px;
    backdrop-filter: blur(6px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, .25);
}

.auth-preview-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; font-size: .95rem; }
.auth-preview-row + .auth-preview-row { border-top: 1px solid rgba(255, 255, 255, .15); }
.pill { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill-success { background: #dcfce7; color: #166534; }
.pill-warning { background: #fef3c7; color: #92400e; }

/* Form side */
.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 32px 16px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 18px;
    padding: 36px 32px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .06);
}

.auth-logo-mobile { display: inline-block; margin-bottom: 20px; color: var(--auth-text); }
.auth-logo-mobile strong { color: var(--auth-brand); }
@media (min-width: 960px) { .auth-logo-mobile { display: none; } }

.auth-card h1 { margin: 0 0 6px; font-size: 1.6rem; letter-spacing: -.02em; }
.auth-subtitle { margin: 0 0 24px; color: var(--auth-muted); line-height: 1.5; }

.auth-alert {
    display: flex; gap: 10px; align-items: flex-start;
    background: #fef2f2; color: var(--auth-danger); border: 1px solid #fecaca;
    padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; font-weight: 500;
}
.auth-alert svg { flex: none; margin-top: 1px; }

.auth-form { display: grid; gap: 18px; }
.auth-field { display: grid; gap: 6px; }
.auth-field label { font-weight: 600; font-size: .9rem; }

.auth-field input {
    font: inherit;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: var(--auth-text);
    transition: border-color .15s, box-shadow .15s;
}
.auth-field input::placeholder { color: #94a3b8; }
.auth-field input:focus { outline: none; border-color: var(--auth-brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .15); }

.auth-password { position: relative; }
.auth-password input { padding-right: 84px; }
.auth-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: var(--auth-brand); font: inherit; font-size: .85rem; font-weight: 600;
    padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.auth-toggle:hover { background: rgba(79, 70, 229, .08); }

.auth-check { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: #334155; cursor: pointer; }
.auth-check input { width: 18px; height: 18px; accent-color: var(--auth-brand); }

.auth-submit {
    font: inherit; font-weight: 700; font-size: 1rem;
    padding: 13px; border: 0; border-radius: 10px; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, var(--auth-brand), var(--auth-brand-2));
    box-shadow: 0 8px 20px rgba(79, 70, 229, .3);
    transition: transform .1s, box-shadow .15s, opacity .15s;
}
.auth-submit:hover { box-shadow: 0 10px 24px rgba(79, 70, 229, .4); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit.is-loading { opacity: .75; cursor: progress; }

.auth-footer-text { margin: 22px 0 0; text-align: center; color: var(--auth-muted); font-size: .92rem; }
.auth-footer-text a { color: var(--auth-brand); font-weight: 600; text-decoration: none; }
.auth-footer-text a:hover { text-decoration: underline; }

.auth-legal { margin: 0; color: #94a3b8; font-size: .8rem; }

/* =========================================================
   Admin: dark variant of the auth page
   ========================================================= */
.auth-dark { --auth-brand: #6366f1; --auth-brand-dark: #4338ca; --auth-brand-2: #8b5cf6; background: #0b1120; color: #e2e8f0; }
.auth-dark .auth-brand { background:
        radial-gradient(circle at 20% 15%, rgba(99, 102, 241, .35), transparent 45%),
        radial-gradient(circle at 80% 85%, rgba(139, 92, 246, .3), transparent 45%),
        linear-gradient(160deg, #0f172a 0%, #020617 100%); }
.auth-dark .auth-brand .auth-logo strong { color: #a5b4fc; }
.auth-badge { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: rgba(165, 180, 252, .18); color: #c7d2fe; vertical-align: middle; margin-left: 6px; }
.auth-dark .auth-card { background: #111827; border-color: #1f2937; box-shadow: 0 20px 50px rgba(0, 0, 0, .45); }
.auth-dark .auth-card h1 { color: #f8fafc; }
.auth-dark .auth-subtitle { color: #94a3b8; }
.auth-dark .auth-logo-mobile { color: #f8fafc; }
.auth-dark .auth-logo-mobile strong { color: #a5b4fc; }
.auth-dark .auth-field label { color: #cbd5e1; }
.auth-dark .auth-field input { background: #0b1120; border-color: #334155; color: #f1f5f9; }
.auth-dark .auth-field input:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(129, 140, 248, .2); }
.auth-dark .auth-toggle { color: #a5b4fc; }
.auth-dark .auth-toggle:hover { background: rgba(165, 180, 252, .1); }
.auth-dark .auth-alert { background: rgba(220, 38, 38, .12); border-color: rgba(248, 113, 113, .35); color: #fca5a5; }
.auth-dark .auth-legal { color: #475569; }
.auth-shield { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; color: #c7d2fe; background: linear-gradient(135deg, rgba(99, 102, 241, .35), rgba(139, 92, 246, .35)); }

/* =========================================================
   Admin shell
   ========================================================= */
.drawer-brand { padding: 20px 20px 16px; display: flex; align-items: center; gap: 8px; }
.drawer-brand .logo { font-size: 1.15rem; color: #f8fafc; text-decoration: none; letter-spacing: -.01em; }
.drawer-brand .logo strong { color: #a5b4fc; font-weight: 800; }
.appbar-border { border-bottom: 1px solid #e2e8f0; }
.user-menu-header { padding: 12px 16px; border-bottom: 1px solid #e2e8f0; min-width: 220px; }
.user-menu-header .name { font-weight: 600; }
.user-menu-header .email { font-size: .82rem; color: #64748b; }
.logout-form button { all: unset; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; cursor: pointer; color: #b91c1c; font-size: .92rem; box-sizing: border-box; }
.logout-form button:hover { background: #fef2f2; }

.avatar-button { all: unset; cursor: pointer; border-radius: 50%; display: inline-flex; }
.avatar-button:focus-visible { outline: 3px solid rgba(99, 102, 241, .5); outline-offset: 2px; }

/* Disabled items on the dark drawer stay readable */
.mud-drawer .mud-nav-link.mud-nav-link-disabled { color: #64748b !important; }
.mud-drawer .mud-nav-link.mud-nav-link-disabled .mud-nav-link-icon { color: #475569 !important; }
.nav-overline { color: #64748b !important; letter-spacing: .08em; }

/* ---------- Tables on phones and tablets (MudTable Breakpoint.Sm = card mode up to 960px) ---------- */
@media (max-width: 960px) {
    .mud-sm-table .mud-table-container { overflow: visible; }
    .mud-sm-table .mud-table-body { border-top: 0 !important; }
    .mud-sm-table .mud-table-root { border-collapse: separate; border-spacing: 0; }
    .mud-sm-table .mud-table-body .mud-table-row {
        display: block; margin: 0 0 10px; padding: 6px 14px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    }
    .mud-sm-table .mud-table-body .mud-table-row:hover { background: #fff; }
    .mud-sm-table .mud-table-row .mud-table-cell,
    .mud-sm-table.mud-table-dense .mud-table-cell {
        padding: 7px 0 !important; border: 0 !important; gap: 12px; font-size: .9rem; min-height: 0; text-align: end !important;
    }
    .mud-sm-table .mud-table-row .mud-table-cell + .mud-table-cell { border-top: 1px dashed #eef2f7 !important; }
    .mud-sm-table .mud-table-cell:before {
        flex: none; padding-right: 0 !important; color: #64748b; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
        text-align: start;
    }
    /* First column = what the row is about: bigger, no label. */
    .mud-sm-table .mud-table-row .mud-table-cell:first-child { font-weight: 600; font-size: .98rem; justify-content: flex-start; text-align: start !important; }
    .mud-sm-table .mud-table-row .mud-table-cell:first-child:before { display: none; }
    /* Cells with fields (editable tables): label above, field full width. */
    .mud-sm-table .mud-table-cell:has(.mud-input-control),
    .mud-sm-table .mud-table-cell:has(.mud-select) { flex-direction: column; align-items: stretch; gap: 4px; text-align: start !important; }
    .mud-sm-table .mud-table-cell .mud-input-control { width: 100% !important; max-width: none !important; }
    .mud-sm-table .mud-table-cell .mud-input-control[style*="width"] { width: 100% !important; }
    .mud-sm-table .mud-table-cell:has(.mud-switch) { flex-direction: row; align-items: center; }
    /* Action cells (buttons): full row, buttons to the end. */
    .mud-sm-table .mud-table-cell:has(.mud-button-root):not(:has(.mud-input-control)) { justify-content: flex-end; }
    .mud-sm-table .mud-table-cell:has(.mud-button-root):not(:has(.mud-input-control)):before { margin-right: auto; }
    .mud-sm-table .mud-table-smalldevices-sortselect { padding: 0 0 10px !important; }
    .mud-sm-table .mud-table-pagination { border: 0; }

    /* Simple tables (no card mode): scroll inside their own box instead of squeezing columns or the page. */
    .mud-simple-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .mud-simple-table table { min-width: 560px; }
    .mud-simple-table th, .mud-simple-table td { white-space: nowrap; font-size: .86rem; }
}
@media (max-width: 960px) {
    /* Fields inside table cards: full width even when the column set a fixed width (Style="width:150px"). */
    .mud-sm-table .mud-table-cell:has(.mud-input-control) [style*="width"],
    .mud-sm-table .mud-table-cell:has(.mud-input-control) .mud-input-control,
    .mud-sm-table .mud-table-cell:has(.mud-input-control) .mud-input { width: 100% !important; max-width: none !important; min-width: 0 !important; }
}

/* ---------- Login: two-step verification ---------- */
.auth-page-single { grid-template-columns: 1fr; }
.auth-page-single .auth-panel { min-height: 100vh; }
.auth-code { letter-spacing: .3em; font-size: 1.3rem !important; text-align: center; }
.auth-help { margin-top: 16px; font-size: .9rem; color: #475569; }
.auth-help summary { cursor: pointer; font-weight: 600; color: #4f46e5; }

/* ---------- Security page ---------- */
.security-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.security-steps { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.security-qr { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 0 0 14px 20px; }
.security-qr img { border: 1px solid #e2e8f0; border-radius: 12px; padding: 6px; background: #fff; image-rendering: pixelated; }
.security-secret { display: block; margin-top: 4px; font-size: 1rem; letter-spacing: .08em; word-break: break-all; }
.security-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.security-confirm .mud-input-control { max-width: 200px; }
.recovery-codes { list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; }
.domain-tips { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: .92rem; color: #334155; }

/* Support tickets: conversation with the store. */
.support-thread { display: flex; flex-direction: column; gap: 12px; }
.support-message { max-width: 85%; padding: 10px 14px; border-radius: 12px; background: #f1f5f9; }
.support-message.from-store { align-self: flex-start; background: #f1f5f9; }
.support-message.from-us { align-self: flex-end; background: #eef2ff; }
.support-meta { font-size: .78rem; color: #64748b; margin-bottom: 4px; }
.support-body { white-space: pre-line; font-size: .95rem; line-height: 1.5; }
