:root {
  --bg: #07111f;
  --bg2: #0b1730;
  --panel: rgba(15, 28, 52, .92);
  --panel2: rgba(22, 38, 69, .95);
  --text: #e7eefc;
  --muted: #92a4c3;
  --line: rgba(148, 163, 184, .24);
  --ok: #2ee57b;
  --bad: #ff5570;
  --warn: #ffb020;
  --info: #38c7ff;
  --accent: #4f8cff;
  --shadow: 0 18px 55px rgba(0, 0, 0, .32);
}

body.light {
  --bg: #eaf0f8;
  --bg2: #f7f9fc;
  --panel: rgba(255, 255, 255, .94);
  --panel2: rgba(255, 255, 255, .98);
  --text: #111827;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .14);
  --shadow: 0 18px 45px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(79, 140, 255, .38), transparent 32%),
    radial-gradient(circle at 90% 12%, rgba(56, 199, 255, .18), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg2) 60%, #020617);
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 12, 25, .72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 50;
}

body.light .topbar {
  background: rgba(255, 255, 255, .78);
}

.brand {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 900;
  letter-spacing: -.05em;
  color: white;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  box-shadow: 0 10px 28px rgba(37, 99, 235, .35);
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 1.2rem;
  letter-spacing: .02em;
}

.topbar p {
  color: var(--muted);
  margin-top: .1rem;
  font-size: .82rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.mini-status {
  display: flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .43rem .7rem;
  font-weight: 800;
  background: rgba(255,255,255,.06);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 14px var(--warn);
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 16px var(--ok);
}

.dot.bad {
  background: var(--bad);
  box-shadow: 0 0 16px var(--bad);
}

.btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  border-radius: 999px;
  padding: .45rem .75rem;
  cursor: pointer;
  font-weight: 750;
}

.btn:hover { border-color: rgba(79,140,255,.65); }

.tabs {
  display: flex;
  gap: .4rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 12, 25, .38);
  overflow-x: auto;
}

body.light .tabs {
  background: rgba(255, 255, 255, .38);
}

.tab {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: .5rem .75rem;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.wrap {
  padding: 1rem;
  max-width: 1580px;
  margin: 0 auto;
}

.panel { display: none; }
.panel.active { display: block; }

.grid {
  display: grid;
  gap: 1rem;
}

.cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.overview-grid {
  grid-template-columns: 1.25fr .75fr;
}

.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}

.kpi {
  padding: 1rem;
  position: relative;
}

.kpi:after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(79,140,255,.32), rgba(56,199,255,.12));
}

.tx-card:after {
  background: linear-gradient(135deg, rgba(46,229,123,.3), rgba(255,176,32,.14));
}

.label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.value {
  font-size: 2.15rem;
  font-weight: 950;
  margin-top: .25rem;
  letter-spacing: -.04em;
}

.hint {
  color: var(--muted);
  font-size: .82rem;
}

.card-head {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.card-head h2 {
  font-size: 1rem;
}

.muted { color: var(--muted); }

.reflector-cards {
  display: grid;
  gap: .75rem;
  padding: .85rem;
}

.reflector-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .9rem;
  background: rgba(255,255,255,.04);
}

.reflector-main {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
}

.reflector-title {
  font-weight: 950;
  font-size: 1rem;
}

.reflector-sub {
  color: var(--muted);
  font-size: .83rem;
  margin-top: .18rem;
}

.reflector-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
  margin-top: .75rem;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .55rem;
}

.stat b {
  display: block;
  font-size: 1.05rem;
}

.stat span {
  color: var(--muted);
  font-size: .72rem;
}

.chips {
  padding: .85rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .4rem .65rem;
  background: rgba(255,255,255,.05);
  font-weight: 850;
}

input[type="search"] {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, .22);
  color: var(--text);
  border-radius: 999px;
  padding: .55rem .85rem;
  outline: none;
}

