/* ---------- Structo design language ----------
 * Monochrome surfaces, one black "live" state on light ground, and a yellow
 * accent that only ever appears on a dark surface. Every colour is a token
 * declared below; a rule never writes a hex value of its own. The old names
 * (--navy, --brand, --line ...) survive only as aliases for the inline styles
 * app.js writes — this file never reads them.
 */
:root {
  /* Light here; [data-theme="dark"] below turns native inputs dark with the
   * page. i18n.js picks the theme (his choice, else the phone's) before paint. */
  color-scheme: light;

  --page:   #F7F7F7;
  --card:   #FFFFFF;
  --card-2: #EFEFEF;
  --bar:    #000000;
  --bar-on: #1A1A1A;   /* the disc behind the bottom bar's open entry */

  --ink:    #101010;
  --ink-2:  #5E5E5E;
  --ink-3:  #6B6B6B;
  --on-ink: #FFFFFF;

  /* The accent is 1.07:1 on white: never text, an icon or a hairline on a
   * light surface — only a fill under black text, a mark on black, or a
   * solid shape nobody has to read. */
  --accent:     #FFFF1E;
  --accent-ink: #101010;

  /* "This one is live": black on light ground; on a dark surface it becomes
   * the accent (see the dark-surface rule). */
  --live:     #101010;
  --live-ink: #FFFFFF;

  /* The hero surface stays dark in both themes. */
  --hero:       #101010;
  --hero-ink:   #FFFFFF;
  --hero-dim:   #A8A8A8;
  --hero-meta:  #D4D4D4;
  --hero-edge:  #999999;
  --hero-track: #3A3A3A;
  /* Semantic colours as they read on a hero surface. */
  --hero-ok:        #5CC48E;
  --hero-ok-wash:   #16291F;
  --hero-bad:       #F2938A;
  --hero-bad-wash:  #2A1A1A;
  --hero-flag:      #E0B055;
  --hero-flag-wash: #2A2213;

  --ok:        #0E7A4F;
  --ok-fill:   #36BC83;
  --ok-wash:   #E0F7EB;
  --bad:       #C0272F;
  --bad-fill:  #ED666B;
  --bad-wash:  #FDE8E9;
  --flag:      #8A5300;
  --flag-wash: #FBEFD6;
  --on-fill:   #FFFFFF;

  /* A divider inside a surface is --hair; anything a finger presses is --edge. */
  --hair: #E6E6E6;
  --edge: #8E8E8E;
  --hair-w: 1px;
  --edge-w: 1px;

  /* User-chosen note colours and the survey heat grid: literal palettes. */
  --blue:      #2B6CB0;
  --purple:    #7C5CFF;
  --magenta:   #C026D3;   /* the 7th Reports chart colour: 4.7:1 on the light card, 3.6:1 on the dark */
  --heat-cut:  #C62828;
  --heat-fill: #1565C0;

  --r-pill: 24px;
  --r-card: 24px;
  --r-row:  12px;
  --r-btn:  13px;
  --r-chip: 10px;
  --r-key:  14px;
  --r-full: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --t-xs:     0.75rem;
  --t-sm:     0.875rem;
  --t-body:   1rem;
  --t-label:  1.0625rem;
  --t-lg:     1.1875rem;
  --t-head:   1.5rem;
  --t-fig:    1.375rem;
  --t-fig-lg: 2rem;

  --w-reg: 400; --w-med: 500; --w-semi: 600; --w-bold: 700;

  --lh-fig: 1; --lh-tight: 1.25; --lh-body: 1.5;
  --tr-tight: -0.02em;
  --tr-flat: 0;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --gutter: 24px;
  --content: 342px;

  --tap:     48px;
  --ctl:     56px;
  --row:     64px;
  --row-2:   80px;
  --bar-h:   94px;
  --nav-btn: 56px;
  --icon:    20px;
  --stroke:  1.6;

  --elev-0: none;
  --elev-sheet: 0 -8px 32px rgba(0, 0, 0, 0.18);
  --elev-toast: 0 6px 24px rgba(0, 0, 0, 0.24);

  --d-press: 100ms;
  --d-state: 160ms;
  --d-sheet: 240ms;
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121212; --card: #1C1C1C; --card-2: #262626; --bar: #000000;
  --ink: #E9E9E9; --ink-2: #A8A8A8; --ink-3: #9A9A9A;
  --accent: #FFFF1E; --accent-ink: #121212;
  --live: #FFFF1E; --live-ink: #121212;
  --ok: #5CC48E; --ok-wash: #16291F; --bad: #F2938A; --bad-wash: #2A1A1A;
  --flag: #E0B055; --flag-wash: #2A2213; --on-fill: #121212;
  --hero: #262626; --hero-dim: #A8A8A8; --hero-meta: #D4D4D4;
  --hero-edge: #9A9A9A; --hero-track: #4F4F4F;
  --hair: #2E2E2E; --edge: #8E8E8E;
  --elev-sheet: 0 -8px 32px rgba(0, 0, 0, 0.6);
  --elev-toast: 0 6px 24px rgba(0, 0, 0, 0.7);
  /* Chart and note colours that would sink into #1C1C1C (v1-R10). */
  --blue: #6EA8E8; --purple: #A792FF; --magenta: #E07AF0;
}
/* v1-R10 — Larger text: every --t-* size is in rem, so one root size scales them. */
:root[data-text="lg"] { font-size: 112.5%; }
/* Paper is ink on white whatever the screen's theme. A dark surface prints as
 * plain ink too: browsers drop backgrounds on paper, so light-on-dark text
 * would come out white on white. For the same reason every "ink on a fill"
 * token (on-ink, accent-ink, live-ink, on-fill) is ink here: the black fill
 * under a .stat.brand tile or an In Progress badge does not print. */
@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --page: #F7F7F7; --card: #FFFFFF; --card-2: #EFEFEF; --bar: #000000;
    --ink: #101010; --ink-2: #5E5E5E; --ink-3: #6B6B6B; --on-ink: #101010;
    --accent: #101010; --accent-ink: #101010;
    --live: #101010; --live-ink: #101010;
    --hero: #FFFFFF; --hero-ink: #101010; --hero-dim: #5E5E5E; --hero-meta: #6B6B6B;
    --hero-edge: #8E8E8E; --hero-track: #E6E6E6;
    --hero-ok: #0E7A4F; --hero-ok-wash: #E0F7EB; --hero-bad: #C0272F; --hero-bad-wash: #FDE8E9;
    --hero-flag: #8A5300; --hero-flag-wash: #FBEFD6;
    --ok: #0E7A4F; --ok-fill: #36BC83; --ok-wash: #E0F7EB;
    --bad: #C0272F; --bad-fill: #ED666B; --bad-wash: #FDE8E9;
    --flag: #8A5300; --flag-wash: #FBEFD6; --on-fill: #101010;
    --hair: #E6E6E6; --edge: #8E8E8E;
    --blue: #2B6CB0; --purple: #7C5CFF; --magenta: #C026D3;
    --elev-sheet: none; --elev-toast: none;
  }
}
/* Indic scripts: negative tracking and a tight line clip vowel signs.
 * I18n sets <html lang> to the person's language. */
:root:not(:lang(en)) { --tr-tight: 0; --lh-tight: 1.4; }
/* A 360dp phone leaves 312px between 24px gutters; 16 keeps the content wide. */
@media (max-width: 379px) { :root { --gutter: 16px; } }

/* ---------- the floor ---------- */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  background: var(--page);
}
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: var(--w-reg) var(--t-body) / var(--lh-body) var(--font);
}
/* A link reads as ink, not the browser's blue, with the underline clear of the letters. */
a { color: var(--ink); text-underline-offset: 3px; }
button, a, [role="button"], label, summary {
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
/* Every figure: a wrong digit becomes a wrong SHAPE. */
.fig { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
       letter-spacing: var(--tr-flat); font-weight: var(--w-semi); }
/* Unknown is a dash: never a zero, never a figure's weight. */
.dash { color: var(--ink-3); font-weight: var(--w-med);
        font-variant-numeric: normal; }

/* ---------- old names, for the inline styles app.js writes ----------
 * Declared on every dark surface as well, so there they re-resolve against
 * that surface's tokens instead of inheriting the page's computed black. */
:root, #bottomnav, .card.navy, .stat.dark, #gate, .gate-panel,
.mp-top, #toast, .note-vis.private, .qa-vis.private, .hero {
  --navy: var(--hero); --navy-deep: var(--hero); --navy-2: var(--hero-track);
  --brand: var(--live); --brand-dark: var(--live); --brand-ink: var(--live-ink);
  --line: var(--hair);
  --green: var(--ok); --red: var(--bad); --amber: var(--flag);
  --muted: var(--card-2);
  --shadow: none; --radius: var(--r-row);
}

/* ---------- DARK SURFACES ----------
 * Each stays dark in both themes and re-declares the tokens its children
 * read, so a child rule written for a light card (var(--ink), var(--live))
 * comes out right on black without an override of its own. */
#bottomnav, .card.navy, .stat.dark, #gate, .gate-panel,
.mp-top, #toast, .note-vis.private, .qa-vis.private, .hero {
  background: var(--hero); color: var(--hero-ink);
  --ink: var(--hero-ink); --ink-2: var(--hero-dim); --ink-3: var(--hero-meta);
  --card: var(--hero); --card-2: var(--hero-track);
  --hair: var(--hero-track); --edge: var(--hero-edge);
  --live: var(--accent); --live-ink: var(--accent-ink);
  --ok: var(--hero-ok); --ok-wash: var(--hero-ok-wash);
  --bad: var(--hero-bad); --bad-wash: var(--hero-bad-wash);
  --flag: var(--hero-flag); --flag-wash: var(--hero-flag-wash);
  --on-fill: var(--accent-ink);
}
/* ON LIVE: anything sitting on a --live fill reads --live-ink only. */
.stat.brand {
  background: var(--live); color: var(--live-ink); border-color: var(--live);
  --ink: var(--live-ink); --ink-2: var(--live-ink);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  height: 100dvh;
}

/* phone frame */
#phone {
  position: relative;
  width: 100%; max-width: 440px; height: 100%; max-height: 940px;
  background: var(--page);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,.55);
}
@media (min-width: 460px) { #phone { border-radius: 24px; height: 92%; } }

/* The icon sprite (index.html): one size, one stroke, the colour of the
 * words beside it. Only svg.ic — the charts' own SVGs are untouched. */
svg.ic {
  width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; flex: none;
}

/* app bar — on the page, no fill of its own */
#appbar {
  flex: 0 0 auto;
  min-height: 72px; display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--gutter);
  background: var(--page); color: var(--ink);
  z-index: 20;
}
.ab-btn {
  background: var(--card); border: 1px solid var(--edge); color: var(--ink);
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer; padding: 0;
  display: grid; place-items: center; position: relative; flex: none;
}
.ab-btn:active { background: var(--card-2); }
/* S2-18 — the back arrow: .ab-btn's grid would beat the hidden attribute */
#upBtn[hidden] { display: none; }
/* line-height 1.5 leaves room for Indic descenders under the ellipsis */
#pageTitle {
  flex: 1; min-width: 0; font-weight: var(--w-semi); font-size: var(--t-lg); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#listSiteBtn, #homeSiteBtn { max-width: 100%; height: auto; white-space: normal; text-align: start; }
.site-choice-name { min-width: 0; overflow-wrap: anywhere; }
.dot {
  position: absolute; top: 8px; right: 9px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bad); border: 2px solid var(--card); display: none;
}
.dot.on { display: block; }
.dot.count {
  top: 4px; right: 4px; width: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full); color: var(--on-fill);
  font-size: var(--t-xs); font-weight: var(--w-semi); line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
}
.dot.count.on { display: inline-grid; place-items: center; }

/* drawer — retired in RD-6a; hidden attribute beats display:flex */
#drawer[hidden] { display: none; }
#drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: 82%; max-width: 340px;
  z-index: 40; background: var(--card); color: var(--ink);
  transform: translateX(-105%); transition: transform .25s ease;
  display: flex; flex-direction: column; padding: 18px 0;
}
#drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; gap: 12px; align-items: center; padding: 8px var(--s-5) 18px;
  border-bottom: 1px solid var(--hair);
}
.drawer-name { font-weight: var(--w-semi); color: var(--ink); font-size: var(--t-lg); line-height: var(--lh-tight); }
.drawer-role { font-size: var(--t-sm); color: var(--ink-2); }
.drawer-co { font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; }
.drawer-nav { flex: 1; overflow-y: auto; padding: 6px 12px; }
/* §4.4 — labelled section headers, never collapsibles */
.drawer-group {
  padding: 16px 12px 6px; font-size: var(--t-sm); font-weight: var(--w-semi);
  line-height: var(--lh-tight); color: var(--ink-2);
}
.drawer-group:first-child { padding-top: 4px; }
/* 56px rows, not 64: there are 23 destinations to scroll through */
.drawer-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px;
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--hair);
  font-size: var(--t-body); font-weight: var(--w-med); line-height: var(--lh-tight);
}
.drawer-nav a::after {
  content: ''; flex: none; margin-left: auto; width: 8px; height: 8px;
  border: solid var(--ink-2); border-width: 2px 2px 0 0; transform: rotate(45deg);
}
.drawer-nav a > .ic { width: 24px; flex: none; display: grid; place-items: center; }
.drawer-nav a:active { background: var(--card-2); }
.drawer-nav a.active { background: var(--live); color: var(--live-ink); border-radius: var(--r-row); border-bottom-color: transparent; }
.drawer-nav a.active::after { border-color: currentColor; }
.drawer-actions { display: flex; gap: 8px; padding: 12px var(--s-5) 4px; }
#drawer .drawer-actions .btn { min-height: var(--ctl); }
.drawer-foot { padding: 10px var(--s-5) 0; font-size: var(--t-xs); color: var(--ink-2); }
#scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .25s; }
#scrim.show { opacity: 1; pointer-events: auto; }

