/* Sentinel Pulse components and layout. Colours, type scale and radii come from tokens.css. */
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/geist-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/geist-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--foreground); background: var(--sidebar); font-size: var(--fs-base); line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-color: color-mix(in oklch, currentColor 35%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus); border-radius: 6px; }
h1 { font-size: var(--fs-xl); line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 .25rem; color: var(--primary); }
h2 { font-size: var(--fs-lg); line-height: 1.35; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-md); font-weight: 600; margin: 1rem 0 .5rem; }
code { background: var(--secondary); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
.skip { position: absolute; left: -999px; top: 0; background: var(--background); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.num, .money { font-variant-numeric: tabular-nums; }
.hp { position: absolute; left: -5000px; }
svg.i { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }

/* app shell: sidebar + inset panel */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side-collapsed .app { grid-template-columns: var(--side-w-icon) minmax(0, 1fr); }
.sidenav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: var(--foreground); }
.dev-banner ~ .app .sidenav { height: calc(100vh - 2rem); top: 2rem; }
.dev-banner ~ .app .topbar { top: 2rem; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; height: 4.5rem; padding: 0 1rem; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--foreground); min-width: 0; }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; object-fit: contain; flex-shrink: 0; box-shadow: 0 0 0 1px var(--border); background: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.015em; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .6875rem; color: var(--muted); letter-spacing: .02em; white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: .5rem; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; position: relative; flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--foreground); }
.side-collapse svg { transition: transform .2s; }
.side-scroll { flex: 1; overflow-y: auto; padding: .25rem 1rem .75rem 1.25rem; scrollbar-width: none; }
.side-scroll::-webkit-scrollbar { display: none; }
.nav-section { margin-bottom: .5rem; }
.nav-title { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .5rem .5rem .35rem; margin: 0; user-select: none; }
.nav-title::-webkit-details-marker { display: none; }
.nav-title:hover { color: var(--foreground); }
.nav-title.static { cursor: default; }
.nav-title .chev { width: 1rem; height: 1rem; transition: transform .2s; }
details[open] > .nav-title .chev { transform: rotate(90deg); }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav li a { position: relative; display: flex; align-items: center; gap: .625rem; height: 2.5rem; padding: 0 .5rem 0 .625rem; border-radius: .5rem; text-decoration: none; color: color-mix(in oklch, var(--foreground) 82%, transparent); font-size: var(--fs-base); white-space: nowrap; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.sidenav li a svg { color: var(--muted); transition: color var(--dur) var(--ease); }
.sidenav li a span { overflow: hidden; text-overflow: ellipsis; }
.sidenav li a:hover { color: var(--foreground); background: var(--hover); }
.sidenav li a[aria-current="page"] { color: var(--primary); font-weight: 600; background: var(--secondary); }
.sidenav li a[aria-current="page"] svg { color: var(--sentinel-link); }
.sidenav li a[aria-current="page"]::before { content: ""; position: absolute; left: -.5rem; top: .5rem; bottom: .5rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--sentinel-accent); }
/* sub-pages: a branch under the open item */
.sidenav li a[aria-current="true"] { color: var(--primary); font-weight: 600; }
.nav-branch { position: relative; margin: 0 0 .25rem 1.4rem !important; padding-left: .5rem !important; border-left: 1px solid var(--border); }
.nav-branch li a { height: 2.1rem; font-size: var(--fs-sm); padding-left: .5rem; }
.nav-branch li a[aria-current="page"]::before { display: none; }
.side-collapsed .nav-branch { display: none; }
.crumb-section { font-size: .95rem; color: var(--muted); white-space: nowrap; margin-left: -.5rem; }
/* on-this-page outline */
.outline { margin: -.5rem 0 1rem; font-size: .9rem; }
.outline > summary { cursor: pointer; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: .35rem; padding: .2rem 0; user-select: none; }
.outline > summary::-webkit-details-marker { display: none; }
.outline > summary:hover { color: var(--foreground); }
.outline ul { list-style: none; margin: .25rem 0 0 .35rem; padding: 0 0 0 .75rem; border-left: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: .1rem 1.25rem; }
.outline a { display: inline-block; padding: .2rem 0; color: var(--muted); text-decoration: none; }
.outline a:hover { color: var(--foreground); text-decoration: underline; }
/* site map */
.sitemap { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; align-items: start; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree > li { padding: .3rem 0; }
.tree > li > a { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--foreground); font-weight: 500; }
.tree > li > a svg { width: 1rem; height: 1rem; color: var(--muted); }
.tree ul { margin: .15rem 0 .1rem .5rem; padding-left: 1.1rem; border-left: 1px solid var(--border); }
.tree ul li { position: relative; padding: .15rem 0; }
.tree ul li::before { content: ''; position: absolute; left: -1.1rem; top: .9em; width: .8rem; border-top: 1px solid var(--border); }
.tree ul a { color: var(--muted); text-decoration: none; }
.tree a:hover { color: var(--foreground); text-decoration: underline; }
.tree-note { margin: .15rem 0 0 1.5rem; color: var(--muted); }
@media print { .outline { display: none; } }
.side-foot { padding: .5rem 1rem 1rem; flex-shrink: 0; }
.account { position: relative; }
.account > summary { display: flex; align-items: center; gap: .625rem; list-style: none; cursor: pointer; padding: .4rem .25rem; border-radius: .5rem; color: var(--foreground); }
.account > summary::-webkit-details-marker { display: none; }
.account > summary:hover { background: var(--hover); }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; background: var(--secondary); border: 1px solid var(--border); font-size: .75rem; font-weight: 600; flex-shrink: 0; }
.acct-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.acct-name { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-role { font-size: .75rem; color: var(--muted); }
.menu { position: absolute; bottom: calc(100% + .4rem); left: 0; width: 14rem; background: var(--background); border: 1px solid var(--border); border-radius: .6rem; box-shadow: 0 8px 24px oklch(0 0 0 / 12%); padding: .3rem; z-index: 30; }
.menu form { margin: 0; }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .625rem; border: 0; border-radius: .4rem; background: none; color: var(--foreground); font: inherit; font-size: .9rem; text-decoration: none; cursor: pointer; text-align: left; }
.menu-item svg { width: 1rem; height: 1rem; color: var(--muted); }
.menu-item:hover { background: var(--hover); }
.menu-item.danger, .menu-item.danger svg { color: var(--red); }
.when-dark { display: none !important; }
:root[data-theme="dark"] .when-dark { display: inline-flex !important; } :root[data-theme="dark"] .when-light { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .when-dark { display: inline-flex !important; } :root:not([data-theme="light"]) .when-light { display: none !important; } }

