/* SpamGuard console — abuse-desk palette: cool paper, navy ink, mail-room signal colours.
   One memorable device: the status stripe on the start edge of every incident row/card. */
:root {
  --header-bg: #111a2e;
  --header-fg: #eef2f8;
  --paper: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --ink: #141c2e;
  --muted: #5d6879;
  --line: #e1e5ec;
  --accent: #4655d4;        /* indigo: primary actions, current tab */
  --accent-soft: #eceefd;
  --pending: #a86b05;
  --contained: #0d7a69;
  --danger: #c0352b;
  --neutral: #8a96a3;
  --focus: #4655d4;
  --c-mail: #4f5fe0;        /* chart series */
  --c-webmail: #12a189;
  --c-panel: #e3901b;
  --c-other: #94a0b2;
  --c-block: #d9485f;
  --shadow: 0 1px 2px rgba(17, 26, 46, .05), 0 4px 16px rgba(17, 26, 46, .06);
  --radius-s: 8px;
  --radius-m: 14px;
  --font: "Segoe UI", "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --header-bg: #0a101d; --header-fg: #e8edf5; --paper: #0d1321; --surface: #151d2f; --surface-2: #1a2337; --ink: #e8edf5;
          --muted: #9aa6b8; --line: #263149; --accent: #8b97ff; --accent-soft: #1f2748; --pending: #e7a93f; --contained: #3cc0ab;
          --danger: #f0736a; --neutral: #7d8a9a; --focus: #8b97ff; --c-mail: #7f8cff; --c-webmail: #34c7ad; --c-panel: #f0aa45;
          --c-other: #66738a; --c-block: #f06a80; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25); }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font);
       line-height: 1.7; font-variant-numeric: tabular-nums; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: right; font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: .92em; }

/* frame */
.top { display: flex; align-items: center; gap: 2rem; padding: .75rem max(1rem, calc((100% - 1180px) / 2));
       background: var(--header-bg); color: var(--header-fg); }
.top .brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.top nav { display: flex; gap: 1.25rem; flex: 1; }
.top nav a { text-decoration: none; opacity: .75; padding: .25rem 0; border-bottom: 2px solid transparent; }
.top nav a[aria-current="page"] { opacity: 1; border-color: currentColor; }
.top form { margin: 0; }
.top button { background: none; border: 1px solid rgba(255,255,255,.35); color: inherit; }
main { max-width: 1180px; margin: 0 auto; padding: 2rem 1rem 4rem; }
h1 { font-size: 1.6rem; line-height: 1.3; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
.lede { color: var(--muted); margin: 0 0 1.5rem; max-width: 68ch; }

/* figures */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
           background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 2rem; }