/* avatars — an initials disc */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--card-2);
  color: var(--ink); font-weight: var(--w-semi); display: grid; place-items: center; font-size: 14px; flex: 0 0 auto;
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.xl { width: 76px; height: 76px; font-size: 26px; }

/* main view */
/* The bottom bar is in the flex flow, so the view only has to clear the FAB. */
#view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--s-4) var(--gutter) 96px; -webkit-overflow-scrolling: touch; }

/* bottom nav — black in both themes (a dark surface, see above). Each entry
 * is a disc holding the glyph, then its word as bare text: i18n D3 reads
 * "</span>word</button>". The word stays on one line and ends in an ellipsis.
 * The button clips (overflow:hidden, for that ellipsis), so the disc never
 * reaches above it: the bar's own top padding places the disc, not a negative margin. */
#bottomnav {
  flex: 0 0 auto; height: var(--bar-h); background: var(--bar);
  display: flex; align-items: flex-start; padding: 4px 4px 0; z-index: 20;
}
#bottomnav button {
  flex: 1; min-width: 0; display: block; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--hero-dim); font: inherit; font-size: var(--t-sm); font-weight: var(--w-med); line-height: 1.4;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The longer Tamil words get their share of the bar without losing their endings. */
:lang(ta) #bottomnav { gap: var(--s-1); }
:lang(ta) #bottomnav button { flex-basis: max-content; font-size: var(--t-xs); }
:lang(ta) #bottomnav .bic { width: 100%; max-width: 56px; }
/* At this width six complete Tamil labels fit at the regular caption size.
   Keep the user's larger text everywhere else, including wider navigation. */
@media (max-width: 380px) {
  :root[lang="ta"][data-text="lg"] #bottomnav button { font-size: 12px; }
}
#bottomnav .bic {
  width: 56px; height: 56px; border-radius: var(--r-full); margin: 0 auto 3px;
  display: grid; place-items: center; font-size: 20px;
}
#bottomnav button.active { color: var(--accent); }
#bottomnav button.active .bic { background: var(--bar-on); box-shadow: inset 0 0 0 2px var(--accent); }
/* Short screens (a 360x640dp phone): a lower bar keeps the list in view. */
@media (max-height: 700px) {
  :root { --bar-h: 76px; }
  #bottomnav .bic { width: 44px; height: 36px; }
}

/* FAB — a black "Add" pill above the bar. Its name is the word it shows. */
#fab {
  position: absolute; right: var(--gutter); bottom: calc(var(--bar-h) + 16px); z-index: 25;
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--ctl); padding: 0 20px; border: 0; border-radius: var(--r-pill);
  background: var(--live); color: var(--live-ink); box-shadow: var(--elev-toast); cursor: pointer;
  font: inherit; font-size: var(--t-label); font-weight: var(--w-semi); line-height: var(--lh-tight);
  transition: transform var(--d-press) var(--ease-out);
}
#fab:active { transform: scale(.96); }
body:has(:is(input, textarea, [contenteditable="true"]):focus) #fab { visibility: hidden; }
/* Keep the filtered people immediately below the field while the keyboard is up. */
body:has(#labourSearch:focus) #bottomnav,
#view:has(#labourSearch:focus) > :is(.page-head, #todayPayCard, #markBtn, #markOneSite, #addWorkerBtn, #labourChips),
#view:has(#labourSearch:focus) .field:has(> #labourSort) { display: none; }
/* P2 — while content runs under it the pill shrinks to a 56px disc (route() toggles .mini). */
#fab.mini { padding: 0; width: var(--ctl); justify-content: center; }
#fab.mini [data-i18n] { display: none; }

/* ---------- generic UI ---------- */
/* Half the tight tracking: -0.01em in English, 0 for Indic scripts. */
.section-title { font-size: var(--t-lg); font-weight: var(--w-semi); color: var(--ink); letter-spacing: calc(var(--tr-tight) / 2); line-height: var(--lh-tight); margin: 22px 0 10px; }
.card {
  background: var(--card); border-radius: var(--r-row); border: 1px solid var(--hair);
  padding: 14px; margin-bottom: 12px;
}
/* Tappable: the darker outline says "press me"; a plain card keeps the hairline. */
.card.tap { cursor: pointer; border-color: var(--edge); transition: transform var(--d-press) var(--ease-out); }
.card.tap:active { transform: scale(.985); }
.card.warn { background: var(--flag-wash); color: var(--flag); border-color: var(--flag-wash); border-left: 6px solid var(--flag); }
/* v1-45 — Money in's "Profit does not change" (machines-money.html frame 14), and a hire still running (frame 16). */
.card.ok { background: var(--ok-wash); color: var(--ok); border-color: var(--ok-wash); border-left: 6px solid var(--ok); }
.t-flag { color: var(--flag); }
/* --edge on a wash is 2.8:1; a ghost button there takes the darker ink-2 outline. */
.card.warn .btn.ghost, .lv-banner .btn.ghost { border-color: var(--ink-2); }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-2); font-size: var(--t-sm); }
/* v1-R6 — the type steps the scripts ask for in place of an inline font-size. */
.t-xs { font-size: var(--t-xs); }
.t-sm { font-size: var(--t-sm); }
.strong { font-weight: 700; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A long site name shows two lines, then the dots; a .one line is cut at one. */
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt12{margin-top:12px}.mb6{margin-bottom:6px}

/* stat grid */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--card); border-radius: var(--r-row); padding: 14px; border: 1px solid var(--hair);
  position: relative; overflow: hidden;
}
/* The figure is tabular here, in CSS: the markup stays a bare text node. The tile clips
 * (overflow: hidden), so the figure shrinks on a narrow phone (₹12,34,567.50 fits a 360dp
 * tile on one line) and a longer one wraps rather than losing its last digits. */
.stat .num { font-size: min(var(--t-fig), 5.2vw); font-weight: var(--w-bold); line-height: var(--lh-tight); color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .lbl { font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; font-weight: var(--w-med); line-height: var(--lh-tight); }
.stat .muted { font-size: var(--t-xs); }
.stat .ic { display: block; font-size: 22px; line-height: 1; margin-bottom: 8px; }
.stat .ic svg.ic { width: 22px; height: 22px; color: var(--ink-2); }
/* An odd last tile (the supervisor's three-tile Attendance) spans the row: no empty cell. */
.stat-grid > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* progress bar */
.bar { height: 6px; background: var(--card-2); border-radius: var(--r-full); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ink); border-radius: var(--r-full); }
.bar.green > span { background: var(--ok-fill); }

/* v1-R7 — Home's hero: a dark surface (above), two accent wedges in its corners
 * behind the words (isolation keeps z-index -1 inside the card), the figures
 * in the accent. Namespaced under .hero so .k never meets .kv .k. */
.hero { position: relative; isolation: isolate; overflow: hidden; border-radius: var(--r-card); padding: 24px 24px 20px; margin-bottom: 12px; }
.hero svg.blob { position: absolute; z-index: -1; fill: var(--accent); stroke: none; }
.hero .blob.tr { top: 0; right: 0; width: 104px; height: 72px; }
.hero .blob.bl { left: 0; bottom: 0; width: 88px; height: 60px; }
.hero .k { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: 2px; max-width: 72%; }
.hero h2 { margin: 0 0 12px; font-size: var(--t-head); font-weight: var(--w-semi); line-height: var(--lh-tight); letter-spacing: var(--tr-tight); max-width: 72%; }
.hero h2 b { font-size: var(--t-fig-lg); font-weight: var(--w-bold); color: var(--accent); font-variant-numeric: tabular-nums; }
.hero .bar > span { background: var(--accent); }
.hero .btn { margin: 18px 0 0 auto; display: flex; width: fit-content; }

/* v1-R7 — an owner money row: 'due' in the flag colour, 'bal' in ink, 'na'
 * (not known) grey with the dash. */
.mrow { display: flex; align-items: center; gap: 14px; min-height: var(--row); background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-row); padding: 10px 16px; margin-bottom: 8px; }
.mrow .lead { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--card-2); color: var(--ink-2); }
.mrow.due .lead { background: var(--flag-wash); color: var(--flag); }
.mrow .t { display: block; font-weight: var(--w-semi); line-height: var(--lh-tight); }
.mrow .s { display: block; font-size: var(--t-sm); color: var(--ink-2); line-height: var(--lh-tight); }
.mrow .amt { display: block; text-align: right; font-size: var(--t-fig); font-weight: var(--w-semi); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mrow .dirword { display: block; text-align: right; font-size: var(--t-xs); font-weight: var(--w-semi); text-transform: uppercase; color: var(--ink-2); }
.mrow.due .amt, .mrow.due .dirword { color: var(--flag); }
.mrow.na .amt { color: var(--ink-3); }
/* Reserve each figure and its tag as a unit. If the widest label cannot
   share the line, the balance moves below it, aligned with the right edge. */
.mrow, #labourList .row:has(> .led-num), #ppList [data-pp-key] { flex-wrap: wrap; }
.mrow > .grow, #labourList .row:has(> .led-num) > .grow, #ppList [data-pp-key] > .grow {
  flex: 1 1 min-content; min-width: min-content; max-width: 100%;
}
.mrow > :last-child, #labourList .row > .led-num, #ppList [data-pp-bal] {
  flex: 0 1 auto; max-width: 100%; margin-inline-start: auto; overflow-wrap: normal;
}
:lang(ta) .row:has(> .grow), :lang(ta) .li:has(> .grow) { flex-wrap: wrap; }
:lang(ta) :is(.row,.li) > .grow { flex-basis: min-content; min-width: min-content; max-width: 100%; }

/* v1-24 — a sticky alert card on the owner's Home (docs/design/cap/v1/
 * alerts-ball-update.html frame 1). Tappable, so an --edge outline; the 6px
 * left rule carries the severity. There is no close button: a card leaves when
 * its matter is fixed. 'unk' (not known on this phone) is dashed and not a tap. */
.al-sec .section-title small { display: block; margin-top: 2px; font-size: var(--t-xs); font-weight: var(--w-reg); color: var(--ink-2); letter-spacing: 0; }
.al { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); color: var(--ink); border: 1px solid var(--edge); border-left: 6px solid var(--edge); border-radius: var(--r-row); padding: 12px 10px 12px 12px; margin-bottom: 8px; font: inherit; cursor: pointer; box-sizing: border-box; }
.al.bad { border-left-color: var(--bad-fill); }
.al.flag { border-left-color: var(--flag); }
.al.unk { border-style: dashed; border-left-style: solid; border-left-color: var(--ink-3); cursor: default; }
.al .lead { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--card-2); color: var(--ink-2); }
.al.bad .lead { background: var(--bad-wash); color: var(--bad); }
.al.flag .lead { background: var(--flag-wash); color: var(--flag); }
.al .mid { flex: 1; min-width: 0; }
.al .t { display: block; font-weight: var(--w-semi); line-height: var(--lh-tight); }
.al .s { display: block; font-size: var(--t-sm); color: var(--ink-2); line-height: var(--lh-tight); margin-top: 2px; overflow-wrap: anywhere; }
.al .since { display: flex; align-items: center; gap: 5px; font-size: var(--t-xs); font-weight: var(--w-semi); color: var(--ink-2); margin-top: 5px; }
.al .since .ic { width: 16px; height: 16px; }
.al.bad .since { color: var(--bad); }
.al.flag .since { color: var(--flag); }
.al > .ic { color: var(--ink-3); flex: none; }
.al-clear { display: flex; align-items: center; gap: 10px; }
.al-clear .ic { color: var(--ok); }

/* chips / badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); font-weight: var(--w-semi); line-height: var(--lh-tight); padding: 4px 10px; border-radius: var(--r-chip); white-space: nowrap; flex: none; }
.badge.todo { background: var(--card-2); color: var(--ink-2); }
.badge.in_progress { background: var(--live); color: var(--live-ink); }
.badge.completed { background: var(--ok-wash); color: var(--ok); }
.badge.blocked { background: var(--bad-wash); color: var(--bad); }
.badge.pending { background: var(--flag-wash); color: var(--flag); }
.badge.approved { background: var(--ok-wash); color: var(--ok); }
.badge.received { background: var(--ok-wash); color: var(--ok); }
.badge.rejected { background: var(--bad-wash); color: var(--bad); }
.badge.high { background: var(--bad-wash); color: var(--bad); }
.badge.medium { background: var(--flag-wash); color: var(--flag); }
.badge.low { background: var(--card-2); color: var(--ink-2); }
.badge.owner { background: var(--live); color: var(--live-ink); }
.badge.supervisor { background: var(--flag-wash); color: var(--flag); }
/* A .chip is a BADGE by default — most are <span>s nobody taps. Only a
 * button.chip is a control: 48px, outlined, and .active is the live fill. */
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--r-chip); background: var(--card-2); color: var(--ink-2); font-size: var(--t-sm); font-weight: var(--w-semi); line-height: var(--lh-tight); margin: 0 6px 6px 0; border: 0; overflow-wrap: break-word; }
button.chip {
  min-height: var(--tap); padding: 6px 16px; border: 1px solid var(--edge);
  background: var(--card); color: var(--ink); font: inherit; font-size: var(--t-body); font-weight: var(--w-med);
  line-height: var(--lh-tight); white-space: normal; cursor: pointer;
}
/* An icon leading a chip's or a bold title's words: neither sets a gap, so it gets its own
 * space, a size nearer the text, and (in the inline title) the text's centre line. */
