/* =============================================================================
   Mondo Hi-Tech - NMS - Foglio di stile
   Palette derivata dal logo Mondo Hi-Tech:
     navy #001C2D (sfera, ombra) · teal #0083A8 ("MONDO") · cyan #00B3E5 (sfera, luce)
     slate #57585A ("HI-TECH") · teal scuro #006786
   Copyright (c) 2026 Mondo Hi-Tech. Tutti i diritti riservati.
   ============================================================================= */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/Inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/Inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/Inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/InterDisplay-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/InterDisplay-Bold.woff") format("woff"); }

:root {
  --navy: #001C2D;
  --navy-2: #06283C;
  --navy-3: #0E3449;
  --teal: #0083A8;
  --teal-dark: #006786;
  --teal-soft: #E3F3F8;
  --cyan: #00B3E5;
  --cyan-soft: #D9F3FB;
  --slate: #57585A;
  --ink: #1A2730;
  --ink-2: #44515A;
  --ink-3: #7A858D;
  --line: #DCE3E8;
  --line-2: #EBF0F3;
  --bg: #F3F6F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;

  --up: #1C9A5B;      --up-soft: #E4F5EC;
  --down: #D63B4C;    --down-soft: #FBE6E9;
  --warn: #E8A33D;    --warn-soft: #FDF1DC;
  --info: #0083A8;    --info-soft: #E3F3F8;
  --unknown: #8C939A; --unknown-soft: #ECEFF1;

  --chart-in: #0083A8;
  --chart-out: #E09B2D;
  --chart-3: #6C4FB2;
  --chart-4: #1C9A5B;

  --font: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Inter Display", "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar: 248px;
  --topbar: 60px;
  --shadow: 0 1px 2px rgba(0, 28, 45, 0.06);
  --shadow-pop: 0 12px 32px rgba(0, 28, 45, 0.18);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: var(--navy);
  color: #C9D6DE;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-3) transparent;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  background: #fff;                 /* il logo è sempre su sfondo bianco */
  border-bottom: 1px solid var(--line);
}
.sidebar-brand img { height: 52px; width: auto; display: block; }
.brand-card { display: block; background: #fff; border-radius: 10px; padding: 10px 14px; }
.brand-card img { display: block; height: 56px; width: auto; margin: 0 auto; }
.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-nav .nav-group { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: #6E8794; padding: 14px 10px 6px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: 7px;
  color: #C9D6DE;
  font-weight: 500;
  font-size: 13.5px;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: rgba(0, 179, 229, 0.16); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.sidebar-nav a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.85; }
.sidebar-nav a.active svg { opacity: 1; color: var(--cyan); }
.sidebar-nav .nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--down);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.sidebar-nav .nav-badge.warn { background: var(--warn); color: var(--navy); }
.sidebar-foot { padding: 14px 18px; font-size: 11.5px; color: #6E8794; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.sidebar-foot strong { color: #9FB3BE; font-weight: 500; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 18px; }
.topbar .crumbs { font-size: 12.5px; color: var(--ink-3); }
.topbar .crumbs a { color: var(--ink-3); }
.topbar .spacer { flex: 1; }
.topbar-search { position: relative; }
.topbar-search input {
  width: 280px;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}
.topbar-search svg { position: absolute; left: 12px; top: 9px; width: 16px; height: 16px; color: var(--ink-3); }
.topbar-search input:focus { background: #fff; border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px var(--cyan-soft); }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink-2); }
.menu-toggle svg { width: 22px; height: 22px; }

.health-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
}
.health-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.health-chip.stale .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.health-chip.dead .dot { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }

.user-menu { position: relative; }
.user-menu > button {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid transparent; border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer;
}
.user-menu > button:hover { border-color: var(--line); background: var(--surface-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  color: #fff; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); min-width: 220px; padding: 6px; z-index: 30; display: none;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; background: none; border: 0; cursor: pointer; color: var(--ink); }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); text-decoration: none; }
.dropdown .dropdown-head { padding: 8px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.dropdown .dropdown-head strong { display: block; }

.content { padding: 22px 24px 40px; flex: 1; }
.content > * + * { margin-top: 18px; }
.dash-row > div > .panel { height: 100%; }
.widget-list { display: flex; flex-direction: column; gap: 6px; }
.widget-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.widget-row .check { align-items: flex-start; }
.widget-row .widget-label { flex: 1 1 220px; min-width: 0; }
.widget-row .check .sub { display: block; font-weight: 400; }
.dash-row > script + .grid, .dash-row > div > script { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--ink-3); margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.footer { padding: 14px 24px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); background: var(--surface); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- grid */
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* ---------------------------------------------------------------- panel */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; }
.panel-head .spacer { flex: 1; }
.panel-head .count { color: var(--ink-3); font-weight: 400; font-size: 13px; margin-left: 6px; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* -------------------------------------------------------------- KPI tile */
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.kpi::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--teal); }
.kpi.up::before { background: var(--up); }
.kpi.down::before { background: var(--down); }
.kpi.warn::before { background: var(--warn); }
.kpi.neutral::before { background: var(--unknown); }
.kpi .kpi-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.kpi .kpi-value { font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .kpi-value small { font-size: 15px; color: var(--ink-3); font-weight: 500; letter-spacing: 0; margin-left: 2px; }
.kpi .kpi-sub { font-size: 12px; color: var(--ink-3); }
.kpi a { color: inherit; }
.kpi.down .kpi-value { color: var(--down); }
.kpi.warn .kpi-value { color: #B4731C; }

/* ----------------------------------------------------------- status pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--unknown-soft); color: var(--ink-2);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); flex: 0 0 7px; }
.pill.up, .pill.ok, .pill.resolved { background: var(--up-soft); color: #11663B; }
.pill.up::before, .pill.ok::before, .pill.resolved::before { background: var(--up); }
.pill.down, .pill.critical, .pill.error { background: var(--down-soft); color: #9A2231; }
.pill.down::before, .pill.critical::before, .pill.error::before { background: var(--down); }
.pill.warning, .pill.acknowledged { background: var(--warn-soft); color: #8A5A10; }
.pill.warning::before, .pill.acknowledged::before { background: var(--warn); }
.pill.info, .pill.open { background: var(--info-soft); color: #005B75; }
.pill.info::before, .pill.open::before { background: var(--info); }
.pill.disabled, .pill.shutdown, .pill.unknown { background: var(--unknown-soft); color: var(--ink-2); }
.pill.plain::before { display: none; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 5px; background: var(--line-2); color: var(--ink-2); font-size: 11.5px; font-weight: 500; }
.tag.teal { background: var(--teal-soft); color: var(--teal-dark); }
.tag.navy { background: var(--navy); color: #fff; }
.tag.red { background: var(--down-soft); color: #9A2231; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 500; font-size: 13.5px; cursor: pointer; line-height: 1.3;
  white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg); text-decoration: none; color: var(--ink); border-color: #C9D3DA; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-danger { color: var(--down); border-color: #F0C3C9; }
.btn-danger:hover { background: var(--down-soft); color: #9A2231; border-color: #E79DA7; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.active { background: var(--navy); color: #fff; border-color: var(--navy); position: relative; z-index: 1; }
form.inline { display: inline; }

/* ----------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid > * { min-width: 0; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-scan { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.field .help { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); line-height: 1.4;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2357585A' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.select[multiple] { background-image: none; padding-right: 10px; min-height: 120px; }
.textarea { min-height: 90px; resize: vertical; }
.input.sm, .select.sm { padding: 4px 8px; font-size: 12.5px; }
.input.mono { font-family: var(--mono); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--teal); }
.input-error { border-color: var(--down) !important; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); }
fieldset { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
fieldset legend { font-weight: 600; font-size: 13px; padding: 0 6px; color: var(--ink-2); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; }
.toolbar .input { min-width: 220px; }

/* ----------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.table th a { color: inherit; }
.table th a.sorted::after { content: " ↓"; color: var(--teal); }
.table th a.sorted.asc::after { content: " ↑"; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #F7FAFC; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 4px; }
.table a.primary-link { font-weight: 500; color: var(--ink); }
.table a.primary-link:hover { color: var(--teal); }
.table tr.row-down td { background: #FFF6F7; }
.table tr.row-warn td { background: #FFFBF2; }
.table tr.muted-row td { color: var(--ink-3); }
.table .sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.table-compact td { padding: 6px 10px; }
.table-compact th { padding: 7px 10px; }

.empty { padding: 36px 16px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

.pagination { display: flex; gap: 4px; align-items: center; }
.pagination a, .pagination span { padding: 4px 9px; border-radius: 6px; font-size: 12.5px; border: 1px solid transparent; }
.pagination a:hover { background: var(--bg); text-decoration: none; }
.pagination .current { background: var(--navy); color: #fff; }

/* ----------------------------------------------------------- utilization bar */
.bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar .track { flex: 1; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 3px; background: var(--teal); }
.bar .fill.warn { background: var(--warn); }
.bar .fill.crit { background: var(--down); }
.bar .pct { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; width: 46px; text-align: right; }

/* ------------------------------------------------------------- device mosaic */
.mosaic { display: flex; flex-wrap: wrap; gap: 5px; }
.mosaic a {
  display: block; width: 22px; height: 22px; border-radius: 5px; background: var(--up);
  position: relative; transition: transform .1s;
}
.mosaic a:hover { transform: scale(1.25); z-index: 2; }
.mosaic a.down { background: var(--down); }
.mosaic a.unknown { background: var(--unknown); }
.mosaic a.disabled { background: var(--line); }
.mosaic a.alert-warning { box-shadow: inset 0 0 0 3px var(--warn); }
.mosaic a.alert-critical { box-shadow: inset 0 0 0 3px #7A1420; }
.mosaic-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.mosaic-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mosaic-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ----------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.tabs a .count { color: var(--ink-3); font-weight: 400; margin-left: 4px; font-size: 12px; }

/* ---------------------------------------------------------- definition list */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; font-size: 13.5px; margin: 0; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; word-break: break-word; }

/* ------------------------------------------------------------------ chart */
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 150px; }
.chart-box canvas { width: 100% !important; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; }
.range-picker { display: inline-flex; gap: 2px; background: var(--line-2); padding: 3px; border-radius: 8px; }
.range-picker button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.range-picker button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------------------------------------------------------------- alerts */
.flash { padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.flash.success { background: var(--up-soft); border-color: #B9E5CB; color: #11663B; }
.flash.error { background: var(--down-soft); border-color: #F0C3C9; color: #9A2231; }
.flash.warning { background: var(--warn-soft); border-color: #F1D7A6; color: #8A5A10; }
.flash.info { background: var(--info-soft); border-color: #B5DEEB; color: #005B75; }
.flash ul { margin: 4px 0 0; padding-left: 18px; }

.sev-stripe { width: 4px; border-radius: 2px; align-self: stretch; }
.sev-stripe.critical { background: var(--down); }
.sev-stripe.warning { background: var(--warn); }
.sev-stripe.info { background: var(--info); }
.alert-item { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.alert-item:last-child { border-bottom: 0; }
.alert-item .title { font-weight: 500; }
.alert-item .meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ------------------------------------------------------------------- map */
.map-wrap { position: relative; height: calc(100vh - 220px); min-height: 480px; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.map-wrap svg { width: 100%; height: 100%; display: block; cursor: grab; }
.map-wrap svg:active { cursor: grabbing; }
.map-node { cursor: pointer; }
.map-node circle { stroke: #fff; stroke-width: 2px; }
.map-node text { font-size: 11px; fill: var(--ink); pointer-events: none; font-family: var(--font); }
.map-node .sub { font-size: 10px; fill: var(--ink-3); }
.map-link { stroke: #B9C6CF; stroke-width: 1.5px; }
.map-link.busy { stroke: var(--teal); stroke-width: 2.5px; }
.map-link.hot { stroke: var(--warn); stroke-width: 3px; }
.map-tip { position: absolute; background: var(--navy); color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 12px; pointer-events: none; display: none; max-width: 260px; box-shadow: var(--shadow-pop); }
.map-tip strong { display: block; font-size: 12.5px; }

/* ------------------------------------------------------------------ login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side {
  background: var(--navy); color: #C9D6DE; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side::before { content: ""; position: absolute; width: 640px; height: 640px; border-radius: 50%; right: -260px; bottom: -300px; background: radial-gradient(circle, rgba(0, 179, 229, 0.22), rgba(0, 28, 45, 0) 65%); }
.login-side .globe { position: absolute; right: 48px; bottom: 64px; background: #fff; border-radius: 24px; padding: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.login-side .globe img { width: 150px; display: block; }
.login-side h2 { color: #fff; font-size: 30px; line-height: 1.15; max-width: 420px; letter-spacing: -0.02em; }
.login-side p { color: #9FB3BE; max-width: 420px; font-size: 15px; }
.login-side .brand { display: inline-block; background: #fff; border-radius: 10px; padding: 10px 16px; }
.login-side .brand img { height: 56px; display: block; }
.login-side .foot { font-size: 12px; color: #6E8794; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--ink-3); margin-bottom: 22px; }
.login-card .field + .field { margin-top: 14px; }
.login-card .btn { width: 100%; padding: 10px; margin-top: 18px; font-size: 14px; }
.login-card .brand-card { display: none; padding: 0 0 18px; }
.login-card .brand-card img { height: 46px; margin: 0; }

/* ------------------------------------------------------------- error page */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.error-page .code { font-family: var(--font-display); font-size: 72px; font-weight: 700; color: var(--teal); line-height: 1; letter-spacing: -0.04em; }

/* ------------------------------------------------------------ sparkline */
.spark { display: inline-block; vertical-align: middle; }
.spark polyline { fill: none; stroke: var(--teal); stroke-width: 1.5; }
.spark polygon { fill: var(--teal-soft); }

/* ------------------------------------------------------------- tooltip */
[data-tip] { position: relative; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } .mosaic a { transition: none; } }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; height: 100vh; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .menu-toggle { display: inline-flex; }
  .topbar-search input { width: 180px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3 { grid-column: span 2; }
  .login-page { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-card .brand-card { display: block; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar-search { display: none; }
  .topbar .crumbs { display: none; }
  .topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
  .health-chip { white-space: nowrap; }
}
@media (max-width: 640px) {
  html { font-size: 13.5px; }
  .content { padding: 16px 14px 32px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-search { display: none; }
  .topbar .crumbs { display: none; }
  .topbar h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .health-chip { padding: 6px 7px; }
  .health-chip .label { display: none; }
  .user-menu > button .small { display: none; }
  .mosaic-legend { font-size: 11px; gap: 10px; }
  .page-head .actions .btn { padding: 6px 10px; font-size: 13px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: span 1; }
  .kpi .kpi-value { font-size: 26px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head .actions { flex-wrap: wrap; }
  .btn-group { flex-wrap: wrap; }
  .btn-group .btn { margin-left: 0; border-radius: var(--radius-sm); }
  .form-grid.cols-4, .form-grid.cols-scan { grid-template-columns: minmax(0, 1fr); }
  .widget-row { flex-wrap: wrap; }
  .btn { max-width: 100%; white-space: normal; }
  .field > .btn, .form-actions .btn { width: auto; }
  [style*="min-width"] { min-width: 0 !important; }
  .widget-row .select { width: auto !important; flex: 1 1 140px; }
  .toolbar .input { min-width: 0; width: 100%; }
  .toolbar .select { max-width: 100%; }
  .toolbar > form, .toolbar label { max-width: 100%; }
  .login-card { padding: 22px 16px; }
  .chart-box { min-height: 180px; }
}
@media (max-width: 1024px) {
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-scan { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* bersagli tattili: su schermi piccoli o dispositivi touch i pulsanti devono essere alti almeno 36px */
@media (max-width: 640px), (pointer: coarse) {
  .btn { min-height: 38px; }
  .btn-sm { min-height: 34px; padding: 6px 11px; }
  .tabs a { padding: 12px 14px; }
  .input, .select { min-height: 40px; }
  .pagination a, .pagination span { min-width: 36px; min-height: 36px; }
  .pagination { flex-wrap: wrap; justify-content: center; }
}
@media print {
  .sidebar, .topbar, .footer, .btn, .toolbar { display: none !important; }
  .content { padding: 0; }
  .panel { box-shadow: none; }
}
