/* Ledger — one stylesheet, no framework. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --brand-800: #0a403c;
  --brand-700: #0c524d;
  --brand-600: #0f645e;
  --brand-500: #157a72;
  --brand-100: #d4ebe8;
  --brand-50: #eef7f6;

  --gray-25: #fcfcfd;
  --gray-50: #f8f9fb;
  --gray-100: #f1f3f6;
  --gray-150: #eaedf1;
  --gray-200: #e3e6eb;
  --gray-300: #cfd4dc;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #101828;

  --ok: #067647;   --ok-bg: #ecfdf3;   --ok-line: #abefc6;
  --warn: #b54708; --warn-bg: #fffaeb; --warn-line: #fedf89;
  --bad: #b42318;  --bad-bg: #fef3f2;  --bad-line: #fecdca;
  --info: #175cd3; --info-bg: #eff8ff; --info-line: #b2ddff;

  --radius: 10px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --ring: 0 0 0 3px rgba(21, 122, 114, .18);
  --sidebar-w: 252px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--gray-50);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-800); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; color: var(--gray-900); letter-spacing: -.011em; }
h1 { font-size: 22px; font-weight: 650; line-height: 1.3; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13.5px; font-weight: 600; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--gray-200); margin: 20px 0; }
.icon { flex: none; vertical-align: -3px; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, #fff 0, #fff calc(var(--sidebar-w) - 1px), var(--gray-200) calc(var(--sidebar-w) - 1px), var(--gray-200) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px; background: #fff; border-right: 1px solid var(--gray-200);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: var(--gray-900); font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; color: var(--gray-900); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-600); display: grid; place-items: center; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.brand-mark svg { display: block; }
.brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--gray-500); letter-spacing: 0; }

.switcher { position: relative; margin: 0 0 8px; }
.switcher > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--gray-25);
  box-shadow: var(--shadow-xs);
}
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > summary:hover { border-color: var(--gray-300); background: #fff; }
.switcher .co-badge { width: 28px; height: 28px; border-radius: 7px; background: var(--gray-100); color: var(--gray-700); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; flex: none; }
.switcher .co-text { min-width: 0; flex: 1; }
.switcher .co-name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher .co-meta { display: block; font-size: 11.5px; color: var(--gray-500); }
.switcher-menu {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.switcher-menu a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 7px; color: var(--gray-800); }
.switcher-menu a:hover { background: var(--gray-100); text-decoration: none; }
.switcher-menu a.current { background: var(--brand-50); }
.switcher-menu .divider { height: 1px; background: var(--gray-150); margin: 6px 2px; }

.nav { display: grid; gap: 2px; }
.nav-label { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--gray-700); font-weight: 520; font-size: 13.5px;
}
.nav a .icon { color: var(--gray-400); }
.nav a:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.nav a.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav a.active .icon { color: var(--brand-600); }
.nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 999px; padding: 0 7px; line-height: 18px; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--gray-150); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; color: var(--gray-800); }
.me:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.avatar { width: 30px; height: 30px; border-radius: 999px; background: var(--brand-100); color: var(--brand-800); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; }
.me-text { min-width: 0; }
.me-name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { display: block; font-size: 11.5px; color: var(--gray-500); }
.signout { margin: 2px 0 0; }
.signout button { width: 100%; justify-content: flex-start; color: var(--gray-600); }

.main { padding: 28px 40px 72px; min-width: 0; }
.container { max-width: 1240px; margin: 0 auto; }
.container.narrow { max-width: 760px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { margin-top: 4px; color: var(--gray-500); font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions form.row { flex-wrap: nowrap; }
.page-actions input[type=date] { width: 158px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--gray-500); margin-bottom: 6px; }
.crumbs a { color: var(--gray-500); }
.crumbs a:hover { color: var(--gray-800); }

/* ---------------------------------------------------------------- cards */
.card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card + .card { margin-top: 16px; }
.stats > .card, .co-grid > .card, .split > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--gray-150); }
.card-head .sub { font-size: 12.5px; color: var(--gray-500); margin-top: 2px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--gray-150); background: var(--gray-25); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.section-gap { margin-top: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--gray-500); font-weight: 520; }
.stat .value { margin-top: 6px; font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .value .ccy { font-size: 13px; font-weight: 600; color: var(--gray-400); margin-left: 4px; letter-spacing: 0; }
.stat .hint { margin-top: 2px; font-size: 12px; color: var(--gray-500); }
.value.neg, .neg { color: var(--bad); }

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

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .045em;
  padding: 9px 14px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
.table thead tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }
.card > .table-wrap:first-child .table th, .card > .table:first-child th { border-top: 0; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table tr.clickable { cursor: pointer; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.table .total td { font-weight: 650; background: var(--gray-25); border-top: 1px solid var(--gray-300); border-bottom: 0; }
.table .group td { background: var(--gray-50); font-weight: 600; color: var(--gray-700); font-size: 12.5px; padding-top: 8px; padding-bottom: 8px; }
.table .muted td, td.muted { color: var(--gray-500); }
.table td.code { font-variant-numeric: tabular-nums; color: var(--gray-600); width: 90px; }
.table td.actions { text-align: right; white-space: nowrap; width: 1%; }
.table .fx { display: block; font-size: 11.5px; color: var(--gray-500); }
.table.compact td { padding: 7px 12px; }
.row-link { color: var(--gray-900); font-weight: 520; }
.row-link:hover { color: var(--brand-700); }

/* reports */
.report { width: 100%; border-collapse: collapse; }
.report td { padding: 7px 18px; border-bottom: 1px solid var(--gray-100); }
.report tr.sec td { padding-top: 18px; font-weight: 650; border-bottom: 1px solid var(--gray-200); color: var(--gray-800); }
.report tr.sub td { font-weight: 600; background: var(--gray-25); border-top: 1px solid var(--gray-200); }
.report tr.key td { font-weight: 650; border-top: 1px solid var(--gray-300); background: #fff; }
.report tr.grand td { font-weight: 700; font-size: 14.5px; border-top: 1px solid var(--gray-500); border-bottom: 3px double var(--gray-600); background: #fff; padding-top: 10px; padding-bottom: 10px; }
.report tr.gap td { border: 0; padding: 6px; }
.report td.indent { padding-left: 34px; }
.report td.code { color: var(--gray-500); width: 80px; font-variant-numeric: tabular-nums; }
.report-head { text-align: center; padding: 22px 18px 14px; border-bottom: 1px solid var(--gray-150); }
.report-head .co { font-size: 13px; color: var(--gray-500); font-weight: 520; }
.report-head h2 { font-size: 19px; margin: 2px 0; }
.report-head .when { font-size: 13px; color: var(--gray-600); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; }
.check.ok { color: var(--ok); }
.check.bad { color: var(--bad); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--gray-300); background: #fff; color: var(--gray-700);
  font: inherit; font-size: 13.5px; font-weight: 560; line-height: 1; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-xs); transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--gray-50); color: var(--gray-900); text-decoration: none; border-color: var(--gray-300); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .icon { color: currentColor; opacity: .85; }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: var(--shadow-xs), inset 0 -1px 0 rgba(0,0,0,.12); }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); border-color: #fda29b; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { width: 32px; padding: 0; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-block { width: 100%; }