.strong > svg.ic, .chip > svg.ic { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.chip.active { background: var(--live); color: var(--live-ink); border-color: var(--live); }
.chip.flag { background: var(--flag-wash); color: var(--flag); }
.chip.ok { background: var(--ok-wash); color: var(--ok); }

/* list item — the lead is a neutral round disc, in a list or on a card's row */
.li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.li:last-child { border-bottom: 0; }
/* The owner's 'More' sheet: each row is a real button (keyboard, Back), drawn as a list row. */
button.li { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--hair); font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.li:last-child { border-bottom: 0; }
.thumb { width: 44px; height: 44px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; font-size: 20px; flex: 0 0 auto; color: var(--ink); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A lead that still carries an inline fill (a photo album's cover colour)
 * keeps its glyph --on-ink. */
.li .thumb[style*="background"] { color: var(--on-ink); }
/* SET-1 — Settings as a section list: a row is a link that opens one section */
.set-list .li, .set-me { color: inherit; text-decoration: none; cursor: pointer; }
.set-list .li .muted, .set-me .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-list .li > .ic, .set-me > .ic { flex: none; color: var(--ink-2); }
.set-list .li.danger .strong, .set-list .li.danger .thumb { color: var(--bad); }
.set-head { display: flex; align-items: center; gap: var(--s-3); }

/* tabs — an underline on a 2px hairline baseline; the row scrolls sideways
 * when the words do not fit, so a word is never cut. */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -2px 0 var(--hair); margin-bottom: 14px; overflow-x: auto; }
/* P2 — no scrollbar; the right edge fades so a strip that runs on shows it does. route()
 * scrolls the active tab into sight and sets .runs-on only while more lies to the right,
 * so a strip that fits, or one scrolled to its end, is never faded. The fade is a mask,
 * so it needs no colour of its own. */
.tabs, .note-filters { scrollbar-width: none; }
.tabs.runs-on, .note-filters.runs-on {
  -webkit-mask-image: linear-gradient(90deg, black calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, black calc(100% - 28px), transparent);
}
.tabs::-webkit-scrollbar, .note-filters::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1 0 auto; min-height: var(--tap); border: 0; border-bottom: 3px solid transparent; background: none;
  padding: 6px 10px; font: inherit; font-size: var(--t-body); font-weight: var(--w-med); line-height: var(--lh-tight);
  color: var(--ink-2); cursor: pointer; white-space: normal;
}
.tabs button.active { color: var(--ink); font-weight: var(--w-semi); border-bottom-color: var(--ink); }
#siteTabs button { padding-inline: var(--s-1); }
/* badge counts on the store tabs — a count pill */
.tab-badge {
  display: inline-block; min-width: 22px; margin-left: 6px; padding: 1px 8px;
  border-radius: var(--r-full); background: var(--card-2); color: var(--ink);
  font-size: var(--t-sm); font-weight: var(--w-semi); text-align: center; line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
}
.tabs button.active .tab-badge { background: var(--live); color: var(--live-ink); }
.tab-badge.warn { background: var(--bad-wash); color: var(--bad); }
.tabs button.active .tab-badge.warn { background: var(--bad); color: var(--on-fill); }

/* store — ledger / movement rows */
.led-row { display: flex; gap: 12px; align-items: center; min-height: var(--row); padding: 9px 0; border-bottom: 1px solid var(--hair); }
.led-row:last-child { border-bottom: 0; }
.led-row.reversed { opacity: .55; text-decoration: line-through; }
/* The lead is a round disc in the direction's wash, like the store mockup's money rows. */
.led-dir {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: var(--t-body); font-weight: 800;
}
.led-dir.in { background: var(--ok-wash); color: var(--ok); }
.led-dir.out { background: var(--bad-wash); color: var(--bad); }
.led-num { text-align: right; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.led-in { color: var(--ok); }
.led-out { color: var(--bad); }
/* v1-F5 — expense money: the balance, its tag, a UPI payment waiting beside it */
.float-big { font-size: var(--t-fig-lg); font-weight: 800; margin: 4px 0; font-variant-numeric: tabular-nums; }
.float-tag { font-size: var(--t-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.float-wait { margin-top: 8px; padding: 8px 10px; border-radius: var(--r-chip); border: 1px dashed var(--flag); font-size: var(--t-sm); }
/* v1-U4 — UPI payments: a staff member's own UPI ID is red; the app's raw answer as it came. */
.chip.bad { background: var(--bad-wash); color: var(--bad); cursor: default; }
.upi-raw { white-space: pre-wrap; word-break: break-all; font-family: monospace; font-size: var(--t-xs); }
.upi-bill { max-width: 100%; border-radius: var(--r-chip); margin-top: 6px; }

/* buttons */
/* Every worded control grows with its words: min-height (never height), a
 * line that wraps, and never nowrap with overflow:hidden — a large system
 * font or a Tamil label must push the button taller, not get clipped.
 * break-word, never anywhere (here and on .chip): anywhere lets a row shrink
 * a button below its own word, so "Undo" broke as "Und / o". */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--ctl); padding: 8px 20px; border: 1px solid transparent; border-radius: var(--r-btn);
  font: inherit; font-size: var(--t-label); font-weight: var(--w-med); line-height: var(--lh-tight);
  white-space: normal; overflow-wrap: break-word; cursor: pointer;
  background: var(--live); color: var(--live-ink);
  transition: transform var(--d-press) var(--ease-out);
}
.btn.block { width: 100%; }
/* A link drawn as a button (Open Settings, Call, Open UPI app) loses the link underline. */
a.btn { text-decoration: none; }
/* A muted sub-line flows on from the button's text as one centred paragraph;
 * as its own flex item it stood beside the text as a second narrow column. */
.btn > .muted { display: contents; }
.btn.brand { background: var(--live); color: var(--live-ink); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--edge); }
/* --ok, not --ok-fill: white on the light fill is 2.42:1. */
.btn.green { background: var(--ok); color: var(--on-fill); }
.btn.red { background: var(--bad); color: var(--on-fill); }
.btn.sm { min-height: var(--tap); padding: 6px 14px; font-size: var(--t-body); }
.btn:active { transform: scale(.985); }
/* Disabled is its own look, never a faded live button. */
.btn[disabled] { background: var(--card-2); color: var(--ink-3); border-color: transparent; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
/* A .grow button sizes from its words, not from 0, so a row never crushes it; it then takes the rest. */
.btn-row > .grow { flex: 1 1 auto; }

/* forms */
.field { margin-bottom: 12px; }
.field label:where(:not(.sw)) { display: block; font-size: var(--t-sm); font-weight: var(--w-med); line-height: var(--lh-tight); color: var(--ink-2); margin-bottom: 6px; }
/* 16px text: anything smaller makes Android zoom the page into the field. */
.field input, .field select, .field textarea {
  width: 100%; min-height: var(--ctl); padding: 12px 15px; border: 1px solid var(--edge); border-radius: var(--r-btn);
  font-family: inherit; font-size: 16px; line-height: var(--lh-tight);
  background: var(--card); color: var(--ink);
}
.field textarea { min-height: 84px; resize: vertical; }
/* The native picker owns touch, keyboard and screen-reader input. Its visible
   value can wrap to the full site name, including at larger text sizes. */
.entry-site-field { position: relative; }
.entry-site-field .btn { justify-content: space-between; text-align: start; white-space: normal; }
.entry-site-field span { min-width: 0; overflow-wrap: anywhere; }
.row:has(> .field #f_categoryName) { flex-wrap: wrap; }
.row:has(> .field #f_categoryName) > .field { flex: 1 1 12em; min-width: 0; max-width: 100%; }
:lang(ta) #f_categoryName { overflow-wrap: normal; }
.entry-site-field select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.entry-site-field:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: var(--r-btn); }
/* Focus: a 2px ink border (the inset shadow adds the second pixel without
 * moving the text) plus the 3px ink outline. */
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink);
  outline: 3px solid var(--ink); outline-offset: 2px;
}
/* A tick or a radio inside a field (the salary-day picker) is not a text box. */
.field input[type="checkbox"], .field input[type="radio"] { min-height: 0; box-shadow: none; }
.field-hint { display: block; margin-top: 6px; font-size: var(--t-sm); line-height: var(--lh-tight); color: var(--ink-2); }
/* A hint wraps to its field's width. Including it in the field's intrinsic
   width can move a neighbouring picker to the next line, making the example
   fit and the hint disappear again on the next measurement. */
.field > .field-hint { contain: inline-size; }

/* empty / denied state — a card of its own, so inside #gate it stays dark */
.empty { text-align: center; padding: 28px 20px; color: var(--ink-2); background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-row); }
.empty .em-ic { font-size: 44px; line-height: 1; color: var(--ink-3); margin-bottom: 12px; }
.empty .em-ic svg.ic { width: 44px; height: 44px; }
.empty .em-title { font-weight: var(--w-semi); color: var(--ink); font-size: var(--t-lg); margin-bottom: 6px; }

/* bottom sheet / modal */
#sheetHost { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--card);
  border-radius: var(--r-card) var(--r-card) 0 0; box-shadow: var(--elev-sheet);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform var(--d-sheet) var(--ease-out);
  max-height: 88%; overflow-y: auto;
}
/* S2-9 — a sheet opened at the gate (the outbox sheet of a refused PIN) shows above it (#gate is 90) */
#sheetHost.over-gate { z-index: 95; }
#sheetHost.open { pointer-events: auto; }
#sheetHost.open .sheet-scrim { opacity: 1; }
#sheetHost.open .sheet { transform: translateY(0); }
.sheet .grab { width: 44px; height: 5px; background: var(--edge); border-radius: 3px; margin: 0 auto 10px; }
/* The header: the title, then a visible 48px close on the right. */
.sheet .sh-h {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 14px; padding: 0 2px 12px; border-bottom: 1px solid var(--hair);
}
.sheet .sh-h h3 {
  flex: 1; min-width: 0; margin: 0;
  font-size: var(--t-lg); font-weight: var(--w-semi); line-height: var(--lh-tight);
}
/* A heading a screen writes into the body (the UPI result: "Paid") keeps its own line. */
.sheet-body h3 {
  margin: 4px 0 14px; padding: 0 2px 12px; border-bottom: 1px solid var(--hair);
  font-size: var(--t-lg); font-weight: var(--w-semi); line-height: var(--lh-tight);
}
.xbtn {
  width: 48px; height: 48px; margin-left: auto; padding: 0; flex: none; cursor: pointer;
  border-radius: var(--r-full); border: 1px solid var(--edge); background: var(--card); color: var(--ink);
  display: grid; place-items: center;
}
.sheet .li.tap { min-height: var(--row); }
/* D4/D16 — the photo picker drawn over an open form: the form is hidden, not removed, so what was typed survives. */
.sheet-body.picking > :not(.pc-pane) { display: none; }

/* toast */
#toast {
  position: absolute; bottom: 84px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 14px 16px; border-radius: var(--r-row); box-shadow: var(--elev-toast);
  font-size: var(--t-body); font-weight: var(--w-med); line-height: var(--lh-tight);
  opacity: 0; transition: all .25s; z-index: 80; pointer-events: none; max-width: 88%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* S2-18 — Back's words on the gate (keypad, setup) show above it (#gate is 90) */
#toast.top { z-index: 95; }
/* A success toast leads with the accent tick (--live is the accent in here). */
#toast > svg.ic { color: var(--live); vertical-align: middle; margin-right: 8px; }

/* v1-4 — the honest storage label under the app bar ("On this phone only") */
#syncPill { flex: 0 0 auto; padding: 0 var(--gutter) var(--s-2); }
#syncPill:empty { display: none; }
.sync-pill {
  border: 0; background: var(--flag-wash); color: var(--flag);
  font: inherit; font-size: var(--t-sm); font-weight: var(--w-semi); line-height: var(--lh-tight);
  min-height: var(--tap); padding: 6px 16px; border-radius: var(--r-pill); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.sync-pill svg.ic { width: 18px; height: 18px; }
/* v1-38 — a device's pill (history-sync.html frames 11-14): synced, waiting, uploading, need a decision */
.sync-pill.ok { background: var(--ok-wash); color: var(--ok); }
.sync-pill.flag { background: var(--flag-wash); color: var(--flag); }
.sync-pill.bad { background: var(--bad-wash); color: var(--bad); }
.sync-pill[data-sync="uploading"] { background: var(--card-2); color: var(--ink); }

/* SPEC-NOTES §6.5 — the in-app reminder banner (app.js ReminderBanner).
 * z-index 70 is above an open bottom sheet (#sheetHost, 60) on purpose: it
 * has to reach a user who is mid-form, and it is a strip, not a modal — the
 * form under it stays usable. Below the toast (80) and the lock screen (90),
 * which must cover it. #phone sets no z-index, so these compare directly. */
.rem-banner {
  position: absolute; top: 76px; left: 10px; right: 10px; z-index: 70;
  background: var(--card); color: var(--ink);
  border-radius: var(--r-row);
  border-left: 6px solid var(--flag);
  box-shadow: var(--elev-toast);
  padding: 10px 8px 10px 12px;
  transform: translateY(-12px); opacity: 0; pointer-events: none;
  transition: transform .2s, opacity .2s;
}
.rem-banner.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.rem-banner .rb-row { display: flex; align-items: flex-start; gap: 10px; }
.rem-banner .rb-ic { font-size: 18px; line-height: 1.35; }
.rem-banner .rb-text { flex: 1; min-width: 0; }
.rem-banner .rb-title { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-banner .rb-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-banner .rb-more { font-size: 12px; font-weight: 700; color: var(--ink); background: var(--card-2); border-radius: 10px; padding: 2px 8px; align-self: center; }
.rem-banner .rb-x { background: none; border: 0; color: var(--ink-3); font-size: 16px; width: 32px; height: 32px; border-radius: 10px; cursor: pointer; flex: 0 0 auto; }
.rem-banner .rb-x:active { background: var(--card-2); }
.rem-banner .rb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rem-banner .rb-actions .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--edge); }