.side-collapsed .brand-text, .side-collapsed .nav-title, .side-collapsed .sidenav li a span, .side-collapsed .acct-text { display: none; }
.side-collapsed .side-head { flex-direction: column; justify-content: center; height: auto; padding: 1rem 0 .5rem; gap: .5rem; }
.side-collapsed .side-collapse svg { transform: rotate(180deg); }
.side-collapsed .side-scroll, .side-collapsed .side-foot { padding-left: .75rem; padding-right: .75rem; }
.side-collapsed .nav-section { margin-bottom: .5rem; }
.side-collapsed .nav-section:not([open]) > ul { display: block; }
.side-collapsed .sidenav li a { justify-content: center; padding: 0; height: 3.125rem; }
.side-collapsed .sidenav li a[aria-current="page"] { background: var(--hover); }
.side-collapsed .account > summary { justify-content: center; }

.panel { min-width: 0; display: flex; flex-direction: column; background: var(--background); margin: .5rem .5rem .5rem 0; border-radius: .75rem; box-shadow: 0 0 0 1px var(--border); min-height: calc(100vh - 1rem); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; height: 4.5rem; padding: 0 1.5rem; background: var(--background); border-radius: .75rem .75rem 0 0; }
.crumb { display: flex; align-items: flex-end; gap: 1rem; min-width: 0; margin-right: auto; }
.crumb > svg { width: 1rem; height: 1rem; align-self: center; }
.crumb-title { font-size: var(--fs-lg); font-weight: 600; color: var(--primary); white-space: nowrap; margin-left: -.25rem; }
.crumb-meta { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--muted); white-space: nowrap; padding-bottom: .15rem; }
.dot { width: .375rem; height: .375rem; border-radius: 999px; background: var(--muted); }
.top-search { position: relative; display: flex; align-items: center; width: 20rem; max-width: 36vw; height: 2.5rem; background: var(--card); border: 1px solid var(--border); border-radius: .5rem; padding: 0 .5rem 0 .625rem; }
.top-search .s-ico { width: .8rem; height: .8rem; color: var(--muted); }
.top-search input { flex: 1; border: 0; background: transparent; min-height: 0; height: 100%; padding: 0 .4rem; font-size: .8rem; box-shadow: none; }
.top-search input:focus-visible { box-shadow: none; }
.top-search:focus-within { box-shadow: var(--focus); }
.kbd { display: inline-flex; align-items: center; height: 1.5rem; padding: 0 .4rem; border-radius: .375rem; background: var(--background); color: var(--muted); font: inherit; font-size: .72rem; }
.top-search input:not(:placeholder-shown) + .kbd { display: none; }
.bell svg { width: 1.15rem; height: 1.15rem; }
.bell .count { position: absolute; top: .2rem; right: .1rem; background: oklch(0.5 0.2 27); color: #fff; font-size: .65rem; font-weight: 600; line-height: 1.1rem; min-width: 1.1rem; text-align: center; border-radius: 999px; padding: 0 .25rem; }
.nav-toggle { display: none; }
.main { padding: .5rem 1.5rem 3rem; max-width: 1320px; width: 100%; min-width: 0; }
.main.wide { max-width: none; }
.shell-public { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--sidebar); }
.shell-public .main { max-width: 440px; padding: 0; }

/* page */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin: .5rem 0 1.25rem; }
.page-head .sub { margin: .2rem 0 0; color: var(--muted); max-width: 70ch; }
.page-head .small a { color: var(--muted); text-decoration: none; }
.page-head .small a:hover { color: var(--foreground); }
.page-actions, .btn-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.page-actions-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* cards: soft fill, no border, like Medesk */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem 1rem .25rem; }
.card-head h2 { font-size: var(--fs-md); line-height: 1.5rem; }
.card-actions { display: flex; gap: .5rem; align-items: center; font-size: .875rem; font-weight: 500; color: color-mix(in oklch, var(--foreground) 80%, transparent); }
.card-body { padding: .75rem 1rem 1rem; }
.card > .card-body:first-child { padding-top: 1rem; }
form.card { padding: 1rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 1rem; }
.cols > *, .dash-grid > * { min-width: 0; }
.cols > .card { margin-bottom: 0; }
.cols { margin-bottom: 1rem; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: 1rem; }
.dash-grid > .card { margin: 0; }
.narrow { max-width: 480px; }

/* stats: big numbers, quiet labels, coloured tick */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card .stats:last-child { margin-bottom: 0; }
.stat { position: relative; display: flex; flex-direction: column; gap: .35rem; padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; }
.card .stat { background: var(--background); box-shadow: var(--shadow); }
.stat::before { content: ""; position: absolute; left: 1rem; top: 1.15rem; width: .5rem; height: .5rem; border-radius: 2px; background: var(--muted); opacity: .5; }
.stat-label { font-size: var(--fs-sm); color: var(--muted); padding-left: 1rem; order: 0; }
.stat-value { font-size: var(--fs-kpi); line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; color: var(--foreground); font-variant-numeric: tabular-nums; order: 1; }
.stat-sub { font-size: .78rem; color: var(--muted); order: 2; }
a.stat:hover { background: var(--hover); }
.card a.stat:hover { background: color-mix(in oklch, var(--background) 92%, var(--foreground)); }
.stat.tone-ok::before { background: var(--green); opacity: 1; } .stat.tone-warn::before { background: var(--amber); opacity: 1; }
.stat.tone-bad::before { background: var(--red); opacity: 1; } .stat.tone-info::before { background: var(--blue); opacity: 1; }
.stat.tone-bad .stat-value { color: var(--bad); }

