/* LAYOUT & COMPONENTS: structure only. Colors/fonts/radii come from theme.css. */
/* moving between pages fades instead of flashing white */
@view-transition { navigation:auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration:.18s; }
* { box-sizing:border-box; }
body { margin:0; font:var(--t-body-weight) var(--t-body-size)/1.45 var(--font); background:var(--bg-page); color:var(--t-body-color);
       display:flex; min-height:100vh; }
a { color:var(--t-link-color); }
/* Icons (static/shared/icons.svg) */
.ic { width:18px; height:18px; flex:0 0 auto; fill:none; stroke:currentColor; stroke-width:2;
      stroke-linecap:round; stroke-linejoin:round; vertical-align:-3px; }
button .ic, .tab .ic { margin-right:7px; }
/* Side menu */
nav { flex:0 0 230px; width:230px; padding:18px 12px; border-right:1px solid var(--line); background:var(--bg-menu);
      display:flex; flex-direction:column; gap:2px; position:sticky; top:0; height:100vh; overflow-y:auto; }
nav a { display:flex; align-items:center; gap:11px; padding:9px 12px; border-radius:var(--radius);
        color:var(--t-menu-color); font-size:var(--t-menu-size); font-weight:var(--t-menu-weight); text-decoration:none; }
nav a:hover { background:var(--bg-hover); }
nav a.active { background:var(--bg-active); color:var(--t-menu-active-color); font-weight:var(--t-menu-active-weight); }
nav a.active .ic { color:var(--on-accent); }
main { flex:1; min-width:0; padding:28px 32px; max-width:620px; margin:0 auto; }
h2 { margin:0 0 18px; font-size:var(--t-title-size); font-weight:var(--t-title-weight); color:var(--t-title-color); }
.hint { color:var(--t-hint-color); font-size:var(--t-hint-size); margin:0 0 14px; }
/* Tabs */
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--line); margin:-4px 0 20px; }
.tab { display:flex; align-items:center; padding:10px 16px; color:var(--t-tab-color); text-decoration:none;
       border-bottom:2px solid transparent; margin-bottom:-1px; font-size:var(--t-tab-size); font-weight:var(--t-tab-weight); }
.tab:hover { color:var(--ink); }
.tab.off { opacity:.6; }
.tab.active { color:var(--t-tab-active-color); border-bottom-color:var(--t-tab-active-color); }
/* Popups */
.overlay { position:fixed; inset:0; z-index:50; background:var(--overlay); display:flex;
           align-items:flex-start; justify-content:center; padding:6vh 16px; overflow-y:auto; }
.modal { width:100%; max-width:480px; background:var(--bg-popup); border-radius:var(--radius-lg); padding:22px;
         box-shadow:var(--shadow); }
.modal.wide-modal { max-width:640px; }
.modal-body { max-height:60vh; overflow-y:auto; margin-bottom:16px; }
.modal-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.modal-head h2 { margin:0; }
.iconbtn { display:inline-flex; padding:6px; border:0; background:transparent; color:var(--muted);
           border-radius:var(--radius); cursor:pointer; }
.iconbtn:hover { background:var(--bg); color:var(--ink); }
.iconbtn .ic { width:20px; height:20px; margin:0; }
/* Forms */
.field { margin-bottom:14px; }
label { display:block; font-size:var(--t-label-size); font-weight:var(--t-label-weight); color:var(--t-label-color); margin-bottom:4px; }
input, select, textarea { width:100%; padding:10px 11px; font:inherit; color:var(--ink); background:var(--bg-input);
                border:1px solid var(--line); border-radius:var(--radius); }
input:focus, select:focus, textarea:focus { outline:2px solid var(--accent); outline-offset:-1px; }
.error { color:var(--err); font-size:12px; margin-top:3px; }
textarea { resize:vertical; line-height:1.5; }
.help { font-size:var(--t-help-size); color:var(--t-help-color); margin-top:4px; }
.help code { background:var(--bg); padding:1px 5px; border-radius:var(--radius); }
button { display:inline-flex; align-items:center; justify-content:center; padding:10px 18px; font:inherit;
         font-size:var(--t-button-size); font-weight:var(--t-button-weight); border:0; border-radius:var(--radius); background:var(--bg-active); color:var(--on-accent); cursor:pointer; }
