/* TP Platform — shared structural stylesheet.
   Theme-agnostic: every color/font/radius/shadow here is a var(--token) read from whichever
   theme's tokens.css loaded before this file (see _Layout.cshtml) plus any tenant branding
   override — this file itself never changes per tenant. Structure ported from the supplied
   design prototypes. The KPI tile treatment, logomark, and login artwork now follow the
   Daylight prototype's richer icon-badge/gradient style exactly (TP_Collect_Prototype_Light.html)
   — but every color in them is a token or a color-mix() derived from one, never a literal hex,
   so the exact same rules render correctly in every installed theme's own palette, not just
   Daylight's. That's what keeps "one structural language, per-theme tokens" true while actually
   matching the prototype's look rather than a simplified stand-in for it. */

*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--sans);font-size:13.5px;line-height:1.55;-webkit-font-smoothing:antialiased}
h1,h2,h3,h4{font-family:var(--display);font-weight:700;margin:0;text-wrap:balance;letter-spacing:-.005em}
a{color:var(--brand-d);text-decoration:none}
button{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:3px}
@media (prefers-reduced-motion:reduce){*{animation-duration:.001ms!important;transition-duration:.001ms!important}}

/* ---------- scrollbars ----------
   Thin, theme-aware, no up/down arrow buttons — replaces every browser/OS default scrollbar
   app-wide (Firefox via scrollbar-width/-color, Chrome/Edge via the ::-webkit- pseudo-elements;
   together that's every browser this app targets). The sidebar gets its own override below since
   it can sit on a dark surface (--sidebar-bg) independent of the main content's light one — a
   thumb colored from --line-2 would be nearly invisible on navy, so it reads var(--sidebar-line,
   ...) instead, same fallback-to-no-op pattern the rest of the sidebar's tokens already use. */
