/* ==========================================================================
   Koodu · "Backwater brights"
   The chosen look, developed into a full system. One hand-written stylesheet,
   written the way the Django templates will use it (no framework).

   Ideas that carry the look:
   - white cards on a cool ground, a light side rail with a coloured tile per section
   - every client and every person has a colour, used the same way on every screen
   - a rounded grotesque (Bricolage) for headings and big numbers, Figtree for text
   - colour always comes as a pale wash with dark text on it, so contrast holds
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #F2F5F7;            /* page ground */
  --card: #FFFFFF;
  --sunk: #F7F9FA;          /* table heads, inset areas */
  --ink: #14202B;           /* text */
  --ink-2: #4A5866;         /* secondary text (>= 6:1 on white) */
  --ink-3: #5E6B78;         /* tertiary text (>= 5:1 on white) */
  --line: #E1E7EC;
  --line-2: #EEF2F5;

  --lagoon: #0E7C7B;        /* primary actions */
  --lagoon-ink: #0A5E5D;
  --lagoon-wash: #DDF2F0;
  --late: #C2410C;          /* overdue, destructive */
  --late-wash: #FFE8DC;

  /* the shared palette: wash = fill, ink = text on the wash, solid = dots, bars, rings */
  --coral: #F2603D;  --coral-wash: #FFE3DA;  --coral-ink: #A33A1C;
  --mango: #F5A524;  --mango-wash: #FFF0CC;  --mango-ink: #7A5200;
  --leaf: #2F9E44;   --leaf-wash: #DCF3E1;   --leaf-ink: #1E6B30;
  --sky: #2F7DE1;    --sky-wash: #DCEAFD;    --sky-ink: #1D4F9E;
  --orchid: #9B4DCA; --orchid-wash: #F1E3FA; --orchid-ink: #6E2E99;
  --hib: #D6336C;    --hib-wash: #FDEBEF;    --hib-ink: #9E2340;
  --clay: #B86B35;   --clay-wash: #F5E7DA;   --clay-ink: #7A4520;

  /* BridgingDots' own letterhead colour, taken from the invoices it sends today.
     Used only on document previews (invoice, credit note, vouchers), never in the app. */
  --brand: #80236C;

  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --sans: "Figtree", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20,32,43,0.04), 0 6px 20px rgba(20,32,43,0.05);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body { margin: 0; }
