/* Team Portal: the closing-book look.
   Ledger green + paper, tabular figures, accounting conventions (negatives in brackets,
   totals double-ruled). Keep tokens in sync with apps/core/exports.py (PDF). */

:root {
  --ledger: #0F3D2E;
  --ledger-2: #164C3A;
  --ledger-3: #1E5C47;
  --brass: #B08A2E;
  --paper: #F4F6F5;
  --surface: #FFFFFF;
  --ink: #17201C;
  --ink-2: #3E4A44;
  --muted: #5B6660;
  --rule: #DDE3E0;
  --rule-strong: #C3CCC7;
  --subtotal: #EAF1ED;
  --negative: #B42318;
  --positive: #146C4B;
  --amber: #8A5A00;
  --amber-bg: #FBF1DC;
  --red-bg: #FCE8E6;
  --green-bg: #E3F1EA;
  --grey-bg: #ECEFED;
  --radius: 10px;
  --sidebar-w: 248px;

  --bs-body-font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--rule);
  --bs-link-color-rgb: 20, 108, 75;
  --bs-link-hover-color-rgb: 15, 61, 46;
  --bs-focus-ring-color: rgba(176, 138, 46, .35);
}

body { background: var(--paper); font-size: .94rem; letter-spacing: -.003em; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); letter-spacing: -.015em; }
a { text-underline-offset: .15em; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---------- numbers ---------- */
.num, .table-ledger td, .table-ledger th, .figure-value, .statement { font-variant-numeric: tabular-nums lining-nums; }
.neg { color: var(--negative) !important; }
.pos { color: var(--positive); }
.muted { color: var(--muted); }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  /* !important: Bootstrap's .offcanvas-lg forces a transparent background on desktop */
  --bs-offcanvas-bg: var(--ledger); --bs-offcanvas-width: 280px;
  width: var(--sidebar-w); flex-shrink: 0; background: var(--ledger) !important; color: #D4E1DA;
  display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.1rem 1rem; color: #fff; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--brass); color: var(--ledger);
  display: grid; place-items: center; font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.brand-name { font-weight: 650; line-height: 1.15; font-size: .98rem; }
.brand-sub { color: #9DB5A9; font-size: .76rem; }
.nav-group { padding: .35rem .65rem; }
.nav-group + .nav-group { border-top: 1px solid rgba(255, 255, 255, .07); }
.nav-heading { color: #8FA99C; font-size: .74rem; font-weight: 600; padding: .55rem .55rem .25rem; }
summary.nav-heading { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer;
  border-radius: 6px; user-select: none; }
summary.nav-heading::-webkit-details-marker { display: none; }
summary.nav-heading .bi { font-size: .7rem; transition: transform .15s ease; }
details.nav-group:not([open]) > summary.nav-heading .bi { transform: rotate(-90deg); }
summary.nav-heading:hover { color: #fff; }
summary.nav-heading:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
details.nav-group:not([open]) { padding-bottom: .2rem; }
@media (prefers-reduced-motion: reduce) { summary.nav-heading .bi { transition: none; } }
.side-link {
  display: flex; align-items: center; gap: .65rem; padding: .42rem .55rem; border-radius: 7px;
  color: #D4E1DA; text-decoration: none; font-size: .9rem; position: relative;
}
.side-link .bi { font-size: 1rem; opacity: .8; }
.side-link:hover { background: var(--ledger-2); color: #fff; }
.side-link.active { background: var(--ledger-3); color: #fff; font-weight: 600; }
.side-link.active::before {
  content: ""; position: absolute; left: -.65rem; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--brass);
}
.side-link.cta { background: var(--brass); color: var(--ledger); font-weight: 650; margin: .25rem 0 .35rem; }
.side-link.cta:hover { background: #C29A37; color: var(--ledger); }
/* ---------- app bar + profile menu ---------- */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 60px; padding: 0 2rem; background: var(--ledger); color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .07);  /* same green as the sidebar, reads as one frame */
}
.appbar-start { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.appbar-brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 650; }
.appbar-brand .brand-mark { width: 30px; height: 30px; font-size: .85rem; }
.appbar-date { align-items: center; color: #B9CCC2; font-size: .88rem; }
.appbar-date .bi { margin-right: .5rem; color: var(--brass); }
.appbar .btn-icon { color: #fff; border: 1px solid rgba(255, 255, 255, .25); padding: .2rem .5rem; }
.appbar .btn-icon:hover { background: var(--ledger-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ledger); color: #fff; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 650; font-size: .8rem; letter-spacing: .02em;
}
.avatar.lg { width: 42px; height: 42px; font-size: .95rem; background: var(--brass); color: var(--ledger); }
.profile-btn {
  display: flex; align-items: center; gap: .6rem; border: 1px solid transparent; background: none; color: #fff;
  padding: .25rem .55rem .25rem .3rem; border-radius: 999px;
}
.profile-btn:hover, .profile-btn[aria-expanded="true"] { background: var(--ledger-2); border-color: var(--ledger-3); }
.profile-btn .avatar { background: var(--brass); color: var(--ledger); }
.profile-btn-text { text-align: left; line-height: 1.15; }
.profile-btn-text b { display: block; font-size: .88rem; font-weight: 600; }
.profile-btn-text small { color: #9DB5A9; font-size: .75rem; }
.profile-menu {
  --bs-dropdown-min-width: 250px; --bs-dropdown-border-color: var(--rule); --bs-dropdown-border-radius: var(--radius);
  --bs-dropdown-link-active-bg: var(--subtotal); --bs-dropdown-link-active-color: var(--ledger);
  --bs-dropdown-link-hover-bg: var(--grey-bg); padding: .4rem; box-shadow: 0 12px 32px rgba(15, 61, 46, .14); margin-top: .4rem !important;
}
.profile-menu-head { display: flex; align-items: center; gap: .7rem; padding: .6rem .6rem .8rem; margin-bottom: .3rem; border-bottom: 1px solid var(--rule); }
.profile-menu-head b { display: block; font-weight: 650; }
.profile-menu-head small { color: var(--muted); font-size: .78rem; }
.profile-menu .dropdown-item { display: flex; align-items: center; gap: .65rem; border-radius: 7px; padding: .5rem .6rem; font-size: .9rem; }
.profile-menu .dropdown-item i { width: 1rem; color: var(--muted); }
.profile-menu .dropdown-item.active i { color: var(--ledger); }
.profile-menu .dropdown-item.text-danger i { color: var(--negative); }
.profile-menu .dropdown-item.text-danger:hover { background: var(--red-bg); }

.main { flex: 1; min-width: 0; padding: 1.75rem 2rem 3rem; max-width: 1480px; }
@media (max-width: 991.98px) {
  .app { display: block; }
  .appbar { padding: 0 1rem; height: 56px; }
  .main { padding: 1.1rem 1rem 2.5rem; }
}

/* profile page */
.profile-grid { display: grid; gap: 1.25rem; align-items: start; max-width: 1000px; }
@media (min-width: 992px) { .profile-grid { grid-template-columns: 300px minmax(0, 1fr); } }
.profile-card { padding: 1.5rem 1.3rem 1.3rem; text-align: center; }
.profile-avatar { width: 76px; height: 76px; margin: 0 auto .8rem; border-radius: 50%; background: var(--ledger); color: #fff;
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; box-shadow: 0 0 0 4px var(--subtotal); }
.profile-name { font-size: 1.15rem; font-weight: 700; }
.profile-meta { text-align: left; margin: 1.1rem 0 1.1rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: auto 1fr; gap: .1rem 1rem; }
.profile-meta dd { margin-bottom: .35rem; }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); margin-top: .2rem; font-size: .92rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- buttons ---------- */
.btn { border-radius: 8px; font-weight: 550; }
.btn-primary {
  --bs-btn-bg: var(--ledger); --bs-btn-border-color: var(--ledger);
  --bs-btn-hover-bg: var(--ledger-2); --bs-btn-hover-border-color: var(--ledger-2);
  --bs-btn-active-bg: var(--ledger-3); --bs-btn-active-border-color: var(--ledger-3);
  --bs-btn-disabled-bg: var(--ledger); --bs-btn-disabled-border-color: var(--ledger);
}
.btn-outline-primary {
  --bs-btn-color: var(--ledger); --bs-btn-border-color: var(--rule-strong);
  --bs-btn-hover-bg: var(--subtotal); --bs-btn-hover-color: var(--ledger); --bs-btn-hover-border-color: var(--ledger);
  --bs-btn-active-bg: var(--subtotal); --bs-btn-active-color: var(--ledger); --bs-btn-active-border-color: var(--ledger);
}
.btn-quiet {
  --bs-btn-color: var(--ink-2); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--rule);
  --bs-btn-hover-bg: var(--paper); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--rule-strong);
}
.btn-success { --bs-btn-bg: var(--positive); --bs-btn-border-color: var(--positive); --bs-btn-hover-bg: #0F5A3E; --bs-btn-hover-border-color: #0F5A3E; }
.btn .bi { margin-right: .3rem; }
.btn-icon .bi { margin: 0; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .95rem 1.15rem .7rem; border-bottom: 1px solid var(--rule);
}
.panel-head h2 { font-size: 1rem; font-weight: 650; margin: 0; }
.panel-head .hint { color: var(--muted); font-size: .82rem; }
.panel-body { padding: 1.1rem 1.15rem; }
.panel > .table-responsive > .table, .panel > .table { margin: 0; }
.stack { display: grid; gap: 1.25rem; }
.stack > *, .row > * { min-width: 0; }  /* let wide tables scroll inside their panel */

/* ---------- figures (KPIs) ---------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.figure { padding: 1rem 1.15rem; border-right: 1px solid var(--rule); }
.figure:last-child { border-right: 0; }
.figure-label { color: var(--muted); font-size: .82rem; }
.figure-value { font-size: 1.45rem; font-weight: 650; letter-spacing: -.02em; margin-top: .1rem; }
.figure-note { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.figure-note a { color: inherit; }
@media (max-width: 767.98px) { .figure { border-right: 0; border-bottom: 1px solid var(--rule); } .figure:last-child { border-bottom: 0; } }
.delta { font-weight: 600; }
.delta.up { color: var(--positive); }
.delta.down { color: var(--negative); }

/* ---------- the closing statement (signature element) ---------- */
.closing { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.6fr); }
.closing-statement { padding: 1.3rem 1.4rem; border-right: 1px solid var(--rule); }
.closing-chart { padding: 1.1rem 1.2rem .8rem; min-width: 0; }
@media (max-width: 991.98px) { .closing { grid-template-columns: 1fr; } .closing-statement { border-right: 0; border-bottom: 1px solid var(--rule); } }
.closing-title { font-size: .86rem; color: var(--muted); margin-bottom: .2rem; }
.closing-period { font-size: 1.15rem; font-weight: 650; margin-bottom: 1rem; }
.statement { width: 100%; border-collapse: collapse; }
.statement td { padding: .36rem 0; border-bottom: 1px solid var(--rule); font-size: .92rem; }
.statement td:last-child { text-align: right; white-space: nowrap; padding-left: 1rem; }
.statement tr.less td:first-child { color: var(--ink-2); padding-left: .9rem; }
.statement tr.sub td { font-weight: 650; border-bottom-color: var(--rule-strong); }
.statement tr.total td {
  font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink);
  padding: .55rem 0;
}
.statement-hero { font-size: 2.35rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; margin: .2rem 0 .1rem; }

/* ---------- ledger tables ---------- */
.table-ledger { --bs-table-bg: transparent; font-size: .87rem; margin: 0; }
.table-ledger > :not(caption) > * > * { padding: .5rem .75rem; border-bottom-color: var(--rule); }
.table-ledger thead th {
  color: var(--muted); font-weight: 600; font-size: .8rem; white-space: nowrap; background: var(--surface);
  border-bottom: 1px solid var(--rule-strong); position: sticky; top: 0; z-index: 1;
}
.table-ledger td.n, .table-ledger th.n { text-align: right; white-space: nowrap; }
.table-ledger tbody tr:hover > * { background: #FAFBFA; }
.table-ledger tr.group-row > td { font-weight: 650; background: var(--paper); color: var(--ledger); padding-top: .7rem; }
.table-ledger tr.subtotal-row > td { font-weight: 650; background: var(--subtotal); }
.table-ledger tr.grand-row > td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); background: var(--surface); }
.table-ledger .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.table-ledger tr.subtotal-row .sticky-col { background: var(--subtotal); }
.table-ledger tr.group-row .sticky-col { background: var(--paper); }
.table-ledger td .sub { display: block; color: var(--muted); font-size: .78rem; }
.table-wrap { max-height: 70vh; overflow: auto; }
.empty { padding: 2.2rem 1rem; text-align: center; color: var(--muted); }
.empty .bi { font-size: 1.6rem; display: block; margin-bottom: .35rem; color: var(--rule-strong); }

/* ---------- status & tags ---------- */
.status { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.status-created { background: var(--amber-bg); color: var(--amber); }
.status-delivered { background: var(--green-bg); color: var(--positive); }
.status-returned { background: var(--red-bg); color: var(--negative); }
.status-cancelled { background: var(--grey-bg); color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .45rem; border-radius: 5px; font-size: .74rem; font-weight: 650; }
.tag-priority { background: var(--negative); color: #fff; }
.tag-low { background: var(--amber-bg); color: var(--amber); }
.tag-soft { background: var(--grey-bg); color: var(--ink-2); }
.tag-info { background: var(--subtotal); color: var(--ledger); }

/* ---------- filters ---------- */
.filters { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: 1.25rem; }
.presets { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .7rem; }
.preset { padding: .2rem .65rem; border-radius: 999px; border: 1px solid var(--rule); font-size: .8rem; color: var(--ink-2); text-decoration: none; background: var(--surface); }
.preset:hover { border-color: var(--rule-strong); color: var(--ink); }
.preset.on { background: var(--ledger); border-color: var(--ledger); color: #fff; }
.filters .form-label { font-size: .78rem; color: var(--muted); margin-bottom: .2rem; }
.filters .form-control, .filters .form-select { min-width: 150px; }

/* ---------- forms ---------- */
.form-control, .form-select { border-color: var(--rule-strong); border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--brass); box-shadow: 0 0 0 .2rem rgba(176, 138, 46, .18); }
.form-label { font-weight: 550; font-size: .86rem; color: var(--ink-2); }
.form-text { color: var(--muted); }
.form-section + .form-section { border-top: 1px solid var(--rule); }
.form-section h2 { font-size: .98rem; font-weight: 650; margin-bottom: .85rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.15rem; border-top: 1px solid var(--rule); background: #FAFBFA; border-radius: 0 0 var(--radius) var(--radius); }

@media (min-width: 992px) { .border-end-lg { border-right: 1px solid var(--rule); } }

/* quick status */
.quick { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; }
.quick .form-control { width: 78px; }
.quick .btn { padding: .2rem .55rem; font-size: .8rem; white-space: nowrap; }

/* ---------- charts ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: var(--ink-2); margin-bottom: .5rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

/* ---------- report index ---------- */
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.report-item { padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: .35rem; }
.report-item h2 { font-size: 1rem; font-weight: 650; margin: 0; }
.report-item h2 a { color: var(--ink); text-decoration: none; }
.report-item h2 a:hover { color: var(--positive); }
.report-item p { color: var(--muted); font-size: .86rem; margin: 0; flex: 1; }
.report-item .links { display: flex; gap: .4rem; margin-top: .4rem; }


/* ---------- misc ---------- */
.alert { border-radius: var(--radius); }
.pagination { --bs-pagination-color: var(--ledger); --bs-pagination-active-bg: var(--ledger); --bs-pagination-active-border-color: var(--ledger); }
dl.meta dt { font-weight: 500; color: var(--muted); font-size: .82rem; }
dl.meta dd { margin-bottom: .55rem; }

@media print {
  .sidebar, .appbar, .page-actions, .filters, .no-print { display: none !important; }
  .main { padding: 0; }
  .panel { border: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Guide ---------- */
.g-hero { background: var(--ledger); color: #D4E1DA; border-radius: var(--radius); padding: 1.6rem 1.6rem 1.3rem; margin-bottom: 1.5rem; }
.g-hero-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.g-hero-kicker { color: var(--brass); font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.g-hero h1 { color: #fff; font-size: 1.9rem; font-weight: 700; margin: 0 0 .4rem; }
.g-hero p { margin: 0; max-width: 62ch; color: #B9CCC2; }
.g-hero-btn { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18); white-space: nowrap; }
.g-hero-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.g-tape { display: flex; gap: .4rem; margin-top: 1.4rem; overflow-x: auto; padding-bottom: .2rem; }
.g-term { position: relative; flex: 1 0 auto; min-width: 108px; background: var(--ledger-2); border: 1px solid var(--ledger-3);
  border-radius: 8px; padding: .55rem .7rem .55rem 1.55rem; }
.g-term b { display: block; color: #fff; font-weight: 600; font-size: .88rem; white-space: nowrap; }
.g-term small { color: #9DB5A9; font-size: .74rem; white-space: nowrap; }
.g-op { position: absolute; left: .55rem; top: 50%; transform: translateY(-50%); color: var(--brass); font-weight: 700; font-size: 1.05rem; }
.g-term.result { background: var(--brass); border-color: var(--brass); }
.g-term.result b { color: var(--ledger); }
.g-term.result small, .g-term.result .g-op { color: var(--ledger); }

.g-layout { display: grid; gap: 1.5rem; }
@media (min-width: 1200px) { .g-layout { grid-template-columns: 210px minmax(0, 1fr); align-items: start; } }
.g-toc { display: flex; flex-wrap: wrap; gap: .25rem; }
@media (min-width: 1200px) { .g-toc { position: sticky; top: 1rem; flex-direction: column; } }
.g-toc a { display: flex; align-items: center; gap: .55rem; color: var(--ink-2); text-decoration: none; font-size: .88rem;
  padding: .42rem .65rem; border-radius: 7px; border-left: 2px solid transparent; }
.g-toc a i { color: var(--muted); }
.g-toc a:hover { background: var(--grey-bg); }
.g-toc a.on { background: var(--surface); color: var(--ledger); font-weight: 600; border-left-color: var(--brass); }
.g-toc a.on i { color: var(--ledger); }
@media (max-width: 1199.98px) { .g-toc a { border: 1px solid var(--rule); background: var(--surface); } }

.g-body { display: grid; gap: 1.25rem; }
.g-section { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.35rem 1.4rem; scroll-margin-top: 1rem; }
.g-head { margin-bottom: 1.1rem; }
.g-head h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 .2rem; }
.g-head p { margin: 0; color: var(--muted); }
.g-section h3 { font-size: .95rem; font-weight: 650; margin: 0 0 .2rem; }
.g-section p { color: var(--ink-2); }
.g-note { display: flex; gap: .55rem; align-items: baseline; margin: 1rem 0 0; font-size: .86rem; color: var(--muted) !important; }

/* steps: a real sequence, so numbered */
.g-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.g-steps li { counter-increment: step; position: relative; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .2rem 0 1.15rem 3rem; }
.g-steps li::before { content: counter(step); position: absolute; left: 0; top: .1rem; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--ledger); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.g-steps li::after { content: ""; position: absolute; left: calc(1rem - 1px); top: 2.3rem; bottom: .1rem; width: 2px; background: var(--rule); }
.g-steps li:last-child { padding-bottom: 0; }
.g-steps li:last-child::after { display: none; }
.g-steps p { margin: 0; font-size: .88rem; }
.g-steps .btn { flex-shrink: 0; }

.g-flow { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g-flow-step { position: relative; background: var(--paper); border-radius: 8px; padding: 1rem; }
.g-flow-step > i { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 8px; background: var(--green-bg);
  color: var(--positive); font-size: 1.05rem; margin-bottom: .6rem; }
.g-flow-step p { margin: 0; font-size: .86rem; }

.g-status-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g-status { border: 1px solid var(--rule); border-radius: 8px; padding: .9rem 1rem; }
.g-status dl { margin: .75rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .35rem .75rem; font-size: .86rem; }
.g-status dt { color: var(--muted); font-weight: 500; }
.g-status dd { margin: 0; color: var(--ink-2); }
.g-status dd i { margin-right: .25rem; }

.g-ledgers { display: grid; gap: 1.5rem; }
@media (min-width: 1400px) { .g-ledgers { grid-template-columns: 1fr 1fr; } }
.g-ledger-title { display: flex; align-items: center; gap: .55rem; font-weight: 650; margin-bottom: .6rem; }
.g-badge { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 6px; background: var(--ledger); color: #fff; font-size: .78rem; }
.g-ledger table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.g-ledger td { padding: .42rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.g-ledger td:nth-child(2) { font-weight: 600; white-space: nowrap; width: 30%; }
.g-ledger td:last-child { color: var(--ink-2); }
.g-ledger td.op { width: 1.6rem; text-align: center; color: var(--brass); font-weight: 700; padding-left: 0; padding-right: 0; }
.g-ledger tr.sub td { background: var(--subtotal); }
.g-ledger tr.total td { background: var(--ledger); color: #fff; border-bottom: 0; }
.g-ledger tr.total td.op { color: var(--brass); }
.g-ledger tr.total td:first-child { border-radius: 6px 0 0 6px; }
.g-ledger tr.total td:last-child { border-radius: 0 6px 6px 0; color: #D4E1DA; }
.g-defs td:first-child { font-weight: 600; white-space: nowrap; width: 30%; padding-left: 0; }

.g-receipts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g-receipt { border: 1px solid var(--rule); border-top: 4px solid var(--positive); border-radius: 8px; padding: 1rem 1.1rem; }
.g-receipt.bad { border-top-color: var(--negative); }
.g-receipt-head { margin-bottom: .6rem; }
.g-receipt-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: .8rem; padding-top: .7rem; border-top: 3px double var(--ink); }
.g-receipt-total span { font-weight: 600; }
.g-receipt-total b { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.g-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; background: var(--paper); border-radius: 8px; padding: 1.1rem 1.2rem; }
.g-formula-label { font-weight: 650; }
.g-fraction { display: inline-flex; flex-direction: column; text-align: center; font-size: .9rem; color: var(--ink); }
.g-fraction span:first-child { padding: 0 .4rem .35rem; border-bottom: 2px solid var(--ink); }
.g-fraction span:last-child { padding-top: .35rem; }
.g-callout { display: flex; gap: .8rem; margin-top: 1rem; padding: 1rem 1.1rem; border-radius: 8px; background: var(--amber-bg); color: #4A3B12; font-size: .9rem; }
.g-callout > i { color: var(--amber); font-size: 1.2rem; }

.g-group { font-size: .8rem !important; color: var(--muted); font-weight: 600 !important; margin: 1.2rem 0 .55rem !important; }
.g-group:first-of-type { margin-top: 0 !important; }
.g-pages { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.g-page { display: flex; gap: .75rem; padding: .85rem .9rem; border: 1px solid var(--rule); border-radius: 8px; text-decoration: none; color: inherit; }
.g-page:hover { border-color: var(--ledger-3); background: var(--subtotal); }
.g-page > i { flex-shrink: 0; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 7px; background: var(--ledger); color: #fff; }
.g-page b { display: block; color: var(--ink); font-weight: 650; font-size: .9rem; }
.g-page span { display: block; color: var(--muted); font-size: .82rem; line-height: 1.4; margin-top: .1rem; }

.g-columns { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.g-col { background: var(--grey-bg); color: var(--ink-2); border-radius: 5px; padding: .2rem .5rem; font-size: .8rem; }
.g-col.req { background: var(--ledger); color: #fff; }
.g-key { font-family: inherit; }
.g-section code:not(.g-col) { color: var(--ledger); background: var(--subtotal); border-radius: 4px; padding: .05rem .3rem; }
.g-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.g-rules li { display: flex; gap: .6rem; color: var(--ink-2); }
.g-rules i { color: var(--positive); }

.g-faq details { border-bottom: 1px solid var(--rule); }
.g-faq details:last-child { border-bottom: 0; }
.g-faq summary { list-style: none; cursor: pointer; padding: .85rem 2rem .85rem 0; font-weight: 600; position: relative; }
.g-faq summary::-webkit-details-marker { display: none; }
.g-faq summary::after { content: "+"; position: absolute; right: .25rem; top: .7rem; font-size: 1.2rem; color: var(--brass); font-weight: 600; }
.g-faq details[open] summary::after { content: "−"; }
.g-faq details p { margin: 0 0 1rem; max-width: 75ch; }

@media (max-width: 575.98px) {
  .g-hero { padding: 1.2rem; } .g-hero h1 { font-size: 1.5rem; } .g-hero-top { flex-direction: column; }
  .g-section { padding: 1.1rem; } .g-steps li { flex-direction: column; align-items: flex-start; }
}
@media print {
  .g-layout { display: block; } .g-section { break-inside: avoid; margin-bottom: 1rem; }
  .g-hero, .g-term, .g-ledger tr.total td, .g-page > i, .g-col.req, .g-steps li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- password eye, code box, sidebar count ---------- */
.pw-wrap { position: relative; }
.pw-wrap > input { padding-right: 2.75rem; }
.pw-toggle { position: absolute; top: 0; right: 0; height: 100%; width: 2.6rem; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center; border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0; }
.pw-toggle:hover { color: var(--ledger); }
.pw-toggle:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; }
.pw-wrap > .form-control-lg ~ .pw-toggle { width: 3rem; font-size: 1.05rem; }
.otp-input { font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.side-count { margin-left: auto; background: var(--brass); color: var(--ledger); border-radius: 999px; font-size: .72rem;
  font-weight: 700; padding: .05rem .45rem; }

/* ---------- product logo ---------- */
.logo-mark { flex-shrink: 0; display: block; }
.logo-bg { fill: var(--ledger); }
.on-dark .logo-bg { fill: var(--ledger-3); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 560px); background: var(--surface); }
.auth-side { background: var(--ledger); color: #D4E1DA; padding: 2.5rem 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; font-weight: 650; font-size: 1.05rem; }
.auth-pitch h1 { color: #fff; font-size: clamp(1.9rem, 3vw, 2.6rem); font-weight: 700; line-height: 1.08; max-width: 16ch; margin-bottom: 1rem; }
.auth-pitch p { max-width: 44ch; color: #B9CCC2; font-size: 1.02rem; }
.auth-points { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: .75rem; }
.auth-points li { display: flex; gap: .7rem; align-items: center; color: #E2ECE7; }
.auth-points i { color: var(--brass); font-size: 1.05rem; }
.auth-credit { font-size: .82rem; color: #8FA99C; }
.auth-credit a { color: #fff; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-brand-mobile { display: none; color: var(--ink); margin-bottom: 1.75rem; }
.auth-title { font-size: 1.65rem; font-weight: 700; margin: 0 0 .35rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.5rem; }
.auth-switch { margin: 1.5rem 0 0; text-align: center; color: var(--muted); font-size: .92rem; }
.auth-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--green-bg); color: var(--positive); display: grid; place-items: center;
  font-size: 1.5rem; margin-bottom: 1rem; }
.auth-resend { margin-top: 1rem; font-size: .9rem; text-align: center; }
.auth-steps { list-style: none; counter-reset: s; display: flex; gap: .4rem; padding: 0; margin: 0 0 1.5rem; font-size: .78rem; color: var(--muted); }
.auth-steps li { counter-increment: s; flex: 1; padding-top: .5rem; border-top: 3px solid var(--rule); }
.auth-steps li::before { content: counter(s) ". "; }
.auth-steps li.on { border-top-color: var(--brass); color: var(--ink); font-weight: 600; }
.auth-steps li.done { border-top-color: var(--positive); color: var(--positive); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-brand-mobile { display: inline-flex; }
  .auth-main { align-items: flex-start; padding: 2rem 1rem; }
}

/* ---------- landing (light, calm) ---------- */
.lp { background: #fff; color: var(--ink); font-size: 1rem; }
.lp-wrap { max-width: 1160px; margin: 0 auto; padding-left: clamp(1rem, 4vw, 1.5rem); padding-right: clamp(1rem, 4vw, 1.5rem); }
.lp-nav { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.lp-nav-inner { display: flex; align-items: center; gap: 2rem; height: 68px; }
.lp-logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.08rem; }
.lp-links { display: flex; gap: 1.6rem; }
.lp-links a { color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500; }
.lp-links a:hover { color: var(--ledger); }
.lp-nav-cta { margin-left: auto; display: flex; gap: .5rem; }

.lp-hero { background: linear-gradient(180deg, #F1F7F4 0%, #fff 100%); padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(3rem, 6vw, 4.5rem); }
.lp-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.lp-tag { display: inline-flex; gap: .45rem; align-items: center; color: var(--positive); background: var(--green-bg); font-weight: 600;
  font-size: .88rem; padding: .3rem .8rem; border-radius: 999px; margin-bottom: 1.25rem; }
.lp-hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); font-weight: 700; line-height: 1.1; letter-spacing: -.03em; color: var(--ink); margin-bottom: 1.2rem; }
.lp-lead { font-size: 1.15rem; line-height: 1.65; color: var(--ink-2); max-width: 52ch; margin-bottom: 0; }
.lp-hero-cta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2rem; }
.lp-checks { list-style: none; padding: 0; margin: 1.4rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; color: var(--ink-2); font-size: .92rem; }
.lp-checks i { color: var(--positive); margin-right: .35rem; }

.lp-preview { margin: 0; background: #fff; border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 24px 48px rgba(15, 61, 46, .10); overflow: hidden; }
.lp-preview-bar { display: flex; align-items: center; gap: .4rem; padding: .7rem 1rem; background: var(--ledger); }
.lp-preview-bar span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .28); }
.lp-preview-bar b { margin-left: .6rem; color: #fff; font-size: .85rem; font-weight: 600; }
.lp-preview-body { padding: 1.2rem; display: grid; gap: 1rem; }
.lp-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.lp-kpis > div { border: 1px solid var(--rule); border-radius: 10px; padding: .7rem .8rem; }
.lp-kpis small { display: block; color: var(--muted); font-size: .76rem; }
.lp-kpis b { display: block; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: .1rem 0; }
.lp-kpis em { font-style: normal; font-size: .74rem; color: var(--muted); }
.lp-kpis em.up { color: var(--positive); font-weight: 600; }
.lp-chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding: .6rem .2rem 0; border-bottom: 1px solid var(--rule); }
.lp-chart i { flex: 1; background: #2a78d6; border-radius: 4px 4px 0 0; opacity: .85; }
.lp-chart i:last-child { opacity: 1; }
.lp-teams { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.lp-teams th { color: var(--muted); font-weight: 500; font-size: .76rem; padding: 0 0 .4rem; }
.lp-teams td { padding: .45rem 0; border-top: 1px solid var(--rule); }
.lp-teams th:not(:first-child), .lp-teams td:not(:first-child) { text-align: right; }
.lp-teams .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .5rem; }
.lp-preview figcaption { padding: 0 1.2rem .8rem; font-size: .72rem; color: var(--muted); }

.lp-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; padding-top: 2.5rem; padding-bottom: 1rem; }
.lp-facts > div { display: grid; grid-template-columns: auto 1fr; column-gap: .75rem; }
.lp-facts i { grid-row: span 2; font-size: 1.3rem; color: var(--positive); }
.lp-facts b { font-weight: 650; }
.lp-facts span { color: var(--muted); font-size: .9rem; line-height: 1.5; }

.lp-section { padding: clamp(3.5rem, 7vw, 5.5rem) 0; }
.lp-soft { background: var(--paper); }
.lp-section-head { max-width: 620px; margin: 0 auto 2.75rem; text-align: center; }
.lp-section-head h2 { font-size: clamp(1.75rem, 3vw, 2.3rem); font-weight: 700; letter-spacing: -.025em; margin-bottom: .6rem; }
.lp-section-head p { color: var(--muted); font-size: 1.08rem; margin: 0; }
.lp-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--green-bg); color: var(--positive); font-size: 1.2rem; flex-shrink: 0; }
.lp-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.lp-features article { padding: 1.5rem; border: 1px solid var(--rule); border-radius: 14px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.lp-features article:hover { border-color: #BFD6CB; box-shadow: 0 8px 24px rgba(15, 61, 46, .06); }
.lp-features h3 { font-size: 1.08rem; font-weight: 650; margin: 1rem 0 .45rem; }
.lp-features p { color: var(--ink-2); font-size: .95rem; line-height: 1.6; margin: 0; }

.lp-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.lp-steps li { counter-increment: step; background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 1.5rem; }
.lp-steps li::before { content: counter(step); display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  background: var(--ledger); color: #fff; font-weight: 700; margin-bottom: 1rem; }
.lp-steps h3 { font-size: 1.08rem; font-weight: 650; }
.lp-steps p { color: var(--ink-2); font-size: .95rem; margin: 0; }

.lp-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.lp-role { border: 1px solid var(--rule); border-radius: 14px; padding: 1.75rem; }
.lp-role h3 { display: flex; align-items: center; gap: .8rem; font-size: 1.15rem; font-weight: 650; margin-bottom: 1.1rem; }
.lp-role ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.lp-role li { position: relative; padding-left: 1.6rem; color: var(--ink-2); }
.lp-role li::before { content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; left: 0; color: var(--positive); }

.lp-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; background: var(--ledger);
  border-radius: 18px; padding: clamp(2rem, 5vw, 3rem); margin-bottom: 1rem; }
.lp-cta h2 { color: #fff; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; margin-bottom: .35rem; }
.lp-cta p { color: #C9D8D0; margin: 0; font-size: 1.05rem; }
.lp-btn-light { background: #fff; color: var(--ledger); font-weight: 650; border: 0; }
.lp-btn-light:hover { background: var(--green-bg); color: var(--ledger); }
.lp-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; padding-top: 1.75rem; padding-bottom: 2.25rem;
  color: var(--muted); font-size: .9rem; }
.lp-foot a { color: var(--ledger); font-weight: 600; }

@media (max-width: 991.98px) {
  .lp-hero-grid { grid-template-columns: 1fr; }
  .lp-links { display: none; }
  .lp-facts { grid-template-columns: 1fr 1fr; }
  .lp-features { grid-template-columns: 1fr 1fr; }
  .lp-steps, .lp-roles { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .lp-nav-cta .btn-quiet { display: none; }
  .lp-facts, .lp-features { grid-template-columns: 1fr; }
  .lp-kpis b { font-size: 1rem; }
}

/* ---- Tracking mode choice cards (signup, settings, new company) ---- */
fieldset > legend.form-label { float: none; font-size: inherit; margin-bottom: .5rem; }
.mode-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.mode-choice { display: flex; gap: .65rem; align-items: flex-start; padding: .8rem .9rem; border: 1px solid var(--rule-strong);
  border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.mode-choice .form-check-input { margin-top: .2rem; flex: none; }
.mode-choice b { display: block; font-weight: 600; }
.mode-choice small { display: block; color: var(--muted); line-height: 1.4; margin-top: .15rem; }
.mode-choice:has(input:checked) { border-color: var(--ledger); box-shadow: inset 0 0 0 1px var(--ledger); background: var(--green-bg); }
.mode-choice:has(input:disabled) { cursor: not-allowed; opacity: .75; }
.mode-choice:has(input:focus-visible) { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---- Barcode scanning (order form) ---- */
.scan-bar { max-width: 560px; margin-bottom: 1rem; }
.scan-status { min-height: 1.25rem; margin-top: .35rem; color: var(--muted); }
.scan-video { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.scan-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 28% 12%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); pointer-events: none; }
.modal-fullscreen-sm-down .scan-video { aspect-ratio: 3 / 4; }
@media (min-width: 576px) { .modal-fullscreen-sm-down .scan-video { aspect-ratio: 4 / 3; } }
@keyframes scan-flash { from { background: var(--amber-bg); } to { background: transparent; } }
tr.scan-flash > td { animation: scan-flash 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { tr.scan-flash > td { animation: none; } }

/* ---- Order form: profit estimate ---- */
.order-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.profit-estimate { width: 100%; max-width: 400px; margin-left: auto; padding: .9rem 1rem; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--paper); }
.pe-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.pe-head h3 { font-size: .92rem; font-weight: 650; margin: 0; }
.pe-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.pe-badge:empty { display: none; }
.pe-badge.ok { background: var(--green-bg); color: var(--positive); }
.pe-badge.low { background: var(--amber-bg); color: var(--amber); }
.pe-badge.loss { background: var(--red-bg); color: var(--negative); }
.pe-note { font-size: .8rem; color: var(--muted); margin: .55rem 0 0; }