*{scrollbar-width:thin;scrollbar-color:var(--line-2) transparent}
*::-webkit-scrollbar{width:9px;height:9px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{background-color:var(--line-2);border-radius:999px;border:2px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-thumb:hover{background-color:var(--ink-3)}
*::-webkit-scrollbar-corner{background:transparent}

.sidebar{scrollbar-color:var(--sidebar-line, var(--line-2)) transparent}
.sidebar ::-webkit-scrollbar-thumb{background-color:var(--sidebar-line, var(--line-2))}
.sidebar ::-webkit-scrollbar-thumb:hover{background-color:var(--sidebar-ink-3, var(--ink-3))}

/* ---------- shell ---------- */
.shell{display:grid;grid-template-columns:252px 1fr;height:100%;min-height:0;position:relative;transition:grid-template-columns .18s ease}
/* Every color below reads var(--sidebar-X, <existing token>) — a theme that never defines
   --sidebar-* (every theme except General, today) falls back to the exact value it always
   rendered, so this is a no-op for them. Only a theme that explicitly opts in (defines
   --sidebar-bg etc. in its own tokens.css) gets a sidebar that differs from the main surface. */
.sidebar{background:var(--sidebar-bg, var(--surface));border-right:1px solid var(--sidebar-line, var(--line));display:flex;flex-direction:column;min-height:0;padding-top:env(safe-area-inset-top,0px);transition:width .16s ease,box-shadow .16s ease}
.brandblock{display:flex;align-items:center;gap:11px;padding:18px 18px 16px;position:relative}
.logomark{width:36px;height:36px;border-radius:11px;background:linear-gradient(150deg,color-mix(in srgb,var(--brand) 55%,white),var(--brand));display:grid;place-items:center;color:var(--on-brand);font-family:var(--display);font-weight:700;font-size:13px;flex:none;overflow:hidden;box-shadow:0 4px 10px color-mix(in srgb,var(--brand) 28%,transparent)}
.logomark img{width:62%;height:62%;object-fit:contain}
.brandname{font-family:var(--display);font-weight:700;font-size:17px;letter-spacing:-.02em;line-height:1.1;color:var(--sidebar-ink, var(--ink))}
.brandsub{font-size:10px;color:var(--sidebar-ink-3, var(--ink-3));letter-spacing:.05em;text-transform:uppercase;font-weight:600}
.nav{flex:1;overflow-y:auto;padding:4px 12px 24px;min-height:0}
.navgroup{margin-top:16px}
.navgroup:first-child{margin-top:2px}
.navlabel{font-size:11px;letter-spacing:.02em;color:var(--sidebar-ink-3, var(--ink-3));padding:6px 10px;font-weight:600}
.navitem{display:flex;align-items:center;gap:11px;width:100%;text-align:left;padding:9px 11px;border-radius:var(--r-m);border:0;background:none;color:var(--sidebar-ink-2, var(--ink-2));cursor:pointer;font-size:13.5px;line-height:1.3;font-weight:500;text-decoration:none;transition:background .13s,color .13s}
.navitem:hover{background:var(--sidebar-hover, var(--surface-2));color:var(--sidebar-ink, var(--ink))}
.navitem.active{background:var(--sidebar-active-bg, var(--brand-soft));color:var(--sidebar-active-ink, var(--brand-d));font-weight:700}
.navitem .ico{width:18px;flex:none;opacity:.75;text-align:center;font-size:14px}
.navitem.active .ico{opacity:1}

/* ---------- sidebar pin / collapse-to-icons ----------
   One toggle, driven by a single class on <html> (not .shell/.sidebar directly) so the earliest
   inline script in <head> can apply it before first paint and avoid a flash of the wrong state —
   see _Layout.cshtml. Pinned (default): .shell stays at its normal 252px column. Unpinned
   (html.navcollapsed): the column shrinks to a 64px icon rail and the main content's 1fr column
   automatically claims the freed width — no JS sizing of .main/.view needed, that's just what a
   CSS grid with a 1fr track already does. Hovering the collapsed rail temporarily re-expands the
   sidebar as an overlay (position:absolute, same visual width as pinned) without touching the
   grid column, so peeking at the full menu never reflows the page underneath it. */
.sidebarpin{position:absolute;top:20px;right:14px;width:26px;height:26px;border-radius:50%;border:0;
  background:var(--sidebar-hover, var(--surface-2));color:var(--sidebar-ink-2, var(--ink-2));
  display:grid;place-items:center;cursor:pointer;flex:none;font-size:13px;line-height:1;
  transition:background .13s,color .13s,transform .15s}
.sidebarpin:hover{background:var(--sidebar-active-bg, var(--brand-soft));color:var(--sidebar-active-ink, var(--brand-d))}
.sidebarpin .pinico{display:inline-block;transition:transform .15s}
html.navcollapsed .sidebarpin .pinico{transform:rotate(40deg)}

@media (min-width:901px){
  html.navcollapsed .shell{grid-template-columns:64px 1fr}
  html.navcollapsed .sidebar{width:64px;overflow:visible}
  html.navcollapsed .brandblock{justify-content:center;padding:18px 0 16px}
  html.navcollapsed .brandtext,
  html.navcollapsed .navlabel,
  html.navcollapsed .navitem span:not(.ico){display:none}
  html.navcollapsed .navitem{justify-content:center;padding:9px 0;gap:0}
  html.navcollapsed .sidebarpin{display:none}

  /* Hover (or keyboard focus) flyout — the whole sidebar, not just a one-item tooltip. Taken out
     of grid flow via position:absolute so growing back to 252px overlays the content instead of
     pushing it; .shell carries position:relative (above) so this anchors to the shell, not the
     viewport. */
  html.navcollapsed .sidebar:hover,
  html.navcollapsed .sidebar:focus-within{
    position:absolute;top:0;left:0;height:100%;width:252px;z-index:80;
    box-shadow:var(--shadow-2);overflow:visible}
  html.navcollapsed .sidebar:hover .brandblock,
  html.navcollapsed .sidebar:focus-within .brandblock{justify-content:flex-start;padding:18px 18px 16px}
  html.navcollapsed .sidebar:hover .brandtext,
  html.navcollapsed .sidebar:focus-within .brandtext,
  html.navcollapsed .sidebar:hover .navlabel,
  html.navcollapsed .sidebar:focus-within .navlabel,
  html.navcollapsed .sidebar:hover .navitem span:not(.ico),
  html.navcollapsed .sidebar:focus-within .navitem span:not(.ico){display:revert}
  html.navcollapsed .sidebar:hover .navitem,
  html.navcollapsed .sidebar:focus-within .navitem{justify-content:flex-start;padding:9px 11px;gap:11px}
  html.navcollapsed .sidebar:hover .sidebarpin,
  html.navcollapsed .sidebar:focus-within .sidebarpin{display:grid;position:absolute;top:20px;right:14px;margin:0}
}
@media (max-width:900px){
  .sidebarpin{display:none}
}

.main{display:flex;flex-direction:column;min-width:0;min-height:0;grid-column:2}
.topbar{display:flex;align-items:center;gap:12px;padding:12px 22px;background:var(--surface);border-bottom:1px solid var(--line);position:sticky;top:env(safe-area-inset-top,0px);z-index:30;flex:none}
.hamb{display:none;background:var(--surface-2);border:1px solid var(--line);border-radius:var(--r-m);padding:7px 10px;cursor:pointer}
.crumb{font-size:12.5px;color:var(--ink-3)}
.crumb b{color:var(--ink);font-weight:700}
.topspacer{flex:1}

/* Topbar brand cluster: the tenant's own uploaded logo (the sidebar carries the fixed TP mark
   instead — see .logomark — so the two never duplicate each other). */
.topbrand{display:flex;align-items:center;flex:none}
.topbrand-tenant{height:37px;width:auto;max-width:160px;object-fit:contain;flex:none}
@media (max-width:640px){.topbrand{display:none}}

/* Global search box (top bar) */
.globalsearch{position:relative;flex:1;max-width:520px}
.gs-ico{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--ink-3);font-size:13px;line-height:1;pointer-events:none}
.globalsearch input[type=text]{width:100%;padding:8px 12px 8px 36px;border-radius:var(--r-m);border:1px solid var(--line-2);background:var(--surface-2);color:var(--ink);font:inherit;font-size:12.5px}
.globalsearch input[type=text]:focus{border-color:var(--brand);outline:none;box-shadow:0 0 0 3px var(--brand-soft);background:var(--surface)}
.gs-results{position:absolute;top:calc(100% + 6px);left:0;right:0;max-height:420px;overflow-y:auto;background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-l);box-shadow:var(--shadow-2);z-index:60;padding:6px}
.gs-section{font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-3);padding:8px 10px 4px}
.gs-item{display:flex;align-items:center;gap:9px;padding:8px 10px;border-radius:var(--r-m);color:var(--ink);text-decoration:none;font-size:12.5px}
.gs-item:hover{background:var(--surface-2)}
.gs-item-ico{color:var(--ink-3);font-size:12px;flex:none}
.gs-loading{padding:8px 10px;font-size:12px;color:var(--ink-3)}