body.light input[type="search"] {
  background: rgba(255,255,255,.74);
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap.compact table {
  font-size: .84rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

th, td {
  padding: .72rem .8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
}

tbody tr:hover {
  background: rgba(255,255,255,.045);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .18rem .52rem;
  font-weight: 900;
  font-size: .74rem;
  border: 1px solid var(--line);
}

.badge.ok { color: var(--ok); border-color: rgba(46,229,123,.45); background: rgba(46,229,123,.09); }
.badge.bad { color: var(--bad); border-color: rgba(255,85,112,.45); background: rgba(255,85,112,.09); }
.badge.info { color: var(--info); border-color: rgba(56,199,255,.45); background: rgba(56,199,255,.09); }
.badge.warn { color: var(--warn); border-color: rgba(255,176,32,.5); background: rgba(255,176,32,.09); }

.talker {
  color: var(--ok);
  font-weight: 950;
  text-shadow: 0 0 16px rgba(46,229,123,.35);
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.map-card {
  min-height: calc(100vh - 180px);
}

#map {
  width: 100%;
  height: calc(100vh - 240px);
  min-height: 560px;
  background: #0b1220;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #0f1c34;
  color: #e7eefc;
}

body.light .leaflet-popup-content-wrapper,
body.light .leaflet-popup-tip {
  background: white;
  color: #111827;
}

.map-popup-title {
  font-weight: 950;
  font-size: 1rem;
}

.map-popup-row {
  margin-top: .25rem;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .cards { grid-template-columns: 1fr; }
  .wrap { padding: .75rem; }
  .reflector-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #map { height: 520px; min-height: 520px; }
}

/* ===== Mauro override V10/control-room style ===== */

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(37, 99, 235, .30), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(14, 165, 233, .12), transparent 28%),
    linear-gradient(135deg, #06111f 0%, #0b1628 48%, #020617 100%);
}

body.light {
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, .18), transparent 34%),
    linear-gradient(135deg, #eef4ff 0%, #dbeafe 52%, #cbd5e1 100%);
}

.wrap {
  max-width: none;
  width: 100%;
  padding: 1rem 1.2rem;
}

.topbar {
  background: rgba(3, 10, 24, .88);
  border-bottom: 1px solid rgba(96, 165, 250, .20);
}

body.light .topbar {
  background: rgba(248, 250, 252, .90);
}

.tabs {
  background: rgba(5, 14, 32, .74);
  border-bottom: 1px solid rgba(96, 165, 250, .18);
}

body.light .tabs {
  background: rgba(226, 232, 240, .72);
}

.card {
  border-radius: 14px;
  border-color: rgba(96, 165, 250, .22);
}

body:not(.light) .card {
  background: linear-gradient(180deg, rgba(13, 27, 51, .96), rgba(8, 18, 36, .96));
}

body:not(.light) .kpi {
  background:
    linear-gradient(180deg, rgba(16, 34, 64, .98), rgba(9, 20, 40, .98));
}

.cards {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.overview-grid {
  grid-template-columns: 1.55fr 1fr;
}

.value {
  font-size: 2.35rem;
}

table {
  font-size: .86rem;
}

th {
  background: rgba(15, 23, 42, .18);
}

body:not(.light) th {
  background: rgba(2, 6, 23, .25);
}

tbody tr:hover {
  background: rgba(59, 130, 246, .08);
}

.badge {
  box-shadow: inset 0 0 12px rgba(255,255,255,.03);
}

.reflector-card {
  background:
    linear-gradient(180deg, rgba(30, 41, 59, .28), rgba(15, 23, 42, .18));
}

body.light .reflector-card {
  background: rgba(255,255,255,.62);
}

#map {
  border-top: 1px solid var(--line);
}

@media (min-width: 1200px) {
  .wrap {
    padding-left: 1.6rem;
    padding-right: 1.6rem;
  }
}

/* ===== DARKER V10 STYLE OVERRIDE ===== */

body:not(.light) {
  --bg: #020814;
  --bg2: #071426;
  --panel: rgba(8, 18, 35, .97);
  --panel2: rgba(10, 25, 48, .98);
  --text: #eaf2ff;
  --muted: #8fa3bf;
  --line: rgba(96, 165, 250, .18);
  background:
    radial-gradient(circle at 18% 0%, rgba(29, 78, 216, .24), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(14, 165, 233, .10), transparent 26%),
    linear-gradient(135deg, #020617 0%, #071326 48%, #01040c 100%);
}

body:not(.light) .topbar {
  background: rgba(2, 8, 20, .96);
  border-bottom: 1px solid rgba(96, 165, 250, .18);
}

body:not(.light) .tabs {
  background: rgba(3, 12, 28, .92);
  border-bottom: 1px solid rgba(96, 165, 250, .16);
}

body:not(.light) .card {
  background: linear-gradient(180deg, rgba(9, 24, 47, .97), rgba(5, 14, 30, .98));
  border-color: rgba(96, 165, 250, .18);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .38);
}

