/*
  Accounting System console.

  The tokens, the Mica recipe, and the motion vocabulary come from the IAGD
  SuperApp stylesheet (Frontend/src/app/globals.css). Nothing here reinvents
  the brand; it ports it to a desktop console.

  Motion rule for this surface: every entrance is a pop. Nothing fades in and
  nothing fades out.
*/

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/inter-400.ttf") format("truetype");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/inter-500.ttf") format("truetype");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/inter-600.ttf") format("truetype");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/inter-700.ttf") format("truetype");
}

:root {
    /* Base, the Mica fallback colour. */
    --base: #1a1340;
    --base-alt: #14102f;
    --surface: #100c26;

    /* Content layers per the WinUI layering guidance. */
    --layer: rgba(255, 255, 255, 0.04);
    --layer-soft: rgba(255, 255, 255, 0.06);
    --layer-alt: rgba(255, 255, 255, 0.08);

    /*
      No container draws a white outline. A panel reads as a plane because its
      fill is darker than the page and it casts a shadow, not because a bright
      hairline traces its edge.

      --stroke is a divider inside a surface, never a border around one.
      --stroke-strong is a control edge, and it carries the brand violet so it
      never reads as a grey operating-system box.
    */
    --stroke: rgba(160, 130, 255, 0.09);
    --stroke-strong: rgba(150, 118, 245, 0.24);
    --stroke-accent: rgba(124, 58, 237, 0.48);
    --lift: 0 1px 2px rgba(4, 2, 14, 0.5), 0 10px 30px rgba(4, 2, 14, 0.35);
    --lift-high: 0 30px 80px rgba(4, 2, 14, 0.7), 0 2px 6px rgba(4, 2, 14, 0.5);

    --text: #ffffff;
    --dim-1: rgba(220, 210, 255, 0.75);
    --dim-2: rgba(220, 210, 255, 0.5);

    --accent: #7c3aed;
    --accent-soft: rgba(124, 58, 237, 0.18);
    --accent-deep: #5b21b6;
    --accent-text: #c4a8ff;

    --gold: #e6c97a;
    --gold-deep: #b8995a;

    --good: #34d399;
    --good-soft: rgba(52, 211, 153, 0.16);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.16);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.16);

    --radius-card: 8px;

    --font-sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    --font-mono: "Cascadia Code", Consolas, "Courier New", monospace;

    --ease-fluent: cubic-bezier(0.1, 0.9, 0.2, 1);
    --ease-fluent-out: cubic-bezier(0.33, 0, 0.1, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-spring-soft: cubic-bezier(0.34, 1.2, 0.64, 1);

    --rail: 236px;

    /* One height for every control. A text input, a date input, a select and a
       button must line up to the pixel when they share a filter bar. */
    --control-h: 38px;
    --control-h-sm: 32px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/*
  The hidden attribute means hidden. The browser sets display:none for it at
  the lowest weight, so any later rule that sets display on the same element,
  for example a flex row in the palette, silently defeats it.
*/
[hidden] { display: none !important; }

html {
    /* Reserve the scrollbar track on every page. Without it a short page and a
       long page render the content at two different widths, and the whole
       layout jumps sideways on each navigation. */
    scrollbar-gutter: stable;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--base);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Wallpaper tint, sampled once, never animated. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(80% 60% at 15% 0%, rgba(124, 58, 237, 0.18), transparent 70%),
        radial-gradient(60% 50% at 100% 100%, rgba(34, 211, 238, 0.06), transparent 70%);
}

/* Mica film grain. A 128px tile, pinned, never scrolls with the content. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: url("../textures/noise.png");
    background-repeat: repeat;
    background-size: 128px 128px;
    opacity: 0.05;
}

/* A panel carries its own grain, because it sits above the body overlay. */
.mica {
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(16, 12, 38, 0.92), rgba(16, 12, 38, 0.92)),
        url("../textures/noise.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 128px 128px;
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Every inline icon is 16px. Without this an SVG with no width falls back to
   the 300x150 replaced-element default and swamps its button. */
.ico {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    opacity: 0.85;
}

a {
    color: var(--accent-text);
    text-decoration: none;
}

a:hover {
    color: var(--text);
}

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.015em;
}

h1 { font-size: 21px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }

