/* Application styles (same design as the Connectivia suite)
   Design system: dark grey sidebar and sign-in panel in both themes, neutral greys as in Risklens, the red of the logo; dark theme in shades of black; auto follows the OS.
   Tenant colours are injected as --brand / --accent on <html>. */

:root {
  /* spacing: one fixed scale, multiples of 8px; margin, padding and gap use only these */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
  --s6: 48px;
  --s8: 64px;
  --s10: 80px;
  --s14: 112px;
  /* edit boxes: as wide as their content, a little more (multiples of 8px) */
  --w-xs: 96px;
  --w-s: 160px;
  --w-m: 240px;
  --w-l: 352px;
  --w-xl: 480px;
  --brand: #5b5bf6;
  --accent: #7c7cff;
  /* text on the brand colour, and the brand colour as text on light surfaces (the layout sets them for light colours) */
  --on-brand: #fff;
  --brand-ink: var(--brand-ink-light, var(--brand));
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #f1f1ee;
  --border: #e6e6e2;
  --border-strong: #d4d4ce;
  --text: #17171a;
  --text-2: #3f3f46;
  --muted: #6b6b74;
  --ok: #138a4b; --ok-bg: #e3f6ec;
  --warn: #a35b06; --warn-bg: #fdf1dc;
  --ringing: #eab308; --ringing-bg: #fde68a;
  --danger: #c22b2b; --danger-bg: #fde8e8;
  --info: #3c48c9; --info-bg: #e8eafe;
  --muted-bg: #f0f0ed;
  --shadow-xs: 0 1px 2px rgba(20, 20, 24, .05);
  --shadow: 0 1px 2px rgba(20, 20, 24, .04), 0 2px 8px rgba(20, 20, 24, .04);
  --shadow-lg: 0 18px 40px rgba(20, 20, 24, .16);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
  --radius: 0;
  --radius-sm: 0;
  --sidebar: 272px;
  --sidebar-mini: 72px;
  --side-bg: #1e1e21;
  --side-bg-2: #252528;
  --side-border: rgba(255, 255, 255, .08);
  --side-text: #b4b4bc;
  --side-text-strong: #ffffff;
  --side-muted: #8d8d96;
  --auth-hero-bg: #1e1e21;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-ink: var(--brand);
  --bg: #09090b;
  --surface: #121214;
  --surface-2: #161618;
  --surface-3: #1e1e21;
  --border: #26262a;
  --border-strong: #36363c;
  --text: #ededef;
  --text-2: #c6c6cc;
  --muted: #8e8e96;
  --ok: #4ade80; --ok-bg: rgba(34, 197, 94, .14);
  --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .14);
  --ringing: #facc15; --ringing-bg: rgba(250, 204, 21, .3);
  --danger: #f87171; --danger-bg: rgba(239, 68, 68, .14);
  --info: #9ec5ff; --info-bg: rgba(8, 125, 245, .16);
  --muted-bg: #1e1e21;
  --shadow-xs: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .65);
  --auth-hero-bg: #1e1e21;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --brand-ink: var(--brand);
    --bg: #09090b;
    --surface: #121214;
    --surface-2: #161618;
    --surface-3: #1e1e21;
    --border: #26262a;
    --border-strong: #36363c;
    --text: #ededef;
    --text-2: #c6c6cc;
    --muted: #8e8e96;
    --ok: #4ade80; --ok-bg: rgba(34, 197, 94, .14);
    --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .14);
    --ringing: #facc15; --ringing-bg: rgba(250, 204, 21, .3);
    --danger: #f87171; --danger-bg: rgba(239, 68, 68, .14);
    --info: #9ec5ff; --info-bg: rgba(8, 125, 245, .16);
    --muted-bg: #1e1e21;
    --shadow-xs: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, .65);
    --auth-hero-bg: #1e1e21;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* room for the scroll bar on every page: short and long pages as wide, the top bar never moves */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; font: 14px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); color: var(--text); }
h1 { font-size: 1.55rem; font-weight: 650; letter-spacing: -.025em; margin: 0 0 0; line-height: 1.2; }
h2 { font-size: .98rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 var(--s2); }
h3 { font-size: .9rem; font-weight: 650; margin: var(--s2) 0 var(--s1); }
h1 small, h2 small { font-weight: 400; color: var(--muted); }
p { margin: var(--s1) 0 var(--s2); }
code, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-3); padding: 0 var(--s1); border-radius: 0; }
pre { background: var(--surface-3); padding: var(--s2) var(--s2); border-radius: 0; overflow-x: auto; max-width: 100%; font: 12.5px/1.55 var(--mono); border: 1px solid var(--border); }
pre.json { max-width: 100%; max-height: 300px; margin: var(--s1) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--border); }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .83rem; margin: var(--s1) 0 var(--s1); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }

.upper { text-transform: uppercase; }
.grow { flex: 1; }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.dim { opacity: .55; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: var(--s1) var(--s2); }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }

/* ---------- shell & sidebar ---------- */
/* no transition on the columns: the content of the menu changes at once, and animating its width laid it out again at every frame */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { overscroll-behavior: contain; background: var(--side-bg); background-image: linear-gradient(180deg, var(--side-bg-2), var(--side-bg) 320px); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; z-index: 40; }
.sidebar > .brand, .sidebar > .console-tag, .sidebar > .tenant-switch, .sidebar > .sidebar-foot { flex: none; }
.brand { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: var(--s1); padding: var(--s2) var(--s2) var(--s2); min-height: 70px; }
/* Logo exactly as wide as the payoff below it: the grid takes the text width, the logo stretches to it.
   All-white, tightly cropped vector; whole-pixel paddings keep its edges sharp. */
.brand-lockup { display: inline-grid; row-gap: var(--s1); }
.brand-lockup .brand-full { width: 0; min-width: 100%; height: auto; }
.brand img { display: block; flex: none; height: auto; }
.brand .brand-mark { display: none; width: 34px; height: 34px; }
/* Without a lockup file (config/brand.php) the logo is the mark followed by the product name */
.brand-lockup .brand-text { display: inline-flex; align-items: center; gap: var(--s1); width: auto; min-width: 0; color: #fff; font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.brand-lockup .brand-text img { width: 22px; height: 22px; }
.brand small { display: block; color: var(--side-muted); font-size: .66rem; line-height: 1.25; white-space: nowrap; }
.tenant-switch { margin: 0 var(--s2) var(--s1); padding: var(--s1) var(--s1) var(--s1); border: 1px solid var(--side-border); border-radius: 0; background: rgba(255, 255, 255, .03); }
.tenant-switch label { font-size: .64rem; color: var(--side-muted); text-transform: uppercase; letter-spacing: .12em; margin: 0; }
.tenant-switch select { width: 100%; margin-top: var(--s1); padding: var(--s1) var(--s1); background: rgba(255, 255, 255, .06); color: var(--side-text-strong); border: 1px solid var(--side-border); border-radius: 0; font-size: .86rem; font-weight: 600; }
.tenant-switch select option { color: #17171a; }
.tenant-switch select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
/* only the entries scroll, with the room for the bar always kept: opening a section moves nothing above them */
.nav { padding: var(--s1) var(--s1) var(--s2); flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }
.nav-section { font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--side-muted); padding: var(--s2) var(--s1) var(--s1); white-space: nowrap; }
.nav a { position: relative; display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s1); margin: 1px 0; color: var(--side-text); border-radius: 0; font-weight: 500; font-size: .875rem; white-space: nowrap; transition: background .12s, color .12s; }
.nav a .ic { opacity: .8; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: var(--side-text-strong); text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .06); color: var(--side-text-strong); }
.nav a.active .ic { opacity: 1; color: var(--brand); }
.nav a.active::before { content: ""; position: absolute; left: calc(-1 * var(--s1)); top: 8px; bottom: 8px; width: 3px; border-radius: 0; background: var(--brand); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); padding: var(--s1) var(--s2) var(--s1) var(--s2); color: var(--side-muted); font-size: .72rem; border-top: 1px solid var(--side-border); }
.collapse-btn { display: inline-flex; align-items: center; gap: var(--s1); background: transparent; border: 1px solid var(--side-border); color: var(--side-text); border-radius: 0; padding: var(--s1) var(--s1); cursor: pointer; font: inherit; font-size: .75rem; }
.collapse-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.collapse-btn .ic { width: 16px; height: 16px; transition: transform .2s; }

/* Collapsed (icons only) */
html.sidebar-collapsed .shell { grid-template-columns: var(--sidebar-mini) minmax(0, 1fr); }
html.sidebar-collapsed .brand { align-items: center; padding: var(--s2) 0 var(--s2); }
html.sidebar-collapsed .brand .brand-mark { display: block; }
html.sidebar-collapsed .brand .brand-lockup,
html.sidebar-collapsed .brand .brand-full,
html.sidebar-collapsed .brand .brand-payoff,
html.sidebar-collapsed .tenant-switch,
html.sidebar-collapsed .nav a span,
html.sidebar-collapsed .sidebar-version,
html.sidebar-collapsed .collapse-btn span { display: none; }
/* only icons: it still scrolls, without a bar that would push them off centre */
html.sidebar-collapsed .nav { padding: var(--s1) var(--s1) var(--s2); scrollbar-gutter: auto; scrollbar-width: none; }
html.sidebar-collapsed .nav-section { font-size: 0; padding: var(--s1) 0 var(--s1); margin: var(--s1) var(--s1) 0; border-top: 1px solid var(--side-border); }
html.sidebar-collapsed .nav-section:first-child { border-top: 0; }
html.sidebar-collapsed .nav a { justify-content: center; padding: var(--s1) 0; }
html.sidebar-collapsed .nav a.active::before { left: calc(-1 * var(--s1)); }
html.sidebar-collapsed .sidebar-foot { justify-content: center; padding: var(--s1) 0; }
html.sidebar-collapsed .collapse-btn .ic { transform: rotate(180deg); }

/* ---------- top bar ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--s2); height: 62px; padding: 0 var(--s3); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); }

.top-actions { display: flex; align-items: center; gap: var(--s1); margin-left: auto; }
.icon-btn { display: inline-flex; align-items: center; gap: var(--s1); background: transparent; border: 1px solid transparent; color: var(--text-2); padding: var(--s1) var(--s1); border-radius: 0; cursor: pointer; font: inherit; }
.icon-btn:hover { background: var(--surface-3); }
.theme-label { font-size: .78rem; color: var(--muted); }
/* Theme switcher: one icon per state (auto = half circle, light = sun, dark = moon) */
.theme-ico { display: none; line-height: 0; }
:root[data-theme="auto"] .theme-ico-auto, :root:not([data-theme]) .theme-ico-auto, :root[data-theme="light"] .theme-ico-light, :root[data-theme="dark"] .theme-ico-dark { display: inline-flex; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: var(--s1); cursor: pointer; padding: var(--s1) var(--s1) var(--s1) var(--s1); border-radius: 0; border: 1px solid transparent; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--surface-3); border-color: var(--border); }
.user-name { font-weight: 600; font-size: .86rem; }
.avatar { width: 32px; height: 32px; border-radius: 0; background: linear-gradient(135deg, var(--brand), var(--accent)); color: var(--on-brand); display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 264px; background: var(--surface); border: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow-lg); padding: var(--s1); }
.menu-head { padding: var(--s1) var(--s1) var(--s2); border-bottom: 1px solid var(--border); margin-bottom: var(--s1); }
.menu-head strong, .menu-head small { display: block; }
.menu-head small { color: var(--muted); margin-bottom: var(--s1); }
.menu a, .menu button { display: flex; width: 100%; gap: var(--s1); align-items: center; padding: var(--s1) var(--s1); color: var(--text-2); background: none; border: 0; font: inherit; text-align: left; border-radius: 0; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.content { padding: var(--s3) var(--s4) var(--s4); flex: 1; max-width: 1560px; width: 100%; }
.foot { display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s2) var(--s4); color: var(--muted); font-size: .75rem; border-top: 1px solid var(--border); }
.backdrop { display: none; }
.only-mobile { display: none; }

/* ---------- page structure ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.page-head p { margin: 0 0 0; color: var(--muted); }
.page-head h1 .badge { vertical-align: 4px; }
.actions { display: flex; gap: var(--s1); align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow); padding: var(--s3); margin-bottom: var(--s2); min-width: 0; }
.card.narrow { max-width: 660px; }
.card.highlight { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); box-shadow: 0 0 0 3px var(--warn-bg); }

.card > h2:first-child { margin-top: 0; display: flex; align-items: center; gap: var(--s1); }
.card > h2 .ic { color: var(--muted); width: 17px; height: 17px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); gap: var(--s2); align-items: start; }
.grid-2.tight, .grid-3.tight { gap: var(--s2); }
.form .grid-2.tight, .form .grid-3.tight { align-items: end; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-3 + .card, .grid-2 + .grid-2, .grid-3 + .grid-2 { margin-top: var(--s2); }

/* ---------- KPI tiles & charts ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); margin-bottom: var(--s2); }
.stats.small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.stat { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 0; padding: var(--s2) var(--s2) var(--s2); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); transform: none; box-shadow: none; }
.stat-icon { position: absolute; right: .95rem; top: .95rem; width: 34px; height: 34px; border-radius: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 11%, transparent); color: var(--brand-ink); }
.stat-icon .ic { width: 18px; height: 18px; vertical-align: 0; }
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 500; padding-right: var(--s5); }
.stat-value { font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: auto; padding-top: var(--s1); }
.stats.small .stat-value { font-size: 1.3rem; }
.stats.small .stat-label { padding-right: 0; }
.stat small { color: var(--muted); }
.stat-ok .stat-icon { background: var(--ok-bg); color: var(--ok); }

.stat-warn .stat-icon { background: var(--warn-bg); color: var(--warn); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.bars li { display: grid; grid-template-columns: minmax(80px, 36%) 1fr 2.4rem; align-items: center; gap: var(--s1); font-size: .84rem; }

.anomalies { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--s1) var(--s3); }
.anomalies li { display: flex; justify-content: space-between; align-items: center; gap: var(--s1); padding: var(--s1) 0; border-bottom: 1px solid var(--border); }
/* «fatto» and «da fare» as wide as each other: the column of states lines up */
.anomalies .step-state { flex: none; width: 4.8rem; justify-content: center; padding-left: 0; padding-right: 0; }
.more { display: inline-flex; margin-top: var(--s2); font-size: .84rem; font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * var(--s3)); padding: 0 var(--s3); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; padding: var(--s1) var(--s1); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table thead th:first-child { border-top-left-radius: 0; }
.table thead th:last-child { border-top-right-radius: 0; }
.table th a { color: inherit; }
.table th a:hover { color: var(--text); text-decoration: none; }
.table td { padding: var(--s1) var(--s1); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td strong { font-weight: 600; }
.table.compact td, .table.compact th { padding: var(--s1) var(--s1); }
.table-hover tbody tr { transition: background .1s; }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

.actions-col { width: 1%; position: sticky; right: 0; z-index: 1; }
.row-actions { white-space: nowrap; text-align: right; position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 12px -10px rgba(20, 20, 24, .25); }
.table-hover tbody tr:hover .row-actions { background: var(--surface-2); }

.act { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 2px; border-radius: 0; color: var(--muted); border: 1px solid transparent; transition: background .12s, color .12s, border-color .12s; }
.act .ic { width: 16px; height: 16px; vertical-align: 0; }
.act:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); text-decoration: none; }
.act-primary { color: var(--brand-ink); }
.act-primary:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.act-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.pagination { display: flex; gap: var(--s1); flex-wrap: wrap; margin-top: var(--s2); }
.pagination a, .pagination span { min-width: 2rem; text-align: center; padding: var(--s1) var(--s1); border: 1px solid var(--border); border-radius: 0; font-size: .83rem; color: var(--text-2); background: var(--surface); }
.pagination a:hover { border-color: var(--border-strong); text-decoration: none; }
.pagination .current { background: var(--text); border-color: var(--text); color: var(--surface); font-weight: 600; }
.pagination .disabled { color: var(--muted); opacity: .5; }
/* under a grid: rows per page and count on the left, pagination on the right */
.grid-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s1) var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
.grid-foot .pagination { margin-top: 0; }
.per-page { display: flex; align-items: center; gap: var(--s2); margin: 0; font-size: .83rem; }
.per-page label { display: flex; align-items: center; gap: var(--s1); margin: 0; font-size: inherit; font-weight: 400; color: var(--text-2); }
.per-page label > select:not([multiple]) { width: 6.5rem; min-width: 0; margin: 0; height: 2rem; padding-top: 0; padding-bottom: 0; font-size: inherit; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: var(--s1); padding: 0 var(--s1) 0 var(--s1); border-radius: 0; font-size: .72rem; font-weight: 600; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 0; background: currentColor; opacity: .85; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }
.chip { display: inline-block; padding: 0 var(--s1); margin: 0 var(--s1) 0 0; border-radius: 0; background: var(--surface-3); color: var(--text-2); font-size: .76rem; border: 1px solid var(--border); }
a.chip:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------- forms ---------- */
.form label, label { display: block; font-weight: 500; font-size: .83rem; color: var(--text-2); margin-bottom: var(--s2); }
input, select, textarea { display: block; width: 100%; margin-top: var(--s1); padding: var(--s1) var(--s1); font: inherit; font-size: .9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 0; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); box-shadow: none; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 16px; height: 16px; margin: 0 var(--s1) 0 0; vertical-align: -3px; accent-color: var(--brand); box-shadow: none; }
/* radio buttons square like the rest of the interface: an empty square, filled with the brand colour when chosen */
input[type="radio"] { -webkit-appearance: none; appearance: none; flex: none; padding: 0; border: 1.5px solid var(--border-strong); border-radius: 0; background: var(--surface); cursor: pointer; }
input[type="radio"]:checked { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px var(--surface); }
input[type="radio"]:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; }
input[type="radio"]:disabled { opacity: .45; cursor: default; }
input[type="color"] { height: 42px; padding: var(--s1); }
input[type="file"] { padding: var(--s1); font-size: .84rem; }
/* date and time fields as tall as the other fields (Chromium pads the inner date parts) */
input::-webkit-datetime-edit { padding: 0; }
input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
label.check { font-weight: 400; display: flex; align-items: flex-start; gap: 0; color: var(--text); }
label.check input { margin-top: 0; }
label.inline { display: inline-flex; align-items: center; gap: var(--s1); margin: 0; }
label.inline input { margin: 0; width: auto; }
fieldset { border: 1px solid var(--border); border-radius: 0; padding: var(--s1) var(--s2) var(--s1); margin: 0 0 var(--s2); }
legend { font-weight: 600; font-size: .83rem; padding: 0 var(--s1); color: var(--text); }

.field-error { color: var(--danger); font-size: .8rem; margin: calc(-1 * var(--s1)) 0 var(--s2); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--s1); margin-top: var(--s2); flex-wrap: wrap; align-items: center; }
/* the buttons of a form whose sections are cards: below them the same space as between the cards */
.card + .form-actions { margin-top: 0; margin-bottom: var(--s2); }

.inline-form { display: flex; gap: var(--s1); align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }
.inline-form input, .inline-form select { width: auto; min-width: 140px; }
.inline-form label.grow { min-width: min(100%, 320px); }
.inline-form label.grow input { width: 100%; }

/* ---------- fields ---------- */
.field > label { margin-bottom: 0; }

.btn-row { display: flex; gap: var(--s1); flex-wrap: wrap; align-items: center; margin: var(--s1) 0; }
.btn-row form { margin: 0; }
.filters { display: flex; gap: var(--s1); flex-wrap: wrap; align-items: center; margin-bottom: var(--s2); }
.filters input, .filters select { width: auto; margin: 0; min-width: 160px; max-width: 100%; }
/* the order from a select only where the grid has no headers to click (cards on the phone): on wide screens the headers sort */
@media (min-width: 900px) { .filters .filter-sort { display: none; } }
/* controls on one row of filters: all as tall as the buttons beside them */
.filters input:not([type="checkbox"]):not([type="radio"]), .filters select, .filters .btn { height: 2.6rem; box-sizing: border-box; }
.filters label { max-width: 100%; min-width: 0; }
.filters input[type="search"] { min-width: 260px; }
.filters .grow { flex: 1; }