body:not(.light) .kpi {
  background:
    linear-gradient(180deg, rgba(10, 26, 52, .98), rgba(4, 13, 29, .99));
}

body:not(.light) .reflector-card {
  background:
    linear-gradient(180deg, rgba(11, 28, 55, .80), rgba(6, 16, 34, .88));
  border-color: rgba(96, 165, 250, .16);
}

body:not(.light) .stat {
  background: rgba(2, 8, 20, .38);
  border-color: rgba(96, 165, 250, .16);
}

body:not(.light) th {
  background: rgba(2, 8, 20, .55);
  color: #9fb5d4;
}

body:not(.light) td {
  color: #eaf2ff;
}

body:not(.light) tbody tr {
  background: rgba(2, 8, 20, .08);
}

body:not(.light) tbody tr:hover {
  background: rgba(37, 99, 235, .13);
}

body:not(.light) input[type="search"] {
  background: rgba(2, 8, 20, .70);
  border-color: rgba(96, 165, 250, .20);
}

body:not(.light) .chip {
  background: rgba(2, 8, 20, .45);
  border-color: rgba(96, 165, 250, .18);
}

body:not(.light) .tab.active {
  background: linear-gradient(180deg, rgba(15, 34, 65, .96), rgba(8, 20, 42, .98));
  border-color: rgba(96, 165, 250, .24);
}

body:not(.light) .mini-status,
body:not(.light) .btn {
  background: rgba(4, 14, 30, .90);
  border-color: rgba(96, 165, 250, .20);
}

body:not(.light) #map {
  background: #020814;
}


/* ===== DARKER V10 STYLE OVERRIDE ===== */

body:not(.light) {
  --bg: #020814;
  --bg2: #071426;
  --panel: rgba(8, 18, 35, .97);
  --panel2: rgba(10, 25, 48, .98);
  --text: #eaf2ff;
  --muted: #8fa3bf;
  --line: rgba(96, 165, 250, .18);
  background:
    radial-gradient(circle at 18% 0%, rgba(29, 78, 216, .24), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(14, 165, 233, .10), transparent 26%),
    linear-gradient(135deg, #020617 0%, #071326 48%, #01040c 100%);
}

body:not(.light) .topbar {
  background: rgba(2, 8, 20, .96);
  border-bottom: 1px solid rgba(96, 165, 250, .18);
}

body:not(.light) .tabs {
  background: rgba(3, 12, 28, .92);
  border-bottom: 1px solid rgba(96, 165, 250, .16);
}

body:not(.light) .card {
  background: linear-gradient(180deg, rgba(9, 24, 47, .97), rgba(5, 14, 30, .98));
  border-color: rgba(96, 165, 250, .18);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .38);
}

body:not(.light) .kpi {
  background:
    linear-gradient(180deg, rgba(10, 26, 52, .98), rgba(4, 13, 29, .99));
}

body:not(.light) .reflector-card {
  background:
    linear-gradient(180deg, rgba(11, 28, 55, .80), rgba(6, 16, 34, .88));
  border-color: rgba(96, 165, 250, .16);
}

body:not(.light) .stat {
  background: rgba(2, 8, 20, .38);
  border-color: rgba(96, 165, 250, .16);
}

body:not(.light) th {
  background: rgba(2, 8, 20, .55);
  color: #9fb5d4;
}

body:not(.light) td {
  color: #eaf2ff;
}

body:not(.light) tbody tr {
  background: rgba(2, 8, 20, .08);
}

body:not(.light) tbody tr:hover {
  background: rgba(37, 99, 235, .13);
}

body:not(.light) input[type="search"] {
  background: rgba(2, 8, 20, .70);
  border-color: rgba(96, 165, 250, .20);
}

body:not(.light) .chip {
  background: rgba(2, 8, 20, .45);
  border-color: rgba(96, 165, 250, .18);
}

body:not(.light) .tab.active {
  background: linear-gradient(180deg, rgba(15, 34, 65, .96), rgba(8, 20, 42, .98));
  border-color: rgba(96, 165, 250, .24);
}

body:not(.light) .mini-status,
body:not(.light) .btn {
  background: rgba(4, 14, 30, .90);
  border-color: rgba(96, 165, 250, .20);
}

body:not(.light) #map {
  background: #020814;
}


/* ===== DARKER V10 STYLE OVERRIDE ===== */

