/* KHR Workroom design standard. Rules: .claude/skills/workroom-design/SKILL.md
   Tokens + one look per component. Theme follows body[data-theme] or any [data-theme] container. */
:root,[data-theme="light"]{
 /* No pure white or black (UX rule 2): off-white page and surfaces, off-black text.
    Day-mode accents are a shade deeper than night so they hold up on light backgrounds (UX rule 10). */
 --ink:#15282f;--muted:#5a6b73;--bg:#f4f3ef;--white:#fbfaf7;--light:#e5f1ef;--line:#d9e1e2;
 --teal:#056b6f;--teal-ink:#fbfaf7;--green:#0f6a41;--amber:#8a5200;--red:#a3283a;
 --danger-ink:#fbfaf7;
 --leave-annual:#0a7a6d;--leave-medical:#c41f48;--leave-hospital:#b91c1c;--leave-family:#7340d8;--leave-unpaid:#5f6f82;--leave-personal:#9e5400;
 --space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:24px;--space-6:32px;
 --r-sm:6px;--r-md:10px;--r-lg:14px;--r-pill:999px;
 --fs-xs:12px;--fs-sm:14px;--fs-md:16px;--fs-lg:20px;--fs-xl:28px;
 --font-ui:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
 --shadow-pop:0 18px 50px rgba(9,30,40,.18);
 --brand-teal:#087f83;--brand-navy:#1d1856;--brand-orange:#f7941d;
 --surface:rgba(251,250,247,.72);--glass-edge:rgba(251,250,247,.85);--glass-line:rgba(24,45,53,.10);--glass-shadow:0 10px 30px rgba(18,52,66,.10);--blur:blur(22px) saturate(180%);
}
[data-theme="dark"],body[data-theme="dark"]{
 --ink:#e9f0f1;--muted:#a9bdc4;--bg:#0b1417;--white:#16242b;--light:rgba(69,132,137,.2);--line:rgba(183,207,215,.18);
 --teal:#5cc8c3;--teal-ink:#06292b;--green:#6fd3a0;--amber:#f1c56f;--red:#ff9ca5;
 --danger-ink:#2a0a10;
 --leave-annual:#14b8a6;--leave-medical:#f43f5e;--leave-hospital:#ef4444;--leave-family:#8b5cf6;--leave-unpaid:#94a3b8;--leave-personal:#f59e0b;
 --shadow-pop:0 18px 50px rgba(0,0,0,.45);
 --surface:rgba(24,38,46,.62);--glass-edge:rgba(255,255,255,.14);--glass-line:rgba(255,255,255,.10);--glass-shadow:0 10px 30px rgba(0,0,0,.35);
}
.ds{font-family:var(--font-ui);font-size:var(--fs-sm);color:var(--ink);background:var(--bg)}

/* Text */
.ds-title{margin:0;font-size:var(--fs-xl);font-weight:700;letter-spacing:-.02em}
.ds-subtitle,.ds-hint{margin:var(--space-1) 0 0;color:var(--muted);font-size:var(--fs-sm)}
.ds-label{display:block;font-size:var(--fs-xs);font-weight:600;color:var(--muted)}
.ds-eyebrow{font-size:var(--fs-xs);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}

/* Buttons */
.ds-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-2);height:40px;padding:0 var(--space-4);border:1px solid var(--line);border-radius:var(--r-md);background:transparent;color:var(--ink);font:600 var(--fs-sm) var(--font-ui);cursor:pointer;text-decoration:none;transition:background-color .15s,border-color .15s}
.ds-btn:hover{background:var(--light)}
.ds-btn.primary{background:var(--teal);border-color:var(--teal);color:var(--teal-ink)}
.ds-btn.primary:hover{background:color-mix(in srgb,var(--teal) 88%,var(--ink))}
.ds-btn.danger{color:var(--red)}
.ds-btn.danger:hover{background:color-mix(in srgb,var(--red) 12%,transparent)}
.ds-btn:disabled{opacity:.5;cursor:not-allowed}
.ds-btn:focus-visible,.ds-card:focus-visible,.ds-menu-item:focus-visible,.ds-input:focus-visible{outline:2px solid var(--teal);outline-offset:2px}

/* Surfaces */
.ds-panel{background:var(--white);border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden}
.ds-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3);padding:var(--space-4) 20px;border-bottom:1px solid var(--line)}
.ds-panel-head h2{margin:0;font-size:var(--fs-md);font-weight:700}
.ds-panel-body{padding:var(--space-4) 20px}
.ds-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:var(--space-3)}
.ds-card{display:block;width:100%;text-align:left;padding:var(--space-3) var(--space-4);background:var(--white);border:1px solid var(--line);border-radius:var(--r-lg);color:inherit;font:inherit}
button.ds-card{cursor:pointer}button.ds-card:hover{border-color:var(--teal)}
.ds-card b{display:block;margin:2px 0;font-size:var(--fs-xl);font-weight:700;line-height:1.2}
.ds-card small{display:block;font-size:var(--fs-xs);color:var(--muted)}