.copy-row { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }
.copy-row input { margin: 0; flex: 1 1 14rem; min-width: 0; }
.copy-row .btn { height: auto; min-height: 30px; align-self: stretch; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); height: 36px; padding: 0 var(--s2); font: inherit; font-size: .86rem; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 0; box-shadow: var(--shadow-xs); cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1; transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 22%, var(--border-strong)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--brand); border-color: color-mix(in srgb, var(--brand) 85%, #000); color: var(--on-brand); box-shadow: 0 1px 2px rgba(20, 20, 24, .15), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); border-color: color-mix(in srgb, var(--brand) 75%, #000); }
.btn:disabled, .btn:disabled:hover { opacity: .5; cursor: not-allowed; filter: grayscale(.35); }
.btn-danger { background: var(--danger); border-color: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
:root[data-theme="dark"] .btn-danger { color: #1a0505; }
.btn-danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong)); }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn-sm { height: 30px; padding: 0 var(--s1); font-size: .79rem; }
.btn-block { width: 100%; }
.btn .ic { width: 16px; height: 16px; vertical-align: 0; }

/* ---------- alerts ---------- */
.alert { position: relative; display: flex; gap: var(--s1); align-items: flex-start; padding: var(--s2) var(--s5) var(--s2) var(--s2); border-radius: 0; margin-bottom: var(--s2); border: 1px solid transparent; font-size: .88rem; overflow-wrap: anywhere; }
.alert::before { content: ""; flex: none; width: 4px; align-self: stretch; border-radius: 0; background: currentColor; opacity: .7; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.alert-warning, .alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.alert a { color: inherit; text-decoration: underline; }
.alert-close { position: absolute; right: .55rem; top: .45rem; background: none; border: 0; font-size: 1.2rem; color: inherit; cursor: pointer; opacity: .6; }
.alert-close:hover { opacity: 1; }
/* the hint of the inventory when Winbox does not open: at the bottom right, wherever the grid is scrolled */
.winbox-hint { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; max-width: 28rem; margin: 0; box-shadow: var(--shadow-md, 0 6px 24px rgba(0, 0, 0, .15)); background: var(--surface); }
.winbox-hint[hidden] { display: none; }
.winbox-hint .ic { flex: none; margin-top: 0; }
.winbox-hint-close { position: absolute; right: .55rem; top: .45rem; background: none; border: 0; font-size: 1.2rem; color: inherit; cursor: pointer; opacity: .6; }
.winbox-hint-close:hover { opacity: 1; }
@media (max-width: 560px) { .winbox-hint { left: 1rem; max-width: none; } }

/* ---------- misc components ---------- */
.dl { display: grid; grid-template-columns: minmax(130px, 32%) 1fr; gap: 0; margin: 0; font-size: .88rem; }
.dl dt, .dl dd { padding: var(--s1) 0; border-bottom: 1px solid var(--border); }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s1); }
.tabs { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s2); overflow-x: auto; padding: var(--s1); background: var(--surface-3); border-radius: 0; width: fit-content; max-width: 100%; }
.tabs a { padding: var(--s1) var(--s2); color: var(--muted); border-radius: 0; white-space: nowrap; font-weight: 500; font-size: .85rem; }
.tabs a.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.add-menu .menu a .ic { width: 15px; height: 15px; color: var(--brand-ink); }

.qr { background: #fff; padding: var(--s1); border-radius: 0; border: 1px solid var(--border); max-width: 100%; height: auto; }

.change { font-size: .8rem; }
.change .old { color: var(--danger); text-decoration: line-through; }
.change .new { color: var(--ok); }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s1); padding: 0; margin: 0 0 var(--s2); counter-reset: s; }
.steps li { counter-increment: s; padding: var(--s1) var(--s2) var(--s1) var(--s1); background: var(--surface); border: 1px solid var(--border); border-radius: 0; font-size: .8rem; color: var(--muted); font-weight: 500; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; margin-right: var(--s1); border-radius: 0; background: var(--surface-3); font-weight: 700; font-size: .72rem; }
.steps li.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.steps li.done::before { content: "✓"; background: var(--ok-bg); }

.codes { columns: 2; list-style: none; padding: 0; font-size: 1.05rem; }
.codes li { margin-bottom: var(--s1); }
.totp-setup { display: flex; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; }
.totp-setup > div { flex: 1; min-width: 260px; }
.secret { font-size: 1rem; letter-spacing: .05em; }
.logo-row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-start; }
.logo-box { min-width: 160px; }
.logo-preview { max-width: 220px; max-height: 90px; background: #fff; padding: var(--s1); border-radius: 0; border: 1px solid var(--border); }

.perm-list { margin: 0; padding-left: var(--s2); font-size: .83rem; color: var(--text-2); }

.prose { max-width: 980px; }

/* ---------- signature ---------- */

.req { color: var(--danger); }

/* ---------- installer (guest card) ---------- */
body.guest { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent), var(--bg); }
.guest-wrap { width: 100%; max-width: 420px; padding: var(--s3); }
.guest-card { background: var(--surface); border: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow-lg); padding: var(--s4); }
.guest-brand { display: flex; flex-direction: column; gap: var(--s1); align-items: flex-start; margin-bottom: var(--s3); }
.guest-brand img { display: block; height: auto; }
.guest-brand small { color: var(--muted); }
.guest-title { font-size: 1.15rem; margin-bottom: var(--s2); }

.check-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 0; font-size: .7rem; font-weight: 800; }
.check-ok { background: var(--ok-bg); color: var(--ok); }
.check-error { background: var(--danger-bg); color: var(--danger); }
.check-warning { background: var(--warn-bg); color: var(--warn); }

/* ---------- authentication (split layout) ---------- */
body.auth { background: var(--surface); --auth-accent: #5b5bf6; --auth-accent-2: #7c7cff; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; background: var(--auth-hero-bg); color: #fff; display: flex; align-items: center; }
.auth-hero-inner { position: relative; z-index: 1; width: 100%; max-width: 680px; padding: var(--s6) var(--s4) var(--s6) clamp(var(--s4), 14%, var(--s14)); }
.auth-watermark { position: absolute; width: 560px; height: 560px; right: -120px; bottom: -150px; opacity: .07; pointer-events: none; user-select: none; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); margin-bottom: var(--s8); }
.auth-brand small { display: block; font-size: .72rem; color: #9a9ca8; padding-left: 2px; }
.auth-brand img, .auth-brand svg.auth-logo { display: block; width: 340px; max-width: 100%; height: auto; }
.auth-brand-compact img, .auth-brand-compact svg.auth-logo { width: 220px; }
.logo-on-dark { display: none !important; }
:root[data-theme="dark"] .logo-on-light { display: none !important; }
:root[data-theme="dark"] .logo-on-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .logo-on-light { display: none !important; }
  :root[data-theme="auto"] .logo-on-dark { display: block !important; }
}
.auth-brand .brand-text { display: inline-flex; align-items: center; gap: var(--s1); color: #fff; font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.auth-brand .brand-text svg { flex: none; }
.auth-brand-compact .brand-text { color: var(--text); font-size: 1.4rem; }
:root[data-theme="dark"] .brand-text.logo-on-dark { display: inline-flex !important; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .brand-text.logo-on-dark { display: inline-flex !important; }
}
.auth-eyebrow { font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; color: var(--auth-accent-2); margin: 0 0 var(--s1); font-weight: 500; }
.auth-claim { font-size: clamp(2rem, 3.2vw, 2.9rem); line-height: 1.12; letter-spacing: -.05em; font-weight: 600; margin: 0 0 var(--s2); color: #fff; }
.auth-lead { color: #cfd1d8; font-size: 1rem; line-height: 1.75; max-width: 330px; margin: 0; }
.auth-hero-foot { color: #9a9ca8; font-size: .82rem; margin: var(--s8) 0 0; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: var(--s5) var(--s3); background: var(--surface); }
.auth-panel { width: 100%; max-width: 350px; }
.auth-panel .auth-eyebrow { color: var(--auth-accent); font-size: .68rem; }
/* dark theme: the brand blue of the organisation can be very dark, texts and links use its lighter tint */
:root[data-theme="dark"] .auth-panel .auth-eyebrow, :root[data-theme="dark"] .auth-help a { color: var(--auth-accent-2); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .auth-panel .auth-eyebrow, :root[data-theme="auto"] .auth-help a { color: var(--auth-accent-2); }
}
.auth-brand-compact { display: none; margin-bottom: var(--s4); color: var(--text); }
.auth-brand-compact small { color: var(--muted); }
.auth-title { font-size: 1.6rem; letter-spacing: -.035em; margin: 0 0 var(--s1); font-weight: 700; }
.auth-sub { color: var(--muted); font-size: .88rem; margin: 0 0 var(--s3); }
.auth-form label { font-weight: 400; color: var(--text-2); font-size: .84rem; margin-bottom: var(--s2); }
.auth-form input { margin-top: var(--s1); padding: var(--s1) var(--s2); border-color: var(--border); border-radius: 0; }
.auth-form input:focus { border-color: var(--auth-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent) 22%, transparent); }
.auth-submit { margin-top: var(--s2); height: 44px; font-size: .95rem; background: var(--auth-accent); border-color: var(--auth-accent); border-radius: 0; }
.auth-submit:hover { background: color-mix(in srgb, var(--auth-accent) 85%, #000); }
.auth-help { color: var(--muted); font-size: .84rem; line-height: 1.6; margin: var(--s1) 0 0; }
.auth-help a { color: var(--auth-accent); }
.auth-foot { display: flex; justify-content: space-between; margin-top: var(--s5); font-size: .72rem; color: var(--muted); }
.auth .alert { font-size: .86rem; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .auth-brand-compact { display: flex; }
  .auth-main { align-items: flex-start; padding-top: var(--s6); }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-side { grid-template-columns: minmax(0, 1fr); }

}
@media (max-width: 860px) {
  .shell, html.sidebar-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 290px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  /* On phones the drawer always shows labels, whatever the desktop preference. */
  html.sidebar-collapsed .sidebar .brand .brand-full, html.sidebar-collapsed .sidebar .brand .brand-payoff, html.sidebar-collapsed .sidebar .tenant-switch { display: block; }
  html.sidebar-collapsed .sidebar .brand .brand-lockup { display: inline-grid; }
  html.sidebar-collapsed .sidebar .brand .brand-mark { display: none; }
  html.sidebar-collapsed .sidebar .nav a span { display: inline; }
  html.sidebar-collapsed .sidebar .nav a { justify-content: flex-start; padding: var(--s1) var(--s1); }
  html.sidebar-collapsed .sidebar .nav-section { font-size: .64rem; border-top: 0; padding: var(--s2) var(--s1) var(--s1); margin: 0; }
  html.sidebar-collapsed .sidebar .brand { align-items: flex-start; padding: var(--s2) var(--s2) var(--s2); }
  .collapse-btn { display: none; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; } /* the page behind the open drawer does not scroll with it */
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(11, 13, 28, .5); backdrop-filter: blur(2px); z-index: 35; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 0 var(--s2); height: 56px; }
  .content { padding: var(--s2) var(--s2) var(--s3); }
  .user-name, .theme-label { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .filters input[type="search"] { min-width: 0; flex: 1 1 100%; }
  .filters select, .filters input { flex: 1 1 140px; }
  .bars li { grid-template-columns: 34% 1fr 2.2rem; }
  .codes { columns: 1; }
  .table-wrap { margin: 0 calc(-1 * var(--s3)); }
}

.print-header { display: none; }
@media print {
  .print-header { display: flex !important; align-items: center; gap: var(--s2); padding: 0 0 var(--s1); margin: 0 0 var(--s2); border-bottom: 2px solid var(--brand); color: #000; }
  .print-header img { max-height: 18mm; max-width: 45mm; object-fit: contain; }
  .print-header strong { display: block; font-size: 13pt; }
  .print-header small { display: block; font-size: 8pt; color: #444; }
  .print-header .print-date { margin-left: auto; text-align: right; }
  .sidebar, .topbar, .foot, .actions, .filters, .pagination, .btn, .alert-close, form .form-actions { display: none !important; }
  .shell, html.sidebar-collapsed .shell { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; color: #000; }
}

/* ---------- historical assignments ---------- */

.steps li.active { color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.steps li.active::before { background: var(--brand); color: var(--on-brand); }

/* ---------- BI charts (validated categorical palette, light / dark steps) ---------- */
:root {
  --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100;
  --viz-5: #e87ba4; --viz-6: #008300; --viz-7: #4a3aa7; --viz-8: #e34948;
  --viz-other: #b9b8b1; --viz-grid: #e1e0d9; --viz-axis: #c3c2b7;
  --viz-good: #0ca30c; --viz-warning: #fab219; --viz-critical: #d03b3b;
}
:root[data-theme="dark"] {
  --brand-ink: var(--brand);
  --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500;
  --viz-5: #d55181; --viz-6: #008300; --viz-7: #9085e9; --viz-8: #e66767;
  --viz-other: #5b5b57; --viz-grid: #2c2c2a; --viz-axis: #383835;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --brand-ink: var(--brand);
    --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500;
    --viz-5: #d55181; --viz-6: #008300; --viz-7: #9085e9; --viz-8: #e66767;
    --viz-other: #5b5b57; --viz-grid: #2c2c2a; --viz-axis: #383835;
  }
}
.s1 { --c: var(--viz-1); } .s2 { --c: var(--viz-2); } .s3 { --c: var(--viz-3); } .s4 { --c: var(--viz-4); }
.s5 { --c: var(--viz-5); } .s6 { --c: var(--viz-6); } .s7 { --c: var(--viz-7); } .s8 { --c: var(--viz-8); }
.s-other { --c: var(--viz-other); }
.st-good { --c: var(--viz-good); } .st-warning { --c: var(--viz-warning); } .st-critical { --c: var(--viz-critical); }
.bi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(420px, calc(50% - .6rem)), 1fr)); gap: var(--s2); }
.bi-grid .card { margin: 0; }
/* every chart card: title, chart, then the «Tabella» link aligned at the bottom of the row */
.bi-card { display: flex; flex-direction: column; }
.bi-card > .chart-table { margin-top: auto; padding-top: var(--s2); }
.bi-wide { grid-column: 1 / -1; }
.bi-kpi { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.bi-kpi .stat-label { padding-right: 0; white-space: normal; min-height: 2.7em; }
.bi-kpi .stat-value { margin-top: var(--s1); }
.bi-kpi .stat small { margin-top: 0; font-size: .78rem; line-height: 1.35; }
.chart-donut { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.donut { width: 168px; height: 168px; flex: none; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 24; }
.donut-seg { fill: none; stroke: var(--c); stroke-width: 24; cursor: pointer; transition: opacity .15s; outline: none; }
.donut:hover .donut-seg:not(:hover), .donut:focus-within .donut-seg:not(:focus) { opacity: .45; }
.donut-total { font-size: 26px; font-weight: 700; fill: var(--text); font-family: var(--font-display); }
.donut-caption { font-size: 11px; fill: var(--muted); }
.chart-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); flex: 1; min-width: 170px; font-size: .84rem; }
.chart-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 3.4rem; align-items: center; gap: var(--s1); color: var(--text); }
.chart-legend.inline { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); margin-bottom: var(--s1); }
.chart-legend.inline li { display: inline-flex; }
.swatch { width: 12px; height: 12px; border-radius: 0; background: var(--c); flex: none; }
.lg-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.lg-pct { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.hbars { display: grid; gap: var(--s1); }
.hbar { display: grid; grid-template-columns: 12rem minmax(0, 1fr) 2.5rem; align-items: center; gap: var(--s1); font-size: .84rem; border-radius: 0; outline: none; }
.hbar:hover .hbar-fill, .hbar:focus .hbar-fill { filter: brightness(1.12); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar-track { height: 14px; display: block; }
.hbar-fill { display: block; height: 100%; background: var(--c); border-radius: 0; }
.hbar-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; color: var(--text); white-space: nowrap; }
.columns { padding-left: var(--s4); }
.col-plot { position: relative; height: 200px; margin-bottom: var(--s3); border-bottom: 1px solid var(--viz-axis); }
.col-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--viz-grid); }
.col-grid span { position: absolute; left: -2rem; top: -.55rem; width: 1.6rem; text-align: right; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-row { position: absolute; inset: 0; display: flex; gap: 2px; align-items: flex-end; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 0; }
.col-bars { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 12%; }
.col-bar { position: relative; flex: 1; max-width: 34px; background: var(--c); border-radius: 0; min-height: 0; cursor: pointer; outline: none; }
.col-bar:hover, .col-bar:focus { filter: brightness(1.12); }
.col-value { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .72rem; font-weight: 600; color: var(--text); padding-bottom: 2px; }
.col-label { position: absolute; top: 100%; left: 0; right: 0; text-align: center; font-size: .7rem; color: var(--muted); padding-top: var(--s1); white-space: nowrap; }
.chart-table { margin-top: var(--s2); }
.chart-table summary { cursor: pointer; font-size: .8rem; color: var(--muted); font-weight: 600; }
.viz-tip { position: fixed; z-index: 60; pointer-events: none; padding: var(--s1) var(--s1); border-radius: 0; background: var(--text); color: var(--surface); font-size: .78rem; font-weight: 600; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
@media (max-width: 520px) { .bi-grid { grid-template-columns: minmax(0, 1fr); } .donut { width: 140px; height: 140px; } }
@media print { .chart-table { display: none; } .bi-grid { grid-template-columns: 1fr 1fr; } }
.org-logo { display: block; height: 30px; max-width: 140px; width: auto; object-fit: contain; padding: 3px var(--s1); background: #fff; border: 1px solid var(--border); border-radius: 0; }
@media (max-width: 860px) { .org-logo { height: 26px; max-width: 90px; } }

/* ---------- assignment target ---------- */
.target-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s1); }
.target-choice .target-option { position: relative; display: flex; align-items: center; gap: var(--s1); margin: 0; padding: var(--s2) var(--s2); border: 1px solid var(--border); border-radius: 0; cursor: pointer; background: var(--surface); }
.target-choice .target-option input { position: absolute; opacity: 0; pointer-events: none; }
.target-choice .target-option .ic { width: 22px; height: 22px; color: var(--brand-ink); flex: none; }
.target-choice .target-option strong { display: block; color: var(--text); font-size: .9rem; }
.target-choice .target-option small { display: block; color: var(--muted); font-size: .75rem; font-weight: 400; }
.target-choice .target-option:hover { border-color: var(--border-strong); }
.target-choice .target-option:has(input:checked) { border-color: var(--brand); box-shadow: var(--ring); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.target-choice .target-option:has(input:focus-visible) { box-shadow: var(--ring); }

/* Autocomplete for long selects */
.ac { position: relative; margin-top: var(--s1); }
.ac .ac-input { margin: 0; padding-right: var(--s4); }
.ac .ac-clear { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.ac .ac-clear:hover { background: var(--surface-3); color: var(--text); }
.ac .ac-clear[hidden] { display: none !important; }
.ac .ac-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0; }
.ac-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40; list-style: none; margin: 0; padding: var(--s1) 0; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 0; box-shadow: var(--shadow-lg); }
.ac-list li { padding: var(--s1) var(--s2); cursor: pointer; font-size: .87rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-list li.active, .ac-list li:hover { background: var(--surface-3); }
.ac-list li.ac-note { cursor: default; color: var(--muted); font-size: .8rem; white-space: normal; background: none; }

.quick-add-btn:disabled { opacity: .45; cursor: not-allowed; }

.filters .ac { margin-top: 0; min-width: 220px; }
.filters .ac .ac-input { width: 100%; min-width: 0; }

/* "+" next to selects and on-the-fly creation dialog */
.quick-add-row { display: flex; align-items: stretch; gap: var(--s1); margin-top: var(--s1); }
.quick-add-row > select, .quick-add-row > .ac { flex: 1; min-width: 0; margin-top: 0; }
.quick-add-btn { flex: none; width: 38px; padding: 0; justify-content: center; font-size: 1.15rem; font-weight: 600; line-height: 1; }
.quick-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--border-strong); border-radius: 0; padding: var(--s3); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.quick-dialog::backdrop { background: rgba(10, 14, 30, .45); }
.quick-dialog h2 { margin: 0 0 var(--s2); font-size: 1.1rem; }
.quick-dialog .form-actions { margin-top: var(--s2); }

/* Sites and positions: one "new" button per type, "+ aggiungi" menu on each row */

.add-menu { position: relative; }
.add-menu summary { cursor: pointer; list-style: none; color: var(--brand-ink); }
.add-menu summary::-webkit-details-marker { display: none; }
.add-menu summary::after { content: " ▾"; font-size: .7em; }
.add-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow-lg); padding: var(--s1); }
.add-menu .menu a { white-space: nowrap; font-size: .84rem; }
/* commands of a grid row: placed on the page by app.js, because the grid scrolls sideways */
.row-menu { display: inline-block; vertical-align: top; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { background: var(--surface-3); color: var(--text); }
/* the sticky cell of the actions is a layer of its own: the one with the open menu goes over the rows below */
.row-actions:has(.row-menu[open]) { z-index: 61; }
.row-menu .menu { position: fixed; z-index: 60; min-width: 210px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); padding: var(--s1); text-align: left; white-space: nowrap; }
.row-menu .menu form { margin: 0; }
.row-menu .menu a, .row-menu .menu button { font-size: .84rem; }
.row-menu .menu .ic { width: 15px; height: 15px; }
.row-menu .menu .menu-danger { color: var(--danger); }
.row-menu .menu .menu-danger:hover { background: var(--danger-bg, var(--surface-3)); color: var(--danger); }

/* Dashboard: "Novità e aggiornamenti" (from CHANGELOG.md), collapsed until clicked */
.whats-new { padding: 0; }
.whats-new > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s1); padding: var(--s2) var(--s2); border-radius: 0; }
.whats-new > summary::-webkit-details-marker { display: none; }
.whats-new > summary:hover { background: var(--surface-2); }
.whats-new-title { display: inline-flex; align-items: center; gap: var(--s1); font-weight: 650; font-size: 1rem; }
.whats-new > summary .badge, .whats-new-date { flex: none; }
.whats-new-title .ic { color: var(--brand-ink); }
.whats-new-date { font-size: .82rem; }
.whats-new-toggle { margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.whats-new[open] > summary .whats-new-toggle { transform: rotate(-135deg); }
.whats-new[open] > summary { border-bottom: 1px solid var(--border); border-radius: 0; }
.whats-new-body { padding: var(--s1) var(--s2) var(--s2); font-size: .9rem; line-height: 1.55; }
.whats-new-body h4 { margin: var(--s2) 0 var(--s1); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.whats-new-body ul { margin: 0; padding-left: var(--s2); }
.whats-new-body li { margin: var(--s1) 0; }
.whats-new-intro { margin: var(--s1) 0 0; color: var(--text-2); }
.whats-new-older { margin-top: var(--s2); border-top: 1px solid var(--border); padding-top: var(--s1); }
.whats-new-older > summary { cursor: pointer; font-weight: 600; font-size: .86rem; color: var(--text-2); }

/* Generic helpers */
.js .js-hide { display: none !important; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s1); }
.card-title-row h2 { margin: 0; display: flex; align-items: center; gap: var(--s1); }
.card-title-row .muted { font-size: .82rem; }
.map-embed { display: block; width: 100%; height: 320px; border: 1px solid var(--border); }
.select-compact { width: auto; min-width: 190px; margin: 0; padding-top: var(--s1); padding-bottom: var(--s1); font-size: .86rem; }
.row-actions .inline-act { display: inline-block; margin: 0; }
.act-disabled { opacity: .35; cursor: not-allowed; }
.act-disabled:hover { background: none; border-color: transparent; color: var(--muted); }
/* action in progress (e.g. a service restarting): disabled, the icon turns */
button.act:disabled { cursor: default; opacity: .3; background: none; }
button.act:disabled:hover { background: none; border-color: transparent; }
.act-busy, .act-busy:hover { opacity: 1; color: var(--brand-ink); }
.act-busy .ic { animation: act-spin 1.1s linear infinite; }
@keyframes act-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .act-busy .ic { animation: none; } }

