/* My Smart Rental – shell + components. Mobile first (handover app on the phone), works down to 360 px. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--fs)/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); } h2 { font-size: var(--fs-lg); } h3 { font-size: var(--fs-md); }
p { margin: 0 0 8px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a:focus-visible { border-radius: 4px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); } .strong { font-weight: 650; }
.right { margin-left: auto; } .row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; gap: var(--gap); } .hide { display: none !important; } .nowrap { white-space: nowrap; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* ---------- boot loader (index.html, CSS only – the CSP allows no extra inline script): Route Key logo, fixed + centred on the theme background
   (no layout shift when the app replaces #app). Invisible for the first 180 ms (fast loads never see it), then: the "S" road draws itself,
   the dashed centre line drives along it, the cyan key ring pulses. Motion level reduced/off or OS reduce motion: static logo, soft opacity pulse.
   Loops are allowed here (like the skeleton shimmer) – it only exists while nothing else can be shown. */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); }
.boot-in { display: grid; justify-items: center; gap: 14px; opacity: 0; animation: boot-show var(--dur-3, 240ms) ease-out 180ms forwards; }
.boot-mark { display: block; width: 88px; height: 88px; border-radius: 19px; box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--brand) 55%, transparent); }
.boot-g1 { stop-color: var(--brand-400); } .boot-g2 { stop-color: var(--brand-700); }
.boot-road { stroke: #fff; stroke-dasharray: 100; stroke-dashoffset: 100; animation: boot-draw 760ms cubic-bezier(.65, 0, .35, 1) 220ms forwards; }
.boot-lane { opacity: 0; animation: boot-fade 240ms ease-out 900ms forwards, boot-drive 1.1s linear 900ms infinite; }
.boot-teeth { fill: #fff; opacity: 0; animation: boot-fade 240ms ease-out 820ms forwards; }
.boot-ring { stroke: var(--accent); transform-box: fill-box; transform-origin: center; animation: boot-ring 1.6s ease-in-out 400ms infinite; }
.boot-wm { font: 500 17px/1 var(--font); letter-spacing: -.01em; color: var(--text); }
.boot-wm b { font-weight: 700; color: var(--brand); } [data-mode="dark"] .boot-wm b { color: var(--accent); }
.boot-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes boot-show { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes boot-draw { to { stroke-dashoffset: 0; } }
@keyframes boot-fade { to { opacity: 1; } }
@keyframes boot-drive { to { stroke-dashoffset: -36; } }
@keyframes boot-ring { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: .7; } }
@keyframes boot-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
[data-motion="reduced"] .boot-road, [data-motion="off"] .boot-road { animation: none; stroke-dashoffset: 0; }
[data-motion="reduced"] .boot-lane, [data-motion="off"] .boot-lane, [data-motion="reduced"] .boot-teeth, [data-motion="off"] .boot-teeth { animation: none; opacity: 1; }
[data-motion="reduced"] .boot-ring, [data-motion="off"] .boot-ring { animation: none; }
@media (prefers-reduced-motion: reduce) { .boot-road { animation: none; stroke-dashoffset: 0; } .boot-lane, .boot-teeth { animation: none; opacity: 1; } .boot-ring { animation: none; } }
/* the global "motion off" rule (motion.css) cuts every duration/delay – the boot loader keeps its 180 ms delay and the soft opacity pulse */
[data-motion="reduced"] .boot-in, [data-motion="off"] .boot-in { animation: boot-fade 1ms linear 180ms forwards !important; }
[data-motion="reduced"] .boot-mark, [data-motion="off"] .boot-mark { animation: boot-breathe 1.8s ease-in-out 200ms infinite !important; }
@media (prefers-reduced-motion: reduce) { .boot-in { animation: boot-fade 1ms linear 180ms forwards !important; } .boot-mark { animation: boot-breathe 1.8s ease-in-out 200ms infinite !important; } }

/* ---------- route progress bar (page changes inside the app): slim brand bar at the very top, only after 150 ms, transform/opacity only ---------- */
.route-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 120; height: 3px; pointer-events: none; transform-origin: 0 50%; transform: scaleX(0); opacity: 0;
  background: linear-gradient(90deg, var(--accent), var(--brand-400) 45%, var(--brand)); box-shadow: 0 0 8px color-mix(in srgb, var(--brand-400) 60%, transparent); }
.route-bar.on { opacity: 1; transform: scaleX(.85); transition: transform 8s cubic-bezier(.08, .82, .17, 1), opacity 120ms; }
.route-bar.done { opacity: 0; transform: scaleX(1); transition: transform 180ms ease-out, opacity 260ms ease 160ms; }
[data-motion="off"] .route-bar.on { transition: none; transform: scaleX(.85); }
@keyframes pulse { 50% { transform: scale(.88); opacity: .6; } }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; } .icon.lg { width: 22px; height: 22px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; } .brand .logo { width: 32px; height: 32px; flex: none; } .brand small { display: block; font-weight: 500; font-size: 11px; color: var(--text-3); letter-spacing: .02em; }
.company-switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; text-align: left; }
.company-switch:hover { border-color: var(--border-strong); } .company-switch .name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.2; } .company-switch .sub { font-size: 11px; color: var(--text-3); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--primary); font-weight: 700; font-size: 12px; flex: none; }
.avatar.sq { border-radius: 9px; }
.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.nav .sec { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: var(--fs); }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; } .nav a.active .icon { stroke: var(--primary); }
.nav a .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav a .count.info { background: var(--surface-3); color: var(--text-2); }
.side-foot { margin-top: auto; padding-top: 12px; }
.plan-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface-2); font-size: var(--fs-sm); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .search { flex: 1; max-width: 420px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-3); cursor: pointer; }
.kbd { font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-3); background: var(--surface-2); }
.content { padding: 24px 24px 64px; width: 100%; max-width: 1480px; margin: 0 auto; }
.env-banner { display: flex; align-items: center; gap: 10px; padding: 6px 20px; background: #c2410c; color: #fff; position: sticky; top: 0; z-index: 21; font-size: var(--fs-sm); }
.env-banner b { letter-spacing: .08em; }
.demo-banner, .support-banner { display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: var(--fs-sm); background: var(--accent-50); color: var(--text); border-bottom: 1px solid var(--border); }
.support-banner { background: var(--info-bg); }
.menu-btn { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; } body.nav-open::after { content: ''; position: fixed; inset: 0; background: var(--overlay); z-index: 25; }
  .menu-btn { display: inline-flex; } .topbar { padding: 0 12px; } .content { padding: 16px 14px 72px; } .topbar .search span.lbl, .topbar .search .kbd { display: none; } .topbar .search { flex: 0 0 auto; width: 40px; padding: 0; justify-content: center; }
}

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; } .page-head .sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: var(--fs-sm); color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; } .crumbs a { color: var(--text-3); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-pad { padding: 18px; } .card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: var(--fs-md); } .card-head .sub { font-size: var(--fs-xs); color: var(--text-3); } .card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); } .cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.cols-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); }
@media (max-width: 1100px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-2-1 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: var(--gap); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi .lbl { font-size: var(--fs-xs); color: var(--text-3); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--fs-xs); color: var(--text-3); flex-wrap: wrap; }
.kpi.hero { background: var(--grad); color: #fff; border: 0; } .kpi.hero .lbl, .kpi.hero .meta { color: rgba(255, 255, 255, .8); }
[data-mode="dark"] .kpi.hero { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: var(--fs-xs); padding: 1px 7px; border-radius: var(--radius-pill); background: var(--neutral-bg); color: var(--text-2); }
.delta.up { background: var(--success-bg); color: var(--success); } .delta.down { background: var(--danger-bg); color: var(--danger); }
.kpi.hero .delta { background: rgba(255, 255, 255, .18); color: #fff; }
.split-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-3); margin-top: 10px; }
.split-bar span { display: block; height: 100%; } .legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--input-h); padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); } .btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); } .btn-accent:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.btn-danger { color: var(--danger); } .btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; } .btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-sm { height: var(--control-h-sm); padding: 0 10px; font-size: var(--fs-xs); } .btn-lg { height: 46px; padding: 0 20px; font-size: var(--fs-md); }
.btn-icon { width: var(--input-h); padding: 0; } .btn-sm.btn-icon { width: var(--control-h-sm); } .btn-block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ----------
   One place for every control: input, select, textarea, date/time, number, search, file, checkbox/radio, input groups, chips,
   switch and segmented control share height (--input-h / --control-h-sm), radius, border, focus ring and states (tokens in theme.css). */
