/* Sora design system. "Sora" means sky: indigo to sky blue. Base text 16px; nothing smaller than 14px. */
:root {
    --s-indigo: #4338ca;
    --s-indigo-dark: #3730a3;
    --s-sky: #0ea5e9;
    --s-grad: linear-gradient(135deg, #4338ca 0%, #6366f1 45%, #0ea5e9 100%);
    --s-bg: #f4f6fb;
    --s-surface: #ffffff;
    --s-text: #0f172a;
    --s-muted: #5b6474;
    --s-line: #e4e8f1;
    --s-soft: #eef1fb;
    --s-green: #059669;
    --s-amber: #b45309;
    --s-red: #dc2626;
    --s-radius: 14px;
    --s-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
    --s-font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
    --s-font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

html, body { font-family: var(--s-font); font-size: 16px; color: var(--s-text); background: var(--s-bg); }
h1, h2, h3, h4 { font-family: var(--s-font-display); letter-spacing: -0.01em; }
a { color: var(--s-indigo); }
.mud-typography, .mud-input, .mud-button-label, .mud-nav-link-text, .mud-list-item-text { font-family: var(--s-font) !important; }
.mud-input { font-size: 1rem !important; }
.mud-input-label { font-size: 1rem !important; }
.mud-button-label { text-transform: none; font-weight: 600; letter-spacing: 0; }
.mud-nav-link { font-size: 1rem !important; padding-top: 10px !important; padding-bottom: 10px !important; border-radius: 10px; margin: 2px 8px; width: calc(100% - 16px) !important; }
.mud-nav-link.active { background: var(--s-soft) !important; color: var(--s-indigo) !important; font-weight: 600; }
.mud-nav-group > .mud-nav-link { margin: 2px 8px; }
.mud-drawer { border-right: 1px solid var(--s-line) !important; }
.mud-appbar { border-bottom: 1px solid var(--s-line); }
.mud-snackbar { font-size: 1rem; }

/* ---------- splash ---------- */
.s-splash { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--s-bg); }
.s-splash-name { font: 600 1.5rem var(--s-font-display); color: var(--s-text); }
.s-splash-bar { width: 180px; height: 4px; border-radius: 4px; background: var(--s-line); overflow: hidden; }
.s-splash-bar div { width: 40%; height: 100%; background: var(--s-grad); animation: s-slide 1.1s ease-in-out infinite; }
@keyframes s-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ---------- page structure ---------- */
.s-page { max-width: 1280px; margin: 0 auto; padding: 28px 28px 64px; }
.s-page.narrow { max-width: 920px; }
.s-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.s-head h1 { font-size: 2rem; font-weight: 700; margin: 0; line-height: 1.15; }
.s-head .s-sub { color: var(--s-muted); margin-top: 4px; font-size: 1rem; }
.s-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.s-card { background: var(--s-surface); border: 1px solid var(--s-line); border-radius: var(--s-radius); box-shadow: var(--s-shadow); padding: 22px; }
.s-card + .s-card { margin-top: 18px; }
.s-card h2 { font-size: 1.25rem; font-weight: 650; margin: 0 0 14px; }
.s-grid { display: grid; gap: 18px; }
.s-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.s-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.s-grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.s-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 20px; }
.s-muted { color: var(--s-muted); }
.s-span2 { min-width: 0; }
@media (min-width: 760px) { .s-span2 { grid-column: span 2; } }
.s-right { text-align: right; }
.s-gap { height: 18px; }

/* ---------- stat tiles ---------- */
.s-stat { position: relative; overflow: hidden; }
.s-stat .label { color: var(--s-muted); font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.s-stat .value { font: 700 2.1rem var(--s-font-display); margin-top: 6px; letter-spacing: -0.02em; }
.s-stat .note { margin-top: 4px; color: var(--s-muted); font-size: 0.95rem; }
.s-stat .note.bad { color: var(--s-red); font-weight: 600; }
.s-stat.hero { background: var(--s-grad); color: #fff; border: none; }
.s-stat.hero .label, .s-stat.hero .note { color: rgba(255,255,255,.85); }
.s-stat.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.12); }