/*
  No last line holds one word. A heading balances its lines, and running text
  pulls a word down instead of stranding one. A table cell wraps the same way,
  because a client name and an address both land in one.
*/
h1, h2, h3, h4 { text-wrap: balance; }
p, td, th, dd, li { text-wrap: pretty; }

/* ---------------------------------------------------------------- Motion */

/*
  One entrance shape for this console: a pop. Opacity pairs with scale so an
  element lands instead of dissolving. There is no fade-in and no fade-out.
*/
@keyframes accPopIn {
    from {
        opacity: 0;
        transform: translate3d(0, 8px, 0) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes accPopOverlay {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes accPopRow {
    from {
        opacity: 0;
        transform: scale(0.985);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes accSpin {
    to { transform: rotate(360deg); }
}

.pop {
    animation: accPopIn 260ms var(--ease-spring-soft) both;
}

.pop-fast {
    animation: accPopIn 180ms var(--ease-spring-soft) both;
}

.stagger > :nth-child(1) { animation-delay: 0ms; }
.stagger > :nth-child(2) { animation-delay: 40ms; }
.stagger > :nth-child(3) { animation-delay: 80ms; }
.stagger > :nth-child(4) { animation-delay: 120ms; }
.stagger > :nth-child(5) { animation-delay: 160ms; }
.stagger > :nth-child(6) { animation-delay: 200ms; }
.stagger > :nth-child(7) { animation-delay: 240ms; }
.stagger > :nth-child(n + 8) { animation-delay: 280ms; }

@media (prefers-reduced-motion: reduce) {
    .pop,
    .pop-fast {
        animation: none !important;
    }
    .stagger > * {
        animation-delay: 0ms !important;
    }
    body::after {
        opacity: 0.025;
    }
}

/* ----------------------------------------------------------------- Shell */

.shell {
    position: relative;
    z-index: 2;
    display: flex;
    min-height: 100vh;
}

.rail {
    width: var(--rail);
    flex: 0 0 var(--rail);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--stroke);
    background: var(--base-alt);
    overflow: hidden;
}

/* The brand and the footer stay put; only the link list scrolls. The list also
   reserves its scrollbar track, so the links never shift left and right as the
   bar appears and disappears. */
.rail-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-bottom: 10px;
}

.rail-brand {
    flex: 0 0 auto;
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--stroke);
}

.rail-brand .mark {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
}

.rail-brand .mark img {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
}

.rail-brand .mark-text { min-width: 0; }

.rail-brand .mark b {
    display: block;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text);
}

.rail-brand .sub {
    display: block;
    margin-top: 1px;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dim-2);
}

.rail-group {
    padding: 16px 16px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--dim-2);
}

.rail nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    margin: 1px 10px;
    border-radius: 6px;
    color: var(--dim-1);
    font-size: 14px;
    transition:
        background 160ms var(--ease-fluent),
        color 160ms var(--ease-fluent),
        transform 160ms var(--ease-spring-soft);
}

.rail nav a:hover {
    background: var(--layer);
    color: var(--text);
    transform: translateX(2px);
}

.rail nav a.on {
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 600;
}

.rail nav a.on::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    width: 3px;
    height: 18px;
    margin-top: -9px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.rail nav a .count {
    margin-left: auto;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--dim-2);
}

.rail-foot {
    flex: 0 0 auto;
    padding: 14px 16px;
    border-top: 1px solid var(--stroke);
    font-size: 12px;
    color: var(--dim-2);
    background: var(--base-alt);
}

.rail-foot strong {
    display: block;
    color: var(--dim-1);
    font-weight: 600;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 26px;
    border-bottom: 1px solid var(--stroke);
    background: rgba(20, 16, 47, 0.86);
    backdrop-filter: blur(14px);
}

.topbar .grow { flex: 1; min-width: 0; }

.topbar .crumb {
    font-size: 12px;
    color: var(--dim-2);
    margin-bottom: 2px;
}

/* Every control in the topbar is one height, whatever size class a page
   happened to pass. A row of buttons at three heights reads as broken. */
.topbar .btn,
.topbar input,
.topbar select { height: 34px; }

.topbar .btn-sm { font-size: 13px; }

/* The sign-out control is destructive, so it sits past a hairline instead of
   next to the page actions where a mis-click costs the operator their work. */
.topbar .sign-out {
    display: flex;
    align-items: center;
    padding-left: 12px;
    margin-left: 2px;
    border-left: 1px solid var(--stroke);
}