form.inline { display: inline; }

/* ---------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: 13px; font-weight: 560; color: var(--gray-700); }
.field .hint, .hint { font-size: 12px; color: var(--gray-500); }
.field .opt { font-weight: 450; color: var(--gray-400); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--gray-300); border-radius: 8px;
  background: #fff; color: var(--gray-900); font: inherit; font-size: 14px;
  box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 84px; padding: 9px 12px; resize: vertical; }
select { padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--gray-400); }
input[disabled], select[disabled] { background: var(--gray-50); color: var(--gray-500); }
input.invalid, select.invalid { border-color: #fda29b; }
input.invalid:focus, select.invalid:focus { box-shadow: 0 0 0 3px rgba(240, 68, 56, .15); }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; }
.check-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand-600); }
.check-row .label { display: block; }
.input-prefix { position: relative; }
.input-prefix .icon { position: absolute; left: 11px; top: 11px; color: var(--gray-400); }
.input-prefix input { padding-left: 34px; }
.seg { justify-self: start; display: inline-flex; padding: 3px; gap: 2px; background: var(--gray-100); border-radius: 9px; border: 1px solid var(--gray-200); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--gray-600); }
.seg input:checked + span { background: #fff; color: var(--gray-900); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { box-shadow: var(--ring); }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--gray-150); }
.filters .field { min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }

/* ---------------------------------------------------------------- alerts, badges */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok-line); color: #05603a; }
.alert-error { background: var(--bad-bg); border-color: var(--bad-line); color: #912018; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #93370d; }
.alert-info { background: var(--info-bg); border-color: var(--info-line); color: #1849a9; }
.alert strong { font-weight: 650; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 560; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge-draft { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge-posted, .badge-open { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge-reversed, .badge-closed, .badge-muted { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-200); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--gray-600); background: var(--gray-100); border-radius: 5px; padding: 1px 6px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- empty state */
.empty { text-align: center; padding: 52px 20px; color: var(--gray-500); }
.empty .bubble { width: 46px; height: 46px; border-radius: 12px; background: var(--gray-100); color: var(--gray-500); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h3 { color: var(--gray-900); font-size: 15px; margin-bottom: 4px; }
.empty p { max-width: 420px; margin: 0 auto 16px; }

/* ---------------------------------------------------------------- company cards */
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.co-card { display: block; padding: 18px; color: var(--gray-900); transition: border-color .12s, box-shadow .12s, transform .12s; }
.co-card:hover { text-decoration: none; border-color: var(--gray-300); box-shadow: var(--shadow-sm); color: var(--gray-900); transform: translateY(-1px); }
.co-card .top { display: flex; align-items: center; gap: 12px; }
.co-card .mark { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.co-card .name { font-weight: 620; font-size: 14.5px; }
.co-card .meta { font-size: 12.5px; color: var(--gray-500); }
.co-card .facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------------------------------------------------------------- journal form */
.lines { width: 100%; border-collapse: separate; border-spacing: 0; }
.lines th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .045em; padding: 9px 6px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.lines th:first-child { padding-left: 18px; }
.lines th.num { text-align: right; }
.lines td { padding: 6px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.lines td:first-child { padding-left: 18px; }
.lines td:last-child { padding-right: 12px; }
.lines input, .lines select { height: 34px; font-size: 13.5px; padding: 0 9px; box-shadow: none; }
.lines select { padding-right: 28px; background-position: right 7px center; }
.lines input.amt { text-align: right; font-variant-numeric: tabular-nums; }
.lines .c-account { width: 31%; }
.lines .c-desc { width: 19%; }
.lines .c-tax { width: 12%; }
.lines .c-amt { width: 12%; }
.lines .c-ccy { width: 10%; }
.lines .c-x { width: 40px; }
.lines .fx-input { display: none; margin-top: 4px; }
.lines tr.is-foreign .fx-input { display: block; }
.lines .row-error { font-size: 12px; color: var(--bad); margin-top: 4px; }
.lines .remove { color: var(--gray-400); }
.lines .remove:hover { color: var(--bad); background: var(--bad-bg); }
.lines-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 12px 18px; }
.totals { display: grid; grid-template-columns: auto auto; gap: 4px 24px; font-variant-numeric: tabular-nums; font-size: 13.5px; min-width: 280px; }
.totals .k { color: var(--gray-500); }
.totals .v { text-align: right; font-weight: 600; }
.totals .diff.ok { color: var(--ok); }
.totals .diff.bad { color: var(--bad); }
.totals .sep { grid-column: 1 / -1; border-top: 1px solid var(--gray-200); margin: 4px 0; }
.tax-preview { margin: 10px 0 0; padding: 8px 10px; list-style: none; font-size: 12.5px; color: var(--gray-600); background: var(--gray-50); border: 1px solid var(--gray-150); border-radius: 8px; }
.tax-preview li { margin: 2px 0; }
.form-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 18px; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.2) blur(6px);
  border-top: 1px solid var(--gray-200); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------------------------------------------------------------- journal view */
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; }
.meta-grid .k { font-size: 12px; color: var(--gray-500); font-weight: 520; }
.meta-grid .v { font-size: 13.5px; color: var(--gray-900); font-weight: 520; margin-top: 2px; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
details.reveal > summary { list-style: none; cursor: pointer; }
details.reveal > summary::-webkit-details-marker { display: none; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 340px; padding: 16px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.rel { position: relative; }

/* ---------------------------------------------------------------- periods */
.years { display: grid; gap: 14px; }
.year-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--gray-150); }
.periods { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 14px 18px; }
.period { border: 1px solid var(--gray-200); border-radius: 9px; padding: 10px 12px; background: #fff; display: grid; gap: 6px; }
.period.closed { background: var(--gray-50); }
.period .p-label { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.period .p-meta { font-size: 11.5px; color: var(--gray-500); }
.period form button { width: 100%; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(21,122,114,.10), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(23,92,211,.06), transparent 60%),
    var(--gray-50);
}
.auth-card { width: 100%; max-width: 410px; padding: 32px; }
.auth-card .brand { justify-content: center; padding: 0 0 20px; font-size: 17px; }
.auth-card h1 { font-size: 20px; text-align: center; }
.auth-card .lead { text-align: center; color: var(--gray-500); margin: 6px 0 22px; }
.auth-card form { display: grid; gap: 14px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--gray-400); }
.qr { display: grid; place-items: center; padding: 12px; border: 1px solid var(--gray-200); border-radius: var(--radius); background: #fff; }
.qr svg { width: 196px; height: 196px; }
.secret { text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .06em; background: var(--gray-50); border: 1px dashed var(--gray-300); border-radius: 8px; padding: 8px; color: var(--gray-700); word-break: break-all; }
input.code-input { text-align: center; font-size: 22px; letter-spacing: .4em; height: 50px; font-variant-numeric: tabular-nums; font-weight: 600; }
.steps { margin: 0 0 6px; padding-left: 18px; color: var(--gray-600); font-size: 13px; }
.steps li { margin: 3px 0; }

/* ---------------------------------------------------------------- utilities */
.muted { color: var(--gray-500); }
.small { font-size: 12.5px; }
.strong { font-weight: 620; }
.right { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.error-box { padding: 12px 0 4px; }
.stack { display: grid; gap: 12px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kbd { font-family: ui-monospace, monospace; font-size: 11.5px; padding: 1px 5px; border: 1px solid var(--gray-300); border-bottom-width: 2px; border-radius: 5px; background: #fff; color: var(--gray-600); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--gray-150); font-size: 13px; color: var(--gray-500); }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13.5px; }
.dl dt { color: var(--gray-500); }
.dl dd { margin: 0; font-weight: 520; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .periods { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--gray-200); padding: 12px; gap: 8px; }
  .brand { padding-bottom: 4px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 2px; scrollbar-width: none; }
  .nav a { white-space: nowrap; flex: none; padding: 6px 10px; }
  .nav-label { display: none; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; margin-top: 0; }
  .signout { margin: 0; }
  .signout button { width: auto; }
  .page-actions form.row { flex-wrap: wrap; }
  .main { padding: 20px 16px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- print */
@media print {
  body { background: #fff; font-size: 12px; }
  .shell { display: block; background: none; }
  .sidebar, .no-print, .page-actions, .alert, .filters, .form-actions { display: none !important; }
  .main { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .report td { padding: 4px 6px; }
  a { color: inherit; }
}