/* Table */
.ds-table-wrap{overflow-x:auto}
.ds-table{width:100%;border-collapse:separate;border-spacing:0}
.ds-table th{padding:10px var(--space-3);text-align:left;font-size:var(--fs-xs);font-weight:600;color:var(--muted);border-bottom:2px solid var(--line);white-space:nowrap}
.ds-table td{height:36px;padding:var(--space-2) var(--space-3);border-bottom:1px solid var(--line)}
.ds-table tbody tr:hover td{background:color-mix(in srgb,var(--teal) 6%,transparent)}
.ds-table .num{text-align:right;font-variant-numeric:tabular-nums}

/* Badges */
.ds-badge{--c:var(--muted);display:inline-flex;align-items:center;height:22px;padding:0 var(--space-2);border-radius:var(--r-sm);font-size:var(--fs-xs);font-weight:600;background:color-mix(in srgb,var(--c) 18%,transparent);border:1px solid color-mix(in srgb,var(--c) 55%,transparent)}
.ds-badge.ok{--c:var(--green)}.ds-badge.warn{--c:var(--amber)}.ds-badge.bad{--c:var(--red)}.ds-badge.info{--c:var(--teal)}
.ds-badge.pending{border-style:dashed}
.ds-count{display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 6px;border-radius:var(--r-pill);font-size:var(--fs-xs);font-weight:700;background:color-mix(in srgb,var(--muted) 18%,transparent)}

/* Menu */
.ds-menu{width:240px;padding:var(--space-2);background:var(--white);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow-pop)}
.ds-menu-title{padding:var(--space-2) var(--space-3) var(--space-1);font-weight:700}
.ds-menu-account{padding:0 var(--space-3) var(--space-2);color:var(--muted);font-size:var(--fs-xs)}
.ds-menu hr{margin:var(--space-2) 0;border:0;border-top:1px solid var(--line)}
.ds-menu .ds-eyebrow{display:block;padding:var(--space-1) var(--space-3)}
.ds-menu-item{box-sizing:border-box;margin:0;display:flex;align-items:center;width:100%;min-height:42px;padding:10px var(--space-3);border:0;border-radius:var(--r-md);background:transparent;color:inherit;font:600 var(--fs-sm) var(--font-ui);text-align:left;text-decoration:none;cursor:pointer}
.ds-menu-item:hover{background:color-mix(in srgb,var(--teal) 14%,transparent)}
.ds-menu-item.danger{color:var(--red)}.ds-menu-item.danger:hover{background:color-mix(in srgb,var(--red) 12%,transparent)}

/* Pop-up */
.ds-dialog{width:min(520px,100%);background:var(--white);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow-pop);overflow:hidden}
.ds-dialog header{display:flex;justify-content:space-between;align-items:center;padding:var(--space-4) 20px;border-bottom:1px solid var(--line)}
.ds-dialog header h2{margin:0;font-size:var(--fs-lg);font-weight:700}
.ds-dialog .ds-close{width:36px;height:36px;padding:0}
.ds-dialog-body{padding:20px}
.ds-dialog footer{display:flex;justify-content:flex-end;gap:var(--space-2);padding:var(--space-3) 20px;border-top:1px solid var(--line)}

/* Forms */
.ds-field{display:grid;gap:6px}
.ds-input{box-sizing:border-box;width:100%;height:40px;padding:0 var(--space-3);border:1px solid var(--line);border-radius:var(--r-md);background:var(--white);color:var(--ink);font:var(--fs-sm) var(--font-ui)}
textarea.ds-input{height:auto;min-height:80px;padding:10px var(--space-3)}

/* Notice */
.ds-notice{--c:var(--teal);display:flex;justify-content:space-between;align-items:center;gap:var(--space-3);padding:var(--space-3) var(--space-4);border-left:4px solid var(--c);border-radius:var(--r-md);background:color-mix(in srgb,var(--c) 10%,transparent)}
.ds-notice.warn{--c:var(--amber)}.ds-notice.bad{--c:var(--red)}
.ds-notice strong{display:block}.ds-notice p{margin:2px 0 0;color:var(--muted)}

/* Tabs */
.ds-tabs{display:flex;flex-wrap:wrap;gap:var(--space-2)}
.ds-tab{height:36px;padding:0 var(--space-4);border:1px solid var(--line);border-radius:var(--r-pill);background:transparent;color:inherit;font:600 var(--fs-sm) var(--font-ui);cursor:pointer}
.ds-tab[aria-pressed="true"]{background:color-mix(in srgb,var(--teal) 18%,transparent);border-color:var(--teal)}

/* Glass surfaces (Apple-style): frosted, see-through, with a light top edge.
   Falls back to solid --white where backdrop blur is unsupported. */