sc-for, sc-if { display: contents; }               /* repeat wrappers must not break grids */
.k { font-family: var(--sans); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
.k h1, .k h2, .k h3, .k p { margin: 0; }
.k a { color: var(--lagoon-ink); text-underline-offset: 2px; }
.k a:hover { color: var(--lagoon); }
.k :focus-visible { outline: 2.5px solid var(--sky); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 0.93em; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.bold { font-weight: 700; }
.late { color: var(--late); }
.svg { width: 18px; height: 18px; flex: none; }
.svg-sm { width: 15px; height: 15px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.row-top { display: flex; align-items: flex-start; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.scroll-x { overflow-x: auto; }
.split { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }   /* main + side columns that stack */

/* ---------- Desktop shell: light rail with coloured section tiles ---------- */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.rail { flex: 1 1 228px; background: var(--card); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 18px; }
.main { flex: 999 1 560px; min-width: 0; padding: 26px 34px 52px; display: flex; flex-direction: column; gap: 22px; }
.brand { font-family: var(--display); font-size: 26px; font-weight: 800; letter-spacing: -0.03em; padding: 0 8px; }
.brand i { color: var(--coral); font-style: normal; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-h { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 12px 10px 4px; }
.k .nav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 10px; border-radius: 11px; color: var(--ink); text-decoration: none; font-weight: 500; }
.k .nav a:hover { background: var(--bg); }
.k .nav a.on { background: var(--lagoon-wash); color: var(--lagoon-ink); font-weight: 700; }
.tile { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.count { margin-left: auto; background: var(--coral); color: #FFFFFF; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--bg); }

/* colour classes shared by tiles, avatars and client chips */
.t-coral { background: var(--coral-wash); color: var(--coral-ink); }
.t-mango { background: var(--mango-wash); color: var(--mango-ink); }
.t-leaf { background: var(--leaf-wash); color: var(--leaf-ink); }
.t-sky { background: var(--sky-wash); color: var(--sky-ink); }
.t-orchid { background: var(--orchid-wash); color: var(--orchid-ink); }
.t-hib { background: var(--hib-wash); color: var(--hib-ink); }
.t-clay { background: var(--clay-wash); color: var(--clay-ink); }
.t-lagoon { background: var(--lagoon-wash); color: var(--lagoon-ink); }
.t-grey { background: var(--line-2); color: var(--ink-2); }

/* people: round avatars with initials in their colour */
.av { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; flex: none; }
.av-sm { width: 26px; height: 26px; font-size: 10.5px; }
.av-lg { width: 46px; height: 46px; font-size: 15px; }

/* clients: a coloured square and the name */
.client { display: inline-flex; align-items: center; gap: 8px; }
.client i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.cl-kay { background: var(--coral); } .cl-nil { background: var(--leaf); } .cl-tide { background: var(--sky); }
.cl-lumen { background: var(--lagoon); } .cl-sahy { background: var(--orchid); } .cl-mang { background: var(--clay); }

/* ---------- Page header ---------- */
.hello { font-size: 15px; color: var(--ink-2); }
.h-display { font-family: var(--display); font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.h-page { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
.crumb { font-size: 13px; color: var(--ink-2); }
.crumb a { color: var(--ink-2); }
.sec-title { font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.eyebrow { font: 700 12px var(--sans); letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Buttons, segments, chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; white-space: nowrap; text-decoration: none; }
.k a.btn { color: var(--ink); text-decoration: none; }
.btn:hover { border-color: #C5D0D9; background: var(--sunk); }
.btn-primary, .k a.btn-primary { background: var(--lagoon); border-color: var(--lagoon); color: #FFFFFF; }
.btn-primary:hover, .k a.btn-primary:hover { background: var(--lagoon-ink); border-color: var(--lagoon-ink); color: #FFFFFF; }
.btn-quiet { background: transparent; border-color: transparent; }
.btn-warn, .k a.btn-warn { color: var(--late); }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; min-height: 48px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font: 600 13.5px var(--sans); color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--ink); color: #FFFFFF; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font: 600 13px var(--sans); color: var(--ink); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.dot { width: 9px; height: 9px; border-radius: 999px; flex: none; display: inline-block; }

/* ---------- Pills: status and labels ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font: 600 12px var(--sans); white-space: nowrap; }
.p-late { background: var(--late-wash); color: var(--late); }
.p-coral { background: var(--coral-wash); color: var(--coral-ink); }
.p-mango { background: var(--mango-wash); color: var(--mango-ink); }
.p-leaf { background: var(--leaf-wash); color: var(--leaf-ink); }
.p-sky { background: var(--sky-wash); color: var(--sky-ink); }
.p-orchid { background: var(--orchid-wash); color: var(--orchid-ink); }
.p-hib { background: var(--hib-wash); color: var(--hib-ink); }
.p-lagoon { background: var(--lagoon-wash); color: var(--lagoon-ink); }
.p-grey { background: var(--line-2); color: var(--ink-2); }
.p-ink { background: var(--ink); color: #FFFFFF; }
.p-line { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }

/* ---------- PROPOSED marker for items still awaiting a decision ---------- */
.prop { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border: 1.5px dashed var(--ink-2); border-radius: 5px; background: var(--card); color: var(--ink); font: 700 10.5px/1 var(--sans); letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.propbox { outline: 1.5px dashed var(--ink-3); outline-offset: 4px; border-radius: 8px; }

/* ---------- Cards and summary blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.today { background: var(--lagoon); color: #FFFFFF; border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 18px; align-items: center; box-shadow: var(--shadow); }
.today .big { font-family: var(--display); font-size: 58px; font-weight: 800; line-height: 0.9; letter-spacing: -0.04em; }
.mini { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.mini .it { display: flex; gap: 10px; align-items: flex-start; text-decoration: none; color: inherit; }
.mini .when { width: 48px; flex: none; font-size: 12px; font-weight: 700; color: var(--ink-2); padding-top: 1px; }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat .n { font-family: var(--display); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 6px; }
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--mango-wash); color: #4D3600; font-size: 13.5px; }
.notice-late { background: var(--late-wash); color: #6E2C0F; }
.notice-teal { background: var(--lagoon-wash); color: var(--lagoon-ink); }
.notice-sky { background: var(--sky-wash); color: var(--sky-ink); }
.divider { height: 1px; background: var(--line-2); }

/* receivables ageing: one bar, a segment per age band */
.age { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 3px; }
.age i { display: block; height: 100%; }

/* ---------- Tables ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font: 700 11.5px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); padding: 11px 14px; background: var(--sunk); border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.t tbody tr:hover td { background: #FAFCFD; }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; }
.t tfoot td { background: var(--sunk); font-weight: 700; border-top: 1px solid var(--line); }
.t a.title { color: var(--ink); font-weight: 600; text-decoration: none; }
.t a.title:hover { color: var(--lagoon-ink); text-decoration: underline; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .lbl { font: 600 13px var(--sans); color: var(--ink-2); }
.input { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); font: 400 14px var(--sans); color: var(--ink); width: 100%; }
.input:focus { outline: 2.5px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.input.num { text-align: right; }
.input.ro { background: var(--sunk); color: var(--ink-2); }
textarea.input { padding: 10px 12px; min-height: 88px; resize: vertical; line-height: 1.45; }
.hint { font-size: 12.5px; color: var(--ink-2); }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--lagoon); }
/* on/off switch built on a real checkbox */
.switch { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: 999px; background: #CBD5DD; position: relative; cursor: pointer; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 999px; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: left 0.15s; }
.switch:checked { background: var(--lagoon); }
.switch:checked::after { left: 19px; }
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }

/* ---------- Month calendar (desktop) ---------- */
.cal { overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 10px 12px; font: 700 11.5px var(--sans); letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 34px repeat(4, 24px) 10px; row-gap: 3px; border-bottom: 1px solid var(--line-2); }
.week:last-child { border-bottom: 0; }
.cell { grid-row: 1 / -1; border-right: 1px solid var(--line-2); }
.cell.c7 { border-right: 0; }
.cell.out { background: #F8FAFB; }
.cell.hol { background: repeating-linear-gradient(135deg, var(--hib-wash) 0 10px, #FFF6F8 10px 20px); }
.cell.today { background: #EFF9F7; }
.dnum { grid-row: 1; padding: 7px 10px 0; font: 700 13.5px var(--sans); z-index: 1; }
.dnum.out { color: #8A97A3; }
.dnum.today span { background: var(--coral); color: #FFFFFF; border-radius: 999px; padding: 2px 8px; }
.ev { z-index: 1; margin: 0 5px; height: 24px; border-radius: 7px; padding: 0 8px; font: 600 12px/24px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; text-decoration: none; }
.k a.ev { text-decoration: none; }
.k .ev.aw { background: var(--mango-wash); color: var(--mango-ink); }
.k .ev.ag.kay { background: var(--coral-wash); color: var(--coral-ink); }
.k .ev.ag.nil { background: var(--leaf-wash); color: var(--leaf-ink); }
.k .ev.ag.tide { background: var(--sky-wash); color: var(--sky-ink); }
.k .ev.hol { background: transparent; color: var(--hib-ink); font-weight: 700; }
.k .ev.timed { background: transparent; color: var(--ink); font-weight: 500; }
.ev.timed::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--orchid); margin-right: 6px; }
.k .ev.task { background: var(--card); color: var(--ink); border: 1.5px solid #C9D3DC; line-height: 21px; }
.ev.task::before { content: ""; display: inline-block; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.k .ev.task.overdue { border-color: var(--late); color: var(--late); background: var(--late-wash); }
.k .ev.task.done { color: #7D8A96; text-decoration: line-through; border-style: dashed; }
.k .ev.more { background: transparent; color: var(--lagoon-ink); font-weight: 700; }
.c1 { grid-column-start: 1; } .c2 { grid-column-start: 2; } .c3 { grid-column-start: 3; } .c4 { grid-column-start: 4; }
.c5 { grid-column-start: 5; } .c6 { grid-column-start: 6; } .c7 { grid-column-start: 7; }
.s2 { grid-column-end: span 2; } .s3 { grid-column-end: span 3; }
.r2 { grid-row: 2; } .r3 { grid-row: 3; } .r4 { grid-row: 4; } .r5 { grid-row: 5; }

/* ---------- Timeline (history, escalation ladder) ---------- */
.tl { display: flex; flex-direction: column; }
.tl-i { display: grid; grid-template-columns: 30px 1fr; gap: 12px; position: relative; padding-bottom: 18px; }
.tl-i:last-child { padding-bottom: 0; }
.tl-i::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.tl-i:last-child::before { display: none; }
.tl-mark { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); }
.tl-mark.done { background: var(--leaf-wash); color: var(--leaf-ink); }
.tl-mark.late { background: var(--late-wash); color: var(--late); }
.tl-mark.wait { background: var(--card); border: 2px dashed #B4C0CB; color: var(--ink-3); }
.tl-mark.info { background: var(--sky-wash); color: var(--sky-ink); }

/* ---------- Invoice PDF preview (A4 proportions, deliberately calm) ---------- */
.a4 { background: #FFFFFF; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 4px rgba(20,32,43,0.06), 0 14px 34px rgba(20,32,43,0.10); padding: 0 40px 36px; font-size: 11.5px; line-height: 1.45; color: #14202B; aspect-ratio: 210 / 297; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.a4 .bar { height: 6px; margin: 0 -40px 18px; background: var(--brand); border-radius: 4px 4px 0 0; }
/* The letterhead every document shares: the wordmark at the top and a band along the foot,
   as on the invoices BridgingDots sends today. The logo itself comes from billing settings. */
.a4::after { content: ""; display: block; flex: none; height: 14px; margin: 0 -40px -36px; background: var(--brand); border-radius: 0 0 4px 4px; }
.wordmark { font-family: var(--sans); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; color: var(--brand); line-height: 1; }
.a4 .lh-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 8px; color: var(--ink-3); font-size: 10.5px; }
.a4 table { width: 100%; border-collapse: collapse; }
.a4 th { text-align: left; font-weight: 700; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; padding: 7px 6px; background: var(--sunk); border-bottom: 1px solid #C9D3DC; }
.a4 td { padding: 7px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.a4 .num { text-align: right; }
.a4 .ph { color: var(--ink-3); background: var(--sunk); border: 1px dashed #C9D3DC; padding: 0 4px; border-radius: 4px; }   /* [placeholder] company details */
.qr { width: 74px; height: 74px; border: 1px dashed #B4C0CB; border-radius: 6px; display: grid; place-items: center; font-size: 9.5px; color: var(--ink-3); text-align: center; flex: none; }

/* ---------- Phone screens (fixed 390 px artboards) ---------- */
.phone { width: 390px; display: flex; flex-direction: column; background: var(--bg); }
.pbar { display: flex; align-items: center; gap: 6px; min-height: 60px; padding: 8px 10px 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.pbar h1 { font-family: var(--display); font-size: 20px; font-weight: 800; letter-spacing: -0.02em; flex: 1 1 auto; min-width: 0; }
.pbody { flex: 1 1 auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 16px; }
.grp { font: 700 12px var(--sans); letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); padding: 2px 2px 0; }
.task { display: flex; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.k a.task { color: var(--ink); text-decoration: none; }
.box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #B4C0CB; flex: none; margin-top: 1px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.li { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit; }
.li:last-child { border-bottom: 0; }
.k a.li { color: var(--ink); text-decoration: none; }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--card); border-top: 1px solid var(--line); padding: 6px 6px 12px; }
.k .tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border-radius: 12px; font: 600 11.5px var(--sans); color: var(--ink-2); text-decoration: none; position: relative; }
.k .tabs a.on { color: var(--lagoon-ink); background: var(--lagoon-wash); }
.badge { position: absolute; top: 3px; left: 56%; background: var(--coral); color: #FFFFFF; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 0 6px; line-height: 17px; }
.foot { background: var(--card); border-top: 1px solid var(--line); padding: 12px 16px 16px; }

/* ---------- Phone month grid ---------- */
.mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 2px; }
.mcal .h { text-align: center; font: 700 11px var(--sans); color: var(--ink-2); padding: 4px 0 6px; }
.k .mcal a { min-height: 48px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 6px; border-radius: 11px; text-decoration: none; color: var(--ink); font: 600 14px var(--sans); }
.k .mcal a.out { color: #8A97A3; }
.k .mcal a.hol { background: var(--hib-wash); color: var(--hib-ink); }
.k .mcal a.today span.n { background: var(--coral); color: #FFFFFF; border-radius: 999px; padding: 0 7px; }
.k .mcal a.sel { outline: 2px solid var(--ink); outline-offset: -2px; }
.mdots { display: flex; gap: 3px; height: 6px; }
.mdots i { width: 6px; height: 6px; border-radius: 999px; display: block; }
.mdots .aw { background: var(--mango); } .mdots .kay { background: var(--coral); } .mdots .nil { background: var(--leaf); }
.mdots .tide { background: var(--sky); } .mdots .int { background: var(--orchid); } .mdots .tk { background: var(--ink); } .mdots .od { background: var(--late); }

/* ==========================================================================
   App additions (phase 1, step 5)
   Everything above is the mockups' stylesheet as it was copied from
   docs/mockups/backwater.css. From here on this file is the one that changes;
   the mockups stay as reference. What follows turns the fixed desktop and
   phone artboards into one responsive app, and styles what the static
   mockups didn't need: form errors, messages, dialogs and copy boxes.
   ========================================================================== */

/* ---------- Page ---------- */
body.k { min-height: 100vh; }
[hidden] { display: none !important; }
.k button { font-family: inherit; }

/* The rail shows on wide screens; the phone bar and tabs on narrow ones. */
.only-phone { display: none !important; }
@media (max-width: 760px) {
  .only-phone { display: flex !important; }
  .only-desktop { display: none !important; }
  /* A side panel with nothing chosen yet takes no room on a phone. */
  .only-desktop-empty { display: none; }
  .app { display: block; }
  .rail { display: none; }
  .main { padding: 16px 16px 104px; gap: 16px; }
  .h-page { font-size: 24px; }
  .h-display { font-size: 28px; }
  .pbar { position: sticky; top: 0; z-index: 5; }
  .tabs.only-phone { display: grid !important; }
}
/* The tab bar sits at the bottom of the screen and takes as many tabs as there are. */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
        grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
        padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.k .tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
                  min-height: 54px; border: 0; border-radius: 12px; background: transparent;
                  font: 600 11.5px var(--sans); color: var(--ink-2); cursor: pointer; width: 100%; }
.tabs form { display: contents; }
.rail .nav a .tile svg, .tabs svg { pointer-events: none; }
.me form { margin-left: auto; }

/* ---------- Access pages: a lagoon panel and the form (sign-in, invite, reset) ---------- */
.access { min-height: 100vh; display: flex; flex-wrap: wrap; }
.access-panel { flex: 1 1 480px; background: var(--lagoon); color: #FFFFFF; padding: 52px 56px;
                display: flex; flex-direction: column; justify-content: space-between; gap: 44px; }
.access-panel .brand { color: #FFFFFF; padding: 0; }
.access-panel h1 { font-family: var(--display); font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.access-panel .lead { font-size: 16px; color: #D7F0EC; }
.access-panel .foot-note { font-size: 13px; color: #BFE3DF; }
.access-side { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.access-card { width: 100%; max-width: 440px; padding: 34px; display: flex; flex-direction: column; gap: 18px; }
.glimpse { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.glimpse .pill { height: 34px; padding: 0 14px; font-size: 14px; }
@media (max-width: 760px) {
  .access { display: block; }
  .access-panel { padding: 30px 20px 24px; gap: 14px; border-radius: 0 0 26px 26px; }
  .access-panel h1 { font-size: 28px; line-height: 1.1; }
  .access-panel .lead, .access-panel .foot-note { display: none; }
  .glimpse { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .glimpse .pill { height: 24px; padding: 0 10px; font-size: 12px; margin-left: 0 !important; }
  .access-side { padding: 22px 16px 40px; display: block; }
  .access-card { padding: 22px 18px; box-shadow: none; border: 0; background: transparent; }
  .access-card .input { min-height: 50px; font-size: 16px; }
  .access-card .btn-block { min-height: 52px; font-size: 16px; }
}

/* A centred single column, for two-step setup and the code page. */
.focus { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 40px 16px 56px; gap: 24px; }
.focus > * { width: 100%; max-width: 940px; }
.focus.narrow > * { max-width: 460px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 18px; }
.code-input { min-height: 54px; font-size: 22px; letter-spacing: 0.35em; text-align: center; }
.qr-code { align-self: center; line-height: 0; }
/* The QR code scales from its viewBox; crisp edges keep the modules sharp for cameras. */
.qr-code svg { display: block; width: 228px; max-width: 100%; height: auto; shape-rendering: crispEdges; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; background: var(--sunk); border: 1px solid var(--line);
         border-radius: 12px; padding: 14px 16px; font-size: 14.5px; }

/* ---------- Forms: errors, password rules, radio segments ---------- */
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--late); font-size: 12.5px; font-weight: 600; }
.field.has-error .input { border-color: var(--late); }
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-3); }
.rules li { display: flex; align-items: center; gap: 8px; }
.rules li::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: #B4C0CB; margin: 0 4px; flex: none; }
.rules li.ok { color: var(--leaf-ink); }
.rules li.ok::before { width: 15px; height: 15px; margin: 0; background: no-repeat center / 15px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E6B30' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L19 7'/%3E%3C/svg%3E"); }
/* A segment of radio buttons, which looks like .seg but posts with the form. */
.seg label { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 9px;
             font: 600 13.5px var(--sans); color: var(--ink-2); cursor: pointer; }
.seg label:has(input:checked) { background: var(--ink); color: #FFFFFF; }
.seg label:has(input:focus-visible) { outline: 2.5px solid var(--sky); outline-offset: 2px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.k a.seg-link { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 9px;
                font: 600 13.5px var(--sans); color: var(--ink-2); text-decoration: none; }
.k a.seg-link.on { background: var(--ink); color: #FFFFFF; }
select.input { padding-right: 32px; }

/* ---------- Messages, links to copy, dialogs ---------- */
.messages { display: flex; flex-direction: column; gap: 8px; }
.link-box { display: flex; gap: 8px; }
.link-box .input { font-family: var(--mono); font-size: 12.5px; }
.k button.link { border: 0; background: none; padding: 0; color: var(--lagoon-ink); font: inherit; text-decoration: underline;
                 text-underline-offset: 2px; cursor: pointer; }
.k button.link:hover { color: var(--lagoon); }
dialog.k-dialog { padding: 0; border: 0; border-radius: var(--radius); width: min(640px, calc(100vw - 32px));
                  box-shadow: 0 24px 60px rgba(20,32,43,0.32); color: var(--ink); }
dialog.k-dialog::backdrop { background: rgba(20, 32, 43, 0.48); }
.dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
               padding: 14px 24px; background: var(--sunk); border-top: 1px solid var(--line); }
.empty { padding: 44px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.empty .tile { width: 56px; height: 56px; border-radius: 16px; }
.k .li-button { display: flex; gap: 12px; padding: 14px; width: 100%; border: 0; border-bottom: 1px solid var(--line-2);
                background: transparent; text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.k .li-button:hover { background: #FAFCFD; }
.list form:last-child .li-button { border-bottom: 0; }
.li-button.unread { background: #FBFDFD; }
.t tr.selected td { background: var(--lagoon-wash); }
.k a.row-link { color: inherit; text-decoration: none; }

/* The Audit log page: compact filters, the chain check's answer, and the change table. */
.audit-filters { gap: 10px; }
.audit-filters .input { width: auto; min-height: 38px; }
#chain-result:empty { display: none; }
.k #audit-list a.row-link:hover { color: var(--lagoon-ink); text-decoration: underline; text-underline-offset: 2px; }
.audit-changes td { overflow-wrap: anywhere; vertical-align: top; }
.audit-changes td:first-child { overflow-wrap: normal; white-space: nowrap; }

/* The client colour picker (Client mockup): radios drawn as swatches; taken ones faded. */
.swatch { position: relative; display: inline-flex; width: 34px; height: 34px; border-radius: 10px;
          background: var(--swatch); cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch.taken { opacity: 0.35; }
.swatch:has(input:checked) { opacity: 1; box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--ink); }
.swatch:has(input:focus-visible) { outline: 2.5px solid var(--sky); outline-offset: 4px; }
@media (max-width: 760px) { .swatch { width: 40px; height: 40px; border-radius: 12px; } }
.htmx-request { opacity: 0.6; transition: opacity 0.2s; }

/* Printing the backup codes prints just them. */
@media print {
  body.k { background: #FFFFFF; }
  .no-print { display: none !important; }
}