/* Super Admin › user: organisations and roles */
.memberships td { vertical-align: middle; }

/* Outgoing mail: setup steps for Microsoft Entra */
.howto { margin: var(--s1) 0 var(--s1); border: 1px solid var(--border); border-radius: 0; padding: var(--s1) var(--s2); background: var(--surface); }
.howto > summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--brand-ink); }
.howto ol { margin: var(--s1) 0 0; padding-left: var(--s2); font-size: .85rem; line-height: 1.55; }
.howto li { margin-bottom: var(--s1); }
.hint.warn { color: var(--warn); }

/* Outgoing mail: log of tests and changes, newest first */
.mail-log { list-style: none; margin: var(--s1) 0 var(--s1); padding: var(--s1) var(--s1); border: 1px solid var(--border); border-radius: 0; background: var(--surface-3); font: 12.5px/1.5 var(--mono); max-height: 420px; overflow-y: auto; }
.mail-log li { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--s2); padding: var(--s1) 0 var(--s1) var(--s1); border-left: 3px solid var(--border); margin-bottom: 0; }
.mail-log li.ok { border-left-color: var(--ok); }
.mail-log li.err { border-left-color: var(--danger); }
.mail-log li.err .mail-log-text { color: var(--danger); }
.mail-log li.info { border-left-color: var(--info); }
.mail-log time { color: var(--muted); white-space: nowrap; }
.mail-log small { color: var(--muted); font-size: inherit; }
@media (max-width: 640px) { .mail-log li { grid-template-columns: minmax(0, 1fr); } }

/* Super Admin › Impostazioni applicazione: one card per section */
.settings-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s2); }
.settings-card { display: flex; gap: var(--s2); align-items: flex-start; text-decoration: none; color: var(--text); margin: 0; border: 1px solid var(--border); }
.settings-card:hover { border-color: var(--brand); box-shadow: var(--ring); }
.settings-card > .ic { width: 26px; height: 26px; color: var(--brand-ink); flex: none; margin-top: 0; }
.settings-card strong { display: block; font-size: 1rem; margin-bottom: 0; }
.settings-card small { display: block; color: var(--muted); margin-bottom: var(--s1); }
.settings-card em { display: block; font-style: normal; font-size: .82rem; }
.settings-card.warn em { color: var(--warn); }