.ds-glass-bg{background:radial-gradient(900px 500px at 8% -10%,color-mix(in srgb,var(--brand-teal) 30%,transparent),transparent 60%),radial-gradient(700px 500px at 105% 15%,color-mix(in srgb,var(--brand-navy) 22%,transparent),transparent 60%),radial-gradient(600px 400px at 60% 110%,color-mix(in srgb,var(--brand-orange) 16%,transparent),transparent 60%),var(--bg)}
.ds-panel,.ds-card,.ds-menu,.ds-dialog{background:var(--surface);border-color:var(--glass-line);box-shadow:inset 0 1px 0 var(--glass-edge),var(--glass-shadow);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur)}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.ds-panel,.ds-card,.ds-menu,.ds-dialog{background:var(--white)}}
.ds-btn:not(.primary):not(.danger),.ds-tab{background:color-mix(in srgb,var(--surface) 70%,transparent)}
.ds-btn.primary{box-shadow:inset 0 1px 0 rgba(255,255,255,.35),0 6px 16px color-mix(in srgb,var(--teal) 30%,transparent)}

/* Top bar: keeps the existing Workroom header (flat bar, menu + path left, status/photo/settings right).
   The KHR logo stays in the sidebar, as on the live site. */
.ds-topbar{position:relative;display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);min-height:64px;padding:0 var(--space-4);background:var(--white);border-bottom:1px solid var(--line);box-shadow:0 4px 14px rgba(18,52,66,.08)}
.ds-topbar::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:3px;background:linear-gradient(90deg,var(--brand-teal),var(--brand-navy) 60%,var(--brand-orange))}
[data-theme="dark"] .ds-topbar,body[data-theme="dark"] .ds-topbar{background:#16252c;box-shadow:0 4px 18px rgba(0,0,0,.4)}
[data-theme="dark"] .ds-topbar::after,body[data-theme="dark"] .ds-topbar::after{background:linear-gradient(90deg,var(--teal),#7c74d9 60%,var(--brand-orange))}
.ds-brand{display:flex;align-items:center;gap:var(--space-3);min-width:0}
.ds-menu-btn{display:grid;place-items:center;width:40px;height:40px;border:1px solid var(--line);border-radius:var(--r-sm);background:transparent;color:inherit;font-size:18px;cursor:pointer}
.ds-crumb{color:var(--ink);font-weight:600;font-size:var(--fs-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ds-status{display:inline-flex;align-items:center;height:30px;padding:0 var(--space-3);border-radius:var(--r-md);background:color-mix(in srgb,var(--muted) 16%,transparent);font-size:var(--fs-xs);font-weight:600}
.ds-avatar{display:inline-grid;place-items:center;width:40px;height:40px;border-radius:var(--r-pill);background:color-mix(in srgb,var(--teal) 20%,transparent);font-weight:700;font-size:var(--fs-xs)}
.ds-gear{display:grid;place-items:center;width:40px;height:40px;border:1px solid var(--line);border-radius:var(--r-pill);background:color-mix(in srgb,var(--teal) 10%,transparent);color:var(--teal);cursor:pointer}
.ds-logo{height:56px;width:auto;display:block}
[data-theme="dark"] .ds-logo,body[data-theme="dark"] .ds-logo{filter:brightness(0) invert(1)}


/* ===== Site-wide bridge: applies the standard to the existing Workroom markup =====
   Prefixed with html:root body so it outranks older page and module styles (incl. their dark-theme rules)
   without !important. Visual properties only: no widths, positions or display changes. */
html:root body{background:var(--bg);color:var(--ink);font-family:var(--font-ui)}
html:root body #main,html:root body .login-page,html:root body main.status-page{background:radial-gradient(900px 500px at 8% -10%,color-mix(in srgb,var(--brand-teal) 22%,transparent),transparent 60%),radial-gradient(700px 500px at 105% 15%,color-mix(in srgb,var(--brand-navy) 16%,transparent),transparent 60%),radial-gradient(600px 400px at 60% 110%,color-mix(in srgb,var(--brand-orange) 10%,transparent),transparent 60%),var(--bg);background-attachment:fixed}

/* Header */
html:root body .topbar{position:relative;background:var(--white);border-bottom:1px solid var(--line);box-shadow:0 4px 14px rgba(18,52,66,.08)}
html:root body .topbar::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:3px;background:linear-gradient(90deg,var(--brand-teal),var(--brand-navy) 60%,var(--brand-orange));pointer-events:none}
html:root body[data-theme="dark"] .topbar{background:#16252c;box-shadow:0 4px 18px rgba(0,0,0,.4)}
html:root body[data-theme="dark"] .topbar::after{background:linear-gradient(90deg,var(--teal),#7c74d9 60%,var(--brand-orange))}
html:root body .breadcrumb{color:var(--ink);font-weight:600;font-size:var(--fs-sm)}

/* Page heading */
html:root body .page-head h1{font-size:var(--fs-xl);font-weight:700;letter-spacing:-.02em;color:var(--ink)}
html:root body .page-head .subtitle,html:root body .subtitle{color:var(--muted);font-size:var(--fs-sm)}

/* Surfaces: panels, filter bars, cards */
html:root body .panel,html:root body .filterbar,html:root body .hr-card{background:var(--surface);border:1px solid var(--glass-line);border-radius:var(--r-lg);box-shadow:inset 0 1px 0 var(--glass-edge),var(--glass-shadow);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur)}
html:root body .panel-head{border-bottom:1px solid var(--line)}
html:root body .panel-head h2,html:root body .panel-head h3{font-size:var(--fs-md);font-weight:700;color:var(--ink)}
html:root body .metric,html:root body .stat-button,html:root body .lm-card{background:var(--surface);border:1px solid var(--glass-line);border-radius:var(--r-lg);box-shadow:inset 0 1px 0 var(--glass-edge),var(--glass-shadow);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);color:var(--ink)}
html:root body button.metric:hover,html:root body .stat-button:hover,html:root body button.lm-card:hover{border-color:var(--teal)}
html:root body .metric-label,html:root body .metric-note{color:var(--muted);font-size:var(--fs-xs)}
html:root body .metric-value{font-weight:700;color:var(--ink)}

/* Buttons */
html:root body .button{min-height:40px;border:1px solid var(--line);border-radius:var(--r-md);background:color-mix(in srgb,var(--surface) 70%,transparent);color:var(--ink);font:600 var(--fs-sm) var(--font-ui);box-shadow:none;text-shadow:none}
html:root body .button:hover{background:var(--light);color:var(--ink);transform:none}
html:root body .button.primary,html:root body .button.teal{background:var(--teal);border-color:var(--teal);color:var(--teal-ink);box-shadow:inset 0 1px 0 rgba(255,255,255,.35),0 6px 16px color-mix(in srgb,var(--teal) 28%,transparent)}
html:root body .button.primary:hover,html:root body .button.teal:hover{background:color-mix(in srgb,var(--teal) 88%,var(--ink));color:var(--teal-ink)}
html:root body .button.active,html:root body .button[aria-pressed="true"]{background:color-mix(in srgb,var(--teal) 18%,transparent);border-color:var(--teal);color:var(--ink)}
html:root body .button:disabled{opacity:.5}
html:root body .button:focus-visible,html:root body .metric:focus-visible,html:root body .lm-card:focus-visible,html:root body .stat-button:focus-visible{outline:2px solid var(--teal);outline-offset:2px}

/* Badges */
html:root body .badge{border-radius:var(--r-sm);font-size:var(--fs-xs);font-weight:600;border:1px solid color-mix(in srgb,currentColor 35%,transparent)}

/* Form fields */
html:root body .field label,html:root body .field>span{font-size:var(--fs-xs);font-weight:600;color:var(--muted)}
html:root body .field input:not([type=checkbox]):not([type=radio]):not([type=file]),html:root body .field select,html:root body .field textarea,html:root body .filterbar input,html:root body .filterbar select{min-height:40px;border:1px solid var(--line);border-radius:var(--r-md);background:var(--white);color:var(--ink);font:var(--fs-sm) var(--font-ui)}
html:root body .field input:focus,html:root body .field select:focus,html:root body .field textarea:focus,html:root body .filterbar input:focus,html:root body .filterbar select:focus{outline:2px solid var(--teal);outline-offset:1px;border-color:var(--teal)}

/* Tables (not the leave calendar or day grids) */
html:root body .table-wrap table:not(.lm-cal){border-collapse:separate;border-spacing:0}
html:root body .table-wrap table:not(.lm-cal) th{font-size:var(--fs-xs);font-weight:600;color:var(--muted);border-bottom:2px solid var(--line);background:transparent}
html:root body .table-wrap table:not(.lm-cal) td{border-bottom:1px solid var(--line)}
html:root body .table-wrap table:not(.lm-cal) tbody tr:hover td{background:color-mix(in srgb,var(--teal) 6%,transparent)}
html:root body .empty{color:var(--muted)}

/* Pop-ups */
html:root body #modal{background:var(--white);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow-pop);color:var(--ink)}
html:root body #modal::backdrop{background:rgba(7,27,42,.45);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
html:root body #modal .modal-head{border-bottom:1px solid var(--line)}
html:root body #modal .modal-head h2{font-size:var(--fs-lg);font-weight:700}

/* Settings menu */
html:root body .settings-menu{background:var(--surface);border:1px solid var(--glass-line);border-radius:var(--r-lg);box-shadow:inset 0 1px 0 var(--glass-edge),var(--shadow-pop);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);color:var(--ink)}

/* Sidebar */
html:root body .sidebar{border-right:1px solid var(--line)}

/* Icon buttons (menu, close, settings): standard secondary look, no white borders */
html:root body .icon-button,html:root body .menu-toggle,html:root body #modal .modal-head button{border:1px solid var(--line);border-radius:var(--r-md);background:color-mix(in srgb,var(--surface) 70%,transparent);color:var(--ink);box-shadow:none}
html:root body .icon-button:hover,html:root body .menu-toggle:hover,html:root body #modal .modal-head button:hover{background:var(--light)}
html:root body .icon-button:focus-visible,html:root body .menu-toggle:focus-visible{outline:2px solid var(--teal);outline-offset:2px}
/* Big numbers in cards stay on one line and shrink on narrow cards */
html:root body .metric,html:root body .lm-card{container-type:inline-size;min-width:0}
html:root body #main .metric-value,html:root body #main .lm-card b{white-space:nowrap;font-size:calc(clamp(18px,11.5cqi,28px) * var(--preview-text-scale,1))!important;font-variant-numeric:tabular-nums} /* !important: overrides a legacy fixed 28px compact-metrics size so long amounts fit */
/* Filter labels sit above their box, like every other form */
html:root body .filterbar .field,html:root body .filterbar label:has(+select),html:root body .claim-filters label{display:grid;gap:6px;align-items:start}

/* Claim form lines (desktop/tablet): one final set of column widths so dates, rates and amounts fit their cells.
   The phone layout (stacked cards below 761px) is left as it is. */
@media (min-width:761px){
 html:root body .claim-travel-scroll .claim-entry-table{table-layout:fixed}
 html:root body .claim-travel-scroll .claim-entry-table :is(th,td):nth-child(1){width:17%}
 html:root body .claim-travel-scroll .claim-entry-table :is(th,td):nth-child(2){width:21%}
 html:root body .claim-travel-scroll .claim-entry-table :is(th,td):nth-child(3){width:26%}
 html:root body .claim-travel-scroll .claim-entry-table :is(th,td):nth-child(4){width:12%}
 html:root body .claim-travel-scroll .claim-entry-table :is(th,td):nth-child(5){width:13%}
 html:root body .claim-travel-scroll .claim-entry-table :is(th,td):nth-child(6){width:11%}
 html:root body .claim-entry-table td>input[type=date]{font-variant-numeric:tabular-nums;padding-inline:6px;font-size:var(--fs-sm)}
 html:root body .claim-entry-table td:last-child .button{padding:0 10px;max-width:100%}
}
/* Numbers stay on one line inside their own cell, aligned for easy comparison */
html:root body :is(.claim-rate,.claim-line-amount,.currency-cell,td.num){white-space:nowrap;font-variant-numeric:tabular-nums}
html:root body .claim-entry-table :is(.claim-rate,.claim-line-amount){font-size:var(--fs-sm)}

/* Claims filters: labels above boxes, inside a standard filter bar */
html:root body .claim-filter{display:flex;flex-wrap:wrap;gap:var(--space-3);align-items:end;padding:var(--space-3) var(--space-4);background:var(--surface);border:1px solid var(--glass-line);border-radius:var(--r-lg);box-shadow:inset 0 1px 0 var(--glass-edge)}
html:root body .claim-filter>label{display:grid;gap:6px;font-size:var(--fs-xs);font-weight:600;color:var(--muted);min-width:160px}
html:root body .claim-filter select{min-height:40px;border:1px solid var(--line);border-radius:var(--r-md);background:var(--white);color:var(--ink);font:var(--fs-sm) var(--font-ui);padding:0 var(--space-3)}
@media (max-width:520px){html:root body .claim-filter>label{flex:1 1 140px;min-width:0}}

/* Phone: table rows become labelled cards (tables marked by interface-polish.js) */
@media (max-width:600px){
 html:root body #main table.ds-cardable,html:root body #main table.ds-cardable tbody{display:block;width:100%;min-width:0!important}
 html:root body #main table.ds-cardable thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
 html:root body #main table.ds-cardable tbody tr{display:block;margin:0 0 var(--space-3);padding:var(--space-2) var(--space-3);border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface)}
 html:root body #main table.ds-cardable tbody td{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-3);min-width:0!important;width:auto!important;height:auto;padding:6px 0;border-bottom:1px solid color-mix(in srgb,var(--line) 60%,transparent);text-align:right}
 html:root body #main table.ds-cardable tbody td:last-child{border-bottom:0}
 html:root body #main table.ds-cardable tbody td::before{content:attr(data-label);flex:0 0 42%;text-align:left;font-size:var(--fs-xs);font-weight:600;color:var(--muted)}
 html:root body #main table.ds-cardable tbody td[data-label=""]::before,html:root body #main table.ds-cardable tbody td:not([data-label])::before{content:none}
 html:root body #main table.ds-cardable tbody td[colspan]{display:block;text-align:center}
 html:root body #main table.ds-cardable tbody td[colspan]::before{content:none}
 html:root body #main .table-wrap:has(table.ds-cardable){overflow:visible}
 html:root body #main .table-scroll-hint:has(+ .table-wrap table.ds-cardable){display:none}
}

/* Filter toggle (see interface-polish.js) */
html:root body .ds-filter-toggle{display:inline-flex;align-items:center;gap:var(--space-2);margin:0 0 var(--space-3)}
html:root body .ds-filter-toggle[aria-expanded="true"]{border-color:var(--teal);background:color-mix(in srgb,var(--teal) 12%,transparent)}
html:root body .ds-filter-toggle .ds-count{background:var(--teal);color:var(--teal-ink);min-width:20px;height:20px}
html:root body .ds-filter-toggle .ds-caret{font-size:var(--fs-xs);color:var(--muted)}
html:root body .filterbar[hidden],html:root body .claim-filter[hidden],html:root body .group-register-filters[hidden]{display:none!important}
@media (max-width:600px){
 html:root body #main table.ds-cardable tbody td:first-child{position:static;background:transparent;width:auto!important}
 html:root body #main table.ds-cardable tbody td:has(.button){flex-wrap:wrap;justify-content:flex-end;gap:var(--space-2)}
 html:root body #main table.ds-cardable tbody td:has(.button)::before{flex-basis:100%}
 html:root body #main table.ds-cardable tbody td>.button{margin:0}
}

/* "More" page-actions menu (see interface-polish.js) */
html:root body .ds-more{position:relative;display:inline-block}
html:root body .ds-more-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:40;min-width:220px;padding:var(--space-2);display:grid;gap:2px;background:var(--surface);border:1px solid var(--glass-line);border-radius:var(--r-lg);box-shadow:inset 0 1px 0 var(--glass-edge),var(--shadow-pop);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur)}
html:root body .ds-more-menu[hidden]{display:none}
html:root body .ds-more-menu .button{justify-content:flex-start;width:100%;min-height:40px;border:0;background:transparent;box-shadow:none;text-align:left}
html:root body .ds-more-menu .button:hover,html:root body .ds-more-menu .button:focus-visible{background:color-mix(in srgb,var(--teal) 14%,transparent)}
html:root body .ds-more-menu hr{margin:4px 0;border:0;border-top:1px solid var(--line)}
@media (max-width:600px){html:root body .ds-more-menu{right:auto;left:0}}

/* User management (compat/user-management.js): layout only, standard components */
html:root body .um-metrics{grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr))}
html:root body .um-metrics .metric[aria-pressed="true"]{border-color:var(--teal)}
html:root body .um-note,html:root body .um-filter,html:root body .um-tabs{margin:0 0 var(--space-4)}
html:root body .um-filter{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:var(--space-3) var(--space-4)}
html:root body .um-filter .field:first-child{flex:1 1 220px;max-width:none}
html:root body .um-toggle{display:inline-flex;align-items:center;gap:var(--space-2);min-height:40px;font-size:var(--fs-sm);font-weight:600}
html:root body .um-toggle input{min-height:0;width:18px;height:18px;accent-color:var(--teal)}
html:root body .um-table th:nth-child(6){text-align:right}
html:root body .um-table td:last-child{text-align:right;white-space:nowrap}
html:root body .um-table .visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
html:root body .um-actions{display:grid;gap:var(--space-1);margin-top:var(--space-3)}
html:root body .um-error{margin:var(--space-2) 0 0;color:var(--red);font-size:var(--fs-sm)}
/* Confirm dialogs are the one place a red fill is allowed (overrides .button.primary teal) */
html:root body .button.primary.danger-fill{background:var(--red)!important;border-color:var(--red)!important;color:var(--danger-ink)}
html:root body .ds-menu-item:focus-visible,html:root body .um-toggle input:focus-visible{outline:2px solid var(--teal);outline-offset:-2px}
html:root body .um-table .ds-badge{white-space:nowrap}