/* misc header block */
.page-head { margin-bottom: 6px; }
.page-head h1 { font-size: var(--t-head); font-weight: var(--w-semi); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); margin: 2px 0 2px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 50px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: var(--t-body); line-height: var(--lh-tight); }
.kv:last-child { border: 0; }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 600; text-align: right; word-break: break-word; font-variant-numeric: tabular-nums; }
:lang(ta) .kv { flex-wrap: wrap; }
:lang(ta) .kv > :is(.v,dd) { margin-inline-start: auto; word-break: normal; overflow-wrap: normal; max-width: 100%; }
:lang(ta) .kv > :is(.k,dt) { flex: 1 1 min-content; overflow-wrap: normal; }
#bkList .k { min-width: 0; overflow-wrap: anywhere; flex: 1 1 min-content; }
#bkList .v, #bkList button { flex: none; white-space: nowrap; }
.site-money-totals .kv { flex-wrap: wrap; }
.site-money-totals .kv .k { flex: 1 1 min-content; min-width: 0; overflow-wrap: anywhere; }
.site-money-totals .kv .v, .site-money-totals summary bdi { white-space: nowrap; }
.site-money-totals .kv .v { margin-inline-start: auto; }
.site-money-totals summary > .kv, .site-money-totals summary > .row {
  display: inline-flex;
  width: calc(100% - 1.5em);
  vertical-align: middle;
}

/* photo grid */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.photo-grid .ph {
  aspect-ratio: 1; border-radius: 12px; display: grid; place-items: flex-end; padding: 6px;
  color: var(--on-ink); font-size: var(--t-xs); font-weight: 600; overflow: hidden; position: relative; background: var(--card-2);
}
.photo-grid .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-grid .ph .cap {
  position: relative; z-index: 1; width: 100%;
  text-shadow: 0 1px 3px rgba(0,0,0,.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* chat */
.msg { max-width: 78%; padding: 9px 12px; border-radius: var(--r-row); margin-bottom: 8px; font-size: var(--t-sm); line-height: 1.35; }
.msg.in { background: var(--card); border: 1px solid var(--hair); border-top-left-radius: 4px; }
.msg.out { background: var(--card-2); margin-left: auto; border-top-right-radius: 4px; }
.msg .who { font-size: var(--t-xs); font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.msg .tm { font-size: var(--t-xs); color: var(--ink-2); margin-top: 3px; text-align: right; }
.chat-input { display: flex; gap: 8px; padding-top: 8px; }
/* v1-52 — a chat row's time and unread count; the line that says who can read a chat */
.chat-when { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: var(--t-xs); }
.lv-banner.info { background: var(--card-2); color: var(--ink); }
.chat-input input { flex: 1; min-height: var(--tap); padding: 12px 16px; border-radius: var(--r-full); border: 1px solid var(--edge); background: var(--card); color: var(--ink); font: inherit; font-size: 16px; }

/* ---------- AI assistant: chat thread, system notes, memory manager -------
 * SPEC-CLOUD-AI §1.5. The thread reuses .msg/.chat-input above; only the three
 * things that screen adds are new — a scroll box, the "this happened to your
 * conversation" system line (compaction), and a memory row. */
.ai-thread { min-height: 120px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.ai-sys {
  font-size: var(--t-xs); line-height: 1.4; color: var(--flag); background: var(--flag-wash);
  border-radius: var(--r-chip); padding: 7px 10px; margin: 2px 0 10px; text-align: center;
}
.ai-mem { border-bottom: 1px solid var(--hair); padding: 11px 0; }
.ai-mem:last-child { border-bottom: 0; }
.ai-mem .badge { margin-right: 6px; }
.ai-mem-text { font-size: var(--t-sm); line-height: 1.4; color: var(--ink); word-break: break-word; }
.ai-mem-when { font-size: var(--t-xs); white-space: nowrap; }
:lang(ta) .ai-mem-when { white-space: normal; }

/* Translated titles and subtitles carry the identity of the item. Give them
   another line before truncating the text that distinguishes two records. */
:lang(ta) :is(#pageTitle, .ellipsis, .note-vis, .qa-vis span, .set-list .li .muted, .set-me .muted, .badge) {
  white-space: normal; overflow: visible;
}
:lang(ta) .clamp2 { display: block; -webkit-line-clamp: unset; overflow: visible; }
:lang(ta) .row:has(> #personBackBtn), :lang(ta) .row:has(> #personWaBtn) { flex-wrap: wrap; }
:lang(ta) .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12em), 1fr)); }
:lang(ta) .kpi-val { word-break: normal; overflow-wrap: normal; }
:lang(ta) .badge { max-width: 100%; flex-shrink: 1; }
:lang(ta) .photo-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9em), 1fr)); }
:lang(ta) .photo-grid .ph .cap { white-space: normal; }
:lang(ta) .seg:has(:is([data-jrdir],[data-cumonths])) { flex-wrap: wrap; }
:lang(ta) .seg > :is([data-jrdir],[data-cumonths]) { flex-basis: max-content; overflow-wrap: normal; }
@media screen {
  :lang(ta) .firm-paper dl > div { display: flex; flex-wrap: wrap; }
  :lang(ta) .firm-paper table.monthly-register { table-layout: auto; }
  :lang(ta) .firm-paper .monthly-register :is(th,td) { overflow-wrap: normal; }
  :lang(ta) .firm-paper .monthly-grid { grid-template-columns: repeat(7, minmax(min-content,1fr)); min-width: max-content; }
}

.hr { height: 1px; background: var(--hair); margin: 12px 0; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- charts ---------- */
.chart-bars { display: flex; flex-direction: column; gap: 11px; }
/* P3 — the name on its own line, the track and the figure under it, so a long site name shows whole. */
.cb-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; }
.cb-label { grid-column: 1 / -1; font-size: var(--t-sm); color: var(--ink); }
.cb-track { height: 12px; background: var(--card-2); border-radius: 8px; overflow: hidden; }
.cb-fill { height: 100%; border-radius: 8px; transition: width .5s ease; }
.cb-val { font-size: var(--t-xs); font-weight: 700; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.dl-row { font-size: var(--t-sm); color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.dl-row b { color: var(--ink); margin-left: auto; font-variant-numeric: tabular-nums; }
.dl-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }

/* =========================================================================
 * Gate — the PIN lock screen and the first-run setup wizard.
 * A full-cover dark layer inside the phone frame; there is never a
 * username/password form.
 * ===================================================================== */
#gate { position: absolute; inset: 0; z-index: 90; display: none; }
#gate.show { display: block; }
#online-cover { position: fixed; inset: 0; z-index: 150; }
#online-line { flex: 0 0 auto; padding: var(--s-2) var(--gutter); }
button[aria-busy="true"] { cursor: progress; opacity: .65; }
@media print { [data-online-inert] { display: none !important; } }
.gate-panel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 22px 20px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.gate-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; font-size: var(--t-body); }
.gate-brand .mark {
  width: 30px; height: 30px; border-radius: var(--r-chip); background: var(--live); color: var(--live-ink);
  display: grid; place-items: center; font-size: var(--t-body); font-weight: 800;
}
.gate-head { text-align: center; margin: 18px 0 10px; }
.gate-head h2 { margin: 12px 0 2px; font-size: var(--t-lg); }
.gate-head .who { color: var(--live); font-size: var(--t-sm); font-weight: 700; }
.gate-msg { min-height: 20px; text-align: center; font-size: var(--t-sm); color: var(--ink-2); margin-top: 8px; }
.gate-msg.err { color: var(--bad); }
.gate-msg.ok { color: var(--ok); }
/* S2-21 — the server a device's gate talks to; after a move made at the gate, a warning */
.gate-msg.gate-host { overflow-wrap: anywhere; }
.gate-msg.warn { color: var(--flag); font-weight: 700; }

/* masked PIN entry */
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 16px 0 4px; min-height: 16px; }
.pin-dots i {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--edge);
  display: block; transition: transform .12s;
}
#gate .pin-dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.12); }

/* keypad — 64px keys on the hero track; the action key is the accent (--live in this scope) */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 14px auto 0; width: 100%; }
.keypad button {
  min-height: 64px; border: 0; border-radius: var(--r-key); background: var(--hero-track); color: var(--ink);
  font: inherit; font-size: 22px; font-weight: 700; cursor: pointer;
}
.keypad button:active { opacity: .7; }
.keypad button.act { background: var(--live); color: var(--live-ink); font-size: var(--t-label); }
.keypad button.sub { font-size: var(--t-body); font-weight: 600; color: var(--ink-2); }
.keypad button[disabled] { opacity: .4; }
.gate-foot { margin-top: auto; padding-top: 16px; text-align: center; }
#gate .gate-link { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: var(--t-sm); cursor: pointer; padding: 10px; min-height: var(--tap); }

/* profile picker — a tappable row on the dark gate: the hero ground with
 * the hero's darker outline, pressed onto the track */
.profile-list { margin-top: 10px; }
.profile-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-row);
  min-height: var(--row); padding: 12px 14px; margin-bottom: 10px; color: var(--ink); cursor: pointer;
}
.profile-row:active { background: var(--card-2); }
.profile-row .nm { font-weight: 700; font-size: var(--t-body); }
.profile-row .rl { font-size: var(--t-xs); color: var(--ink-2); }
.profile-row .tag { font-size: var(--t-xs); font-weight: 700; color: var(--live); }

/* wizard */
.wiz-steps { display: flex; gap: 6px; margin: 16px 0 6px; }
.wiz-steps i { flex: 1; height: 4px; border-radius: 3px; background: var(--card-2); display: block; }
.wiz-steps i.on { background: var(--live); }
.wiz-body { margin-top: 8px; }
/* A card on the dark gate: the hero ground and the track as its hairline. */
.wiz-card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-row); padding: 14px; margin-bottom: 12px; }
.wiz-note { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.45; }
.wiz-log { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.7; }
.wiz-log .done { color: var(--ok); }
.wiz-log .fail { color: var(--bad); }

/* =========================================================================
 * My Team (accountability) + activity log
 * ===================================================================== */
.team-card .metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.team-card .metric { background: var(--card-2); border-radius: var(--r-row); padding: 8px 6px; text-align: center; }
.team-card .metric b { display: block; font-size: var(--t-body); color: var(--ink); font-variant-numeric: tabular-nums; }
.team-card .metric span { font-size: var(--t-xs); color: var(--ink-2); font-weight: 600; }
/* One activity: a list row with a round lead, like .li (the wash says what happened). */
.audit-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.audit-row:last-child { border-bottom: 0; }
.audit-row .act {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: var(--t-body); background: var(--card-2);
}
.audit-row .act.create { background: var(--ok-wash); }
.audit-row .act.edit { background: var(--card-2); }
.audit-row .act.delete { background: var(--bad-wash); }
.audit-row .act.approve { background: var(--flag-wash); }
.audit-row .txt { font-size: var(--t-sm); line-height: 1.35; }

/* =========================================================================
 * Notes & To-Dos (SPEC-NOTES §6, SPEC-MASTER §5 P2 items 18/19)
 *
 * The load-bearing rule here is that a PRIVATE note must LOOK private without
 * being read: a locked left edge, a dark badge and a tinted surface, so nobody
 * types something personal into a shared note by accident (§3.1).
 * ===================================================================== */

/* ---- filter chip row ---- */
.note-filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 10px; }
.note-filters .chip { flex: 0 0 auto; margin: 0; }

/* ---- a note row, and the swipe surface under it ---- */
.note-swipe {
  position: relative; margin-bottom: 8px; border-radius: var(--r-row); overflow: hidden;
  background: var(--card-2);
  /* Vertical drags must remain page scrolls; only the X axis is ours (§6.3). */
  touch-action: pan-y;
}
.note-behind {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 18px;
  font-size: var(--t-sm); font-weight: 800; color: var(--on-ink);
}
.note-behind .nb-left { color: var(--ok); }
.note-behind .nb-right { color: var(--flag); }
.note-swipe.to-done .note-behind { background: var(--ok-wash); }
.note-swipe.to-snooze .note-behind { background: var(--flag-wash); }

.note-row {
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border-radius: var(--r-row); padding: 11px 12px 11px 0;
  border: 1px solid var(--hair); will-change: transform;
}
.note-row .note-bar {
  width: 5px; align-self: stretch; border-radius: 0 4px 4px 0; flex: 0 0 auto;
  margin-right: 6px; min-height: 38px;
}
.note-title { font-weight: 700; font-size: var(--t-body); color: var(--ink); }
.note-time { font-size: var(--t-xs); font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.note-sub { font-size: var(--t-sm); color: var(--ink-2); margin-top: 3px; }
.note-sub.late { color: var(--bad); font-weight: 700; }
.note-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; align-items: center; }
.note-meta .chip, .note-meta .badge { margin: 0; font-size: var(--t-xs); padding: 2px 8px; }
.note-row.done .note-title, .note-row.dropped .note-title { text-decoration: line-through; color: var(--ink-2); }
.note-row.dropped { opacity: .6; }
.note-struck { text-decoration: line-through; color: var(--ink-2); }

/* ---- visibility: the badge that has to be unmissable ---- */
.note-vis {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--t-xs); font-weight: 800; padding: 2px 8px; border-radius: var(--r-full);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-vis.manager { background: var(--card-2); color: var(--ink); }
.note-vis.shared { background: var(--ok-wash); color: var(--ok); }
/* A private row reads as private at a glance, before any label is parsed:
 * the private-note card's darker 1px outline, beside the dark badge. */
.note-row.private { background: var(--card); border-color: var(--ink-2); }