button:hover { filter:brightness(1.08); }
button.secondary { background:transparent; color:var(--ink); border:1px solid var(--line); margin-left:8px; font-weight:500; }
button.secondary:hover { background:var(--bg); filter:none; }
button.block { width:100%; }
.msg { padding:10px 12px; border-radius:var(--radius); margin-bottom:16px; font-size:var(--t-msg-size); }
.msg.ok { border:1px solid var(--ok); color:var(--ok); }
.msg.warn { border:1px solid var(--warn); color:var(--warn); }
.hidden { display:none !important; }
/* Public pages (log in, register, forgot, verify, 2FA): brand panel left, form right; stacked on phones */
body.public { display:block; }
/* AD1: the DATAPULSE log-in look (its auth-top / auth-form): two equal halves, a dark-to-Cobalt panel with the logo and one line at the left, the form card raised on a plain half at the right */
.authsplit { display:grid; grid-template-columns:1fr 1fr; min-height:100vh; flex:1; }
.authsplit.solo { grid-template-columns:1fr; min-height:0; }
.authside { position:relative; overflow:hidden; color:#FFFFFF; padding:96px 32px 32px; display:flex; flex-direction:column;
            background:linear-gradient(180deg, #0B1220 0%, #0E1A33 26%, #072A63 58%, #003680 80%, #0047AB 100%); }
.authbg { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.authbg line { stroke:rgba(255,255,255,.10); stroke-width:1.5; vector-effect:non-scaling-stroke; }
.authin { position:relative; margin:0 auto; width:100%; max-width:520px; display:flex; flex-direction:column; align-items:center; gap:24px; text-align:center; }
.authbrand { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; }
/* the tile behind the logo and name: clear in light mode, white in dark mode */
.brandtile { display:inline-flex; align-items:center; gap:inherit; background:transparent; }
[data-mode="dark"] .brandtile { background:#FFFFFF; border-radius:10px; padding:6px 10px; }
.authbrand .brandtile { flex-direction:column; justify-content:center; background:#FFFFFF; border-radius:16px; padding:18px 28px; }
.authbrand .brandlogo { height:72px; width:auto; flex:none; }
.authbrand .brandname { height:30px; width:auto; flex:none; }
/* the lockup on a soft blue block (the Privacy & Terms page) */
.brandblock { display:inline-flex; align-items:center; gap:12px; padding:18px 24px; border-radius:var(--radius-lg); background:var(--accent-soft); color:var(--ink); }
.brandblock .brandlogo { height:40px; width:auto; flex:none; }
.brandblock .brandname { height:22px; width:auto; flex:none; }
.authside .tagline { margin:0; font-size:30px; line-height:1.25; font-weight:600; letter-spacing:-.01em; color:#FFFFFF; opacity:.94; }
.authtrust { position:relative; display:flex; gap:10px; align-items:flex-start; margin:auto 0 0; font-size:13px; line-height:1.45; color:rgba(255,255,255,.82); max-width:460px; align-self:center; }
.authtrust .mi { width:16px; height:16px; margin-top:1px; fill:currentColor; }
main.auth { max-width:none; margin:0; padding:48px 32px; display:flex; flex-direction:column; justify-content:center; align-items:center; }
.authsplit:not(.solo) main.auth { background:var(--bg-card); }
.authcard { width:100%; max-width:420px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius-lg);
            padding:32px 32px 24px; box-shadow:0 12px 32px rgba(20,17,24,.08); }
.authcard h2 { text-align:left; font-size:26px; margin:0 0 20px; }
.authfoot { text-align:center; color:var(--muted); margin-top:16px; font-size:14px; }
.authfoot a, .hint a, .help a { color:var(--accent-text); text-decoration:none; }
.hint.links { margin-top:16px; text-align:center; }
.field.agree label { display:flex; gap:8px; align-items:center; font-size:14px; color:var(--ink); }
.field.agree input { width:auto; }
.privacy-text h3 { margin:18px 0 6px; font-size:16px; }
@media (max-width:860px) {
  .authsplit { grid-template-columns:1fr; }
  .authside { padding:22px 20px; }
  .authin { gap:10px; margin:0; }
  .authbrand .brandtile { padding:10px 16px; }
  .authside .tagline { font-size:16px; }
  .authtrust { display:none; }
  main.auth { padding:24px 16px 40px; justify-content:flex-start; }
}
/* Reports: full width */
main.wide, main.full { max-width:none; }
.period { display:flex; gap:12px; align-items:flex-end; margin-bottom:18px; flex-wrap:wrap; }
.period .field { margin:0; }
table.report { width:100%; border-collapse:separate; border-spacing:0; background:var(--bg-card); color:var(--t-td-color); font-size:var(--t-td-size);
               border:1px solid var(--line); border-radius:var(--radius-lg); box-shadow:var(--shadow); overflow:hidden; }
table.report td { padding:9px 16px; }
table.report td.num { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
table.report tr:first-child.section td { border-top:0; }
table.report .total td { font-weight:var(--t-total-weight); color:var(--t-total-color); border-top:1px solid var(--line); }
table.report .head td { font-size:var(--t-th-size); color:var(--t-th-color); border-bottom:1px solid var(--line); font-weight:var(--t-th-weight); }
table.report a { color:var(--t-link-color); text-decoration:none; font-weight:var(--t-link-weight); }
.changes { border:1px solid var(--warn); border-radius:var(--radius-lg); padding:14px 16px; margin-bottom:16px; background:var(--card); }
.changes ul { margin:8px 0 12px; padding-left:18px; max-height:160px; overflow-y:auto; font-size:13px; }
table.grid { border-collapse:collapse; width:100%; }
table.grid th { text-align:left; font-size:12px; font-weight:600; color:var(--muted); padding:9px 10px;
                border-bottom:1px solid var(--line); white-space:nowrap; position:sticky; top:0; background:var(--card); }
table.grid td { padding:2px 4px; border-bottom:1px solid var(--line); }
table.grid td.id { padding:2px 10px; color:var(--muted); font-size:12px; white-space:nowrap; }
table.grid input, table.grid select { padding:6px 6px; min-width:90px; font-size:14px; }
table.grid select { min-width:135px; }
table.grid input[type=number] { min-width:100px; }
table.grid td input[type=text] { min-width:180px; }
.field input[readonly] { background:var(--bg); color:var(--muted); }
table.grid input:disabled, table.grid select:disabled { background:transparent; border-color:transparent;
    color:var(--ink); opacity:1; -webkit-text-fill-color:var(--ink); appearance:none; -webkit-appearance:none; }
table.grid td.changed { background:var(--accent-soft); }
table.grid td.changed input, table.grid td.changed select { border-color:var(--warn); }
table.grid td.bad input, table.grid td.bad select { border-color:var(--err); }
/* Dashboard */
.kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:14px; margin-bottom:18px; }
.panel { background:var(--bg-card); border:1px solid var(--line); border-radius:var(--radius-lg); padding:16px 18px; box-shadow:var(--shadow); }
.panel h3 { margin:0; font-size:var(--t-heading-size); font-weight:var(--t-heading-weight); color:var(--t-heading-color); }
.panel .hint { margin:0; }
table.report.small { margin-top:8px; box-shadow:none; }
table.report.small td { padding:5px 12px; }
/* Card statement */
/* Settings */
.codeform { display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; margin-bottom:12px; }
.codeform .field { margin:0; flex:1; min-width:200px; }
.codeform button.secondary { margin-left:0; }
.danger { margin-top:24px; border:1px solid var(--err); border-radius:var(--radius-lg); padding:14px 16px; }
.danger h3 { margin:0 0 6px; font-size:16px; color:var(--err); }
.danger p { margin:0 0 12px; font-size:14px; }
button.dangerbtn { background:var(--err); color:#fff; }
/* Appearance picker */
/* History */
main.hist table.report td { vertical-align:top; }
/* Settings: cards, tabs content */
main.settings { max-width:760px; }
.card { background:var(--bg-card); border:1px solid var(--line); border-radius:var(--radius-lg); padding:18px 20px;
        margin-bottom:16px; box-shadow:var(--shadow); }
.card h3 { display:flex; align-items:center; gap:8px; margin:0 0 10px; font-size:var(--t-heading-size); font-weight:var(--t-heading-weight); color:var(--t-heading-color); }
.card h3 .ic { color:var(--accent-text); }
.card.danger { border-color:var(--err); box-shadow:none; }
.card.danger h3, .card.danger h3 .ic { color:var(--err); }
.btnrow { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.btnrow button.secondary { margin-left:0; }
input.inline { width:auto; min-width:140px; padding:3px 6px; font-size:inherit; }
.iconbtn.small .ic { width:16px; height:16px; }
.chip { display:inline-flex; align-items:center; gap:6px; padding:4px 6px 4px 11px; border-radius:999px;
        background:var(--card); border:1px solid var(--line); font-size:14px; cursor:grab; }
.chip .x { display:inline-flex; padding:2px; border:0; background:transparent; color:var(--muted); cursor:pointer; border-radius:50%; }
.chip .x:hover { background:var(--accent-soft); color:var(--err); }
.chip .x .ic { width:14px; height:14px; margin:0; }
.count { font-size:11px; color:var(--muted); background:var(--bg); border-radius:999px; padding:0 6px; }
/* Record and View & edit: type buttons, inline form, filters */
.msg .ic { vertical-align:-4px; }
table.grid tr.deleted td { background:var(--bg); }
table.grid tr.deleted input, table.grid tr.deleted select { text-decoration:line-through; opacity:.5; }
/* Dashboard tabs and charts */
.panel.full { margin-top:14px; }
.panel .empty { margin:8px 0 4px; }
table.report td.up { color:var(--err); }
table.report td.down { color:var(--ok); }
.sm { border:1px solid var(--line); border-radius:var(--radius); padding:10px 12px; }
.tab { white-space:nowrap; }
/* Settings > Data */
.checkline { display:flex; gap:8px; align-items:flex-start; font-size:14px; color:var(--ink); margin:6px 0; }
.checkline input { width:auto; margin-top:3px; }
.card.preview { border-color:var(--accent); }
.card h4 { margin:18px 0 4px; font-size:var(--t-subheading-size); font-weight:var(--t-subheading-weight); color:var(--t-subheading-color); }
.needs { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:6px 14px; margin:8px 0 14px; }
.need { display:flex; gap:8px; align-items:flex-start; margin:0; font-size:14px; color:var(--ink); }
.need input { width:auto; margin-top:3px; }
details.errors { margin:10px 0 14px; }
details.errors summary { cursor:pointer; color:var(--err); }
button:disabled { opacity:.5; cursor:default; }
main.settings { max-width:940px; }
/* Statements: readable width, centred on wide screens */
main.wide { max-width:1080px; margin:0 auto; }
/* View & edit grid: amounts line up on the right */
/* All tables: headings centred; text left, numbers right (1,850.00) */
table.grid th, table.grid th.num, table.report .head td, table.report .head td.num { text-align:left; }
table.grid td.num { text-align:right; }
/* Empty pages: a short line and the next step */
/* Privacy & Terms as its own page */
main.doc { max-width:760px; padding-top:40px; }
.doc-brand { margin-bottom:18px; }
form.inline { display:inline; margin:0; }
table.report td.center { text-align:center; }
button.small { padding:6px 12px; font-size:14px; }
/* Home: greeting and shortcuts */
main.home { max-width:900px; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
/* Home: plan usage */
.usage { display:flex; flex-wrap:wrap; gap:8px; text-decoration:none; color:var(--muted); font-size:13px; }
.usage span { background:var(--card); border:1px solid var(--line); border-radius:999px; padding:4px 11px; }
.usage strong { color:var(--ink); }
/* Admin */
table.report.users tr.head td { white-space:nowrap; }
#audit { margin-top:28px; }
@page { margin:14mm; @bottom-right { content:counter(page) " / " counter(pages); font-size:9pt; color:#777; } }
@media print {
  table.report tr { break-inside:avoid; }
  table.report td { padding:4px 8px; font-size:11px; }
}
label.check { display:flex; align-items:center; gap:8px; margin:6px 0 10px; font-size:14px; }
label.check input { width:auto; }
/* Section tabs: one strip at the top of each section; swipe sideways on phones; the grip moves tabs */
/* Coloured icons by meaning (theme.css ICON COLOURS). Only where an icon labels something; buttons keep their text colour. */
:is(nav, .tab, .card h3, .panel h3) .ic { color:var(--ic-plan); }
/* the open menu item, the picked type and the open tab keep their own colours */
nav a.active .ic { color:var(--on-accent); }
/* icons on home tiles and KPI cards sit on a soft tile of their own colour */
/* Search across all types */
/* Help & Feedback: a conversation */
.bubble { max-width:85%; padding:10px 12px; border-radius:var(--radius-lg); border:1px solid var(--line); background:var(--bg-page); }
.bubble.me { align-self:flex-end; background:var(--accent-soft); border-color:transparent; }
.bubble .who { font-size:var(--t-help-size); color:var(--t-help-color); margin-bottom:4px; }
.bubble .text { white-space:pre-wrap; overflow-wrap:anywhere; }
.shot { display:block; max-width:240px; max-height:240px; margin-top:8px; border-radius:var(--radius); border:1px solid var(--line); }
textarea { resize:vertical; min-height:80px; }
.authcard [hidden] { display:none !important; }
button.block.ghost { gap:8px; background:transparent; color:var(--accent-text); border:1.5px solid var(--accent); }
button.block.ghost .mi { width:20px; height:20px; }
/* QA-AD1-01: a full-width button's Material icon (the locked page's Delete Now) is drawn at icon size, in the button's colour */
button.block .mi { width:20px; height:20px; fill:currentColor; vertical-align:-4px; margin-right:6px; }
/* 2FA: the lost-phone option sits apart from Log In */
.authcard .mlost { display:flex; flex-direction:column; align-items:center; gap:10px; margin:26px 0 0; padding-top:18px; border-top:1px solid var(--line, #e5e7eb); }
.authcard .mlost button.secondary { width:100%; margin:0; }

/* AD1: the log-in page's Windows Hello button and the sign-up's human check (Cloudflare Turnstile) */
.whlogin { margin-top:10px; }
.cf-turnstile { margin:12px 0; }