.topbar .sign-out .btn:hover {
    background: var(--bad-soft);
    border-color: transparent;
    color: var(--bad);
}

.topbar .sign-out .btn:hover .ico { opacity: 1; }

.content {
    padding: 24px 26px 60px;
    width: 100%;
    max-width: 1480px;
}

/* -------------------------------------------------------------- Surfaces */

/* No outline. The panel sits darker than the page and casts a shadow, which
   is what separates it from the background. */
.panel {
    border: 0;
    border-radius: var(--radius-card);
    box-shadow: var(--lift);
    margin-bottom: 18px;
    overflow: hidden;
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(16, 12, 38, 0.92), rgba(16, 12, 38, 0.92)),
        url("../textures/noise.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 128px 128px;
}

/* The one panel that does draw an edge, because it marks a state the operator
   has to notice. It is violet, not white. */
.panel-accent {
    box-shadow: var(--lift), inset 0 0 0 1px var(--stroke-accent);
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--stroke);
}

.panel-head .grow { flex: 1; min-width: 0; }

.panel-head .btn { flex: 0 0 auto; }

/* A filter box that lives in a panel header. It is narrower than a form field
   and it never stretches the header. The selector names the input type so it
   outranks the width rule on the base control. */
.panel-head input.filter-box,
.filter-box {
    width: 230px;
    max-width: 40vw;
    height: var(--control-h-sm);
    flex: 0 0 auto;
    font-size: 13px;
    line-height: calc(var(--control-h-sm) - 2px);
}

.filter-empty {
    padding: 34px 18px;
    text-align: center;
    color: var(--dim-2);
    font-size: 13px;
    border-top: 1px solid var(--stroke);
}

/* An inactive row states its own status; it does not need a badge in every
   other row to make the point. */
table.data tbody tr.off td:not(.act) { opacity: 0.55; }

.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }

.dim {
    color: var(--dim-2);
    font-size: 13px;
}

.hint {
    color: var(--dim-2);
    font-size: 12px;
    margin-top: 5px;
}

.hint.file-note { color: var(--accent-text); }
.hint[hidden] { display: none; }

/* One card level only. A stat is a flat cell inside the panel. */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
}

.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat {
    padding: 15px 18px;
    border-right: 1px solid var(--stroke);
    border-bottom: 1px solid var(--stroke);
}

.stat:last-child { border-right: 0; }
.stats-4 .stat:nth-child(4n) { border-right: 0; }
.stats-3 .stat:nth-child(3n) { border-right: 0; }

.stat dt {
    margin: 0 0 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dim-2);
}

.stat dd {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.stat dd.sm { font-size: 14px; font-weight: 500; }
.stat dd.good { color: var(--good); }
.stat dd.warn { color: var(--warn); }
.stat dd.bad { color: var(--bad); }

.stat .delta {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: var(--dim-2);
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Tables */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.data th,
table.data td {
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--stroke);
    vertical-align: middle;
}

table.data th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--base-alt);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dim-2);
    white-space: nowrap;
}

table.data th a {
    color: inherit;
}

table.data th a:hover {
    color: var(--accent-text);
}

table.data tbody tr {
    animation: accPopRow 200ms var(--ease-fluent-out) both;
    transition: background 140ms var(--ease-fluent);
}

table.data tbody tr:hover {
    background: var(--layer);
}

table.data td.num,
table.data th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.data td.mono {
    font-family: var(--font-mono);
    font-size: 12.5px;
}

/* The row action column. It hugs the right edge, never wraps, and holds its
   controls in one group so a link and a button do not sit at two heights. */
table.data th.act,
table.data td.act {
    width: 1%;
    text-align: right;
    white-space: nowrap;
    padding-right: 16px;
}

/* The control sets the row height here, so the cell adds almost no padding of
   its own. Otherwise a list of fifty rows grows by half a screen. */
table.data td.act { padding-top: 4px; padding-bottom: 4px; }

table.data td.act > * { vertical-align: middle; }

/* The controls stay on one line. A wrapped pair doubles the row height and
   turns a flat list into a ladder. */