/* Top-bar user account menu */
.avatar-sm,.avatar-md{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;background:var(--brand-soft);color:var(--brand-d);font-weight:700;flex:none}
.avatar-sm{width:30px;height:30px;font-size:12px}
.avatar-md{width:40px;height:40px;font-size:14px}
.usermenu{position:relative;flex:none}
.usertrigger{display:flex;align-items:center;gap:9px;padding:5px 10px 5px 5px;border-radius:var(--r-l);border:1px solid transparent;background:none;cursor:pointer;color:var(--ink)}
.usertrigger:hover{background:var(--surface-2);border-color:var(--line)}
.usertrigger-text{display:flex;flex-direction:column;align-items:flex-start;line-height:1.3}
.usertrigger-text b{font-size:12.5px;font-weight:600}
.usermenu-panel{position:absolute;top:calc(100% + 8px);right:0;width:280px;background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-l);box-shadow:var(--shadow-2);z-index:60;padding:6px;display:flex;flex-direction:column;gap:2px}
.usermenu-head{display:flex;align-items:center;gap:10px;padding:10px 10px 12px;border-bottom:1px solid var(--line);margin-bottom:6px}
.usermenu-head b{font-size:13px}
.usermenu-item{display:flex;align-items:center;gap:9px;padding:9px 10px;border-radius:var(--r-m);color:var(--ink-2);text-decoration:none;font-size:12.5px;font-weight:500;background:none;border:none;width:100%;text-align:left;cursor:pointer;font-family:inherit}
.usermenu-item:hover{background:var(--surface-2);color:var(--ink)}
.usermenu-item.danger{color:var(--crit)}
.usermenu-item.danger:hover{background:var(--crit-soft)}
.usermenu-item .ico{color:var(--ink-3);font-size:12px;width:16px;flex:none}
.usermenu-item.danger .ico{color:var(--crit)}

/* Topbar notification bell — same positioned-dropdown pattern as .usermenu above. */
.notifbell{position:relative;flex:none}
.notiftrigger{position:relative;display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:999px;border:1px solid transparent;background:none;cursor:pointer;color:var(--ink-2);font-size:16px}
.notiftrigger:hover{background:var(--surface-2);border-color:var(--line);color:var(--ink)}
.notifbadge{position:absolute;top:2px;right:2px;min-width:16px;height:16px;padding:0 3px;border-radius:999px;background:var(--crit);color:#fff;font-size:9.5px;font-weight:700;display:flex;align-items:center;justify-content:center;line-height:1}
.notifpanel{position:absolute;top:calc(100% + 8px);right:0;width:340px;max-height:420px;overflow-y:auto;background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-l);box-shadow:var(--shadow-2);z-index:60}
.notifpanel-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--surface)}
.notifpanel-head b{font-size:13px}
.notif-item{display:flex;align-items:flex-start;gap:9px;padding:10px 14px;text-decoration:none;color:var(--ink);border-bottom:1px solid var(--line)}
.notif-item:last-child{border-bottom:none}
.notif-item:hover{background:var(--surface-2)}
.notif-item b{font-size:12.5px}
.notif-dot{width:7px;height:7px;border-radius:999px;background:transparent;margin-top:5px;flex:none}
.notif-item.unread .notif-dot{background:var(--brand)}
.linklike{background:none;border:none;padding:0;color:var(--brand);cursor:pointer;font-family:inherit;text-decoration:underline}

/* Dashboard gradient stat tiles — every gradient pair is built from that theme's own tokens
   (never a fixed hex), so the same markup stays vivid and on-brand in any installed theme. */
.gradtiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px}
.gradtile{position:relative;overflow:hidden;border-radius:var(--r-l);padding:16px 18px;color:#fff;text-decoration:none;box-shadow:var(--shadow-1);min-height:92px;display:flex;flex-direction:column;justify-content:space-between;transition:transform .15s,box-shadow .15s}
.gradtile:hover{transform:translateY(-2px);box-shadow:var(--shadow-2)}
.gradtile::after{content:"";position:absolute;right:-30px;top:-30px;width:120px;height:120px;border-radius:50%;background:rgba(255,255,255,.12)}
.gradtile .k{font-size:11.5px;font-weight:600;letter-spacing:.02em;opacity:.92;text-shadow:0 1px 2px rgba(0,0,0,.15)}
.gradtile .v{font-size:26px;font-weight:800;font-family:var(--display);line-height:1.1;text-shadow:0 1px 3px rgba(0,0,0,.2)}
.gradtile .d{font-size:10.5px;opacity:.85;text-shadow:0 1px 2px rgba(0,0,0,.15)}
.gradtile.g-brand{background:linear-gradient(135deg,var(--brand),var(--accent))}
.gradtile.g-pos{background:linear-gradient(135deg,var(--pos),var(--sky))}
.gradtile.g-warn{background:linear-gradient(135deg,var(--warn),var(--rose))}
.gradtile.g-crit{background:linear-gradient(135deg,var(--crit),var(--warn))}

.chartgrid{display:grid;grid-template-columns:2fr 1fr;gap:14px}
.chartgrid.thirds{grid-template-columns:1fr 1fr 1fr}
@media (max-width:900px){.chartgrid,.chartgrid.thirds{grid-template-columns:1fr}}
.chartcard{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-l);padding:16px;display:flex;flex-direction:column;gap:10px}
.chartcard .chartcard-title{font-size:12.5px;font-weight:700;color:var(--ink)}
.chartcard-body{position:relative;flex:1;min-height:200px}
.donutlegend{display:flex;flex-direction:column;gap:7px;justify-content:center}
.donutlegend .row{display:flex;align-items:center;gap:8px;font-size:11.5px;color:var(--ink-2)}
.donutlegend .dot{width:9px;height:9px;border-radius:50%;flex:none}
.donutlegend .val{margin-left:auto;font-weight:700;color:var(--ink)}