.figures a, .figures div { background: var(--surface); padding: 1rem 1.25rem; text-decoration: none; display: block; }
.figures strong { display: block; font-size: 2rem; line-height: 1.2; }
.figures span { color: var(--muted); font-size: .9rem; }
.figures .is-pending strong { color: var(--pending); }
.figures .is-offline strong { color: var(--danger); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters a { padding: .3rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
             text-decoration: none; font-size: .9rem; }
.filters a[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* incident list: the status stripe */
.incidents { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.incident { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1.5rem; align-items: center;
            background: var(--surface); border: 1px solid var(--line); border-inline-start: 6px solid var(--neutral);
            border-radius: var(--radius-s); padding: .85rem 1.1rem; }
.incident[data-status="pending_approval"] { border-inline-start-color: var(--pending); }
.incident[data-status="contained"] { border-inline-start-color: var(--contained); }
.incident .who { font-weight: 700; text-decoration: none; }
.incident .who:hover { text-decoration: underline; }
.incident .meta { color: var(--muted); font-size: .88rem; grid-column: 1; }
.incident .state { grid-row: 1 / span 2; grid-column: 2; text-align: end; font-size: .9rem; }
.level-confirmed { color: var(--danger); font-weight: 700; }
.level-suspect { color: var(--pending); font-weight: 700; }

/* detail */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem 1.5rem; }
.sheet + .sheet { margin-top: 1rem; }
.stamp { display: inline-block; padding: .1rem .7rem; border-radius: var(--radius-s); color: #fff; font-size: .9rem; background: var(--neutral); }
.stamp.pending_approval { background: var(--pending); }
.stamp.contained { background: var(--contained); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.actions-bar { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.25rem 0 0; }
.actions-bar form { margin: 0; }
.hint { color: var(--muted); font-size: .9rem; margin: .5rem 0 0; max-width: 70ch; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: .88rem; }
.timeline pre { margin: .25rem 0 0; white-space: pre-wrap; word-break: break-word; font-size: .8rem; color: var(--muted); direction: ltr; text-align: left; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
th, td { text-align: start; padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: var(--paper); }
tr:last-child td { border-bottom: 0; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-inline-end: .4rem; background: var(--neutral); }
.dot.on { background: var(--contained); }
.dot.off { background: var(--danger); }

/* forms & buttons */
label { display: block; font-weight: 600; margin-bottom: .3rem; }
input:not([type=checkbox]):not([type=hidden]):not([type=radio]) { width: 100%; max-width: 26rem; padding: .6rem .8rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
button, .button { font: inherit; padding: .5rem 1.1rem; border-radius: var(--radius-s); border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary { background: transparent; color: var(--ink); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.approve { background: var(--contained); border-color: var(--contained); color: #fff; }
.inline-form { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; }
.notice { border-radius: var(--radius-m); padding: 1rem 1.25rem; margin-bottom: 1.5rem; border: 1px solid var(--line); background: var(--surface); }
.notice.ok { border-color: var(--contained); }
.notice.err { border-color: var(--danger); }
.notice.key { border: 2px dashed var(--pending); }
.notice pre { direction: ltr; text-align: left; background: var(--paper); padding: .75rem; border-radius: var(--radius-s); overflow-x: auto; font-size: .85rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-m); }

/* login */
.login { max-width: 24rem; margin: 12vh auto; padding: 0 1rem; }
.login h1 { margin-bottom: 1.5rem; }
.login .field { margin-bottom: 1rem; }
.login button { width: 100%; margin-top: .5rem; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: .75rem; }
  .incident { grid-template-columns: 1fr; }
  .incident .state { grid-row: auto; grid-column: 1; text-align: start; }
  .timeline li { grid-template-columns: 1fr; gap: .25rem; }
  dl.facts { grid-template-columns: 1fr; }
  table, thead, tbody, tr, td, th { display: block; }
  thead { display: none; }
  td { border-bottom: 0; padding: .3rem 1rem; }
  tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
form.inline { display: inline; }
.sheet > h2:first-child { margin-top: 0; }
h1.ltr { font-size: 1.5rem; }

/* additions after review */
.stamp.contained { background: #0b6156; }          /* >= 4.5:1 with white text in both themes */
.stamp.pending_approval { background: #8a5a06; }
.flag { display: inline-block; margin-inline-start: .5rem; padding: 0 .5rem; border-radius: var(--radius-s);
        border: 1px solid var(--danger); color: var(--danger); font-size: .8rem; }
.search { display: flex; gap: .5rem; margin: 0 0 1rem; max-width: 34rem; }
.search #q { flex: 1; max-width: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: .85rem; }
td.small { font-size: .8rem; max-width: 28rem; word-break: break-word; }
details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.notice form.inline { margin-inline-start: 1rem; }
@media (max-width: 720px) {
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
}
/* settings & installer forms */
.form-grid { display: grid; gap: 1rem; }
.form-grid .field small { display: block; color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.check input { width: auto; }
select { padding: .55rem .8rem; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
.steps-done { padding-inline-start: 1.25rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.25rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .5rem; }
.login.wide { max-width: 40rem; }

/* ---- cPSecure login guard ---- */
.sub { display: block; color: var(--muted); font-size: .85rem; }
.layer { display: inline-block; padding: 0 .6rem; border-radius: 999px; border: 1px solid var(--line); font-size: .85rem; white-space: nowrap; }
.layer-ip { border-color: var(--danger); color: var(--danger); }
.layer-protected { border-color: var(--pending); color: var(--pending); }
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.health .sheet + .sheet { margin-top: 0; }
.health h3 { margin: 0 0 .75rem; font-size: 1rem; }
.components { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.components li { display: grid; grid-template-columns: 1.2rem 1fr; column-gap: .4rem; }
.components li .sub { grid-column: 2; }
.components .mark { font-weight: 700; }
.components .ok .mark { color: var(--contained); }
.components .bad .mark, .components .bad strong { color: var(--danger); }
.components .unknown .mark { color: var(--neutral); }
.change { display: inline-block; padding: .05rem .6rem; border-radius: var(--radius-s); font-size: .88rem; border: 1px solid var(--line); }
.change-verified { border-color: var(--contained); color: var(--contained); }
.change-failed { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.change-applied { border-color: var(--pending); color: var(--pending); }
.change-rolled_back { color: var(--neutral); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.compare .sheet + .sheet { margin-top: 0; }
pre.code { direction: ltr; text-align: left; background: var(--paper); padding: .75rem; border-radius: var(--radius-s);
  overflow-x: auto; font-size: .82rem; white-space: pre-wrap; word-break: break-word; margin: 0 0 .75rem; max-height: 28rem; }
@media (max-width: 720px) { .compare { grid-template-columns: 1fr; } }

/* ---- public self-service unblock ---- */
.unblock { max-width: 34rem; margin: 6vh auto; padding: 0 1rem; }
.unblock .field { margin-bottom: 1.1rem; }
.unblock .field small { display: block; color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.unblock form > button[type=submit]:not(.secondary) { width: 100%; padding: .7rem; }
.captcha { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.captcha img { display: block; border: 1px solid var(--line); border-radius: var(--radius-s); max-width: 100%; height: auto; }
input.code { letter-spacing: .35em; font-size: 1.2rem; max-width: 12rem !important; text-align: center; }
details.help { margin-top: 1.5rem; color: var(--muted); }
details.help summary { cursor: pointer; color: var(--ink); }

/* ---- login guard v2: tabs, server cards, modes ---- */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line); margin: 0 0 1.5rem; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }
.mode { display: inline-block; padding: .05rem .75rem; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid; white-space: nowrap; }
.mode-monitor { color: var(--pending); border-color: var(--pending); }
.mode-enforce { color: var(--contained); border-color: var(--contained); }
.server-card { margin-bottom: 1.25rem; }
.server-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .75rem; }
.server-head h3 { margin: 0; font-size: 1.15rem; }
.server-head .sub { flex-basis: 100%; }
.mode-box { background: var(--paper); border-radius: var(--radius-m); padding: .9rem 1.1rem; margin-bottom: 1rem; }
.mode-box p { margin: 0 0 .4rem; }
.mode-box .actions-bar { margin-top: .75rem; align-items: center; }
.mode-box .actions-bar > .sub { flex-basis: 100%; }
a.button.secondary { background: transparent; color: var(--ink); }
.components li { grid-template-columns: 1.4rem 1fr; }
.components .detail { font-size: .8rem; }
.components .state-ok .mark { color: var(--contained); }
.components .state-error .mark, .components .state-error .state-text { color: var(--danger); font-weight: 700; }
.components .state-off .mark, .components .state-off .state-text { color: var(--neutral); }
.components .state-waiting .mark, .components .state-waiting .state-text { color: var(--pending); }
.recent { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .4rem; }
.recent li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .5rem .8rem; }
.sub-inline { color: var(--muted); font-size: .88rem; }
ul.plain { margin: 0 0 1rem; padding-inline-start: 1.2rem; display: grid; gap: .5rem; }
details.help dl.facts { margin-top: .75rem; }

/* ---- limits page ---- */
form.limits fieldset { background: var(--surface); }
form.limits .field.changed input { border-color: var(--pending); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pending) 25%, transparent); }
form.limits .field.changed small { color: var(--pending); }
form.limits input[type=number] { max-width: 10rem; }
.presets .actions-bar { margin-top: 0; }

/* honeypot: off-screen, still in the form for bots */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ==== modern refresh (2026-11): cards, header, dashboard ==== */
.top { position: sticky; top: 0; z-index: 10; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.top nav a { opacity: .7; border-radius: 8px; padding: .3rem .7rem; border-bottom: 0; transition: background .15s, opacity .15s; }
.top nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.top nav a[aria-current="page"] { opacity: 1; background: rgba(255,255,255,.14); }
.top button { border-radius: 8px; }
button, .button { border-radius: 10px; font-weight: 600; transition: filter .15s, background .15s; }
button:not(.secondary):not(.danger):not(.approve), .button:not(.secondary):not(.ghost) { background: var(--accent); border-color: var(--accent); color: #fff; }
.top button { background: none !important; border-color: rgba(255,255,255,.35) !important; color: inherit !important; font-weight: 400; }
button:hover, .button:hover { filter: brightness(1.06); }
a.button.secondary, button.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
a.button.secondary:hover, button.secondary:hover { border-color: var(--accent); color: var(--accent); }
a.button.ghost { background: transparent; border-color: transparent; color: var(--accent); padding-inline: .4rem; }
input:not([type=checkbox]):not([type=hidden]):not([type=radio]), select { border-radius: 10px; }
input:focus, select:focus { border-color: var(--accent); }
.sheet, .card, table, fieldset, .notice, .empty { border-radius: var(--radius-m); }
.sheet, .card { box-shadow: var(--shadow); border-color: var(--line); }
.card { background: var(--surface); border: 1px solid var(--line); padding: 1.1rem 1.25rem; min-width: 0; }
.notice { box-shadow: var(--shadow); border-inline-start-width: 4px; }
.tabs { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .3rem; gap: .2rem;
        box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tabs a { border-bottom: 0; border-radius: 9px; padding: .45rem .95rem; }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.figures { gap: .75rem; background: none; border: 0; overflow: visible; }
.figures a, .figures div { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: .85rem 1rem;
                            transition: transform .15s, border-color .15s; }
.figures a:hover { transform: translateY(-2px); border-color: var(--accent); }
.figures strong { font-size: 1.6rem; font-weight: 700; }
.figures span { font-size: .82rem; }
.recent.card { background: none; border: 0; box-shadow: none; padding: 0; }
.recent li { border-radius: 10px; box-shadow: var(--shadow); }
.layer { background: var(--surface-2); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head .lede { margin-bottom: 0; }
.page-head h1 .dot { width: .8rem; height: .8rem; vertical-align: middle; }
.health-pill { display: inline-flex; align-items: center; gap: .2rem; padding: .45rem 1rem; border-radius: 999px; font-weight: 600; font-size: .9rem;
               background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.health-pill.good { color: var(--contained); }
.health-pill.bad { color: var(--danger); border-color: var(--danger); }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: .5rem; }
.crumbs a { color: var(--accent); text-decoration: none; }
.section-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; margin-top: 2.25rem; }
.more { margin: .75rem 0 0; }
.more a { color: var(--accent); text-decoration: none; font-weight: 600; }
.pill { display: inline-block; padding: .05rem .7rem; border-radius: 999px; font-size: .8rem; background: var(--accent-soft); color: var(--accent); }

/* range switch + server switch */
.stats-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin: 2rem 0 1rem; }
.stats-title { margin: 0; }
.seg, .server-switch { display: inline-flex; flex-wrap: wrap; gap: .2rem; padding: .25rem; background: var(--surface); border: 1px solid var(--line);
                       border-radius: 11px; box-shadow: var(--shadow); }
.seg a, .server-switch a { padding: .3rem .85rem; border-radius: 8px; text-decoration: none; font-size: .88rem; color: var(--muted); }
.seg a:hover, .server-switch a:hover { color: var(--ink); }
.seg a[aria-current="true"], .server-switch a[aria-current="true"] { background: var(--accent); color: #fff; font-weight: 600; }

/* KPIs */
.kpis { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: .85rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 1rem 1.15rem;
       display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.kpi-label { color: var(--muted); font-size: .85rem; }
.kpi-value { font-size: 2rem; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.kpi-note { color: var(--muted); font-size: .8rem; }
.kpi-note a { color: var(--accent); text-decoration: none; }
.kpi-main { background: linear-gradient(135deg, #4655d4 0%, #2a347f 100%); border-color: transparent; color: #fff; }
.kpi-main .kpi-label, .kpi-main .kpi-note { color: rgba(255,255,255,.85); }
.kpi-main .kpi-value { font-size: 2.4rem; }
.kpi-alert .kpi-value { color: var(--c-block); }
.trend { display: inline-block; width: fit-content; margin-top: .2rem; padding: .05rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
         background: rgba(255,255,255,.18); color: #fff; }

/* dashboard grid */
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.card-wide { grid-column: span 2; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; margin-bottom: .6rem; }
.card-head h3 { margin: 0; font-size: 1rem; }
.card-sub { margin: 1rem 0 .5rem; font-size: .95rem; }
.card .empty { padding: 2rem 1rem; box-shadow: none; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin: 0; padding: 0; font-size: .82rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: .35rem; }
.legend-col { flex-direction: column; gap: .45rem; font-size: .88rem; }
.legend-col li { display: flex; }
.legend-col strong { color: var(--ink); margin-inline-start: auto; padding-inline-start: .75rem; }
.sw { width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; background: var(--c-other); flex: none; }
.sw.k-mail { background: var(--c-mail); }
.sw.k-webmail { background: var(--c-webmail); }
.sw.k-panel { background: var(--c-panel); }
.sw.k-other { background: var(--c-other); }

/* charts (SVG; colours only through classes: the CSP forbids inline styles) */
.chart-wrap { width: 100%; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap.small .chart { max-height: 150px; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .base { stroke: var(--line); stroke-width: 1.5; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .hit { fill: transparent; }
.chart .col:hover .hit { fill: var(--accent-soft); }
.chart .k-mail { fill: var(--c-mail); }
.chart .k-webmail { fill: var(--c-webmail); }
.chart .k-panel { fill: var(--c-panel); }
.chart .k-other { fill: var(--c-other); }
.chart .k-block { fill: var(--c-block); }
.donut-row { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut circle { fill: none; stroke-width: 16; }
.donut .track { stroke: var(--surface-2); }
.donut .k-mail { stroke: var(--c-mail); }
.donut .k-webmail { stroke: var(--c-webmail); }
.donut .k-panel { stroke: var(--c-panel); }
.donut .k-other { stroke: var(--c-other); }
.donut-num { fill: var(--ink); font-size: 20px; font-weight: 700; font-family: var(--font); }
.donut-sub { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.donut-row .legend-col { flex: 1; min-width: 9rem; }
.spark { width: 100%; height: 44px; display: block; }
.spark .area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.spark .stroke { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

/* ranked lists */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.rank li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem; align-items: center; }
.rank-name { min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }
.rank-name .sub-inline { display: block; font-size: .78rem; }
.rank-n { font-weight: 700; font-size: .9rem; }
.mbar { grid-column: 1 / -1; width: 100%; height: 6px; display: block; }
.mbar .track { fill: var(--surface-2); }
.mbar .fill { fill: var(--accent); }
.mbar.k-block .fill { fill: var(--c-block); }
.mbar.k-acct .fill { fill: var(--c-webmail); }
.mbar.k-cc .fill { fill: var(--c-panel); }
.cc { display: inline-block; padding: 0 .4rem; border-radius: 5px; font-size: .72rem; font-weight: 700; background: var(--surface-2);
      border: 1px solid var(--line); direction: ltr; letter-spacing: .05em; }

/* server cards */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: .85rem; }
.server-grid .server-card { margin-bottom: 0; }
.server-card { border-top: 4px solid var(--contained); }
.server-card.is-off { border-top-color: var(--danger); }
.server-head h3 a { text-decoration: none; }
.server-head h3 a:hover { color: var(--accent); }
.server-figs { display: grid; grid-template-columns: repeat(3, auto) minmax(110px, 1fr); gap: .75rem 1.25rem; align-items: center;
               padding: .75rem 0 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.server-figs strong { display: block; font-size: 1.35rem; line-height: 1.2; }
.server-figs span { color: var(--muted); font-size: .78rem; }
.mode-box { background: var(--surface-2); border: 1px solid var(--line); }
.comp-fold summary { font-size: .88rem; color: var(--ink); padding: .25rem 0; }
.comp-fold summary strong { color: var(--danger); }
.comp-fold .components { margin-top: .6rem; }
.dot.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--contained) 22%, transparent); }
.dot.off { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-main { grid-column: 1 / -1; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .card-wide { grid-column: auto; }
  .server-figs { grid-template-columns: repeat(3, 1fr); }
  .server-figs .spark-cell { grid-column: 1 / -1; }
  .top { position: static; }
  .top nav { flex-wrap: wrap; gap: .25rem; }
  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .kpi-value { font-size: 1.6rem; }
}

/* header nav: one line, scroll on narrow screens */
.top nav { gap: .2rem; overflow-x: auto; scrollbar-width: none; }
.top nav a { white-space: nowrap; }
.top .brand { white-space: nowrap; }
.top form button { white-space: nowrap; }
/* active-block tiles: 8 in one row on wide screens, 4 x 2 otherwise */
.figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1150px) { .figures { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (max-width: 560px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chart .axis { font-size: 12px; }
.chart-wrap.small .chart { max-height: 190px; }

/* ==== sidebar shell + logo (2026-11) ==== */
body.has-side { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
body.has-side main { width: 100%; padding-top: 1.75rem; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem; padding: 1.1rem .8rem;
        background: linear-gradient(180deg, #121b33 0%, #0c1324 100%); color: #e8edf8; overflow-y: auto; z-index: 20;
        border-inline-end: 1px solid rgba(255,255,255,.06); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .35rem .9rem;
             border-bottom: 1px solid rgba(255,255,255,.08); }
.logo { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: inherit; min-width: 0; }
.logo img { flex: none; filter: drop-shadow(0 4px 10px rgba(75, 90, 255, .45)); }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.logo-text strong { font-size: 1.2rem; letter-spacing: .01em; direction: ltr; text-align: start; }
.logo-text small { font-size: .78rem; opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn { display: none; cursor: pointer; padding: .4rem; border-radius: 9px; color: inherit; margin: 0; }
.nav-btn:hover { background: rgba(255,255,255,.08); }
.side-nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: 10px; text-decoration: none;
              color: rgba(232, 237, 248, .72); font-size: .95rem; transition: background .15s, color .15s; position: relative; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a[aria-current="page"] { background: rgba(110, 125, 255, .2); color: #fff; font-weight: 600; }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -.8rem; top: 22%; bottom: 22%; width: 3px;
                                           border-radius: 3px; background: #8b97ff; }
.ico { width: 1.25rem; height: 1.25rem; flex: none; }
.side-foot { margin: 0; padding: .85rem .35rem 0; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center;
             justify-content: space-between; gap: .5rem; }
.who { display: flex; align-items: center; gap: .55rem; min-width: 0; font-size: .9rem; overflow: hidden; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: .9rem;
          background: linear-gradient(135deg, #6b78ff, #2f3bb0); color: #fff; }
.side-foot button.logout { display: inline-flex; align-items: center; gap: .35rem; background: transparent !important; color: rgba(232,237,248,.75) !important;
                           border: 1px solid rgba(255,255,255,.16) !important; padding: .35rem .55rem; font-size: .8rem; font-weight: 400; }
.side-foot button.logout:hover { color: #fff !important; border-color: rgba(255,255,255,.35) !important; }
.side-foot button.logout span { display: none; }
@media (max-width: 900px) {
  body.has-side { display: block; }
  .side { position: sticky; height: auto; flex-direction: column; gap: 0; padding: .6rem .9rem; }
  .side-head { border-bottom: 0; padding: 0; }
  .nav-btn { display: inline-flex; }
  .side-nav, .side-foot { display: none; }
  .nav-toggle:checked + .side .side-nav { display: flex; padding-top: .6rem; }
  .nav-toggle:checked + .side .side-foot { display: flex; padding-bottom: .4rem; }
  .side-nav a[aria-current="page"]::before { display: none; }
  .nav-toggle:focus-visible + .side .nav-btn { outline: 3px solid var(--focus); }
}

/* ==== dashboard widgets: move / collapse / full width / lock ==== */
.widgets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.widget { min-width: 0; transition: box-shadow .15s, opacity .15s; }
.widget.s2 { grid-column: span 2; }
.widget.s3, .widget.is-wide { grid-column: 1 / -1; }
.widget.card { padding: 1rem 1.2rem 1.15rem; }
.widget-bare { background: none; border: 0; box-shadow: none; padding: 0; }
.w-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; margin-bottom: .7rem; min-height: 2rem; }
.w-head h3 { margin: 0; font-size: 1rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.widget-bare > .w-head h3 { font-size: 1.08rem; }
.w-head .legend { order: 3; flex-basis: 100%; }
.w-head .more-link { color: var(--accent); text-decoration: none; font-size: .85rem; font-weight: 600; }
.w-tools { display: inline-flex; gap: .15rem; margin-inline-start: auto; opacity: .55; transition: opacity .15s; }
.widget:hover .w-tools, .widget:focus-within .w-tools { opacity: 1; }
.w-btn { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; padding: 0; border-radius: 8px; font-weight: 400;
         background: transparent !important; border: 1px solid transparent !important; color: var(--muted) !important; cursor: pointer; }
.w-btn svg { width: 1rem; height: 1rem; }
.w-btn:hover:not(:disabled) { background: var(--accent-soft) !important; color: var(--accent) !important; }
.w-btn:disabled { opacity: .3; cursor: not-allowed; }
.w-move { cursor: grab; }
.w-move:active { cursor: grabbing; }
.w-fold svg { transition: transform .15s; }
.is-collapsed .w-fold svg { transform: rotate(90deg); }
.w-lock[aria-pressed="true"] { color: var(--pending) !important; opacity: 1; }
.is-locked .w-tools { opacity: 1; }
.is-collapsed > .w-body { display: none; }
.is-collapsed > .w-head { margin-bottom: 0; }
.widget-bare.is-collapsed { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .55rem 1rem; box-shadow: var(--shadow); }
.widget.is-locked.card { border-color: color-mix(in srgb, var(--pending) 35%, var(--line)); }
.widget.is-dragging { opacity: .45; outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: var(--radius-m); }
.widgets.is-sorting .widget:not(.is-dragging):not(.is-locked) { box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow); }
.widget .kpis, .widget .figures { margin-bottom: 0; }
.w-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; }
.w-toolbar:empty { display: none; }
.w-bar-btn { font-size: .82rem; padding: .3rem .75rem; border-radius: 9px; }
@media (max-width: 1000px) {
  .widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .widgets { grid-template-columns: minmax(0, 1fr); }
  .widget.s2 { grid-column: auto; }
  .w-tools { opacity: 1; }
}

/* widgets follow the width of the content area (the sidebar takes 256px), not the window */
body.has-side main { container-type: inline-size; container-name: page; }
.widget { container-type: inline-size; }
@container page (max-width: 980px) { .widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container page (max-width: 620px) { .widgets { grid-template-columns: minmax(0, 1fr); } .widget.s2 { grid-column: auto; } }
@container (max-width: 820px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-main { grid-column: 1 / -1; } }
@container (max-width: 1000px) { .figures { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (max-width: 480px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* with the sidebar the content fills the whole remaining width (the old 1180px centred column predates it) */
body.has-side main { max-width: none; margin: 0; padding: 1.75rem clamp(1rem, 2.2vw, 2.5rem) 4rem; }
@container page (min-width: 1500px) { .widgets { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lede { max-width: 90ch; }

/* ==== v0.3.5: consistent fixed-width widget columns aligned to the start edge (right in Arabic, left in English) ==== */
body.has-side main { max-width: 1680px; margin-inline: 0 auto; }
.widgets { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 380px)); justify-content: start; }
.widget, .widget.s2 { grid-column: auto; }
.widget[data-size="full"], .widget.w-full { grid-column: 1 / -1; }
.widget.w-1 { grid-column: span 1; }
.widget.w-2 { grid-column: span 2; }
.widget.w-3 { grid-column: span 3; }
/* height: drag the bottom edge of the body; the explicit height scrolls inside */
.widget.is-resizable > .w-body { resize: vertical; overflow: auto; min-height: 60px; }
.widget > .w-body[style] { overflow: auto; }
.widget.is-resizable > .w-body::-webkit-resizer { background: linear-gradient(135deg, transparent 50%, var(--line) 50%); }
.w-height.is-on { color: var(--accent) !important; }
.chart-wrap .chart { max-height: 340px; }
/* LTR (English): sidebar on the left, icons mirrored where they point */
[dir="ltr"] .side-nav a[aria-current="page"]::before { inset-inline-start: -.8rem; }
[dir="ltr"] .ltr { text-align: left; }
[dir="ltr"] .side { border-inline-end: 1px solid rgba(255,255,255,.06); }

/* ==== keys, secrets and commands: never overflow or overlap (all pages and modules) ==== */
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
                   overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
main pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; }
main pre.cmd, .notice pre { display: block; direction: ltr; text-align: left; unicode-bidi: isolate; background: var(--surface-2);
                            border: 1px solid var(--line); border-radius: 10px; padding: .75rem .9rem; margin: .5rem 0; font-size: .82rem; line-height: 1.6; }
main code { overflow-wrap: anywhere; word-break: break-all; }
dl.creds { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .55rem 1rem; align-items: center; margin: .75rem 0; }
dl.creds dt { color: var(--muted); font-weight: 600; font-size: .85rem; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; direction: ltr; }
dl.creds dd { margin: 0; display: flex; gap: .5rem; align-items: center; min-width: 0; }
dl.creds code { flex: 1; min-width: 0; display: block; direction: ltr; text-align: left; background: var(--surface-2); border: 1px solid var(--line);
                border-radius: 8px; padding: .35rem .6rem; font-size: .82rem; }
.cmd-box { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; min-width: 0; }
.cmd-box pre.cmd { width: 100%; margin: 0; }
button.sm, .button.sm { padding: .25rem .7rem; font-size: .8rem; border-radius: 8px; flex: none; white-space: nowrap; }
button.copied { border-color: var(--contained) !important; color: var(--contained) !important; }
@media (max-width: 600px) { dl.creds { grid-template-columns: minmax(0, 1fr); gap: .2rem; } dl.creds dt { margin-top: .4rem; } }
.widgets { grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); max-width: calc(4 * 400px + 3 * 1rem); }
.w-head h3 { flex: 1 1 auto; min-width: 0; }
.w-head .w-tools { order: 2; }

/* ==== IPs: flag + address, linked to the IP history page ==== */
.flagicon { display: inline-block; width: 1.25em; height: .94em; vertical-align: -.12em; border-radius: 2px; object-fit: cover;
        box-shadow: 0 0 0 1px rgba(0,0,0,.12); margin-inline-end: .35em; flex: none; }
a.ip, span.ip { display: inline-flex; align-items: center; gap: 0; text-decoration: none; white-space: nowrap; }
a.ip:hover bdi { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.ip bdi { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }
.ip-title { display: flex; align-items: center; gap: .2rem; }
.ip-title .flagicon { width: 1.6em; height: 1.2em; }
.pips { display: flex; flex-wrap: wrap; gap: .3rem .4rem; align-items: center; margin-top: .35rem; }
.pips > .sub-inline { flex-basis: 100%; }
.pip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2);
       border: 1px solid var(--line); font-size: .82rem; }
.pip small { color: var(--muted); font-weight: 700; }
.state-chip { display: inline-block; padding: .05rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); }
.state-chip.st-active { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.state-chip.st-expired { color: var(--muted); }
.state-chip.st-unblocked { color: var(--contained); border-color: color-mix(in srgb, var(--contained) 40%, var(--line)); }
table.compact td, table.compact th { padding: .45rem .8rem; font-size: .88rem; }
.geo-credit { margin: 2.5rem 0 0; font-size: .75rem; color: var(--muted); }
.geo-credit a { color: inherit; }

/* health series (modules: backup status, ...) */
.donut .k-ok { stroke: var(--contained); } .donut .k-warning { stroke: var(--pending); }
.donut .k-critical { stroke: var(--danger); } .donut .k-unreachable { stroke: var(--c-block); }
.sw.k-ok { background: var(--contained); } .sw.k-warning { background: var(--pending); }
.sw.k-critical { background: var(--danger); } .sw.k-unreachable { background: var(--c-block); }
/* a collapsed widget shows only its header (also hides card footers) */
.widget.is-collapsed > :not(.w-head) { display: none !important; }
.widget.bm-card > .w-head { margin-bottom: 0; }
.widget .bm-kpis { margin-bottom: 0; }

/* honeypot (bot trap): stays in the form for bots, invisible to people, takes no space, never scrolls into view */
.hp { position: absolute !important; inset-inline-start: 0 !important; left: auto; top: 0; width: 1px !important; height: 1px !important;
      margin: -1px !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important;
      clip-path: inset(50%) !important; white-space: nowrap !important; opacity: 0 !important; pointer-events: none !important; }

/* ==== security pages ==== */
.chart .k-ok { fill: var(--contained); } .chart .k-warning { fill: var(--pending); } .chart .k-critical { fill: var(--danger); }
.sec-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1.1rem; margin: 0 0 1rem; display: grid; gap: .7rem; }
.sec-form legend { font-weight: 700; padding: 0 .4rem; }
.sec-form textarea { width: 100%; max-width: 34rem; font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; padding: .5rem .7rem;
                     border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.sec-form .field small { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.form-row input { max-width: 9rem !important; }
.sec-form .actions-bar { align-items: flex-end; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; max-width: 980px; }
.checks li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .8rem; background: var(--surface); border: 1px solid var(--line);
             border-inline-start: 4px solid var(--neutral); border-radius: 12px; padding: .8rem 1rem; box-shadow: var(--shadow); }
.check-mark { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); }
.check-top { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.check-tag { font-size: .75rem; font-weight: 700; padding: 0 .55rem; border-radius: 999px; border: 1px solid currentColor; }
.check-detail { color: var(--muted); font-size: .88rem; margin-top: .2rem; overflow-wrap: anywhere; }
.check-fix { font-size: .85rem; margin-top: .3rem; overflow-wrap: anywhere; }
.check-fail { border-inline-start-color: var(--danger) !important; } .check-fail .check-mark, .check-fail .check-tag { color: var(--danger); }
.check-warn { border-inline-start-color: var(--pending) !important; } .check-warn .check-mark, .check-warn .check-tag { color: var(--pending); }
.check-pass { border-inline-start-color: var(--contained) !important; } .check-pass .check-mark, .check-pass .check-tag { color: var(--contained); }
.check-info .check-mark, .check-info .check-tag { color: var(--accent); }
.checks form.inline { display: inline-block; margin-top: .5rem; }
/* login */
.login-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.25rem; }
.login-brand img { filter: drop-shadow(0 6px 14px rgba(75, 90, 255, .35)); }
.login-brand strong { display: block; font-size: 1.5rem; direction: ltr; text-align: start; }
.login-brand span { color: var(--muted); }
.login .captcha img { border-radius: 10px; }


/* ==== unblock log + successful logins ==== */
.unb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.unb-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .7rem; align-items: center; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.unb-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.unb-who .sub-inline { display: block; font-size: .8rem; }
.state-chip.out-success { color: var(--contained); border-color: color-mix(in srgb, var(--contained) 40%, var(--line)); }
.state-chip.out-reblocked, .state-chip.out-failing { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.state-chip.out-pending, .state-chip.out-not_done { color: var(--pending); border-color: color-mix(in srgb, var(--pending) 40%, var(--line)); }
.state-chip.out-quiet, .state-chip.out-unknown { color: var(--muted); }
.rank li.is-current .rank-name a { color: var(--accent); font-weight: 700; }
.donut .k-c0 { stroke: var(--c-mail); } .donut .k-c1 { stroke: var(--c-webmail); } .donut .k-c2 { stroke: var(--c-panel); }
.donut .k-c3 { stroke: var(--c-block); } .donut .k-c4 { stroke: #8e6bd8; } .donut .k-c5 { stroke: #2b9cd8; } .donut .k-c6 { stroke: var(--c-other); }
.sw.k-c0 { background: var(--c-mail); } .sw.k-c1 { background: var(--c-webmail); } .sw.k-c2 { background: var(--c-panel); }
.sw.k-c3 { background: var(--c-block); } .sw.k-c4 { background: #8e6bd8; } .sw.k-c5 { background: #2b9cd8; } .sw.k-c6 { background: var(--c-other); }


/* ==== v0.5: sidebar groups + sub-menus ==== */
.side-group { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(232,237,248,.42);
              padding: .9rem .8rem .3rem; }
.side-nav a.has-sub { background: rgba(110, 125, 255, .14); }
.side-sub { display: flex; flex-direction: column; gap: .1rem; margin: .15rem 0 .45rem; padding-inline-start: 1.15rem;
            border-inline-start: 1px solid rgba(255,255,255,.1); margin-inline-start: 1.25rem; }
.side-sub a { display: flex; align-items: center; gap: .45rem; padding: .38rem .6rem; border-radius: 8px; font-size: .86rem;
              color: rgba(232,237,248,.66); text-decoration: none; }
.side-sub a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-sub a[aria-current="true"] { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.side-sub a[aria-current="true"]::before { display: none; }
.side-sub .sub-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-sub .badge { min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: #e3485f; color: #fff; font-size: .72rem; font-weight: 700; text-align: center; }
.side-sub-label { font-size: .68rem; color: rgba(232,237,248,.4); padding: .5rem .6rem .15rem; font-weight: 700; }
.side-sub .dot { width: .5rem; height: .5rem; margin: 0; box-shadow: none; }

/* ==== home dashboard ==== */
.health-pill.warnish { color: var(--pending); border-color: color-mix(in srgb, var(--pending) 50%, var(--line)); }
.alert-list, .review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.alert-list a { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .6rem; align-items: center; text-decoration: none;
                padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.alert-list a:hover { border-color: var(--accent); }
.al-mark { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--pending); }
.al-crit .al-mark { background: var(--danger); }
.al-crit a { border-inline-start: 3px solid var(--danger); }
.al-warn a { border-inline-start: 3px solid var(--pending); }
.al-text { font-size: .9rem; overflow-wrap: anywhere; }
.al-card { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.review-list a { display: flex; gap: .75rem; align-items: center; text-decoration: none; padding: .5rem .7rem; border-radius: 10px; border: 1px solid var(--line); }
.review-list a:hover { border-color: var(--accent); }
.review-list strong { font-size: 1.4rem; min-width: 2.2rem; text-align: center; color: var(--accent); }
.review-list span { display: flex; flex-direction: column; font-size: .9rem; }
.review-list small { color: var(--muted); font-size: .75rem; }
.mod-card { border-top: 3px solid var(--contained); }
.mod-card.st-warn { border-top-color: var(--pending); }
.mod-card.st-crit { border-top-color: var(--danger); }
.mod-card.st-off { border-top-color: var(--line); }
.mod-card .w-head h3 a { text-decoration: none; }
.mod-card .w-head h3 a:hover { color: var(--accent); }
.mod-st-ok { color: var(--contained); } .mod-st-warn { color: var(--pending); } .mod-st-crit { color: var(--danger); } .mod-st-off { color: var(--muted); }
.mod-line { margin: 0 0 .7rem; color: var(--muted); font-size: .88rem; }
.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin-bottom: .6rem; }
.mini-kpis a { display: flex; flex-direction: column; padding: .55rem .7rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
               text-decoration: none; transition: border-color .15s; }
.mini-kpis a:hover { border-color: var(--accent); }
.mini-kpis strong { font-size: 1.25rem; line-height: 1.2; }
.mini-kpis span { font-size: .76rem; color: var(--muted); }
.mod-alerts { margin: 0 0 .4rem; color: var(--pending); font-size: .82rem; font-weight: 600; }
.widgets { grid-auto-flow: row dense; }
/* the sidebar sub-menu replaces the page tabs on wide screens (tabs stay on phones, where the sidebar is folded) */
@media (min-width: 901px) { body.has-subnav main nav.tabs { display: none; } }


/* ==== filter tiles (click = filter this page; the active tile is highlighted) ==== */
.ftiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: 0 0 1.1rem; }
.ftile { display: flex; flex-direction: column; gap: .1rem; padding: .7rem .9rem; border-radius: 12px; background: var(--surface);
         border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; transition: border-color .15s, transform .15s; }
.ftile:hover { border-color: var(--accent); transform: translateY(-1px); }
.ftile strong { font-size: 1.45rem; line-height: 1.15; }
.ftile span { font-size: .8rem; color: var(--muted); }
.ftile.tone-danger strong { color: var(--danger); }
.ftile.tone-pending strong { color: var(--pending); }
.ftile.tone-ok strong { color: var(--contained); }
.ftile[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.ftile[aria-current="true"] span { color: var(--accent); font-weight: 600; }
.figures a[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ==== compact settings layout (core + modules): section nav + cards with 2-column fields + save bar ==== */
.settings-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; max-width: 1180px; }
.set-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .15rem; background: var(--surface); border: 1px solid var(--line);
           border-radius: 12px; padding: .45rem; box-shadow: var(--shadow); }
.set-nav a { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; padding: .5rem .7rem; border-radius: 8px;
             text-decoration: none; font-size: .88rem; color: var(--ink); }
.set-nav a:hover { background: var(--accent-soft); color: var(--accent); }
.set-nav .state-chip { font-size: .68rem; padding: 0 .45rem; }
.set-main { display: grid; gap: 1rem; min-width: 0; }
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 1rem 1.2rem; scroll-margin-top: 1rem; }
.set-card > header { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-bottom: .8rem; }
.set-card > header h2 { margin: 0; font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; flex: 1 1 auto; }
.set-card > header .hint { flex-basis: 100%; margin: 0; font-size: .84rem; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .75rem 1rem; }
.set-grid .field label, .set-card .field label { font-size: .84rem; margin-bottom: .2rem; }
.set-grid input:not([type=checkbox]), .set-grid select, .set-grid textarea { max-width: none !important; width: 100%; }
.set-grid .field small { display: block; color: var(--muted); font-size: .76rem; margin-top: .15rem; }
.set-checks { display: grid; gap: .45rem; margin-bottom: .8rem; }
.save-bar { position: sticky; bottom: .75rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; padding: .8rem 1rem;
            background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line);
            border-radius: 14px; box-shadow: 0 8px 24px rgba(17, 26, 46, .14); }
.save-bar .field { margin: 0; }
.save-bar .field input { max-width: 16rem; }
.save-bar small { flex: 1 1 14rem; color: var(--muted); font-size: .78rem; }
.center-key .inline-form { align-items: flex-end; }
@media (max-width: 900px) { .settings-shell { grid-template-columns: minmax(0, 1fr); } .set-nav { position: static; flex-direction: row; flex-wrap: wrap; } }
/* security settings: the four groups as cards side by side */
.sec-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 1rem; align-items: start; }
.sec-form fieldset { margin: 0; background: var(--surface-2); }
.sec-form .actions-bar { grid-column: 1 / -1; margin: 0; }
.sec-form textarea { max-width: none; }
/* limits: compact cards, fields in 2 columns */
form.limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 1rem; align-items: start; max-width: 1280px; }
form.limits fieldset { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: .6rem .9rem; }
form.limits fieldset > legend, form.limits fieldset > .hint { grid-column: 1 / -1; }
form.limits fieldset:last-of-type { grid-column: 1 / -1; }
form.limits .field label { font-size: .82rem; }

/* ==== v0.6: server bar on top of a module + collapsible sidebar ==== */
.srvbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: .5rem; margin: -.6rem 0 1.1rem;
          padding: .45rem .55rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
          box-shadow: 0 6px 18px -14px rgba(15, 23, 42, .45); }
.srvbar-label { display: inline-flex; align-items: center; gap: .35rem; flex: none; color: var(--muted); font-size: .8rem; font-weight: 600; padding-inline: .2rem .1rem; }
.srvbar-label .ico { width: 1.05rem; height: 1.05rem; }
.srvbar-search { flex: 0 0 11rem; min-width: 0; height: 2rem; padding: 0 .6rem; font-size: .85rem; margin: 0; }
.srvbar-list { display: flex; flex-wrap: nowrap; gap: .3rem; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.srvbar a.srv { display: inline-flex; align-items: center; gap: .4rem; flex: none; max-width: 15rem; padding: .32rem .7rem; border-radius: 9px;
                border: 1px solid transparent; color: var(--ink); text-decoration: none; font-size: .87rem; white-space: nowrap; cursor: pointer; }
.srvbar a.srv bdi { overflow: hidden; text-overflow: ellipsis; }
.srvbar a.srv:hover { background: var(--accent-soft); }
.srvbar a.srv[aria-current="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.srvbar a.srv[aria-current="true"] .dot.on { box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.srvbar a.srv .dot { width: .5rem; height: .5rem; margin: 0; flex: none; }
.srvbar a.srv .badge { min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: #e3485f; color: #fff; font-size: .7rem; font-weight: 700; text-align: center; }
.srvbar a.srv.dragging { opacity: .45; }
.srvbar .drop-before { box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .srvbar .drop-before { box-shadow: inset -3px 0 0 var(--accent); }
.srvbar-more { position: relative; flex: none; }
.srvbar-more[hidden] { display: none; }
.srvbar-more-btn { height: 2rem; padding: 0 .7rem; font-size: .82rem; font-weight: 600; background: var(--surface-2) !important;
                   color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: 9px; white-space: nowrap; }
.srvbar-menu { position: absolute; inset-inline-end: 0; top: calc(100% + .35rem); min-width: 15rem; max-height: 60vh; overflow-y: auto; z-index: 30;
               padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px -18px rgba(15, 23, 42, .55); }
.srvbar-menu[hidden] { display: none; }
.srv-row { display: flex; align-items: center; gap: .25rem; }
.srv-row a.srv { flex: 1; max-width: none; }
.srv-pin { flex: none; width: 1.9rem; height: 1.9rem; padding: 0; font-size: .95rem; background: transparent !important; color: var(--muted) !important;
           border: 1px solid transparent !important; border-radius: 8px; }
.srv-pin:hover { color: var(--accent) !important; border-color: var(--line) !important; }
.srv-none { padding: .5rem .7rem; color: var(--muted); font-size: .85rem; }
@media (max-width: 900px) {
  .srvbar { position: static; margin-top: 0; flex-wrap: wrap; }
  .srvbar-search { flex: 1 1 100%; order: -1; }
}

/* collapse button + icons-only sidebar (desktop) */
.side-collapse { display: inline-flex; align-items: center; justify-content: center; padding: .35rem; margin: 0; border-radius: 9px;
                 background: transparent !important; color: rgba(232,237,248,.7) !important; border: 1px solid rgba(255,255,255,.14) !important; }
.side-collapse:hover { color: #fff !important; border-color: rgba(255,255,255,.35) !important; }
.side-collapse .ico { width: 1.15rem; height: 1.15rem; }
[dir="rtl"] .side-collapse .ico { transform: scaleX(-1); }
@media (min-width: 901px) {
  body.has-side.side-mini { grid-template-columns: 72px minmax(0, 1fr); }
  body.side-mini .side { padding-inline: .55rem; }
  body.side-mini .side-head { flex-direction: column; gap: .6rem; padding-inline: 0; }
  body.side-mini .logo-text, body.side-mini .side-nav a > span, body.side-mini .side-sub, body.side-mini .who bdi,
  body.side-mini .side-foot button.logout span { display: none; }
  body.side-mini .side-group { font-size: 0; padding: .5rem 0 .2rem; border-top: 1px solid rgba(255,255,255,.08); margin: .3rem .4rem 0; }
  body.side-mini .side-nav a { justify-content: center; padding: .65rem 0; }
  body.side-mini .side-nav a[aria-current="page"]::before { inset-inline-start: -.55rem; }
  body.side-mini .side-foot { flex-direction: column; }
  body.side-mini .side-collapse .ico { transform: scaleX(-1); }
  [dir="rtl"] body.side-mini .side-collapse .ico { transform: none; }
}
@media (max-width: 900px) { .side-collapse { display: none; } }

/* In-page confirmation (app.js sgConfirm) */
dialog.sg-confirm { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); padding: 1.25rem 1.4rem; width: min(460px, calc(100vw - 32px)); font-family: var(--font); }
dialog.sg-confirm::backdrop { background: rgba(10, 16, 29, .45); }
dialog.sg-confirm p { margin: 0 0 1.1rem; line-height: 1.7; }
.sg-confirm-bar { display: flex; gap: .6rem; flex-wrap: wrap; }
/* /servers/ID: agents of the modules on one server */
.agent-card h3 { margin-top: 0; }
.agent-card details { margin-top: .5rem; }
.flag.ok-flag { background: var(--accent-soft); color: var(--accent); }
.danger-zone { border-color: var(--red-line, #e7b4b4); }
.danger-zone h2 { color: var(--red, #b42318); margin-top: 0; }

/* ======================================================================================================
   v0.7 design system (2026-11-29)
   One calm console look for every page and module: neutral paper, white cards, one indigo accent,
   a single button scale (primary / secondary / quiet / danger), 40 px controls (44 px on phones),
   and a phone layout that behaves like an app: top app bar, section chips, bottom tab bar, slide-out menu.
   ====================================================================================================== */
:root {
  --paper: #f4f6fb; --surface: #ffffff; --surface-2: #f7f8fc; --ink: #0f172a; --muted: #5b6578;
  --line: #e4e7ef; --line-strong: #d2d7e2; --accent: #4f5bd5; --accent-hover: #4350c4; --accent-soft: #eef0fd;
  --ok-soft: #e7f6f3; --warn-soft: #fdf4e3; --danger-soft: #fdecea;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05); --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px -8px rgba(15, 23, 42, .12);
  --radius-s: 10px; --radius-m: 14px; --ctl: 2.5rem;
  --side-bg: #0f1730; --tabbar-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #0b1120; --surface: #121a2c; --surface-2: #172036; --ink: #e7ecf5; --muted: #98a3b6; --line: #232d44; --line-strong: #2f3a55;
          --accent: #8b95ff; --accent-hover: #a0a8ff; --accent-soft: #1e2650; --ok-soft: #0f2a27; --warn-soft: #2d2412; --danger-soft: #34181a;
          --shadow-sm: 0 1px 2px rgba(0,0,0,.35); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 22px -10px rgba(0,0,0,.5); --side-bg: #080d1a; }
}
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { line-height: 1.65; -webkit-tap-highlight-color: transparent; }
h1 { font-size: 1.5rem; font-weight: 750; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-weight: 700; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---- page frame ---- */
body.has-side { grid-template-columns: 252px minmax(0, 1fr); }
body.has-side main { padding: 1.5rem clamp(1rem, 2.4vw, 2.25rem) 4rem; }
.side { background: var(--side-bg); }
.page-head { align-items: center; gap: .75rem 1.25rem; margin-bottom: 1.25rem; }
.page-head > div:first-child { min-width: 0; flex: 1 1 22rem; }
.page-head > :not(:first-child) { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.lede { font-size: .93rem; line-height: 1.7; }
.crumbs { margin-bottom: .35rem; }

/* ---- buttons: one scale, four kinds ---- */
button, .button, a.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--ctl);
  padding: .45rem 1.05rem; border-radius: var(--radius-s); font-size: .92rem; font-weight: 650; line-height: 1.2; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
button:hover, .button:hover { filter: none; }
button:not(.secondary):not(.danger):not(.approve):not(.ghost), .button:not(.secondary):not(.ghost):not(.danger) {
  background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(79, 91, 213, .25); }
button:not(.secondary):not(.danger):not(.approve):not(.ghost):hover, .button:not(.secondary):not(.ghost):not(.danger):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.secondary, a.button.secondary, .button.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-sm); }
button.secondary:hover, a.button.secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
button.ghost, a.button.ghost { background: transparent; border-color: transparent; color: var(--accent); box-shadow: none; padding-inline: .6rem; }
button.ghost:hover, a.button.ghost:hover { background: var(--accent-soft); }
button.danger, a.button.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
button.danger:hover, a.button.danger:hover { background: var(--danger); color: #fff; }
button.approve { background: var(--contained); border-color: var(--contained); color: #fff; }
button.approve:hover { filter: brightness(1.08); }
button.sm, .button.sm, a.button.sm { min-height: 2rem; padding: .25rem .7rem; font-size: .82rem; border-radius: 8px; }
button:disabled, .button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
button svg, .button svg { width: 1.05em; height: 1.05em; flex: none; }
.actions-bar, .inline-form { gap: .5rem; }
.actions-bar { align-items: center; }
form.inline { display: inline-flex; margin: 0; }

/* ---- fields ---- */
label { font-size: .88rem; margin-bottom: .35rem; }
input:not([type=checkbox]):not([type=hidden]):not([type=radio]):not([type=range]):not([type=file]), select, textarea {
  min-height: var(--ctl); padding: .5rem .8rem; font: inherit; font-size: .93rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); transition: border-color .15s, box-shadow .15s; }
textarea { width: 100%; line-height: 1.6; }
select { padding-inline-end: 2rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; vertical-align: -.15em; }
.field small, .form-grid .field small { font-size: .82rem; }
.set-grid input:not([type=checkbox]):not([type=radio]), .set-grid select, .form-grid input:not([type=checkbox]):not([type=radio]) { max-width: none; }
label.check { font-weight: 500; display: flex; align-items: flex-start; gap: .5rem; }
label.check input { margin-top: .3rem; flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.25rem; margin: 0 0 1rem; background: var(--surface); }
legend { font-weight: 700; padding: 0 .4rem; }

/* ---- surfaces ---- */
.sheet, .card, .widget:not(.widget-bare), .set-card, .kpi, .server-card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: var(--shadow); }
.notice { border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); background: var(--surface); box-shadow: var(--shadow-sm);
  border-radius: var(--radius-m); padding: .85rem 1.1rem; line-height: 1.7; }
.notice.ok { border-color: color-mix(in srgb, var(--contained) 30%, var(--line)); border-inline-start-color: var(--contained); background: var(--ok-soft); }
.notice.err { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); border-inline-start-color: var(--danger); background: var(--danger-soft); }
.notice.warn { border-inline-start-color: var(--pending); background: var(--warn-soft); }
.empty { background: var(--surface); border: 1px dashed var(--line-strong); color: var(--muted); }

/* ---- tables ---- */
table { border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-sm); border-collapse: separate; border-spacing: 0; }
th { background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 650; padding: .6rem .9rem; white-space: nowrap; }
td { padding: .65rem .9rem; font-size: .92rem; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
th:first-child { border-start-start-radius: var(--radius-m); }
th:last-child { border-start-end-radius: var(--radius-m); }

/* ---- navigation inside a page ---- */
.tabs { border-radius: 12px; box-shadow: var(--shadow-sm); }
.tabs a { font-size: .9rem; font-weight: 600; color: var(--muted); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--accent); color: #fff; }
.filters a, .seg a { font-weight: 600; }
.filters a { background: var(--surface); border-color: var(--line-strong); color: var(--muted); padding: .35rem .9rem; }
.filters a:hover { color: var(--ink); border-color: var(--accent); }
.filters a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ftile, .figures a, .figures div { border-radius: 12px; box-shadow: var(--shadow-sm); }
.ftile strong, .figures strong { font-weight: 750; letter-spacing: -.01em; }
.state-chip, .pill, .mode { font-weight: 600; }

/* ---- sidebar polish ---- */
.side-nav a { font-size: .93rem; padding: .58rem .75rem; }
.side-nav a[aria-current="page"] { background: rgba(139, 151, 255, .18); }
.side-group { font-size: .68rem; letter-spacing: .04em; }

/* phone-only parts are hidden on desktop */
.appbar, .tabbar, .subchips, .drawer-backdrop { display: none; }
body.has-subnav main nav.tabs { display: none; }

/* ======================= phone & tablet: the app layout ======================= */
@media (max-width: 900px) {
  :root { --ctl: 2.75rem; }
  body.has-side { display: block; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  body.has-side main { padding: 1rem max(1rem, env(safe-area-inset-right)) 2rem max(1rem, env(safe-area-inset-left)); }

  /* top app bar */
  .appbar { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 40;
            padding: calc(.45rem + env(safe-area-inset-top)) .6rem .45rem; background: var(--side-bg); color: #eef2fb;
            box-shadow: 0 4px 16px -6px rgba(0,0,0,.4); }
  .appbar-btn, .appbar-logo { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 12px; cursor: pointer; color: inherit; margin: 0; }
  .appbar-btn:active, .appbar-logo:active { background: rgba(255,255,255,.12); }
  .appbar-btn .ico { width: 1.4rem; height: 1.4rem; }
  .appbar-title { text-align: center; line-height: 1.25; min-width: 0; }
  .appbar-title strong { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar-title small { display: block; font-size: .75rem; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* section chips under the app bar (replace the in-page tabs) */
  .subchips { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: .6rem 1rem; position: sticky;
              top: calc(3.65rem + env(safe-area-inset-top)); z-index: 35; background: color-mix(in srgb, var(--paper) 92%, transparent);
              backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .subchips::-webkit-scrollbar { display: none; }
  .subchips a { flex: none; display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .95rem; border-radius: 999px; font-size: .86rem;
                font-weight: 600; text-decoration: none; color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong); }
  .subchips a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
  .subchips .badge { min-width: 1.2rem; padding: 0 .3rem; border-radius: 999px; background: #e3485f; color: #fff; font-size: .68rem; }
  main nav.tabs { display: none; }

  /* bottom tab bar */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 45;
            height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
            background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
            border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -12px rgba(15,23,42,.25); }
  .tabbar a, .tabbar label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; margin: 0;
            text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; cursor: pointer; position: relative; }
  .tabbar .ico { width: 1.35rem; height: 1.35rem; }
  .tabbar a[aria-current="page"], .tabbar label.is-on { color: var(--accent); }
  .tabbar a[aria-current="page"]::before, .tabbar label.is-on::before { content: ""; position: absolute; top: 0; width: 2rem; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }

  /* the sidebar becomes a slide-out drawer */
  .side { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(86vw, 330px); height: 100%; z-index: 60;
          padding: calc(1rem + env(safe-area-inset-top)) .9rem calc(1rem + env(safe-area-inset-bottom));
          flex-direction: column; gap: .8rem; overflow-y: auto; transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  [dir="rtl"] .side { transform: translateX(105%); }
  [dir="ltr"] .side { transform: translateX(-105%); }
  .nav-toggle:checked ~ .side { transform: none; }
  .side .side-nav, .side .side-foot { display: flex; }
  .side-head { border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: .8rem; }
  .side-head .nav-btn { display: inline-flex; }
  .side-nav a { padding: .75rem .8rem; font-size: 1rem; }
  .side-sub a { padding: .6rem .7rem; font-size: .92rem; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(5, 9, 20, .5); margin: 0; }
  .nav-toggle:checked ~ .drawer-backdrop { display: block; }
  body:has(.nav-toggle:checked) { overflow: hidden; }

  /* content */
  h1 { font-size: 1.3rem; }
  .page-head { flex-direction: column; align-items: stretch; gap: .6rem; }
  .page-head > div:first-child { flex: 0 0 auto; }
  .page-head > :not(:first-child) { width: 100%; }
  .page-head .health-pill { width: fit-content; }
  .lede { font-size: .88rem; }
  input:not([type=checkbox]):not([type=hidden]):not([type=radio]), select, textarea { font-size: 16px; max-width: none; }
  .inline-form { align-items: stretch; }
  .inline-form > .field, .inline-form > div { flex: 1 1 100%; }
  .inline-form > button, .search button { flex: 1 1 auto; }
  form.search { display: flex; gap: .5rem; }
  form.search input { flex: 1; min-width: 0; }
  .actions-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .actions-bar > *, .actions-bar form, .actions-bar form button { width: 100%; }
  .save-bar { position: static; flex-direction: column; align-items: stretch; }
  .save-bar .field, .save-bar input, .save-bar button[type="submit"] { width: 100%; max-width: none; }
  .set-nav { position: static; display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: .4rem;
             padding: .1rem 0 .3rem; background: none; border: 0; box-shadow: none; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav a { flex: none; white-space: nowrap; padding: .45rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong);
               font-size: .86rem; text-decoration: none; }
  .ftiles { display: flex; overflow-x: auto; scrollbar-width: none; gap: .5rem; padding-bottom: .2rem; }
  .ftiles::-webkit-scrollbar { display: none; }
  .ftile { flex: 0 0 auto; min-width: 7.5rem; }
  .w-tools, .w-btn, [data-widget-toolbar], .stats-head .w-toolbar { display: none !important; }
  .srvbar { margin: 0 0 1rem; }
  .side-collapse { display: none; }
}
@media (max-width: 900px) and (display-mode: standalone) {
  /* installed app: no text-selection callouts on the chrome, it should feel native */
  .appbar, .tabbar, .subchips { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
/* tablets: wide tables scroll sideways; phones: every table row becomes a card ("stack" tables label each value) */
@media (min-width: 721px) and (max-width: 900px) {
  table:not(.stack) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 720px) {
  table { border: 0; box-shadow: none; background: transparent; border-radius: 0; }
  table tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-sm);
                   margin-bottom: .6rem; padding: .45rem 0; }
  table tbody tr:hover { background: var(--surface); }
  table td { border: 0; padding: .3rem .95rem; white-space: normal; overflow-wrap: anywhere; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tbody tr { padding: .45rem 0; }
  table.stack td { border: 0; padding: .3rem .95rem; white-space: normal; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: .74rem; font-weight: 650; color: var(--muted); margin-bottom: .05rem; }
  table.stack td:empty { display: none; }
  table.stack td form.inline, table.stack td .button, table.stack td button { margin-top: .25rem; }
}
/* desktop: widget controls only appear on hover/focus of their widget; layout buttons are quiet */
@media (hover: hover) and (min-width: 901px) {
  .widget .w-tools { opacity: 0; transition: opacity .15s; }
  .widget:hover .w-tools, .widget:focus-within .w-tools { opacity: 1; }
}
button.w-bar-btn { min-height: 2rem; padding: .25rem .7rem; font-size: .8rem; font-weight: 600; background: transparent; border-color: transparent;
                   color: var(--muted); box-shadow: none; }
button.w-bar-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
/* phones: the server bar is two compact rows: search, then the servers + "more" on one line */
@media (max-width: 900px) {
  .srvbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; padding: .5rem; }
  .srvbar-label { display: none; }
  .srvbar-search { grid-column: 1 / -1; order: 0; min-height: 2.5rem !important; }
  .srvbar-list { grid-column: 1; min-width: 0; }
  .srvbar-more { grid-column: 2; }
  .srvbar-more-btn { min-height: 2.4rem; padding: 0 .7rem; }
  .srvbar a.srv { padding: .4rem .7rem; }
}
.kpi.kpi-main { background: linear-gradient(135deg, #5561e0 0%, #2a347f 100%); border-color: transparent; color: #fff; }
.al-more { margin-top: .5rem; }
.al-more > summary { display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
                     color: var(--accent); background: var(--accent-soft); list-style: none; }
.al-more > summary::-webkit-details-marker { display: none; }
.al-more[open] > summary { margin-bottom: .5rem; }
