/* ==========================================================================
   Light and dark themes.
   Every colour in the stylesheets comes from a token. The light values are in app.css (:root); this file holds the dark values.
   The theme is chosen with <html data-theme="light|dark">, set from the toggle in the page header (see assets/js/ui/theme.js).
   Brand colours (--forest, --lawn, --tea, --harvest) keep their value in both themes; surfaces, text and lines change.
   ========================================================================== */
html[data-theme="dark"]{
  color-scheme:dark;
  --frame:#0A0A0B; --porcelain:#131315; --card:#1F1F23; --honey:#232327;
  --white:#1F1F23; --surface:#2A2A2F; --surface-2:#232327; --fill:#2D2D32; --fill-2:#37373D;
  --ink:#ECECEE; --muted:#A1A1A8; --line:#2E2E33; --line-strong:#47474E; --line-soft:#232327;
  --link:#E4E7E4; --err:#F77A70; --forest:#003D20; --lawn:#003D20; --tea:#DADADF;
  --warn-bg:#3A2410; --warn-ink:#FFC48A; --bad-bg:#3E1717; --bad-ink:#FFB3B3; --bad-line:#6B2A2A; --info-bg:#14304F; --info-ink:#A9CCFF;
  --strong:#003D20; --bar:#D8D8DC; --on-bar:#003D20; --panel-dark:#1C1C20; --link-hover:#fff; --hover-bg:#2D2D33;
  --shadow-ink:0,0,0;
  --page-a:#131315; --page-b:#18181B;
  --icon-bg:#2A2A2F; --icon-fg:#E4E7E4;
  --card-shadow:0 1px 2px rgba(0,0,0,.4),0 10px 28px rgba(0,0,0,.35); --card-shadow-hover:0 2px 4px rgba(0,0,0,.45),0 18px 40px rgba(0,0,0,.5);
  --shadow-1:0 1px 2px rgba(0,0,0,.45),0 8px 22px rgba(0,0,0,.35);
  --shadow-2:0 2px 6px rgba(0,0,0,.5),0 20px 48px rgba(0,0,0,.5);
}

/* Printed and previewed documents are paper: always light, in either theme. */
.doc,#print-root{
  color-scheme:light;
  --frame:#DCE7DC; --porcelain:#FCFFFC; --card:#EDFFEA; --honey:#EDFFEA;
  --white:#fff; --surface:#fff; --surface-2:#F7FCF6; --fill:#E7EEE5; --fill-2:#DDE8DB;
  --ink:#1A1E16; --muted:#5E655F; --line:#D5E3D3; --line-strong:#A9BFA9; --line-soft:#EAF2E8;
  --link:#003D20; --err:#C62828;
  --warn-bg:#FDE7D3; --warn-ink:#8A3F00; --bad-bg:#FADADA; --bad-ink:#8E1B1B; --bad-line:#F0C9C9; --info-bg:#DDEBFF; --info-ink:#18407A;
  --strong:#003D20; --bar:#003D20; --on-bar:#fff; --panel-dark:#003D20; --link-hover:#003D20; --hover-bg:color-mix(in srgb,#CBFFB5 40%,#fff);
  background:#fff;color:#1A1E16;
}