/* ===== UX rules (SKILL.md "UX rules"); behaviour lives in compat/ux-rules.js ===== */
/* 1. Labels above fields, left-aligned, one column of label + box */
html:root body .field{display:flex;flex-direction:column;align-items:stretch;gap:6px;text-align:left}
html:root body .field>label,html:root body .field>span:first-child{display:block;margin:0;text-align:left;line-height:1.4}
html:root body .field>label:has(>input[type=checkbox]),html:root body .field>label:has(>input[type=radio]){display:flex;align-items:center;gap:var(--space-2)}

/* 5. Colour meaning: destructive = red, primary = teal fill, Cancel = secondary */
html:root body .button.danger,html:root body button.danger:not(.ds-menu-item):not(.ds-btn){color:var(--red);border-color:color-mix(in srgb,var(--red) 45%,transparent);background:color-mix(in srgb,var(--surface) 70%,transparent)}
html:root body .button.danger:hover{background:color-mix(in srgb,var(--red) 12%,transparent);color:var(--red)}
html:root body .button.danger:focus-visible{outline-color:var(--red)}

/* 6. Key figures: value large and bold, label small and muted */
html:root body #main :is(.metric-label,.metric-note,.lm-card small,.month-summary-item>span,.approval-widget>span){font-size:var(--fs-xs);font-weight:600;color:var(--muted)}
html:root body #main :is(.metric-value,.lm-card b,.month-summary-item>strong,.approval-widget>strong){font-weight:700;color:var(--ink);line-height:1.15}

