/* LynxBilling design system: tokens and blocks (from design/mockups.css). Pages add layout only. */
@import url("fonts/fonts.css");

:root {
  --graphite: #33363C;
  --graphite-2: #44484F;
  --gold: #CC9A1E;
  --gold-light: #E3B547;
  --gold-wash: #FBF3DF;
  --ink: #2E2E2E;
  --muted: #666B73;
  --line: #DADCE0;
  --field-line: #8A8E95; /* field and choice edges: 3:1 against white (WCAG 1.4.11) */
  --line-soft: #ECEDEF;
  --canvas: #ECEEF1;
  --paper: #FFFFFF;
  --on-dark: #F2F3F5;
  --on-dark-muted: #A9ADB4;

  --green: #2D7A4E;  --green-bg: #E5F3EA;
  --red: #B0372F;    --red-bg: #FBE9E7;
  --blue: #2D5C9A;   --blue-bg: #E6EEF8;
  --violet: #66499C; --violet-bg: #EFEAF7;
  --amber: #8A5F06;  --amber-bg: #FBF1D9;
  --grey: #5C6067;   --grey-bg: #EDEEF0;

  --display: "Poppins", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 8px;
  --tear: 9px;
}

* { box-sizing: border-box; }
/* The hidden attribute always hides, whatever display a block sets (pages show and hide with it, never style.display). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.5 var(--body);
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
p { margin: 0; }
a { color: var(--graphite); }
.money, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.money { white-space: nowrap; }
.muted { color: var(--muted); }
.right { text-align: right; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; } /* darker gold: 5.6:1 on white, where brand gold is 2.6:1 */
/* Read by screen readers, not shown. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Places focus is moved to (a screen's h1, the main area after "Skip to content"): not controls, so no ring. */
[tabindex="-1"]:focus { outline: none; }
/* "Skip to content": the first thing a keyboard reaches, shown only while it has focus. */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 60; padding: 10px 14px; border-radius: 6px; background: var(--paper); color: var(--ink); font-weight: 600; }
.skip-link:focus { top: 12px; }

/* Vendor line at the foot of client pages and emails (account setting) */
.by-line { margin-top: 10px; font-size: 11.5px; color: var(--muted); text-align: center; letter-spacing: .02em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 14px/1 var(--body);
  padding: 10px 16px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #BFC2C7; }
.btn-primary { background: var(--graphite); border-color: var(--graphite); color: #fff; }
.btn-primary:hover { background: var(--graphite-2); }
.btn-pay { width: 100%; padding: 15px; font: 600 16px/1 var(--display); }
.icon-btn {
  width: 30px; height: 30px; border: 0; border-radius: 6px; background: none;
  color: var(--muted); cursor: pointer; font-size: 16px;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

/* Banners, help text, toasts */
.banner { margin: 12px 0 0; padding: 10px 12px; border-radius: 6px; font-size: 13.5px; }
.banner-error { color: var(--red); background: var(--red-bg); }
.banner-info { color: var(--blue); background: var(--blue-bg); }
.banner-warn { color: var(--amber); background: var(--amber-bg); }
/* A warning that must not be missed (the console with staff two-factor off in development): white on red, 5.9:1. */
.banner-danger { margin: 0 0 16px; color: #FFFFFF; background: var(--red); font-weight: 600; }
.help { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--graphite); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(30,32,36,.25); z-index: 50; }
.btn-wide { width: 100%; }
.btn-danger { color: var(--red); border-color: #E7B8B3; }
.btn-danger:hover { border-color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--graphite); text-decoration: underline; cursor: pointer; }
.badge-cancelled { color: var(--grey); background: var(--grey-bg); text-decoration: line-through; }

/* Tabs */
/* Tabs: links to a screen's own addresses (app.js tabLinks). They wrap on a narrow screen rather than scroll; the
   current one is marked by weight and its underline as well as colour. */
.tabs-row { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab-link { padding: 9px 12px; border: 0; background: none; font: 500 14px var(--body); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tab-link:hover { color: var(--ink); }
.tab-link[aria-selected="true"], .tab-link[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }

/* Dialog */
dialog.dialog { border: 0; border-radius: 12px; padding: 22px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(30,32,36,.3); color: var(--ink); }
dialog.dialog::backdrop { background: rgba(30,32,36,.45); }
.dialog h2 { margin-bottom: 14px; }
.dialog .actions { justify-content: flex-end; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* Empty state */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty p { margin-bottom: 14px; }

/* Status badges */
.badge {
  display: inline-block; font: 600 11.5px/1 var(--body); letter-spacing: .02em;
  padding: 5px 8px; border-radius: 99px; white-space: nowrap;
}
.badge-draft   { color: var(--grey);   background: var(--grey-bg); box-shadow: inset 0 0 0 1px #D3D5D9; }
.badge-sent    { color: var(--blue);   background: var(--blue-bg); }
.badge-viewed  { color: var(--violet); background: var(--violet-bg); }
.badge-partial { color: var(--amber);  background: var(--amber-bg); }
.badge-paid    { color: var(--green);  background: var(--green-bg); }
.badge-overdue { color: var(--red);    background: var(--red-bg); }

/* Fields */
.label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.field, select.field {
  width: 100%; font: 14px/1.3 var(--body); color: var(--ink);
  padding: 8px 10px; border: 1px solid var(--field-line); border-radius: 6px; background: var(--paper);
}
.field:focus { border-color: var(--graphite); } /* the ring is the :focus-visible one: the soft gold glow was 1.2:1 against white */
.field[aria-invalid="true"] { border-color: var(--red); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 6px 0; }
.check input { margin-top: 3px; accent-color: var(--graphite); }
.check small { display: block; color: var(--muted); font-size: 12.5px; }

/* The paper sheet with a torn till-receipt edge (the signature) */
.paper-wrap { filter: drop-shadow(0 1px 1px rgba(30,32,36,.08)) drop-shadow(0 10px 24px rgba(30,32,36,.08)); }
.paper {
  background: var(--paper);
  padding: 40px 44px calc(36px + var(--tear));
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--tear) * 2) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--tear) * 2) 100%;
}
.paper-both {
  padding-top: calc(28px + var(--tear));
  -webkit-mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--tear) * 2) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tear) * 2) 51% repeat-x;
          mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--tear) * 2) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tear) * 2) 51% repeat-x;
}
.perf { border: 0; border-top: 1px dashed var(--line); margin: 20px 0; }