.form { display: grid; gap: 14px; } .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 16px; align-items: start; } .form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; gap: 14px; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; } .field > label, .lbl-text { font-size: var(--fs-sm); font-weight: 600; line-height: 1.35; color: var(--text-2); }
.field > label[for] { cursor: pointer; }
.field .hint { font-size: var(--fs-xs); line-height: 1.45; color: var(--text-3); } .field .req { color: var(--danger); margin-left: 2px; }
.field-err { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-xs); line-height: 1.4; font-weight: 550; color: var(--danger); }
.field-err .icon { width: 14px; height: 14px; margin-top: 1px; }

.input { width: 100%; min-width: 0; height: var(--input-h); margin: 0; padding: 0 12px; border: 1px solid var(--input-border); border-radius: var(--radius-control);
  background-color: var(--input-bg); color: var(--text); font-size: var(--fs); line-height: 1.3; transition: border-color .12s, box-shadow .12s, background-color .12s; }
.input:not([type="color"]):not([type="range"]) { -webkit-appearance: none; appearance: none; }
.input::placeholder { color: var(--placeholder); opacity: 1; }
.input:hover:not(:disabled):not([readonly]):not(:focus) { border-color: var(--input-border-hover); }
.input:focus, .input:focus-visible { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input[readonly] { background-color: var(--input-readonly-bg); }
.input:disabled { background-color: var(--input-disabled-bg); color: var(--text-3); -webkit-text-fill-color: var(--text-3); border-color: var(--border); cursor: not-allowed; opacity: 1; }
.input[aria-invalid="true"], .input:user-invalid { border-color: var(--danger); }
.input[aria-invalid="true"]:focus, .input:user-invalid:focus { border-color: var(--danger); box-shadow: var(--ring-danger); }
.input.sm { height: var(--control-h-sm); padding: 0 10px; font-size: var(--fs-sm); }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
/* select: own chevron (same on every OS, token colour), long option texts end with … instead of running under the arrow */
select.input { padding-right: 34px; cursor: pointer; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select.input.sm { padding-right: 30px; background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; }
select.input:disabled { cursor: not-allowed; opacity: 1; }
select.input[multiple], select.input[size] { height: auto; padding: 6px; background-image: none; white-space: normal; }
select.input option, select.input optgroup { background-color: var(--surface); color: var(--text); }
/* date / time / datetime: tabular digits, calendar icon themed by color-scheme, aligned on iOS */
.input[type="date"], .input[type="time"], .input[type="datetime-local"], .input[type="month"], .input[type="week"] { font-variant-numeric: tabular-nums; cursor: text; }
.input::-webkit-date-and-time-value { text-align: left; min-height: 1.3em; }
.input::-webkit-datetime-edit { padding: 0; line-height: 1.3; }
.input::-webkit-calendar-picker-indicator { margin-left: 6px; padding: 3px; border-radius: 4px; opacity: .65; cursor: pointer; }
.input::-webkit-calendar-picker-indicator:hover { opacity: 1; background-color: var(--surface-3); }
.input:disabled::-webkit-calendar-picker-indicator { display: none; }
/* number: no spinners (they cover suffixes and break narrow cells); arrow keys still step */
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums; }
.input[type="number"]::-webkit-inner-spin-button, .input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
.input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.input[type="color"] { width: 64px; padding: 4px; cursor: pointer; }
/* file */
.input[type="file"] { height: auto; min-height: var(--input-h); padding: 5px 6px; color: var(--text-3); font-size: var(--fs-sm); line-height: calc(var(--input-h) - 12px); cursor: pointer; }
input[type="file"]::file-selector-button { height: calc(var(--input-h) - 12px); margin-right: 10px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: calc(var(--radius-control) - 2px);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--surface-3); }
/* file input hidden inside a label button: keep it keyboard reachable and show the focus on the label */
label:has(> input[type="file"].sr-only:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
/* checkbox / radio */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); cursor: pointer; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 24px; cursor: pointer; font-size: var(--fs); line-height: 1.4; }
.check input { width: 18px; height: 18px; margin: 0; flex: none; }
.check:has(input:disabled) { opacity: .6; cursor: not-allowed; }
/* input groups: [input][button], [input] with a unit (€, km, %, min) inside */
.input-group { display: flex; align-items: stretch; min-width: 0; } .input-group > .input { flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input:focus { position: relative; z-index: 1; }
.input-group > .btn { height: var(--input-h); border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; border-color: var(--input-border); }
.input-suffix, .input-unit { position: relative; display: flex; align-items: center; min-width: 0; }
.input-suffix .input { padding-right: 46px; } .input-unit .input { padding-right: 52px; }
.input-suffix > span, .input-unit > span { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); line-height: 1; color: var(--text-3); font-size: var(--fs-sm); pointer-events: none; }
.input-suffix:has(.input:disabled) > span, .input-unit:has(.input:disabled) > span { opacity: .7; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
/* horizontal scroll affordance (ui.js initScrollHints): fade the edge where more content is hidden – alpha mask only, no colour */
.sc-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.sc-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
.sc-l.sc-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
@media (max-width: 720px) { .tbl th.hm, .tbl td.hm { display: none; } }
.chip { display: inline-flex; align-items: center; gap: 6px; height: var(--control-h-sm); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); font-weight: 550; color: var(--text-2); user-select: none; white-space: nowrap; transition: background .12s, border-color .12s; }
button.chip:hover, label.chip:hover { border-color: var(--input-border-hover); color: var(--text); }
.chip[aria-pressed="true"], .chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.chip .n { font-size: 11px; color: var(--text-3); font-weight: 600; } .chip.on .n { color: var(--primary); }