.view{flex:1;overflow-y:auto;padding:22px 22px 60px;min-height:0}
.viewinner{max-width:1380px;margin:0 auto;display:flex;flex-direction:column;gap:18px}

.pagehead{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap}
.eyebrow{font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--brand);font-weight:700;margin-bottom:5px}
.pagehead h1{font-size:25px}
.pagehead h1.titlerow{display:flex;align-items:center;gap:7px}
.headactions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}

/* page-title info tooltip — replaces the old always-visible .pagesub description paragraph;
   the description now lives in this bubble so the page body starts with real content, not prose */
.infotip{position:relative;display:inline-flex;align-items:center;justify-content:center;
  width:17px;height:17px;border-radius:50%;color:var(--ink-3);cursor:help;flex:none;
  font-size:14px;line-height:1;vertical-align:middle}
.infotip:hover,.infotip:focus-visible{color:var(--brand)}
.infotip:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:50%}
.infotip .ico{font-size:15px}
.infotip-bubble{
  position:absolute;left:0;top:calc(100% + 9px);z-index:40;
  width:max-content;max-width:320px;
  background:var(--ink);color:var(--surface);font-size:12px;font-weight:400;line-height:1.5;
  padding:8px 11px;border-radius:var(--r-m);box-shadow:var(--shadow-2);
  opacity:0;visibility:hidden;transform:translateY(-4px);
  transition:opacity .12s ease,transform .12s ease}
.infotip-bubble a{color:inherit;text-decoration:underline}
.infotip:hover .infotip-bubble,.infotip:focus-visible .infotip-bubble{
  opacity:1;visibility:visible;transform:translateY(0)}
@media (max-width:520px){ .infotip-bubble{max-width:220px} }

/* ---------- controls ---------- */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 15px;border-radius:var(--r-m);border:1px solid var(--line-2);background:var(--surface);color:var(--ink-2);cursor:pointer;font-size:12.5px;font-weight:600;white-space:nowrap;transition:background .13s,border-color .13s,color .13s;text-decoration:none}
.btn:hover{background:var(--surface-2);border-color:var(--ink-3);color:var(--ink)}
.btn.primary{background:var(--brand);border-color:var(--brand);color:var(--on-brand);box-shadow:0 2px 8px color-mix(in srgb,var(--brand) 24%,transparent)}
.btn.primary:hover{background:var(--brand-d);border-color:var(--brand-d);color:var(--on-brand)}
.btn.ghost{background:none;border-color:var(--line-2);color:var(--ink-2)}
.btn.ghost:hover{background:var(--surface-2);border-color:var(--ink-3);color:var(--ink)}
.btn.danger{color:var(--crit);border-color:var(--crit)}
.btn.sm{padding:5px 10px;font-size:11.5px;border-radius:8px}
.btn.icon-only{padding:0;width:28px;height:28px;justify-content:center;flex:none}
.btn.icon-only.sm{width:26px;height:26px}
.btn.icon-only .ico{font-size:13px;line-height:1}
.btn:disabled{opacity:.45;cursor:not-allowed}
.seg{display:inline-flex;background:var(--surface-3);border-radius:var(--r-m);padding:3px;gap:2px}
.seg button{border:0;background:none;padding:5px 12px;border-radius:7px;cursor:pointer;font-size:12px;color:var(--ink-2);font-weight:600}
.seg button.on{background:var(--surface);color:var(--brand-d);box-shadow:var(--shadow-1)}

label.f{display:flex;flex-direction:column;gap:5px;font-size:11.5px;color:var(--ink-2);font-weight:500}
input[type=text],input[type=email],input[type=password],input[type=date],input[type=number],input:not([type]),select,textarea{
  font:inherit;font-size:12.5px;padding:7px 9px;border-radius:var(--r-m);border:1px solid var(--line-2);
  background:var(--surface);color:var(--ink);width:100%}
input:focus,select:focus,textarea:focus{border-color:var(--brand);outline:none;box-shadow:0 0 0 3px var(--brand-soft)}
textarea{resize:vertical;min-height:70px;line-height:1.55}
input:disabled,select:disabled{background:var(--surface-3);color:var(--ink-3)}
input[type=file]{font:inherit;font-size:12.5px;color:var(--ink-2)}
input[type=file]::file-selector-button{
  font:inherit;font-size:12.5px;font-weight:600;padding:7px 12px;margin-right:10px;
  border-radius:var(--r-m);border:1px solid var(--line-2);background:var(--surface);color:var(--ink-2);
  cursor:pointer;transition:background .13s,border-color .13s,color .13s}