/* Invoice document blocks (shared by editor and pay page) */
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.biz-mark { display: flex; align-items: center; gap: 10px; }
.biz-logo {
  width: 40px; height: 40px; border-radius: 8px; background: #1F4D45; color: #fff;
  display: grid; place-items: center; font: 700 18px/1 var(--display);
}
/* A brand's own logo in place of the initial (brands.js): its shape kept, never taller than the initial's square */
.biz-logo-img { height: 40px; width: auto; max-width: 160px; object-fit: contain; display: block; }
.brand-logo-preview { height: 32px; width: auto; max-width: 120px; object-fit: contain; vertical-align: middle; }
.biz-name { font: 600 17px/1.2 var(--display); }
.doc-title { font: 700 13px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); text-align: right; }
.doc-number { font: 500 20px/1.3 var(--mono); text-align: right; margin-top: 6px; white-space: nowrap; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 32px; font-size: 14px; }
/* "Bill to", "For": second-level headings under the page's h1, drawn as small labels */
.doc-parties h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; margin: 0; }
.doc-meta { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 24px; margin-top: 24px; font-size: 13.5px; justify-content: start; }
.doc-meta dt { color: var(--muted); font-size: 12px; }
.doc-meta dd { margin: 0; font-family: var(--mono); font-size: 13.5px; }
.lines { width: 100%; border-collapse: collapse; margin-top: 28px; font-size: 14px; }
.lines th { text-align: left; font: 500 12px/1 var(--body); color: var(--muted); padding: 8px 6px; border-bottom: 1.5px solid var(--graphite); }
.lines th.right { text-align: right; }
.lines td { padding: 10px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.lines .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { margin: 18px 0 0 auto; width: min(300px, 100%); font-size: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 6px; }
.totals .grand { border-top: 1.5px solid var(--graphite); margin-top: 6px; padding-top: 10px; font-weight: 600; }
.totals .grand .money { font-size: 18px; font-weight: 500; }
.doc-notes { margin-top: 28px; font-size: 13.5px; color: var(--muted); }

/* App shell (account side) */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--graphite); color: var(--on-dark);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
}
.side-logo { height: 40px; margin: 4px 8px 22px; align-self: flex-start; }
.side-account { margin: 0 8px 18px; font-size: 13px; color: var(--on-dark-muted); }
.side-account strong { display: block; color: var(--on-dark); font: 600 14px/1.3 var(--display); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px;
  color: var(--on-dark-muted); text-decoration: none; font-size: 14.5px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--on-dark); }
