/* Tokens from the NotDone Web design system (light); dark is derived from the
   same inks and checked for contrast. */
:root {
  --g: #ffffff; --p: #f5f6f8; --pr: #eef0f3; --ink: #241e22; --body: #5c5157; --muted: #6b5f63;
  --line: #d9d1c4; --rule: #ebe7e1; --blue: #2540e6; --wash: #eef1fe; --neutral: #8a94a3;
  --track: #e9ebef; --danger: #a83e26; --warn: #8a4b00; --area: rgba(37, 64, 230, 0.10);
  --shadow: 0 26px 54px -28px rgba(23, 21, 15, 0.42); --glass: rgba(255, 255, 255, 0.78); --glass-edge: rgba(36, 30, 34, 0.08);
  --ease: cubic-bezier(0.16, 0.86, 0.26, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --g: #131115; --p: #1c191e; --pr: #262229; --ink: #f4eff1; --body: #cfc6ca; --muted: #a89da2;
    --line: #38323a; --rule: #29252b; --blue: #8396ff; --wash: #1e2347; --neutral: #7a8494;
    --track: #2a262c; --danger: #ff8f73; --warn: #e7a54c; --area: rgba(131, 150, 255, 0.16);
    --shadow: 0 26px 54px -28px rgba(0, 0, 0, 0.8); --glass: rgba(28, 25, 30, 0.80); --glass-edge: rgba(255, 255, 255, 0.08);
  }
}
:root[data-theme="dark"] {
  --g: #131115; --p: #1c191e; --pr: #262229; --ink: #f4eff1; --body: #cfc6ca; --muted: #a89da2;
  --line: #38323a; --rule: #29252b; --blue: #8396ff; --wash: #1e2347; --neutral: #7a8494;
  --track: #2a262c; --danger: #ff8f73; --warn: #e7a54c; --area: rgba(131, 150, 255, 0.16);
  --shadow: 0 26px 54px -28px rgba(0, 0, 0, 0.8); --glass: rgba(28, 25, 30, 0.80); --glass-edge: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--g); }