/* badges: tinted pills */
.badge { display: inline-flex; align-items: center; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; line-height: 1.25rem; font-weight: 500; white-space: nowrap; }
.tone-ok.badge { background: var(--ok-bg); color: var(--ok); } .tone-warn.badge { background: var(--warn-bg); color: var(--warn); }
.tone-bad.badge { background: var(--bad-bg); color: var(--bad); } .tone-info.badge { background: var(--info-bg); color: var(--info); }
.tone-muted.badge { background: var(--secondary); color: var(--muted); }
.alert { padding: .75rem 1rem; border-radius: .6rem; margin: 0 0 1rem; border: 0; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alert-success, .alert-ok { background: var(--ok-bg); color: var(--foreground); box-shadow: inset 3px 0 0 var(--green); }
.alert-error { background: var(--bad-bg); color: var(--foreground); box-shadow: inset 3px 0 0 var(--red); }
.alert-warn { background: var(--warn-bg); color: var(--foreground); box-shadow: inset 3px 0 0 var(--amber); }
.alert-info { background: var(--info-bg); color: var(--foreground); box-shadow: inset 3px 0 0 var(--blue); }
.flag { color: var(--bad-ink); font-weight: 500; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.5rem; padding: .45rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--input); background: var(--background); color: var(--foreground); font: inherit; font-size: var(--fs-base); font-weight: 500; text-decoration: none; cursor: pointer; line-height: 1.2; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 60ms; }
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--secondary); color: var(--foreground); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); font-weight: 600; }
.btn-primary:hover { background: var(--sentinel-blue-hover); border-color: var(--sentinel-blue-hover); color: var(--primary-fg); }
.btn-danger { border-color: color-mix(in oklch, var(--bad) 45%, transparent); color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { min-height: 2.125rem; padding: .25rem .7rem; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input { max-width: 16rem; }
.inline-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .25rem 0; }
.inline-row input:not([type=checkbox]) { max-width: 18rem; }
details.inline-details summary { cursor: pointer; color: var(--muted); font-size: .875rem; }
details.inline-details summary:hover { color: var(--foreground); }
details.inline-details[open] summary { margin-bottom: .5rem; }

/* forms */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain { display: contents; }
.group { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin-bottom: 1rem; }
.card .group { background: var(--background); }
.group > legend { font-weight: 500; padding: .75rem 0 0; float: left; width: 100%; margin-bottom: .5rem; }
.group > legend + * { clear: both; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.wide { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: var(--fs-sm); color: var(--foreground); }
.req { color: var(--bad); }
input, select, textarea { font: inherit; font-size: var(--fs-base); color: inherit; padding: .5rem .7rem; border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--background); width: 100%; min-height: 2.5rem; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
input:hover, select:hover, textarea:hover { border-color: var(--ring); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--ring); }
input[disabled], select[disabled], textarea[disabled] { background: var(--secondary); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 1.1rem; height: 1.1rem; min-height: 0; accent-color: var(--primary); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.hint { margin: 0; font-size: .8rem; color: var(--muted); }
.error { margin: 0; font-size: var(--fs-sm); color: var(--bad); font-weight: 500; }
.field-check { flex-direction: row; align-items: center; gap: .5rem; }
.field-check .hint, .field-check .error { flex-basis: 100%; }
.check-inline { display: inline-flex; align-items: center; gap: .3rem; font-weight: 500; }
.money-input { display: flex; align-items: center; }
.money-input span { padding: .45rem .6rem; background: var(--secondary); border: 1px solid var(--input); border-right: 0; border-radius: .5rem 0 0 .5rem; color: var(--muted); min-height: 2.375rem; display: inline-flex; align-items: center; }
.money-input input { border-radius: 0 .5rem .5rem 0; text-align: right; font-variant-numeric: tabular-nums; }
.readonly-val { margin: 0; padding: .5rem 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.w-sm { max-width: 6rem; }
.time-pair { display: flex; gap: .3rem; }
.time-pair input { min-width: 6.5rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: .75rem; }
.reason-box { background: var(--warn-bg); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; background: var(--card); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filter-details > summary { display: none; list-style: none; margin-bottom: .5rem; }
.filter-details > summary::-webkit-details-marker { display: none; }
.filter-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.form-with-summary { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.summary { position: sticky; top: 5rem; padding: 1rem; }
.summary h2 { margin-bottom: .5rem; }
.upload-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-top: .75rem; }
.upload-form .field { flex: 1 1 260px; }

/* tables: quiet header, hairline rows, hover tint */
.table-wrap { position: relative; overflow-x: auto; scrollbar-width: thin; }
.card .table-wrap { margin: 0 -1rem; }
.card .table-wrap table th:first-child, .card .table-wrap table td:first-child { padding-left: 1rem; }
.card .table-wrap table th:last-child, .card .table-wrap table td:last-child { padding-right: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .65rem .75rem; border-top: 1px solid color-mix(in oklch, var(--border) 70%, transparent); vertical-align: top; }
thead th { border-top: 0; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: .6rem; padding-bottom: .6rem; white-space: nowrap; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.changed td { background: var(--warn-bg); }
tfoot th, tfoot td, tr.strong th, tr.strong td { font-weight: 600; }
.calc-table th { font-weight: 400; }
.calc-table .sign { display: inline-block; width: 1em; color: var(--muted); }
.denoms input { max-width: 7rem; }
.empty { color: var(--muted); margin: .25rem 0; }
.empty-state { text-align: center; padding: 2rem; color: var(--muted); }
ul.changes { margin: 0; padding-left: 1rem; }
del { color: var(--red); } ins { color: var(--ok); text-decoration: none; font-weight: 600; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1.25rem; margin: 0; }
.dl div { border-bottom: 1px dashed var(--border); padding-bottom: .45rem; }
.dl dt { font-size: .8rem; color: var(--muted); }
.dl dd { margin: .1rem 0 0; font-weight: 500; }
.dl.tight { grid-template-columns: 1fr; }
.dl .total dd { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.pager, .table-pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; }
.tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; padding: .25rem; background: var(--secondary); border-radius: .6rem; }
.page-actions .tabs { margin: 0; }
.tabs a { padding: .4rem .85rem; border-radius: .45rem; text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 500; }
.tabs a:hover { color: var(--foreground); }
.tabs a[aria-current="page"] { background: var(--background); color: var(--foreground); box-shadow: 0 1px 2px oklch(0 0 0 / 8%); }

/* checklist, timeline */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 2rem 1fr; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.check-icon { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; font-weight: 800; }
.checklist .ok .check-icon { background: var(--ok-bg); color: var(--ok); }
.checklist .warn .check-icon { background: var(--warn-bg); color: var(--warn); }
.checklist .bad .check-icon { background: var(--bad-bg); color: var(--red); }
.timeline { margin: 0; padding-left: 1.2rem; }
.timeline li { margin-bottom: .5rem; }
.action-list { margin: 0; padding-left: 1.2rem; }
.action-list li { margin: .25rem 0; }
.guide li { margin-bottom: .5rem; }
.attachments { padding-left: 1.2rem; margin: 0; }
.comments { list-style: none; padding: 0; }
.comments li { padding: .5rem 0; border-bottom: 1px solid var(--line); }

/* meters */
.meter-wrap { display: inline-flex; align-items: center; gap: .4rem; min-width: 140px; }
progress { width: 100px; height: .7rem; accent-color: var(--brand); }
.meter-num { font-size: .8rem; font-variant-numeric: tabular-nums; }

/* task board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 1rem; overflow-x: auto; }
.board-col { background: var(--card); border-radius: var(--radius); padding: .75rem; }
.board-col h2 { font-size: .95rem; margin-bottom: .5rem; }
.task-card { background: var(--background); border-radius: .6rem; padding: .75rem; margin-bottom: .6rem; }
.task-card.overdue { border-left: 4px solid var(--bad); }
.task-card h3 { margin: 0 0 .25rem; font-size: .95rem; }
.task-card p { margin: 0 0 .4rem; }

/* login & survey */
.login-card { background: var(--background); padding: 2rem; border-radius: 1rem; border: 1px solid var(--border); }
.login-card h1 { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; color: var(--foreground); }
.login-card .brand-mark { background: var(--brand); color: #fff; }
.survey-body { background: var(--sidebar); }
.survey { max-width: 640px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.survey h1 { color: var(--foreground); }
.rating { background: var(--background); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .75rem; }
.rating legend { font-weight: 600; padding: 0; margin-bottom: .5rem; float: left; width: 100%; }
.rating.has-error { border-color: var(--bad); }
.rating-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; clear: both; }
.rating-options.nps { grid-template-columns: repeat(11, 1fr); }
.rating-opt { position: relative; }
.rating-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.rating-opt span { display: flex; flex-direction: column; align-items: center; padding: .5rem .2rem; border: 1px solid var(--input); border-radius: .5rem; text-align: center; min-height: 3rem; justify-content: center; }
.rating-opt small { font-size: .65rem; color: var(--muted); }
.rating-opt input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.rating-opt input:checked + span small { color: var(--primary-fg); }
.rating-opt input:focus-visible + span { box-shadow: var(--focus); }
.qr-wrap { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.qr svg { width: 180px; height: 180px; background: var(--background); }

/* receipts & print */
.receipt { max-width: 560px; background: var(--background); padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); }
.receipt header h1 { font-size: 1.2rem; margin: 0; }
.receipt header p { margin: 0; color: var(--muted); font-size: .85rem; }
.receipt h2 { margin: 1rem 0; }
.receipt-lines { margin: 1rem 0; }
.signatures { display: flex; gap: 2rem; margin-top: 2rem; }
.print-only { display: none; }

@media (max-width: 900px) {
  .app, .side-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-grid; margin-left: -.5rem; }
  .dev-banner { position: static; font-size: .78rem; }
  .dev-banner ~ .app .topbar { top: 0; }
  .sidenav { position: fixed; inset: 0 auto 0 0; width: min(var(--side-w), 86vw); height: 100vh; z-index: 50; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px oklch(0 0 0 / 25%); }
  .side-collapse { display: none; }
  .side-collapsed .brand-text, .side-collapsed .nav-title, .side-collapsed .sidenav li a span, .side-collapsed .acct-text { display: revert; }
  .nav-open .sidenav { transform: none; }
  .nav-open body::after { content: ""; position: fixed; inset: 0; background: oklch(0 0 0 / 35%); z-index: 45; }
  .panel { margin: 0; border-radius: 0; min-height: 100vh; }
  .topbar { padding: 0 1rem; gap: .5rem; border-radius: 0; height: 3.75rem; }
  .crumb-meta { display: none; }
  .top-search { width: auto; flex: 1; max-width: 16rem; }
  .kbd { display: none; }
  .main { padding: .25rem 1rem 2rem; }
  .form-with-summary { grid-template-columns: 1fr; }
  .summary { position: static; }
  .dash-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 80vw); }
}
@media (max-width: 640px) {
  .table-wrap table:not(.denoms):not(.calc-table):not(.sched) thead { display: none; }
  .table-wrap table:not(.denoms):not(.calc-table):not(.sched) tr { display: block; border-top: 1px solid var(--border); padding: .5rem 0; }
  .table-wrap table:not(.denoms):not(.calc-table):not(.sched) td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem .4rem; text-align: right; }
  .table-wrap table:not(.denoms):not(.calc-table):not(.sched) td::before { content: attr(data-label); font-weight: 500; color: var(--muted); text-align: left; }
  .table-wrap table td[data-label=""]::before { content: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .rating-options.nps { grid-template-columns: repeat(6, 1fr); }
  h1 { font-size: 1.3rem; }
  .filters .field { max-width: none; }
  .filter-details > summary { display: inline-flex; }
}
@media print {
  .topbar, .sidenav, .no-print, .filters, .btn, .skip, form, .dev-banner { display: none !important; }
  .app { display: block; } .panel { margin: 0; }
  .main { padding: 0; max-width: none; }
  body { background: var(--background); font-size: 11pt; }
  .card { break-inside: avoid; border: 1px solid #999; background: #fff; }
  .print-only { display: block; }
  .receipt { border: 0; }
  a { color: inherit; text-decoration: none; }
  thead { display: table-header-group; }
}

/* charts */
.trends { margin: 0 0 1.25rem; }
.trends-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.trends-head h2 { font-size: 1.15rem; }
.seg { display: inline-flex; gap: .2rem; padding: .25rem; border-radius: .6rem; overflow: hidden; background: var(--secondary); }
.seg a { padding: .35rem .8rem; text-decoration: none; color: var(--muted); font-size: .875rem; font-weight: 500; border-radius: .45rem; }

.seg a[aria-current] { background: var(--background); color: var(--foreground); box-shadow: 0 1px 2px oklch(0 0 0 / 8%); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 1rem; }
.chart-grid > .card { margin: 0; min-width: 0; }
.ch-title { font-size: 1rem; margin: 0; }
.chart-card .card-head p { margin: .1rem 0 0; }
.chart { margin: 0; }
.ch-wrap { position: relative; }
.ch-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.ch-label { font-size: 11px; fill: var(--foreground); font-weight: 600; }
.ch-hit { cursor: crosshair; outline: none; }
.ch-hit:focus-visible { stroke: var(--ring); stroke-width: 2; }
.ch-legend { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0 0 .4rem; padding: 0; font-size: .82rem; color: var(--muted); }
.ch-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.ch-tip { position: absolute; pointer-events: none; background: var(--background); border: 1px solid var(--border); border-radius: .5rem; box-shadow: 0 4px 12px oklch(0 0 0 / 12%); color: var(--foreground); padding: .45rem .6rem; font-size: .8rem; min-width: 150px; z-index: 5; }
.ch-tip .tt-h { color: var(--muted); margin-bottom: .2rem; }
.ch-tip .tt-r { display: flex; align-items: center; gap: .4rem; justify-content: space-between; }
.ch-tip .tt-r b { font-variant-numeric: tabular-nums; color: var(--foreground); }
.ch-tip .tt-k { display: inline-block; width: 12px; height: 2px; border-radius: 1px; margin-right: .3rem; vertical-align: middle; }
.ch-table summary { cursor: pointer; font-size: .82rem; color: var(--brand-dark); margin-top: .4rem; }
@media print { .ch-tip { display: none; } .ch-table[open] { display: block; } }

/* accounting */
.neg { color: var(--red); font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); font-variant-numeric: tabular-nums; }
.num-input { text-align: right; font-variant-numeric: tabular-nums; min-width: 7rem; }
.stmt-review input:not([type=checkbox]) { min-height: 2.1rem; padding: .3rem .45rem; }
.stmt-review td { padding: .3rem .4rem; }
.journal-lines select { min-width: 16rem; }
.alloc-form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.alloc-form select { max-width: 20rem; }
.alloc-form input[name=note] { max-width: 14rem; }
.w-label { min-width: 12rem; font-weight: 600; }
.narrow-wide { max-width: 640px; }
.afs { background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 2rem; position: relative; }
.afs-watermark { position: sticky; top: 4rem; text-align: center; font-weight: 800; letter-spacing: .1em; color: var(--bad); background: var(--bad-bg); border-radius: 6px; padding: .3rem; z-index: 2; }
.afs-cover { text-align: center; border-bottom: 2px solid var(--foreground); padding-bottom: 1rem; margin-bottom: 1rem; }
.afs-cover h1 { font-size: 1.6rem; color: var(--foreground); }
.afs-section { margin: 1.5rem 0; break-inside: avoid-page; }
.afs-section > h2 { font-size: 1.1rem; color: var(--brand-dark); border-bottom: 1px solid var(--line); padding-bottom: .3rem; margin-bottom: .6rem; }
.afs-table { max-width: 760px; }
.afs-table th[scope=row] { font-weight: 400; }
.afs-heading th { font-size: 1rem; text-transform: none; letter-spacing: 0; padding-top: .9rem; }
.afs-sub th { font-style: italic; font-weight: 600 !important; }
.afs-total th, .afs-total td { font-weight: 700 !important; border-top: 1px solid #555; }
.afs-grand td { border-bottom: 3px double #555; }
.afs-note h3 { font-size: .98rem; margin-top: 1.2rem; }
details.card > summary { cursor: pointer; list-style: none; }
@media print { .afs { border: 0; padding: 0; } .afs-watermark { position: static; } }

/* logo */
.login-logo { display: block; width: 96px; height: 96px; margin: 0 auto .5rem; border-radius: 18px; }
.login-card h1 { justify-content: center; text-align: center; }
.login-card .sub { text-align: center; }
.survey-logo { display: block; width: 72px; height: 72px; margin: 0 auto .5rem; border-radius: 14px; }
.survey h1, .survey > .sub { text-align: center; }
.receipt-logo { float: right; width: 56px; height: 56px; border-radius: 10px; }

/* development sign-in */
.dev-banner { position: sticky; top: 0; z-index: 40; min-height: 2rem; line-height: 1.3rem; background: var(--warn-bg); color: var(--foreground); border-bottom: 1px solid color-mix(in oklch, var(--amber) 35%, transparent); padding: .35rem 1rem; font-size: .85rem; text-align: center; }
.linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.dev-roles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.dev-roles { display: grid; gap: .75rem; }
.dev-role-name { margin: 0 0 .3rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dev-role form + form { margin-top: .35rem; }
.login-card { max-width: 440px; }

/* month-end */
.monthend { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .monthend { grid-template-columns: 1fr; } }
.check-items { margin-top: .3rem; }
.check-items summary { cursor: pointer; font-size: .85rem; color: var(--foreground); }
.check-items ul { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .88rem; }
.check-items li { margin: .2rem 0; }
.checklist .inline-form { margin-left: .4rem; }
.pack-list { padding-left: 0; list-style: none; margin: 0; }
.pack-list > li { margin-bottom: .6rem; }
.pack-list ul { padding-left: 1.1rem; margin: .2rem 0; font-size: .9rem; }
.checklist .check-items li { display: list-item; border: 0; padding: .15rem 0; grid-template-columns: none; }
.checklist .check-items .inline-form { margin-left: .5rem; vertical-align: middle; }
.flag-list { color: var(--bad-ink); margin: .5rem 0 1rem; padding-left: 1.2rem; }

/* dashboard: what needs doing, before any figures */
.attention { margin: 0 0 1.25rem; }
.attention h2 { font-size: 1rem; margin: 0 0 .5rem; }
.attention ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: .6rem; }
.attention li a { display: flex; align-items: center; gap: .75rem; height: 100%; padding: .7rem .9rem; border: 1px solid var(--border); border-left-width: 4px; border-radius: .6rem; background: var(--card); color: var(--foreground); text-decoration: none; }
.attention li a:hover { background: var(--hover); }
.attention li strong { font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; min-width: 1.6ch; }
.attention li span { font-size: .92rem; line-height: 1.25; }
.attention .att-bad a { border-left-color: var(--bad); }
.attention .att-warn a { border-left-color: var(--warn); }
.attention .att-info a { border-left-color: var(--info); }
.attention-clear { margin: 0 0 1.25rem; padding: .6rem .9rem; border-radius: .6rem; background: var(--ok-bg); color: var(--ok); }

/* pin a menu link to the top */
.sidenav li { position: relative; }
.pin-btn { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); display: none; width: 1.75rem; height: 1.75rem; place-items: center; border: 0; border-radius: .4rem; background: none; color: var(--muted); cursor: pointer; }
.sidenav li:hover > .pin-btn, .pin-btn:focus-visible, .pin-btn[aria-pressed="true"] { display: grid; }
.pin-btn[aria-pressed="true"] { color: var(--foreground); }
.pin-btn:hover { background: var(--hover); color: var(--foreground); }
.nav-branch .pin-btn { display: none !important; }
.side-collapsed .pin-btn { display: none !important; }
.nav-section.pinned .pin-btn { display: none !important; }
@media (hover: none) { .sidenav li > .pin-btn { display: grid; opacity: .6; } }

/* status is never colour alone: each tone also carries a mark (decorative, not read aloud) */
.badge.tone-ok::before, .badge.tone-warn::before, .badge.tone-bad::before, .badge.tone-info::before { font-size: .72em; margin-right: .35em; font-weight: 700; }
.badge.tone-ok::before { content: "✓" / ""; }
.badge.tone-warn::before { content: "!" / ""; }
.badge.tone-bad::before { content: "✕" / ""; }
.badge.tone-info::before { content: "●" / ""; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .6rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: baseline; gap: .6rem; }

/* long lists keep their column headings in view while scrolling (phones switch to stacked rows instead) */
@media (min-width: 641px) {
  .table-wrap.long { max-height: 70vh; overflow: auto; }
  .table-wrap.long thead th { position: sticky; top: 0; z-index: 2; background: var(--background); box-shadow: 0 1px 0 var(--border); }
  .card .table-wrap.long thead th { background: var(--card); }
}
/* an empty list says so plainly instead of looking broken */
.card-body > p.empty, .table-wrap + p.empty { padding: 1.25rem 1rem; text-align: center; border: 1px dashed var(--border); border-radius: .6rem; }
.card-body > p.empty { margin: .25rem 0; }

/* clock-in kiosk: big targets for a shared tablet */
.shell-public.kiosk { place-items: start center; padding: 1.5rem 1rem; }
.shell-public.kiosk .main { max-width: 70rem; width: 100%; }
.kiosk-wrap { width: 100%; }
.kiosk-wrap.narrow { max-width: 30rem; margin: 2rem auto; }
.kiosk-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; }
.kiosk-head h1, .kiosk-wrap h1 { margin: 0; font-size: 2rem; }
.kiosk-sub { color: var(--muted); font-size: 1.2rem; margin: .25rem 0 1rem; }
.kiosk-help { font-size: 1.15rem; margin: 0 0 1rem; }
.kiosk-search input { width: 100%; font-size: 1.15rem; padding: .8rem 1rem; }
.kiosk-grid { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.kiosk-tile { position: relative; display: flex; flex-direction: column; justify-content: center; gap: .15rem; min-height: 5.25rem; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: .75rem; background: var(--card); color: var(--foreground); text-decoration: none; }
.kiosk-tile:hover, .kiosk-tile:focus-visible { border-color: var(--foreground); }
.kt-name { font-size: 1.2rem; font-weight: 600; }
.kt-pos { color: var(--muted); font-size: .95rem; }
.kt-state { position: absolute; top: .6rem; right: .75rem; font-size: .85rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; }
.kiosk-tile.st-in .kt-state { background: var(--ok-bg); color: var(--ok); }
.kiosk-tile.st-done .kt-state { background: var(--secondary); color: var(--muted); }
.kiosk-foot { margin-top: 1.5rem; text-align: center; }
.kiosk-msg { font-size: 1.1rem; }
.kiosk-form .field label { font-size: 1.1rem; }
.pin-input { width: 100%; font-size: 2rem; letter-spacing: .5em; text-align: center; padding: .6rem; }
.btn-lg { font-size: 1.2rem; padding: .9rem 1.6rem; min-height: 3.25rem; }
.kiosk-done { text-align: center; }
.kiosk-big { font-size: 2.2rem; font-weight: 600; margin: .5rem 0; }
.kiosk-time { font-size: 3.5rem; font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; }
.pin-reveal { letter-spacing: .4em; font-variant-numeric: tabular-nums; }
ul.plain { list-style: none; margin: 0; padding: 0; }

/* ---- Sentinel components (design-system layer) ---- */

/* density: "Compact rows" in the account menu, remembered in this browser */
:root[data-density="compact"] th, :root[data-density="compact"] td { padding-top: .35rem; padding-bottom: .35rem; }
:root[data-density="compact"] table { font-size: var(--fs-sm); }
:root[data-density="compact"] .card-body { padding-top: .5rem; padding-bottom: .65rem; }

/* touch: every control is at least about 44 x 44 px */
@media (pointer: coarse) {
  .btn, .icon-btn, input:not([type=checkbox]):not([type=radio]), select, textarea, .menu-item { min-height: 2.75rem; }
  .btn-sm { min-height: 2.75rem; padding-left: .9rem; padding-right: .9rem; }
  .sidenav li a { height: 2.75rem; }
  .nav-branch li a { height: 2.5rem; }
  input[type=checkbox], input[type=radio] { width: 1.4rem; height: 1.4rem; }
  .icon-btn { width: 2.75rem; height: 2.75rem; }
}

/* feedback: thin progress line while a page loads or a form is sent */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; background: transparent; pointer-events: none; opacity: 0; transition: opacity var(--dur); }
.progress::after { content: ""; display: block; height: 100%; width: 35%; background: var(--sentinel-accent); border-radius: 0 3px 3px 0; animation: slide 1.1s var(--ease) infinite; }
html.is-loading .progress { opacity: 1; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 1rem; height: 1rem; border: 2px solid var(--primary-fg); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.btn-primary)[aria-busy="true"]::after { border-color: var(--foreground); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--secondary), var(--card), var(--secondary)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-sm); min-height: 1rem; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* confirmation dialog (replaces the browser's own confirm box) */
dialog.dlg { border: 1px solid var(--border); border-radius: var(--radius); background: var(--elevated); color: var(--foreground); box-shadow: var(--shadow-pop); padding: 1.25rem 1.25rem 1rem; width: min(26rem, calc(100vw - 2rem)); }
dialog.dlg::backdrop { background: rgb(11 20 25 / 50%); }
dialog.dlg h2 { font-size: var(--fs-lg); margin-bottom: .5rem; }
dialog.dlg p { margin: 0 0 1rem; }
dialog.dlg .actions { justify-content: flex-end; }

/* toast: success messages fade away; errors stay until read */
.alert-success.is-toast { transition: opacity .4s, transform .4s; }
.alert-success.is-toast.gone { opacity: 0; transform: translateY(-4px); }

/* sortable tables */
.table-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin: 0 0 .5rem; }
.table-tools input[type=search] { max-width: 18rem; min-height: 2.25rem; }
.table-tools .count { color: var(--muted); font-size: var(--fs-sm); }
th[data-sortable] { cursor: pointer; user-select: none; }
th[data-sortable]:hover { color: var(--foreground); }
th[data-sortable]::after { content: ""; display: inline-block; margin-left: .35rem; width: .5rem; opacity: .35; }
th[aria-sort="ascending"]::after { content: "▲"; opacity: .9; font-size: .6rem; }
th[aria-sort="descending"]::after { content: "▼"; opacity: .9; font-size: .6rem; }
.pager, .table-pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 0 0; font-size: var(--fs-sm); color: var(--muted); }
.pager .btn, .table-pager .btn { min-height: 2.125rem; }