body:not(.light) {
  --bg: #020814;
  --bg2: #071426;
  --panel: rgba(8, 18, 35, .97);
  --panel2: rgba(10, 25, 48, .98);
  --text: #eaf2ff;
  --muted: #8fa3bf;
  --line: rgba(96, 165, 250, .18);
  background:
    radial-gradient(circle at 18% 0%, rgba(29, 78, 216, .24), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(14, 165, 233, .10), transparent 26%),
    linear-gradient(135deg, #020617 0%, #071326 48%, #01040c 100%);
}

body:not(.light) .topbar {
  background: rgba(2, 8, 20, .96);
  border-bottom: 1px solid rgba(96, 165, 250, .18);
}

body:not(.light) .tabs {
  background: rgba(3, 12, 28, .92);
  border-bottom: 1px solid rgba(96, 165, 250, .16);
}

body:not(.light) .card {
  background: linear-gradient(180deg, rgba(9, 24, 47, .97), rgba(5, 14, 30, .98));
  border-color: rgba(96, 165, 250, .18);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .38);
}

body:not(.light) .kpi {
  background:
    linear-gradient(180deg, rgba(10, 26, 52, .98), rgba(4, 13, 29, .99));
}

body:not(.light) .reflector-card {
  background:
    linear-gradient(180deg, rgba(11, 28, 55, .80), rgba(6, 16, 34, .88));
  border-color: rgba(96, 165, 250, .16);
}

body:not(.light) .stat {
  background: rgba(2, 8, 20, .38);
  border-color: rgba(96, 165, 250, .16);
}

body:not(.light) th {
  background: rgba(2, 8, 20, .55);
  color: #9fb5d4;
}

body:not(.light) td {
  color: #eaf2ff;
}

body:not(.light) tbody tr {
  background: rgba(2, 8, 20, .08);
}

body:not(.light) tbody tr:hover {
  background: rgba(37, 99, 235, .13);
}

body:not(.light) input[type="search"] {
  background: rgba(2, 8, 20, .70);
  border-color: rgba(96, 165, 250, .20);
}

body:not(.light) .chip {
  background: rgba(2, 8, 20, .45);
  border-color: rgba(96, 165, 250, .18);
}

body:not(.light) .tab.active {
  background: linear-gradient(180deg, rgba(15, 34, 65, .96), rgba(8, 20, 42, .98));
  border-color: rgba(96, 165, 250, .24);
}

body:not(.light) .mini-status,
body:not(.light) .btn {
  background: rgba(4, 14, 30, .90);
  border-color: rgba(96, 165, 250, .20);
}

body:not(.light) #map {
  background: #020814;
}


/* ===== ASL Dashboard V10 / SAP light-blue style ===== */