table.data td.act .btn-group {
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

/* Row controls stay quiet until the row is under the pointer, so a long list
   is not fifty competing buttons. Keyboard focus reveals them too. */
table.data td.act .btn {
    opacity: 0.55;
    transition: opacity 140ms var(--ease-fluent), background 140ms var(--ease-fluent);
}

table.data tbody tr:hover td.act .btn,
table.data td.act .btn:focus-visible { opacity: 1; }

/* A chart of accounts is a tree. The code column carries the indent so the
   parent and its children read as a hierarchy, not as a flat list. */
table.data td .depth-1 { padding-left: 16px; display: inline-block; }
table.data td .depth-2 { padding-left: 32px; display: inline-block; }

table.data tfoot td {
    background: var(--layer);
    font-weight: 600;
    border-top: 1px solid var(--stroke-strong);
    border-bottom: 0;
}

/* ------------------------------------------------- Line editing tables */

/*
  A document is typed line by line, so the controls have to sit tight and the
  numeric columns have to line up with the totals under them. A control in a
  line row is shorter than a control in a form panel.
*/
table.lines td { padding: 6px 10px; }
table.lines th { padding: 8px 10px; }

table.lines td input,
table.lines td select {
    height: var(--control-h-sm);
    font-size: 13px;
    line-height: calc(var(--control-h-sm) - 2px);
}

table.lines td select { background-position: right 8px center; padding-right: 28px; }

/* Amounts, quantities and totals share one right edge down the column. */
table.lines td.num input,
table.lines input.money { text-align: right; }

table.lines td.line-total {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* The remove control keeps its cell exactly as wide as the button, so the
   money column above the totals does not drift. */
table.lines th.drop,
table.lines td.drop {
    width: 44px;
    padding-left: 0;
    padding-right: 10px;
    text-align: right;
}

table.lines td.drop .btn {
    color: var(--dim-2);
    opacity: 0.7;
}

table.lines td.drop .btn:hover {
    background: var(--bad-soft);
    border-color: transparent;
    color: var(--bad);
    opacity: 1;
}

/* A row that is the only row cannot be removed, and the control says so. */
table.lines tbody tr:only-child td.drop .btn { opacity: 0.25; pointer-events: none; }

table.lines tfoot td.label {
    text-align: right;
    color: var(--dim-1);
    font-weight: 500;
}

table.lines tfoot tr:last-child td { font-size: 15px; }
table.lines tfoot tr:last-child td.label { color: var(--text); font-weight: 600; }

/* The running debit and credit check on a journal entry. */
.balance-flag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
}

.balance-flag .badge { font-variant-numeric: tabular-nums; }

table.data tr.sub td {
    background: rgba(255, 255, 255, 0.02);
    font-size: 12.5px;
    color: var(--dim-1);
}

/* The type selector in "table.data td" outranks a bare .empty class, so the
   empty cell has to name the table to win its own padding back. */
table.data td.empty,
.empty {
    padding: 46px 18px;
    text-align: center;
    color: var(--dim-2);
    font-size: 13px;
}

table.data tbody tr:hover td.empty { background: transparent; }

.empty strong {
    display: block;
    color: var(--dim-1);
    font-size: 14.5px;
    font-weight: 600;
    margin-bottom: 5px;
}

.empty .btn { margin-top: 14px; }

/* ----------------------------------------------------------------- Forms */

.field { margin-bottom: 13px; }

.field > label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--dim-1);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="month"],
input[type="number"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    height: var(--control-h);
    padding: 0 11px;
    border: 1px solid var(--stroke-strong);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    line-height: calc(var(--control-h) - 2px);
    transition:
        border-color 140ms var(--ease-fluent),
        background 140ms var(--ease-fluent),
        box-shadow 140ms var(--ease-fluent);
}

input::placeholder,
textarea::placeholder { color: var(--dim-2); }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input:hover:not(:focus):not([disabled]),
select:hover:not(:focus):not([disabled]),
textarea:hover:not(:focus) { border-color: var(--stroke-accent); }

input[disabled],
select[disabled],
textarea[disabled] {
    color: var(--dim-2);
    background: rgba(255, 255, 255, 0.015);
    cursor: not-allowed;
}

/* The native select paints an operating-system arrow that ignores the theme.
   Draw our own chevron instead and keep room for it on the right. */
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9a8ee' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px 15px;
    cursor: pointer;
}

select option { background: var(--surface); color: var(--text); }
select option:disabled { color: var(--dim-2); }

textarea {
    height: auto;
    min-height: 74px;
    padding: 9px 11px;
    line-height: 1.5;
    resize: vertical;
}