/* ---- detail sheet ---- */
.nd-vis { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: var(--r-row); margin-bottom: 10px; }
.nd-vis .nd-vis-ic { font-size: 20px; line-height: 1; }
.nd-vis.private { background: var(--card-2); border: 1px solid var(--ink); }
.nd-vis.manager { background: var(--card-2); border: 1px solid var(--edge); }
.nd-vis.shared { background: var(--ok-wash); border: 1px solid var(--ok); }
.nd-vis .muted { font-size: var(--t-xs); line-height: 1.4; }
.note-banner {
  background: var(--flag-wash); color: var(--flag); border-radius: var(--r-row); padding: 10px 12px;
  font-size: var(--t-sm); font-weight: 700; margin-bottom: 10px;
}
.note-banner a { color: var(--flag); }
.note-why { background: var(--card-2); color: var(--ink-2); border-radius: var(--r-row); padding: 9px 12px; font-size: var(--t-sm); margin-bottom: 10px; }
.note-readonly { background: var(--card-2); color: var(--ink); border-radius: var(--r-row); padding: 9px 12px; font-size: var(--t-sm); margin-bottom: 10px; }
.note-closed { margin-top: 10px; }
.note-closed summary { font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); padding: 8px 0; cursor: pointer; }
.section-title.danger { color: var(--bad); }

/* ---- quick add (§6.2) — the search-pill look with the live add key ---- */
/* P2 — #view drops its 96px FAB clearance on Notes (no FAB there), so the bar sits on the
 * bottom edge, gutter to gutter, instead of floating 96px up. */
#view.qa-host { padding-bottom: 0; }
.quick-add {
  position: sticky; bottom: 0; z-index: 15;
  margin: 14px calc(-1 * var(--gutter)) 0; padding: 8px var(--gutter) 12px;
  background: var(--page); border-top: 1px solid var(--hair);
}
.qa-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; }
.qa-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--hero); color: var(--on-ink); border-radius: var(--r-full);
  padding: 3px 5px 3px 10px; font-size: var(--t-xs); font-weight: 700;
}
.qa-chip.date, .qa-chip.timeword { background: var(--ink-2); }
.qa-chip.time { background: var(--ink-2); }
.qa-chip.repeat { background: var(--ink-3); }
.qa-chip.priority { background: var(--bad); }
.qa-chip.tag { background: var(--ink-3); }
.qa-chip.site { background: var(--ok); }
.qa-x {
  border: 1px solid currentColor; background: none; color: var(--on-ink); cursor: pointer;
  width: 16px; height: 16px; border-radius: 50%; font-size: var(--t-xs); line-height: 1;
  display: grid; place-items: center; padding: 0;
}
.qa-preview { font-size: var(--t-xs); color: var(--ink-2); margin-bottom: 6px; min-height: 15px; line-height: 1.4; }
.qa-preview .qa-saves { font-weight: 800; color: var(--ink); }
.qa-preview .qa-warn { color: var(--flag); font-weight: 700; }
.qa-bar { display: flex; gap: 7px; align-items: center; }
/* 16px text: anything smaller makes the phone zoom the page into the field. */
.qa-bar input {
  flex: 1; min-width: 0; min-height: var(--tap); padding: 10px 16px; border-radius: var(--r-full);
  border: 1px solid var(--edge); background: var(--card); color: var(--ink); font-size: 16px; font-family: inherit;
}
.qa-vis {
  flex: 0 0 auto; max-width: 42%; min-height: var(--tap); border: 0; cursor: pointer;
  border-radius: var(--r-full); padding: 9px 11px; font-size: var(--t-xs); font-weight: 800;
  display: inline-flex; align-items: center; gap: 4px; overflow: hidden;
}
.qa-vis span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-vis.manager { background: var(--card-2); color: var(--ink); }
.qa-vis.shared { background: var(--ok-wash); color: var(--ok); }
.qa-add {
  flex: 0 0 auto; width: var(--tap); height: var(--tap); border-radius: 50%; border: 0;
  background: var(--live); color: var(--live-ink); font-size: var(--t-lg); cursor: pointer;
  display: grid; place-items: center;
}
.qa-add[disabled] { opacity: .55; }

/* ---- the undo toast needs taps; the plain one must never take them ---- */
#toast.has-undo { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
/* --live inside the toast's dark scope is the accent: a yellow 48px Undo. */
#toast .toast-undo {
  flex: 0 0 auto; min-height: var(--tap); border: 0; background: var(--live); color: var(--live-ink);
  border-radius: var(--r-chip); padding: 6px 16px; font: inherit; font-size: var(--t-body);
  font-weight: var(--w-semi); line-height: var(--lh-tight); cursor: pointer;
}
/* A note you did not write never drags — no swipe track, no grab affordance. */
.note-swipe.no-swipe { background: transparent; touch-action: auto; }

/* =========================================================================
 * REPORTS — the #reports catalogue and #reports/:type (SPEC-REPORTS §13)
 * ===================================================================== */

/* --- catalogue cards --- */
/* The back circle, grown into a pill by its word ("← Reports"): 48px, outlined. */
.rep-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 16px 0 12px;
  margin-bottom: 8px; border: 1px solid var(--edge); border-radius: var(--r-full); background: var(--card);
  text-decoration: none; color: var(--ink); font-size: var(--t-body); font-weight: var(--w-med); line-height: var(--lh-tight);
}
/* A report's lead is the neutral list disc (v1-R6: no category fill). */
.rep-card { display: block; text-decoration: none; }
.rep-ic {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; background: var(--card-2);
  display: grid; place-items: center; font-size: 20px; color: var(--ink);
}
.rep-go { color: var(--ink-2); font-size: 22px; font-weight: 700; line-height: 1; flex: 0 0 auto; }
.rep-fmts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
/* A format label in the outlined chip's colours (a <span>: it stays small). */
.chip.fmt {
  margin: 0; padding: 2px 9px; font-size: var(--t-xs); font-weight: 800;
  letter-spacing: .03em; background: var(--card); color: var(--ink); border: 1px solid var(--edge); cursor: inherit;
}

/* --- report header, scope and period pickers --- */
.rep-head { margin-bottom: 12px; }
.rep-head h1 { margin: 0 0 2px; }
.chip.site-pick { margin: 0 0 8px; background: var(--live); color: var(--live-ink); font-weight: 700; border: 0; }
.rep-periods { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.rep-periods .chip { flex: 0 0 auto; margin: 0; }
.rep-range, .rep-scope { margin: 8px 4px 4px; font-weight: 600; }
/* v1-R8 — the one-line filter summary under a report's site and period chips. */
.fsum { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; padding: 10px 14px; border-radius: var(--r-row); background: var(--card-2); color: var(--ink); font-size: var(--t-sm); }
.fsum svg.ic { color: var(--ink-2); }

/* --- KPI strip (§13) --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; margin: 10px 0 4px; }
.kpi {
  background: var(--card); border-radius: var(--r-row); padding: 12px 13px;
  border: 1px solid var(--hair); border-left: 4px solid var(--ink); min-width: 0;
}
.kpi-val { font-size: var(--t-fig); font-weight: var(--w-bold); line-height: var(--lh-tight); color: var(--ink); word-break: break-word; font-variant-numeric: tabular-nums; }
.kpi-lbl { font-size: var(--t-sm); color: var(--ink-2); font-weight: var(--w-med); line-height: var(--lh-tight); margin-top: 2px; }
.kpi-delta { font-size: var(--t-xs); font-weight: 800; margin-top: 5px; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--bad); }
/* A tone is said twice: the 4px left rule and the figure's own colour.
   A dash stays the dash's grey — an unknown never takes a figure's tone. */
.kpi.good { border-left-color: var(--ok); }
.kpi.warn { border-left-color: var(--flag); }
.kpi.bad { border-left-color: var(--bad); }
.kpi.good .kpi-val:not(.dash) { color: var(--ok); }
.kpi.warn .kpi-val:not(.dash) { color: var(--flag); }
.kpi.bad .kpi-val:not(.dash) { color: var(--bad); }

/* --- flags (§5 `flags[]`) --- */
.rep-flags { display: flex; flex-direction: column; gap: 7px; margin: 12px 0 4px; }
.rep-flag {
  display: flex; gap: 9px; align-items: flex-start;
  border-radius: var(--r-row); padding: 10px 12px; font-size: var(--t-sm); line-height: 1.4;
  background: var(--card-2); color: var(--ink);
}
.rep-flag .rf-ic { flex: 0 0 auto; line-height: 1.3; }
.rep-flag.warn { background: var(--flag-wash); color: var(--flag); }
.rep-flag.bad { background: var(--bad-wash); color: var(--bad); }

/* --- section tables. A phone is 360 px wide; wide reports scroll sideways
       inside the card rather than squeezing every column to nothing. --- */
.rep-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; }
.rep-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.rep-table th, .rep-table td { padding: 8px 8px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.rep-table td { font-variant-numeric: tabular-nums; }
.rep-table th {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-2); font-weight: 800; border-bottom: 2px solid var(--hair);
}
.rep-table td:first-child, .rep-table th:first-child { padding-left: 0; }
.rep-table td:last-child, .rep-table th:last-child { padding-right: 0; }
.rep-table tbody tr:last-child td { border-bottom: 0; }
.rep-table .al-left { text-align: left; }
.rep-table .al-right { text-align: right; font-variant-numeric: tabular-nums; }
.rep-table .al-center { text-align: center; }
.rep-table tr.bold td { font-weight: 800; }
.rep-table tr.tone-good td { color: var(--ok); }
.rep-table tr.tone-warn td { color: var(--flag); }
.rep-table tr.tone-bad td { color: var(--bad); }
.rep-table tfoot td {
  border-top: 2px solid var(--hair); border-bottom: 0;
  font-weight: 800; color: var(--ink); padding-top: 10px;
}

/* --- narrative (§10) --- */
.rep-narrative { position: relative; }
.rep-narr-tag {
  display: inline-block; font-size: var(--t-xs); font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-2); background: var(--card-2);
  border-radius: var(--r-full); padding: 3px 9px; margin-bottom: 8px;
}
.rep-narr-body { font-size: var(--t-body); line-height: 1.5; color: var(--ink); white-space: pre-wrap; }
.rep-narr-foot { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--hair); font-size: var(--t-xs); }

/* --- export --- */
.rep-export .btn-row { gap: 8px; }
.rep-err { margin-top: 10px; }

/* These scoped paper rules travel with the saved document and print WebView. */
.firm-paper { font-family: var(--font); font-size: var(--t-sm); line-height: var(--lh-body); color: var(--ink); overflow-wrap: anywhere; }
.firm-paper.card { overflow-x: auto; }
.firm-paper h1 { font-size: var(--t-head); margin: var(--s-3) 0; }
.firm-paper h2 { font-size: var(--t-label); margin: var(--s-3) 0 var(--s-1); }
.firm-paper p { margin: var(--s-2) 0; }
.firm-paper dl { margin: 0; }
.firm-paper dl > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s-2); padding: var(--s-1) 0; border-bottom: 1px solid var(--hair); break-inside: avoid; }
.firm-paper dt, .firm-paper dd { margin: 0; }
.firm-paper [data-firm-letterhead] div { white-space: pre-line; }
.firm-paper [data-firm-letterhead] .strong { font-weight: var(--w-bold); }
.firm-paper img { max-width: 100%; object-fit: contain; }
.firm-paper #wsPaperLogo img { height: 60px; }
.firm-paper pre, .firm-paper .paper-pre { white-space: pre-wrap; font: inherit; margin: 0; }
.firm-paper table { border-collapse: collapse; width: 100%; }
.firm-paper th, .firm-paper td { text-align: start; vertical-align: top; border-bottom: 1px solid var(--hair); padding: var(--s-1); }
.firm-paper th { font-weight: var(--w-semi); }
.firm-paper tr { break-inside: avoid; }
.firm-paper .paper-frame > thead > tr > td, .firm-paper .paper-frame > tbody > tr > td { border: 0; padding: 0; }
.firm-paper .paper-frame > tbody > tr { break-inside: auto; }
.firm-paper .paper-signature { padding-top: 12mm; break-inside: avoid; }
.firm-paper .paper-day p { margin: var(--s-1) 0; }
.firm-paper .paper-day-dense { font-size: var(--t-xs); }
.paper-print-frame { position: fixed; width: 0; height: 0; border: 0; }

/* --- print view: desktop only, secondary to the generated PDF (§14).
       Everything that is app chrome is dropped; only #view is printed. --- */
/* Shown only on paper: the offline summary that replaces screen-only AI commentary. */
.rep-print-only { display: none; }
/* v1-50 — a labour cut the chips are not showing; paper shows all four. */
.rep-cut.off { display: none; }