body { color: var(--ink); font: 15px/1.4 Manrope, "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; transition: background-color 320ms var(--ease), color 320ms var(--ease); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
.disp { font-family: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.eyebrow { font: 500 11px/1.2 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.body { color: var(--body); }
.warn { color: var(--warn); font-weight: 700; }
.bad { color: var(--danger); font-weight: 700; }
.run { color: var(--blue); font-weight: 700; }
h1, h2, p { margin: 0; }
h2 { font: 700 22px/1.15 "Schibsted Grotesk", "Helvetica Neue", sans-serif; letter-spacing: -0.02em; }

.shell { max-width: 1344px; margin: 0 auto; padding: 12px clamp(16px, 4vw, 56px) 56px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; min-height: 72px; position: sticky; top: 0; z-index: 20; background: var(--g); }
.brand { display: flex; align-items: baseline; gap: 10px; flex: 1 1 200px; min-width: 0; }
.wordmark { font-size: 22px; font-weight: 800; letter-spacing: -0.025em; }
.brand-sub { font-size: 15px; font-weight: 600; color: var(--muted); }
.host { font-size: 12px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
main { display: flex; flex-direction: column; gap: 32px; padding-top: 12px; }

.panel { background: var(--p); border-radius: 18px; padding: 24px; min-width: 0; }
.seg { display: inline-flex; background: var(--p); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 8px; min-height: 36px; padding: 0 12px; font-size: 14px; font-weight: 600; color: var(--body); }
.seg button[aria-pressed="true"] { background: var(--g); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 0 0 1px var(--line); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--pr); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: var(--pr); } }
.qbtn { border: 0; background: transparent; min-height: 44px; padding: 0 14px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.qbtn.small { min-height: 36px; font-size: 13px; }
.qbtn.danger { color: var(--danger); }
.qbtn[disabled] { color: var(--muted); cursor: default; }
.icon-btn { width: 44px; padding: 0; }
.qbtn:active:not([disabled]), .seg button:active { transform: scale(0.97); transition: transform 100ms ease-out; }
@media (hover: hover) {
  .qbtn:hover:not([disabled]) { background: var(--pr); }
  .seg button:hover:not([aria-pressed="true"]) { color: var(--ink); }
  .row:hover { background: var(--pr); }
}
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--blue); display: inline-block; flex: none; }
.live.on .dot { animation: pulse 2s var(--ease) infinite; }
.live.off .dot { background: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--area); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.banner { margin-top: 8px; padding: 12px 16px; border-radius: 14px; background: var(--p); color: var(--warn); font-weight: 600; font-size: 14px; }

#verdict { display: flex; flex-direction: column; gap: 10px; max-width: 880px; }
#verdict h1 { font: 800 clamp(28px, 3.4vw, 48px)/1.08 "Schibsted Grotesk", "Helvetica Neue", sans-serif; letter-spacing: -0.03em; }
#verdict p.lead { font-size: 17px; line-height: 1.5; color: var(--body); }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .value { font: 800 30px/1.05 "Schibsted Grotesk", "Helvetica Neue", sans-serif; letter-spacing: -0.025em; }
.kpi .sub { font-size: 13px; color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .note { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: auto; }
.kpi .note.warn { color: var(--warn); }
.kpi svg { width: 100%; height: 28px; margin-top: 4px; }

.two { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; }
.col-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }

.chart-wrap { display: flex; gap: 10px; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; height: 180px; font-size: 11px; color: var(--muted); text-align: right; width: 34px; flex: none; }
.plot { position: relative; height: 180px; touch-action: pan-y; }
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.grid span { border-top: 1px solid var(--rule); }
.grid span:last-child { border-top-color: var(--line); }
.xaxis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding-top: 8px; }
.crosshair { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink); opacity: 0.35; pointer-events: none; }
.tip { position: absolute; top: 8px; background: var(--g); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); border-radius: 10px; padding: 10px 12px; pointer-events: none; width: 210px; z-index: 2; }
.tip b { display: block; font: 800 20px/1.1 "Schibsted Grotesk", sans-serif; }
.lanes { display: flex; flex-direction: column; gap: 2px; padding-top: 14px; border-top: 1px solid var(--rule); }
.lane-row { display: flex; align-items: center; gap: 12px; min-height: 22px; }
.lane-name { font-size: 12px; color: var(--body); width: 200px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-track { position: relative; flex: 1 1 auto; height: 20px; }
.lane-track::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; border-top: 1px solid var(--rule); }
.lane { position: absolute; height: 10px; border-radius: 5px; background: var(--neutral); top: 5px; min-width: 3px; }
.lane.active { background: var(--blue); }
.lane.failed { background: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 6px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

.stack { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--rule); }
.item:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; width: 120px; flex: none; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--neutral); }
.bar > span.hot { background: var(--blue); }
.bar.wide { width: auto; flex: 1 1 auto; }
.next-row { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--rule); }
.next-row .t { font-size: 13px; width: 44px; flex: none; }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; padding: 0 12px 10px; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; }
.tbl td:first-child, .tbl th:first-child { padding-left: 0; }
.tbl td:last-child, .tbl th:last-child { padding-right: 0; }
.tbl .num { text-align: right; }
.tbl .name { font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 500; }
.cpucell { display: inline-flex; align-items: center; gap: 10px; }
.cpucell .v { font-size: 13px; width: 44px; }
.chev { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; color: var(--muted); border: 0; background: transparent; }
@media (hover: hover) { .chev:hover { background: var(--g); color: var(--ink); } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.qbtn.toggle[aria-pressed="true"] { background: var(--ink); color: var(--g); box-shadow: none; }
.timers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.timer { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--g); }
:root[data-theme="dark"] .timer { background: var(--pr); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .timer { background: var(--pr); } }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.stat b { display: block; font: 800 26px/1.1 "Schibsted Grotesk", sans-serif; letter-spacing: -0.025em; }
.qrow { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rule); }
.qrow .sql { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 13px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--rule); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* Overlays: dialogs on desktop, sheets on the phone. */
.scrim { position: fixed; inset: 0; background: rgba(19, 17, 21, 0.5); z-index: 100; animation: fade 200ms ease both; }
.dlg { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow: auto; background: var(--g); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; z-index: 101; box-shadow: 0 34px 70px -34px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--line); animation: pop 320ms var(--ease) both; }
.dlg.wide { width: min(640px, calc(100% - 32px)); }
.dlg h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.025em; }
.dlg .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
.grab { display: none; width: 36px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; }
.field { min-height: 44px; border-radius: 10px; border: 0; box-shadow: inset 0 0 0 1.5px var(--line); background: var(--g); color: var(--ink); padding: 0 12px; font: 500 15px "IBM Plex Mono", ui-monospace, monospace; width: 100%; }
.field:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue); }
.solid { border: 0; min-height: 44px; padding: 0 18px; border-radius: 8px; font-weight: 700; font-size: 15px; background: var(--danger); color: var(--g); }
.solid.ink { background: var(--ink); }
.solid[disabled] { opacity: 0.45; cursor: default; }
.group { background: var(--p); border-radius: 14px; display: flex; flex-direction: column; }
.act { border: 0; background: transparent; min-height: 56px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; font-weight: 600; font-size: 15px; }
.act + .act { box-shadow: inset 0 1px 0 var(--rule); }
.act[disabled] { cursor: default; color: var(--muted); }
.act .hint { font-size: 13px; font-weight: 500; color: var(--muted); }
.facts { padding: 4px 16px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.facts div:first-child { border-top: 0; }
.bars { position: relative; height: 110px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--line); }
.bars span { flex: 1 1 0; border-radius: 3px 3px 0 0; background: var(--neutral); min-height: 2px; }
.bars span.active { background: var(--blue); }
.bars span.failed { background: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--g); border-radius: 14px; padding: 6px 6px 6px 18px; display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 16px 34px -20px rgba(23, 21, 15, 0.5); animation: rise 320ms var(--ease) both; max-width: calc(100% - 32px); }
.toast button { border: 0; background: transparent; color: inherit; min-height: 40px; padding: 0 12px; border-radius: 10px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@keyframes fade { from { opacity: 0.3; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0.4; transform: translate(-50%, -48%) scale(0.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes rise { from { opacity: 0.4; transform: translate(-50%, 8px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }

.tabbar { display: none; }
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login .brand { flex: none; }
.login h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.login label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.login .bad:empty { display: none; }
.login .solid { min-height: 48px; }

@media (max-width: 63.99rem) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two, .halves { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 40rem) {
  .shell { padding: 4px 16px 120px; }
  .top { min-height: 56px; flex-wrap: nowrap; }
  .brand { flex: 1 1 0; }
  .live-word { display: none; }
  .tbl.cards tr.row[data-row-restart], .tbl.cards tr.row[data-row-job] { cursor: pointer; }
  .hide-s { display: none !important; }
  main { gap: 20px; }
  .panel { padding: 16px; border-radius: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 16px; }
  .kpi .value { font-size: 26px; }
  .kpi svg, .kpi.extra { display: none; }
  h2 { font-size: 19px; }
  .yaxis { display: none; }
  .plot { height: 140px; }
  .lane-row { flex-direction: column; align-items: stretch; gap: 0; }
  .lane-name { width: auto; font-size: 11.5px; }
  body:not([data-tab="stato"]) .sect[data-tab="stato"],
  body:not([data-tab="processi"]) .sect[data-tab="processi"],
  body:not([data-tab="job"]) .sect[data-tab="job"],
  body:not([data-tab="database"]) .sect[data-tab="database"] { display: none !important; }
  .foot { display: none; }
  .tabbar { position: fixed; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); height: 64px; border-radius: 22px; background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%); box-shadow: inset 0 0 0 1px var(--glass-edge), 0 16px 34px -20px rgba(23, 21, 15, 0.38); display: flex; padding: 6px; gap: 4px; z-index: 50; }
  .tabbar button { flex: 1 1 0; border: 0; background: transparent; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--muted); }
  .tabbar button[aria-current="page"] { color: var(--blue); background: var(--wash); }
  .dlg { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: 92%; border-radius: 18px 18px 0 0; padding: 10px 16px calc(28px + env(safe-area-inset-bottom)); animation: up 320ms var(--ease) both; }
  .dlg .actions { flex-direction: column-reverse; }
  .dlg .actions > * { width: 100%; min-height: 50px; border-radius: 12px; font-size: 16px; }
  .grab { display: block; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tbl.cards thead { display: none; }
  .tbl.cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
  .tbl.cards td { border: 0; padding: 0; }
  .tbl.cards td.grow { flex: 1 1 100%; }
  .tbl.cards .hide-card { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar { background: var(--p) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (prefers-contrast: more) {
  :root { --rule: var(--line); --muted: var(--body); }
}