/* Bright fills (mint, lime) stay bright in dark mode, so the text on them must stay dark: reset the text tokens inside them. */
html[data-theme="dark"] :where(
.adm-unsaved .btn.save,
.adm-unsaved .btn.save:hover,
.alert.ok,
.cal .d .e,
.card:hover .ch .ci,
.chat .ci2 .u,
.fx-cta .btn,
.fx-note .lead,
.fx-note.ok .lead,
.gantt .today,
.idcard .av,
.lrow .lead,
.lrow.notif .ndot,
.mk.available,
.msel label:has(input:checked),
.msg .rx button.me,
.msg .tx .mn,
.onode:hover,
.pagehead h1 .pi.lime,
.pb .bar .in,
.pg-adm .adm-dark .btn:hover,
.pg-adm .adm-ql:hover,
.pg-adm .card .rchip em,
.pg-adm .lead.sm,
.pg-adm .ochip.on i,
.pg-adm .pdot i,
.pg-adm .step em,
.pg-adm .step:hover,
.pg-adm .vchip em,
.pg-chat .ci2 .u,
.pg-chat .ci2.on .pp-lead,
.pg-chat .msg .ma button:hover,
.pg-chat .msg .rec.callcard.live,
.pg-chat .msg.mine .bd,
.pg-chat .msg.mine .rx button.me,
.pg-dash .dAcard.dark:hover .ci,
.pg-dash .dAcard:hover .ci,
.pg-dash .dHrows.lime .tr i,
.pg-dash .dMchip.lime,
.pg-dash .dMchip.tea,
.pg-dash .sumtile .btn.wht:hover,
.pg-sales .board .col .chd .v,
.pg-sales .board .col.won .chd .ci,
.pg-sales .board .col:hover .chd .ci,
.pg-sales .sg-estate:hover .sg-es-foot .go,
.pg-sales .sg-leg i.lime,
.pg-sales .sg-leg i.tea,
.pg-sales .sg-stack i.lime,
.pg-sales .sg-stack i.tea,
.pg-work .cal .d .e,
.pg-work .gantt .gb i.done,
.pg-work .wk-chain .pill.warn,
.pg-work .wk-col.st-doing .chd .ci,
.pg-work .wk-col.st-review .chd .ci,
.pg-work .wk-lead.info,
.pg-work .wk-lead.warn,
.pg-work .wk-legend i,
.pg-work .wk-legend i.d,
.pg-work .wk-pbar i,
.pill.ok,
.plot.available,
.pp-chips button.on b,
.pp-lead,
.pp-lead.lime,
.pp-legend .late,
.pp-objs li svg,
.pp-prog .pp-objs li svg,
.pp-score.pass,
.pp-split .late,
.ql:hover,
.seg .n,
.tabs a .n,
.tbl tbody tr.sel,
.tbl tbody tr.sel td,
.tcard:hover .fx-th .ci,
.tile.dark .caps i,
.tile.dark:hover .th .ci,
.tile.lime,
.ucard:hover,
.wk-chain-d .pill.warn
){--ink:#1A1E16;--muted:#4A4F4A;--line:rgba(0,0,0,.14);--line-strong:rgba(0,0,0,.3);--link:#003D20;--surface:rgba(255,255,255,.6);--surface-2:rgba(255,255,255,.4);--fill:rgba(255,255,255,.5);--fill-2:rgba(255,255,255,.65);--white:rgba(255,255,255,.6);--bar:#003D20;--on-bar:#fff}

/* Soft glows behind the public forms: dimmer in dark mode */
html[data-theme="dark"] body:has(.publicpage)::before{opacity:.28}

/* ---------- the green highlight card (.tile.lime) ----------
   Every page: the bright highlight card (for example "Properties sold", "Roles", "Confirmed") takes the same green as the buttons (--forest).
   Other cards keep their colour. Inside the card the text, lines and chips switch to light-on-green. This block comes last so it wins on every page. */
.tile.lime{
  --ink:#fff; --muted:rgba(255,255,255,.95); --line:rgba(255,255,255,.28); --line-strong:rgba(255,255,255,.5); --line-soft:rgba(255,255,255,.18);
  --surface:rgba(0,31,16,.22); --surface-2:rgba(0,31,16,.14); --fill:rgba(0,31,16,.26); --fill-2:rgba(0,31,16,.34); --white:rgba(0,31,16,.22);
  --bar:#fff; --on-bar:#003D20; --link:#fff; --link-hover:#fff;
  background:var(--forest); color:#fff;
}
.tile.lime .muted,.tile.lime .small,.tile.lime .big small{color:#fff;opacity:.95}
.tile.lime .dMchip,.tile.lime .adm-mchip,.tile.lime .th .ci,.tile.lime .pc{background:rgba(0,31,16,.26);color:#fff}
.tile.lime .caps i{background:#fff;border-color:rgba(255,255,255,.55)}
.tile.lime .caps i.off{background:transparent}

/* ---------- one look on every screen ----------
   White cards with a soft shadow on a light page (the same page colour as the Home menu), icons in the dark green, and no pale-green panels.
   Text and brand greens (buttons, the highlight card, status pills) are unchanged. This block comes last so it wins on every page. */
html{background:var(--page-b)}
body{background:linear-gradient(135deg,var(--page-a) 0%,var(--page-b) 45%,var(--page-a) 100%) fixed}
.main,.main.is-home{background:transparent}
.card,.tile,.tcard{box-shadow:var(--card-shadow)}
.tile.tea{background:var(--card);color:var(--ink)}
.tile.tea .th .ci{background:var(--icon-bg);color:var(--icon-fg)}
.tile.dark,.tile.lime{box-shadow:var(--card-shadow)}
/* icon tiles: one colour */
.pagehead h1 .pi,.pagehead h1 .pi.lime,
.card .ch .ci,.card h3 .ci,.tile .th .ci,.ql .ci,
.lrow .lead,.pp-lead,.pg-adm .lead.sm,.fx-note .lead,.pg-work .wk-lead.info{background:var(--icon-bg);color:var(--icon-fg)}
.card:hover .ch .ci,.tcard:hover .fx-th .ci,.pg-sales .board .col:hover .chd .ci,.pg-dash .dAcard:hover .ci{background:var(--strong);color:#fff}

html[data-theme="dark"] .homebtn{background:var(--forest)}

/* ---------- one green ----------
   The site has white and one dark green (--forest). The bright lime and the pale mint are gone: counts, bars and chips use the dark green with white text,
   or white when they sit on a dark-green surface. Status colours (orange for late, red for failed) are unchanged. */
.tile.dark .caps i,.tile.dark:hover .th .ci,.pg-dash .dAcard.dark:hover .ci,.pg-adm .adm-dark .btn:hover,.fx-cta .btn,.adm-unsaved .btn.save,
.pg-dash .sumtile .btn.wht:hover,.pg-dash .dHrows.lime .tr i,.pg-work .gantt .gb i.done,.pg-work .gantt .gb i::before,.pg-chat .ci2.on .pp-lead,.pg-chat .ci2.on .u,
.fld.chkr input[type=checkbox]:checked::after,.sw:checked::after,.tabs a.on .n,.seg .on .n,.seg button.on .n{background:#fff;color:#003D20;border-color:#fff}
.plot.documented,.mk.documented{background:#fff;color:#003D20;border-color:var(--strong);box-shadow:inset 0 0 0 2px var(--strong)}
.pg-work .cal .d.t{background:color-mix(in srgb,var(--strong) 12%,var(--surface))}
.pg-work .wk-lead.warn,.pg-work .wk-chain .pill.warn,.wk-chain-d .pill.warn{background:var(--warn-bg);color:var(--warn-ink)}
.pg-chat .msg.mine .bd{background:var(--strong);color:#fff}
.pg-chat .msg.mine .tx a,.pg-chat .msg.mine a.small{color:#fff;text-decoration:underline}
.hcard .hbadge,.badge{background:var(--strong);color:#fff}
/* bar charts: the light capsule is the total (due, sold, target); the dark-green fill inside it is what was collected */
.pb .bar{background:var(--fill-2)}
.pb .bar .in{background:var(--strong);color:#fff}
.pb .bar .d1{background:var(--strong)}
.pb .bar .d2{background:#fff}


/* ---------- page title: centred, no icon ----------
   Area name (small, grey), the title in bold, a summary line, then the tabs centred with the page's action button on the same line at the right. */
.pagehead{display:block;text-align:center;margin:4px 0 20px}
.pagehead .pgrp{font-size:15px;font-weight:500;color:var(--muted);margin-bottom:4px}
.pagehead h1{font-size:clamp(30px,4.6vw,50px);font-weight:800;letter-spacing:-.035em;line-height:1.08;margin:0;min-width:0;flex:none;text-wrap:balance}
.pagehead .sub{font-size:14.5px;font-weight:500;margin-top:8px}
.pagehead .acts{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin:14px 0 0}
.pagehead .acts:empty{display:none}
.tabs{justify-content:center}
.tabrow{display:flex;align-items:center;gap:12px;margin-bottom:22px}
.tabrow .tabs{flex:1 1 auto;min-width:0;margin:0}
.tabrow.sym .tabs{padding-left:calc(var(--aw,0px) + 12px)}
.tabrow .tabacts{flex:none;display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;align-items:center}
.tabrow .tabacts .btn{height:42px}
@media(max-width:1000px){
  .tabrow{flex-direction:column;align-items:stretch}
  .tabrow.sym .tabs{padding-left:0}
  .tabrow .tabacts{justify-content:flex-end}
}

/* ---------- Back button (every page except the Home menu) ---------- */
.backbtn{display:inline-flex;align-items:center;gap:6px;height:46px;padding:0 18px 0 12px;border-radius:999px;background:var(--card);border:0;color:var(--ink);font-weight:700;font-size:14px;cursor:pointer;flex:none;box-shadow:var(--card-shadow);transition:transform .25s var(--ease),box-shadow .25s var(--ease)}
.backbtn:hover{transform:translateY(-1px);box-shadow:var(--card-shadow-hover)}
.backbtn svg{width:20px;height:20px}
@media(max-width:560px){.backbtn{width:38px;height:38px;padding:0;justify-content:center}.backbtn span{display:none}.backbtn svg{width:18px;height:18px}}

/* ---------- dark mode: the same dark green as light mode ----------
   The dark green (#003D20) is used for buttons, tabs and highlight cards in dark mode too. It is quiet against the charcoal page, so the controls get a thin light edge,
   and anything that is only a green line or dot (icons, links, chart fills) uses a light neutral instead. */
html[data-theme="dark"] .btn.primary,html[data-theme="dark"] .homebtn,html[data-theme="dark"] .tabs a.on,html[data-theme="dark"] .qc{border-color:rgba(255,255,255,.16);box-shadow:inset 0 0 0 1px rgba(255,255,255,.12)}
html[data-theme="dark"] .hhero h1 span{color:#fff}
html[data-theme="dark"] .pb .bar .in,html[data-theme="dark"] .pb .bar .d1{background:#E4E7E4}
html[data-theme="dark"] .pb .bar .d2{background:#003D20}
html[data-theme="dark"] .legend i[style*="--lawn"]{background:#E4E7E4!important}

html[data-theme="dark"] .hcard:hover .harr{stroke:#fff}

/* label and value lists (profile, record details): on a phone the label sits above its value so long text keeps the full width */
@media(max-width:560px){
  .kv{grid-template-columns:minmax(0,1fr);gap:2px 0}
  .kv dd{margin-bottom:10px;overflow-wrap:anywhere}
  .fx-pay .kv{grid-template-columns:84px minmax(0,1fr);gap:8px 12px}
  .fx-pay .kv dd{margin-bottom:0}
}

/* ---------- motion ----------
   Pages and cards ease in, controls respond to hover and press, the loading screen fades in and out, and the two themes cross-fade.
   Everything here is switched off for people who ask their device for reduced motion (see the rule in figma.css that shortens all animations). */
@keyframes preIn{from{opacity:0}to{opacity:1}}
.preloader:not([hidden]){animation:preIn .22s ease backwards}
#main:not(.no-anim){animation:fadein .3s ease backwards}
.hhero{animation:rise .6s var(--ease) backwards}
.hcard{animation:rise .5s var(--ease) backwards;animation-delay:calc(var(--i,0)*40ms + .08s)}
.pagehead .pgrp,.pagehead .sub{animation:fadein .5s ease .12s backwards}
.tabrow .tabacts{animation:fadein .45s ease .2s backwards}
.tbl tbody tr{animation:fadein .35s ease backwards}
.tbl tbody tr:nth-child(1){animation-delay:.04s}.tbl tbody tr:nth-child(2){animation-delay:.07s}.tbl tbody tr:nth-child(3){animation-delay:.10s}.tbl tbody tr:nth-child(4){animation-delay:.13s}
.tbl tbody tr:nth-child(5){animation-delay:.16s}.tbl tbody tr:nth-child(6){animation-delay:.19s}.tbl tbody tr:nth-child(7){animation-delay:.22s}.tbl tbody tr:nth-child(8){animation-delay:.25s}
.tbl tbody tr:nth-child(n+9){animation-delay:.28s}
.lrow{animation:fadein .35s ease backwards}
.sresults:not(.hide){animation:pop .22s var(--ease) backwards}
.toast{animation:pop .3s var(--ease) backwards}
a,button{transition-property:background-color,color,border-color,box-shadow,transform,opacity,filter;transition-duration:.2s;transition-timing-function:var(--ease)}
.fld input,.fld select,.fld textarea,.chip,.pill,.seg button,.seg a,.tabs a{transition-property:background-color,color,border-color,box-shadow,transform,opacity;transition-duration:.2s;transition-timing-function:var(--ease)}
.btn:active,.tabs a:active,.iconbtn:active,.backbtn:active,.homebtn:active,.usrbtn:active,.seg button:active,.chip:active{transform:scale(.97)}
.hcard:active,.tile:active,.card.clk:active,.lrow.clk:active{transform:scale(.985)}
.btn:hover,.iconbtn:hover{transform:translateY(-1px)}
.tabs a.on{animation:pop .3s var(--ease) backwards}
html.theming,html.theming *,html.theming *::before,html.theming *::after{transition:background-color .35s ease,color .35s ease,border-color .35s ease,box-shadow .35s ease,fill .35s ease,stroke .35s ease!important}
@media(prefers-reduced-motion:reduce){.preloader:not([hidden]),#main,.hhero,.hcard,.tbl tbody tr,.lrow,.tabs a.on{animation:none!important}.btn:hover,.iconbtn:hover,.btn:active,.hcard:active{transform:none}}

/* ---------- sticky header ---------- */
.topbar{position:sticky;top:0;z-index:70;margin:-12px -48px 10px;padding:12px 48px;isolation:isolate}
.topbar::before{content:"";position:absolute;inset:0;z-index:-1;background:color-mix(in srgb,var(--page-a) 94%,transparent);-webkit-backdrop-filter:blur(16px) saturate(1.2);backdrop-filter:blur(16px) saturate(1.2);transition:box-shadow .25s ease}
.topbar.scrolled::before{box-shadow:0 1px 0 var(--line),0 10px 26px rgba(0,31,16,.07)}
html[data-theme="dark"] .topbar.scrolled::before{box-shadow:0 1px 0 var(--line),0 10px 26px rgba(0,0,0,.4)}
@media(max-width:860px){.topbar{margin:-12px -30px 10px;padding:12px 30px}}
@media(max-width:560px){
  .topbar .search{max-height:46px;transition:max-height .25s ease,opacity .2s ease,margin .25s ease}
  .topbar.search-away .search{max-height:0;opacity:0;margin-top:-10px;overflow:hidden;pointer-events:none}
}