/* toggle switch – SHSS standard (pill, ON = brand, label clickable, role=switch, keyboard) */
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 28px; cursor: pointer; user-select: none; border-radius: var(--radius-control); }
.switch .track { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--border-strong); transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch:hover:not([aria-disabled="true"]) .track { background: var(--input-border-hover); }
.switch[aria-checked="true"] .track, .switch[aria-checked="true"]:hover .track { background: var(--primary); } .switch[aria-checked="true"] .track::after { transform: translateX(18px); }
.switch:focus-visible { outline: none; } .switch:focus-visible .track { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus); }
.switch[aria-disabled="true"] { opacity: .5; cursor: not-allowed; } .switch .txt { font-size: var(--fs); line-height: 1.35; } .switch .txt small { display: block; color: var(--text-3); font-size: var(--fs-xs); }

/* segmented control – outer height = --input-h, so it lines up with inputs and buttons in the same row */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: calc(var(--radius-control) + 2px); flex-wrap: wrap; }
.seg button { height: calc(var(--input-h) - 6px); padding: 0 12px; border: 0; border-radius: calc(var(--radius-control) - 1px); background: transparent; color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button:focus-visible { outline-offset: -2px; }
/* inside a form field the switch spans the field: options share the width evenly (no empty half) */
.field > .seg, .seg.full { display: flex; width: 100%; box-sizing: border-box; } .field > .seg button, .seg.full button { flex: 1 1 0; min-width: fit-content; }

/* phones: 16px text in every field (iOS zooms below that), larger touch targets */
@media (max-width: 720px) {
  .input, .palette input { font-size: 16px !important; }   /* guard: area CSS loaded later must not shrink it again */
  .check, .switch { min-height: 40px; }
  .check input { width: 20px; height: 20px; }
}

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- badges & status pills (always text + colour) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--neutral-bg); color: var(--text-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; } .badge.plain::before { display: none; }
.badge.ok { background: var(--success-bg); color: var(--success); } .badge.warn { background: var(--warning-bg); color: var(--warning); } .badge.err { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); } .badge.brand { background: var(--primary-soft); color: var(--primary); } .badge.accent { background: var(--accent-50); color: var(--accent-text); }
.pf { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); } .pf i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl th.sortable { cursor: pointer; user-select: none; } .tbl th.sortable:hover { color: var(--text); } .tbl th .arr { opacity: .6; margin-left: 3px; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; } .tbl tbody tr:hover td { background: var(--surface-2); } .tbl tr.click { cursor: pointer; }
.tbl .r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; } .tbl .c { text-align: center; } .tbl td.sub { color: var(--text-3); font-size: var(--fs-xs); }
.tbl tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); }
.tbl .mini { color: var(--text-3); font-size: 11.5px; display: block; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); flex-wrap: wrap; }