/* 4. Dates: DD/MM/YYYY text box + calendar button (public/dates.js); the real date input stays underneath for saving */
html:root body .ds-date{position:relative;display:block;min-width:0;width:100%}
html:root body .ds-date>input.ds-date-native{position:absolute;left:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;pointer-events:none}
html:root body .ds-date-input{box-sizing:border-box;width:100%;min-height:40px;padding:0 44px 0 var(--space-3);border:1px solid var(--line);border-radius:var(--r-md);background:var(--white);color:var(--ink);font:var(--fs-sm) var(--font-ui);font-variant-numeric:tabular-nums}
html:root body .ds-date-input::placeholder{color:var(--muted)}
html:root body .ds-date-input:focus{outline:2px solid var(--teal);outline-offset:1px;border-color:var(--teal)}
html:root body .ds-date-input:disabled,html:root body .ds-date-input:read-only{opacity:.6;cursor:not-allowed}
html:root body .ds-date-input:user-invalid{border-color:var(--red)}
html:root body .ds-date-pick{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:36px;height:36px;min-height:0;padding:0;border:0;border-radius:var(--r-sm);background:transparent;color:var(--muted);cursor:pointer}
html:root body .ds-date-pick:hover{background:var(--light);color:var(--ink)}
html:root body .ds-date-pick:focus-visible{outline:2px solid var(--teal);outline-offset:-2px}
html:root body .ds-date-pick:disabled{opacity:.5;cursor:not-allowed}
html:root body :is(td,.claim-line) .ds-date-input{padding-right:32px;padding-left:8px}html:root body :is(td,.claim-line) .ds-date-pick{width:28px;height:28px;right:2px}
@media (max-width:720px){html:root body .ds-date-input{min-height:44px;font-size:16px}html:root body .ds-date-pick{width:40px;height:40px}}