input[type=file]::file-selector-button:hover{background:var(--surface-2);border-color:var(--brand)}
.formgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
.switch{display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-size:12px}
.switch input{appearance:none;width:32px;height:18px;border-radius:9px;background:var(--line-2);position:relative;cursor:pointer;transition:background .15s;flex:none;margin:0}
.switch input:checked{background:var(--brand)}
.switch input::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .15s}
.switch input:checked::after{transform:translateX(14px)}

/* ---------- surfaces ---------- */
/* --panel-bg falls back to --surface-2 (every theme's existing light-gray secondary surface) so
   cards read as distinct from the page background out of the box — previously this was
   var(--surface), identical to the page itself, which is why panels blended in. A tenant can
   override --panel-bg from Admin > Branding (see ThemeService.RenderThemeCssAsync) without
   touching anything else. */
.card{background:var(--panel-bg, var(--surface-2));border:1px solid var(--line);border-radius:var(--r-l);box-shadow:var(--shadow-1)}
.card.pad{padding:16px}
/* flex-wrap:wrap guards against a header whose title + subtitle + trailing controls (e.g. a
   .cardtoggle) are together wider than the card — without it, the non-shrinking .cardtoggle gets
   pushed past the card's right edge and clipped/unclickable at realistic (non-1440px) widths,
   rather than dropping to its own line. */
.cardhead{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:13px 16px;border-bottom:1px solid var(--line)}
.cardhead h3{font-size:14px}
.cardhead .sub{font-size:11.5px;color:var(--ink-3)}
.cardhead .right{margin-left:auto;display:flex;gap:7px;align-items:center}
.cardbody{padding:16px}

/* Collapsible panel toggle — opt-in via .card.collapsible, one small chevron button in the
   header (wherever it sits in source order, pinned to the far right by margin-left:auto so it
   doesn't need a wrapping .right div). Click handling and localStorage persistence live in
   _Layout.cshtml's shared script, event-delegated so new collapsible panels need no JS of their
   own — just this markup: <div class="card collapsible" data-panel-id="...">
   <div class="cardhead">...<button class="cardtoggle">...</button></div>
   <div class="cardbody">...</div></div> */
.cardtoggle{margin-left:auto;flex:none;width:26px;height:26px;border-radius:50%;border:0;
  background:var(--surface-3, var(--surface));color:var(--ink-2);display:grid;place-items:center;
  cursor:pointer;font-size:11px;line-height:1;transition:background .13s,color .13s}
.cardtoggle:hover{background:var(--brand-soft);color:var(--brand-d)}
.cardtoggle .ico{display:inline-block;transition:transform .15s}
.card.collapsible.collapsed .cardtoggle .ico{transform:rotate(-90deg)}
/* !important: a few .cardbody elements (e.g. "Key operational insights") carry their own inline
   display:grid for layout — an inline style always wins over a class rule regardless of
   specificity, so without !important here the collapsed state silently failed to hide them. */
.card.collapsible.collapsed > .cardbody{display:none!important}
.card.collapsible .cardhead{cursor:pointer}
.grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px}
.grid3{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px}
.split{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:16px}
@media (max-width:1000px){.split{grid-template-columns:1fr}}

/* KPI strip — icon-badge tiles, ported from the Daylight prototype. Grid-based (not flex) so
   the icon badge (::before) can span all three text rows while .k/.v/.d stay exactly where
   existing page markup (e.g. Customers/Details.cshtml) already puts them as plain sibling divs
   — no markup changes needed, only this CSS. .strip stays defined-but-hidden for the same
   reason: older markup that still renders a <div class="strip"> keeps working, it just no
   longer draws anything, since the icon badge now carries the semantic color instead. */
/* Label:value pairs (Customer 360's header box, Admin > License) — was unstyled, so <dt>/<dd>
   fell back to the browser default of stacking each on its own line. A 2-column grid puts every
   dt/dd pair on one row instead, reading "Label: Value" like the rest of the app's compact
   layouts, with no markup change needed anywhere this class is already used. */
.dl{display:grid;grid-template-columns:auto 1fr;column-gap:8px;row-gap:7px;align-items:baseline;font-size:12.5px}
.dl dt{color:var(--ink-3);font-weight:600;white-space:nowrap}
.dl dt::after{content:":"}
.dl dd{margin:0;font-weight:700;color:var(--ink);overflow-wrap:anywhere}

.kpistrip{display:grid;grid-template-columns:repeat(auto-fit,minmax(176px,1fr));gap:14px}
.kpi{border-radius:var(--r-l);padding:15px;display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto auto;column-gap:11px;align-items:start;border:1px solid transparent;background:var(--sky-soft);position:relative;min-width:0}
.kpi .strip{display:none}
.kpi::before{
  content:"$";grid-row:1/4;grid-column:1;
  width:34px;height:34px;border-radius:10px;display:grid;place-items:center;
  font-family:var(--display);font-size:15px;font-weight:700;color:#fff;background:var(--sky);
  box-shadow:0 3px 9px rgba(27,32,40,.14)}
.kpi .k{grid-column:2;font-size:12px;color:var(--ink-2);font-weight:600;letter-spacing:.01em}
.kpi .v{grid-column:2;font-family:var(--display);font-size:clamp(18px,1.5vw,25px);font-weight:700;letter-spacing:-.025em;font-variant-numeric:tabular-nums;line-height:1.18;color:var(--ink);min-width:0;overflow-wrap:anywhere}
.kpi .d{grid-column:2;font-size:11.5px;color:var(--ink-2);font-weight:600}

/* No semantic modifier: rotate through the four tints by position, so an unlabeled strip still
   reads as a coherent set rather than four identical tiles. */