@page trip-sheet { size: A4 landscape; margin: 10mm; }
@media print {
  body { display: block; background: #fff; overflow: visible; }
  #phone {
    width: auto; max-width: none; height: auto; max-height: none;
    box-shadow: none; border-radius: 0; background: #fff; overflow: visible;
  }
  #appbar, #drawer, #scrim, #bottomnav, #fab, #sheetHost, #toast, #gate, #remBanner,
  .rep-back, .rep-periods, .site-pick, .rep-export, .rep-err, .rep-ai { display: none !important; }
  .rep-print-only { display: block !important; }
  .rep-cut.off { display: block !important; }
  .trip-report > :not(#repBody),
  .trip-report #repBody > :not(.rep-print-only) { display: none !important; }
  .trip-report { page: trip-sheet; }
  [data-trip-paper] .rep-table { font-size: var(--t-xs); line-height: 1.25; }
  [data-trip-paper] .rep-table th, [data-trip-paper] .rep-table td { padding: 3px 5px; vertical-align: top; overflow-wrap: anywhere; }
  [data-trip-paper] h1, [data-trip-paper] h2, [data-trip-paper] p { margin: 4px 0; }
  [data-trip-paper] + [data-trip-paper] { break-before: page; }
  [data-trip-paper] tr { break-inside: avoid; }
  #view { overflow: visible !important; padding: 0; }
  .card { box-shadow: none; border: 1px solid var(--hair); break-inside: avoid; }
  .rep-table-wrap { overflow: visible; }
  .rep-table th, .rep-table td { white-space: normal; }
}

/* =========================================================================
 * MEASURE — the take-off pad
 * (SPEC-SURVEY §14.1/§14.2, SPEC-MASTER §4.4/§4.5, §5 P5 item 30)
 *
 * The design brief is not "a form": one thumb, gloves, direct sun, 30 %
 * battery, no signal, standing on a slab. That produces three hard rules and
 * everything here follows from them.
 *
 *   1. THE NUMBER NEVER LEAVES THE SCREEN. `.mp-top` is sticky, dark and
 *      32 px in the accent — readable at arm's length, updated on every key.
 *   2. THE OS KEYBOARD IS NEVER INVOKED FOR A DIMENSION. Dimension chips are
 *      <button>s, not <input>s, so Android cannot slide a keyboard over the
 *      running total (which is exactly what `type="number"` does elsewhere in
 *      this app, and why §14.2 forbids it here). `.mp-keys` are 56 px — the
 *      spec floor, and about a thumb pad wide.
 *   3. A WARNING APPEARS WHERE THE MISTAKE IS. `.mp-flag` sits under the chip
 *      that caused it, with the fix as a tappable chip (§3.2). A typo caught
 *      here costs a tap; the same typo caught after saving is a lorry of
 *      concrete.
 * ===================================================================== */

/* The pad owns the whole scroll area: #view's own padding would push the
   sticky footer 90 px up and leave dead space under the keypad. */
#view.mp-host { padding: 0; }

.mp { display: flex; flex-direction: column; min-height: 100%; }

/* ---- sticky result header (§14.2) — the hero: a dark surface (see the
        dark-surface rule), so --card-2 here is the hero track and --live
        the accent ---- */
.mp-top {
  position: sticky; top: 0; z-index: 12;
  padding: 10px 14px 12px;
}
.mp-crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mp-back {
  background: var(--card-2); border: 0; color: var(--ink); cursor: pointer;
  border-radius: var(--r-chip); padding: 6px 10px; font-size: var(--t-sm); font-weight: 700;
}
.mp-back:active { opacity: .7; }
.mp-name {
  flex: 1; min-width: 0; background: none; border: 0; color: var(--ink-3); cursor: pointer;
  text-align: left; font-size: var(--t-sm); font-weight: 700; padding: 4px 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:lang(ta) .mp-name { white-space: normal; overflow: visible; }
.mp-result { display: flex; align-items: baseline; gap: 8px; min-height: 42px; }
/* The running figure: the accent on black, tabular so a digit never shifts. */
.mp-top .mp-qty {
  font-size: var(--t-fig-lg); font-weight: var(--w-bold); line-height: 1.05; letter-spacing: var(--tr-flat);
  font-variant-numeric: tabular-nums; color: var(--accent);
}
.mp-top .mp-qty.none { color: var(--ink-2); font-size: var(--t-fig); }
.mp-unit { font-size: var(--t-body); font-weight: 800; color: var(--live); }
.mp-sub { font-size: var(--t-xs); color: var(--ink-2); margin-top: 3px; font-weight: 600; }
.mp-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mp-tag {
  font-size: var(--t-xs); font-weight: 800; padding: 3px 9px; border-radius: var(--r-full);
  background: var(--card-2); color: var(--ink-3);
}
.mp-tag.bad { background: var(--bad-wash); color: var(--bad); }
.mp-tag.warn { background: var(--flag-wash); color: var(--flag); }
.mp-tag.ok { background: var(--ok-wash); color: var(--ok); }

/* ---- body ---- */
.mp-body { padding: 12px 14px 6px; }
.mp-sec {
  font-size: var(--t-xs); font-weight: 800; color: var(--ink-2); text-transform: uppercase;
  letter-spacing: .05em; margin: 14px 2px 8px;
}
.mp-sec.first { margin-top: 2px; }
.mp-card {
  background: var(--card); border-radius: var(--r-row); border: 1px solid var(--hair);
  padding: 10px 12px; margin-bottom: 10px;
}
.mp-rowhead {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 12px; font-weight: 800; color: var(--ink-2);
}
.mp-rowhead .mp-rowqty { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.mp-x {
  border: 0; background: var(--card-2); color: var(--ink-2); border-radius: 9px;
  width: 30px; height: 30px; font-size: 15px; cursor: pointer; flex: 0 0 auto;
}
.mp-x:active { background: var(--hair); }

/* ---- a dimension chip: label left, value right in tabular figures,
        the parsed metre value in grey underneath (§14.2) ---- */
/* A full-width row, never a grid cell: the finding chip (.mp-flag) sits
   UNDER the chip that caused it (§14.2 rule 3). */
.mp-chip {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  min-height: 52px; padding: 8px 12px; margin-bottom: 8px; cursor: pointer;
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-row);
}
.mp-chip .mp-lb { font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); }
.mp-chip .mp-req { color: var(--flag); }
.mp-chip .mp-vw { margin-left: auto; text-align: right; min-width: 0; max-width: 64%; }
/* §14.2 — the value right-aligned in tabular figures, and the parsed metre
   value in grey UNDERNEATH it. Both are blocks so `1.5` and `1.500 m` stack
   instead of running together on one line, which is what made "180mm 0.180 m"
   read as a single number. */
.mp-chip .mp-vl {
  display: block;
  font-size: var(--t-label); font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mp-chip .mp-vl.ph { color: var(--ink-3); font-weight: 700; }
.mp-chip .mp-pv {
  display: block;
  font-size: var(--t-xs); font-weight: 700; color: var(--ink-2); margin-top: 1px;
  white-space: nowrap;
}
/* "Could not read \".4\" as a dimension. Try 3.8, 3800mm or 12'6\"" is a
   sentence, not a number: it has to wrap and it has to look wrong. */
.mp-chip .mp-pv.err { color: var(--bad); white-space: normal; line-height: 1.3; }
/* The live chip: a 2px ink border (the inset shadow adds the second pixel
   without moving the figure) plus the 3px ink outline. */
.mp-chip.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); outline: 3px solid var(--ink); outline-offset: 0; }
.mp-chip.bad { border-color: var(--bad); }
.mp-chip.warn { border-color: var(--flag); }
.mp-chip .mp-caret { color: var(--ink-2); font-size: var(--t-sm); }

/* ---- inline finding chip (§3.2) — the whole point of the guard ---- */
.mp-flag {
  border-radius: var(--r-row); padding: 9px 11px; margin: -4px 0 9px;
  font-size: var(--t-sm); line-height: 1.4; background: var(--flag-wash); color: var(--flag);
}
.mp-flag.bad { background: var(--bad-wash); color: var(--bad); }
.mp-flag b { font-variant-numeric: tabular-nums; }
.mp-fix { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mp-fix button {
  border: 0; border-radius: var(--r-full); padding: 7px 13px; font-size: var(--t-xs); font-weight: 800;
  cursor: pointer; background: var(--live); color: var(--live-ink); min-height: 34px;
}
.mp-fix button.keep { background: var(--card-2); color: var(--ink); }

/* ---- add buttons ---- */
.mp-add {
  border: 1px dashed var(--edge); background: var(--card); color: var(--ink);
  border-radius: var(--r-row); padding: 11px; width: 100%; font-weight: 800; font-size: var(--t-sm);
  cursor: pointer; min-height: 46px;
}
.mp-add:active { background: var(--card-2); }
.mp-add.sm { padding: 8px; font-size: var(--t-xs); min-height: 40px; }

/* ---- disclosure for optional dimensions ---- */
.mp-more {
  border: 0; background: none; color: var(--ink); font-weight: 800; font-size: var(--t-sm);
  padding: 8px 2px; cursor: pointer; min-height: 36px;
}

/* ---- the visible breakdown (§14.2 — nothing is a black box) ---- */
.mp-bd { display: flex; flex-direction: column; }
.mp-bd-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: var(--t-sm);
}
.mp-bd-row:last-child { border-bottom: 0; }
.mp-bd-lb { font-weight: 700; color: var(--ink); }
.mp-bd-vl { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-bd-ex {
  grid-column: 1 / -1; font-size: var(--t-xs); color: var(--ink-2);
  font-variant-numeric: tabular-nums; word-break: break-word;
}
.mp-bd-row.total { background: var(--card-2); border-radius: var(--r-chip); padding: 8px; }
.mp-bd-row.total .mp-bd-vl { color: var(--ink); }
.mp-bd-row.deduct .mp-bd-vl { color: var(--bad); }
.mp-bd-row.add .mp-bd-vl { color: var(--ok); }
.mp-bd-row.material .mp-bd-lb { color: var(--flag); }
.mp-bd-row.note { border-bottom: 0; padding-bottom: 2px; }
.mp-bd-row.note .mp-bd-lb {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2);
}

/* ---- sticky footer: save, unit strip, 56 px keypad ----
   On the page, like a keyboard: a hairline above it, no shadow. Only the total
   above stays dark. The keys keep 5 columns at 56 px — 64 px keys would cost the
   dimension list most of a 360dp screen. White keys on the light page need
   their --edge outline (card-2 on the page is 1.07:1). */
.mp-foot {
  position: sticky; bottom: 0; z-index: 11; margin-top: auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--page); color: var(--ink); border-top: 1px solid var(--hair);
}
.mp-save {
  width: 100%; min-height: var(--tap); border: 0; border-radius: var(--r-btn); cursor: pointer;
  background: var(--live); color: var(--live-ink); font-weight: 800; font-size: var(--t-body);
  font-variant-numeric: tabular-nums;
}
/* Disabled is its own look, never a faded live button. */
.mp-save[disabled] { background: var(--card-2); color: var(--ink-3); cursor: default; }
.mp-save:active:not([disabled]) { opacity: .85; }
.mp-strip { display: flex; gap: 5px; margin: 8px 0; overflow-x: auto; }
.mp-strip button {
  flex: 1 0 auto; min-width: 42px; min-height: 40px; border: 1px solid var(--edge); border-radius: var(--r-chip); cursor: pointer;
  background: var(--card); color: var(--ink); font-size: var(--t-sm); font-weight: 800;
}
.mp-strip button:active { background: var(--card-2); }
.mp-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mp-keys button {
  min-height: 56px; border: 1px solid var(--edge); border-radius: var(--r-key); cursor: pointer;
  background: var(--card); color: var(--ink); font-size: var(--t-fig); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mp-keys button:active { background: var(--card-2); }
.mp-keys button.act { background: var(--live); color: var(--live-ink); border-color: var(--live); font-size: var(--t-sm); }
.mp-keys button.sub { background: var(--card-2); font-size: var(--t-sm); font-weight: 800; }
.mp-keys button[disabled] { opacity: .38; cursor: default; }
.mp-keys .mp-next { grid-column: 5; grid-row: 2 / span 2; height: auto; }
/* The keypad folds away to read a long breakdown; the number and the save
   button stay, because those are the two things you never want hidden. */
.mp-fold {
  display: block; width: 46px; height: 5px; border: 0; border-radius: 4px; cursor: pointer;
  background: var(--edge); margin: 0 auto 8px; padding: 0;
}
.mp-foot.folded .mp-strip, .mp-foot.folded .mp-keys { display: none; }

/* ---- hub + take-off list ---- */
.mp-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mp-tile {
  background: var(--card); border-radius: var(--r-row); border: 1px solid var(--hair);
  padding: 14px 12px; text-align: left; cursor: pointer; min-height: 92px;
  display: flex; flex-direction: column; gap: 4px;
}
.mp-tile .ti { font-size: 24px; }
.mp-tile .ti svg.ic { width: 28px; height: 28px; }
.mp-tile .tt { font-weight: 800; font-size: var(--t-sm); color: var(--ink); }
.mp-tile .ts { font-size: var(--t-xs); color: var(--ink-2); }
.mp-tile[disabled] { opacity: .55; cursor: default; border: 1px dashed var(--hair); }
.mp-tile.add-tile { min-height: 96px; align-items: center; justify-content: center; text-align: center; }
.mp-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mp-pick button {
  border: 0; background: var(--card-2); border-radius: var(--r-row); padding: 12px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 86px;
}
.mp-pick button:active { background: var(--hair); }
.mp-pick .pi { font-size: 22px; }
.mp-pick .pl { font-size: var(--t-xs); font-weight: 800; color: var(--ink); text-align: center; line-height: 1.25; }
.mp-pick .pu { font-size: var(--t-xs); font-weight: 700; color: var(--ink-2); }

/* ---- print: the working, not the tool (§14.4) ---- */
@media print {
  .mp-foot, .mp-back, .mp-add, .mp-more, .mp-x, .mp-fold { display: none !important; }
  #view.mp-host { padding: 0; }
  .mp-top {
    position: static; background: #fff; color: var(--ink);
    box-shadow: none; border-bottom: 2px solid var(--hair);
  }
  .mp-sub, .mp-name { color: var(--ink-2); }
  .mp-card { box-shadow: none; border: 1px solid var(--hair); break-inside: avoid; }
}

/* =========================================================================
 * P6 / P7 — BOQ, rate library, Measurement Book, survey
 *   SPEC-SURVEY §7, §8, §9, §10, §14.1 · SPEC-MASTER §5 P6/P7
 *
 * One rule runs through all of it: a figure that nobody has set must LOOK
 * unset. `.blank-rate` is the visible blank a null rate renders as, and it is
 * deliberately not styled like a number — an owner has to be able to see, at a
 * glance, that no mason's day rate has been entered, or they will sign off a
 * rate that silently left the mason out (§8.2).
 * ===================================================================== */

/* ---- wide numeric tables: they scroll sideways rather than squash ---- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tbl th {
  text-align: left; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-2); font-weight: 800; padding: 6px 8px 8px; white-space: nowrap;
  border-bottom: 1px solid var(--hair);
}
.tbl td {
  padding: 8px; border-bottom: 1px solid var(--hair); vertical-align: top;
  font-variant-numeric: tabular-nums;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl .right { text-align: right; }
.tbl .center { text-align: center; }
.tbl tr.locked td { background: var(--card-2); }
.tbl tr.corr td { color: var(--ink-2); }
.tbl tr.prov td:first-child { box-shadow: inset 3px 0 0 var(--flag); }
.tbl tr.overrun td { background: var(--bad-wash); }
.tbl .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--t-xs); font-weight: 700; }
.bad { color: var(--bad); font-weight: 700; }
.good { color: var(--ok); }
.chip.sm { font-size: var(--t-xs); padding: 2px 8px; margin: 0 4px 0 0; }

/* ---- the visible blank. NOT a number, NOT a zero, NOT a placeholder that
       could be mistaken for a figure somebody agreed to pay. ---- */
.blank-rate {
  display: inline-block; font-size: var(--t-xs); font-weight: 800; letter-spacing: .03em;
  color: var(--ink-3); background: repeating-linear-gradient(135deg, var(--card) 0 6px, var(--card-2) 6px 12px);
  border: 1px dashed var(--edge); border-radius: 6px; padding: 1px 7px;
}

/* ---- big paired figures (cut / fill, measured / billed) ---- */
.mfig { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hair); }
.mfig:last-child { border-bottom: 0; }
.mfig .mfl { color: var(--ink-2); font-size: var(--t-sm); }
.mfig .mfv { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---- the level-book check banner: a proof, so it has to read as one ---- */
.lv-banner {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: var(--r-row); padding: 12px 14px; margin: 12px 0; font-size: var(--t-sm); line-height: 1.4;
}
.lv-banner .lb-ic { font-size: 24px; font-weight: 800; line-height: 1; }
.lv-banner b { display: block; font-size: var(--t-body); margin-bottom: 2px; }
.lv-banner.good { background: var(--ok-wash); color: var(--ok); }
.lv-banner.good .lb-ic { color: var(--ok); }
.lv-banner.bad { background: var(--bad-wash); color: var(--bad); }
.lv-banner.bad .lb-ic { color: var(--bad); }
/* P2 — a notice inside a card (Pay is off): the warn card's wash and rule, no card in a card. */
.lv-banner.warn { background: var(--flag-wash); color: var(--flag); border-left: 6px solid var(--flag); }

/* ---- inline numeric cells in the level book and the earthwork grid ---- */
.lv-in {
  width: 74px; min-height: 38px; padding: 6px 8px; border: 1px solid var(--edge);
  border-radius: var(--r-chip); font-size: var(--t-sm); font-variant-numeric: tabular-nums; text-align: right;
  background: var(--card); color: var(--ink);
}
.lv-in.wide { width: 92px; text-align: left; }
.lv-in:focus { outline: 3px solid var(--ink); outline-offset: 0; }

/* ---- the cut/fill heat grid (survey.js builds the SVG; this frames it) ---- */
.heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; text-align: center; }
.heat-wrap svg { max-width: none; }
.heat-key { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: var(--t-xs); color: var(--ink-2); }
.heat-key .hk { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--hair); }
.heat-key .hk.cut { background: var(--heat-cut); }
.heat-key .hk.fill { background: var(--heat-fill); }