/* filter bar */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; height: var(--control-h-sm); font-size: var(--fs-sm); }
.filters > .btn, .filters .row > .btn { height: var(--control-h-sm); }
.filters .search-in { min-width: 220px; }

/* ---------- empty / loading / alerts ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); } .empty > .icon { width: 36px; height: 36px; margin: 0 auto 10px; stroke: var(--text-3); }
.empty h3 { color: var(--text); margin-bottom: 4px; } .empty.small { padding: 20px; }
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: var(--fs-sm); background: var(--info-bg); color: var(--text); border: 1px solid transparent; }
.alert .icon { margin-top: 1px; } .alert.ok { background: var(--success-bg); } .alert.warn { background: var(--warning-bg); } .alert.err { background: var(--danger-bg); } .alert b { font-weight: 650; }

/* ---------- overlays ---------- */
.backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .12s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop .15s ease; }
.modal.wide { width: min(860px, 100%); } .modal.xwide { width: min(1100px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); } .modal-head h2 { font-size: var(--fs-lg); }
.modal-body { padding: 20px; overflow-y: auto; } .modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.drawer-bd { position: fixed; inset: 0; background: var(--overlay); z-index: 70; animation: fade .12s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 71; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease; }
.drawer.wide { width: min(760px, 100vw); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 36px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 550; animation: pop .15s; max-width: 420px; }
.toast-act { margin-left: 6px; padding: 6px 10px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--bg) 16%, transparent); color: inherit; font: inherit; font-weight: 700; cursor: pointer; min-height: 32px; }
.toast-act:hover { background: color-mix(in srgb, var(--bg) 26%, transparent); } .toast-act:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.toast.err { background: var(--danger); color: #fff; } .toast.ok .icon { stroke: #4ade80; }
.dd-menu { position: fixed; z-index: 85; min-width: 220px; max-width: calc(100vw - 16px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .1s; }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: var(--fs-sm); border: 0; background: none; cursor: pointer; text-align: left; text-decoration: none !important; }
.dd-menu > button > span { flex: 1; min-width: 0; overflow-wrap: anywhere; } .dd-menu > button > .icon { color: var(--text-3); }
/* language menus: flag + name + check in one row */
.dd-menu > button > span:has(> .flag), .dd-menu > button > span:has(> .icon:last-child) { display: flex; align-items: center; gap: 10px; } .dd-menu > button > span > .ellipsis { flex: 1; min-width: 0; }
.csx-pop .csx-opt { overflow-wrap: anywhere; } .dd-menu > button > span > .flag { flex: none; } .dd-menu > button > span > .icon:last-child { margin-left: auto; color: var(--primary); }
.dd-menu a:hover, .dd-menu button:hover, .dd-menu .sel { background: var(--surface-3); }
.dd-menu [role^="menuitem"]:focus-visible { outline: none; background: var(--surface-3); box-shadow: inset 0 0 0 2px var(--focus); }
@media (max-width: 720px) { .dd-menu > button, .dd-menu > a { min-height: 44px; } } .dd-menu .sep { height: 1px; background: var(--border); margin: 6px 0; } .dd-menu .head { padding: 8px 10px; }
.dropdown { position: relative; }

/* language switch (flags) */
.flag { display: block; width: 22px; height: 16.5px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(15, 29, 43, .14); flex: none; }
[data-mode="dark"] .flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.lang-btn { display: inline-flex; align-items: center; gap: 8px; }

/* palette */
.palette .list { max-height: 50vh; overflow-y: auto; padding: 6px; } .palette input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; height: 52px; padding: 0 18px; font-size: var(--fs-md); width: 100%; background: transparent; outline: none; }
.palette .item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; } .palette .item.sel { background: var(--primary-soft); }