/* The date field: keep the picker button, tint it to the theme, and stop the
   grey placeholder text from reading as a filled value. */
input[type="date"],
input[type="month"] { padding-right: 8px; }

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.45;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: opacity 140ms var(--ease-fluent), background 140ms var(--ease-fluent);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.12);
}

input[type="date"]::-webkit-datetime-edit { color: var(--text); }
input[type="date"]:invalid::-webkit-datetime-edit { color: var(--dim-2); }

/* The file field: the browser button is grey and unstyleable as a whole, so
   the button half is restyled and the rest carries our own border. */
input[type="file"] {
    padding: 0;
    line-height: normal;
    display: flex;
    align-items: center;
    font-size: 12.5px;
    color: var(--dim-1);
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    height: calc(var(--control-h) - 2px);
    margin-right: 11px;
    padding: 0 13px;
    border: 0;
    border-right: 1px solid var(--stroke-strong);
    border-radius: 5px 0 0 5px;
    background: var(--layer-soft);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 140ms var(--ease-fluent);
}

input[type="file"]::file-selector-button:hover { background: var(--layer-alt); }

/* The clear control on a search field is drawn white by the browser. Keep the
   affordance, draw it in the theme. */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    cursor: pointer;
    opacity: 0.45;
    background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dcd2ff' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / 13px 13px no-repeat;
}

input[type="search"]::-webkit-search-cancel-button:hover { opacity: 0.95; }

input.money,
input[type="number"] {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Chrome paints a spinner on a number field that steals width and never gets
   used for a money amount. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] { -moz-appearance: textfield; }

.row {
    display: grid;
    gap: 13px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    align-items: start;
}

.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* A field that should take the rest of its grid row rather than sit in a
   narrow column: a description, a memo, an address. */
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

/* A date needs about half the width of a name. Without this the grid hands it
   the same track as every other field and it reads as a text box. */
.row .field.narrow { max-width: 190px; }

.bar {
    display: flex;
    gap: 9px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.bar .field { margin-bottom: 0; }

/* Every direct child of a filter bar shares one height, so the bottoms line up
   whether the child is an input, a select, a button or a download link. */
.bar > .btn,
.bar > a.btn,
.bar > button { height: var(--control-h); }

.bar .sep {
    align-self: stretch;
    width: 1px;
    margin: 0 4px;
    background: var(--stroke);
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--dim-1);
    cursor: pointer;
}

/*
  The native box paints an operating-system square that ignores the theme, and
  accent-color only tints the checked state. Draw the whole control instead.
  The tick pops in, in line with the motion rule for this console.
*/
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    display: inline-grid;
    place-content: center;
    border: 1px solid var(--stroke-strong);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition:
        background 140ms var(--ease-fluent),
        border-color 140ms var(--ease-fluent),
        box-shadow 140ms var(--ease-fluent);
}

input[type="radio"] { border-radius: 50%; }

input[type="checkbox"]::before,
input[type="radio"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    background: #fff;
    transition: transform 140ms var(--ease-spring);
}

input[type="checkbox"]::before {
    clip-path: polygon(14% 47%, 0 61%, 39% 100%, 100% 22%, 85% 8%, 38% 71%);
}

input[type="radio"]::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before { transform: scale(1); }

input[type="checkbox"]:hover:not(:checked),
input[type="radio"]:hover:not(:checked) { border-color: var(--stroke-accent); }

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: var(--control-h);
    padding: 0 14px;
    border: 1px solid var(--stroke-strong);
    border-radius: 6px;
    background: var(--layer-soft);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 140ms var(--ease-fluent),
        border-color 140ms var(--ease-fluent),
        transform 140ms var(--ease-spring);
}

.btn:hover {
    background: var(--layer-alt);
    border-color: var(--stroke-accent);
    color: var(--text);
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-deep);
    border-color: var(--accent-deep);
}

.btn-gold {
    background: linear-gradient(180deg, var(--gold), var(--gold-deep));
    border-color: var(--gold-deep);
    color: #241a05;
}

.btn-danger {
    background: var(--bad-soft);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--bad);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--dim-1);
}

.btn-ghost:hover { background: var(--layer); }

