/* ==========================================================================
   HABISCOPE · DESIGN SYSTEM (ds.css)
   Shared by the application (index.html) and the administration (admin.html).
   The public pages (commune.css) mirror the same tokens.

   RULE: every new screen reuses these tokens and components. No raw native
   control (select, checkbox, file...) and no decorative inline style: only
   truly dynamic values (a bar width in %, a computed colour) stay inline.

   TOKENS (:root, light; dark under prefers-color-scheme or data-theme)
     colour   --bg --panel --soft --ink --ink2 --muted --line --line2 --line-strong
              --accent --accent2 --accent-soft --accent-solid --on-accent --btn-tint
              --ok --warn --err (+ -soft, + --ok-solid --err-solid)  --hl
     type     --font  --text-2xs 11 · xs 12 · sm 13 · md 14 · base 15 · lg 17 · xl 20 · 2xl 24 · 3xl 30
     space    --space-1 4 · 2 8 · 3 12 · 4 16 · 5 20 · 6 24 · 8 32 · 10 40 · 12 48
     radius   --radius-xs 6 · sm 8 · (base) 10 · md 12 · lg 14 · xl 18 · pill
     controls --control-sm 32 · --control 40 · --control-lg 46 (44 on touch screens)
     shadow   --shadow-xs · --shadow · --shadow-md · --shadow-lg
     focus    --focus-ring (keyboard), --ring (focused field)
     z-index  --z-drawer 80 · --z-sticky 900 · --z-header 1000 · --z-header-mobile 1100
              --z-floating 1500 · --z-lightbox 3000 · --z-modal 4000 · --z-toast 5000
     motion   --dur-fast .12s · --dur .18s · --ease ; prefers-reduced-motion respected

   COMPONENTS
     .btn            primary · .ghost (secondary) · .quiet (discreet) · .danger
                     sizes .sm .lg · .icon (square) · .full · loading: <span class="spin">
     fields          native input/select/textarea are styled without any class;
                     .field (label + control + .hint + .field-error) · .field.inline
     select          appearance:none + chevron, everywhere
     .check          checkbox or radio + text (alias .chk) ; custom boxes, keyboard focus
     .switch         on/off setting: <label class="switch"><input type="checkbox" role="switch"><span>text</span></label>
     .segmented      radio group as a segmented control (.sm, .full, .on-dark)
     .seg            same look, with buttons (views, table/chart switches)
     .dropzone       file input hidden but focusable, covering a dashed zone
     .file-btn       a .btn label around a visually hidden file input
     .card .panel    surfaces ; .b / .badge (ok warn err info acc) ; .chip
     .alert          page banner ; .callout (info ok warn err) in-card message
     .modal .mbox    dialog ; .mtabs (tabs in a dialog) ; .tabs (underline)
     .meter          progress bar ; .steps (.step.run .ok .err) ; .sk / .skeleton
     .empty-state    nothing to show yet
     utilities       .mt-0..mt-5 .mb-0..mb-4 .m-0 .block .text-right .text-center
                     .text-sm .text-xs .nowrap .min-w-0 .grow .ml-auto .row .stack .sr-only
   ========================================================================== */