/* ---------- auth pages ---------- */
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: var(--fs-xs); margin: 16px 0; } .divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* charts */
.chart { width: 100%; } .chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); } .chart .grid line { stroke: var(--border); }
.chart-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--text); color: var(--bg); padding: 8px 10px; border-radius: 9px; font-size: 12px; box-shadow: var(--shadow-lg); max-width: 260px; }
.chart-tip b { font-weight: 650; } .chart-tip .r { display: flex; justify-content: space-between; gap: 14px; }
.hm { display: grid; grid-template-columns: 34px repeat(24, minmax(10px, 1fr)); gap: 2px; font-size: 10px; color: var(--text-3); } .hm div.c { aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); }
.rank { display: flex; flex-direction: column; gap: 10px; } .rank .it { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.rank .bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 4px; } .rank .bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.map { height: 420px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); }
.leaflet-container { font-family: var(--font); }

/* misc */
.dl { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 14px; font-size: var(--fs-sm); } .dl dt { color: var(--text-3); } .dl dd { margin: 0; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; } .steps .s { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; }
.steps .s .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; } .steps .s.on { color: var(--text); } .steps .s.on .n { background: var(--primary); color: var(--on-primary); }
.steps .s.done .n { background: var(--success-bg); color: var(--success); } .steps .line { width: 24px; height: 2px; background: var(--border); align-self: center; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; } .progress span { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.qr { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--border); background: #fff; padding: 8px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.list-plain { list-style: none; margin: 0; padding: 0; } .list-plain li { padding: 10px 0; border-bottom: 1px solid var(--border); } .list-plain li:last-child { border-bottom: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
[data-period-picker] [data-custom] .input { width: 160px; }
@media (max-width: 720px) { [data-period-picker] [data-custom] { flex: 1 1 100%; } [data-period-picker] [data-custom] .input { flex: 1; width: auto; } [data-period-picker] { max-width: 100%; } [data-period-picker] .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; } }