/* =========================================================================
 * .sw — THE ON/OFF SWITCH. One component, every setting in the app.
 *
 * The owner's words: "turn all the toggle buttons to switch". A tick box on a
 * building site reads as "I have done this"; a SETTING is not a thing you have
 * done, it is a thing that is on or off — so every setting now carries a
 * sliding switch, and a tick box is left to mean only what it always meant
 * (a checklist item ticked OFF, a filter narrowed).
 *
 * The native <input type="checkbox"> is still the control: it is what the
 * screen's own handler reads (`el.checked`), what the keyboard drives (Space,
 * natively — nothing here intercepts a key), and what carries the checkbox
 * role to a screen reader. It is only made invisible and stretched over the
 * whole row, so a tap anywhere on the row hits it. The <i> is the painted
 * track; its ::after is the knob and its ::before the word On or Off beside
 * it. The knob POSITION and the WORD carry the state, so the switch never
 * depends on colour alone.
 *
 * Markup (app.js switchRow() writes it — do not hand-roll a second one):
 *   <label class="sw"><input type="checkbox" id=…><i aria-hidden="true"
 *     data-on="On" data-off="Off"></i>
 *     <span class="sw-tx">Label<span class="sw-hint" id="…_hint">why</span></span></label>
 * ===================================================================== */
.sw {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 5px 0;                 /* ≥48 px tap target, always */
  font-size: var(--t-body); font-weight: var(--w-med); line-height: var(--lh-tight);
  color: inherit; cursor: pointer;
  /* A drag across the words must toggle, never select them — on a phone a
   * half-swipe on a label otherwise pops the text-selection handles instead. */
  -webkit-user-select: none; user-select: none;
}
/* The real control, stretched over the row. opacity:0 (not display:none, not
 * visibility:hidden) — it must stay focusable and hit-testable. */
.sw > input {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; opacity: 0; z-index: 2; cursor: inherit;
}
.sw > .sw-tx { order: 1; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
:lang(ta) .sw:not(.sw-tight) { flex-wrap: wrap; }
:lang(ta) .sw:not(.sw-tight) > .sw-tx { flex: 1 1 min-content; min-width: min-content; max-width: 100%; overflow-wrap: normal; }
#fpBox .sw { column-gap: var(--s-5); }
.sw .sw-hint {
  display: block; margin-top: 2px;
  font-size: var(--t-sm); font-weight: var(--w-reg); line-height: 1.45; color: var(--ink-2);
}
/* the track: 60x34, the knob travels 26px */
.sw > i {
  order: 0; flex: 0 0 auto; position: relative; display: block;
  width: 60px; height: 34px; border-radius: var(--r-full); font-style: normal;
  background: var(--card); border: 2px solid var(--edge);
  transition: background var(--d-state) var(--ease-out), border-color var(--d-state);
}
/* the knob — its POSITION is the state; the colour only agrees with it.
 * Off it is --edge on the card track; on it is --live-ink on the --live
 * track, which on a dark surface is black on the yellow accent. */
.sw > i::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--edge);
  transition: transform var(--d-state) var(--ease-out), background var(--d-state);
}
.sw > input:checked + i { background: var(--live); border-color: var(--live); }
.sw > input:checked + i::after { transform: translateX(26px); }
.sw > input:focus-visible + i { box-shadow: 0 0 0 2px var(--page), 0 0 0 5px var(--ink); }
/* The state as a WORD beside the track, in the person's language (switchRow
 * passes both words through tr). Screen only: on paper the print block below
 * writes the state inside the box instead. The track keeps room for it. The
 * checked knob's fill is screen-only too: on paper --live-ink is ink, and a
 * filled box would hide the printed ON. */
@media screen {
  .sw > input:checked + i::after { background: var(--live-ink); }
  /* Size this column using both words in the reader's font. The label
     stays in place when the track switches between On and Off. */
  .sw-word-space { display: grid; flex: none; visibility: hidden; font-weight: var(--w-semi); }
  .sw-word-space::before, .sw-word-space::after { grid-area: 1 / 1; }
  .sw-word-space::before { content: attr(data-on); }
  .sw-word-space::after { content: attr(data-off); }
  .sw > i::before {
    content: attr(data-off); position: absolute; left: calc(100% + 8px); top: 50%;
    transform: translateY(-50%); font-weight: var(--w-semi); line-height: var(--lh-tight);
    color: var(--ink-2);
  }
  .sw > input:checked + i::before { content: attr(data-on); color: var(--ink); }
}
/* Sitting beside a field rather than owning a row of its own (the morning
 * digest's "On", next to the time it goes out): hug the words, sit on the
 * field's baseline. */
.sw.sw-tight { flex: 0 0 auto; gap: 8px; padding-bottom: 10px; }
/* Its label is the word "On" itself, which the state word now says: the
 * label stays for a screen reader only, so the row never reads "Off On". */
.sw.sw-tight > .sw-tx {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0;
}
/* Off, and not yours to change: dimmed, and the cursor says so. */
.sw.sw-off { cursor: not-allowed; opacity: .45; }
.sw.sw-off > input { cursor: not-allowed; }
/* A person who asked the phone to stop animating gets no slide, only a jump —
 * and every motion token drops to 1ms with it. */
@media (prefers-reduced-motion: reduce) {
  :root { --d-press: 1ms; --d-state: 1ms; --d-sheet: 1ms; }
  .sw > i, .sw > i::after { transition: none; }
}

/* ---- .seg — a SEGMENTED control: every state visible, the live one pressed.
 * Attendance is Present / Half day / Absent, which is three states, so it is
 * not a switch and never can be. It used to be ONE chip that cycled on tap,
 * which hid the half day behind a guess; now all three are on the row and the
 * pressed one is marked with aria-pressed, for the eye and for the reader. */
/* No overflow:hidden and no nowrap: Tamil "Half day" in a third of a row
 * wraps to two lines instead of losing its vowel signs. */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-chip); background: var(--card-2); }
.seg > button {
  appearance: none; -webkit-appearance: none; border: 0; background: none;
  flex: 1; border-radius: calc(var(--r-chip) - 4px);
  font: inherit; font-size: var(--t-sm); font-weight: var(--w-semi); line-height: var(--lh-tight); color: var(--ink);
  min-height: var(--tap); padding: 6px 10px; cursor: pointer; white-space: normal; overflow-wrap: anywhere;
}
.seg > button[aria-pressed="true"] { background: var(--live); color: var(--live-ink); }
:lang(ta) #matModeSeg { flex-wrap: wrap; max-width: 100%; }
:lang(ta) #matModeSeg > button { flex-basis: max-content; overflow-wrap: normal; }
.seg > button:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.seg > button[aria-pressed="true"]:focus-visible { outline-color: var(--live-ink); }
/* Keep each worker's status choices in view. A filtered .li must give up
 * its flex display so that a search hides the entire nonmatching row. */
#attList [hidden] { display: none; }
.att-row { flex-wrap: wrap; }
.att-row .seg, .att-head .seg { flex: 1 0 100%; margin-top: 8px; }
.att-row .seg > button, .att-head .seg > button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; overflow-wrap: normal; }
/* v1-R8 — Present / Half day / Absent each lead with their icon, at 20px. */
.att-row .seg svg.ic, .att-head .seg svg.ic { width: 20px; height: 20px; }
/* UX-IMP review — a state's word breaks only at a space ("anywhere" cut Tamil
 * வந்தவர் into வந்தவ / ர் at 360px). In Tamil the icon stands above the word, so
 * the word has the button's width; a word wider still widens its own button. */
:lang(ta) .att-row .seg > button, :lang(ta) .att-head .seg > button { flex-direction: column; gap: 2px; padding: 6px 4px; }
/* v1-T8 — a counted team's block on the Mark sheet: per group full · half · OT, two to a line on a phone. */
.att-team { padding: 12px 0; border-bottom: 1px solid var(--hair); }
.att-grp { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-top: 8px; }
.att-grp > .att-gname { flex: 0 0 100%; }
.att-grp > .att-cnt { flex: 1 1 140px; min-width: 0; margin-bottom: 0; }
/* ATT-DEL-A — a saved mark he chose to remove: struck, its controls off until Save (or Keep this mark). */
.att-row > [data-rm], .att-row > [data-rmask] { flex: 1 0 100%; margin-top: 8px; }
.att-gone { opacity: .55; }
.att-gone .strong { text-decoration: line-through; }
/* v1-T7 — a field's .seg spans the field; a STEPPER is [−] count [+], a 48px target each side. */
.field .seg { display: flex; }
/* v1-44 — "Who is this bill for?": two answers of the same weight, stacked, each
 * with its plain line under the name; nothing is pressed until he picks. */
.seg.seg-col { flex-direction: column; }
.seg.seg-col > button { text-align: left; padding: 10px 12px; }
.seg > button > .seg-sub { display: block; margin-top: 2px; font-size: var(--t-xs); font-weight: var(--w-reg); opacity: .85; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper > input { flex: 1 1 auto; min-width: 0; text-align: center; }
.stepper > .btn { flex: 0 0 auto; min-width: var(--tap); padding: 0; font-size: var(--t-lg); }

/* ---- print: the abstract, the MB page and the level book, on A4 (§14.4) ---- */
@media print {
  .tabs, .rep-back, .btn-row, .btn, #bottomnav, #fab, #appbar { display: none !important; }
  .tbl-wrap, .heat-wrap { overflow: visible; }
  .tbl { font-size: 10.5px; }
  .card { box-shadow: none; border: 1px solid var(--hair); break-inside: avoid; }
  .lv-banner { border: 1px solid var(--hair); }
  .blank-rate { background: none; }
  /* A switch on paper. Browsers print no backgrounds by default, so the track
   * and the knob would come out as an empty pill — which reads as "nothing
   * was set". The state prints as a WORD in a box instead. */
  .sw > i {
    width: auto; height: auto; min-width: 40px;
    background: none !important; border: 1px solid #000; border-radius: 4px;
  }
  .sw > i::after {
    content: 'OFF'; position: static; display: block;
    width: auto; height: auto; transform: none;
    background: none; box-shadow: none; border-radius: 0;
    padding: 2px 5px; text-align: center;
    font-size: 10px; font-weight: 800; letter-spacing: .04em;
  }
  .sw > input:checked + i::after { content: 'ON'; transform: none; }
}

/* =========================================================================
 * P9 — the claim → verify chip, the history timeline and My Requests
 *      (SPEC-MASTER C11 · C19 · C20 · SPEC-RBAC §4)
 *
 * Designed for the person the owner described: a builder holding a phone in
 * bad light. Three things carry the whole feature and each is given real
 * contrast rather than a subtle tint:
 *   · the STATUS of a to-do — waiting on me, or not;
 *   · the BEFORE value, struck through, next to the AFTER value;
 *   · a REDACTED value, which must read as "hidden", never as an empty change.
 * ===================================================================== */

/* ---- the claim → verify chip ---- */
.todo-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--t-xs); font-weight: 800; letter-spacing: .01em;
  padding: 3px 9px; border-radius: var(--r-full); margin: 0 6px 6px 0;
  background: var(--card-2); color: var(--ink-2); border: 1px solid transparent;
}
.todo-chip.waiting { background: var(--flag-wash); color: var(--flag); border-color: var(--flag); }
.todo-chip.ok      { background: var(--ok-wash); color: var(--ok); border-color: var(--ok); }
.todo-chip.back    { background: var(--bad-wash); color: var(--bad); border-color: var(--bad); }
.todo-chip.open    { background: var(--card-2); color: var(--ink-2); }