body,
body.light {
  --bg: #dceaf7;
  --bg2: #c8d9e8;
  --panel: #f7fbff;
  --panel2: #ffffff;
  --text: #071827;
  --muted: #48627d;
  --line: #aec3d8;
  --ok: #1db954;
  --bad: #dc3545;
  --warn: #ff9f1a;
  --info: #168bd6;
  --accent: #0d6efd;
  background:
    linear-gradient(90deg, #cfe0f3 0%, #e8f2fb 50%, #74808f 100%);
  color: var(--text);
}

.topbar,
body.light .topbar {
  background: #d9e9f7;
  border-bottom: 1px solid #acc3d8;
  box-shadow: 0 1px 3px rgba(0,0,0,.10);
}

.tabs,
body.light .tabs {
  background: #d3e4f5;
  border-bottom: 1px solid #acc3d8;
}

.tab {
  color: #27445f;
}

.tab.active,
body:not(.light) .tab.active {
  color: #071827;
  background: #ffffff;
  border: 1px solid #9bb8d4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 3px rgba(0,0,0,.12);
}

.card,
body:not(.light) .card,
body.light .card {
  background: #ffffff;
  border: 1px solid #a9bfd5;
  border-radius: 10px;
  box-shadow: 0 2px 7px rgba(28, 55, 85, .16);
}

.kpi,
body:not(.light) .kpi {
  background: linear-gradient(180deg, #ffffff, #f4f8fc);
}

.kpi:after {
  background: linear-gradient(135deg, #d7eaff, #b8d7f7);
}

.tx-card:after {
  background: linear-gradient(135deg, #d7f9df, #b7ecc6);
}

.card-head {
  background: linear-gradient(180deg, #ffffff, #f4f8fc);
  border-bottom: 1px solid #b5c7d9;
}

.card-head h2 {
  color: #071827;
}

.reflector-card,
body:not(.light) .reflector-card,
body.light .reflector-card {
  background: linear-gradient(180deg, #ffffff, #f6f9fd);
  border: 1px solid #b5c7d9;
  border-radius: 9px;
}

.stat,
body:not(.light) .stat {
  background: #f9fcff;
  border: 1px solid #bfd0e1;
}

table {
  color: #071827;
}

th,
body:not(.light) th {
  background: #b9cee4;
  color: #14324f;
  border-bottom: 1px solid #98b2cc;
}

td,
body:not(.light) td {
  color: #071827;
}

tbody tr:nth-child(even) {
  background: #f6f9fc;
}

tbody tr:hover,
body:not(.light) tbody tr:hover {
  background: #e7f1fb;
}

.badge {
  background: #eef6ff;
  border: 1px solid #8fb7dc;
  color: #0b426d;
  font-weight: 900;
}

.badge.ok {
  background: #dff8e8;
  border-color: #73d995;
  color: #087a2d;
}

.badge.bad {
  background: #fde5e8;
  border-color: #ee9aa6;
  color: #b42335;
}

.badge.info {
  background: #e2f4ff;
  border-color: #7ccaf0;
  color: #006fae;
}

.badge.warn {
  background: #fff3d8;
  border-color: #ffc266;
  color: #a95f00;
}

.mini-status,
body:not(.light) .mini-status,
.btn,
body:not(.light) .btn {
  background: #f6fbff;
  border: 1px solid #a7bfd7;
  color: #071827;
}

input[type="search"],
body:not(.light) input[type="search"] {
  background: #ffffff;
  border: 1px solid #a7bfd7;
  color: #071827;
}

.chip,
body:not(.light) .chip {
  background: #ffffff;
  border: 1px solid #adc5dc;
}

.brand-icon {
  background: linear-gradient(135deg, #1092e8, #0d6efd);
}

.value {
  color: #020817;
}

.talker {
  color: #087a2d;
  font-weight: 950;
  text-shadow: none;
}

.tx-live-box {
  display: grid;
  gap: .55rem;
  padding: .85rem;
}

.tx-live-item {
  border: 1px solid #83c39a;
  background: linear-gradient(180deg, #e8fff0, #d8f8e3);
  color: #063d19;
  border-radius: 9px;
  padding: .7rem .8rem;
  font-weight: 900;
}

.tx-live-item.idle {
  border-color: #b7c8d8;
  background: #f7fbff;
  color: #49627b;
}

tr.row-tx {
  background: #dcfce7 !important;
  box-shadow: inset 4px 0 0 #22c55e;
}

tr.row-tg224 {
  box-shadow: inset 4px 0 0 #0d6efd;
}

.badge.tg224 {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #0b4ea2;
}

#map {
  background: #d7e7f5;
}

/* ===== Active Nodes stile vecchia SVX / V10 ===== */

#panel-overview .card:last-child .card-head {
  background: #30363b;
  color: #ffffff;
}

#panel-overview .card:last-child .card-head h2,
#panel-overview .card:last-child .card-head .muted {
  color: #ffffff;
}

#overview-nodes-body td {
  font-size: .95rem;
}

.active-talker-row {
  background: #bfe8ed !important;
}

.tx-yes {
  color: #008000;
  font-weight: 900;
}

.tx-no {
  color: #ff0000;
  font-weight: 700;
}

tr.row-tx td {
  background: #bfe8ed !important;
}

tr.row-tx td:first-child {
  box-shadow: inset 5px 0 0 #159db4;
}

tr.row-tg224:not(.row-tx) td:first-child {
  box-shadow: inset 5px 0 0 #0d6efd;
}

.badge.tg224 {
  background: #0d6efd !important;
  border-color: #0b5ed7 !important;
  color: #ffffff !important;
}


/* ===== TG ufficiali + Last Heard stile HamThings/SAP ===== */

.official-tgs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .75rem;
}

.official-tg {
  display: inline-flex;
  align-items: center;
  border: 1px solid #9fb8d0;
  background: #edf6ff;
  color: #14324f;
  border-radius: 999px;
  padding: .22rem .55rem;
  font-size: .78rem;
  font-weight: 850;
}

.official-tg.default {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #0b4ea2;
}

.tg-label {
  margin-left: .25rem;
  font-size: .78rem;
  font-weight: 700;
}

.lh-actions {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.lh-live-row td {
  background: #c9f7d8 !important;
  box-shadow: inset 0 0 0 9999px rgba(34, 197, 94, .06);
}

.lh-live-row td:first-child {
  box-shadow: inset 5px 0 0 #16a34a;
}

#lastheard-body td {
  font-size: .92rem;
}



/* ===== HamPhone / PBX module ===== */

.hamphone-panel {
  padding: .9rem;
}

.hamphone-main {
  display: flex;
  justify-content: space-between;
  gap: .85rem;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem;
  background: rgba(255,255,255,.04);
}

.hamphone-title {
  font-weight: 950;
  font-size: 1rem;
}

.hamphone-sub {
  color: var(--muted);
  font-size: .83rem;
  margin-top: .2rem;
}

.hamphone-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
  margin-top: .75rem;
}

.hamphone-row {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  margin-top: .7rem;
  font-size: .88rem;
}

.hamphone-dtmf {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .22rem .5rem;
  background: rgba(255,255,255,.05);
  font-weight: 850;
}

.hamphone-note {
  margin-top: .8rem;
  color: var(--muted);
  font-size: .82rem;
  border-top: 1px solid var(--line);
  padding-top: .7rem;
}

body:not(.light) .hamphone-main {
  background: linear-gradient(180deg, rgba(11, 28, 55, .78), rgba(6, 16, 34, .86));
  border-color: rgba(96, 165, 250, .16);
}

@media (max-width: 760px) {
  .hamphone-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.hamphone-sessions {
  margin-top: .85rem;
  border-top: 1px solid var(--line);
  padding-top: .75rem;
}

.hamphone-section-title {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .55rem;
}

.hamphone-session {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: .65rem .75rem;
  background: rgba(255,255,255,.045);
  margin-top: .5rem;
}

.hamphone-session-sub {
  margin-top: .2rem;
  color: var(--muted);
  font-size: .82rem;
}

.hamphone-empty {
  border: 1px dashed var(--line);
  border-radius: 13px;
  padding: .7rem .75rem;
  background: rgba(255,255,255,.025);
}

body:not(.light) .hamphone-session {
  background: rgba(2, 8, 20, .38);
  border-color: rgba(96, 165, 250, .16);
}


/* ===== Access Controller / Multi-Reflector Control ===== */

.access-control-card {
  border-color: rgba(56, 199, 255, .28);
}

body:not(.light) .access-control-card {
  background:
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, .18), transparent 28%),
    linear-gradient(180deg, rgba(12, 30, 58, .98), rgba(7, 18, 36, .98));
}

.access-control-main .hamphone-title {
  font-size: 1.02rem;
}

.access-help {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  padding: .85rem;
  border-top: 1px solid var(--line);
}

.access-help > div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .75rem;
  background: rgba(255,255,255,.04);
}