/* product logo lockup (ui.js brandLogo): icon + wordmark with the gaps of logo-horizontal.svg; tone 'auto' shows one wordmark per mode */
.brand-logo { display: inline-flex; align-items: center; gap: calc(var(--bl-h) * .243); line-height: 0; }
.brand-logo .logo { flex: none; width: var(--bl-h); height: var(--bl-h); }
.brand-logo__wm { flex: none; height: calc(var(--bl-h) * .583); width: auto; margin-top: calc(var(--bl-h) * .107); }
[data-mode="dark"] .brand-logo__wm.only-light, :root:not([data-mode="dark"]) .brand-logo__wm.only-dark { display: none; }
@media (max-width: 380px) { .brand-logo--small .brand-logo__wm { display: none; } }

/* =====================================================================
   Custom form controls (ui.js): select, date / date-time picker, date range, tooltips.
   The native control stays in the DOM (value, name, validation, events) but is invisible: .ui-native.
   ===================================================================== */
.ui-native { position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
  opacity: 0 !important; pointer-events: none !important; overflow: hidden !important; box-shadow: none !important; }
.csx[hidden], .dpx[hidden], .rng[hidden] { display: none !important; }   /* the native control is hidden by code → its visible control too */
/* select trigger: looks like select.input (same chevron), text ends with … */
.input.csx { display: flex; align-items: center; padding-right: 34px; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input.csx.sm { padding-right: 30px; background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; }
.input.csx[aria-expanded="true"] { border-color: var(--primary); box-shadow: var(--ring);
  background-image: linear-gradient(135deg, transparent 50%, var(--text-3) 50%), linear-gradient(45deg, var(--text-3) 50%, transparent 50%); }
.input.csx:disabled { cursor: not-allowed; }
.csx-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.csx.is-empty .csx-v { color: var(--placeholder); }

/* floating popup (custom select, date picker, range picker) – same surface as the dropdown menus */
.pop { position: fixed; z-index: 90; min-width: 180px; max-width: calc(100vw - 16px); overflow: auto; overscroll-behavior: contain; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .1s; font-size: var(--fs-sm); }
.pop.is-up { animation-name: pop-up; } @keyframes pop-up { from { transform: translateY(-6px) scale(.98); opacity: 0; } }
.pop-bd { position: fixed; inset: 0; z-index: 89; background: var(--overlay); animation: fade .12s; }
.pop.is-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100% !important; max-width: none; min-width: 0 !important; max-height: 85vh; border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: sheet .18s ease; }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
.csx-pop { padding: 6px; display: flex; flex-direction: column; width: max-content; }
.csx-search { position: sticky; top: -6px; z-index: 1; display: flex; align-items: center; gap: 6px; margin: -6px -6px 6px; padding: 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.csx-search .icon { position: absolute; left: 18px; color: var(--text-3); pointer-events: none; } .csx-search .input { padding-left: 32px; }
.csx-list { display: grid; gap: 1px; }
.csx-opt { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--text); line-height: 1.35; }
.csx-opt > span:last-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.csx-opt.is-active { background: var(--surface-3); }
.csx-opt[aria-selected="true"] { color: var(--primary); font-weight: 600; }
.csx-opt[aria-disabled="true"] { color: var(--text-4); cursor: not-allowed; background: none; }
.csx-tick { visibility: hidden; color: var(--primary); } .csx-opt[aria-selected="true"] .csx-tick { visibility: visible; }
.csx-box { flex: none; width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--surface); position: relative; }
.csx-opt[aria-selected="true"] .csx-box { background: var(--primary); border-color: var(--primary); }
.csx-opt[aria-selected="true"] .csx-box::after { content: ''; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.csx-gh { padding: 8px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.csx-none { padding: 14px 10px; color: var(--text-3); text-align: center; }
.pop.is-sheet .csx-opt { min-height: 46px; font-size: 16px; } .pop.is-sheet .csx-search .input { font-size: 16px; }

/* date field: text input (typed DD.MM.YYYY) + calendar button inside */
.dpx { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; }
.dpx > .dpx-in { padding-right: 40px; font-variant-numeric: tabular-nums; }
.dpx > .dpx-in.sm { padding-right: 34px; }
.dpx-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-3); cursor: pointer; }
.dpx-in.sm + .dpx-btn { width: 28px; height: 28px; right: 3px; } .dpx-in.sm + .dpx-btn .icon { width: 16px; height: 16px; }
.dpx-btn:hover:not(:disabled), .dpx-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--primary); }
.dpx-btn:disabled { opacity: .5; cursor: not-allowed; }
.dpx-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.filters .dpx, .row > .dpx, .actions > .dpx { width: auto; }
.filters .dpx > .dpx-in { min-width: 150px; }