.nav-item[aria-current="page"] { background: rgba(255,255,255,.08); color: var(--on-dark); border-left-color: var(--gold-light); }
.side :focus-visible { outline-color: var(--gold-light); } /* the darker gold ring is 2.2:1 on graphite; light gold is 6.3:1 */
.side-foot { margin-top: auto; padding: 14px 8px 0; font-size: 12px; color: var(--on-dark-muted); border-top: 1px solid rgba(255,255,255,.1); }
.side-foot .plan { display: inline-block; margin-bottom: 8px; padding: 3px 8px; border-radius: 99px; border: 1px solid rgba(227,181,71,.5); color: var(--gold-light); }
.main { min-width: 0; padding: 24px 32px 48px; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.crumbs { font-size: 13px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The top-right corner (app.js, decisions log 22 October 2026), as Lynxdesk's dashboard top bar: a grid button and the
   person's initials, 30px each and 12px apart, each opening a small white panel under it, right-aligned. The corner
   comes after the support-visit banner on the page and its panels open downwards, so they never cover the banner. */
.corner { display: flex; justify-content: flex-end; gap: 12px; margin: -8px 0 12px; }
.corner-spot { position: relative; }
.corner-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.corner-btn:hover, .corner-btn[aria-expanded="true"], .corner-btn[aria-pressed="true"] { background: var(--line); color: var(--ink); }
.corner-face { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--graphite); color: #fff; font: 700 11px/1 var(--body); letter-spacing: .03em; }
.corner-btn.corner-face:hover, .corner-btn.corner-face[aria-expanded="true"] { background: var(--graphite-2); color: #fff; box-shadow: 0 0 0 2px var(--line); }
.corner-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(250px, calc(100vw - 32px)); padding: 8px 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(30,32,36,.14); font-size: 14px; }
.corner-profile { width: min(270px, calc(100vw - 32px)); }
.corner-item { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 20px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
a.corner-item:hover, button.corner-item:hover { background: var(--line-soft); }
.corner-item[aria-current] { font-weight: 600; }
.corner-item[aria-current]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--gold); }
.corner-soon { color: var(--muted); cursor: default; }
.corner-soon small { font-size: 12px; }
.corner-sep { border-top: 1px solid var(--line-soft); margin: 6px 0; }
.corner-who { display: flex; gap: 12px; align-items: center; padding: 8px 20px 10px; }
.corner-who b { display: block; font: 600 14px/1.3 var(--display); }
.corner-who small { display: block; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.corner-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 0 20px 8px; color: var(--muted); font-size: 13px; }
.corner-out { justify-content: center; color: var(--muted); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin-bottom: 12px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 500 12px/1 var(--body); color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table th[scope="row"] { font: inherit; color: inherit; text-align: left; padding: 11px 12px; }
.table td .link { padding: 2px 0; } /* Edit, Archive, Revoke: at least 24px tall */
.scroll { overflow-x: auto; position: relative; } /* relative: a screen-reader-only label in a cell stays inside the box, not past the page's edge */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 2px; }
  .side-logo { margin: 0 12px 0 0; height: 26px; }
  .side-account, .side-foot { display: none; }
  .nav-item { padding: 7px 9px; font-size: 13.5px; border-left: 0; }
  .main { padding: 20px 16px 40px; }
  .paper { padding: 28px 20px calc(28px + var(--tear)); }
  .doc-parties { grid-template-columns: 1fr; gap: 16px; }
  .doc-meta { grid-template-columns: repeat(2, auto); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Integrations (Settings > Integrations): a card per way of getting paid. The status is the badge's word, never its
   colour alone; a card not built yet is dashed, with no buttons. */
.badge-soon { color: var(--grey); background: var(--paper); box-shadow: inset 0 0 0 1px var(--field-line); }
.integrations { list-style: none; margin: 16px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.integration { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-width: 0; }
.integration-soon { border-style: dashed; }
.integration-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.integration-head h2 { margin: 0; font-size: 16px; }
.integration-text { font-size: 14px; }
.integration-note { align-self: flex-start; font: 600 11.5px/1 var(--body); padding: 4px 8px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--field-line); }
.integration-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; font-size: 13.5px; }
.integration-facts dt { color: var(--muted); }
.integration-facts dd { margin: 0; overflow-wrap: anywhere; }
.integration .banner { margin: 0; }
.integration p[role="status"]:empty { display: none; }
.integration .actions { margin-top: auto; padding-top: 4px; }
.integration .btn { padding: 8px 12px; font-size: 13.5px; }
/* A group of ticks with its own heading (Settings > Emails, payment reminders). */
fieldset.checks { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
fieldset.checks legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
/* Touch targets: 44 by 44 on a phone (Russell, 12 November 2026; Apple and Google guidance), 24 by 24 at least
   elsewhere (WCAG 2.2 2.5.8). test/widths-browser.mjs checks both. */
@media (max-width: 599px) {
  .btn, .icon-btn, .nav-item, .skip-link, .side-logo-link, button, select,
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]) { min-height: 44px; }
  .btn, .icon-btn, button { min-width: 44px; }
  .icon-btn { width: 44px; height: 44px; }
}