:root {
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, Consolas, "SFMono-Regular", monospace;
  --bg: #f4f5f7; --panel: #ffffff; --soft: #f7f8fa; --ink: #14171f; --ink2: #3b4150; --muted: #5f6673;
  --line: #e5e7eb; --line2: #eef0f3; --line-strong: #cfd4dc;
  --accent: #2448c7; --accent2: #5b7cfa; --accent-soft: #e9eefc; --accent-solid: #2448c7; --on-accent: #ffffff;
  --ok: #0f7d4a; --ok-soft: #e3f4ea; --ok-solid: #0f7d4a;
  --warn: #a14a07; --warn-soft: #fdf1e1;
  --err: #c0362c; --err-soft: #fbe8e6; --err-solid: #c0362c;
  --hl: #fff8e1; --sk1: #eceef2; --sk2: #f6f7f9; --hero-glow: rgba(36,72,199,.10);
  --field-bg: #ffffff; --field-bg-focus: #ffffff; --seg-bg: #eef0f4; --seg-active: #ffffff;
  --overlay: rgba(10,14,25,.55); --btn-tint: rgba(0,0,0,.1);

  --text-2xs: 11px; --text-xs: 12px; --text-sm: 13px; --text-md: 14px; --text-base: 15px; --text-lg: 17px; --text-xl: 20px; --text-2xl: 24px; --text-3xl: 30px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px;
  --radius-xs: 6px; --radius-sm: 8px; --radius: 10px; --radius-md: 12px; --radius-lg: 14px; --radius-xl: 18px; --radius-pill: 999px;
  --control-sm: 32px; --control: 40px; --control-lg: 46px;

  --shadow-xs: 0 1px 2px rgba(16,24,40,.06);
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-md: 0 8px 20px -10px rgba(16,24,40,.22);
  --shadow-lg: 0 24px 48px -12px rgba(16,24,40,.18);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent);
  --ring: 0 0 0 3px var(--accent-soft);

  --z-drawer: 80; --z-sticky: 900; --z-header: 1000; --z-header-mobile: 1100; --z-floating: 1500; --z-lightbox: 3000; --z-modal: 4000; --z-toast: 5000;
  --dur-fast: .12s; --dur: .18s; --ease: cubic-bezier(.2, .7, .3, 1);

  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6673' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --checkmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (pointer: coarse) { :root { --control: 44px; --control-lg: 48px; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --panel: #171a21; --soft: #1d2129; --ink: #eef0f4; --ink2: #c9cdd6; --muted: #949cab;
    --line: #2a2f3a; --line2: #222631; --line-strong: #3a404d;
    --accent: #8aa5ff; --accent2: #aabdff; --accent-soft: #1f2a4d; --accent-solid: #3b5ce0; --on-accent: #ffffff;
    --ok: #4cc58a; --ok-soft: #173326; --ok-solid: #12804c;
    --warn: #f0a94a; --warn-soft: #3a2a12;
    --err: #ff8577; --err-soft: #3d1c19; --err-solid: #c23a2f;
    --hl: #2f2a16; --sk1: #20242d; --sk2: #2a2f3a; --hero-glow: rgba(138,165,255,.12);
    --field-bg: #1d2129; --field-bg-focus: #20242d; --seg-bg: #11141a; --seg-active: #262b36;
    --overlay: rgba(0,0,0,.6); --btn-tint: rgba(255,255,255,.1);
    --shadow-xs: none; --shadow: none; --shadow-md: 0 10px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.5);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23949cab' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --panel: #171a21; --soft: #1d2129; --ink: #eef0f4; --ink2: #c9cdd6; --muted: #949cab;
  --line: #2a2f3a; --line2: #222631; --line-strong: #3a404d;
  --accent: #8aa5ff; --accent2: #aabdff; --accent-soft: #1f2a4d; --accent-solid: #3b5ce0; --on-accent: #ffffff;
  --ok: #4cc58a; --ok-soft: #173326; --ok-solid: #12804c; --warn: #f0a94a; --warn-soft: #3a2a12; --err: #ff8577; --err-soft: #3d1c19; --err-solid: #c23a2f;
  --hl: #2f2a16; --sk1: #20242d; --sk2: #2a2f3a; --hero-glow: rgba(138,165,255,.12);
  --field-bg: #1d2129; --field-bg-focus: #20242d; --seg-bg: #11141a; --seg-active: #262b36; --overlay: rgba(0,0,0,.6); --btn-tint: rgba(255,255,255,.1);
  --shadow-xs: none; --shadow: none; --shadow-md: 0 10px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.5);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23949cab' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: var(--text-md)/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
button { font-family: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------------ native controls: never raw, even without a class */
:where(input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=number], input[type=tel], input[type=date], select, textarea) {
  font: var(--text-base)/1.4 var(--font); color: var(--ink); background-color: var(--field-bg); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 0 var(--space-3); min-width: 0; max-width: 100%;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
:where(input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=number], input[type=tel], input[type=date], select) { height: var(--control); }
:where(textarea) { padding: 10px var(--space-3); min-height: 84px; resize: vertical; line-height: 1.5; }
:where(input, select, textarea)::placeholder { color: var(--muted); opacity: .85; }
:where(input:not([type=checkbox], [type=radio], [type=range], [type=file]), select, textarea):hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }
:where(input:not([type=checkbox], [type=radio], [type=range], [type=file]), select, textarea):focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background-color: var(--field-bg-focus); }
:where(input, select, textarea):disabled { opacity: .55; cursor: not-allowed; }
:where(input[type=number]) { font-variant-numeric: tabular-nums; }
:where(select) {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 34px; text-overflow: ellipsis;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
}
:where(select[multiple]) { background-image: none; height: auto; padding: 6px; }
:where(select) option { background: var(--panel); color: var(--ink); }
:where(input[type=checkbox], input[type=radio]) {
  -webkit-appearance: none; appearance: none; flex: none; width: 18px; height: 18px; margin: 0; vertical-align: -4px; cursor: pointer;
  border: 1.5px solid var(--line-strong); background: var(--field-bg); border-radius: 5px; display: inline-grid; place-content: center;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
:where(input[type=radio]) { border-radius: 50%; }
:where(input[type=checkbox], input[type=radio]):hover { border-color: var(--accent); }
:where(input[type=checkbox]):checked { background: var(--accent-solid) var(--checkmark) center / 12px no-repeat; border-color: var(--accent-solid); }
:where(input[type=radio]):checked { border-color: var(--accent-solid); background: var(--accent-solid); box-shadow: inset 0 0 0 3.5px var(--field-bg); }
:where(input[type=checkbox], input[type=radio]):focus-visible { outline: none; box-shadow: var(--focus-ring); }
:where(input[type=radio]):checked:focus-visible { box-shadow: inset 0 0 0 3.5px var(--field-bg), var(--focus-ring); }
:where(input[type=range]) { accent-color: var(--accent-solid); cursor: pointer; }
:where(input[type=file]) { font: var(--text-sm) var(--font); color: var(--muted); max-width: 100%; }
:where(input[type=file])::file-selector-button {
  height: var(--control-sm); margin-right: var(--space-3); padding: 0 var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); font: 600 var(--text-sm) var(--font); cursor: pointer;
}
:where(input[type=file])::file-selector-button:hover { background: var(--soft); }
:where(fieldset) { min-width: 0; }