/* 3. Searchable dropdown (combobox) — the real <select> stays underneath for saving */
html:root body .ds-combo{position:relative;display:block;min-width:0;width:100%}
html:root body .ds-combo>select.ds-combo-native{position:absolute;inset:0;width:100%;height:100%;opacity:0;pointer-events:none}
html:root body .ds-combo-input{box-sizing:border-box;width:100%;min-height:40px;padding:0 36px 0 var(--space-3);border:1px solid var(--line);border-radius:var(--r-md);background:var(--white);color:var(--ink);font:var(--fs-sm) var(--font-ui);text-overflow:ellipsis}
html:root body .ds-combo-input::-webkit-search-cancel-button{display:none}
html:root body .ds-combo-input:focus{outline:2px solid var(--teal);outline-offset:1px;border-color:var(--teal)}
html:root body .ds-combo-input:disabled{opacity:.6;cursor:not-allowed}
html:root body .ds-combo-toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--r-sm);background:transparent;color:var(--muted);cursor:pointer}
html:root body .ds-combo-toggle:hover{background:var(--light)}
html:root body .ds-combo-toggle:focus-visible{outline:2px solid var(--teal);outline-offset:-2px}
html:root body .ds-combo-list{position:absolute;left:0;right:0;top:calc(100% + 4px);z-index:60;max-height:min(300px,50vh);overflow-y:auto;overscroll-behavior:contain;padding:var(--space-1);background:var(--white);border:1px solid var(--line);border-radius:var(--r-md);box-shadow:var(--shadow-pop)}
html:root body .ds-combo-list[hidden]{display:none}
html:root body .ds-combo-group{padding:var(--space-2) var(--space-3) var(--space-1);font-size:var(--fs-xs);font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
html:root body .ds-combo-option{display:block;width:100%;min-height:40px;padding:10px var(--space-3);border:0;border-radius:var(--r-sm);background:transparent;color:var(--ink);font:var(--fs-sm) var(--font-ui);text-align:left;cursor:pointer}
html:root body .ds-combo-option:hover,html:root body .ds-combo-option[aria-selected="true"]{background:color-mix(in srgb,var(--teal) 14%,transparent)}
html:root body .ds-combo-option[aria-current="true"]{font-weight:700}
html:root body .ds-combo-option[aria-disabled="true"]{opacity:.5;cursor:not-allowed}
html:root body .ds-combo-empty{margin:0;padding:10px var(--space-3);color:var(--muted);font-size:var(--fs-sm)}
html:root body td .ds-combo-input{min-height:36px}

/* 8. Format hints under fields */
html:root body .ds-format-hint{display:block;margin:0;color:var(--muted);font-size:var(--fs-xs);font-weight:400;line-height:1.4}

/* 7. Skeleton loading: page-shaped placeholders instead of spinners */
html:root body .ds-skeleton{display:grid;gap:var(--space-4);padding:var(--space-2) 0}
html:root body .ds-skel{display:block;border-radius:var(--r-sm);background:linear-gradient(90deg,color-mix(in srgb,var(--muted) 14%,transparent) 0%,color-mix(in srgb,var(--muted) 24%,transparent) 40%,color-mix(in srgb,var(--muted) 14%,transparent) 80%);background-size:200% 100%;animation:ds-skel 1.4s ease-in-out infinite}
html:root body .ds-skel-title{width:min(320px,70%);height:28px}
html:root body .ds-skel-line{width:min(480px,90%);height:14px}
html:root body .ds-skel-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr));gap:var(--space-3)}
html:root body .ds-skel-card{height:96px;border-radius:var(--r-lg)}
html:root body .ds-skel-table{display:grid;gap:var(--space-2);padding:var(--space-4);border:1px solid var(--line);border-radius:var(--r-lg)}
html:root body .ds-skel-row{height:36px}
html:root body .ds-skel-row:first-child{height:20px;width:60%}
html:root body .ds-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@keyframes ds-skel{0%{background-position:100% 0}100%{background-position:-100% 0}}
@media (prefers-reduced-motion:reduce){html:root body .ds-skel{animation:none}}
/* Start-up skeleton (src/Workspace.tsx): covers the page area while the workspace loads */
.workroom-boot-skeleton{position:fixed;inset:0;z-index:10010;display:grid;grid-template-columns:260px 1fr;background:var(--bg);font-family:var(--font-ui)}
.workroom-boot-skeleton .boot-side{display:grid;align-content:start;gap:var(--space-3);padding:var(--space-5) var(--space-4);border-right:1px solid var(--line)}
.workroom-boot-skeleton .boot-main{display:grid;align-content:start;gap:var(--space-5);padding:96px var(--space-5) var(--space-5)}
.workroom-boot-skeleton .ds-skel{display:block;border-radius:var(--r-sm);background:linear-gradient(90deg,color-mix(in srgb,var(--muted) 14%,transparent) 0%,color-mix(in srgb,var(--muted) 24%,transparent) 40%,color-mix(in srgb,var(--muted) 14%,transparent) 80%);background-size:200% 100%;animation:ds-skel 1.4s ease-in-out infinite}
@media (prefers-reduced-motion:reduce){.workroom-boot-skeleton .ds-skel{animation:none}}
@media (max-width:860px){.workroom-boot-skeleton{grid-template-columns:1fr}.workroom-boot-skeleton .boot-side{display:none}.workroom-boot-skeleton .boot-main{padding:88px var(--space-4) var(--space-4)}}
@media print{.workroom-boot-skeleton{display:none!important}}
/* 1. Forms are one column: one label + box per row (checkbox groups inside a field keep their grid) */
html:root body #modal .form-grid:not(.field .form-grid){grid-template-columns:minmax(0,1fr);gap:var(--space-4)}
html:root body #modal .form-grid:not(.field .form-grid)>.field{grid-column:1/-1}
/* Tap targets: at least 44px tall on phones */
@media (max-width:600px){html:root body :is(.button,.ds-combo-input,.field input:not([type=checkbox]):not([type=radio]),.field select,.ds-combo-option){min-height:44px}}
/* Owner's design references ("UI photo advice"): typography rhythm, soft lines, clear affordances */
/* Small uppercase labels get breathing room; buttons are never shouted in capitals */
html:root body :is(.table-wrap th,.ds-table th,.ds-eyebrow,.nav-section,.sidebar h3,.sidebar .nav-label){letter-spacing:.06em}
html:root body :is(.button,button){text-transform:none}
/* Paragraphs support, headlines attract: comfortable line height, slightly softer text */
html:root body #main :is(p,.subtitle,.metric-note,.panel-head p){line-height:1.55}
html:root body #main .panel-body>p,html:root body #modal .modal-body>p{color:color-mix(in srgb,var(--ink) 82%,var(--muted))}
/* Soft dividers: one light 1px line, never a heavy rule */
html:root body .table-wrap table:not(.lm-cal) th,html:root body .ds-table th{border-bottom-width:1px}
/* Clickable summary cards show they open something */
html:root body #main button.metric{position:relative;padding-right:32px}
html:root body #main button.metric::after{content:"›";position:absolute;right:14px;top:50%;transform:translateY(-50%);font-size:20px;line-height:1;color:var(--muted)}
html:root body #main button.metric:hover::after{color:var(--teal)}
/* Balanced radius: controls inside a 14px surface use 10px, chips inside controls 6px */
html:root body :is(.panel,.filterbar,#modal) :is(.button,input,select,textarea,.ds-combo-input){border-radius:var(--r-md)}
/* Long pop-ups on phones: the action buttons stay in reach at the bottom */
@media (max-width:600px){html:root body #modal .modal-footer{position:sticky;bottom:0;z-index:2;background:var(--white);border-top:1px solid var(--line)}}
html:root body .ds-combo-toggle[hidden]{display:none}