/* date picker popup */
.dpk { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.dpk-main { display: flex; gap: 10px; }
.dpk-cal { width: 266px; }
.pop.is-sheet .dpk-cal { width: auto; }
.dpk-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.dpk-head .dpk-title { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 650; text-transform: capitalize; cursor: pointer; }
button.dpk-title:hover:not(:disabled) { background: var(--surface-3); } button.dpk-title:disabled { cursor: default; } span.dpk-title { cursor: default; }
.dpk-nav { display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-2); cursor: pointer; }
.dpk-nav:hover { border-color: var(--primary); color: var(--primary); } .dpk-nav .icon { width: 16px; height: 16px; }
.dpk-grid { border-collapse: collapse; table-layout: fixed; width: 100%; }
.dpk-grid th { padding: 4px 0; font-size: 11px; font-weight: 650; color: var(--text-3); text-align: center; }
.dpk-grid td { height: 38px; padding: 1px 0; text-align: center; }
.pop.is-sheet .dpk-grid td { height: 46px; }
.dpk-day { width: 100%; min-width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 550;
  font-variant-numeric: tabular-nums; cursor: pointer; }
.dpk-day:hover { background: var(--primary-soft); color: var(--primary); }
.dpk-day.out { color: var(--text-4); font-weight: 450; }
.dpk-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); color: var(--primary); font-weight: 700; }
.dpk-day.in { background: var(--primary-soft); color: var(--text); border-radius: 0; }
.dpk-day.sel, .dpk-day.sel:hover { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.dpk-day.r-start:not(.r-end) { border-radius: 8px 0 0 8px; } .dpk-day.r-end:not(.r-start) { border-radius: 0 8px 8px 0; }
.dpk-day[aria-disabled="true"], .dpk-day[aria-disabled="true"]:hover { background: none; color: var(--text-4); text-decoration: line-through; cursor: not-allowed; box-shadow: none; }
.dpk-day:focus-visible, .dpk-mgrid button:focus-visible, .dpk-times button:focus-visible, .rngp-presets button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; position: relative; z-index: 1; }
.dpk-mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0; }
.dpk-mgrid button { height: 44px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: inherit; font-weight: 550; text-transform: capitalize; cursor: pointer; }
.dpk-mgrid button:hover { background: var(--primary-soft); color: var(--primary); } .dpk-mgrid button.today { border-color: var(--primary); }
.dpk-mgrid button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.dpk-time { position: relative; width: 84px; border-left: 1px solid var(--border); padding-left: 10px; }
.dpk-time-h { height: 32px; margin-bottom: 4px; display: grid; place-items: center; font-weight: 650; }
.dpk-times { position: absolute; top: 36px; bottom: 0; left: 10px; right: 0; overflow-y: auto; display: grid; align-content: start; gap: 2px; scrollbar-width: thin; }
.dpk-times button { height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.dpk-times button:hover { background: var(--primary-soft); color: var(--primary); }
.dpk-times button[aria-selected="true"] { background: var(--primary); color: var(--on-primary); font-weight: 650; }
.dpk-foot { display: flex; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pop.is-sheet.dpk { padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.pop.is-sheet .dpk-day { height: 44px; font-size: 15px; }
.pop.is-sheet .dpk-main { flex-direction: column; }
.pop.is-sheet .dpk-time { width: auto; border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 8px; }
.pop.is-sheet .dpk-times { position: static; height: auto; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; gap: 4px; padding-bottom: 4px; }
.pop.is-sheet .dpk-times button { flex: none; width: 64px; height: 40px; }
.pop.is-sheet .dpk-time-h { height: auto; place-items: start; margin-bottom: 6px; }
.pop.is-sheet .dpk-foot .btn { height: 40px; }

/* date range: one trigger for from/to (filters, reports), popup with presets + two months */
.rng { position: relative; display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.rng > .rng-btn { display: inline-flex; align-items: center; gap: 8px; width: auto; min-width: 210px; max-width: 100%; padding-right: 12px; cursor: pointer; text-align: left; white-space: nowrap; }
.rng.has-value:not([data-required]) > .rng-btn { padding-right: 36px; }
.rng-btn > .icon { color: var(--text-3); }
.rng-v { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.rng-v b { font-weight: 600; } .rng-v small { color: var(--text-3); font-size: var(--fs-xs); }
.rng-btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: var(--ring); }
.rng-clr { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; }
.rng-clr:hover { background: var(--surface-3); color: var(--text); } .rng-clr[hidden] { display: none; }
.rngp { display: flex; padding: 0; }
.rngp-presets { display: flex; flex-direction: column; gap: 2px; width: 172px; flex: none; padding: 10px; border-right: 1px solid var(--border); background: var(--surface-2); border-radius: 12px 0 0 12px; }
.rngp-presets button { display: flex; align-items: center; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: inherit; font-weight: 550; text-align: left; cursor: pointer; white-space: nowrap; }
.rngp-presets button:hover { background: var(--surface-3); color: var(--text); }
.rngp-presets button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.rngp-main { display: flex; flex-direction: column; gap: 6px; padding: 10px; min-width: 0; }
.rngp-cal .dpk-head { gap: 8px; } .rngp-cal .dpk-head .dpk-title { flex: 1; }
.rngp-months { display: flex; align-items: flex-start; gap: 18px; } .rngp-months .dpk-grid { width: 266px; }
.rngp .dpk-foot { justify-content: flex-end; } .rngp-sel { margin-right: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pop.is-sheet.rngp { flex-direction: column; }
.pop.is-sheet .rngp-presets { width: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); border-radius: 16px 16px 0 0; gap: 6px; }
.pop.is-sheet .rngp-presets button { height: 36px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); }
.pop.is-sheet .rngp-presets button[aria-pressed="true"] { border-color: var(--primary); }
.pop.is-sheet .rngp-months .dpk-grid { width: 100%; } .pop.is-sheet .rngp-sel { flex-basis: 100%; } .pop.is-sheet .rngp-main { padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); }
@media (max-width: 720px) { .rng, .filters .rng { width: 100%; } .rng > .rng-btn { width: 100%; min-width: 0; } }
[data-period-picker] { min-width: 0; }

/* tooltip (ui.js [data-tip] / [data-tip-rail]) */
.tip { position: fixed; z-index: 110; max-width: 260px; padding: 6px 10px; border-radius: 8px; background: var(--tip-bg); color: var(--tip-fg); font-size: var(--fs-xs); font-weight: 550; line-height: 1.35;
  box-shadow: var(--shadow); pointer-events: none; animation: fade .12s; white-space: nowrap; }

/* checkbox / radio: themed box with brand fill (keyboard focus ring); :where() keeps it below every area rule (sizes, hidden inputs) */
input:where([type="checkbox"], [type="radio"]) { -webkit-appearance: none; appearance: none; display: inline-grid; place-content: center; flex: none;
  width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--border-strong); border-radius: 5px; background-color: var(--input-bg); vertical-align: -4px; transition: background-color .12s, border-color .12s; }
input:where([type="radio"]) { border-radius: 50%; }
input:where([type="checkbox"], [type="radio"]):hover:not(:disabled) { border-color: var(--primary); }
input:where([type="checkbox"]:checked, [type="checkbox"]:indeterminate, [type="radio"]:checked) { background-color: var(--primary); border-color: var(--primary); }
input:where([type="checkbox"]:checked)::after { content: ''; width: 5px; height: 9px; margin-top: -2px; border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg); }
input:where([type="checkbox"]:indeterminate)::after { content: ''; width: 8px; height: 2px; background: var(--on-primary); }
input:where([type="radio"]:checked)::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--on-primary); }
input:where([type="checkbox"], [type="radio"]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:where([type="checkbox"], [type="radio"]):disabled { background-color: var(--input-disabled-bg); border-color: var(--border); }
input:where([type="checkbox"]:checked, [type="radio"]:checked):disabled { background-color: var(--text-4); border-color: var(--text-4); }

/* scrollbars: thin, token colours (light + dark) */
html { scrollbar-color: var(--scroll-thumb) transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-4); }

/* empty state: icon in a soft brand circle (like the notification panel) */
.empty > .icon { box-sizing: content-box; width: 26px; height: 26px; padding: 14px; border-radius: 50%; background: var(--primary-soft); stroke: var(--primary); }
@media (prefers-reduced-motion: reduce) { .pop, .pop-bd, .tip { animation: none; } }