/* ------------------------------------------------------------------ buttons */
.btn {
  --btn-h: var(--control); height: var(--btn-h); padding: 0 18px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--accent-solid); color: var(--on-accent); font: 600 var(--text-md)/1 var(--font); letter-spacing: -.003em;
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  text-decoration: none !important; -webkit-tap-highlight-color: transparent; user-select: none;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform var(--dur-fast) ease;
}
/* hover darkens (lightens in dark mode) any button colour, custom ones included */
.btn:hover:not(:disabled) { background-image: linear-gradient(var(--btn-tint), var(--btn-tint)); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled:has(.spin), .btn.is-loading { opacity: .85; cursor: progress; }
.btn svg { flex: none; }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line-strong)); }
.btn.quiet { background: transparent; color: var(--ink2); border-color: transparent; }
.btn.quiet:hover { background: var(--soft); color: var(--ink); }
.btn.danger { background: var(--err-solid); color: #fff; }
.btn.ghost.danger { background: var(--panel); color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.btn.ghost.danger:hover { background: var(--err-soft); }
.btn.sm { --btn-h: var(--control-sm); padding: 0 12px; font-size: var(--text-sm); border-radius: var(--radius-sm); gap: 6px; }
.btn.lg { --btn-h: var(--control-lg); padding: 0 22px; font-size: var(--text-base); }
.btn.icon { width: var(--btn-h); padding: 0; }
.btn.full { width: 100%; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .8s linear infinite; display: inline-block; flex: none; }
.spin.dark, .btn.ghost .spin, .btn.quiet .spin { border-color: var(--line); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -200% 0; } }
/* text button inside a sentence */
.mlink { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; border-radius: 4px; }
.mlink:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------------ fields */
.field { display: grid; gap: 6px; margin-bottom: var(--space-4); min-width: 0; }
.field > label, .label { font: 600 var(--text-sm)/1.35 var(--font); color: var(--ink2); }
.field > label .dim, .label .dim { font-weight: 500; }
.field input:not([type=checkbox], [type=radio], [type=file], [type=range]), .field select, .field textarea { width: 100%; }
.hint, .field .hint { font-size: var(--text-xs); color: var(--muted); line-height: 1.4; }
.field-error, .merr { color: var(--err); font-size: var(--text-sm); font-weight: 500; line-height: 1.4; min-height: 18px; margin: var(--space-1) 0 var(--space-3); }
.field-error:empty, .merr:empty { min-height: 0; margin: 0; }
.field.invalid :is(input, select, textarea) { border-color: var(--err); }
.field.invalid :is(input, select, textarea):focus { box-shadow: 0 0 0 3px var(--err-soft); }
.field-count { text-align: right; color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 var(--space-3); }
.form-grid > .span-all { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* checkbox or radio with its text */
.check, .chk { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; font-size: var(--text-sm); color: var(--ink2); line-height: 1.5; margin: var(--space-1) 0 var(--space-4); cursor: pointer; }
.check > input, .chk > input { margin-top: 1px; }
.check.inline { display: inline-grid; margin: 0; align-items: center; }
.check.inline > input { margin-top: 0; }

/* ------------------------------------------------------------------ switch (a setting that applies at once) */
/* <label class="switch"><input type="checkbox" role="switch"><span>Label<small>hint</small></span></label> */
.switch { display: inline-flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; font-size: var(--text-md); color: var(--ink); line-height: 1.4; min-width: 0; }
.switch > input { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 38px; height: 22px; margin: 0; border: 0; border-radius: var(--radius-pill);
  background: var(--line-strong); cursor: pointer; transition: background-color var(--dur) var(--ease), box-shadow var(--dur-fast) ease; }
.switch > input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.25); transition: transform var(--dur) var(--ease); }
.switch > input:hover { background: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }
.switch > input:checked { background: var(--accent-solid); }
.switch > input:checked::before { transform: translateX(16px); }
.switch > input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.switch > input:disabled { opacity: .5; cursor: not-allowed; }
.switch > span { display: grid; gap: 2px; min-width: 0; padding-top: 1px; font-weight: 600; }
.switch > span small { font-weight: 500; font-size: var(--text-xs); color: var(--muted); line-height: 1.45; }
.switch:has(> input:disabled) { cursor: not-allowed; }
.switch.busy > input { cursor: progress; }