.kpi:nth-child(4n+2){background:var(--mint-soft)}
.kpi:nth-child(4n+2)::before{background:var(--mint);content:"⇄"}
.kpi:nth-child(4n+3){background:var(--sky-soft)}
.kpi:nth-child(4n+3)::before{background:var(--sky);content:"$"}
.kpi:nth-child(4n+4){background:var(--amber-soft)}
.kpi:nth-child(4n+4)::before{background:var(--amber);content:"▤"}
.kpi:nth-child(4n+1){background:var(--rose-soft)}
.kpi:nth-child(4n+1)::before{background:var(--rose);content:"◫"}

/* Semantic modifiers override the rotation with a fixed, meaningful tint+glyph. */
.kpi.lead{background:var(--rose-soft)}
.kpi.lead::before{background:var(--rose);content:"▤"}
.kpi.lead .d{color:var(--rose)}
.kpi.critbar{background:var(--rose-soft)}
.kpi.critbar::before{background:var(--rose);content:"!"}
.kpi.critbar .d{color:var(--crit)}
.kpi.warnbar{background:var(--amber-soft)}
.kpi.warnbar::before{background:var(--amber);content:"◔"}
.kpi.warnbar .d{color:var(--warn)}
.kpi.posbar{background:var(--mint-soft)}
.kpi.posbar::before{background:var(--mint);content:"↗"}
.kpi.posbar .d{color:var(--pos)}

/* Compact KPI tiles — Customer 360's aging strip and PTP-tab strip opt into this (not a global
   .kpi change: Dashboard/Worklist keep their icon tiles as-is). Drops the icon badge column
   entirely and shrinks the value font so a currency-suffixed amount ("4,19,745.02 EUR") fits on
   one line in a ~190px tile instead of wrapping. */