/* page header: the primary action sits on the right and stays first on small screens */
.page-head h1 { margin-bottom: .15rem; }
.context-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; background: var(--secondary); color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }

/* ---- sign-in ---- */
.shell-public.login-shell { display: block; place-items: normal; padding: 0; background: var(--background); }
.signin { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }
.dev-banner ~ .shell-public .signin { min-height: calc(100vh - 2rem); }
.signin-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: .25rem; padding: 3rem clamp(2rem, 5vw, 4.5rem); color: #eaf1fa; background: linear-gradient(160deg, #1d4e89 0%, #153a68 100%); }
.signin-mark { width: 5.25rem; height: 5.25rem; display: grid; place-items: center; background: #fff; border-radius: 1.25rem; box-shadow: 0 8px 28px rgb(0 0 0 / 28%); margin-bottom: 1.75rem; }
.signin-mark img { width: 4.5rem; height: 4.5rem; border-radius: 1rem; }
.signin-eyebrow { margin: 0; font-size: var(--fs-sm); letter-spacing: .1em; text-transform: uppercase; color: #a9cdf7; }
.signin-product { margin: 0; font-size: 2.5rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; color: #fff; }
.signin-brand h2 { margin: .5rem 0 1.75rem; font-size: var(--fs-lg); font-weight: 450; color: #d3e3f6; letter-spacing: 0; }
.signin-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; max-width: 26rem; position: relative; z-index: 1; }
.signin-points li { position: relative; padding-left: 1.6rem; color: #dce9f8; }
.signin-points li::before { content: ""; position: absolute; left: 0; top: .5em; width: .6rem; height: .6rem; border-radius: 0 70% 0 70%; background: #7db2f0; }
.signin-leaf { position: absolute; right: -9rem; bottom: -9rem; width: 24rem; height: 24rem; border-radius: 0 60% 0 60%; background: #4a90d9; opacity: .16; transform: rotate(-8deg); }
.signin-leaf::after { content: ""; position: absolute; inset: 3rem; border-radius: inherit; border: 2px solid #a9cdf7; opacity: .5; }
.signin-panel { display: grid; place-items: center; padding: 2rem 1.25rem; background: var(--background); }
.signin-box { width: 100%; max-width: 25rem; }
.signin-logo-sm { display: none; border-radius: .6rem; margin-bottom: 1rem; }
.signin-box h1 { font-size: var(--fs-2xl); margin-bottom: .25rem; }
.signin-box .sub { color: var(--muted); margin: 0 0 1.5rem; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 4.25rem; }
.pw-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); min-height: 2rem; padding: 0 .65rem; border: 0; border-radius: .35rem; background: transparent; color: var(--link); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.pw-toggle:hover { background: var(--hover); }
.signin-help { margin-top: 1.25rem; }
.demo-access { margin-top: 1.75rem; padding: .85rem 1rem; border: 1px dashed color-mix(in oklch, var(--warn) 55%, transparent); border-radius: var(--radius); background: var(--warn-bg); }
.demo-access > summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.demo-access .dev-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .75rem; margin-top: .5rem; }
.dev-role-name { margin: 0 0 .3rem; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dev-role form + form { margin-top: .35rem; }
.dev-role .btn { font-size: var(--fs-sm); text-align: center; }
@media (max-width: 860px) {
  .signin { grid-template-columns: 1fr; }
  .signin-brand { display: none; }
  .signin-panel { place-items: start center; padding: 2rem 1.25rem 3rem; }
  .signin-logo-sm { display: block; }
}

/* WCAG 2.2 target size: links in tables and lists are at least 24px tall */
main td a:not(.btn), main .action-list a, main a.small, main .checklist a, main .legend a { display: inline-block; padding-block: .2rem; }

/* narrow screens: nothing is allowed to push the page wider than the screen */
.stats { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.stat { min-width: 0; }
.stat-value { font-size: clamp(1.4rem, 3.2vw + .8rem, var(--fs-kpi)); overflow-wrap: anywhere; }
.seg { flex-wrap: wrap; max-width: 100%; }
table.sched { display: block; max-width: 100%; overflow-x: auto; }
.crumb { flex: 1 1 auto; }
.crumb-title { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 480px) { .crumb-section, .crumb-meta { display: none; } }
@media (max-width: 900px) { .record-layout, .workspace { grid-template-columns: minmax(0, 1fr); } }
.record-main, .ws-main, .result-main { min-width: 0; }
@media (max-width: 1180px) { .crumb-meta { display: none; } }

/* settings: choice cards */
.choice-group { border: 0; padding: 0; margin: 0 0 1.25rem; }
.choice-group > legend { font-weight: 600; margin-bottom: .5rem; padding: 0; }
.choice { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .9rem; margin-bottom: .5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); cursor: pointer; }
.choice:hover { border-color: var(--input); }
.choice:has(input:checked) { border-color: var(--sentinel-blue); box-shadow: inset 0 0 0 1px var(--sentinel-blue); background: var(--secondary); }
.choice input { margin-top: .2rem; flex-shrink: 0; }
.choice > span { display: flex; flex-direction: column; gap: .1rem; }
.leave-apply { margin: 1rem 0; padding: 1rem 0 .25rem; border-top: 1px solid var(--border); }
.leave-apply h3 { margin-top: 0; }
.gap { font-size: var(--fs-sm); }
.gap-ok { color: var(--ok); } .gap-warn { color: var(--warn); } .gap-bad { color: var(--bad); } .gap-muted { color: var(--muted); }
.choice-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.25rem; border: 0; padding: 0; margin: 0; }
.choice-row > legend { font-weight: 600; font-size: var(--fs-sm); padding: 0; width: 100%; margin-bottom: .2rem; }
.choice-row label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
.choice-row .hint { flex-basis: 100%; }

[id].card, h2[id], section[id] { scroll-margin-top: 5.5rem; }
.report-jump { margin: 0 0 1rem; }
.help-others { margin: 1rem 0; }
.help-others > summary { cursor: pointer; font-weight: 600; margin-bottom: .75rem; }

/* progressive enhancement */
.js-only { display: none !important; }
.js .js-only { display: inline-flex !important; }
.req-picker { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-top: .75rem; }
.req-picker .field:first-child { flex: 1 1 18rem; }
.receipt-lines input { min-width: 6rem; }
.label-like { margin: 0 0 .3rem; }

/* patient look-up */
.pl { position: relative; margin-top: .4rem; }
.pl-label { font-size: .8rem; font-weight: 500; color: var(--muted); }
.pl-list { position: absolute; z-index: 30; left: 0; right: 0; max-height: 18rem; overflow-y: auto; margin: .25rem 0 0; padding: .25rem; list-style: none; background: var(--background); border: 1px solid var(--border); border-radius: .6rem; box-shadow: 0 8px 24px oklch(0 0 0 / 12%); }
.pl-list li { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .6rem; border-radius: .4rem; cursor: pointer; }
.pl-list li span { font-size: .8rem; color: var(--muted); }
.pl-list li[aria-selected="true"], .pl-list li:hover { background: var(--hover); }
.pl-status { margin: .25rem 0 0; }
.pl-chosen:not(:empty) { margin-top: .3rem; padding: .35rem .6rem; border-radius: .4rem; background: var(--ok-bg); }

/* confirmation shown when the page keeps its scroll position after an action */
.alert.toast { position: fixed; z-index: 60; right: 1rem; bottom: 1rem; max-width: min(28rem, calc(100vw - 2rem)); margin: 0; box-shadow: 0 8px 24px oklch(0 0 0 / 18%); }