/* ------------------------------------------------------------------ segmented control (radio group) */
.segmented { --seg-h: var(--control); display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; min-width: 0;
  background: var(--seg-bg); border: 1px solid var(--line); border-radius: var(--radius-md); }
.segmented > label { position: relative; display: flex; min-width: 0; cursor: pointer; }
.segmented > label > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.segmented > label > span { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; height: calc(var(--seg-h) - 8px);
  padding: 0 14px; border-radius: 9px; color: var(--muted); font: 600 var(--text-sm)/1 var(--font); white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.segmented > label > span svg { flex: none; opacity: .8; }
.segmented > label > span > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.segmented > label:hover > span { color: var(--ink); }
.segmented > label > input:checked + span { background: var(--seg-active); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 0 0 1px var(--line); }
.segmented > label > input:checked + span svg { color: var(--accent); opacity: 1; }
.segmented > label > input:focus-visible + span { box-shadow: var(--focus-ring); }
.segmented.sm { --seg-h: var(--control-sm); border-radius: var(--radius); }
.segmented.sm > label > span { padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.segmented.full { display: grid; width: 100%; }
/* the same control on the blue gradient (call to action) */
.segmented.on-dark { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); }
.segmented.on-dark > label > span { color: #dbe4ff; }
.segmented.on-dark > label:hover > span { color: #fff; }
.segmented.on-dark > label > input:checked + span { background: #fff; color: #1c3aa8; box-shadow: 0 2px 8px rgba(8,16,48,.25); }
.segmented.on-dark > label > input:checked + span svg { color: #2448c7; }
.segmented.on-dark > label > input:focus-visible + span { box-shadow: 0 0 0 3px rgba(255,255,255,.55); }

/* segmented look with buttons (.on = selected) */
.seg { display: inline-flex; gap: 2px; background: var(--seg-bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--ink2); font: 600 var(--text-sm) var(--font); padding: 6px 11px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; gap: 7px; align-items: center; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.seg button i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.seg button small { color: var(--muted); font-weight: 600; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--seg-active); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 0 0 1px var(--line); }
.seg button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.seg.sm { padding: 2px; border-radius: 9px; } .seg.sm button { padding: 3px 10px; font-size: var(--text-xs); border-radius: 7px; }

/* ------------------------------------------------------------------ files */
.dropzone { position: relative; display: grid; justify-items: center; gap: 4px; padding: 22px 16px; text-align: center; color: var(--ink2);
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--soft); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.dropzone > input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--soft)); }
.dropzone:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.dropzone .dz-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--panel); color: var(--accent); box-shadow: var(--shadow-xs); border: 1px solid var(--line); margin-bottom: 4px; }
.dropzone b { font-size: var(--text-md); color: var(--ink); font-weight: 650; }
.dropzone small { font-size: var(--text-xs); color: var(--muted); }
.file-btn { position: relative; }
.file-btn > input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0, 0, 0, 0); }
.file-btn:has(> input:focus-visible) { box-shadow: var(--focus-ring); }

/* ------------------------------------------------------------------ surfaces, badges, messages */
.card, .panel-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.b, .badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 600; line-height: 1.5;
  background: var(--soft); color: var(--ink2); white-space: nowrap; max-width: 100%; vertical-align: middle; }