.btn-sm { height: var(--control-h-sm); padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-sm.btn-icon { width: var(--control-h-sm); }

/* A disabled control must not keep the accent fill. A greyed violet button
   still reads as the thing to press. */
.btn[disabled],
.btn[aria-disabled="true"] {
    background: var(--layer);
    border-color: var(--stroke);
    color: var(--dim-2);
    cursor: not-allowed;
    transform: none;
}

.btn[disabled]:hover { background: var(--layer); border-color: var(--stroke); }
.btn[disabled] .ico { opacity: 0.4; }

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid var(--stroke);
    background: var(--layer);
    color: var(--dim-1);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge-gold { background: rgba(230, 201, 122, 0.16); color: var(--gold); border-color: transparent; }

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.alert {
    padding: 11px 14px;
    border-radius: 6px;
    border: 1px solid var(--stroke);
    margin-bottom: 16px;
    font-size: 13.5px;
    animation: accPopIn 240ms var(--ease-spring-soft) both;
}

.alert-good { background: var(--good-soft); border-color: transparent; color: var(--good); }
.alert-bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------------------------------------------- Toast and overlays */

.toasts {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
}

.toast {
    padding: 12px 15px;
    border: 0;
    border-radius: var(--radius-card);
    box-shadow: 0 18px 44px rgba(6, 3, 18, 0.6), 0 2px 5px rgba(4, 2, 14, 0.5);
    font-size: 13.5px;
    animation: accPopIn 240ms var(--ease-spring) both;
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(16, 12, 38, 0.94), rgba(16, 12, 38, 0.94)),
        url("../textures/noise.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 128px 128px;
}

.toast strong { display: block; margin-bottom: 2px; }
.toast-good { border-left: 3px solid var(--good); }
.toast-bad { border-left: 3px solid var(--bad); }

/* A dialog pops. The backdrop appears at once, with no fade. */
dialog.sheet {
    padding: 0;
    border: 0;
    border-radius: 10px;
    box-shadow: var(--lift-high);
    color: var(--text);
    width: min(760px, calc(100vw - 48px));
    max-height: calc(100vh - 80px);
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(16, 12, 38, 0.94), rgba(16, 12, 38, 0.94)),
        url("../textures/noise.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 128px 128px;
}

dialog.sheet[open] {
    animation: accPopOverlay 200ms var(--ease-spring-soft) both;
}

dialog.sheet::backdrop {
    background: rgba(6, 3, 18, 0.62);
}

dialog.sheet .panel-head { position: sticky; top: 0; }

dialog.sheet .sheet-body {
    padding: 18px;
    overflow-y: auto;
    max-height: calc(100vh - 210px);
}

dialog.sheet .sheet-foot {
    display: flex;
    gap: 9px;
    justify-content: flex-end;
    padding: 13px 18px;
    border-top: 1px solid var(--stroke);
}

dialog.sheet.narrow { width: min(460px, calc(100vw - 48px)); }

/* Command palette. */
dialog.palette {
    width: min(560px, calc(100vw - 48px));
    margin-top: 12vh;
}

.palette-input {
    border: 0;
    border-bottom: 1px solid var(--stroke);
    border-radius: 0;
    background: transparent;
    padding: 15px 18px;
    font-size: 15px;
}

.palette-input:focus {
    box-shadow: none;
    border-color: var(--stroke-accent);
    background: transparent;
}

.palette-list {
    max-height: 46vh;
    overflow-y: auto;
    padding: 6px;
}

.palette-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--dim-1);
    font-size: 13.5px;
}

.palette-list a:hover,
.palette-list a.on {
    background: var(--accent-soft);
    color: var(--text);
}

.palette-list a .where {
    margin-left: auto;
    font-size: 11px;
    color: var(--dim-2);
}

.palette-foot {
    padding: 9px 14px;
    border-top: 1px solid var(--stroke);
    font-size: 11.5px;
    color: var(--dim-2);
}

kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--stroke-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--layer);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dim-1);
}

/* ------------------------------------------------------------------ Help */

.help-lead {
    margin: 0 0 18px;
    font-size: 14px;
    color: var(--dim-1);
}

.help-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--stroke);
}

.help-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dim-2);
}

#helpSheet table.data td:first-child {
    width: 130px;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ Tour */

/*
  The guided tour. One spotlight box dims the whole page through a very large
  shadow spread, and one card carries the wording. Both move from step to step
  instead of being rebuilt, so the tour costs two elements in total.
*/
.tour {
    position: fixed;
    inset: 0;
    z-index: 120;
}