/* ---------- tables (lists and reports share one style; our own HTML, prints cleanly) ---------- */
.s-table-wrap { overflow-x: auto; }
table.s-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.s-table th { text-align: left; font-weight: 600; color: var(--s-muted); font-size: 0.92rem; padding: 10px 12px; border-bottom: 2px solid var(--s-line); white-space: nowrap; }
.s-table td { padding: 12px; border-bottom: 1px solid var(--s-line); vertical-align: middle; }
.s-table tr.click { cursor: pointer; }
.s-table tr.click:hover td { background: #f7f8fe; }
.s-table .num, .s-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.s-table tfoot td { font-weight: 700; border-top: 2px solid var(--s-text); border-bottom: none; }
.s-table .dim { color: var(--s-muted); }
.s-table td.wrap { white-space: normal; }

.s-report { max-width: 900px; margin: 0 auto; }
.s-report-head { text-align: center; margin-bottom: 18px; }
.s-report-head .company { color: var(--s-muted); font-weight: 600; }
.s-report-head h2 { font-size: 1.6rem; margin: 2px 0; }
.s-report-head .period { color: var(--s-muted); }
.s-report tr.section td { font-weight: 700; padding-top: 22px; border-bottom: 1px solid var(--s-line); font-size: 1.05rem; }
.s-report tr.account td:first-child { padding-left: 26px; }
.s-report tr.subtotal td { font-weight: 650; border-top: 1px solid var(--s-text); }
.s-report tr.total td { font-weight: 800; font-size: 1.08rem; border-top: 2px solid var(--s-text); border-bottom: 3px double var(--s-text); }
.s-report tr.spacer td { border: none; height: 10px; padding: 0; }
.s-report tr.account.click:hover td { background: #f7f8fe; cursor: pointer; }

/* ---------- status pills ---------- */
.s-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.s-pill.draft { background: #eef0f4; color: #475569; }
.s-pill.approved { background: #e0e7ff; color: var(--s-indigo-dark); }
.s-pill.overdue { background: #fee2e2; color: #b91c1c; }
.s-pill.paid { background: #d1fae5; color: #047857; }
.s-pill.void { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
/* a draft an assistant app added through the connector */
.s-pill.connector { background: #e0f2fe; color: #075985; }

/* ---------- the connector (Settings) ---------- */
.s-keybox { margin-top: 18px; padding: 18px 20px; border: 2px solid var(--s-sky); border-radius: 12px; background: #f0f9ff; }
.s-key { font: 600 1.02rem ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--s-surface); border: 1px solid var(--s-line); border-radius: 8px; padding: 10px 12px; word-break: break-all; user-select: all; flex: 1 1 320px; }
.s-review { border: 2px solid var(--s-sky); }

/* ---------- tabs as chips ---------- */
.s-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.s-tab { border: 1px solid var(--s-line); background: var(--s-surface); color: var(--s-text); border-radius: 999px; padding: 7px 16px; font: 600 0.95rem var(--s-font); cursor: pointer; }
.s-tab.on { background: var(--s-text); color: #fff; border-color: var(--s-text); }
.s-tab .count { margin-left: 6px; opacity: .7; }

/* ---------- document editor ---------- */
.s-lines { width: 100%; border-collapse: separate; border-spacing: 0; }
.s-lines th { text-align: left; font-weight: 600; color: var(--s-muted); font-size: 0.92rem; padding: 8px 6px; border-bottom: 2px solid var(--s-line); }
.s-lines td { padding: 4px 6px; vertical-align: top; border-bottom: 1px solid var(--s-line); }
.s-lines td.amount { text-align: right; padding-top: 22px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.s-totals { margin-left: auto; width: min(380px, 100%); margin-top: 16px; }
.s-totals div { display: flex; justify-content: space-between; padding: 6px 0; font-size: 1.05rem; }
.s-totals .grand { border-top: 2px solid var(--s-text); margin-top: 6px; padding-top: 10px; font-weight: 800; font-size: 1.35rem; }
.s-totals .due { color: var(--s-indigo); font-weight: 700; }

/* ---------- VAT boxes ---------- */
.s-boxes { display: grid; gap: 10px; }
.s-box { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--s-line); border-radius: 12px; background: var(--s-surface); }
.s-box .n { width: 40px; height: 40px; border-radius: 10px; background: var(--s-soft); color: var(--s-indigo); font: 800 1.15rem var(--s-font-display); display: flex; align-items: center; justify-content: center; }
.s-box .v { font: 700 1.25rem var(--s-font-display); font-variant-numeric: tabular-nums; }
.s-box.key { background: var(--s-grad); color: #fff; border: none; }
.s-box.key .n { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- auth pages ---------- */
.s-auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.s-auth-art { background: var(--s-grad); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 56px; position: relative; overflow: hidden; }
.s-auth-art h1 { font-size: 2.6rem; line-height: 1.12; margin: 18px 0 14px; font-weight: 800; }
.s-auth-art p { font-size: 1.15rem; opacity: .92; max-width: 520px; }
.s-auth-art ul { list-style: none; padding: 0; margin: 22px 0 0; font-size: 1.08rem; }
.s-auth-art li { margin: 10px 0; display: flex; gap: 10px; align-items: center; }
.s-auth-art img.art { margin-top: 30px; max-width: 460px; width: 100%; }
.s-auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--s-surface); }
.s-auth-form > div { width: min(440px, 100%); }
.s-auth-form h2 { font-size: 1.9rem; font-weight: 750; margin: 0 0 6px; }
@media (max-width: 900px) { .s-auth { grid-template-columns: 1fr; } .s-auth-art { padding: 32px 24px; } .s-auth-art img.art, .s-auth-art ul { display: none; } .s-auth-art h1 { font-size: 1.8rem; } }

/* ---------- empty states ---------- */
.s-empty { text-align: center; padding: 48px 20px; color: var(--s-muted); }
.s-empty h2, .s-empty h3 { color: var(--s-text); margin: 14px 0 6px; }
.s-empty p { margin: 0 auto 18px; max-width: 460px; }

/* ---------- brand ---------- */
.s-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--s-text); }
.s-brand .name { font: 750 1.3rem var(--s-font-display); letter-spacing: -0.02em; }
.s-brand .name span { background: var(--s-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.s-company-btn { font-weight: 650 !important; }
/* The account menu's activator: the avatar inside a plain button (keyboard and screen readers reach it). */
.s-avatar-btn { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; border-radius: 50%; line-height: 0; }
.s-avatar-btn:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }

/* ---------- chart (our own SVG) ---------- */
.s-chart text { font: 13px var(--s-font); fill: var(--s-muted); }
.s-legend { display: flex; gap: 18px; color: var(--s-muted); font-size: 0.95rem; }
.s-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- print: reports and invoices print as clean A4 ---------- */
.s-print-only { display: none; }
@page { size: A4; margin: 16mm 14mm; }
@media print {
    html, body { background: #fff !important; font-size: 11pt; }
    .mud-appbar, .mud-drawer, .s-no-print, .mud-snackbar-provider, .mud-overlay { display: none !important; }
    .mud-main-content { padding: 0 !important; margin: 0 !important; }
    .s-page { padding: 0; max-width: none; }
    .s-card { box-shadow: none; border: none; padding: 0; }
    .s-print-only { display: block; }
    .s-table tr { page-break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
}

/* ---------- invoice sheet ---------- */
.s-sheet { background: #fff; max-width: 820px; margin: 0 auto; padding: 48px; border-radius: var(--s-radius); box-shadow: var(--s-shadow); }
.s-sheet .top { display: flex; justify-content: space-between; gap: 24px; }
.s-sheet h1 { font-size: 2.2rem; letter-spacing: 0.04em; margin: 0; color: var(--s-indigo); }
.s-sheet .meta { display: grid; grid-template-columns: auto auto; gap: 4px 18px; margin-top: 10px; }
.s-sheet .meta b { color: var(--s-muted); font-weight: 600; }
.s-sheet .parties { display: flex; justify-content: space-between; gap: 24px; margin: 32px 0 24px; }
.s-sheet .footer { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--s-line); color: var(--s-muted); white-space: pre-line; }
.s-sheet .top { align-items: center; }
.s-sheet .logo { display: block; max-width: 240px; max-height: 80px; width: auto; height: auto; }
.s-sheet .parties .meta { margin-top: 0; text-align: right; align-content: start; }
.s-sheet .pay { margin-top: 24px; background: #f1f5f9; border-radius: 10px; padding: 14px 16px; }
@media print { .s-sheet { box-shadow: none; padding: 0; } }

/* ---------- invoice branding and emails ---------- */
.s-logo-box { display: inline-flex; align-items: center; justify-content: center; min-width: 220px; min-height: 90px; padding: 14px; border: 1px solid var(--s-line); border-radius: 12px; background: #fff; }
.s-logo-box img { max-width: 300px; max-height: 100px; width: auto; height: auto; display: block; }
.s-email-list { display: grid; gap: 10px; }
.s-email-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--s-line); }
.s-email-row:last-child { border-bottom: none; }

/* ---------- sign-in code and the admin area ---------- */
.s-code-input input { font-size: 1.6rem; letter-spacing: 0.25em; font-variant-numeric: tabular-nums; }
.s-qr { display: block; width: 220px; height: 220px; image-rendering: pixelated; border: 1px solid var(--s-line); border-radius: 12px; background: #fff; }
.s-key { font: 600 1.15rem ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.06em; word-break: break-all; background: #f5f6fb; border-radius: 10px; padding: 12px 14px; }
.s-codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; font: 600 1.15rem ui-monospace, "Cascadia Mono", Consolas, monospace; }
.s-codes div { background: #f5f6fb; border-radius: 10px; padding: 10px 12px; text-align: center; }
.s-filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.s-filters .mud-input-control { max-width: 200px; }
.s-chip { display: inline-flex; align-items: center; gap: 6px; background: #eef0ff; color: var(--s-indigo); border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.s-chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 2px; }
.s-link { color: var(--s-indigo); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.s-footnote { color: var(--s-muted); font-size: 0.95rem; line-height: 1.6; }

/* ---------- receipts and attachments ---------- */
.s-att-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.s-att-head h2 { margin-bottom: 4px; }
.s-drop { margin-top: 14px; border: 2px dashed var(--s-line); border-radius: 12px; padding: 12px 14px; transition: border-color .15s, background-color .15s; }
.s-drop.on { border-color: var(--s-indigo); background: var(--s-soft); }
.s-drop.off { border-style: solid; }
.s-drop-empty { text-align: center; color: var(--s-muted); padding: 20px 8px; font-size: 1.02rem; }
.s-drop-hint { text-align: center; color: var(--s-muted); padding-top: 10px; font-size: 0.95rem; }
.s-file-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; word-break: break-word; }
.s-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.s-phone-only { display: none !important; }
@media (pointer: coarse) { .s-phone-only { display: inline-flex !important; } }
.s-usage-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 1.1rem; }

#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .8rem 1.25rem; position: fixed; width: 100%; z-index: 2000; font-size: 1rem; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .6rem; }
h1:focus { outline: none; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
    .s-page { padding: 18px 16px 48px; }
    .s-head h1 { font-size: 1.6rem; }
    .s-brand .name { display: none; }
    .s-hide-phone { display: none; }
    .s-new-btn { min-width: 0 !important; padding: 6px 10px !important; margin-right: 6px !important; }
    .s-new-btn .mud-button-icon-start { margin: 0 !important; }
    .s-company-menu { margin-left: 4px !important; min-width: 0; flex: 1 1 auto; }
    .s-company-btn .mud-button-label { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
    .s-stat .value { font-size: 1.7rem; }
    .s-sheet { padding: 22px; }
    .s-sheet .top, .s-sheet .parties { flex-direction: column; }
    .s-sheet .top > div:last-child { text-align: left !important; }
}

/* Notice to every user: a banner on every page until it is dismissed (NoticeBanner) */
.s-notice-wrap { max-width: 1280px; margin: 0 auto; padding: 20px 28px 0; }
.s-notice { display: flex; gap: 14px; align-items: flex-start; background: var(--s-soft, #eef0ff); border: 1px solid #c7d2fe; border-radius: var(--s-radius); padding: 16px 18px; }
.s-notice-icon { margin-top: 2px; flex: none; }
.s-notice-text { flex: 1 1 auto; min-width: 0; }
.s-notice-title { font-weight: 700; font-size: 1.08rem; margin-bottom: 4px; }
.s-notice-body { white-space: pre-line; line-height: 1.55; }
.s-notice-close { flex: none; }
@media (max-width: 640px) { .s-notice { flex-wrap: wrap; } .s-notice-wrap { padding: 14px 14px 0; } }
.s-preview { white-space: pre-wrap; font-size: 0.98rem; line-height: 1.55; background: #f8f9fc; border: 1px solid var(--s-line); border-radius: 12px; padding: 14px 16px; }

/* Sign-up: the hidden field bots fill in (off the screen, never seen by people) */
.s-trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
/* The check that a person is signing up (ALTCHA widget, served from this app) */
altcha-widget { display: block; max-width: 360px; --altcha-max-width: 360px; }