/* Card whose actions sit at its bottom edge (e.g. Super Admin › tenant: "Salva modifiche") */
.card-actions { display: flex; flex-direction: column; }
.card-actions > .form-actions { margin-top: auto; padding-top: var(--s2); }
.btn-warning { background: var(--warn); border-color: color-mix(in srgb, var(--warn) 85%, #000); color: #fff; }
.btn-warning:hover { filter: brightness(1.06); }
:root[data-theme="dark"] .btn-warning { color: #1a1205; }
.backup-choice { border: 1px solid var(--border); border-radius: 0; padding: var(--s1) var(--s2) var(--s1); margin: 0 0 var(--s2); }
.backup-choice legend { font-weight: 600; padding: 0 var(--s1); font-size: .9rem; }
.backup-choice .check { display: flex; align-items: flex-start; gap: var(--s1); margin: var(--s1) 0; }
.backup-choice .check input { margin-top: 0; }
.backup-choice small { display: block; color: var(--muted); font-weight: 400; }
.totp-input { max-width: 10rem; letter-spacing: .2em; }

.backup-import { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s1); margin: var(--s1) 0 var(--s2); }
.backup-import label { margin: 0; }
.backup-import input, .backup-import .btn { height: 2.6rem; margin-top: var(--s1); box-sizing: border-box; }
.backup-import .btn { margin-top: 0; }
.upper::placeholder { text-transform: none; }

/* ---------- Row actions in the grids ----------
   every action always in its own slot (an empty slot keeps the others in place), no floating shadow,
   bigger targets on touch screens, rows as cards on smartphones. */
.act-label { display: none; }
.act-slot { visibility: hidden; }
button.act { background: none; padding: 0; font: inherit; cursor: pointer; }
button.act:hover { background: var(--surface-3); }
button.act-danger:hover { background: var(--danger-bg); }
.row-actions, th.actions-col { box-shadow: 1.4rem 0 0 var(--surface); border-left: 1px solid var(--border); }
@media (pointer: coarse) {
  .row-actions .act { width: 40px; height: 40px; }
  .row-actions .act .ic { width: 18px; height: 18px; }
}
@media (max-width: 640px) {

  /* every grid (not the key/value ones): one card per row, the field names taken from the column headers (app.js) */
  :is(.grid-cards, .table:not(.kv, .no-cards)) thead { display: none; }
  :is(.grid-cards, .table:not(.kv, .no-cards)), :is(.grid-cards, .table:not(.kv, .no-cards)) tbody, :is(.grid-cards, .table:not(.kv, .no-cards)) tr { display: block; width: 100%; min-width: 0; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) tr { padding: var(--s1) var(--s2); margin-bottom: var(--s1); border: 1px solid var(--border); border-radius: 0; background: var(--surface); }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td { display: block; border: 0; padding: 0 0; white-space: normal; font-size: .85rem; min-width: 0; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td:first-child { font-size: .95rem; font-weight: 600; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td:empty, :is(.grid-cards, .table:not(.kv, .no-cards)) td.row-actions:not(:has(.act:not(.act-slot))) { display: none; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--muted); font-size: .78rem; font-weight: 400; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td[colspan] { text-align: center; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions { grid-column: 1 / -1; position: static; box-shadow: none; border-left: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s1);
    border-left: 0; border-top: 1px solid var(--border); padding-top: var(--s1); margin-top: var(--s1); background: none; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .act { width: auto; height: auto; margin: 0; padding: var(--s1) 0; display: flex; flex-direction: column; gap: 0;
    align-items: center; border: 1px solid var(--border); border-radius: 0; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .act-slot { border-color: transparent; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .inline-act { display: block; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .inline-act .act { width: 100%; height: 100%; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .row-menu { display: block; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .row-menu > .act { width: 100%; height: 100%; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .act-label { display: block; font-size: .72rem; line-height: 1.1; }
}
/* long press on a touch screen: the name of the action */
.act-tip { position: fixed; z-index: 70; transform: translate(-50%, -120%); background: var(--text); color: var(--surface); font-size: .78rem;
  padding: var(--s1) var(--s1); border-radius: 0; pointer-events: none; white-space: nowrap; }

/* ---------- 2FA code: one box per digit (built by app.js on input[data-otp]; without JS the plain field stays) ---------- */
.otp-boxes { display: flex; gap: var(--s1); margin-top: var(--s1); }
.otp-boxes input.otp-box { width: 2.7rem; min-width: 0; height: 3.1rem; margin: 0; padding: 0; text-align: center; font: 600 1.35rem/1 var(--mono);
  border: 1px solid var(--border-strong); border-radius: 0; background: var(--surface); color: var(--text); caret-color: var(--brand); }
.otp-boxes input.otp-box:nth-child(4) { margin-left: var(--s1); }
.otp-boxes input.otp-box:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.auth-form .otp-boxes input.otp-box { border-color: color-mix(in srgb, currentColor 35%, transparent); }
.auth-form .otp-boxes input.otp-box:focus { border-color: var(--auth-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent) 22%, transparent); }
.otp-boxes.otp-error input.otp-box { border-color: var(--danger); }
.otp-boxes[hidden], .otp-toggle[hidden] { display: none; }
.otp-toggle { display: inline-block; margin: calc(-1 * var(--s1)) 0 var(--s2); padding: 0; background: none; border: 0; font: inherit; font-size: .82rem; color: var(--brand-ink); cursor: pointer; text-decoration: underline; }
@media (max-width: 380px) { .otp-boxes { gap: var(--s1); } .otp-boxes input.otp-box { width: 2.3rem; height: 2.8rem; font-size: 1.15rem; } .otp-boxes input.otp-box:nth-child(4) { margin-left: var(--s1); } }

/* ---------- integrations: the two directions ---------- */

.direction { display: inline-flex; align-items: center; gap: var(--s1); padding: 0 var(--s1); border-radius: 0; font-size: .78rem; font-weight: 600;
  background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand-ink); }
.direction .ic { width: 14px; height: 14px; }
.indent { margin: calc(-1 * var(--s1)) 0 var(--s2) var(--s3); }

/* ---------- integrations: logos of the applications ---------- */

.int-logo { width: 28px; height: 28px; flex: none; border-radius: 0; object-fit: contain; }

.int-logo-text { display: inline-grid; place-items: center; background: #173f5f; color: #fff; font: 700 .62rem/1 var(--font); letter-spacing: .02em; }

/* ---------- Editor stampe ---------- */

.alert .btn { text-decoration: none; }
.alert .btn-primary, .alert .btn-primary:hover { color: #fff; }

/* ---------- user manual ---------- */
.manual { --nx-blue: #00529e; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: var(--s2); align-items: start; }
/* dark theme: headings in the text colour (#00529E on black is not readable), the blue stays on bars and borders */
:root[data-theme="dark"] .manual-body h3, :root[data-theme="dark"] .manual-toc li.active > a { color: var(--text); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .manual-body h3, :root[data-theme="auto"] .manual-toc li.active > a { color: var(--text); } }
.manual-side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: var(--s1); max-height: calc(100vh - 6rem); overflow: auto; }
.manual-search input { width: 100%; margin: 0; }
.manual-pdf { align-self: flex-start; }
.manual-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.manual-toc > ol > li { counter-increment: ch; margin: 0 0; }
.manual-toc > ol > li > a::before { content: counter(ch) ". "; color: var(--muted); }
.manual-toc a { display: block; padding: var(--s1) var(--s1); border-radius: 0; color: var(--text); font-size: .9rem; }
.manual-toc a:hover { background: var(--surface-2); text-decoration: none; }
.manual-toc li.active > a { background: color-mix(in srgb, var(--nx-blue) 12%, transparent); color: var(--nx-blue); font-weight: 600; }
.manual-toc ul { list-style: none; margin: 0 0 var(--s1) var(--s2); padding: 0 0 0 var(--s1); border-left: 2px solid var(--border); }
.manual-toc ul a { font-size: .84rem; color: var(--text-2); padding: 0 var(--s1); }
.manual-body { max-width: 900px; line-height: 1.65; }
.manual-body h2 { font-size: 1.7rem; margin: 0 0 var(--s2); }
.manual-body h3 { font-size: 1.2rem; margin: var(--s4) 0 var(--s1); color: var(--nx-blue); scroll-margin-top: var(--s10); }
.manual-body h4 { font-size: 1rem; margin: var(--s3) 0 var(--s1); scroll-margin-top: var(--s10); }
.manual-body ul, .manual-body ol { padding-left: var(--s3); }
.manual-body li { margin: var(--s1) 0; }
.manual-body pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; padding: var(--s1) var(--s2); overflow: auto; font-size: .85rem; }
.manual-crumb { margin: 0 0 var(--s1); font-size: .84rem; }
.manual-callout { margin: var(--s2) 0; padding: var(--s1) var(--s2); border-radius: 0; border-left: 4px solid var(--nx-blue); background: color-mix(in srgb, var(--nx-blue) 8%, transparent); }
.manual-callout.manual-warning { border-left-color: var(--warn); background: var(--warn-bg); }
.manual-callout.manual-tip { border-left-color: var(--ok); background: var(--ok-bg); }
.manual-table { margin: var(--s2) 0; }
.manual-pager { display: flex; justify-content: space-between; gap: var(--s2); margin-top: var(--s4); padding-top: var(--s2); border-top: 1px solid var(--border); }
.manual-index li { margin: var(--s1) 0; }
.manual-index span { display: block; font-size: .84rem; }
.manual-results { list-style: none; padding: 0; }
.manual-results li { padding: var(--s1) 0; border-bottom: 1px solid var(--border); }
.manual-results p { margin: 0 0 0; font-size: .88rem; color: var(--text-2); }
@media (max-width: 900px) {
  .manual { grid-template-columns: minmax(0, 1fr); }
  .manual-side { position: static; max-height: none; }
}
.manual-figure { margin: var(--s2) 0 var(--s3); text-align: center; }
.manual-figure img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow); background: #fff; }
.manual-figure figcaption { margin-top: var(--s1); font-size: .84rem; color: var(--muted); }

/* ---------- counts on the tabs, lists of checkboxes ---------- */
.tabs a .count { display: inline-block; margin-left: var(--s1); padding: 0 var(--s1); border-radius: 0; background: var(--surface-3); color: var(--muted); font-size: .74rem; font-weight: 600; }
.tabs a.active .count { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-ink); }
.check-list { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); margin: 0 0 var(--s1); }
.check-list .check { margin: 0; }

/* ---------- sign-in with Microsoft ---------- */
.auth-or { display: flex; align-items: center; gap: var(--s2); margin: var(--s2) 0 var(--s1); color: var(--muted); font-size: .8rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.btn-microsoft { gap: var(--s1); background: var(--surface); color: var(--text); border-color: var(--border-strong); font-weight: 600; }
.btn-microsoft:hover { border-color: var(--text-2); text-decoration: none; }
.ms-logo { width: 18px; height: 18px; flex: none; }
.auth-choices { list-style: none; margin: var(--s2) 0; padding: 0; display: grid; gap: var(--s1); }
.btn-logo { width: 16px; height: 16px; }

/* Spigoli vivi, come tutta la suite: angoli a 0 nei valori sopra, senza eccezioni (anche utente e pallini
   indicatori). Niente ombre su schede, pulsanti
   e campi: le schede compensano con il bordo più marcato. Restano l'ombra delle finestre e l'anello di focus. */
.card, .stat { box-shadow: none; border-color: var(--border-strong); }
.btn, .btn-primary, .tabs a.active, input, select, textarea { box-shadow: none; }

.num { text-align: right; white-space: nowrap; }

.ext { display: flex; flex-direction: column; gap: 0; padding: var(--s1) var(--s1); border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 0; background: var(--surface); min-width: 0; }

.refresh-stale { opacity: .55; transition: opacity .2s; }
/* monospaced inputs keep the height of the other fields */
input.mono { font-size: .9rem; line-height: 1.55; }

.stack { height: 100%; display: flex; flex-direction: column-reverse; justify-content: flex-start; padding: 0 12%; }
.stack-part { display: block; width: 100%; max-width: 34px; margin: 0 auto; background: var(--c); cursor: pointer; outline: none; }
.stack-part + .stack-part { box-shadow: 0 1px 0 var(--surface); }
.stack-part:hover, .stack-part:focus { filter: brightness(1.12); }
.chart-gauge { display: flex; justify-content: center; }
.gauge { width: 100%; max-width: 260px; height: auto; }
.gauge-track, .gauge-fill { fill: none; stroke-width: 16; stroke-linecap: butt; }
.gauge-track { stroke: var(--surface-3); }
.gauge-fill { stroke: var(--c); cursor: pointer; outline: none; transition: stroke-dasharray .6s ease; }
.gauge-target { stroke: var(--text); stroke-width: 2; }
.gauge-value { font-size: 30px; font-weight: 700; fill: var(--text); font-family: var(--font-display); }
.gauge-caption { font-size: 10px; fill: var(--muted); }
.st-none { --c: var(--viz-other); }
.heatmap { display: grid; grid-template-columns: 2.4rem repeat(var(--cols), minmax(0, 1fr)); gap: 2px; font-size: .68rem; color: var(--muted); }
.hm-col { text-align: center; white-space: nowrap; }
.hm-row { display: flex; align-items: center; }
.hm-cell { aspect-ratio: 1 / 1; min-height: 12px; background: color-mix(in srgb, var(--viz-1) var(--lv), var(--surface-2)); cursor: pointer; outline: none; }
.hm-cell:hover, .hm-cell:focus { box-shadow: inset 0 0 0 2px var(--text); }
.bi-filters { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; }
.bi-filters .btn.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.bi-section { margin: var(--s3) 0 var(--s2); font-size: 1.05rem; display: flex; align-items: center; gap: var(--s1); }
.bi-section small { font-weight: 400; color: var(--muted); font-size: .8rem; }

.rate { display: inline-block; width: 6rem; height: 8px; background: var(--surface-3); vertical-align: middle; }

.area { padding-left: var(--s4); }
.ar-plot { height: 220px; }
.ar-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ar-fill { fill: var(--c); opacity: .12; }
.ar-line { fill: none; stroke: var(--c); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ar-dot { position: absolute; width: 7px; height: 7px; translate: -50% -50%; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--c); pointer-events: none; }
.ar-hits { position: absolute; inset: 0; display: flex; }
.ar-hit { flex: 1; cursor: pointer; outline: none; }
.ar-hit:hover, .ar-hit:focus { background: color-mix(in srgb, var(--text) 6%, transparent); }
.ar-labels { position: absolute; left: 0; right: 0; top: 100%; height: 1.4rem; }
.ar-label { position: absolute; transform: translateX(-50%); padding-top: var(--s1); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.ar-label:first-child { transform: none; }
.ar-label.ar-last { transform: translateX(-100%); }
@media (max-width: 560px) { .bi-grid { grid-template-columns: minmax(0, 1fr); } .hbar { grid-template-columns: 8rem minmax(0, 1fr) 2.5rem; } }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.checks li { display: grid; grid-template-columns: 6.6rem 9.5rem minmax(0, 1fr); gap: var(--s1); align-items: baseline; padding: var(--s1) 0; border-top: 1px solid var(--border); font-size: .88rem; }
.checks li:first-child { border-top: 0; padding-top: 0; }
.checks .badge { justify-self: start; }
.check-label { font-weight: 600; }
.check-detail { color: var(--muted); }
.quota { margin-top: var(--s2); }

.table.kv td:first-child { color: var(--muted); width: 42%; }

.events details summary { cursor: pointer; }
.events pre { white-space: pre-wrap; word-break: break-all; font-size: .76rem; max-height: 16rem; overflow: auto; margin: var(--s1) 0 0; padding: var(--s1); background: var(--muted-bg); }
@media (max-width: 700px) { .checks li { grid-template-columns: 6.6rem minmax(0, 1fr); } .check-detail { grid-column: 2; } }
.sys-stats .stat small { min-height: 2.6em; }
.table.kv td { overflow-wrap: anywhere; }

.table-wrap + .hint { margin-top: var(--s2); }

.pick { min-width: 0; padding: var(--s2) var(--s2) var(--s2); }
.pick legend small { font-weight: 400; margin-left: var(--s1); }

 .table-wrap + label { margin-top: var(--s2); }

/* loading: bar at the top while the next page is on its way, spinner on the pressed button */
.page-loader { position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 3px; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .15s; }
.page-loader::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--brand); animation: page-loader 1.1s ease-in-out infinite; }
.page-loader.on { opacity: 1; }
@keyframes page-loader { to { left: 100%; } }
body.is-loading main { opacity: .6; transition: opacity .2s .15s; pointer-events: none; }
.btn.btn-busy { position: relative; color: transparent !important; }
.btn.btn-busy > * { visibility: hidden; }
.btn.btn-busy::after { content: ""; position: absolute; top: 50%; left: 50%; width: 15px; height: 15px; translate: -50% -50%; border: 2px solid currentColor; border-color: var(--brand) var(--brand) transparent transparent; border-radius: 50%; animation: act-spin .7s linear infinite; }
.btn-primary.btn-busy::after { border-color: #fff #fff transparent transparent; }
select.is-busy { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .page-loader::before { animation: none; left: 0; width: 100%; opacity: .6; } .btn.btn-busy::after { animation-duration: 2s; } }

.hbars-wide .hbar { grid-template-columns: 12rem minmax(0, 1fr) 12rem; }
@media (max-width: 560px) { .hbars-wide .hbar { grid-template-columns: 6rem minmax(0, 1fr) 10rem; } }

/* scheduled sending form: time and number fields as tall as the selects beside them */
[data-schedule-form] input:not([type="checkbox"]), [data-schedule-form] select { height: 42px; box-sizing: border-box; }

/* Mobile: no automatic zoom and no jumps. iOS Safari zooms in on fields with text under 16px when they get the focus
   (the sign-in page focuses the e-mail field at once) and the page then slides; 100vh changes while the browser bar
   shows and hides, 100dvh follows the visible height. */
@media (max-width: 900px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea { font-size: 16px; }
}
@supports (min-height: 100dvh) {
  .auth-split { min-height: 100dvh; }
  body.guest { min-height: 100dvh; }
}
@media (max-width: 900px) {
  .auth-main { min-height: 100dvh; overflow-anchor: none; }
}

.dual-item + .dual-item { border-top: 1px solid var(--border); }
.dual-item label { display: flex; align-items: center; gap: var(--s1); min-height: 40px; user-select: none; margin: 0; padding: var(--s1) var(--s1) var(--s1) var(--s2); font-size: .86rem; font-weight: 400; cursor: pointer; }
.dual-item:hover label, .dual-item:focus-visible label { background: var(--surface-2); }
.dual-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.dual-num { flex: 0 0 auto; min-width: 3.2rem; color: var(--muted); font-size: .8rem; }
.dual-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.dual-tools { display: flex; align-items: center; margin-left: auto; flex: 0 0 auto; }
.dual-tools .act { width: 28px; height: 28px; margin: 0; }
.dual-tools .act:disabled { opacity: .3; cursor: default; background: none; }
.dual-add { display: inline-grid; place-items: center; width: 28px; height: 28px; color: var(--muted); opacity: .45; transition: opacity .12s, color .12s; }
.dual-item:hover .dual-add, .dual-item:focus-visible .dual-add { opacity: 1; color: var(--brand-ink); }

.dual-grip { display: inline-grid; place-items: center; width: 22px; height: 28px; color: var(--muted); cursor: grab; flex: 0 0 auto; touch-action: none; }
.dual-item.is-dragging .dual-grip { cursor: grabbing; }
.dual-grip .ic { width: 16px; height: 16px; }
.dual-item.is-dragging { opacity: .55; background: var(--surface-3); }

.sort-grip { display: inline-grid; place-items: center; width: 22px; height: 28px; color: var(--muted); cursor: grab; touch-action: none; }
.sort-grip .ic { width: 16px; height: 16px; }
.sort-tools { display: flex; }
.sort-tools .act { width: 28px; height: 28px; margin: 0; }
.sort-tools .act:disabled { opacity: .3; cursor: default; background: none; }

a.ro-link { color: var(--brand-ink); font-weight: 600; text-decoration: none; }
a.ro-link:hover { text-decoration: underline; }

/* Modelli e-mail: the texts on the left, the e-mail as it arrives on the right (always light, like the e-mail) */
.mail-tpl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2); align-items: start; }
.mail-tpl .card { margin: 0; }
.mail-tpl-form textarea { min-height: 15rem; line-height: 1.5; }
.mail-vars { border: 1px solid var(--border); background: var(--surface-2); padding: var(--s1) var(--s2); font-size: .82rem; }
.mail-vars ul { list-style: none; margin: var(--s1) 0 0; padding: 0; display: grid; gap: 0; }
.mail-vars code { color: var(--brand-ink); }
.mail-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s2); margin: 0 0 var(--s1); font-size: .85rem; }
.mail-head dt { color: var(--muted); }
.mail-head dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.mail-preview { background: #f6f6f4; border: 1px solid var(--border); overflow: auto; margin-bottom: var(--s2); color-scheme: light; }
.mail-preview img { max-width: 100%; }
@media (max-width: 1100px) { .mail-tpl { grid-template-columns: minmax(0, 1fr); } }

/* Search in long selects (data-autocomplete): the group of each entry, and the box inside the rows of keys and forwardings */
.ac-list li .ac-group { float: right; margin-left: var(--s2); color: var(--muted); font-size: .75rem; }
.ac-list li.active .ac-group { color: var(--text-2); }

/* Error pages: dark with a glow in the colour of the brand, white logo, the picture of the link, title on two lines
   with the full stop. Fixed brand colours (--errp from config/brand.php), always dark (the page is the brand, not the theme). */
.errp { margin: 0; min-height: 100vh; display: flex; background: #0a0c1c linear-gradient(135deg, #1b2042, #0a0c1c); color: #fff; color-scheme: dark; }
.errp-wrap { flex: 1; display: flex; flex-direction: column; padding: var(--s4) clamp(var(--s2), 6vw, var(--s8));
  background: radial-gradient(ellipse at 85% 18%, color-mix(in srgb, var(--errp, #a6ff00) 30%, transparent), transparent 55%); }
.errp-head a { display: inline-block; }
.errp-logo { width: 11.25rem; height: auto; display: block; }
.errp-main { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 40rem; padding: var(--s5) 0; }
.errp-kicker { color: color-mix(in srgb, var(--errp, #a6ff00) 55%, #fff); font-size: .8rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; margin: 0 0 var(--s2); }
.errp-title { font-size: clamp(2.1rem, 6vw, 3.5rem); line-height: 1.05; font-weight: 800; letter-spacing: -.02em; margin: 0 0 var(--s3); color: #fff; }
.errp-line { display: block; width: 100%; height: 4.4rem; margin: 0 0 var(--s3); }
.errp-lead { font-size: 1.05rem; line-height: 1.6; color: #d9dbe8; margin: 0 0 var(--s1); max-width: 33rem; }
.errp-detail { font-size: .9rem; line-height: 1.5; color: #a3a9bf; margin: 0 0 var(--s1); max-width: 33rem; }
.errp-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.errp-btn { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 var(--s3); background: var(--errp, #a6ff00); color: var(--errp-on, #101a22); font-weight: 700; text-decoration: none; border: 1px solid var(--errp, #a6ff00); }
.errp-btn:hover { background: color-mix(in srgb, var(--errp, #a6ff00) 85%, #000); border-color: color-mix(in srgb, var(--errp, #a6ff00) 85%, #000); color: var(--errp-on, #101a22); }
.errp-btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .35); }
.errp-btn-ghost:hover { background: rgba(255, 255, 255, .08); border-color: #fff; }
.errp-foot { display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; font-size: .75rem; color: #8e92ae; }
.errp pre { background: rgba(255, 255, 255, .06); padding: var(--s1) var(--s2); overflow-x: auto; color: #fff; }
/* the steps of a restore of the database (admin/db_restore_progress.php) */
.errp-steps { list-style: none; margin: var(--s2) 0; padding: 0; display: grid; gap: var(--s1); font-size: .9rem; color: #d9dbe8; }
.errp-steps li { display: flex; gap: var(--s2); align-items: baseline; padding-left: var(--s3); position: relative; }
.errp-steps li::before { content: ""; position: absolute; left: 0; top: .35em; width: 8px; height: 8px; background: var(--errp, #a6ff00); }
.errp-steps .mono { color: #8e92ae; flex: none; }
.errp-step-run::before { animation: live-pulse 1.4s infinite; }
.errp-step-fail { color: #ffb4b4; }
.errp-step-fail::before { background: #ff5a5a; }

/* Larghezza dei campi: a field is as wide as what it can hold (type, maxlength), not as the card. Full width again on
   phones. Textareas, the filter rows and fields given a width of their own are not touched. */
:where(.form, form, .card) :where(input[type="number"]) { max-width: 9rem; }
:where(.form, form, .card) :where(input[type="time"]) { max-width: 8.5rem; }
:where(.form, form, .card) :where(input[type="date"]) { max-width: 11rem; }
:where(.form, form, .card) :where(input[type="datetime-local"]) { max-width: 15rem; }
:where(.form, form, .card) :where(input[type="color"]) { max-width: 7rem; }
:where(.form, form, .card) :where(input[maxlength="1"], input[maxlength="2"], input[maxlength="3"], input[maxlength="4"], input[maxlength="5"], input[maxlength="6"]) { max-width: 8rem; }
:where(.form, form, .card) :where(input[maxlength="7"], input[maxlength="8"], input[maxlength="9"], input[maxlength="10"], input[maxlength="11"], input[maxlength="12"]) { max-width: 12rem; }
:where(.form, form, .card) :where(input[maxlength="13"], input[maxlength="14"], input[maxlength="15"], input[maxlength="16"], input[maxlength="17"], input[maxlength="18"], input[maxlength="19"], input[maxlength="20"], input[maxlength="21"]) { max-width: 16rem; }
:where(.form, form, .card) :where(input[maxlength="30"], input[maxlength="32"], input[maxlength="36"], input[maxlength="40"]) { max-width: 24rem; }
:where(.form, form, .card) :where(input[maxlength="50"], input[maxlength="60"], input[maxlength="64"]) { max-width: 30rem; }
:where(.form, form, .card) :where(input[type="email"], input[type="password"], input[type="tel"]) { max-width: 30rem; }
:where(.form, form, .card) :where(input[maxlength="100"], input[maxlength="120"], input[maxlength="150"], input[maxlength="190"], input[maxlength="200"], input[maxlength="255"]) { max-width: 36rem; }
/* a drop-down in a form is as wide as its longest choice (not in the rows of keys, menus and forwards, aligned on purpose) */
:where(.form, form, .card) label > select:not([multiple]) { width: fit-content; min-width: 12rem; max-width: 100%; }
:where(.form, form, .card) :where(select:not([multiple])) { max-width: 30rem; }

/* the «+» beside a field as tall as the field (the rows of keys, menus and forwards set their own heights) */
:where(.quick-add-row) > .quick-add-btn { height: auto; min-height: 0; align-self: stretch; }
@media (max-width: 560px) {
  :where(.form, form, .card) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select) { max-width: none; }
}
/* Righe di campi (.grid-2.tight, .grid-3.tight in a form): no columns of equal width with random holes between the
   fields, but each field at its natural width and at the same distance from the next one, aligned on the left; what
   is left of the row stays empty on the right. One field per row on phones. */
:where(.form, form, .card) :is(.grid-2, .grid-3).tight { display: flex; flex-wrap: wrap; column-gap: var(--s3); row-gap: 0; align-items: flex-end; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > * { flex: 0 1 auto; min-width: 0; max-width: 100%; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > :is(input, .ac, .quick-add-row) { width: 20rem; max-width: 100%; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > select:not([multiple]) { width: fit-content; min-width: 12rem; max-width: 100%; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > input:is([type="number"]) { width: 9rem; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > input:is([type="time"]) { width: 8.5rem; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > input:is([type="date"]) { width: 11rem; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > input:is([type="color"]) { width: 7rem; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > input:is([maxlength="1"], [maxlength="2"], [maxlength="3"], [maxlength="4"], [maxlength="5"], [maxlength="6"]) { width: 8rem; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > input:is([maxlength="7"], [maxlength="8"], [maxlength="9"], [maxlength="10"], [maxlength="11"], [maxlength="12"]) { width: 12rem; }
:where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > input:is([maxlength="13"], [maxlength="14"], [maxlength="15"], [maxlength="16"], [maxlength="17"], [maxlength="18"], [maxlength="19"], [maxlength="20"], [maxlength="21"]) { width: 16rem; }
@media (max-width: 560px) {
  :where(.form, form, .card) :is(.grid-2, .grid-3).tight > * { flex: 1 1 100%; }
  :where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > :is(input, select, .ac, .quick-add-row) { width: 100%; }
}

/* edit boxes as wide as what they hold, a little more: w-xs numbers and ports, w-s codes, VAT and phone, w-m short
   names, users, hosts and passwords, w-l e-mail, names and identifiers, w-xl addresses, subjects and notes.
   Widths on the 8px scale too; after the rows of fields, so that they win there as well. */
:is(.form, form, .card, dialog, body) :is(label, div, td, p, span) > input.w-xs.w-xs { width: var(--w-xs); max-width: 100%; }
:is(.form, form, .card, dialog, body) :is(label, div, td, p, span) > input.w-s.w-s { width: var(--w-s); max-width: 100%; }
:is(.form, form, .card, dialog, body) :is(label, div, td, p, span) > input.w-m.w-m { width: var(--w-m); max-width: 100%; }
:is(.form, form, .card, dialog, body) :is(label, div, td, p, span) > input.w-l.w-l { width: var(--w-l); max-width: 100%; }
:is(.form, form, .card, dialog, body) :is(label, div, td, p, span) > input.w-xl.w-xl { width: var(--w-xl); max-width: 100%; }
@media (max-width: 560px) {
  :is(.form, form, .card, dialog, body) :is(label, div, td, p, span) > input:is(.w-l, .w-xl):is(.w-l, .w-xl) { width: 100%; }
}

/* in a card a drop-down or a field of the grid takes the whole width (e.g. the column fields of the Excel import) */
@media (max-width: 640px) {
  :is(.grid-cards, .table:not(.kv, .no-cards)) td :is(select, input:not([type="checkbox"]):not([type="radio"])) { width: 100%; max-width: none; margin-top: var(--s1); }

}
/* cards: every value on the left under its name, the name in the text font also before numbers in monospace */
@media (max-width: 640px) {
  :is(.grid-cards, .table:not(.kv, .no-cards)) td, :is(.grid-cards, .table:not(.kv, .no-cards)) td.num { text-align: left; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td[data-label]:not(:first-child)::before { font-family: var(--font); letter-spacing: 0; }
}

/* Rifiniture di maschere e griglie */
/* rows of fields: every field takes at least one column (20rem), so the second and third fields start at the same
   x in every row of the form; a wider field pushes only its own row. Phones keep one field per row. */
@media (min-width: 561px) {
  :where(.form, form, .card) :is(.grid-2, .grid-3).tight > :is(label, div):not(.check, .form-actions) { min-width: min(20rem, 100%); }
}
/* the end of a form: a thin line above the buttons, as at the end of a sheet */
:is(.card > form, form.card) > .form-actions:last-child { border-top: 1px solid var(--border); padding-top: var(--s2); margin-top: var(--s3); }
/* card titles in forms: a thin line under the title separates it from the fields */
:is(form.card, .card:has(> form)) > h2:first-child { padding-bottom: var(--s1); border-bottom: 1px solid var(--border); margin-bottom: var(--s2); }
/* grids: the column of the actions separated by a light line only, the heading row a touch more marked */
.row-actions, th.actions-col { border-left-color: color-mix(in srgb, var(--border) 60%, transparent); }
.table thead th { border-bottom-color: var(--border-strong); }
.table td { color: var(--text-2); }
.table td strong { color: var(--text); }
/* filter bars: the «Filtra» button in the dark colour of the brand, the brand colour stays for the actions of the page */
.filters .btn-primary { background: var(--text); border-color: var(--text); color: var(--surface); }
.filters .btn-primary:hover { background: color-mix(in srgb, var(--text) 85%, var(--surface)); }

/* Stato del server: the three gauges side by side */
.gauge-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); align-items: end; }
@media (max-width: 520px) { .gauge-row { grid-template-columns: minmax(0, 1fr); } }
.gauge-row .gauge-value { font-size: 24px; }
.gauge-row .gauge-caption { font-size: 12px; }

/* Console Super Admin (/admin): the tag above its menu */
.console-tag { display: flex; align-items: center; gap: var(--s1); margin: 0 var(--s2) var(--s1); padding: var(--s1) var(--s1); border: 1px solid var(--side-border); color: var(--side-text-strong); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.console-tag .ic { width: 16px; height: 16px; flex: none; }
html.sidebar-collapsed .console-tag span { display: none; }
html.sidebar-collapsed .console-tag { justify-content: center; margin: 0 var(--s1) var(--s1); }
/* a Super Admin working in an organisation entered from the console: the bar above the page */
.console-bar { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; margin: 0; }
.console-bar .ic { width: 16px; height: 16px; flex: none; }
.console-bar span { flex: 1 1 16rem; }

/* Super Admin dashboard (0.14.9): three charts per row */
.bi-grid.bi-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr)); }

/* a page that takes long (data-wait): a message in the middle until the next page arrives */
.wait-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity .2s; }
.wait-overlay.on { opacity: 1; }
.wait-box { display: flex; align-items: center; gap: var(--s2); max-width: min(28rem, calc(100vw - 2rem)); padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: .92rem; }
.wait-spin { flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border: 3px solid color-mix(in srgb, var(--brand) 20%, transparent); border-top-color: var(--brand); border-radius: 50%; animation: wait-spin .8s linear infinite; }
@keyframes wait-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wait-spin { animation-duration: 2.4s; } }

/* Configurazioni dei router: testo e differenze */
pre.config-text, pre.diff { max-height: 560px; overflow: auto; white-space: pre; }
pre.diff span { display: block; min-width: max-content; }
.diff-add { background: var(--ok-bg); color: var(--ok); }
.diff-del { background: var(--danger-bg); color: var(--danger); }
.diff-gap { color: var(--muted); }

/* Traffico di un'interfaccia in tempo reale */
.live-traffic-now { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-bottom: var(--s1); font-size: .9rem; }
.live-swatch { display: inline-block; width: 10px; height: 10px; background: var(--c); margin-right: var(--s1); }
.live-traffic-plot { position: relative; height: 240px; border: 1px solid var(--border); background: var(--surface-2, transparent); }
.live-traffic-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.live-traffic-top { position: absolute; top: .3rem; left: .5rem; font-size: .72rem; color: var(--muted); z-index: 1; }

/* Logo a sinistra nella barra, largo come quello di Risklens */
.brand .brand-full { width: 132px; max-width: 100%; }
.brand .brand-full.brand-text { width: auto; }

/* Asse dei grafici con unità: il valore resta su una riga */
.col-grid span { white-space: nowrap; left: auto; right: calc(100% + .4rem); width: auto; }

/* Configurazione del router: sezioni a sinistra, contenuto a destra */
/* the window as tall as the menu: the two cards end on the same line */
.config-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--s2); align-items: stretch; margin-bottom: var(--s2); }
.config-layout > .config-menu { margin-bottom: 0; }
.config-main { display: flex; flex-direction: column; min-width: 0; }
.config-main > .card { flex: 1 1 auto; margin-bottom: 0; }
/* the last changes under everything, closed until asked for */
.config-history > summary { list-style: none; cursor: pointer; }
.config-history > summary::-webkit-details-marker { display: none; }
.config-history > summary h2 { display: inline-flex; align-items: center; gap: var(--s1); margin: 0; }
.config-history > summary h2::before { content: "▸"; font-size: .8em; color: var(--muted); transition: transform .15s; }
.config-history[open] > summary h2::before { transform: rotate(90deg); }
.config-history[open] > summary { margin-bottom: var(--s2); }
.config-fields > .config-textarea { grid-column: 1 / -1; }
.config-textarea textarea { min-height: 8rem; font-size: .85rem; line-height: 1.5; white-space: pre; overflow-x: auto; tab-size: 4; }
@media (max-width: 860px) { .config-layout { grid-template-columns: minmax(0, 1fr); } }

/* Configurazione come le finestre di WinBox */
.config-toolbar { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; margin-bottom: var(--s1); }
.flag-col { width: 2.6rem; text-align: center; color: var(--muted); white-space: nowrap; }
.num-col { width: 2.2rem; color: var(--muted); }

tr.config-off td { color: var(--muted); }
tr.config-off td a { color: var(--muted); }
.config-fields { border: 1px solid var(--border); padding: var(--s2) var(--s2) var(--s1); margin: 0 0 var(--s2); min-width: 0; }
.config-fields:not(:has(legend)) { border: 0; padding: 0; }
.config-fields legend { padding: 0 var(--s1); font-weight: 600; font-size: .85rem; }
.config-settings { max-width: 620px; }

/* Configura: il menu ad albero come WinBox, la finestra con la sua barra */
.config-menu { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.config-device { display: flex; align-items: center; gap: var(--s1); padding: var(--s2) var(--s2); background: var(--side-bg); color: var(--side-text-strong); border-bottom: 2px solid var(--brand); }
.config-device-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; background: color-mix(in srgb, var(--brand) 22%, transparent); color: #fff; }
.config-device-icon .ic { width: 19px; height: 19px; }
.config-device-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.config-device-text strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.config-device-text small { color: var(--side-text); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.config-menu-filter { position: relative; margin: var(--s1) var(--s1) var(--s1); }
.config-menu-filter .ic { position: absolute; left: .55rem; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.config-menu-filter input { width: 100%; margin: 0; padding: var(--s1) var(--s1) var(--s1) var(--s4); font-size: .83rem; background: var(--surface-2); }
.config-tree, .config-tree ul { list-style: none; margin: 0; padding: 0; }
.config-tree { padding: 0 var(--s1) var(--s1); flex: 1 1 auto; }
.config-leaf { display: flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s1); color: var(--text-2); font-size: .875rem; font-weight: 500; cursor: pointer; border-left: 3px solid transparent; user-select: none; }
.config-leaf .ic { width: 17px; height: 17px; flex: none; color: var(--muted); }
.config-leaf > span:not(.config-chevron) { flex: 1 1 auto; min-width: 0; }
a.config-leaf:hover, summary.config-leaf:hover, .config-sub:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.config-leaf.active { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); border-left-color: var(--brand); color: var(--text); font-weight: 600; }
.config-leaf.active .ic, .config-leaf.inside .ic { color: var(--brand-ink); }
.config-leaf.inside { color: var(--text); font-weight: 600; }
.config-node > summary { list-style: none; }
.config-node > summary::-webkit-details-marker { display: none; }
.config-chevron { display: inline-flex; margin-left: auto; transition: transform .15s ease; }
.config-chevron .ic { width: 14px; height: 14px; }
.config-node[open] > summary .config-chevron { transform: rotate(90deg); }
.config-node ul { position: relative; margin: 0 0 var(--s1) var(--s2); padding-left: var(--s1); border-left: 1px solid var(--border); }
.config-sub { display: block; padding: var(--s1) var(--s1); color: var(--text-2); font-size: .84rem; border-left: 2px solid transparent; margin-left: calc(-1 * var(--s1)); }
.config-sub.active { color: var(--brand-ink); border-left-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); font-weight: 600; }
.config-menu-empty { margin: 0 var(--s2) var(--s2); font-size: .83rem; }
.config-menu-last { margin: auto var(--s1) var(--s1); padding-top: var(--s1); border-top: 1px solid var(--border); }
.config-menu [hidden] { display: none !important; }
.config-window { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.config-window > *:not(.config-titlebar):not(.table-wrap) { margin-left: var(--s2); margin-right: var(--s2); }
.config-window > .table-wrap { margin: 0; padding: 0; }
.config-window .table :is(th, td):first-child { padding-left: var(--s2); }
.config-window .table :is(th, td):last-child { padding-right: var(--s2); }
.config-titlebar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s1) var(--s2); margin-bottom: var(--s2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.config-crumb { display: inline-flex; align-items: center; gap: var(--s1); font-size: 1rem; min-width: 0; }
.config-crumb .ic { width: 18px; height: 18px; color: var(--brand-ink); }
.config-crumb strong { font-family: var(--font-display); font-size: 1.05rem; }
.config-sep { color: var(--border-strong); }
.config-path { font-family: var(--mono); font-size: .75rem; color: var(--muted); background: var(--surface-3); padding: 0 var(--s1); white-space: nowrap; }
.config-tabs { width: auto; background: none; padding: 0; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: var(--s2); overflow-y: hidden; scrollbar-width: none; }
.config-tabs a { padding: var(--s1) var(--s2); border-bottom: 2px solid transparent; }
.config-tabs a.active { background: none; color: var(--brand-ink); border-bottom-color: var(--brand); }
.config-toolbar { padding: var(--s1) var(--s1); background: var(--surface-2); border: 1px solid var(--border); }
/* inside the window the bar goes edge to edge, like the table under it */
.config-window > .config-toolbar.config-toolbar { margin: 0; padding: var(--s1) var(--s2); border-width: 1px 0 0; }
.config-search { position: relative; display: inline-flex; }
.config-search .ic { position: absolute; left: .6rem; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.config-search input { width: 15rem; min-width: 0; margin: 0; padding-left: var(--s4); }
.config-toolbar input, .config-toolbar .btn { height: 2.25rem; box-sizing: border-box; }
/* the dropdowns of a live grid: flat, the chevron of the product, the brand colour when they filter something */
.grid-select { -webkit-appearance: none; appearance: none; width: auto; min-width: 0; max-width: 100%; height: 2.25rem; margin: 0; box-sizing: border-box;
  padding: 0 var(--s4) 0 var(--s1); font-size: .83rem; font-weight: 500; color: var(--text-2); cursor: pointer; background: var(--surface) no-repeat right .6rem center / 12px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238a8f98' stroke-width='1.6'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E"); }
.grid-select:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border-strong)); color: var(--text); }
.grid-select.is-set { border-color: var(--brand); color: var(--brand-ink); background-color: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.grid-reset { display: inline-flex; align-items: center; gap: var(--s1); height: 2.25rem; padding: 0 var(--s1); border: 0; background: none; font: inherit; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.grid-reset .ic { width: 13px; height: 13px; }
.grid-reset:hover { color: var(--brand-ink); }
.grid-reset[hidden] { display: none; }
/* pages of a live grid, under the table */
.live-grid-foot { margin-top: 0; padding: var(--s1) 0; }
.config-window > .live-grid-foot.live-grid-foot { margin: 0; padding: var(--s1) var(--s2); border-top: 1px solid var(--border); }
.live-grid-foot .per-page label > select.grid-select { width: auto; height: 2rem; padding-top: 0; padding-bottom: 0; }
.live-grid-foot .pagination > * { height: 2rem; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
.pagination button { min-width: 2rem; padding: var(--s1) var(--s1); border: 1px solid var(--border); border-radius: 0; font: inherit; font-size: .83rem; color: var(--text-2); background: var(--surface); cursor: pointer; }
.pagination button:hover:not(:disabled) { border-color: var(--border-strong); }
.pagination button:disabled { cursor: default; }
/* compact rows: the actions sit in the middle of the row, not on the baseline of the text */
[data-grid] .row-actions { line-height: 0; }
[data-grid] .row-actions > *, [data-grid] .row-actions .inline-act { vertical-align: middle; }
[data-grid] .table td { vertical-align: middle; }
@media (pointer: fine) { [data-grid] .row-actions .act { width: 27px; height: 27px; } }
.live-titlebar-end { display: inline-flex; align-items: center; gap: var(--s1); }
.live-window > .config-titlebar { margin-bottom: 0; }
.live-window > .config-titlebar + .config-toolbar { border-top-width: 0; }
.live-window .config-crumb .muted { font-size: .8rem; font-weight: 400; }
.live-window > .alert { margin-top: var(--s2); }
.live-window > .hint { margin-top: var(--s1); margin-bottom: var(--s1); }
.live-window > .config-empty:not([data-grid-none]) { margin: 0; }
.config-count { margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface-3); padding: 0 var(--s1); }
.config-window .table-wrap { border-top: 1px solid var(--border); }
.config-window .table thead th { background: var(--surface-2); }
.config-empty { padding: var(--s3) 0; text-align: center; }
.cfg-flag { display: inline-grid; place-items: center; width: 17px; height: 17px; margin: 0 1px; font-size: .68rem; font-weight: 700; line-height: 1; }
.cfg-flag-x { background: var(--muted-bg); color: var(--muted); }
.cfg-flag-d { background: var(--info-bg); color: var(--info); }
.cfg-flag-r { background: var(--ok-bg); color: var(--ok); }
.config-window .alert, .config-window .hint { margin-bottom: var(--s2); }
.config-window > form, .config-window > .config-settings { padding-bottom: var(--s2); }
@media (max-width: 860px) { .config-tree { columns: 2; } .config-node { break-inside: avoid; } .config-path { display: none; } }

/* Moduli di configurazione su due colonne */
.config-form { max-width: 920px; }
.config-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s2); align-items: start; }
.config-fields > legend { grid-column: 1 / -1; }
.config-fields > .hint { grid-column: 1 / -1; margin-top: calc(-1 * var(--s1)); }
.config-fields > label.check { align-self: center; }
@media (max-width: 640px) { .config-fields { grid-template-columns: minmax(0, 1fr); } }

/* Statistiche (BI) */
.bi-section { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1); margin: var(--s3) 0 var(--s2); font-size: 1.05rem; }
.bi-section small { color: var(--muted); font-weight: 400; font-size: .82rem; }
.bi-filters { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; }
.bi-filters .btn.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* CVE: the mark next to a version, one of the badges of the application, with the shield in place of the dot. Exploited: a border */
.cve-flag, .cve-flag:hover { text-decoration: none; }
.cve-flag::before { content: none; }
.cve-flag .ic { width: 12px; height: 12px; }
.cve-flag:hover, .cve-flag:focus-visible { background: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger); }
.cve-table .cve-main { width: 100%; min-width: 15rem; }
.cve-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s1); }
.cve-head .muted { font-size: .78rem; font-weight: 400; }
.cve-desc { margin-top: 0; line-height: 1.4; }
.cve-table .cve-severity .badge { display: flex; width: max-content; }
.cve-table .cve-severity .badge + .badge { margin-top: var(--s1); }
.cve-table .cve-versions { font-size: .78rem; min-width: 8.5rem; white-space: pre-line; }
@media (min-width: 1200px) { .cve-table .cve-versions { min-width: 13rem; } }
@media (max-width: 900px) { .cve-table .cve-versions { min-width: 7rem; } }
.cve-stat-date { font-size: 1.15rem; }
.cve-text { line-height: 1.55; overflow-wrap: anywhere; }
.cve-refs { margin: 0; padding-left: var(--s2); overflow-wrap: anywhere; font-size: .86rem; }
.cve-refs li { margin: var(--s1) 0; }

/* Suggerimenti per i comandi RouterOS */
.ros-complete { display: block; position: relative; margin-top: var(--s1); }
.ros-complete > input, .ros-complete > textarea { margin: 0; display: block; width: 100%; }
.ros-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ac-list.ros-list { top: 0; right: auto; width: min(560px, 100%); max-height: 320px; }
.ac-list.ros-list li[role="option"] { display: flex; align-items: baseline; gap: var(--s1); padding: var(--s1) var(--s1); }
.ros-name { font: 12.5px/1.5 var(--mono); flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.ros-tag { flex: none; color: var(--muted); font-size: .72rem; }
.ros-text { flex: 1 1 0; min-width: 0; color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.ac-list.ros-list li.ac-note.ros-foot { position: sticky; bottom: -.25rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--s2); padding: var(--s1) var(--s1); font-size: .74rem; background: var(--surface); border-top: 1px solid var(--border); }

/* The cards of a phone turn the first cell bold and every line back to normal: here the text stays plain, a range per line */
.cve-table td.cve-versions { white-space: pre-line; }
.cve-table td.cve-main { font-weight: 400; }
.cve-table .cve-desc { font-size: .85rem; font-weight: 400; }
/* Two lines of label exactly as the space kept for them, so that the numbers stay on one line */
.bi-kpi .stat-label { line-height: 1.35; }

/* Terminal in a window over the inventory: the suggestions may come out of the window, the answers scroll inside */
.terminal-dialog { width: min(820px, calc(100vw - 32px)); overflow: visible; }
.terminal-dialog h2 { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.terminal-dialog .hint { margin-top: calc(-1 * var(--s1)); }
pre.terminal-log { max-height: 45vh; margin: 0 0 var(--s2); white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-log span { display: block; }
.terminal-log .term-cmd { font-weight: 700; }
.terminal-log .term-cmd:not(:first-child) { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--border); }
.terminal-tools { display: flex; justify-content: flex-end; gap: var(--s1); margin-bottom: var(--s1); }
.terminal-log .term-err { color: var(--danger); }

/* ACL as a grid: the fields fill their cells, the rows of the server are fixed and stand apart */
.acl-grid .table td { vertical-align: middle; }
.acl-grid .table td > input { width: 100%; margin: 0; }
.acl-grid .table th:first-child { width: 34%; }
.acl-grid .acl-server td { background: var(--surface-2); }
.acl-grid .acl-server .badge { margin-left: var(--s1); }
.acl-tools { margin: var(--s1) 0; }
.acl-title { margin: var(--s2) 0 var(--s1); font-size: .95rem; }
html:not(.js) .acl-grid [data-acl-remove] { display: none; }
.acl-grid .field-error { margin: var(--s1) 0 0; }

/* Removal of the ACL: the routers involved */
.acl-remove-list { margin: 0 0 var(--s2); padding-left: var(--s2); max-height: 9rem; overflow-y: auto; }

/* Device type: under the group in the grid, as wide as the other fields in the form */
.router-type { display: block; color: var(--muted); font-size: .78rem; }
/* inventory: a long identity without spaces goes to a new line instead of widening the column; badges under the value */
.router-id { min-width: 11rem; max-width: 15rem; overflow-wrap: anywhere; }
.cell-badge { display: block; margin-top: 0; font-family: var(--font, inherit); }
.form select.device-type-select { width: 100% !important; max-width: 320px; }

/* Scoperta Risklens: credentials of a row under its choice */
.discovery-table .discovery-cred { min-width: 13rem; }
.discovery-cred select { width: 100% !important; margin: 0; }
.discovery-own { display: grid; gap: var(--s1); margin-top: var(--s1); }
.discovery-own[hidden] { display: none; }
.discovery-own input { margin: 0; }

/* Integrations: one card per connection, as in the other applications */
.int-title { display: flex; align-items: center; gap: var(--s1); }
.int-logo-sm { width: 16px; height: 16px; border-radius: 0; }
.integration-card .btn-row { margin-top: var(--s2); }

/* Default credentials of the onboarding: three fields of the same width */
.credentials-grid .table th:first-child { width: 30%; }
.credentials-grid .table th:nth-child(2) { width: 30%; }

/* Dashboard: ten tiles, five per row or two per row, never a hole in the last one */
.dash-kpi { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dash-kpi .stat small { line-height: 1.35; }
@media (max-width: 1180px) { .dash-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash-row { margin-bottom: var(--s2); }
.dash-detail { display: block; color: var(--muted); overflow-wrap: anywhere; }
.dash-sub { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--border); }

/* Sections of the menu that open and close */
.nav-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; border-radius: 0; font-family: inherit; text-align: left; cursor: pointer; }
.nav-toggle:hover { color: var(--side-text-strong); }
.nav-toggle:focus-visible { outline: 2px solid var(--side-text-strong); outline-offset: -2px; }
.nav-toggle::after { content: ""; flex: none; width: .4rem; height: .4rem; margin-right: 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .12s; }
.nav-toggle[aria-expanded="true"]::after { transform: translateY(-.1rem) rotate(45deg); }
/* icons only: every entry stays reachable, the sections are just lines between them */
@media (min-width: 861px) {
  html.sidebar-collapsed .nav-items[hidden] { display: block !important; }
  html.sidebar-collapsed .nav-toggle { pointer-events: none; }
  html.sidebar-collapsed .nav-toggle::after { display: none; }
  html.sidebar-collapsed .nav-group + .nav-group .nav-section { border-top: 1px solid var(--side-border); width: auto; }
  html.sidebar-collapsed .nav-group .nav-section { display: block; width: calc(100% - 1rem); }
}

/* Why a CVE is to be judged on this version */
.cve-why { display: block; margin-top: var(--s1); font-family: var(--font); white-space: normal; }

/* The window Firewall on the card of a router */
.fw-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); margin-bottom: var(--s2); }
.fw-nav .fw-edit { margin-left: auto; }
.fw-cond { font-family: var(--mono, monospace); font-size: .78rem; }
.fw-cond span { display: inline-block; margin: 0 var(--s1) 0 0; color: var(--muted); }
.fw-cond strong { color: var(--text); font-weight: 500; }

/* The queues of the jobs */
.queue-tile .stat-label { color: var(--muted); text-decoration: none; min-height: 0; }
.queue-tile .stat-label:hover { color: var(--text); text-decoration: underline; }
.queue-tile .stat-value { font-size: 1.2rem; }
.queue-tile small { overflow-wrap: anywhere; }
.queue-chosen { border-color: var(--brand); }
.queue-chosen .stat-label { color: var(--text); font-weight: 600; }
.queue-waiting { display: block; }

/* The upgrade of one router from the inventory */
.firmware-dialog, .activate-dialog { width: min(680px, calc(100vw - 2rem)); }
.activate-dialog h2 .ic { vertical-align: -3px; }
.activate-dialog .acl-title { margin-top: var(--s2); }
.activate-dialog { overflow-x: hidden; }
.activate-dialog .table-wrap { margin-left: 0; margin-right: 0; padding: 0; }
.firmware-dialog h2 .ic { vertical-align: -3px; }

/* The choice of an upgrade: sources on one line, channel and version on one line */
.fw-sources { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin: 0 0 var(--s2); }
.fw-sources .check { margin: 0; }
.fw-versions { display: flex; gap: var(--s2); align-items: flex-start; max-width: 40rem; margin-bottom: var(--s1); }
.fw-versions > label { flex: 1 1 0; min-width: 0; margin: 0; }
.fw-versions > label > select:not([multiple]) { width: 100%; min-width: 0; max-width: none; }
@media (max-width: 480px) { .fw-versions { flex-direction: column; gap: var(--s1); } .fw-versions > label { width: 100%; flex: none; } }
.fw-source-hint { margin: 0 0 var(--s2); }
.fw-count { margin-left: auto; white-space: nowrap; }

/* ---------- a user blocked by failed sign-in attempts: badge and «Sblocca» side by side ---------- */
.user-lock { display: inline-flex; align-items: center; gap: var(--s1); flex-wrap: wrap; margin-left: var(--s1); }
.user-lock .badge { display: inline-flex; align-items: center; gap: var(--s1); }
.user-lock .badge .ic { width: 12px; height: 12px; }
.user-lock .inline-act { display: inline; margin: 0; }
.user-lock .btn-sm .ic { width: 13px; height: 13px; }
dd > .user-lock { margin-left: 0; }

/* ---------- Confguard: the box of the router card and the help of the page ---------- */
.guard-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s1) var(--s2); flex-wrap: wrap; margin-bottom: var(--s1); }
.guard-head h2 { display: flex; align-items: center; gap: var(--s1); margin: 0; }
.guard-head .btn-row { margin: 0; }
.guard-head form { margin: 0; }
.guard-card-drift { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); box-shadow: inset 3px 0 0 var(--danger); }
.badge .ic { width: 12px; height: 12px; vertical-align: -1px; }
.guard-dl { margin-bottom: var(--s1); }
.guard-events-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: var(--s2) 0 var(--s1); }
.guard-events { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.guard-ev { padding: var(--s1) 0 var(--s1) var(--s1); border-left: 2px solid var(--border); }
.guard-ev-drift { border-left-color: var(--danger); }
.guard-ev-resolved, .guard-ev-locked, .guard-ev-relocked, .guard-ev-own_change { border-left-color: var(--ok); }
.guard-ev-own_in_drift { border-left-color: var(--warn); }
.guard-help summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: var(--s1); }
.guard-help ul { margin: var(--s1) 0 0; padding-left: var(--s2); font-size: .88rem; line-height: 1.55; }
.guard-drift-row td { background: color-mix(in srgb, var(--danger) 5%, transparent); }

/* ---------- cells of the tables read from a router ---------- */
.cell-none { color: var(--muted); opacity: .6; }
.cell-chip { display: inline-block; padding: 0 var(--s1); font-size: .76rem; font-family: var(--mono); background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
[data-grid] .table tbody tr:hover td { background: var(--surface-2); }
[data-grid] .table tbody tr:hover td.row-actions { background: var(--surface-2); }
.live-window .table td .badge { font-size: .72rem; }

/* ---------- LIVE bar of the panels that reload by themselves ---------- */
.live-bar { display: flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s1) var(--s1) var(--s2); margin-bottom: var(--s2); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); font-size: .78rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: live-pulse 2s infinite; flex: none; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.live-word { color: var(--ok); letter-spacing: .08em; font-size: .72rem; }
.live-sep { width: 1px; height: 14px; background: var(--border); flex: none; }
.live-label { color: var(--muted); white-space: nowrap; }
.live-track { flex: 1; min-width: 60px; height: 3px; background: var(--surface-3); overflow: hidden; }
.live-fill { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s linear; }
.live-secs { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); min-width: 4.5rem; text-align: right; }
.live-bar .act { margin: 0; }
.live-bar .act.is-on { color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.live-ic-play { display: none; }
.live-bar.is-paused .live-ic-play { display: inline; }
.live-bar.is-paused .live-ic-pause { display: none; }
.live-bar.is-paused .live-dot { background: var(--muted); animation: none; }
.live-bar.is-paused .live-word { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } .live-fill { transition: none; } }
@media (max-width: 640px) { .live-label { display: none; } }
/* compact view: denser tables and no hints, also after the reload of the panel */
body.live-compact .table.compact td, body.live-compact .table.compact th { padding-top: var(--s1); padding-bottom: var(--s1); }
body.live-compact .live-window > .hint, body.live-compact .card > .hint { display: none; }
body.live-compact .config-titlebar { padding-top: var(--s1); padding-bottom: var(--s1); }

/* Console of a router: xterm.js in a window of its own */
.console-window { padding-bottom: 0; }
.console-window > .config-titlebar { margin-bottom: 0; }
.console-state { font-size: .78rem; padding: 0 var(--s1); margin-left: var(--s1); border: 1px solid var(--border); color: var(--muted); }
.console-state::before { content: ""; display: inline-block; width: .5rem; height: .5rem; margin-right: var(--s1); background: currentColor; vertical-align: .05rem; }
.console-state.is-ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.console-state.is-wait { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.console-state.is-off { color: var(--muted); }
.console-msg { margin: var(--s2) var(--s2) 0; }
.console-screen { height: calc(100vh - 360px); min-height: 280px; background: #0c1117; padding: var(--s1) var(--s1); margin-top: var(--s2); box-sizing: border-box; }
.console-term { height: 100%; overflow: hidden; }
.console-term .xterm { height: 100%; }
.console-screen .xterm-viewport { background: #0c1117 !important; }
.console-hint { margin: var(--s1) var(--s2) var(--s2); }
.console-hint kbd { font-family: var(--mono); font-size: .75rem; padding: 0 var(--s1); border: 1px solid var(--border-strong); background: var(--surface-2); }
.console-window:fullscreen { background: var(--surface); display: flex; flex-direction: column; }
.console-window:fullscreen .console-screen { flex: 1; height: auto !important; }
.console-commands { max-height: 16rem; overflow: auto; margin: var(--s1) 0 0; font-size: .78rem; }

/* compact view: everything but the charts folds to a bar like the title bar of the windows, full width; a click opens it */
body.live-compact .ov-fold:not(.is-open) > :not(h2):not(.config-titlebar):not(.guard-head) { display: none !important; }
body.live-compact .grid-2:has(> .ov-fold) { display: block; }
body.live-compact .ov-fold { margin-bottom: var(--s1); }
body.live-compact .ov-fold > h2, body.live-compact .ov-fold > .config-titlebar, body.live-compact .ov-fold > .guard-head { cursor: pointer; user-select: none; }
body.live-compact .ov-fold:not(.is-open) { padding: 0; }
body.live-compact .ov-fold:not(.is-open) > h2, body.live-compact .ov-fold:not(.is-open) > .guard-head, body.live-compact .ov-fold:not(.is-open) > .config-titlebar { margin: 0; height: 40px; padding: 0 var(--s2); background: var(--surface-2); box-sizing: border-box; flex-wrap: nowrap; overflow: hidden; }
body.live-compact .ov-fold:not(.is-open) .btn { padding: 0 var(--s1); height: 28px; font-size: .78rem; }
body.live-compact .ov-fold:not(.is-open) > .guard-head .btn-row { flex-wrap: nowrap; }
body.live-compact .ov-fold:not(.is-open) > h2 { display: flex; align-items: center; font-family: var(--font-display); font-size: 1.05rem; }
body.live-compact .ov-fold:not(.is-open) > .guard-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.05rem; }
body.live-compact .ov-fold:not(.is-open) > .config-titlebar { margin-bottom: 0; border-bottom: 0; }
/* the chevron: right of the title, turned down when open */
body.live-compact .ov-fold > h2::after, body.live-compact .ov-fold > .guard-head h2::after, body.live-compact .ov-fold > .config-titlebar .config-crumb::after { content: ""; width: .45rem; height: .45rem; margin-left: var(--s1); border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); display: inline-block; flex: none; }
body.live-compact .ov-fold.is-open > h2::after, body.live-compact .ov-fold.is-open > .guard-head h2::after, body.live-compact .ov-fold.is-open > .config-titlebar .config-crumb::after { transform: rotate(45deg); margin-bottom: 0; }

/* the upgrade page: quick picks over the table */
.fw-picks { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin: 0 0 var(--s2); }
.fw-picks .btn .badge { margin-left: 0; }
.fw-picks .grid-select { max-width: 13rem; }
.fw-picks-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 0; }
.fw-picked { margin-left: auto; color: var(--brand-ink); font-size: .88rem; }
/* the bar of the Inventory: actions in groups, the ACL ones in a menu */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-bottom: var(--s2); }
.bulk-bar .bulk-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 var(--s1); }
.bulk-bar .add-menu > summary { list-style: none; color: var(--text-2); }
.bulk-bar .add-menu > summary::after { content: none; }
.bulk-bar .add-menu[open] > summary { background: var(--surface-3); color: var(--text); }
.bulk-bar .add-menu > summary::-webkit-details-marker { display: none; }
.bulk-bar .add-menu .menu, .btn-row .add-menu .menu { left: 0; right: auto; }
.bulk-bar .add-menu .menu button { white-space: nowrap; font-size: .84rem; }
.bulk-bar .add-menu .menu .menu-danger { color: var(--danger); }

/* guided upgrade: the steps and the rule */
.wizard-steps { display: flex; gap: 0; list-style: none; padding: 0; margin: 0 0 var(--s2); border: 1px solid var(--border); background: var(--surface); }
.wizard-steps li { flex: 1; padding: var(--s1) var(--s2); color: var(--muted); font-size: .88rem; border-right: 1px solid var(--border); }
.wizard-steps li:last-child { border-right: 0; }
.wizard-steps li.is-done { color: var(--text-2); }
.wizard-steps li.is-current { color: var(--text); font-weight: 650; box-shadow: inset 0 -3px 0 var(--brand); }
.wizard-rule { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--s2) var(--s3); align-items: start; }
.wizard-rule fieldset { border: 1px solid var(--border); padding: var(--s1) var(--s2) var(--s2); margin: 0; }
.wizard-rule legend { font-size: .8rem; color: var(--muted); padding: 0 var(--s1); }
.wizard-rule select[multiple] { width: 100%; }

/* when an upgrade runs: the choice and the date on the left, how on the right */
.fw-when { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--s1) var(--s3); margin: var(--s1) 0 0; }
.fw-when-pick, .fw-when-how { display: flex; flex-direction: column; gap: var(--s1); }
.fw-when-at input { max-width: 15rem; }
.fw-when-stop input { max-width: 6rem; }

/* the card of a router: the tabs on the left, Apri Winbox and Configura on the right of the same row */
.tabs-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s1) var(--s2); flex-wrap: wrap; margin-bottom: var(--s2); }
.tabs-row > .tabs { margin-bottom: 0; }
.tabs-row-end { display: flex; gap: var(--s1); align-items: center; margin-left: auto; }
.page-head .actions { gap: var(--s1); }
.page-head .actions form { display: inline-flex; margin: 0; }

/* ---------- smartphone (0.9.76): a layout of its own, not the desktop squeezed ----------
   Top bar with the mark and the name; the buttons of a page on one row that slides sideways; the tabs on one row too;
   the filters behind a «Filtri» button; the commands on the selected rows in a bar at the bottom, only when something
   is selected; compact cards on two columns; the drop-down menus and the dialogs as sheets from the bottom. */
.top-brand { display: none; }
.filters-toggle, .bulk-count, .bulk-all { display: none; }
@media (max-width: 860px) {
  .top-brand { display: inline-flex; align-items: center; gap: var(--s1); min-width: 0; color: var(--text); font: 650 1.02rem/1 var(--font-display); letter-spacing: -.01em; text-decoration: none; }
  .top-brand:hover { text-decoration: none; }
  .top-brand img { width: 26px; height: 26px; flex: 0 0 auto; }
  .top-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar { gap: var(--s1); padding: 0 var(--s1); }
  .topbar .top-actions { gap: 0; }
  .topbar .icon-btn { width: 42px; height: 42px; justify-content: center; padding: 0; }
  .org-logo { display: none; }
}
@media (max-width: 640px) {
  .content { padding: var(--s2) var(--s2) var(--s3); }
  .card { padding: var(--s2) var(--s2); margin-bottom: var(--s2); }
  h1 { font-size: 1.3rem; }
  h1 .ic { width: 20px; height: 20px; vertical-align: -3px; }
  h2 { font-size: 1.05rem; }
  .page-head { gap: var(--s1); margin-bottom: var(--s2); align-items: stretch; flex-direction: column; flex-wrap: nowrap; }
  .page-head > div:first-child { min-width: 0; }
  .page-head p { font-size: .82rem; line-height: 1.45; }

  /* the buttons of a page: one row from edge to edge that slides sideways */
  .page-head > .actions { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--s2)); padding: 0 var(--s2) 2px; gap: var(--s1); scrollbar-width: none; -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .page-head > .actions::-webkit-scrollbar { display: none; }
  .page-head > .actions > * { flex: 0 0 auto; }
  .page-head > .actions .btn { height: 38px; padding: 0 var(--s2); font-size: .82rem; }

  /* tabs: one row that slides, the active one brought into view (app.js) */
  .tabs { flex-wrap: nowrap; width: auto; max-width: none; margin-left: calc(-1 * var(--s2)); margin-right: calc(-1 * var(--s2)); padding: var(--s1) var(--s2); scrollbar-width: none; scroll-snap-type: x proximity; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { scroll-snap-align: start; padding: var(--s1) var(--s2); }
  .tabs-row { gap: var(--s1); }
  .tabs-row > .tabs { flex: 1 1 100%; }
  .tabs-row-end { margin-left: 0; width: 100%; }
  .tabs-row-end > .btn { flex: 1 1 0; }

  /* filters: the search, then «Filtri» opens the others (app.js adds the button where there are at least two) */
  .filters { gap: var(--s1); }
  .filters input[type="search"] { flex: 1 1 0; min-width: 0; }
  .filters select, .filters input:not([type="search"]), .filters .ac, .filters label { flex: 1 1 calc(50% - .25rem); min-width: 0; }
  .filters .btn { padding: 0 var(--s2); }
  .filters.is-folded > :not(input[type="search"], .filters-toggle, button.btn:not([type="button"]), input[type="hidden"], [data-filter-count]) { display: none; }
  .filters.has-toggle > [data-filter-count] { order: 5; flex: 1 1 100%; font-size: .8rem; }
  .filters.has-toggle > button.btn:not([type="button"]) { order: 3; }
  .filters.has-toggle > .filters-toggle { display: inline-flex; order: 2; }
  .filters.has-toggle > input[type="search"] { order: 1; }
  .filters.has-toggle > :not(input[type="search"], .filters-toggle, button.btn) { order: 4; }
  .filters-toggle .filters-n { min-width: 1.15rem; padding: 0 var(--s1); background: var(--brand); color: var(--on-brand); font-size: .7rem; line-height: 1.15rem; text-align: center; }
  .filters-toggle .filters-n:empty { display: none; }
  .filters:not(.is-folded) > .filters-toggle { background: var(--surface-3); }

  /* commands on the selected rows: hidden until a row is chosen, then a bar at the bottom of the screen */
  .bulk-bar.is-js { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; padding: var(--s1) var(--s2) calc(var(--s1) + env(safe-area-inset-bottom));
    flex-wrap: nowrap; overflow-x: auto; background: var(--surface); border-top: 1px solid var(--border-strong); box-shadow: 0 -8px 24px rgba(20, 20, 24, .12);
    transform: translateY(110%); visibility: hidden; transition: transform .18s ease, visibility .18s; scrollbar-width: none; }
  .bulk-bar.is-js::-webkit-scrollbar { display: none; }
  .bulk-bar.is-js.has-selection { transform: none; visibility: visible; }
  .bulk-bar.is-js > * { flex: 0 0 auto; }
  .bulk-bar.is-js > .muted { display: none; }
  .bulk-bar.is-js .bulk-count { display: inline-flex; align-items: center; height: 38px; padding: 0 var(--s1); background: var(--text); color: var(--surface); font-weight: 700; font-size: .82rem; }
  .bulk-bar.is-js .bulk-sep { display: none; }
  .bulk-bar.is-js .bulk-all { display: inline-flex; }
  .bulk-bar.is-js .btn { height: 38px; padding: 0 var(--s2); font-size: .82rem; }
  body:has(.bulk-bar.is-js.has-selection) .content { padding-bottom: var(--s10); }

  /* cards: a title row, then the fields two by two, the name small above the value; the box of the row in the corner */
  .table-wrap { margin: 0; padding: 0; overflow: visible; }
  /* the box around a list of cards goes away: the cards are the boxes */
  .card:has(> .table-wrap > :is(.grid-cards, .table:not(.kv, .no-cards))) { background: none; border: 0; box-shadow: none; padding: 0; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s1) var(--s2); padding: var(--s2) var(--s2); margin-bottom: var(--s1); }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td { padding: 0; font-size: .86rem; line-height: 1.35; overflow-wrap: anywhere; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 0; font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td:first-child, :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-wide, :is(.grid-cards, .table:not(.kv, .no-cards)) td[colspan] { grid-column: 1 / -1; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-check { position: absolute; top: .6rem; right: .6rem; z-index: 1; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-check input { width: 22px; height: 22px; margin: 0; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-check + td + td { padding-right: var(--s4); }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-flag { position: absolute; top: .7rem; right: .75rem; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-flag:empty { display: none; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-flag + td + td { padding-right: var(--s3); }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.card-flag + td::before { content: attr(data-label); display: block; margin-bottom: 0; font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

  /* the gauges of a router two by two, the figures under them */
  .grid-3.tight:has(> .chart-gauge) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s1) var(--s1); }
  .grid-3.tight:has(> .chart-gauge) > .dl { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--s2); }
  .grid-3.tight:has(> .chart-gauge) > .dl dt { border-bottom: 1px solid var(--border); padding-bottom: var(--s1); }
  .chart-gauge .gauge { max-width: 170px; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) tr:has(> td.card-check input:checked) { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td .cell-badge { display: inline-block; margin: 0 var(--s1) 0 0; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: 0; padding-top: var(--s1); }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions > * { flex: 1 1 0; min-width: 0; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .act { flex-direction: row; gap: var(--s1); height: 38px; padding: 0 var(--s1); }
  /* four or more commands: the name under the icon, small */
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions:has(> :nth-child(4)) .act { flex-direction: column; gap: 0; height: 46px; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions:has(> :nth-child(4)) .act-label { font-size: .68rem; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) td.nowrap { white-space: normal; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .row-actions .act .ic { width: 16px; height: 16px; flex: 0 0 auto; }
  :is(.grid-cards, .table:not(.kv, .no-cards)) .act-label { font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-foot { justify-content: center; }
  .grid-foot .per-page { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--s1); }
  .pagination a, .pagination span { min-width: 2.4rem; padding: var(--s1) var(--s1); }

  /* drop-down menus: a sheet from the bottom of the screen, big entries, the page dimmed behind */
  :is(details.add-menu, details.row-menu, details.user-menu)[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 59; background: rgba(11, 13, 28, .45); cursor: default; }
  :is(.add-menu, .row-menu, .user-menu) .menu { position: fixed !important; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0; z-index: 60; width: auto; min-width: 0; max-height: 75vh; overflow-y: auto;
    padding: var(--s1) var(--s1) calc(var(--s2) + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--border-strong); white-space: normal; }
  :is(.add-menu, .row-menu, .user-menu) .menu :is(a, button) { display: flex; align-items: center; gap: var(--s1); width: 100%; min-height: 48px; padding: var(--s1) var(--s2); font-size: .95rem; text-align: left; white-space: normal; }
  :is(.add-menu, .row-menu, .user-menu) .menu .ic { width: 18px !important; height: 18px !important; }
  :is(.add-menu, .row-menu, .user-menu) .menu form { display: block; margin: 0; }

  /* dialogs: from the bottom, the whole width */
  dialog[open]:is(.quick-dialog, .terminal-dialog, .firmware-dialog, .activate-dialog) { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom)); overflow-y: auto; border-width: 1px 0 0; }
  dialog .form-actions { display: flex; flex-wrap: wrap; gap: var(--s1); }
  dialog .form-actions > .btn { flex: 1 1 auto; }

  /* forms: the buttons at the end share the width */
  .form-actions { display: flex; flex-wrap: wrap; gap: var(--s1); }
  .form-actions > .btn { flex: 1 1 calc(50% - .25rem); height: 44px; }
  .dl dd { margin-bottom: var(--s1); }
}

/* smartphone: Configura with its menu closed behind a button */
.config-menu-toggle { display: none; }
@media (max-width: 640px) {
  .config-layout { gap: var(--s2); }
  .config-menu.card { padding: 0; }
  .config-menu-toggle { display: flex; width: calc(100% - 1rem); height: auto; min-height: 52px; margin: var(--s1); padding: var(--s1) var(--s2); justify-content: flex-start; gap: var(--s1); text-align: left; }
  .config-menu-toggle .config-menu-toggle-text { display: flex; flex-direction: column; gap: 0; flex: 1 1 auto; min-width: 0; }
  .config-menu-toggle small { font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .config-menu-toggle strong { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .config-menu-toggle[aria-expanded="true"] > .ic:last-child { transform: rotate(180deg); }
  .config-menu.is-folded > :not(.config-device, .config-menu-toggle) { display: none !important; }
  .config-menu .config-tree { columns: 1; }
  .config-menu .config-leaf, .config-menu .config-sub { min-height: 44px; display: flex; align-items: center; }
  .config-device { padding: var(--s1) var(--s2); }
}
/* smartphone: the quick choices of the firmware page two by two, every drop-down of a form the whole width */
@media (max-width: 640px) {
  .fw-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s1); }
  .fw-picks > :is(.muted, span:first-child, .fw-picked) { grid-column: 1 / -1; margin: 0; }
  .fw-picks-sep, .fw-picked:empty { display: none; }
  .fw-picks > :is(.btn, select, .grid-select, button) { width: 100%; max-width: none; min-width: 0; justify-content: space-between; }
  :where(.form, form, .card) label > select:not([multiple]) { width: 100%; min-width: 0; }
  :where(.form, form, .card) :is(.grid-2, .grid-3).tight > label > select:not([multiple]) { width: 100%; }
}

/* smartphone: the title bar of a window (Configura, live panels, console) on two rows, its buttons sharing the width */
@media (max-width: 640px) {
  .config-window > *:not(.config-titlebar):not(.table-wrap) { margin-left: var(--s2); margin-right: var(--s2); }
  .config-titlebar { flex-wrap: wrap; gap: var(--s1); padding: var(--s1) var(--s2); }
  .config-titlebar > .config-crumb { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; }
  .config-titlebar > .live-titlebar-end { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: var(--s1); }
  .config-titlebar > .live-titlebar-end > .btn { flex: 1 1 0; }
  .console-window { margin-left: calc(-1 * var(--s2)); margin-right: calc(-1 * var(--s2)); border-left: 0; border-right: 0; }
  .console-screen { margin-top: var(--s1); padding: var(--s1) var(--s1); }
  .console-msg { margin: var(--s1) var(--s2) 0; }
}
/* ---------- tablet (0.9.77): 641-1199 px, upright and on its side ----------
   The menu a rail of icons (side.js), the filters behind «Filtri» and laid out in columns when opened, the commands on
   the selected rows in a bar at the bottom only when something is chosen, the grids tighter so that they fit, the
   action column always at the right edge. */
@media (min-width: 641px) and (max-width: 1199px) {
  .content { padding-left: var(--s3); padding-right: var(--s3); }

  /* filters: one row (search, Filtri, Cerca); opened, the others in three or four columns */
  .filters { gap: var(--s1); }
  .filters input[type="search"] { flex: 1 1 60%; min-width: 0; }
  .filters.has-toggle > :not(input[type="search"], .filters-toggle, button.btn, input[type="hidden"], [data-filter-count]) { flex: 1 1 calc(33.333% - .34rem); min-width: 0; }
  .filters.is-folded > :not(input[type="search"], .filters-toggle, button.btn:not([type="button"]), input[type="hidden"], [data-filter-count]) { display: none; }
  .filters.has-toggle > [data-filter-count] { order: 5; flex: 1 1 100%; font-size: .8rem; }
  .filters.has-toggle > button.btn:not([type="button"]) { order: 3; }
  .filters.has-toggle > .filters-toggle { display: inline-flex; order: 2; }
  .filters.has-toggle > input[type="search"] { order: 1; }
  .filters.has-toggle > :not(input[type="search"], .filters-toggle, button.btn) { order: 4; }
  .filters-toggle .filters-n { min-width: 1.15rem; padding: 0 var(--s1); background: var(--brand); color: var(--on-brand); font-size: .7rem; line-height: 1.15rem; text-align: center; }
  .filters-toggle .filters-n:empty { display: none; }
  .filters:not(.is-folded) > .filters-toggle { background: var(--surface-3); }

  /* commands on the selected rows: a bar at the bottom of the page, beside the menu, only with something chosen */
  .bulk-bar.is-js { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; padding: var(--s1) var(--s3) calc(var(--s1) + env(safe-area-inset-bottom));
    flex-wrap: wrap; gap: var(--s1); background: var(--surface); border-top: 1px solid var(--border-strong); box-shadow: 0 -8px 24px rgba(20, 20, 24, .12);
    transform: translateY(110%); visibility: hidden; transition: transform .18s ease, visibility .18s; }
  .bulk-bar.is-js.has-selection { transform: none; visibility: visible; }
  .bulk-bar.is-js > .muted, .bulk-bar.is-js .bulk-sep { display: none; }
  .bulk-bar.is-js .bulk-count { display: inline-flex; align-items: center; height: 40px; padding: 0 var(--s2); background: var(--text); color: var(--surface); font-weight: 700; font-size: .84rem; border: 0; cursor: pointer; }
  .bulk-bar.is-js .bulk-all { display: inline-flex; }
  .bulk-bar.is-js .btn { height: 40px; }
  body:has(.bulk-bar.is-js.has-selection) .content { padding-bottom: var(--s14); }

  /* grids: tighter cells, the text that is long goes on two lines instead of pushing the table out */
  .table td, .table th { padding: var(--s1) var(--s1); }
  .table.compact td, .table.compact th { padding: var(--s1) var(--s1); }
  .table th { letter-spacing: .04em; white-space: normal; line-height: 1.25; vertical-align: bottom; }
  .table td { overflow-wrap: break-word; }
  .table td.nowrap:not(.row-actions) { white-space: normal; }
  .table-wrap { scrollbar-width: thin; }

  /* a menu that opens from a button stays inside the screen */
  :is(.add-menu, .row-menu) .menu { max-width: calc(100vw - 2rem); }

  /* quick dialogs and the firmware window: wide, never wider than the screen */
  :is(.quick-dialog, .firmware-dialog) { width: min(92vw, 720px); max-width: 92vw; }
  .terminal-dialog { width: 94vw; max-width: 94vw; }
}
/* with the rail of icons the bar of the commands starts after it */
@media (min-width: 861px) and (max-width: 1199px) {
  html.sidebar-collapsed .bulk-bar.is-js { left: var(--sidebar-mini); }
  html:not(.sidebar-collapsed) .bulk-bar.is-js { left: var(--sidebar); }
  .filters.has-toggle > :not(input[type="search"], .filters-toggle, button.btn, input[type="hidden"], [data-filter-count]) { flex-basis: calc(25% - .38rem); }
}
.bulk-bar.is-js:not(.is-ready) { transition: none; }

/* tablet: the drop-downs of the bar at the bottom open upwards */
@media (min-width: 641px) and (max-width: 1199px) {
  .bulk-bar.is-js .menu { top: auto; bottom: calc(100% + 6px); max-height: 60vh; overflow-y: auto; }
}

/* tablet: the tabs of a page on one row that slides, the active one in view (app.js); the dials of CPU and RAM smaller */
@media (min-width: 641px) and (max-width: 1199px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x proximity; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; scroll-snap-align: start; }
  .tabs-row > .tabs { flex: 1 1 100%; min-width: 0; }
  .gauge { max-width: 210px; }
}

/* tablet: Configura on one column, the menu of the router closed behind its button as on a phone */
@media (min-width: 641px) and (max-width: 1199px) {
  .config-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .config-menu.card { padding: 0; }
  .config-menu-toggle { display: flex; width: calc(100% - 1rem); height: auto; min-height: 50px; margin: var(--s1); padding: var(--s1) var(--s2); justify-content: flex-start; gap: var(--s1); text-align: left; }
  .config-menu-toggle .config-menu-toggle-text { display: flex; flex-direction: column; gap: 0; flex: 1 1 auto; min-width: 0; }
  .config-menu-toggle small { font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .config-menu-toggle strong { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .config-menu-toggle[aria-expanded="true"] > .ic:last-child { transform: rotate(180deg); }
  .config-menu.is-folded > :not(.config-device, .config-menu-toggle) { display: none !important; }
  .config-menu:not(.is-folded) .config-tree { columns: 2; column-gap: var(--s2); }
  .config-menu .config-tree > li { break-inside: avoid; }
  .config-menu .config-leaf, .config-menu .config-sub { min-height: 40px; display: flex; align-items: center; }
  .config-menu { position: static; max-height: none; }
}
@media (min-width: 900px) and (max-width: 1199px) {
  .config-menu.card { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); align-items: stretch; }
  .config-menu.card > :not(.config-device, .config-menu-toggle) { grid-column: 1 / -1; }
  .config-menu-toggle { width: auto; }
}

/* Operazioni pianificate: the last line of a log, as long as it is */
.sched-log { overflow-wrap: anywhere; max-width: 46rem; }
/* cards on a phone: the small line under the name of the first cell stays light */
@media (max-width: 640px) { :is(.grid-cards, .table:not(.kv, .no-cards)) td:first-child small { font-weight: 400; } }

/* Backup: tiles that filter, the wizard of a plan */
.stat-danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
a.stat.is-on { border-color: var(--brand); box-shadow: var(--ring); }
.backup-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.add-menu summary.btn-primary { color: #fff; }
.add-menu .menu button[role="menuitem"] { display: flex; align-items: center; gap: var(--s1); width: 100%; padding: var(--s1) var(--s1); border: 0; background: none; font: inherit; font-size: .84rem; color: var(--text); text-align: left; cursor: pointer; white-space: nowrap; }
.add-menu .menu button[role="menuitem"]:hover { background: var(--surface-2); }
.add-menu .menu button[role="menuitem"] .ic { width: 15px; height: 15px; color: var(--brand-ink); }
.plan-who { min-width: 14rem; }
.input-num { width: 7rem; }
.plan-wizard .target-choice + .field-error, .plan-wizard .target-choice + .plan-pick, .plan-wizard .target-choice + .pick { margin-top: var(--s2); }
.plan-pick { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--s2); margin-top: var(--s2); }
.plan-pick .filters { margin-bottom: var(--s1); }
.plan-pick-list { max-height: 26rem; overflow-y: auto; }
.plan-pick-list thead th { position: sticky; top: 0; z-index: 1; }
.plan-chosen { border: 1px solid var(--border); background: var(--surface-2); padding: var(--s2) var(--s2); align-self: start; }
.plan-chosen ul { list-style: none; padding: 0; margin: var(--s1) 0 var(--s1); max-height: 20rem; overflow-y: auto; }
.plan-chosen li { display: flex; justify-content: space-between; align-items: center; gap: var(--s1); padding: var(--s1) 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.plan-chosen li button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0; }
.plan-chosen li button:hover { color: var(--danger); }
.plan-days { margin-top: var(--s2); }
.plan-time { display: flex; gap: var(--s2); align-items: flex-end; flex-wrap: wrap; margin-top: var(--s2); }
.plan-time label { margin: 0; }
.plan-time .hint { margin: 0 0 var(--s1); }
.wizard-nav { display: flex; gap: var(--s1); align-items: center; }
.wizard-nav .grow { flex: 1; }
.plan-wizard[data-wizard-on] [data-step][hidden] { display: none; }
.wizard-steps li[data-step-tab] { cursor: default; }
@media (max-width: 860px) { .plan-pick { grid-template-columns: 1fr; } }.add-menu summary.btn::after { content: none; }
.grid-2 + .alert { margin-top: var(--s2); }

/* Diagnostica of a router: the verdict and its steps */
.diag-verdict { display: flex; gap: var(--s2); align-items: flex-start; }
.diag-verdict .ic { width: 22px; height: 22px; flex: none; margin-top: 0; }
.diag-verdict strong { display: block; font-size: 1rem; }
.diag-verdict p { margin: var(--s1) 0 0; color: var(--text-2); }
.diag-steps td:first-child { width: 2rem; }
.diag-state { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; font-size: .8rem; font-weight: 700; }
.diag-state-ok { background: var(--ok-bg); color: var(--ok); }
.diag-state-warn { background: var(--warn-bg); color: var(--warn); }
.diag-state-fail { background: var(--danger-bg); color: var(--danger); }
.diag-state-skip { background: var(--muted-bg); color: var(--muted); }
form[data-busy].is-busy button { opacity: .7; cursor: progress; }.diag-verdict .diag-state { width: 2.2rem; height: 2.2rem; }
.diag-verdict .diag-state .ic { width: 18px; height: 18px; margin: 0; }

/* Inventory: columns of a fixed width, decided by the colgroup and not by the rows. With the automatic layout the
   widths followed the content while the page arrived, and Identity and Indirizzo moved under the eyes. The check, CVE
   and actions columns are fixed; the others are shares of the table, so a wider screen widens them all in proportion
   instead of giving everything to Identity. At the minimum width every title stays on one line and the widest badges
   fit: «Non raggiungibile» and the CVE one, which here shows only its number (the title of the column says CVE); below it the grid scrolls (the actions stay pinned on the right). */
.inventory-table { table-layout: fixed; min-width: 1032px; }
.inventory-table col.c-check { width: 40px; }
.inventory-table col.c-cve { width: 72px; }
.inventory-table col.c-actions { width: 136px; }
.inventory-table col.c-serial { width: 8%; }
.inventory-table col.c-identity { width: 12%; }
.inventory-table col.c-host { width: 11.5%; }
.inventory-table col.c-model { width: 10%; }
.inventory-table col.c-version { width: 7.5%; }
.inventory-table col.c-onboarded { width: 14%; }
.inventory-table col.c-seen { width: 13%; }
.inventory-table th { white-space: nowrap; vertical-align: bottom; }
.inventory-table th abbr { text-decoration: none; cursor: help; }
.inventory-table td.router-id { overflow-wrap: anywhere; }
.inventory-table td.nowrap { overflow: hidden; text-overflow: ellipsis; }
.inventory-table td .router-type { white-space: normal; }
@media (max-width: 640px) {
  .inventory-table { table-layout: auto; min-width: 0; }
  .inventory-table colgroup { display: none; }
}

/* Plain lists of messages (import results) */
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: var(--s1) 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: 0; }

/* Occupancy of a pool of IP addresses */
.pool-bar { display: flex; width: var(--w-s); height: 8px; background: var(--surface-3); overflow: hidden; }
.pool-bar span { display: block; height: 100%; }
.pool-bar .used { background: var(--brand); }
.pool-bar .reserved { background: var(--warn); }
.pool-bar .quarantine { background: var(--muted); }

/* Suggestions of the RADIUS dictionary under a textarea */
.dict-host { position: relative; }
.dict-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 0; padding: 0; list-style: none; max-height: 288px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.dict-suggest li { display: flex; flex-direction: column; gap: 0; padding: var(--s1) var(--s2); cursor: pointer; border-bottom: 1px solid var(--border); }
.dict-suggest li small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dict-suggest li.active, .dict-suggest li:hover { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }

/* Portal of the subscribers: band in the colour of the organisation, tabs, centred content */
body.portal { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.portal-head { background: var(--surface); border-bottom: 1px solid var(--border); border-top: 4px solid var(--brand); }
.portal-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); max-width: 1120px; margin: 0 auto; padding: var(--s2) var(--s3); }
.portal-brand { display: inline-flex; align-items: baseline; gap: var(--s2); color: var(--text); text-decoration: none; font-size: 1.25rem; font-weight: 700; }
.portal-brand img { display: block; max-height: 40px; max-width: 240px; }
.portal-brand small { color: var(--muted); font-size: .85rem; font-weight: 500; }
.portal-tools { display: flex; align-items: center; gap: var(--s2); }
.portal-user { display: flex; align-items: center; gap: var(--s2); margin: 0; }
.portal-nav { display: flex; gap: var(--s1); max-width: 1120px; margin: 0 auto; padding: 0 var(--s3); overflow-x: auto; }
.portal-nav a { display: inline-flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s2); color: var(--text-2); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.portal-nav a .ic { width: 16px; height: 16px; }
.portal-nav a:hover { color: var(--text); }
.portal-nav a.active { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; }
.portal-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--s3); box-sizing: border-box; }
.portal-login { max-width: 480px; margin: var(--s4) auto; }
.portal-login h1 { margin-top: 0; }
.paypal-topup { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); margin-top: var(--s2); }
.paypal-topup label { margin: 0; }
.paypal-card > form + form { margin-top: var(--s2); }
.portal-foot { display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; max-width: 1120px; width: 100%; margin: 0 auto; padding: var(--s2) var(--s3); box-sizing: border-box; font-size: .85rem; color: var(--text-2); }
@media (max-width: 640px) {
  .portal-bar, .portal-main, .portal-foot { padding-left: var(--s2); padding-right: var(--s2); }
  .portal-user .mono { display: none; }
}

/* ---------- prepaid cards: sheet to print, 3 per row (A4) ---------- */
.card-sheet { display: grid; grid-template-columns: repeat(var(--per-row, 3), minmax(0, 1fr)); gap: var(--s2); }
@media (max-width: 900px) { .card-sheet { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
.prepaid { border: 1px dashed var(--border-strong); background: var(--surface); padding: var(--s2); display: flex; flex-direction: column; gap: var(--s1); break-inside: avoid; }
.prepaid-head { display: flex; justify-content: space-between; gap: var(--s1); font-size: .82rem; border-bottom: 2px solid var(--card-accent, var(--brand)); padding-bottom: var(--s1); }
.prepaid-head span { color: var(--muted); text-align: right; }
.prepaid-org { display: flex; align-items: center; gap: var(--s1); min-width: 0; }
.prepaid-org p, .prepaid-text p, .prepaid-foot p { margin: 0; }
.prepaid-logo { max-height: 24px; max-width: 80px; object-fit: contain; }
.prepaid-text { font-size: .78rem; color: var(--text-2); }
.prepaid-row strong { white-space: nowrap; }
.template-preview .card-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prepaid-value { font-size: 1.5rem; font-weight: 700; }
.prepaid-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s1); }
.prepaid-row span { color: var(--muted); font-size: .82rem; }
.prepaid-row strong { font-size: 1.1rem; letter-spacing: .04em; }
.prepaid-foot { font-size: .72rem; color: var(--muted); }
@media print {
  .card-sheet { grid-template-columns: repeat(var(--per-row, 3), 1fr); gap: 4mm; }
  .prepaid { border: 1px dashed #777; padding: 4mm; }
  .page-head { display: none !important; }
}
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s1) var(--s2); margin-bottom: var(--s2); }
.check-grid .check { margin: 0; }

/* ---------- state of a NAS: CPU and RAM gauges, live traffic ---------- */
.nas-state { display: grid; grid-template-columns: 180px 180px minmax(0, 1fr); gap: var(--s2); align-items: center; margin-bottom: var(--s3); }
.nas-state .stats.small { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.nas-state .stat { min-width: 0; }
.nas-state .gauge-box { text-align: center; }
.nas-state .gauge-label { margin: calc(-1 * var(--s1)) 0 0; color: var(--muted); font-size: .82rem; }
#state h3 { margin: var(--s3) 0 var(--s1); }
.nas-state .stats { margin: 0; }
@media (max-width: 860px) { .nas-state { grid-template-columns: 1fr 1fr; } .nas-state .stats { grid-column: 1 / -1; } }

/* ---------- invoice as a document (A4) and the editor of its template ---------- */
.invoice-doc { --doc-accent: var(--brand); background: #fff; color: #1a1a1a; border: 1px solid var(--border); padding: var(--s4); max-width: 210mm; margin: 0 auto var(--s3); display: flex; flex-direction: column; gap: var(--s3); font-size: .92rem; }
.invoice-doc p { margin: 0 0 var(--s1); }
.invoice-head { display: flex; justify-content: space-between; gap: var(--s3); border-bottom: 3px solid var(--doc-accent); padding-bottom: var(--s2); }
.invoice-logo { display: block; max-height: 48px; max-width: 200px; object-fit: contain; margin-bottom: var(--s1); }
.invoice-title { text-align: right; }
.invoice-title h2 { margin: 0 0 var(--s1); color: var(--doc-accent); font-size: 1.5rem; }
.invoice-title dl { display: grid; grid-template-columns: auto auto; gap: 0 var(--s2); margin: 0; justify-content: end; }
.invoice-title dt { color: #666; }
.invoice-title dd { margin: 0; font-weight: 600; }
.invoice-customer h3 { margin: 0 0 var(--s1); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: #666; }
.invoice-lines { width: 100%; border-collapse: collapse; }
.invoice-lines th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #666; border-bottom: 2px solid var(--doc-accent); padding: var(--s1); }
.invoice-lines td { border-bottom: 1px solid #e3e3e3; padding: var(--s1); vertical-align: top; }
.invoice-lines .num { text-align: right; }
.invoice-totals { display: flex; justify-content: flex-end; }
.invoice-totals dl { display: grid; grid-template-columns: auto auto; gap: var(--s1) var(--s3); margin: 0; min-width: 260px; }
.invoice-totals dt { color: #555; }
.invoice-totals dd { margin: 0; text-align: right; white-space: nowrap; }
.invoice-totals .invoice-total { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--doc-accent); padding-top: var(--s1); color: #000; }
.invoice-notes { color: #444; }
.invoice-foot { border-top: 1px solid #ddd; padding-top: var(--s2); font-size: .8rem; color: #555; }
.template-editor { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.4fr); gap: var(--s3); align-items: start; }
.template-editor textarea { width: 100%; }
.template-preview .invoice-doc { margin: 0; }
@media (max-width: 1100px) { .template-editor { grid-template-columns: 1fr; } }
@media print {
  .invoice-doc { border: 0; padding: 0; max-width: none; }
  .no-print, .alert { display: none !important; }
}

/* ---------- sortable headers of the grids ---------- */
th.sortable a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: var(--s1); white-space: nowrap; }
th.sortable a:hover { color: var(--text); text-decoration: underline; }
th.sorted a { color: var(--text); }
/* the arrow has its place also when the column is not sorted: the title never moves when the sort changes */
th.sortable .sort-arrow { display: inline-block; width: 1em; font-size: .7em; color: var(--brand-ink, var(--text)); }
/* Grids with fixed columns (grid_cols): the widths come from the colgroup and not from the rows, so sorting, changing
   page or filtering never makes the columns jump. A text longer than its column ends with «…» (the whole text in
   the page of the record); below the minimum width the grid scrolls, on the phone it becomes cards as before. */
.table.fixed-cols { table-layout: fixed; min-width: 1000px; }
.table.fixed-cols :is(th, td):not(.row-actions, .actions-col) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table.fixed-cols td:not(.row-actions) > :is(small, div, span.badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.table.fixed-cols td:not(.row-actions) > small { display: block; }
@media (max-width: 640px) {
  .table.fixed-cols { table-layout: auto; min-width: 0; }
  .table.fixed-cols colgroup { display: none; }
}
th.num.sortable a { justify-content: flex-end; width: 100%; }

/* Sezioni a schede con menu laterale (scheda dell'utente, data-side-tabs): una sezione alla volta; sul telefono il menu
   diventa una riga che scorre. Senza JavaScript le sezioni restano una sotto l'altra. */
.side-tabs { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: var(--s3); align-items: start; }
.side-tabs-nav { position: sticky; top: var(--s2); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); padding: var(--s1) 0; }
.side-tabs-nav a { position: relative; display: flex; align-items: center; gap: var(--s1); min-height: 40px; padding: var(--s1) var(--s2); color: var(--text-2); font-size: .88rem; font-weight: 500; }
.side-tabs-nav a .ic, .side-tabs-nav a svg { flex: none; color: var(--muted); }
.side-tabs-nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.side-tabs-nav a.active { background: var(--surface-3); color: var(--text); font-weight: 600; }
.side-tabs-nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--brand); }
.side-tabs-nav a.active .ic, .side-tabs-nav a.active svg { color: var(--brand); }
.side-tabs-nav .count { margin-left: auto; padding: 0 var(--s1); background: var(--surface-3); color: var(--muted); font-size: .74rem; font-weight: 600; }
.side-tabs-nav a.active .count { background: var(--surface); }
.side-tabs.is-ready .tab-panel[hidden] { display: none; }
.side-tabs-body > .tab-panel > .card:last-child, .side-tabs-body > .tab-panel > .grid-2:last-child > .card { margin-bottom: 0; }
@media (max-width: 900px) {
  .side-tabs { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .side-tabs-nav { position: static; flex-direction: row; overflow-x: auto; padding: 0; }
  .side-tabs-nav a { white-space: nowrap; }
  .side-tabs-nav a.active::before { left: var(--s2); right: var(--s2); top: auto; bottom: 0; width: auto; height: 3px; }
}
.side-tabs-body > .tab-panel > .stats.small { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------- prepaid card of the graphic editor (PrintTemplateService «card» layout, in millimetres) and its print ---------- */
.prepaid-x { position: relative; overflow: hidden; box-sizing: border-box; color: #18181B; line-height: 1.55; break-inside: avoid; }
.prepaid-x .pe { position: absolute; overflow: hidden; box-sizing: border-box; }
.prepaid-x .pe p { margin: 0 0 0.6mm; }
.prepaid-x .pe p:last-child { margin: 0; }
.prepaid-x :is(.pe-code, .pe-pin) { display: flex; justify-content: space-between; align-items: baseline; gap: 2mm; }
.prepaid-x :is(.pe-code, .pe-pin) span { font-weight: 400; font-size: .75em; color: #6B6B74; }
.prepaid-x :is(.pe-code, .pe-pin) strong { letter-spacing: .04em; white-space: nowrap; }
.prepaid-x .pe-logo img { width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.print-pages { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); overflow-x: auto; }
.print-page { display: grid; align-content: start; flex: none; box-sizing: border-box; border: 1px dashed var(--border-strong); }
.print-page.cut-marks .prepaid-x { outline: 0.1mm dashed #9a9a9a; }
@media print {
  .print-pages { display: block; overflow: visible; }
  .print-page { border: 0; box-shadow: none; break-after: page; }
  .print-page:last-child { break-after: auto; }
  .content, .main { padding: 0 !important; margin: 0 !important; }
}
/* the graphic editor of the card (Modelli di stampa › Scheda prepagata) */
.designer { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: var(--s3); align-items: start; }
.designer-side > .card { margin-bottom: var(--s2); }
.designer-side summary { cursor: pointer; margin-bottom: var(--s2); }
.designer-side textarea { width: 100%; }
.designer-stage { position: sticky; top: var(--s2); min-width: 0; }
.designer-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); margin-bottom: var(--s2); }
.designer-tools label { margin: 0; }
.designer-canvas { display: inline-block; padding: var(--s3); background: var(--surface-3); border: 1px solid var(--border); max-width: 100%; overflow: auto; outline: none; }
.designer-canvas.with-grid .prepaid-x { background-image: linear-gradient(to right, rgba(0, 0, 0, .06) 1px, transparent 1px), linear-gradient(to bottom, rgba(0, 0, 0, .06) 1px, transparent 1px); background-size: var(--grid) var(--grid); }
.designer-canvas .prepaid-x { overflow: visible; }
.designer-canvas .pe { cursor: move; outline: 1px dashed rgba(0, 0, 0, .18); touch-action: none; user-select: none; }
.designer-canvas .pe.is-selected { outline: 2px solid var(--brand); z-index: 2; overflow: visible; }
.designer-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: var(--brand); border: 2px solid #fff; cursor: nwse-resize; }
.designer-ph { color: #999; font-size: 8px; }
.designer-sheet { overflow: auto; max-width: 100%; }
.designer-page { display: grid; align-content: start; box-sizing: border-box; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow); }
.designer-page.cut-marks .prepaid-x { outline: 1px dashed #b5b5b5; }
@media (max-width: 1100px) { .designer { grid-template-columns: minmax(0, 1fr); } .designer-stage { position: static; } }

/* Attività pianificate: the output of a run, inside the grid (wraps, scrolls past 12 lines) */
.table.fixed-cols td.wrap { white-space: normal; }
.cron-output { margin: 0; max-height: 18em; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; background: var(--surface-2); padding: var(--s1); border: 1px solid var(--border); }

/* ---------- Swagger of the API ---------- */
.swagger-nav { display: flex; flex-wrap: wrap; gap: var(--s1); margin: 0 0 var(--s2); }
.swagger-nav .chip { margin: 0; padding: var(--s1) var(--s2); font-size: .83rem; }
.swagger-tag { scroll-margin-top: var(--s10); }
.swagger-tag h2 { margin-bottom: var(--s2); }
.swagger-op { --m: var(--muted); --m-bg: var(--muted-bg); border: 1px solid var(--border); border-left: 4px solid var(--m); margin: 0 0 var(--s1); background: var(--surface); scroll-margin-top: var(--s10); }
.swagger-op.m-get { --m: var(--info); --m-bg: var(--info-bg); }
.swagger-op.m-post { --m: var(--ok); --m-bg: var(--ok-bg); }
.swagger-op.m-patch { --m: var(--warn); --m-bg: var(--warn-bg); }
.swagger-op.m-delete { --m: var(--danger); --m-bg: var(--danger-bg); }
.swagger-op > summary { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2); cursor: pointer; list-style: none; min-height: var(--s5); }
.swagger-op > summary::-webkit-details-marker { display: none; }
.swagger-op > summary:hover { background: var(--surface-2); }
.swagger-op[open] > summary { background: var(--m-bg); border-bottom: 1px solid var(--border); }
.swagger-method { flex: none; width: 64px; padding: 0 var(--s1); text-align: center; font: 700 .72rem/1.9 var(--mono); color: var(--on-brand); background: var(--m); }
.swagger-path { flex: none; font-size: .86rem; font-weight: 600; color: var(--text); background: none; padding: 0; }
.swagger-sum { flex: 1 1 auto; min-width: 0; color: var(--text-2); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swagger-body { padding: var(--s2); }
.swagger-body h3 { font-size: .9rem; margin: var(--s2) 0 var(--s1); display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.swagger-body > h3:first-child, .swagger-body > p:first-child { margin-top: 0; }
.swagger-body-grid { align-items: start; }
.swagger-body-grid textarea, .swagger-body-grid pre { margin-top: var(--s1); }
.swagger-body-grid pre.json { max-height: 480px; }
.swagger-fields td { vertical-align: top; }
.swagger-fields input, .swagger-fields select { margin: 0; }
.swagger-req { color: var(--danger); font-weight: 700; }
.swagger-fields .hint { margin: 0; }
.swagger-auth .inline-form input, .swagger-auth .inline-form select { height: 36px; padding-top: 0; padding-bottom: 0; }
.swagger-enum { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }
.swagger-enum .chip { margin: 0; }
.swagger-example > summary { cursor: pointer; color: var(--brand-ink); font-size: .83rem; }
.swagger-run { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; margin: var(--s2) 0 0; }
.swagger-run .hint { margin: 0; }
.swagger-result { margin-top: var(--s2); border-top: 1px solid var(--border); }
.swagger-out { max-height: 480px; }
.swagger-schema .swagger-method { color: var(--text-2); background: var(--surface-3); }
@media (max-width: 720px) {
  .swagger-op > summary { flex-wrap: wrap; gap: var(--s1); }
  .swagger-sum { flex-basis: 100%; white-space: normal; }
}

/* Super Admin › Database: the grid of a table, one line per row; the whole row with the long values wrapped */
.db-grid td { white-space: nowrap; }
.db-grid th, .db-row th[scope="row"] { text-transform: none; letter-spacing: 0; font-family: var(--mono, ui-monospace, monospace); }
.db-grid th .sort-link { display: inline-flex; align-items: center; gap: var(--s1); }
.db-grid th .sort-link.active { color: var(--text); }
.db-grid th .sort-link .ic { width: 12px; height: 12px; }
.db-row th[scope="row"] { width: 1%; text-align: left; vertical-align: top; }
.db-row td { vertical-align: top; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
/* the database to read and the query: selector, conditions of the builder, editor */
.db-pick { display: inline-flex; margin: 0; }
.db-pick label { display: inline-flex; align-items: center; gap: var(--s1); margin: 0; }
.db-pick select { min-width: 200px; }
.actions .btn.is-current { border-color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
.db-cols { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); border: 0; padding: 0; margin: 0 0 var(--s2); }
.db-cols legend { width: 100%; margin-bottom: var(--s1); font-weight: 600; }
.db-cols .check { margin: 0; }
.db-cond { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; margin-bottom: var(--s1); }
.db-sql { width: 100%; min-height: 200px; font-size: .85rem; }
.db-cond select, .db-cond input { display: inline-block; width: auto; margin: 0; }
.db-cond select[name$="[col]"], .db-cond select[name="b_sort"] { min-width: 160px; max-width: 220px; }
.db-cond select[name$="[op]"] { min-width: 120px; }
.db-cond input { flex: 1 1 120px; max-width: 240px; }
.db-cond label.inline { display: inline-flex; align-items: center; gap: var(--s1); margin: 0; }
.db-cols { border: 0; }
.db-cols legend { padding: 0; }
.db-pick select { display: inline-block; width: auto; margin: 0; }

/* Query › Visuale: list of the tables, canvas with the boxes and the lines of the joins, grid of the columns */
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.card-head-row h2 { margin: 0; }
.qd-layout { display: grid; grid-template-columns: 240px 1fr; gap: var(--s2); }
.qd-side { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.qd-side input[type="search"] { margin: 0; }
.qd-list { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; border: 1px solid var(--border); background: var(--surface); }
.qd-list li { display: flex; align-items: center; gap: var(--s1); padding: var(--s1); border-bottom: 1px solid var(--border); cursor: grab; font-size: .82rem; }
.qd-list li:hover { background: var(--surface-2); }
.qd-list li > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-list li .act { width: 24px; height: 24px; }
.qd-canvas { position: relative; height: 560px; overflow: auto; border: 1px solid var(--border); background-color: var(--surface-2);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--text) 14%, transparent) 1px, transparent 1px); background-size: 16px 16px; }
.qd-canvas.is-drop { outline: 2px dashed var(--brand); outline-offset: -2px; }
.qd-area { position: relative; min-width: 100%; min-height: 100%; }
.qd-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.qd-line { fill: none; stroke: var(--brand-ink, var(--brand)); stroke-width: 2; }
.qd-line.is-outer { stroke-dasharray: 6 4; }
.qd-line.is-selected { stroke-width: 4; }
.qd-line.is-temp { stroke: var(--muted); stroke-dasharray: 4 4; }
.qd-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.qd-line-label { font: 600 10px var(--mono); fill: var(--muted); text-anchor: middle; paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; }
.qd-empty { position: absolute; left: var(--s3); top: var(--s3); max-width: 420px; margin: 0; color: var(--muted); }
.qd-box { position: absolute; width: 224px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow); z-index: 1; }
.qd-box.is-moving { z-index: 2; box-shadow: var(--shadow-lg, var(--shadow)); }
.qd-box-head { display: flex; align-items: center; gap: var(--s1); padding: var(--s1); background: var(--surface-3); border-bottom: 2px solid var(--brand); cursor: move; user-select: none; touch-action: none; font-weight: 600; font-size: .82rem; }
.qd-box-head > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-alias { color: var(--muted); font-weight: 500; }
.qd-x { width: 24px; height: 24px; margin: 0; padding: 0; border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.qd-x:hover { color: var(--danger, #c0392b); }
.qd-cols { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.qd-cols li { position: relative; display: flex; align-items: center; gap: var(--s1); padding: 0 var(--s3) 0 var(--s1); min-height: 24px; font-size: .78rem; border-bottom: 1px solid var(--border); }
.qd-cols li.is-target { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.qd-cols label { display: flex; align-items: center; gap: var(--s1); flex: 1; min-width: 0; margin: 0; font-weight: 400; color: var(--text); }
.qd-cols label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-cols input[type="checkbox"] { width: auto; margin: 0; box-shadow: none; }
.qd-pk, .qd-secret { font-size: .65rem; padding: 0 var(--s1); background: var(--surface-3); color: var(--muted); }
.qd-dot { position: absolute; right: var(--s1); top: 50%; transform: translateY(-50%); width: 10px; height: 10px; border: 2px solid var(--brand); background: var(--surface); border-radius: 50%; cursor: crosshair; touch-action: none; }
.qd-dot:hover { background: var(--brand); }
.qd-joins { margin-top: var(--s2); }
.qd-joins h3 { margin: 0 0 var(--s1); }
.qd-join { display: flex; align-items: center; gap: var(--s1); padding: var(--s1); border: 1px solid var(--border); margin-bottom: var(--s1); }
.qd-join.is-selected { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.qd-join > span { flex: 1; font-size: .82rem; }
.qd-join select { width: auto; margin: 0; }
.qd-grid { margin-top: var(--s2); }
.qd-grid select, .qd-grid input:not([type="checkbox"]) { width: auto; margin: 0; }
.qd-grid input[type="checkbox"] { width: auto; margin: 0; }
.qd-run { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
.qd-run .check, .qd-run label.inline { display: inline-flex; align-items: center; gap: var(--s1); margin: 0; }
.qd-run input[type="checkbox"] { width: auto; margin: 0; }
.qd-run select { width: auto; margin: 0; }
.qd-run-actions { display: flex; gap: var(--s1); margin-left: auto; }
.qd-sql { margin: var(--s2) 0 0; padding: var(--s2); background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; min-height: 48px; }
@media (max-width: 900px) { .qd-layout { grid-template-columns: 1fr; } .qd-list { max-height: 200px; } }