.access-help strong {
  display: block;
  margin-bottom: .35rem;
}

.access-help span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
  margin-top: .2rem;
}

.access-map-block {
  margin-top: 0;
}

.access-map-table {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.access-map-head,
.access-map-row {
  display: grid;
  grid-template-columns: .55fr 1.45fr .9fr 1.8fr .8fr 1fr;
  gap: .65rem;
  align-items: center;
  padding: .62rem .72rem;
}

.access-map-head {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: rgba(2, 6, 23, .24);
}

.access-map-row {
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.025);
}

.access-map-row:hover {
  background: rgba(59, 130, 246, .07);
}

.access-map-row small {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  margin-top: .12rem;
}

.access-index {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(56, 199, 255, .38);
  border-radius: 999px;
  color: var(--info);
  background: rgba(56, 199, 255, .08);
  font-weight: 950;
}

.access-tgs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}

.hamphone-dtmf {
  color: #facc15;
  font-weight: 900;
}

body.light .access-help > div,
body.light .access-map-row {
  background: rgba(255,255,255,.70);
}

body.light .access-map-head {
  background: rgba(226, 232, 240, .72);
}

@media (max-width: 980px) {
  .access-help {
    grid-template-columns: 1fr;
  }

  .access-map-table {
    overflow-x: auto;
  }

  .access-map-head,
  .access-map-row {
    min-width: 860px;
  }
}

@media (max-width: 640px) {
  .access-help {
    padding: .7rem;
  }
}