.kpistrip.compact{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.kpistrip.compact .kpi{grid-template-columns:1fr;padding:12px 14px}
.kpistrip.compact .kpi::before{display:none}
.kpistrip.compact .kpi .k,.kpistrip.compact .kpi .v,.kpistrip.compact .kpi .d{grid-column:1}
.kpistrip.compact .kpi .v{font-size:16px}

/* Plain KPI tiles — Dashboard's bottom row opts into this (not a global .kpi change: Worklist,
   Allocation, and Customer 360's own kpistrips keep the colorful icon-badge look as-is). Drops
   the ::before icon badge entirely, same as .compact, but keeps the full k/v/d layout; and
   replaces every variant's tinted background with one neutral surface + border, so the row reads
   as a normal, calm set of stat tiles rather than a bright dashboard widget. The .d text color
   on critbar/warnbar/posbar is left alone — that's the one meaningful color signal (overdue, on
   track, etc.), not decoration. */
.kpistrip.plain .kpi{grid-template-columns:1fr;background:var(--surface);border-color:var(--line)}
.kpistrip.plain .kpi::before{display:none}
.kpistrip.plain .kpi .k,.kpistrip.plain .kpi .v,.kpistrip.plain .kpi .d{grid-column:1}
.kpistrip.plain .kpi:nth-child(4n+1),.kpistrip.plain .kpi:nth-child(4n+2),
.kpistrip.plain .kpi:nth-child(4n+3),.kpistrip.plain .kpi:nth-child(4n+4),
.kpistrip.plain .kpi.lead,.kpistrip.plain .kpi.critbar,
.kpistrip.plain .kpi.warnbar,.kpistrip.plain .kpi.posbar{background:var(--surface)}

/* ---------- loading overlay (site.js: TP.showLoading / showLoadingDelayed) ----------
   Pure CSS, no external library/Lottie fetch — see site.js's own comment for why. A rotating
   3D cube rather than a flat spinner, in the spirit of the "abstract modular cube" reference. */
.loading-overlay{position:fixed;inset:0;background:color-mix(in srgb,var(--paper) 88%,transparent);backdrop-filter:blur(2px);z-index:9999;display:none;flex-direction:column;align-items:center;justify-content:center;gap:14px}
.loading-overlay.show{display:flex}
.loading-cube{width:48px;height:48px;position:relative;transform-style:preserve-3d;animation:loading-spin 2.4s linear infinite}
.loading-cube .face{position:absolute;inset:0;background:linear-gradient(135deg,var(--brand),var(--brand-d));opacity:.88;border:1px solid color-mix(in srgb,#fff 40%,transparent);border-radius:7px}
.loading-cube .face:nth-child(1){transform:translateZ(24px)}
.loading-cube .face:nth-child(2){transform:rotateY(180deg) translateZ(24px)}
.loading-cube .face:nth-child(3){transform:rotateY(90deg) translateZ(24px)}
.loading-cube .face:nth-child(4){transform:rotateY(-90deg) translateZ(24px)}
.loading-cube .face:nth-child(5){transform:rotateX(90deg) translateZ(24px)}
.loading-cube .face:nth-child(6){transform:rotateX(-90deg) translateZ(24px)}
@keyframes loading-spin{from{transform:rotateX(0deg) rotateY(0deg)}to{transform:rotateX(360deg) rotateY(360deg)}}
.loading-text{font-size:13px;color:var(--ink);font-weight:700;text-align:center}
.loading-eta{font-size:12px;color:var(--ink-3);font-variant-numeric:tabular-nums}

/* ---------- pills / chips ---------- */
.pill{display:inline-flex;align-items:center;gap:5px;padding:2px 8px;border-radius:99px;font-size:11px;font-weight:600;border:1px solid transparent;white-space:nowrap}
.pill.ok{background:var(--pos-soft);color:var(--pos)}
.pill.warn{background:var(--warn-soft);color:var(--warn)}
.pill.crit{background:var(--crit-soft);color:var(--crit)}
.pill.info{background:var(--info-soft);color:var(--info)}
.pill.mute{background:var(--surface-3);color:var(--ink-3);border-color:var(--line)}
.pill.brand{background:var(--brand-soft);color:var(--brand-d)}
.dot{width:8px;height:8px;border-radius:50%;display:inline-block;flex:none}
.dot.ok{background:var(--pos)}.dot.warn{background:var(--warn)}.dot.crit{background:var(--crit)}.dot.mute{background:var(--line-2)}
.chip{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;border-radius:var(--r-m);background:var(--surface-3);border:1px solid var(--line);font-size:11.5px;color:var(--ink-2)}
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.num{font-family:var(--mono);font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap}
.neg{color:var(--crit)}
.muted{color:var(--ink-3)}
.tiny{font-size:11px}

/* ---------- tables ---------- */
.tablewrap{overflow-x:auto;border-radius:var(--r-l)}
table.dt{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;min-width:100%}
table.dt th{position:sticky;top:0;z-index:2;background:var(--surface-2);text-align:left;font-size:10.5px;letter-spacing:.055em;text-transform:uppercase;color:var(--ink-3);font-weight:700;padding:9px 11px;border-bottom:1px solid var(--line);white-space:nowrap}
table.dt td{padding:8px 11px;border-bottom:1px solid var(--line);vertical-align:middle}
table.dt tbody tr:hover td{background:var(--surface-2)}
table.dt tr:last-child td{border-bottom:0}
.emptystate{padding:36px;text-align:center;color:var(--ink-3)}

/* ---------- CSS-only tabs (radio + label + sibling selector, no JS) ---------- */
.tabbar{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:12px}
.tabbar input{position:absolute;opacity:0;pointer-events:none}
.tabbar label{padding:8px 12px;font-size:12.5px;font-weight:500;color:var(--ink-3);cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px}
.tabbar input:checked+label{color:var(--brand-d);border-color:var(--brand)}
/* Link-driven variant of .tabbar — for pages whose "active tab" lives in the URL (?tab=x)
   instead of client-side radio state, so a reload or a direct link lands on the right tab. */
.tabbar .tabbtn{padding:10px 12px;font-size:12.5px;font-weight:600;color:var(--ink-2);border-bottom:2px solid transparent;margin-bottom:-1px;text-decoration:none;display:inline-flex;gap:6px;align-items:center}
.tabbar .tabbtn.on{color:var(--brand-d);border-color:var(--brand)}
.tabbar .cnt{background:var(--line);border-radius:99px;padding:0 6px;font-size:11px}
dialog.modal-dialog{border:none;border-radius:var(--r-l);padding:0;max-width:900px;width:92vw;background:var(--surface);color:var(--ink);box-shadow:var(--shadow-2)}
dialog.modal-dialog::backdrop{background:rgba(0,0,0,.5)}
.tabpanel{display:none}

/* ---------- forms as a row (existing pages use this) ---------- */
.row.g-2{display:flex;flex-wrap:wrap;gap:10px}
.col-auto{flex:0 0 auto}

/* swatches (Branding customizer) */
.swatchrow{display:flex;gap:7px;flex-wrap:wrap}
.swatch{width:28px;height:28px;border-radius:var(--r-s);border:1px solid var(--line-2);cursor:pointer;padding:0}
.swatch.on{outline:2px solid var(--brand);outline-offset:2px}

/* theme gallery */
.themegrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.themecard{border:1px solid var(--line);border-radius:var(--r-l);overflow:hidden;background:var(--surface);box-shadow:var(--shadow-1)}
.themecard .thumb{height:120px;background:var(--surface-3);background-size:cover;background-position:center;display:flex;align-items:center;justify-content:center;color:var(--ink-3);font-size:11px}
.themecard .body{padding:12px}
.themecard.active{outline:2px solid var(--brand);outline-offset:-2px}

/* login */
.loginwrap{display:grid;place-items:center;padding:24px 0}
.loginframe{width:min(880px,100%);border-radius:16px;overflow:hidden;border:1px solid var(--line);box-shadow:var(--shadow-2);display:grid;grid-template-columns:1fr 340px;min-height:430px;background:var(--surface)}
.loginart{background:linear-gradient(155deg,color-mix(in srgb,var(--brand) 45%,white) 0%,var(--brand) 52%,var(--brand-d) 100%);color:#fff;padding:30px;display:flex;flex-direction:column;justify-content:space-between;position:relative;overflow:hidden;background-size:cover;background-position:center}
.loginart::after{content:"";position:absolute;inset:auto -40px -90px -40px;height:230px;background:radial-gradient(ellipse at center,rgba(255,255,255,.22),transparent 70%)}
.loginart h2{font-size:27px;color:#fff;max-width:14ch;position:relative}
.loginform{padding:28px;display:flex;flex-direction:column;gap:14px;justify-content:center;background:var(--surface)}
@media (max-width:760px){.loginframe{grid-template-columns:1fr}.loginart{min-height:150px}}

/* alerts (existing pages use Bootstrap-style alert classes) */
.alert{padding:11px 14px;border-radius:var(--r-m);font-size:12.5px;border:1px solid transparent}
.alert-danger{background:var(--crit-soft);color:var(--crit);border-color:color-mix(in srgb,var(--crit) 30%,transparent)}
.alert-info{background:var(--info-soft);color:var(--info);border-color:color-mix(in srgb,var(--info) 30%,transparent)}
.alert-warn{background:var(--warn-soft);color:var(--warn);border-color:color-mix(in srgb,var(--warn) 30%,transparent)}
.text-danger{color:var(--crit)}
.text-muted{color:var(--ink-3)}
.form-text{font-size:11px;color:var(--ink-3);margin-top:4px}
.form-label{display:block;font-size:11.5px;color:var(--ink-2);font-weight:500;margin-bottom:5px}
.form-check{display:flex;align-items:center;gap:6px}
.form-select,.form-control{font:inherit;font-size:12.5px;padding:7px 9px;border-radius:var(--r-m);border:1px solid var(--line-2);background:var(--surface);color:var(--ink);width:100%}
.form-control:focus,.form-select:focus{border-color:var(--brand);outline:none;box-shadow:0 0 0 3px var(--brand-soft)}
.form-check-input{accent-color:var(--brand);width:15px;height:15px;margin:0}
.form-check-label{font-size:12.5px;color:var(--ink-2)}
.text-success{color:var(--pos)}

/* ---------- Bootstrap-vocabulary compatibility shim ----------
   The 7 admin/auth pages already use Bootstrap's class names (btn-primary, form-control,
   card-body, the row/col grid, h4/h5 sizing utilities, mt-*/mb-* spacing). Rather than touch
   every page's markup, these classes are themed here to draw from the same tokens as the
   .btn/.card/.pill vocabulary above — visually there is now no Bootstrap default left
   anywhere; only the class *names* on these specific pages still read as Bootstrap's. */
.btn-primary{background:var(--brand);border-color:var(--brand);color:var(--on-brand)}
.btn-primary:hover{background:var(--brand-d);border-color:var(--brand-d)}
.btn-outline-primary{color:var(--brand-d);border-color:var(--brand)}
.btn-outline-primary:hover{background:var(--brand-soft)}
.btn-outline-danger{color:var(--crit);border-color:var(--crit)}
.btn-outline-danger:hover{background:var(--crit-soft)}
.btn-outline-success{color:var(--pos);border-color:var(--pos)}
.btn-outline-success:hover{background:var(--pos-soft)}
.btn-sm{padding:4px 9px;font-size:11.5px}
.btn-ghost{background:none;border-color:transparent}
.d-inline{display:inline-block}

.card-body{padding:16px}
.card-title{font-size:15px;margin-bottom:4px}

.h4{font-family:var(--display);font-weight:600;font-size:18px}
.h5{font-family:var(--display);font-weight:600;font-size:15px}
.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:20px}
.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:20px}

.row{display:flex;flex-wrap:wrap;gap:10px;margin:0}
.row.g-2{gap:10px}
.row.g-1{gap:5px}
/* .row's vertical counterpart — several pages pair it with an inline style="gap:Npx" expecting
   flex-column spacing between stacked sections; this class was referenced everywhere but never
   actually defined, so every "gap" on it was silently inert (gap only applies to flex/grid). */
.stack{display:flex;flex-direction:column;margin:0}
.col-auto{flex:0 0 auto}
.col{flex:1 1 220px;min-width:0}
.align-items-end{align-items:flex-end}
.justify-content-end{justify-content:flex-end}

/* Bare <table> (no .dt class) gets the same treatment as table.dt, so the pages that never
   opted into the .tablewrap/.dt convention still render consistently with it. */
table{width:100%;border-collapse:collapse;font-size:12.5px}
table thead{background:var(--surface-2)}
table th{text-align:left;font-size:10.5px;letter-spacing:.05em;text-transform:uppercase;color:var(--ink-3);font-weight:700;padding:9px 11px;border-bottom:1px solid var(--line)}
table td{padding:8px 11px;border-bottom:1px solid var(--line);vertical-align:middle}
table tbody tr:hover td{background:var(--surface-2)}

/* Click-to-sort, applied automatically by site.js to every <table> on the page — no per-page
   markup or class needed, so a table a developer adds later gets this for free. th.sort-asc/
   sort-desc mark the active column; .sort-ind is the caret, hidden until that state applies. */
table th.sortable-col{cursor:pointer;user-select:none}
table th.sortable-col:hover{color:var(--ink)}
table th .sort-ind{display:inline-block;width:9px;margin-left:3px;opacity:.35;font-size:9px}
table th.sort-asc .sort-ind,table th.sort-desc .sort-ind{opacity:1;color:var(--brand-d)}

/* responsive shell */
@media (max-width:920px){
  .shell{grid-template-columns:1fr}
  .sidebar{position:fixed;top:0;bottom:0;left:0;width:260px;z-index:70;transform:translateX(-100%);transition:transform .2s ease}
  .sidebar.open{transform:none;box-shadow:var(--shadow-2)}
  .hamb{display:block}
  .view{padding:16px 16px 48px}
  .topbar{padding:10px 16px}
}
@media (max-width:520px){
  .pagehead h1{font-size:21px}
  .headactions{width:100%;margin-left:0}
  .kpi .v{font-size:22px}
  .kpi::before{width:34px;height:34px;font-size:15px}
}
