/* ── Appearance system ────────────────────────────────────────────────────────
   Palettes live on [data-preset] (not :root) so that any element can wear one: the
   settings page paints each style's preview with its real colours. Dark variants are
   [data-preset][data-mode="dark"]; data-mode is set by the inline script in base.html
   (without JS everything falls back to light). */
:root { --font-scale:1; --ui-font:system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[data-font="system"] { --ui-font:system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[data-font="serif"]  { --ui-font:Georgia, "Times New Roman", serif; }
[data-font="narrow"] { --ui-font:"Arial Narrow", "Liberation Sans Narrow", Tahoma, sans-serif; }
[data-font="mono"]   { --ui-font:ui-monospace, Consolas, "DejaVu Sans Mono", monospace; }

/* wwtp (default): the logo's colours. Brown bar, blue accent (darkened until white text reads on it), sand
   background, grey for muted text. --brand-earth and --brand-water colour the name on the login page. */
:root, [data-preset="wwtp"] {
  --bg:#f6f2ea; --surface:#ffffff; --surface-2:#faf7f1; --border:#ddd3c2; --text:#2b1e13; --text-muted:#5b6763;
  --accent-base:#0273b6; --accent-hover:#015c93; --accent-contrast:#ffffff; --nav-bg:#643d21; --nav-text:#fbf6ee;
  --brand-earth:#643d21; --brand-water:#0285c4;
}
[data-preset="wwtp"][data-mode="dark"] {
  --bg:#14100c; --surface:#1d1711; --surface-2:#261e17; --border:#3a2e23; --text:#efe8dc; --text-muted:#a59c8f;
  --accent-base:#4fb3ee; --accent-hover:#7cc7f3; --accent-contrast:#06131c; --nav-bg:#2a1a0f; --nav-text:#efe8dc;
  --brand-earth:#d9b48c; --brand-water:#4fb3ee;
}
/* Blue () */
[data-preset="blue"] {
  --bg:#eceff3; --surface:#ffffff; --surface-2:#f4f6f9; --border:#ccd5df; --text:#12283c; --text-muted:#5b6f82;
  --accent-base:#17456b; --accent-hover:#0f3252; --accent-contrast:#ffffff; --nav-bg:#12304a; --nav-text:#eaf1f7;
}
[data-preset="blue"][data-mode="dark"] {
  --bg:#0c151d; --surface:#131f2a; --surface-2:#182734; --border:#253746; --text:#dfe9f1; --text-muted:#8ba0b1;
  --accent-base:#4d9ad4; --accent-hover:#6aabdd; --accent-contrast:#06111b; --nav-bg:#0a121a; --nav-text:#dfe9f1;
}
/* Amber (): warm light, easy on the eyes at night. */
[data-preset="amber"] {
  --bg:#efe6d4; --surface:#faf4e8; --surface-2:#f3ead8; --border:#d8c7a4; --text:#3a2a0e; --text-muted:#7a6334;
  --accent-base:#a35d07; --accent-hover:#8a4e05; --accent-contrast:#fff8ec; --nav-bg:#3a2a0e; --nav-text:#f5e9d2;
}
[data-preset="amber"][data-mode="dark"] {
  --bg:#070604; --surface:#0f0d08; --surface-2:#17130c; --border:#2e2515; --text:#ffc978; --text-muted:#b08745;
  --accent-base:#ff9c1f; --accent-hover:#ffb057; --accent-contrast:#1a1207; --nav-bg:#050403; --nav-text:#ffc978;
}
/* High contrast () */
[data-preset="contrast"] {
  --bg:#ffffff; --surface:#ffffff; --surface-2:#eeeeee; --border:#000000; --text:#000000; --text-muted:#2b2b2b;
  --accent-base:#0033cc; --accent-hover:#002499; --accent-contrast:#ffffff; --nav-bg:#000000; --nav-text:#ffffff;
}
[data-preset="contrast"][data-mode="dark"] {
  --bg:#000000; --surface:#0a0a0a; --surface-2:#171717; --border:#ffffff; --text:#ffffff; --text-muted:#d6d6d6;
  --accent-base:#ffd400; --accent-hover:#ffe34d; --accent-contrast:#000000; --nav-bg:#000000; --nav-text:#ffd400;
}
/* Paper () */
[data-preset="paper"] {
  --bg:#e9e5d9; --surface:#f7f4ea; --surface-2:#f0ece0; --border:#cfc7b3; --text:#23241f; --text-muted:#605e53;
  --accent-base:#35573f; --accent-hover:#294331; --accent-contrast:#f4f7f2; --nav-bg:#2c3b30; --nav-text:#eef0e6;
}
[data-preset="paper"][data-mode="dark"] {
  --bg:#131614; --surface:#1b1f1c; --surface-2:#222724; --border:#2e3630; --text:#e6e8df; --text-muted:#98a094;
  --accent-base:#7fb08a; --accent-hover:#96c19f; --accent-contrast:#0f130f; --nav-bg:#0f120f; --nav-text:#e6e8df;
}
/* The user's own accent beats the style's when set (contrast computed on the server). */
:root, [data-preset] {
  --accent:var(--accent-user, var(--accent-base));
  --accent-hover-eff:var(--accent-user, var(--accent-hover));
  --accent-on:var(--accent-contrast-user, var(--accent-contrast));
  /* Fixed status colours, readable in both modes. */
  --bad:#b91c1c; --warn:#b45309; --danger-bg:#b91c1c; --ok-bg:#e3f4ea; --bad-bg:#fbe9e9; --badge-bg:#e6edf8; --badge-text:#1e3a8a;
  --warn-bg:#fdf0dc;
  --flag-ok:#15803d; --flag-bad:#b91c1c; --flag-none:#6b7280;
}
[data-preset][data-mode="dark"] {
  /* A user accent is lightened in dark mode and gets dark text; the custom properties
     below are invalid (so the var() fallbacks apply) when no user accent is set. */
  --dark-user: color-mix(in srgb, var(--accent-user) 60%, white);
  --dark-on: color-mix(in srgb, var(--accent-user) 0%, #12100c);
  --accent:var(--dark-user, var(--accent-base));
  --accent-hover-eff:var(--dark-user, var(--accent-hover));
  --accent-on:var(--dark-on, var(--accent-contrast));
  --bad:#f87171; --warn:#fbbf24; --danger-bg:#b91c1c; --ok-bg:#12301f; --bad-bg:#3a1717; --badge-bg:#1f2a44; --badge-text:#bcd0ff;
  --warn-bg:#3a2a0c;
  --flag-ok:#4ade80; --flag-bad:#f87171; --flag-none:#9ca3af;
}
[data-preset="contrast"] { --ok-bg:#ffffff; --bad-bg:#ffffff; --warn-bg:#ffffff; }
[data-preset="contrast"][data-mode="dark"] { --ok-bg:#000000; --bad-bg:#000000; --warn-bg:#000000; }

/* ── Base ─────────────────────────────────────────────────────────────────── */
* { box-sizing:border-box; }
html { font-size:calc(16px * var(--font-scale)); }
body { margin:0; font:1rem/1.45 var(--ui-font); color:var(--text); background:var(--bg); }
a { color:var(--accent); }
a:hover { color:var(--accent-hover-eff); }
header.top { display:flex; align-items:center; gap:.4rem; padding:.5rem .75rem;
  background:var(--nav-bg); color:var(--nav-text); border-bottom:1px solid var(--border); }
.brand { display:flex; align-items:center; gap:.5rem; font-weight:700; color:var(--nav-text); text-decoration:none; min-width:0; }
.brand:hover { color:var(--nav-text); }
.brand span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.brand .logo { height:28px; width:auto; flex:none; background:#fff; border-radius:50%; padding:2px; }
.wordmark { font-weight:400; }
.wordmark b { font-weight:700; }
main { max-width:60rem; margin:0 auto; padding:1rem; }
h1 { font-size:1.4rem; }
.stack { display:flex; flex-direction:column; gap:.75rem; max-width:28rem; }
label { display:flex; flex-direction:column; gap:.25rem; font-weight:600; }
label.check { flex-direction:row; align-items:center; font-weight:400; gap:.5rem; }
input, select, textarea, button { font:inherit; padding:.6rem .7rem; border:1px solid var(--border); border-radius:.4rem;
  background:var(--surface); color:var(--text); }
input[type=radio], input[type=checkbox] { padding:0; }
input[type=color] { padding:.15rem; width:3rem; height:2.5rem; }
select { min-height:2.75rem; }
button { background:var(--accent); color:var(--accent-on); border:none; min-height:2.75rem; cursor:pointer; }
button:disabled { opacity:.5; cursor:not-allowed; }
button:not(:disabled):hover { background:var(--accent-hover-eff); }
button.secondary { background:var(--surface); color:var(--text); border:1px solid var(--border); }
button.secondary:not(:disabled):hover { background:var(--surface-2); }
button.danger { background:var(--danger-bg); color:#fff; }
button.link { background:none; color:var(--text); padding:0; min-height:0; text-decoration:underline; }
:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
form.inline { display:inline; }
.error, .field-error { color:var(--bad); }
.field-error { font-weight:400; font-size:.9rem; }
.flash { padding:.6rem .8rem; border-radius:.4rem; background:var(--ok-bg); border:1px solid var(--border); }
.flash.error { background:var(--bad-bg); }
.hint, .muted { color:var(--text-muted); }
.cards { display:flex; flex-direction:column; gap:.75rem; }
.card { background:var(--surface); border:1px solid var(--border); border-radius:.6rem; padding:.8rem 1rem; }
.badge { display:inline-block; padding:.05rem .45rem; border-radius:.3rem; background:var(--badge-bg); color:var(--badge-text); font-size:.85rem; }
table { width:100%; border-collapse:collapse; background:var(--surface); }
th, td { text-align:left; padding:.5rem; border-bottom:1px solid var(--border); vertical-align:top; }
.row { display:flex; flex-wrap:wrap; gap:.75rem; }
.row > label { flex:1 1 9rem; }
fieldset { border:1px solid var(--border); border-radius:.6rem; padding:.8rem; background:var(--surface); margin:0 0 1rem; }
legend { font-weight:600; padding:0 .3rem; }
@media (min-width: 48rem) { .cards.wide { display:none; } }
@media (max-width: 47.99rem) { table.wide { display:none; } }

/* ── Login page ───────────────────────────────────────────────────────────── */
body.login-page { min-height:100vh; }
body.login-page main { max-width:none; display:flex; justify-content:center; padding:6vh 1rem; }
.login-card { width:100%; max-width:24rem; background:var(--surface); color:var(--text); border-radius:.8rem;
  padding:1.4rem 1.5rem; box-shadow:0 10px 30px rgba(0,0,0,.2); }
.login-card h1 { margin-top:0; }
.login-logo { display:block; height:72px; width:auto; margin-bottom:.6rem; }
.login-brand .wordmark { display:block; font-size:1.5rem; color:var(--brand-water, currentColor); }
.login-brand .wordmark b { color:var(--brand-earth, currentColor); }
.login-brand .tagline { margin:.2rem 0 1rem; color:var(--text-muted); }

/* ── Dropdown menus (<details class="dropdown">): hamburger left, user circle right ── */
.dropdown { position:relative; }
.dropdown summary { list-style:none; cursor:pointer; display:flex; align-items:center; justify-content:center;
  width:44px; height:44px; border-radius:50%; color:var(--nav-text); }
.dropdown summary::-webkit-details-marker { display:none; }
.dropdown summary:hover, .dropdown[open] summary { background:rgba(255,255,255,.14); }
.dropdown summary .ico { width:24px; height:24px; }
.dropdown .menu { position:absolute; top:calc(100% + .3rem); min-width:14rem; z-index:20; background:var(--surface);
  color:var(--text); border:1px solid var(--border); border-radius:.6rem; box-shadow:0 10px 30px rgba(0,0,0,.25); padding:.3rem 0; }
.nav-menu .menu { left:0; }
.user-menu { margin-left:auto; }
.user-menu .menu { right:0; }
.user-menu .avatar { display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px;
  border-radius:50%; background:var(--accent); color:var(--accent-on); font-size:.82rem; font-weight:600; letter-spacing:.02em;
  box-shadow:0 0 0 2px var(--nav-text); }
.dropdown .who { padding:.5rem 1rem .6rem; }
.dropdown .who b { display:block; font-weight:600; }
.dropdown .who small { display:block; color:var(--text-muted); font-size:.8rem; }
.dropdown hr { border:0; border-top:1px solid var(--border); margin:.3rem 0; }
.dropdown .menu a, .dropdown .menu button { display:flex; align-items:center; gap:.65rem; width:100%; min-height:44px;
  padding:0 1rem; background:none; border:0; border-radius:0; color:var(--text); text-decoration:none;
  font:inherit; font-weight:400; text-align:left; cursor:pointer; }
.dropdown .menu a:hover, .dropdown .menu button:hover { background:var(--surface-2); color:var(--text); }
.dropdown .menu a[aria-current="page"] { font-weight:700; color:var(--accent); box-shadow:inset 3px 0 0 var(--accent); }
.dropdown .menu .ico { flex:none; opacity:.85; }
.dropdown form { margin:0; }

/* ── Settings page ────────────────────────────────────────────────────────── */
.settings { max-width:46rem; }
.seg-group { display:flex; flex-wrap:wrap; gap:.4rem; }
.seg { flex:1 1 6rem; flex-direction:row; position:relative; font-weight:400; }
.seg input { position:absolute; opacity:0; pointer-events:none; }
.seg span { flex:1; text-align:center; padding:.6rem .7rem; min-height:2.75rem; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border); border-radius:.4rem; background:var(--surface); cursor:pointer; }
.seg input:checked + span { background:var(--accent); color:var(--accent-on); border-color:var(--accent); }
.seg input:focus-visible + span { outline:3px solid var(--accent); outline-offset:2px; }
.legend-like { font-weight:600; display:block; margin-bottom:.25rem; }
.field-group { flex:2 1 16rem; }
.sample { margin:.8rem 0 0; padding:.6rem .8rem; background:var(--surface-2); border-radius:.4rem; }
.seg input:disabled + span { opacity:.6; cursor:not-allowed; }
.seg input:disabled:checked + span { opacity:.8; }

/* ── Appearance page: theme cards and swatches ────────────────────────────── */
.preset-grid { display:grid; gap:.75rem; grid-template-columns:1fr; }
@media (min-width: 36rem) { .preset-grid { grid-template-columns:1fr 1fr; } }
.preset-option { display:block; cursor:pointer; margin:0; font-weight:400; }
.preset-option input { position:absolute; opacity:0; pointer-events:none; }
.preset-card, .preset-why, .preview, .preview-bar, .preview-body, .preview-line { display:block; }
.preset-card { border:2px solid var(--border); border-radius:.5rem; overflow:hidden; background:var(--surface); }
.preset-option input:focus-visible + .preset-card { outline:3px solid var(--accent); outline-offset:2px; }
.preset-option input:checked + .preset-card { border-color:var(--accent); }
.preset-name { display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.5rem .7rem; font-weight:600; }
.preset-check { color:var(--accent); visibility:hidden; }
.preset-option input:checked + .preset-card .preset-check { visibility:visible; }
.preset-why { padding:0 .7rem .55rem; font-size:.8rem; color:var(--text-muted); line-height:1.35; }
.preview-pair { display:grid; grid-template-columns:1fr 1fr; }
.preview { background:var(--bg); padding:.5rem; border-top:1px solid var(--border); }
.preview + .preview { border-left:1px solid var(--border); }
.preview-bar { background:var(--nav-bg); color:var(--nav-text); font-size:.65rem; padding:.2rem .35rem; border-radius:3px 3px 0 0; }
.preview-bar .ico { width:.8em; height:.8em; vertical-align:-.1em; }
.preview-body { background:var(--surface); border:1px solid var(--border); border-top:0; border-radius:0 0 3px 3px; padding:.4rem .35rem; }
.preview-line { height:5px; border-radius:3px; background:var(--text); opacity:.8; }
.preview-line.short { width:55%; margin-top:4px; opacity:.4; }
.preview-btn { margin-top:6px; display:inline-block; background:var(--accent-base); color:var(--accent-contrast);
  font-size:.6rem; padding:.12rem .4rem; border-radius:3px; }
.swatch-row { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.swatch { width:2.75rem; height:2.75rem; min-height:0; padding:0; border-radius:50%; border:2px solid var(--border); }
.swatch:hover { filter:brightness(1.1); }
.swatch[aria-pressed="true"] { outline:3px solid var(--text); outline-offset:2px; }

/* ── Buttons for touch (tablet): links that are actions look and size like buttons ── */
a.button, label.button { display:inline-flex; align-items:center; justify-content:center; gap:.4rem; min-height:2.75rem;
  padding:.6rem .9rem; border-radius:.4rem; background:var(--accent); color:var(--accent-on); text-decoration:none;
  font-weight:600; line-height:1.2; cursor:pointer; border:1px solid transparent; }
a.button:hover, label.button:hover { background:var(--accent-hover-eff); color:var(--accent-on); }
a.button.secondary, label.button.secondary { background:var(--surface); color:var(--text); border-color:var(--border); }
a.button.secondary:hover, label.button.secondary:hover { background:var(--surface-2); color:var(--text); }
a.button.danger { background:var(--danger-bg); color:#fff; }
.icon-btn { display:inline-flex; align-items:center; justify-content:center; width:2.75rem; min-width:44px; height:2.75rem;
  min-height:44px; padding:0; }
.icon-btn .ico { width:20px; height:20px; }
.icon-btn.copied { color:var(--accent); border-color:var(--accent); }
.icon-group { display:inline-flex; gap:.35rem; vertical-align:middle; }
.actions { display:flex; flex-wrap:wrap; gap:.6rem; }
.page-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.6rem 1rem; margin:1rem 0; }
.page-head h1 { margin:0; min-width:0; overflow-wrap:anywhere; }
.page-head h2 { margin:0; }

/* ── «Δοκιμή ρόλου» (Ρόλοι) ──────────────────────────────────────────────── */
.role-preview { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.6rem; margin:0 0 1rem;
  background:#fff4cc; border-color:#e0b000; color:#4a3700; }
[data-mode="dark"] .role-preview { background:#3d2f00; border-color:#b08900; color:#ffe9a8; }
[data-preset="contrast"] .role-preview { background:var(--ok-bg); color:var(--text); }
.row-actions { display:flex; flex-wrap:wrap; gap:.4rem; }

/* ── Ειδοποιήσεις (web push) ─────────────────────────────────────────────── */
.push-nudge { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.6rem; margin:0 0 1rem; }
.push-nudge[hidden] { display:none; }
.push-nudge-actions { display:flex; align-items:center; gap:.5rem; margin-left:auto; }
.push-nudge-actions [hidden] { display:none; }
.push-kinds, .push-device { margin:0 0 1rem; }
.push-kinds h2, .push-device h2 { margin:0 0 .5rem; font-size:1.1rem; }
.push-kinds p, .push-device p { margin:.3rem 0; }
.push-device .actions { margin:.6rem 0 .2rem; }
.push-device [data-when] { display:none; }
.push-device[data-state="loading"] [data-when~="loading"],
.push-device[data-state="unsupported"] [data-when~="unsupported"],
.push-device[data-state="ios"] [data-when~="ios"],
.push-device[data-state="denied"] [data-when~="denied"],
.push-device[data-state="off"] [data-when~="off"],
.push-device[data-state="subscribed"] [data-when~="subscribed"] { display:revert; }
.push-device [data-push="message"]:empty { display:none; }
table.push-device-list td { vertical-align:middle; }
table.push-device-list td small { display:block; }
td.push-remove { width:1%; text-align:right; }
.notify-kind { display:flex; flex-direction:column; align-items:flex-start; gap:.15rem; white-space:nowrap; }

/* ── Switches, permission grid, tables ───────────────────────────────────── */
body.wide-page main { max-width:none; }
.switch { display:inline-flex; flex-direction:row; align-items:center; gap:.6rem; min-height:44px; font-weight:600;
  cursor:pointer; position:relative; }
.switch input { position:absolute; opacity:0; width:3rem; height:1.75rem; margin:0; cursor:pointer; }
.switch .slider { flex:none; position:relative; width:3rem; height:1.75rem; border-radius:999px; background:var(--surface-2);
  border:1px solid var(--border); transition:background .15s; }
.switch .slider::after { content:""; position:absolute; top:2px; left:2px; width:calc(1.75rem - 6px); height:calc(1.75rem - 6px);
  border-radius:50%; background:var(--text-muted); transition:transform .15s, background .15s; }
.switch input:checked + .slider { background:var(--accent); border-color:var(--accent); }
.switch input:checked + .slider::after { transform:translateX(1.25rem); background:var(--accent-on); }
.switch input:focus-visible + .slider { outline:3px solid var(--accent); outline-offset:2px; }
@media (prefers-reduced-motion: reduce) { .switch .slider, .switch .slider::after { transition:none; } }
.switch input:disabled, .switch input:disabled ~ * { cursor:not-allowed; }
.switch input:disabled + .slider { opacity:.5; }
.perm-grid { display:grid; gap:1rem; grid-template-columns:repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.perm-grid > fieldset { margin:0; }
/* the role form spans the page; only the name field keeps the usual form width */
.role-form { max-width:none; }
.role-form > label { max-width:28rem; }
/* Role form on a wide screen: the cards flow into columns no taller than the «plants» card (app.js sets the
   height); several small cards share a column, so the page stays short. */
@media (min-width: 48rem) {
  .perm-grid.packed { display:block; columns:16rem; column-gap:1rem; column-fill:auto; }
  .perm-grid.packed > fieldset { break-inside:avoid; margin:0 0 1rem; }
}
.perm-card legend { font-weight:700; }
.perm-card .switch { display:flex; }
.table-wrap { overflow-x:auto; }
.sampling-table th, .sampling-table td { white-space:nowrap; text-align:right; }
.sampling-table th:first-child, .sampling-table td:first-child,
.compliance-table th:first-child, .compliance-table td:first-child { position:sticky; left:0; text-align:left;
  background:var(--surface); }
.sampling-table th small { display:block; font-weight:400; color:var(--text-muted); }
.pager { display:flex; gap:1rem; align-items:center; justify-content:center; margin:1rem 0; }

/* Time chart of one parameter (samplings tab). */
:root, [data-preset] { --series-1:#2a78d6; }
[data-preset][data-mode="dark"] { --series-1:#3987e5; }
.chart-card { width:fit-content; max-width:100%; min-width:min(100%, 24rem); margin:1rem 0; }
.chart-card h2 { margin:0 0 .4rem; font-size:1.05rem; }
.seg-links { display:inline-flex; gap:.4rem; align-self:flex-end; }
.seg-links a { padding:.5rem .8rem; border:1px solid var(--border); border-radius:.4rem; background:var(--surface);
  color:var(--text); text-decoration:none; }
.seg-links a[aria-current="true"] { background:var(--accent); color:var(--accent-on); border-color:var(--accent); }
.chart-scroll { overflow-x:auto; display:flex; align-items:flex-start; }
.chart-yaxis { position:sticky; left:0; z-index:1; flex:none; background:var(--surface); outline:2px solid var(--surface); }
.chart-yaxis text { font:12px var(--ui-font); fill:var(--text-muted); }
svg.chart { display:block; max-width:100%; height:auto; }
svg.chart text { font:12px var(--ui-font); fill:var(--text-muted); }
svg.chart .grid { stroke:var(--border); stroke-width:1; }
svg.chart .line { fill:none; stroke-width:2; stroke-linejoin:round; }
svg.chart .dot { stroke:none; }
svg.chart .hit { fill:transparent; cursor:crosshair; }
.series-1 { fill:var(--series-1); stroke:var(--series-1); }
.chart-tip { position:fixed; z-index:50; pointer-events:none; background:var(--text); color:var(--surface); padding:.3rem .55rem;
  border-radius:.35rem; font-size:.85rem; max-width:18rem; white-space:pre-line; box-shadow:0 2px 8px rgb(0 0 0 / .25); }

.avatar.big { display:inline-flex; align-items:center; justify-content:center; width:5.5rem; height:5.5rem; border-radius:50%;
  background:var(--accent); color:var(--accent-on); font-size:1.6rem; font-weight:600; flex:none; }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0);
  white-space:nowrap; border:0; }

/* ── Home page: what is loaded ────────────────────────────────────────────── */
.tiles { display:grid; grid-template-columns:repeat(auto-fill, minmax(11rem, 1fr)); gap:.75rem; margin:0 0 1.25rem; }
.tile { background:var(--surface); border:1px solid var(--border); border-radius:.6rem; padding:.8rem 1rem;
  display:flex; flex-direction:column; gap:.2rem; }
.tile span { color:var(--text-muted); }
.tile strong { font-size:1.6rem; }
.last-run h2 { margin-top:0; }
@media (max-width: 47.99rem) { .tiles { grid-template-columns:1fr; } }

/* ── Plants list ──────────────────────────────────────────────────────────── */
.search-row { align-items:flex-end; margin-bottom:1rem; }
.search-row > label { min-width:0; }
.search-row select, .search-row input { width:100%; max-width:100%; box-sizing:border-box; }
.flag { display:inline-flex; align-items:center; gap:.4rem; }
.flag::before { content:""; width:.7rem; height:.7rem; border-radius:50%; background:var(--flag-none); flex:none; }
.flag-ok::before { background:var(--flag-ok); }
.flag-bad::before { background:var(--flag-bad); }
.kv { display:flex; flex-wrap:wrap; gap:.25rem .75rem; }
.kv dt { color:var(--text-muted); min-width:10rem; }
.kv dd { margin:0; }
@media (max-width: 39.99rem) {
  .plant-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .plant-table, .plant-table tbody, .plant-table tr, .plant-table td { display:block; }
  .plant-table tr { background:var(--surface); border:1px solid var(--border); border-radius:.6rem; padding:.4rem .8rem;
    margin-bottom:.75rem; }
  .plant-table td { border:none; padding:.2rem 0; }
  .plant-table td::before { content:attr(data-label) ": "; color:var(--text-muted); }
}

/* ── Plant page ───────────────────────────────────────────────────────────── */
.plant-back { display:inline-block; margin-bottom:.5rem; }
.plant-summary { color:var(--text-muted); margin:0 0 .5rem; }
.tabs { display:flex; flex-wrap:nowrap; white-space:nowrap; overflow-x:auto; gap:.4rem; margin:1rem 0;
  border-bottom:2px solid var(--border); }
.tabs .tab { display:inline-flex; align-items:center; min-height:2.75rem; padding:.6rem 1rem; margin-bottom:-2px;
  border:1px solid var(--border); border-bottom:2px solid var(--border); border-radius:.4rem .4rem 0 0;
  background:var(--surface-2); color:var(--text); text-decoration:none; font-weight:600; flex:none; }
.tabs .tab:hover { background:var(--surface); }
.tabs .tab[aria-current="page"] { background:var(--surface); color:var(--accent); border-bottom-color:var(--accent); }
.plant-section dl { margin:0 0 1rem; display:grid; gap:.35rem; }
.contact { margin:0 0 1rem; padding-bottom:.5rem; border-bottom:1px solid var(--border); }

/* ── Maps ─────────────────────────────────────────────────────────────────── */
.map-small { isolation:isolate; height:260px; width:100%; border:1px solid var(--border); border-radius:.6rem; margin:.5rem 0 1rem; }
/* the dark map: the tiles only, so the dots keep their colour */
[data-mode="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }

/* Tab «Συμμόρφωση»: one table per framework. */
.compliance-table th, .compliance-table td { text-align:left; vertical-align:top; }
.compliance-table small { color:var(--text-muted); }
.legend { list-style:none; padding:0; }

/* ── The map as the home page ─────────────────────────────────────────────── */
body.map-page { height:100vh; height:100dvh; display:flex; flex-direction:column; }
body.map-page main { max-width:none; width:100%; box-sizing:border-box; flex:1; min-height:0; margin:0; padding:.5rem;
  display:flex; flex-direction:column; gap:.5rem; }
.map-tools { position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; }
.map-tools input[type=search] { flex:1 1 12rem; min-width:0; }
.map-filters { position:static; }
.map-filters summary { display:inline-flex; align-items:center; gap:.4rem; cursor:pointer; list-style:none; }
.map-filter-body { position:absolute; z-index:10; top:100%; right:0; margin-top:.25rem; display:grid; gap:.5rem; width:min(20rem, 100%); box-sizing:border-box;
  padding:.75rem; background:var(--surface); border:1px solid var(--border); border-radius:.6rem; }
.map-filter-body > label { min-width:0; }
.map-filter-body select { width:100%; max-width:100%; box-sizing:border-box; }
.map-stage { position:relative; isolation:isolate; flex:1; min-height:0; }
.map-full { height:100%; width:100%; min-height:16rem; border:1px solid var(--border); border-radius:.6rem; }
.map-legend { position:absolute; z-index:500; left:.5rem; bottom:1.6rem; margin:0; padding:.4rem .6rem; list-style:none;
  display:flex; flex-wrap:wrap; gap:.2rem .8rem; background:var(--surface); border:1px solid var(--border); border-radius:.6rem;
  font-size:.85rem; max-width:calc(100% - 1rem); }
.map-legend li { min-width:0; overflow-wrap:anywhere; }
.map-card { position:absolute; z-index:1000; top:.5rem; right:.5rem; width:18rem; max-width:calc(100% - 1rem); padding:.8rem 1rem;
  background:var(--surface); border:1px solid var(--border); border-radius:.6rem; box-shadow:0 2px 10px rgba(0,0,0,.25); }
.map-card[hidden] { display:none; }
.map-card h2 { margin:0 2.5rem .4rem 0; font-size:1.05rem; }
.map-card p { margin:.2rem 0; }
.map-card [data-card-close] { position:absolute; top:.3rem; right:.3rem; }
@media (max-width: 39.99rem) {
  .map-card { top:auto; right:0; bottom:0; left:0; width:auto; max-width:none; border-radius:.9rem .9rem 0 0;
    animation:map-sheet .2s ease-out; }
  .map-legend { bottom:auto; top:.5rem; left:3.5rem; max-width:calc(100% - 4rem); }
}
@keyframes map-sheet { from { transform:translateY(100%); } to { transform:none; } }
@media (prefers-reduced-motion: reduce) { .map-card { animation:none; } }