/* The page must not scroll under the tour. The spotlight is measured in
   viewport coordinates, and a stray scroll would leave it behind. */
body.tour-open { overflow: hidden; }

.tour-spot {
    position: absolute;
    border-radius: 8px;
    box-shadow:
        0 0 0 9999px rgba(6, 3, 18, 0.74),
        inset 0 0 0 2px var(--accent);
    transition:
        top 220ms var(--ease-fluent),
        left 220ms var(--ease-fluent),
        width 220ms var(--ease-fluent),
        height 220ms var(--ease-fluent);
}

.tour-card {
    position: absolute;
    width: min(360px, calc(100vw - 24px));
    padding: 16px 18px 14px;
    border-radius: 10px;
    box-shadow: var(--lift-high);
    animation: accPopIn 200ms var(--ease-spring-soft) both;
    background-color: var(--base-alt);
    background-image:
        linear-gradient(rgba(20, 16, 47, 0.96), rgba(20, 16, 47, 0.96)),
        url("../textures/noise.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 128px 128px;
}

.tour-count {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-text);
}

.tour-card h3 {
    margin: 5px 0 6px;
    font-size: 15.5px;
}

.tour-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--dim-1);
}

.tour-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

@media (prefers-reduced-motion: reduce) {
    .tour-spot { transition: none; }
    .tour-card { animation: none; }
}

/* ------------------------------------------------------------ Data shapes */

/* A horizontal magnitude bar inside a table cell. No chart library. */
.meter {
    position: relative;
    height: 5px;
    border-radius: 3px;
    background: var(--layer-alt);
    overflow: hidden;
    min-width: 70px;
}

.meter > span {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 3px;
    background: var(--accent);
}

/* A bar with its figure beside it, on one line. Stacking the percentage under
   the bar makes the row twice as tall for one number. */
.meter-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.meter-row .meter { flex: 1; }

.meter-row b {
    flex: 0 0 auto;
    min-width: 34px;
    text-align: right;
    font-size: 11.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--dim-2);
}

.meter.good > span { background: var(--good); }
.meter.bad > span { background: var(--bad); }
.meter.gold > span { background: var(--gold); }

/*
  A month column chart drawn with boxes. It carries a scale on the left and
  gridlines behind the bars, because a bar with nothing to measure it against
  states no figure at all.
*/
.chart {
    --plot-h: 132px;
    --axis-h: 20px;
    display: flex;
    gap: 12px;
}

.chart-y {
    flex: 0 0 auto;
    height: calc(var(--plot-h) + var(--axis-h));
    padding-bottom: var(--axis-h);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: var(--dim-2);
}

.chart-y span { transform: translateY(-50%); }
.chart-y span:last-child { transform: translateY(50%); }

.chart-plot {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.chart-lines {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: var(--axis-h);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.chart-lines i { height: 1px; background: var(--stroke); }
.chart-lines i:last-child { background: var(--stroke-strong); }

.chart .col {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 5px 5px 0 0;
    transition: background 140ms var(--ease-fluent);
}

.chart .col:hover { background: rgba(255, 255, 255, 0.03); }

/* Two bars side by side, so money in and money out compare directly. A stacked
   pair would read as one total and hide the comparison. */
.chart .col .bars {
    height: var(--plot-h);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.chart .col i {
    display: block;
    width: 30%;
    max-width: 20px;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    animation: accPopIn 320ms var(--ease-spring-soft) both;
}

.chart .col .in { background: var(--accent); }
.chart .col .out { background: rgba(248, 113, 113, 0.6); }

.chart .col b {
    height: var(--axis-h);
    line-height: var(--axis-h);
    font-size: 10.5px;
    font-weight: 500;
    text-align: center;
    color: var(--dim-2);
}

.chart .col:hover b { color: var(--dim-1); }

/* The read-out sits above the hovered column instead of in a native tooltip,
   which takes a second to appear and lands wherever the pointer is. */
.chart .col .read {
    position: absolute;
    left: 50%;
    top: 4px;
    transform: translateX(-50%) scale(0.94);
    z-index: 4;
    padding: 6px 9px;
    border: 1px solid var(--stroke-strong);
    border-radius: 6px;
    background: var(--base-alt);
    box-shadow: 0 10px 26px rgba(4, 2, 14, 0.55);
    font-size: 11px;
    line-height: 1.45;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    visibility: hidden;
    opacity: 0;
}

.chart .col:hover .read {
    visibility: visible;
    animation: accPopIn 160ms var(--ease-spring-soft) both;
}

.chart .col .read s { text-decoration: none; color: var(--dim-2); }

.legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--dim-2);
}

.legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: -1px;
}

