/* ============================================================
   Invoice Console — dual-theme token system.
   Every colour pair in here is checked against WCAG 2.1 AA by
   build/audit_contrast.py: 4.5:1 for text, 3:1 for control
   boundaries and meaningful graphics.
   The theme is resolved to an explicit data-bs-theme by the
   inline script in base.html, so Bootstrap's own components
   switch with us.  The media query below is the no-JS fallback.
   ============================================================ */
:root{
  /* The page is deliberately a few steps darker than the cards: at #eceff3
     the light theme read as one flat white sheet. mute and rule-strong are
     darkened to keep their ratios on the new ground. */
  --page:#cbd6e2; --card:#ffffff; --sunk:#f1f4f7;
  --ink:#131c26; --ink-2:#333f4b; --mute:#4e5862;
  --rule:#c3cdd6; --rule-strong:#6d7985;
  --accent:#0b6340; --danger:#b3261e; --success:#136a3e; --warn:#7a5300;
  --accent-soft:#e2efe8;
  --draft-bg:#e6eaee; --draft-fg:#414c56;
  --gen-bg:#e3eefb;   --gen-fg:#14528f;
  --sub-bg:#e0f2e8;   --sub-fg:#0f5a35;
  --fail-bg:#fbe6e4;  --fail-fg:#8f1d16;
  --warn-bg:#fdf3e2;  --warn-bd:#b5851f;
  --chrome-bg:#131c26; --chrome-ink:#e8eef4; --chrome-mute:#9fb0c0;
  --chrome-rule:#2b3742; --chrome-hover:#1e2a36;
  --shadow:0 1px 2px rgba(16,24,32,.05);
  --brand-text:var(--brand-text-light,#1F3A5F);
  --brand-bar:var(--brand-bar-light,#1F3A5F);
  --brand-btn:var(--brand-btn-light,#1F3A5F);
  --brand-btn-fg:var(--brand-btn-fg-light,#ffffff);
}
@media (prefers-color-scheme:dark){
  :root:not([data-bs-theme="light"]){
    --page:#0b1016; --card:#1e2833; --sunk:#27333f;
    --ink:#e8eef4; --ink-2:#c2cdd8; --mute:#98a6b4;
    --rule:#333f4c; --rule-strong:#77848f;
    --accent:#4fc48d; --danger:#ff9b91; --success:#6edb9f; --warn:#e6b355;
    --accent-soft:#15291f;
    --draft-bg:#242e38; --draft-fg:#b9c5d1;
    --gen-bg:#12293f;   --gen-fg:#8ec5f7;
    --sub-bg:#0f2a1d;   --sub-fg:#71dda3;
    --fail-bg:#33191a;  --fail-fg:#f6a19a;
    --warn-bg:#2c2113;  --warn-bd:#e6b355;
    --chrome-bg:#0b1016; --chrome-ink:#e8eef4; --chrome-mute:#9fb0c0;
    --chrome-rule:#232e3a; --chrome-hover:#151d26;
    --shadow:0 1px 2px rgba(0,0,0,.5);
    --brand-text:var(--brand-text-dark,#8fa3bb);
    --brand-bar:var(--brand-bar-dark,#8fa3bb);
    --brand-btn:var(--brand-btn-dark,#556985);
    --brand-btn-fg:var(--brand-btn-fg-dark,#ffffff);
  }
}
[data-bs-theme="dark"]{
  --page:#0b1016; --card:#1e2833; --sunk:#27333f;
  --ink:#e8eef4; --ink-2:#c2cdd8; --mute:#98a6b4;
  --rule:#333f4c; --rule-strong:#77848f;
  --accent:#4fc48d; --danger:#ff9b91; --success:#6edb9f; --warn:#e6b355;
  --accent-soft:#15291f;
  --draft-bg:#242e38; --draft-fg:#b9c5d1;
  --gen-bg:#12293f;   --gen-fg:#8ec5f7;
  --sub-bg:#0f2a1d;   --sub-fg:#71dda3;
  --fail-bg:#33191a;  --fail-fg:#f6a19a;
  --warn-bg:#2c2113;  --warn-bd:#e6b355;
  --chrome-bg:#0b1016; --chrome-ink:#e8eef4; --chrome-mute:#9fb0c0;
  --chrome-rule:#232e3a; --chrome-hover:#151d26;
  --shadow:0 1px 2px rgba(0,0,0,.5);
  --brand-text:var(--brand-text-dark,#8fa3bb);
  --brand-bar:var(--brand-bar-dark,#8fa3bb);
  --brand-btn:var(--brand-btn-dark,#556985);
  --brand-btn-fg:var(--brand-btn-fg-dark,#ffffff);
}

body{background:var(--page);color:var(--ink);font-size:14.5px;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.mono,.num{font-variant-numeric:tabular-nums;
  font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace}

/* focus: one visible, high-contrast treatment everywhere */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--accent);outline-offset:2px;border-radius:4px}

.skip{position:absolute;left:-9999px;top:0;z-index:1080;
  background:var(--card);color:var(--ink);padding:.6rem 1rem;border:2px solid var(--accent);
  border-radius:0 0 6px 0;font-weight:600}
.skip:focus{left:0}

/* chrome */
.navbar{background:var(--chrome-bg);border-bottom:1px solid var(--chrome-rule)}
.navbar-brand-mark{width:30px;height:30px;border-radius:6px;background:var(--brand-btn);
  color:var(--brand-btn-fg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:0 0 auto}
.navbar-brand-mark img{width:100%;height:100%;object-fit:contain;border-radius:6px;background:#fff}
.navbar .navbar-brand{color:var(--chrome-ink)}
.navbar .nav-link{color:var(--chrome-mute);font-weight:500;padding:.35rem .8rem;border-radius:6px}
.navbar .nav-link:hover{color:var(--chrome-ink);background:var(--chrome-hover)}
.navbar .nav-link.active{color:var(--chrome-ink);background:var(--chrome-hover);font-weight:600}

/* theme switch */
.theme-switch{display:inline-flex;border:1px solid var(--chrome-rule);border-radius:7px;overflow:hidden}
.theme-switch button{background:transparent;color:var(--chrome-mute);border:0;padding:.3rem .5rem;
  display:grid;place-items:center;line-height:0}
.theme-switch button+button{border-left:1px solid var(--chrome-rule)}
.theme-switch button:hover{background:var(--chrome-hover);color:var(--chrome-ink)}
.theme-switch button[aria-pressed="true"]{background:var(--accent);color:#0b1016}
.theme-switch svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}

/* cards */
.card{background:var(--card);border:1px solid var(--rule);border-radius:10px;box-shadow:var(--shadow)}
.card-header{background:var(--card);border-bottom:1px solid var(--rule);color:var(--ink);
  font-weight:600;font-size:13px;padding:.7rem 1rem}
.section-label{font-size:10.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;
  color:var(--mute)}
h1,h2,h3,h4,h5{color:var(--ink)}
.text-muted{color:var(--mute)!important}
.text-danger{color:var(--danger)!important}
.text-success{color:var(--success)!important}

/* stat tiles */
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:1px;
  background:var(--rule);border:1px solid var(--rule);border-radius:10px;overflow:hidden}
.tile{background:var(--card);padding:14px 16px}
.tile .k{font-size:10.5px;font-weight:700;letter-spacing:.11em;text-transform:uppercase;
  color:var(--mute);display:block;margin-bottom:6px}
.tile .v{font-size:1.35rem;font-weight:600;line-height:1.1;display:block;
  font-variant-numeric:tabular-nums;color:var(--ink)}
.tile .n{font-size:11.5px;color:var(--mute);display:block;margin-top:4px}
.tile.accent .v{color:var(--accent)}
.tile.brand .v{color:var(--brand-text)}

/* burn bar */
.burn{height:26px;border-radius:6px;background:var(--sunk);overflow:hidden;position:relative;
  border:1px solid var(--rule-strong)}
.burn .fill{height:100%;background:var(--brand-bar)}
.burn .pace{position:absolute;top:-3px;bottom:-3px;width:3px;background:var(--danger)}
.burn-legend{display:flex;justify-content:space-between;gap:1rem;font-size:11.5px;
  color:var(--mute);margin-top:5px}

/* tables */
table.tight{font-size:13.5px;color:var(--ink)}
table.tight th{font-size:10.5px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;
  color:var(--mute);border-bottom:1px solid var(--rule-strong)!important;white-space:nowrap;
  background:var(--sunk)}
table.tight td{border-bottom:1px solid var(--rule);vertical-align:middle;color:var(--ink)}
table.tight tr:last-child td{border-bottom:none}
.table{--bs-table-bg:transparent;--bs-table-color:var(--ink)}

/* status badges — shape and word carry the meaning, colour only reinforces */
.hp-field{position:absolute;left:-9999px;top:-9999px;width:1px;height:1px;
  overflow:hidden}

.badge-status{font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  padding:.28em .6em;border-radius:5px;border:1px solid transparent;display:inline-block}
.s-queued{background:var(--draft-bg);color:var(--draft-fg);border-color:var(--rule-strong)}
.s-running{background:var(--gen-bg);color:var(--gen-fg);border-color:var(--gen-fg)}
.s-done{background:var(--sub-bg);color:var(--sub-fg);border-color:var(--sub-fg)}
.s-failed{background:var(--fail-bg);color:var(--fail-fg);border-color:var(--fail-fg)}

/* forms and buttons */
.btn-brand{background:var(--brand-btn);border-color:var(--brand-btn);
  color:var(--brand-btn-fg);font-weight:500}
.navbar .btn-brand{background:var(--brand-chrome);border-color:var(--brand-chrome);
  color:var(--brand-chrome-fg)}
.navbar-brand-mark{background:var(--brand-chrome);color:var(--brand-chrome-fg)}
.btn-brand:hover,.btn-brand:focus{filter:brightness(1.14);color:var(--brand-btn-fg)}
.form-label{font-size:12px;font-weight:600;color:var(--ink-2);margin-bottom:.25rem}
.form-control,.form-select{background:var(--card);color:var(--ink);border-color:var(--rule-strong)}
.form-control::placeholder{color:var(--mute)}
.form-control:focus,.form-select:focus{background:var(--card);color:var(--ink);
  border-color:var(--accent);box-shadow:0 0 0 .2rem color-mix(in srgb,var(--accent) 26%,transparent)}
.alert{border-radius:8px}
.alert-light{background:var(--sunk)!important;color:var(--ink)!important;border-color:var(--rule-strong)!important}
.alert-warning{background:var(--warn-bg)!important;color:var(--ink)!important;border-color:var(--warn-bd)!important}
.alert-success{background:var(--sub-bg)!important;color:var(--ink)!important;border-color:var(--sub-fg)!important}
.alert-danger{background:var(--warn-bg)!important;color:var(--ink)!important;border-color:var(--danger)!important}
.btn-outline-secondary{color:var(--ink-2);border-color:var(--rule-strong)}
.btn-outline-secondary:hover{background:var(--sunk);color:var(--ink);border-color:var(--rule-strong)}

/* template chooser */
.tpl-card{display:block;border:2px solid var(--rule-strong);border-radius:10px;overflow:hidden;
  background:var(--card);height:100%}
.tpl-card:hover{border-color:var(--accent)}
.tpl-card.sel{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 26%,transparent)}
.tpl-card:focus-within{outline:3px solid var(--accent);outline-offset:2px}
.tpl-frame{height:300px;overflow:hidden;background:#fff;border-bottom:1px solid var(--rule)}
.tpl-card iframe{border:0;background:#fff;transform:scale(.62);transform-origin:top left;
  width:161%;height:484px;pointer-events:none}

.visually-hidden-focusable:not(:focus):not(:focus-within){position:absolute!important;
  width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
@media (prefers-contrast:more){
  :root{--rule:var(--rule-strong)}
  .card,.tiles{border-width:2px}
}

/* ============================================================
   Mobile. Three things drive the breakpoints below:
   an odd tile count leaves a hole in a 2-up grid; card headers
   that carry a control need to wrap rather than collide; and
   wide tables read better stacked than side-scrolled.
   ============================================================ */

/* nothing may push the page sideways */
html,body{max-width:100%;overflow-x:hidden}

/* card headers that also hold a control */
.card-header{display:flex;align-items:center;justify-content:space-between;
  flex-wrap:wrap;gap:.5rem .75rem}
.card-header>form{flex-wrap:wrap}

/* tables scroll inside their own box, never the page */
.table-responsive{-webkit-overflow-scrolling:touch}
.table-responsive>table.tight{min-width:460px}

@media (max-width:991.98px){
  .tpl-frame{height:210px}
  .tpl-card iframe{transform:scale(.44);width:227%;height:477px}
}

@media (max-width:767.98px){
  body{font-size:15px}
  main.container-fluid{padding-left:1rem!important;padding-right:1rem!important}

  /* an odd last tile spans the row instead of leaving a hole */
  .tiles{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tiles .tile:nth-child(odd):last-child{grid-column:1/-1}
  .tile .v{font-size:1.2rem}

  /* header block stops trying to be a two-column layout */
  .page-head{flex-direction:column;align-items:flex-start!important}
  .page-head .text-end{text-align:left!important}

  /* alerts with an action stack the action underneath */
  .alert-stack{flex-direction:column;align-items:flex-start!important;gap:.6rem}
  .alert-stack .btn{align-self:flex-start}

  .burn-legend{flex-wrap:wrap;gap:.25rem .75rem}
  .burn-legend .mid{order:3;flex-basis:100%;text-align:center}

}

@media (max-width:359.98px){
  .tiles{grid-template-columns:1fr}
  .tiles .tile:nth-child(odd):last-child{grid-column:auto}
}
@media (max-width:575.98px){
  h1.h4{font-size:1.28rem}
}

/* touch targets: 44px minimum where the pointer is a finger */
@media (pointer:coarse){
  .theme-switch button{min-width:44px;min-height:44px}
  .navbar .nav-link{padding-top:.6rem;padding-bottom:.6rem}
  .btn-sm{min-height:38px}
  table.tight td .form-select{min-height:38px}
}

/* the navbar's right-hand cluster stacks once collapsed */
@media (max-width:991.98px){
  .navbar-collapse .nav-actions{flex-direction:column;align-items:stretch!important;
    gap:.5rem!important;padding-top:.75rem;margin-top:.5rem;border-top:1px solid var(--rule)}
  .navbar-collapse .nav-actions .btn{width:100%}
  .navbar-collapse .theme-switch{align-self:flex-start}
}

/* ============================================================
   Focus and scroll. The navbar is sticky, so anything scrolled
   to must reserve room for it or it lands underneath.
   ============================================================ */
:root{ --nav-h:57px; }   /* measured header height; shell padding and
                             scroll-margin both key off this */
h1,h2,h3,.card,.alert,.tile,
input,select,textarea,summary,[tabindex]{ scroll-margin-top:calc(var(--nav-h) + 16px); }

/* the field the page has sent you to */
.field-attention{
  animation:field-ping 1.1s ease-out 1;
}
@keyframes field-ping{
  0%   { box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 55%,transparent); }
  100% { box-shadow:0 0 0 12px transparent; }
}
@media (prefers-reduced-motion:reduce){ .field-attention{ animation:none; } }

/* invalid controls read as invalid without relying on colour alone */
.form-control:user-invalid,.form-select:user-invalid{
  border-color:var(--danger); border-width:2px;
}

/* ---------- account menu ---------- */
.user-chip{
  width:26px;height:26px;border-radius:50%;flex:0 0 auto;
  background:var(--brand-btn);color:var(--brand-btn-fg);
  display:grid;place-items:center;font-size:11px;font-weight:700;letter-spacing:.02em;
}
.navbar .dropdown-toggle{
  background:none;border:0;color:var(--chrome-mute);font-weight:500;
  padding:.3rem .6rem;border-radius:6px;
}
.navbar .dropdown-toggle:hover{background:var(--chrome-hover);color:var(--chrome-ink)}
.navbar .dropdown-toggle.active{background:var(--chrome-hover);color:var(--chrome-ink);font-weight:600}
.navbar .dropdown-toggle::after{color:var(--chrome-mute)}
.dropdown-menu{
  background:var(--card);border:1px solid var(--rule-strong);border-radius:9px;
  box-shadow:0 8px 28px -12px rgba(16,24,32,.4);padding:.35rem;min-width:12rem;
}
/* holds an email address, so no uppercasing and no letter-spacing */
.dropdown-header{
  color:var(--mute);font-size:12px;font-weight:600;padding:.4rem .6rem;
}
.dropdown-item{color:var(--ink);border-radius:6px;padding:.42rem .6rem;font-size:14px}
.dropdown-item:hover,.dropdown-item:focus{background:var(--sunk);color:var(--ink)}
.dropdown-item.active,.dropdown-item:active{
  background:var(--accent-soft,var(--sunk));color:var(--accent);font-weight:600;
}
.dropdown-divider{border-color:var(--rule);margin:.3rem 0}

/* Below lg the toggle itself shows the address, so the menu header repeats it. */
@media (max-width:991.98px){
  .navbar .dropdown-header,
  .navbar .dropdown-menu > li:first-child + li > .dropdown-divider{ display:none; }
  .navbar .dropdown-menu{ width:100%; }
}

/* profile pictures */
.user-chip img,.avatar-lg img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block}
.avatar-lg{
  width:84px;height:84px;border-radius:50%;flex:0 0 auto;overflow:hidden;
  background:var(--brand-btn);color:var(--brand-btn-fg);
  display:grid;place-items:center;font-size:26px;font-weight:700;
  border:1px solid var(--rule-strong);
}
.user-chip{overflow:hidden}

/* "or" divider between sign-in methods */
.sep-or{display:flex;align-items:center;gap:.75rem;margin:1rem 0;color:var(--mute);font-size:12px}
.sep-or::before,.sep-or::after{content:"";flex:1;height:1px;background:var(--rule-strong)}

/* An 11-column record table cannot fit a tablet either, so it stacks up to lg
   rather than md; at 768px it previously fell back to a scrolling table that
   still pushed the page sideways. */
@media (max-width:991.98px){
  /* Wide record tables become one card per row. The header cell text is
     carried on each td as data-label, so the table stays a real table for
     assistive tech while reading as a list on a phone. */
  /* The table element keeps its content width unless it stops laying out as
     a table, which is what overflowed. Changing display drops the implicit
     table semantics, so the markup carries explicit ARIA roles. */
}

/* Every page's heading sits in the same container as the rest of its content,
   rather than floating on the page background. */
.page-head{background:var(--card);border:1px solid var(--rule);border-radius:10px;
  box-shadow:var(--shadow);padding:1rem 1.15rem;margin-bottom:1rem;
  display:flex;justify-content:space-between;align-items:flex-end;gap:1rem;flex-wrap:wrap}
.page-head h1{margin:0}
.page-head .page-head-sub{color:var(--mute);font-size:13px;margin:.15rem 0 0}
@media (max-width:767.98px){
  .page-head{flex-direction:column;align-items:flex-start;padding:.9rem 1rem}
  .page-head .text-end{text-align:left!important}
}

/* ---------- shell: footer sits after the content, and at the bottom of a
   short page rather than floating mid-screen ---------- */
body.app-shell{min-height:100vh;display:flex;flex-direction:column;
  padding-top:var(--nav-h)}
body.app-shell > main{flex:1 0 auto}

/* Fixed, not sticky: the nav lives inside <header>, which is a flex item of
   the shell, so a sticky nav could only stick within its own header box and
   scrolled away with it. */
.site-header{position:fixed;top:0;left:0;right:0;z-index:1030}
.site-header .navbar{width:100%}
/* the collapsed menu can exceed the viewport on a phone */
@media (max-width:991.98px){
  .site-header .navbar-collapse{max-height:calc(100vh - var(--nav-h));overflow-y:auto}
}
.site-footer{flex-shrink:0;border-top:1px solid var(--chrome-rule);background:var(--chrome-bg);
  color:var(--chrome-mute);font-size:12.5px}
.footer-inner{max-width:1320px;margin:0 auto;padding:.9rem 1.5rem;
  display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.footer-grow{flex:1 1 auto}
.footer-sep{color:var(--chrome-rule)}
@media (max-width:575.98px){
  .footer-inner{padding:.8rem 1rem;font-size:12px}
  .footer-grow{flex-basis:100%;height:0}
}

/* ---------- wide record tables become one card per row ----------
   The invoice table needs ~1070px for its eleven columns, so it stacks below
   xl rather than at some breakpoint that merely looks plausible.
   The table element must stop laying out as a table or it keeps its content
   width and pushes the page sideways; that drops implicit table semantics, so
   the markup carries explicit ARIA roles. */
@media (max-width:1199.98px){
  table.stacked{display:block;width:100%;min-width:0!important}
  table.stacked tbody{display:block;width:100%}
  table.stacked thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
  table.stacked tr{display:block;border:1px solid var(--rule);border-radius:9px;
    padding:.5rem .75rem;margin-bottom:.6rem;background:var(--card)}
  table.stacked td{display:flex;justify-content:space-between;align-items:center;gap:1rem;
    border:0;border-bottom:1px solid var(--rule);padding:.42rem 0;text-align:left!important}
  table.stacked tr td:last-child{border-bottom:0}
  table.stacked td::before{content:attr(data-label);font-size:10.5px;font-weight:700;
    letter-spacing:.08em;text-transform:uppercase;color:var(--mute);flex:0 0 auto}
  table.stacked td:empty{display:none}
  table.stacked td.rowhead{border-bottom:1px solid var(--rule-strong);padding-top:0}
  table.stacked td.rowhead::before{content:none}
  table.stacked td.rowhead a{font-size:1.05rem}
  .stacked-wrap{overflow:visible!important}
}

/* the invoice the link was sent for, led with rather than buried in a table */
.invoice-hero{border-color:var(--accent);border-width:2px}
.invoice-hero .hero-amount{font-size:2rem;font-weight:600;line-height:1.1;color:var(--ink)}
@media (max-width:575.98px){
  .invoice-hero .hero-amount{font-size:1.6rem}
  .invoice-hero .btn-lg{width:100%;justify-content:center}
}

/* ---------- guided tour ---------- */
.tour-mask{position:fixed;inset:0;background:rgba(8,12,16,.62);z-index:1080}
.tour-hole{position:absolute;z-index:1081;border-radius:10px;pointer-events:none;
  box-shadow:0 0 0 3px var(--accent),0 0 0 9999px rgba(8,12,16,.62)}
.tour-pop{position:absolute;z-index:1082;max-width:340px;background:var(--card);
  color:var(--ink);border:1px solid var(--rule-strong);border-radius:11px;
  padding:1rem 1.1rem;box-shadow:0 14px 40px -12px rgba(0,0,0,.55)}
.tour-step{font-size:10.5px;font-weight:700;letter-spacing:.13em;text-transform:uppercase;
  color:var(--mute);margin:0 0 .35rem}
.tour-title{font-size:1rem;font-weight:600;margin:0 0 .35rem;color:var(--ink)}
.tour-body{font-size:13.5px;color:var(--ink-2);margin:0 0 .9rem}
.tour-actions{display:flex;align-items:center;gap:.4rem}
.tour-grow{flex:1 1 auto}
.tour-actions .btn-link{color:var(--mute);text-decoration:underline;padding-left:0}
.tour-actions .btn-link:hover{color:var(--ink)}
body.tour-open{overflow:hidden}
@media (max-width:575.98px){ .tour-pop{max-width:none} }
@media (prefers-reduced-motion:reduce){ .tour-hole{transition:none} }
.tour-launch{color:var(--mute);text-decoration:underline;font-size:12.5px}
.tour-launch:hover{color:var(--ink)}

/* ---------- charts ----------
   Single-series, so no legend: the card header names the series and every
   value is direct-labelled instead of carrying an axis. Hues validated against
   both card surfaces (>=3:1, inside the lightness band, above the chroma floor). */
:root{ --chart-1:#0d7a4a; --chart-1-soft:#0d7a4a26; --chart-track:#e6ebf0; }
@media (prefers-color-scheme:dark){
  :root:not([data-bs-theme="light"]){ --chart-1:#38a06f; --chart-1-soft:#38a06f33;
    --chart-track:#27333f; }
}
[data-bs-theme="dark"]{ --chart-1:#38a06f; --chart-1-soft:#38a06f33; --chart-track:#27333f; }

.chart svg{width:100%;height:auto;display:block;overflow:visible}
.chart .axis{stroke:var(--rule);stroke-width:1}
.chart .ceiling{stroke:var(--rule-strong);stroke-width:1;stroke-dasharray:3 3}
.chart .ceiling-label{fill:var(--mute)}
.chart .bar rect{fill:var(--chart-1)}
.chart .bar .bar-foot{fill:var(--chart-1)}      /* square the base of a rounded bar */
.chart .area{fill:var(--chart-1-soft);stroke:none}
.chart .line{fill:none;stroke:var(--chart-1);stroke-width:2;
  stroke-linejoin:round;stroke-linecap:round}
.chart .pt circle{fill:var(--chart-1);stroke:var(--card);stroke-width:2}
.chart text{font-family:inherit}
.chart .v{fill:var(--ink);font-size:12px;font-weight:600;text-anchor:middle;
  font-variant-numeric:tabular-nums}
.chart .k{fill:var(--mute);font-size:11px;text-anchor:middle}
.chart .bar:hover rect,.chart .bar:focus-visible rect,
.chart .pt:hover circle,.chart .pt:focus-visible circle{filter:brightness(1.15)}
.chart g:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (max-width:575.98px){ .chart .k{font-size:10px} .chart .v{font-size:11px} }

/* Passkey sign-in is a peer of the password, not a lesser option: it carries
   the accent rather than the muted outline that made it recede. */
.btn-passkey{
  background:var(--accent-soft);color:var(--accent);
  border:2px solid var(--accent);font-weight:600;
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
}
.btn-passkey:hover,.btn-passkey:focus-visible{
  background:var(--accent);color:var(--card);border-color:var(--accent);
}
.btn-passkey svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}

/* feature list on the sign-in page */
.feature-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.8rem}
.feature-list li{display:flex;gap:.7rem;align-items:flex-start;font-size:13.5px;color:var(--ink-2)}
.feature-list strong{color:var(--ink);font-weight:600}
.feature-mark{flex:0 0 auto;width:20px;height:20px;border-radius:50%;
  background:var(--accent-soft);display:grid;place-items:center;margin-top:.1rem}
.feature-mark svg{width:12px;height:12px;fill:none;stroke:var(--accent);
  stroke-width:3;stroke-linecap:round;stroke-linejoin:round}

/* --- step rail -----------------------------------------------------------
   Where this invoice is in the process. Every colour here is an existing
   audited pair: accent on accent-soft, ink/mute on card, rule-strong borders. */
.steps{list-style:none;display:flex;flex-wrap:wrap;gap:.35rem;margin:0;padding:.5rem .75rem;
  background:var(--card);border:1px solid var(--rule);border-radius:.5rem}
.steps li{display:flex;align-items:center;gap:.45rem;font-size:13px;color:var(--mute);
  padding:.15rem .6rem .15rem .15rem}
.steps li + li::before{content:"";width:14px;height:1px;background:var(--rule-strong);
  margin-right:.45rem;flex:0 0 auto}
.steps .mark{flex:0 0 auto;width:20px;height:20px;border-radius:50%;
  display:grid;place-items:center;font-size:11px;font-weight:700;
  border:1px solid var(--rule-strong);color:var(--mute);background:var(--card)}
.steps .now, .steps .done{color:var(--ink);font-weight:600}
.steps .now .mark, .steps .done .mark{background:var(--accent-soft);color:var(--accent);
  border-color:var(--accent)}
@media (max-width:575.98px){ .steps li{font-size:12px} }

/* An advanced control that is right there but not in the way. */
details.opt > summary{cursor:pointer;font-size:13px;color:var(--ink-2);
  padding:.35rem .5rem;border:1px solid var(--rule);border-radius:.375rem;
  background:var(--sunk)}
details.opt > summary:hover{color:var(--ink)}
details.opt > summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