:is(.b, .badge).ok { background: var(--ok-soft); color: var(--ok); }
:is(.b, .badge).warn { background: var(--warn-soft); color: var(--warn); }
:is(.b, .badge).err { background: var(--err-soft); color: var(--err); }
:is(.b, .badge):is(.info, .acc) { background: var(--accent-soft); color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.alert, .callout { border-radius: var(--radius); padding: 11px 14px; font-size: var(--text-md); line-height: 1.5; background: var(--err-soft); color: var(--err); font-weight: 500; }
.alert { margin-top: var(--space-3); }
.callout { margin: 0 0 var(--space-3); font-size: 13.5px; background: var(--soft); color: var(--ink2); }
:is(.alert, .callout).info { background: var(--accent-soft); color: var(--accent); }
:is(.alert, .callout).ok { background: var(--ok-soft); color: var(--ok); }
:is(.alert, .callout).warn { background: var(--warn-soft); color: var(--warn); }
:is(.alert, .callout).err { background: var(--err-soft); color: var(--err); }
:is(.alert, .callout) a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.callout > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ dialog, tabs */
.modal { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: var(--z-modal); padding: var(--space-4); }
.modal.on { display: flex; }
.modal.on .mbox { animation: mbox-in var(--dur) var(--ease); }
@keyframes mbox-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.mbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: min(440px, 100%); max-height: calc(100dvh - 32px);
  overflow: auto; padding: 26px; position: relative; overscroll-behavior: contain; }
.mbox h2, .mbox h3 { margin: 0 0 6px; font-size: var(--text-xl); letter-spacing: -.015em; line-height: 1.25; padding-right: 32px; }
.mbox .msub, .mbox > p { color: var(--muted); margin: 0 0 18px; line-height: 1.55; }
.mbox .x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius); background: none; border: 0;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease; }
.mbox .x:hover { background: var(--soft); color: var(--ink); }
.mbox .x:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (max-width: 520px) { .mbox { padding: 22px 18px; border-radius: 16px; } }
.mtabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; background: var(--seg-bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 3px; margin-bottom: 18px; }
.mtabs button { border: 0; background: none; height: 34px; padding: 0 10px; border-radius: 9px; font: 600 13.5px var(--font); color: var(--muted); cursor: pointer; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.mtabs button:hover { color: var(--ink); }
.mtabs button.on { background: var(--seg-active); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 0 0 1px var(--line); }
.mtabs button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 14px; font: 500 var(--text-md) var(--font); color: var(--muted);
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button:focus-visible { outline: none; box-shadow: inset var(--focus-ring); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

/* ------------------------------------------------------------------ data: tables, progress, loading, empty */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line2); }
.table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:hover td { background: var(--soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter { height: 6px; background: var(--line2); border-radius: var(--radius-pill); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s var(--ease); }
.meter.ok > i { background: var(--ok); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding: 4px 10px; border-radius: var(--radius-pill); background: var(--panel); border: 1px solid var(--line); }
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.step.run { color: var(--ink); border-color: var(--accent); } .step.run .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.step.ok .dot { background: var(--ok); } .step.err .dot { background: var(--err); }
.sk, .skeleton { display: grid; gap: 10px; }
:is(.sk, .skeleton) i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--sk1) 25%, var(--sk2) 50%, var(--sk1) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
:is(.sk, .skeleton) i:nth-child(3n) { width: 70%; } :is(.sk, .skeleton) i:nth-child(3n+2) { width: 88%; }
.empty-state { text-align: center; padding: 48px 24px; background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius-xl); color: var(--ink2); }
.empty-state h3 { margin: 12px 0 6px; font-size: 18px; } .empty-state p { margin: 0 auto 18px; color: var(--muted); max-width: 420px; }
.empty-state svg { color: var(--accent); }

/* ------------------------------------------------------------------ utilities (spacing on the 4 px scale) */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: var(--space-1) !important; } .mt-2 { margin-top: var(--space-2) !important; } .mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; } .mt-5 { margin-top: var(--space-5) !important; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: var(--space-1) !important; } .mb-2 { margin-bottom: var(--space-2) !important; } .mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.block { display: block !important; }
.text-right { text-align: right !important; } .text-center { text-align: center !important; } .text-left { text-align: left !important; }
.text-sm { font-size: var(--text-sm) !important; } .text-xs { font-size: var(--text-xs) !important; }
.nowrap { white-space: nowrap; } .min-w-0 { min-width: 0; } .grow { flex: 1; min-width: 0; } .ml-auto { margin-left: auto !important; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.stack { display: grid; gap: var(--space-3); }
.tone-ok { color: var(--ok) !important; } .tone-warn { color: var(--warn) !important; } .tone-err { color: var(--err) !important; } .tone-muted { color: var(--muted) !important; }
