/* VitalReg office: NPC branding. Two custom daisyUI themes, npc-light and npc-dark, built from the NPC seal colours:
   green #0E9738, amber #E1AF19, white, black #111111, red #C62828 only for errors and destructive actions.
   Every colour in the office comes from these tokens, so light and dark resolve from one place. Only green, amber, red and neutrals.
   Pair contrast was measured in headless Chromium on every office page (docs/design/branding.md has the numbers). */
[data-theme="npc-light"] {
  color-scheme: light;
  --color-base-100: #ffffff; --color-base-200: #f1f5f2; --color-base-300: #dbe3dd; --color-base-content: #111111;
  --color-primary: #0a6e2a; --color-primary-content: #ffffff;
  --color-secondary: #e1af19; --color-secondary-content: #1a1a1a;
  --color-accent: #0e9738; --color-accent-content: #111111;
  --color-neutral: #111111; --color-neutral-content: #ffffff;
  --color-info: #1a1a1a; --color-info-content: #ffffff;
  --color-success: #0e9738; --color-success-content: #111111;
  --color-warning: #e1af19; --color-warning-content: #1a1a1a;
  --color-error: #c62828; --color-error-content: #ffffff;
  --office-page: #f5f7f4; --office-border: #5f6f65; --office-seal-back: transparent; --office-muted: #4b5a51;
  --ledger: #0b3a20; --ledger-hi: #145330; --ledger-ink: #eef6f0; --ledger-muted: #b4cdbd; --ledger-label: #e9c766;
  --ledger-line: rgba(255, 255, 255, .10); --stamp-paper: #fffdf6;
  --depth: 0; --noise: 0;
}
[data-theme="npc-dark"] {
  color-scheme: dark;
  --color-base-100: #132119; --color-base-200: #0f1a14; --color-base-300: #243a2d; --color-base-content: #f2f5f3;
  --color-primary: #3dbe6a; --color-primary-content: #0f1a13;
  --color-secondary: #e1af19; --color-secondary-content: #1a1a1a;
  --color-accent: #0e9738; --color-accent-content: #0a0f0c;
  --color-neutral: #2a4034; --color-neutral-content: #f2f5f3;
  --color-info: #d6e0d9; --color-info-content: #0f1a13;
  --color-success: #3dbe6a; --color-success-content: #0f1a13;
  --color-warning: #e1af19; --color-warning-content: #1a1a1a;
  --color-error: #ef5350; --color-error-content: #1a1a1a;
  --office-page: #0b140f; --office-border: #8aa194; --office-seal-back: #ffffff; --office-muted: #b0c0b5;
  --ledger: #0a2516; --ledger-hi: #143823; --ledger-ink: #eef6f0; --ledger-muted: #a9c3b2; --ledger-label: #e9c766;
  --ledger-line: rgba(255, 255, 255, .09); --stamp-paper: transparent;
  --depth: 0; --noise: 0;
}
body { background: var(--office-page); }
/* Type: Public Sans (made for government services) for everything; IBM Plex Mono for register numbers. */
html, body, .btn, .input, .select, .textarea { font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { font-size: 15px; line-height: 1.5; font-feature-settings: "tnum" 0; -webkit-font-smoothing: antialiased; }

.skip-link { position: absolute; left: -999px; top: 0; padding: .5rem 1rem; background: var(--color-base-100); color: var(--color-base-content); z-index: 100; }
.skip-link:focus { left: 0; }

/* Header: a brand-green band over a white (light) or green-black (dark) bar, the seal on the left. */
.brand-band { height: 6px; background: #0e9738; }
.brand-bar { background: var(--color-base-100); border-bottom: 1px solid var(--color-base-300); }
.brand-seal { width: 40px; height: 40px; border-radius: 9999px; background: var(--office-seal-back); flex: none; }
.brand-name { display: block; font-size: 1.125rem; line-height: 1.2; font-weight: 700; }
.brand-owner { display: block; font-size: .75rem; line-height: 1.2; color: var(--color-base-content); opacity: .85; }
.signin-brand { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
.signin-brand .brand-seal { width: 88px; height: 88px; }

/* Text in a theme colour (text-primary, link-primary, text-error and the rest). daisyUI's colours are fill colours;
   amber and the lighter greens fail as text on white, so each text token is its own value, chosen for 4.5:1 on
   base-100, base-200, base-300 and a hovered table row (measured numbers: docs/design/branding.md). */
[data-theme="npc-light"] {
  --office-text-primary: #0a6e2a; --office-text-secondary: #6b4e00; --office-text-accent: #0a6e2a;
  --office-text-info: #1a1a1a; --office-text-success: #0a6e2a; --office-text-warning: #6b4e00; --office-text-error: #b3261e;
}
[data-theme="npc-dark"] {
  --office-text-primary: #3dbe6a; --office-text-secondary: #e1af19; --office-text-accent: #3dbe6a;
  --office-text-info: #d6e0d9; --office-text-success: #3dbe6a; --office-text-warning: #e1af19; --office-text-error: #f28b88;
}
.text-primary, .link-primary, .link-primary:hover { color: var(--office-text-primary); }
.text-secondary, .link-secondary, .link-secondary:hover { color: var(--office-text-secondary); }
.text-accent, .link-accent, .link-accent:hover { color: var(--office-text-accent); }
.text-info, .link-info, .link-info:hover { color: var(--office-text-info); }
.text-success, .link-success, .link-success:hover { color: var(--office-text-success); }
.text-warning, .link-warning, .link-warning:hover { color: var(--office-text-warning); }
.text-error, .link-error, .link-error:hover { color: var(--office-text-error); }

/* The focus ring is a UI border (3:1 needed); primary clears it on every surface in both themes. */
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Buttons and focus rings inside a coloured alert (the toast): they take the alert's own content colour, which is the
   colour its fill was checked against. A ghost button would otherwise keep the page text colour on red. */
.alert .btn-ghost { color: inherit; }
.alert-error :focus-visible { outline-color: var(--color-error-content); }
.alert-success :focus-visible { outline-color: var(--color-success-content); }
.alert-warning :focus-visible { outline-color: var(--color-warning-content); }
.alert-info :focus-visible { outline-color: var(--color-info-content); }

/* Placeholders and helper text must stay readable in both themes. */
::placeholder { color: color-mix(in oklab, var(--color-base-content) 70%, transparent); opacity: 1; }
:disabled, .btn[disabled] { cursor: not-allowed; }
/* daisyUI keeps .label on one line; a long checkbox label (the false-declaration one) then pushes the page wider
   than a phone. Let it wrap. daisyUI also dims .label text to 60%, which is 4.1:1 on light base-100 (AA needs
   4.5); radio and checkbox labels are the text the officer reads, so they take the full text colour. */
.label { white-space: normal; color: var(--color-base-content); }

/* daisyUI dims table headers to 60% text, which drops below AA on the header background. */
.table thead, .table tfoot { color: var(--color-base-content); }

/* Long lists scroll inside their own box so the header row stays in view. */
.table-scroll { max-height: 70vh; overflow: auto; border: 1px solid var(--color-base-300); border-radius: var(--radius-box, .5rem); background: var(--color-base-100); }
.table-sticky thead th { position: sticky; top: 0; z-index: 1; background: var(--color-base-300); color: var(--color-base-content); }
.table-zebra tbody tr:nth-child(even) { background: var(--color-base-200); }
.table tbody tr:hover { background: color-mix(in oklab, var(--color-primary) 12%, var(--color-base-100)); }

/* A QR code only scans dark-on-light, so its frame stays light in both themes on purpose. */
.qr-frame { background: #fff; padding: 12px; border-radius: .5rem; display: inline-block; }
.qr-frame img { display: block; width: 14rem; height: 14rem; }

/* Form controls: daisyUI draws their edge at 20% of the text colour (about 1.4:1). A control edge is a UI border and
   needs 3:1, so it takes the theme's --office-border. */
.input, .select, .textarea, .file-input { --input-color: var(--office-border); border-color: var(--office-border); }
.checkbox, .radio, .toggle { --input-color: var(--office-border); border-color: var(--office-border); }

.mono, code, kbd { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }

dialog.modal::backdrop { background: color-mix(in oklab, var(--color-base-content) 50%, transparent); }
/* Alpine shows these once it starts; hidden until then so a closed section never flashes open. */
[x-cloak] { display: none !important; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .15s; }

/* Sign-in: full page. A brand-green panel with a certificate-style security pattern (left) and a plain form (right).
   The panel is NPC green in both themes; the form side follows the theme tokens. Light is the default. */
[x-cloak] { display: none !important; }
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 44%) 1fr; }
.signin-panel { position: relative; overflow: hidden; background: #0a6e2a; color: #ffffff; display: flex; flex-direction: column;
  justify-content: center; padding: 48px 56px; }
.signin-guilloche { position: absolute; inset: 0; width: 100%; height: 100%; color: #ffffff; opacity: .09; pointer-events: none; }
.signin-panel-inner { position: relative; max-width: 420px; }
.signin-eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #f6d878; margin: 0 0 18px; }
.signin-seal { width: 132px; height: 132px; border-radius: 9999px; background: #ffffff; padding: 4px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.signin-owner { font-size: 1.85rem; line-height: 1.15; font-weight: 800; margin: 22px 0 4px; letter-spacing: -.01em; }
.signin-product { font-size: 1.1rem; font-weight: 600; color: #e9f6ee; margin: 0; }
.signin-rule { width: 64px; height: 4px; background: #e1af19; margin: 20px 0; border-radius: 2px; }
.signin-tagline { font-size: 1.05rem; line-height: 1.5; color: #ffffff; margin: 0 0 14px; }
.signin-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.signin-points li { position: relative; padding-left: 22px; color: #e9f6ee; font-size: .95rem; }
.signin-points li::before { content: ""; position: absolute; left: 0; top: .55em; width: 10px; height: 10px; border-radius: 2px; background: #e1af19; }
.signin-panel-foot { position: relative; margin-top: 40px; font-size: .75rem; color: #d3ecdb; }

.signin-main { display: flex; flex-direction: column; background: var(--color-base-100); min-height: 100vh; }
.signin-top { display: flex; justify-content: flex-end; align-items: center; padding: 16px 28px; }
.signin-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.signin-form { width: 100%; max-width: 420px; display: grid; gap: 18px; }
.signin-title { font-size: 2rem; font-weight: 800; letter-spacing: -.015em; margin: 0; color: var(--color-base-content); }
.signin-sub { margin: -8px 0 4px; color: var(--color-base-content); opacity: .85; line-height: 1.5; }
.signin-field { display: grid; gap: 6px; }
.signin-field label { font-weight: 600; font-size: .95rem; color: var(--color-base-content); }
.signin-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.signin-show { background: none; border: 0; padding: 2px 4px; font-weight: 600; font-size: .9rem; color: var(--color-primary); cursor: pointer; }
.signin-show:hover { text-decoration: underline; }
/* The edge takes --office-border (3:1 on the page) and the focus ring is solid primary (3:1), in both themes. */
.signin-input { width: 100%; height: 3rem; font-size: 1rem; border: 1.5px solid var(--office-border); }
.signin-input:focus, .signin-input:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 1px; border-color: var(--color-primary); }
.signin-submit { height: 3rem; font-size: 1.02rem; margin-top: 4px; }
.signin-help { font-size: .9rem; line-height: 1.55; color: var(--color-base-content); opacity: .85; margin: 0; }
.signin-notice { font-size: .82rem; line-height: 1.5; color: var(--color-base-content); background: var(--color-base-200);
  border-left: 4px solid #e1af19; padding: 10px 14px; border-radius: 6px; }
/* Tinted panel with a solid red edge: the text stays base-content, so it holds AA in both themes. */
.signin-alert { margin: 0; background: color-mix(in oklab, var(--color-error) 14%, var(--color-base-100)); color: var(--color-base-content);
  border: 1px solid color-mix(in oklab, var(--color-error) 45%, transparent); border-left: 4px solid var(--color-error); }
.signin-foot { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; padding: 16px 28px; font-size: .8rem;
  color: var(--color-base-content); opacity: .8; border-top: 1px solid var(--color-base-300); }

@media (max-width: 860px) {
  .signin { grid-template-columns: 1fr; }
  .signin-panel { padding: 28px 24px; }
  .signin-points, .signin-panel-foot { display: none; }
  .signin-seal { width: 84px; height: 84px; }
  .signin-owner { font-size: 1.4rem; margin-top: 14px; }
  .signin-tagline { margin: 0; }
  .signin-main { min-height: auto; }
}
/* A status word on a dashboard tile: bordered in its own text colour (text-success, text-warning, text-error), which is
   the colour checked for 4.5:1 on the card. Never colour alone: the word says it. */
.pill { display: inline-block; align-self: flex-start; border: 1px solid currentColor; border-radius: 9999px; padding: 0 .6rem; font-size: .875rem; font-weight: 600; }

/* Role menu groups (someone holding two roles sees both menus, grouped). The label is plain base-content text so
   it keeps AA in both themes; a rule separates the groups. */
.menu-group-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-base-content); padding: 0 .25rem 0 .6rem; border-left: 2px solid var(--color-base-300); }
.menu-group-label:first-child { border-left: 0; padding-left: 0; }
.menu-utilities { padding-left: .5rem; border-left: 2px solid var(--color-base-300); }

/* A red button hovered in dark mode: daisyUI darkens a hovered button by 7%, which takes dark text on the light
   dark-theme red under 4.5:1 (4.19:1 measured). Lighten it instead, which raises the contrast (End session, Roll
   back this batch and every other btn-error, filled or outline). */
@media (hover: hover) {
  [data-theme="npc-dark"] .btn-error:hover { --btn-bg: color-mix(in oklab, var(--color-error), #fff 8%); }
}