/* The lifecycle card takes the same colour as its chip on the left edge, so a
 * to-do waiting on the reader is visible before a single word is read. */
.todo-life { border-left: 3px solid var(--hair); }
.todo-life.waiting { border-left: 6px solid var(--flag); }
.todo-life.ok      { border-left-color: var(--ok); }
.todo-life.back    { border-left-color: var(--bad); }

/* ---- one entry of the timeline: a ring on a 2px hairline spine that runs
        down the icon column, entry to entry. A day line breaks the spine. ---- */
.hist-list { display: block; }
.hist-slot.hide { display: none; }
.hist-entry { position: relative; padding: 11px 0; }
.hist-entry::before {
  content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px; background: var(--hair);
}
.he-head { display: flex; gap: 10px; align-items: flex-start; }
.he-ic {
  position: relative; width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: var(--t-xs); background: var(--card); border: 2px solid var(--edge);
}
.he-what { font-size: var(--t-body); font-weight: var(--w-semi); color: var(--ink); line-height: 1.35; }
.he-label { font-size: var(--t-sm); color: var(--ink); }
.he-who { font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; }
.he-go { color: var(--ink-2); font-size: var(--t-lg); flex: 0 0 auto; align-self: center; }
.he-move {
  font-size: var(--t-sm); font-weight: 700; color: var(--ink-2);
  margin: 6px 0 0 36px;
}
/* A reason and a remark are USER-AUTHORED FREE TEXT. They are esc()'d at every
 * call site; `word-break` here is what stops one long unbroken string from
 * pushing the card off a 360 px screen. */
.he-reason {
  margin: 6px 0 0 36px; padding: 7px 10px; border-radius: var(--r-chip);
  background: var(--flag-wash); border: 1px solid var(--hair);
  font-size: var(--t-sm); line-height: 1.4; color: var(--flag);
  overflow-wrap: anywhere; word-break: break-word;
}
/* P4 — the 36px indent lines a reason up under the History timeline; on a card it has none.
 * Its chat icon is spaced from the words, as a bold title's is. */
.card .he-reason { margin-left: 0; }
.he-reason > svg.ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.he-quiet { margin: 6px 0 0 36px; font-size: var(--t-sm); color: var(--ink-2); font-style: italic; }

/* An honesty note: scope, redaction or retention. Never decorative. */
.hist-note {
  padding: 8px 11px; margin-bottom: 8px; border-radius: var(--r-chip);
  background: var(--card-2); border: 1px solid var(--hair);
  font-size: var(--t-sm); line-height: 1.4; color: var(--ink);
}

/* ---- BEFORE and AFTER, side by side ---- */
.hist-fields { margin: 8px 0 0 36px; display: block; }
.hist-field {
  padding: 6px 0; border-top: 1px dashed var(--hair);
}
.hist-field:first-child { border-top: 0; }
.hf-name {
  font-size: var(--t-xs); font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-2);
}
.hf-vals {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  margin-top: 3px; font-size: var(--t-sm); line-height: 1.35;
}
/* THE OLD VALUE, VISIBLY STRUCK THROUGH — this is the owner's question rendered
 * literally ("what was there before"). The line is drawn in the red ink rather
 * than the text colour so it survives a dim screen and a cheap panel. */
.hf-was {
  text-decoration: line-through;
  text-decoration-color: var(--bad);
  text-decoration-thickness: 2px;
  color: var(--ink-2);
  overflow-wrap: anywhere; word-break: break-word;
}
/* Nothing to cross out: the field was blank before, so the dash keeps its
 * meaning ("there was no value") without a line implying one was removed. */
.hf-was.hf-blank { text-decoration: none; color: var(--ink-2); }
.hf-arrow { color: var(--ink-2); font-weight: 700; flex: 0 0 auto; }
.hf-now {
  font-weight: 800; color: var(--ink);
  overflow-wrap: anywhere; word-break: break-word;
}
/* SPEC-RBAC §4 — a withheld figure is a DASH with a reason, never a 0 and never
 * an empty pair (an empty pair reads as a real change from nothing to nothing). */
.hist-field.redacted .hf-name { color: var(--flag); }
.hf-hidden { color: var(--flag); font-weight: 700; font-size: var(--t-sm); }

@media print {
  .hist-slot.more { display: block !important; }
  .hf-was { text-decoration-color: #666; }
}

/* =========================================================================
 * P10 — ACCOUNTS: wages, party ledger, cashbook, site profit
 *   SPEC-ACCOUNTS · SPEC-MASTER C7/C16/C19 · SPEC-RBAC §4
 *
 * The visual rule on these screens is the one rule money has: A FIGURE AND A
 * BLANK MUST NOT LOOK ALIKE. `—` means "not known" or "not yours to see"; a
 * number means "this is what it is". Everything below exists to keep those two
 * apart at arm's length on a phone in daylight — which is where an owner
 * actually reads them, standing on a site, deciding whether to hand over cash.
 *
 * Money is tabular-nums throughout so a column of rupees lines up on the
 * decimal and a wrong digit is visible as a wrong SHAPE, not just a wrong value.
 * ===================================================================== */

/* ---- one party / worker account card ---- */
.ac-party .led-num { text-align: right; }
.ac-party .led-num .strong { font-size: var(--t-body); font-variant-numeric: tabular-nums; }
.ac-figs { font-size: var(--t-xs); gap: 10px; flex-wrap: wrap; }
.ac-figs b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- THE BASIS BOX. Every screen that shows a derived total shows, directly
       underneath and never behind a chevron, what went into it and what did
       not. It is deliberately quiet rather than hidden: an owner should be able
       to ignore it at a glance and read it when the number surprises them.
       A profit figure whose omissions are invisible is worse than none. ---- */
.ac-basis {
  background: var(--card-2); box-shadow: none; border: 1px solid var(--hair);
  font-size: var(--t-sm); line-height: 1.45;
}
.ac-basis .strong { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }

/* ---- site profit ---- */
.ac-profit { overflow-wrap: anywhere; }
.ac-profit > .row { flex-wrap: wrap; }
.ac-profit > .row > .grow { flex-basis: auto; }
.ac-profit > .row > .led-num { max-width: 100%; margin-inline-start: auto; }
.ac-profit .led-num .strong { font-size: var(--t-lg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-profit .kv { font-size: var(--t-sm); }
.hero h2[data-pf-heading] { max-width: 100%; }
[data-pf-total], [data-pf-machines-total] { display: inline-block; white-space: nowrap; }
@media (max-width: 480px) {
  .hero h2 .long-figure { font-size: var(--t-fig); }
}

/* ---- the pay-wages sheet ------------------------------------------------
 * BEFORE and AFTER are two separate blocks, on purpose. The person paying is
 * answering two questions in order — "what do I owe him" then "what will I owe
 * him" — and collapsing them into one row is how somebody pays the outstanding
 * amount twice. */
.pw-before { background: var(--card-2); box-shadow: none; border: 1px solid var(--hair); }
.pw-before .kv { padding: 7px 0; font-size: var(--t-sm); }
.pw-before .v { font-variant-numeric: tabular-nums; }

.pw-after {
  border-radius: var(--r-row); padding: 11px 13px; margin: 4px 0 12px;
  font-size: var(--t-sm); line-height: 1.45;
}
.pw-after .kv { padding: 6px 0; border-bottom: 0; }
.pw-after .v { font-variant-numeric: tabular-nums; }
/* Green is NOT "good", it is "this will go through" — the form is telling the
   user the engine accepted it, nothing more. */
.pw-after.good { background: var(--ok-wash); border: 1px solid var(--ok); }
/* Red is a refusal with a reason, and the reason is the engine's own sentence.
   It is never a bare "invalid": a man is standing there waiting to be paid. */
.pw-after.bad { background: var(--bad-wash); border: 1px solid var(--bad); color: var(--bad); }
.pw-after.muted { background: var(--card-2); border: 1px dashed var(--edge); color: var(--ink-3); }

/* v1-R8 — a sheet's action strip stays pinned while its body scrolls under it
 * (.sheet is the scroller). The negative bottom and margins take it to the
 * sheet's own edge, over the sheet's bottom padding. */
.sheet .dock {
  position: sticky; z-index: 3; bottom: calc(-20px - env(safe-area-inset-bottom));
  margin: 12px -16px calc(-20px - env(safe-area-inset-bottom));
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--hair);
}
/* Focus and scroll-into-view stop above the pinned strip (12 + 56 + 20 + its
 * border, and some air), so a field he moves to is never typed into under it. */
.sheet:has(.dock) { scroll-padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
@media (max-height: 600px) {
  .sheet:has(#expPayment) { max-height: 100%; }
}
/* The second press: Record asks in the strip (shown by the sheet), and only the yes saves.
 * The answers stack full width, "Keep it" at the bottom where Record was: the strip
 * grows upwards, so a double tap on Record lands on Keep it, never on the yes
 * (controls.html §9 — the yes sits on top, where a thumb lands last). */
.dock .cf { display: none; }
.cf-ask { font-size: var(--t-lg); font-weight: var(--w-semi); line-height: var(--lh-tight); margin-bottom: 12px; }
.cf .btn-row { flex-direction: column; }

/* v1-R8 — a wage row's Pay carries the voucher icon; Ledger and Pay sit right. */
.wrow .btn-row { justify-content: flex-end; }
.wrow .wpay svg.ic { width: 20px; height: 20px; }

/* The dash, wherever an amount is unknown. Same weight as the muted text and
   deliberately NOT the weight of a figure, so an eye scanning a column of
   rupees does not read it as one. */
.v.dash, .kpi-val.dash { color: var(--ink-3); font-weight: var(--w-med); }

@media print {
  .ac-basis { background: none; border: 1px solid var(--hair); }
  .pw-before, .pw-after { background: none; border: 1px solid var(--hair); }
}

/* ---- v1-17 — History & cleanup ------------------------------------------ */
.dayh { margin: 14px 2px 4px; font-size: var(--t-sm); font-weight: 700; color: var(--ink-2); }
.he-tags { margin: 6px 0 0 36px; }
.cu-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: var(--t-sm); }
.cu-nm { flex: 1 1 auto; min-width: 0; }
.cu-nm small { display: block; color: var(--ink-2); font-size: var(--t-xs); }
.cu-bar { flex: 0 0 72px; }
.cu-sz { flex: 0 0 auto; min-width: 52px; text-align: right; color: var(--ink-2); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }

/* ---- v1-46 — Calendar (docs/design/cap/v1/site-day.html frames 1-3) ------
   A mark is a shape plus a word in the legend, never colour alone. */
.calw { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-row); padding: 10px 8px 8px; }
.monthbar { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; }
.monthbar b { flex: 1; text-align: center; font-size: var(--t-lg); }
.cal-step { width: var(--tap); height: var(--tap); border-radius: var(--r-full); border: 1px solid var(--edge); background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal .wd { font-size: var(--t-xs); font-weight: var(--w-semi); color: var(--ink-2); text-align: center; padding: 2px 0 4px; }
.cal button { min-height: 52px; border: 0; background: transparent; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font: var(--w-semi) var(--t-body)/1.1 var(--font); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.cal button.o { color: var(--ink-3); font-weight: var(--w-reg); }
.cal button[aria-pressed="true"] { background: var(--live); color: var(--live-ink); }
.cal button.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal .mk { display: flex; gap: 3px; align-items: center; min-height: 14px; }
.cal .rec { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cal .bell svg.ic { width: 12px; height: 12px; }
.cal .pay { font-size: var(--t-xs); font-weight: var(--w-semi); line-height: 1; }
.calw .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--t-xs); color: var(--ink-2); margin: 8px 4px 2px; }
.calw .legend span { display: inline-flex; align-items: center; gap: 5px; }
.calw .legend svg.ic { width: 12px; height: 12px; }
.calw .legend .rec { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); display: inline-block; }
/* The printed register keeps its date cells together and leaves space to sign. */
.firm-paper table.monthly-register {width:100%; table-layout:fixed; font-size:var(--t-xs);}
.firm-paper.card .monthly-scroll {overflow-x:auto;}
.firm-paper.card .monthly-register {min-width:255mm;}
.firm-paper .monthly-register th, .firm-paper .monthly-register td {overflow-wrap:anywhere; vertical-align:top;}
.firm-paper .monthly-register th:nth-child(4) {width:24%;}
.firm-paper .monthly-register th:last-child {width:8%;}
.firm-paper .monthly-wages th:first-child {width:13%;}
.firm-paper .monthly-wages th:nth-child(2) {width:11%;}
.firm-paper .monthly-wages th:nth-child(5) {width:4%;}
.firm-paper .monthly-signature {display:block; margin-top:10mm; border-bottom:1px solid var(--edge);}
.firm-paper .monthly-grid {display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px; text-align:center;}
.firm-paper .monthly-grid span {border:1px solid var(--hair); line-height:1.2;}
.firm-paper .monthly-grid small {display:block; font-weight:var(--w-reg);}