/* -------------------------------------------------------------- Utilities */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--stroke);
    padding: 0 18px;
}

.tabs a {
    padding: 10px 13px;
    border-bottom: 2px solid transparent;
    color: var(--dim-2);
    font-size: 13.5px;
    font-weight: 600;
}

.tabs a.on {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.split {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    align-items: start;
}

.loader {
    padding: 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--dim-2);
}

.loader[hidden] { display: none; }

.spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid var(--stroke-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: accSpin 700ms linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }

/* A label a screen reader announces and the eye never sees. Used on an action
   column header, which has no visible title but still needs a name. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Truncate a long name in a fixed table cell instead of letting it push the
   money column off the right edge. */
.clip {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------ Searchable select */

/* A dropdown you can type into. The native select keeps the value and the
   form posts it, so this layer only draws and filters. */
.combo { position: relative; }

.combo-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.combo-trigger {
    display: block;
    width: 100%;
    height: var(--control-h);
    padding: 0 32px 0 11px;
    border: 1px solid var(--stroke-strong);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9a8ee' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px 15px;
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    line-height: calc(var(--control-h) - 2px);
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    transition:
        border-color 140ms var(--ease-fluent),
        background-color 140ms var(--ease-fluent),
        box-shadow 140ms var(--ease-fluent);
}

.combo-trigger.is-empty { color: var(--dim-2); }
.combo-trigger:hover { border-color: var(--stroke-accent); }

.combo-trigger:focus-visible,
.combo-trigger[aria-expanded="true"] {
    outline: none;
    border-color: var(--accent);
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.combo-pop {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    min-width: 220px;
    padding: 6px;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--lift);
    animation: accPopIn 140ms var(--ease-spring-soft) both;
}

.combo-pop[hidden] { display: none !important; }

.combo-search {
    height: var(--control-h-sm) !important;
    line-height: calc(var(--control-h-sm) - 2px) !important;
    margin-bottom: 6px;
}

.combo-list {
    max-height: 244px;
    overflow-y: auto;
}

.combo-option {
    display: block;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.combo-option[hidden] { display: none !important; }

.combo-empty {
    padding: 10px 9px;
    font-size: 12.5px;
    color: var(--dim-2);
}

.combo-empty[hidden] { display: none !important; }
.combo-option.on { color: var(--accent-text); }

.combo-option.at,
.combo-option:hover { background: rgba(255, 255, 255, 0.06); }

/* A short fixed choice reads as a row of radios, never as a dropdown. */
.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    min-height: var(--control-h);
    align-items: center;
}

.choices .check { margin: 0; }

/* ----------------------------------------------------------- Sign-in page */

.signin {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.signin-card {
    width: 100%;
    max-width: 386px;
    padding: 30px;
    border: 0;
    border-radius: 12px;
    box-shadow: var(--lift-high);
    animation: accPopIn 320ms var(--ease-spring-soft) both;
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(16, 12, 38, 0.92), rgba(16, 12, 38, 0.92)),
        url("../textures/noise.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 128px 128px;
}

.signin-mark {
    display: block;
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
}

.signin-card .mark {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.signin-card .dim { margin: 4px 0 22px; }

/* ------------------------------------------------------------- Responsive */

@media (max-width: 1180px) {
    .split { grid-template-columns: minmax(0, 1fr); }
    .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-4 .stat:nth-child(4n) { border-right: 1px solid var(--stroke); }
    .stats-4 .stat:nth-child(2n) { border-right: 0; }
}

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .rail {
        width: 100%;
        flex: none;
        height: auto;
        position: static;
        border-right: 0;
        border-bottom: 1px solid var(--stroke);
    }
    .rail nav { display: flex; flex-wrap: wrap; }
    .rail-group { width: 100%; }
    .content { padding: 16px; }
    .stats-4,
    .stats-3 { grid-template-columns: 1fr; }
    .stat { border-right: 0 !important; }
}
