:root { font-family: Inter, "Segoe UI", Arial, sans-serif; color: #1b3043; background: #f3f6f9; font-size: 14px; --nav: #10283b; --teal: #087f83; --line: #dce4eb; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, .button { border: 1px solid var(--line); background: white; color: #244254; border-radius: 6px; padding: 9px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { background: #e8f2f2; }
button.primary { background: var(--teal); border-color: var(--teal); color: white; }
button.primary:hover { background: #066c70; }
button.danger { color: #ba3643; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { border: 1px solid #c8d5df; border-radius: 5px; background: white; padding: 10px; color: #1b3043; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
label { display: grid; gap: 7px; margin: 15px 0; }
h1 { font-size: 27px; letter-spacing: -.7px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 18px; }
h3 { font-size: 15px; }
p { line-height: 1.6; }
a { color: var(--teal); }
.hidden { display: none !important; }
.muted { color: #6a7f90; }
.customer-description { color: #1b3043; font-size: 32px; font-weight: 700; letter-spacing: -.7px; line-height: 1.2; margin-bottom: 6px; }
h1.with-lead { font-size: 16px; font-weight: 600; letter-spacing: 0; color: #5e7587; }
.hint { font-size: 12px; color: #758b9b; }
.error { color: #b33442; }
.empty { padding: 40px; text-align: center; color: #718797; }

.sidebar { width: 224px; position: fixed; inset: 0 auto 0 0; background: var(--nav); color: #b3c5d3; padding: 29px 17px; display: flex; flex-direction: column; z-index: 2; }
.brand { font-size: 25px; font-weight: 800; color: white; margin: 0 12px 5px; letter-spacing: -1px; }
.brand span { color: #54ccca; }
.brand-sub { font-size: 11px; letter-spacing: 2px; margin: 0 12px 33px; }
.sidebar a { color: inherit; display: flex; gap: 12px; text-decoration: none; padding: 13px 14px; border-radius: 5px; margin-bottom: 4px; }
.sidebar a:hover { background: #1a3a50; }
.sidebar a.active { background: #23495c; color: white; border-left: 3px solid #5bd7cc; }
.sidebar .foot { margin-top: auto; padding: 15px 12px; font-size: 12px; line-height: 1.8; }
.shell { margin-left: 224px; }
.topbar { height: 75px; background: white; border-bottom: 1px solid var(--line); padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar small { display: block; color: #74899a; margin-top: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.customer-picker { display: flex; align-items: center; gap: 8px; margin: 0; }
.main { padding: 29px 32px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 24px; }
.banner { border-left: 4px solid #d89b25; background: #fff5dc; padding: 13px 17px; margin-bottom: 24px; line-height: 1.5; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 19px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 25px; }
.metric, .card { background: white; border: 1px solid var(--line); border-radius: 9px; padding: 22px; box-shadow: 0 2px 4px #182b3b04; }
.metric strong { display: block; font-size: 32px; font-weight: 650; margin-top: 13px; }
.metric span { color: #6a7f90; font-size: 12px; }
.card .title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 25px; }
.card .title .pill { align-self: flex-start; }
.card footer { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.pill { font-size: 11px; display: inline-block; padding: 5px 9px; border-radius: 20px; background: #edf2f6; color: #647c8c; white-space: nowrap; }
.pill.good { background: #e0f3e9; color: #14774d; }
.pill.bad { background: #fde8e9; color: #bb3d49; }
.pill.warn { background: #fff0cf; color: #946500; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; border-bottom: 1px solid #edf1f4; padding: 12px 0; }
.kv span:first-child { color: #718797; }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; }

.panel { background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 23px; }
.panel-head { padding: 18px 21px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head h2 { margin: 0; }
.panel > .hint { padding: 0 21px; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12px; text-align: left; }
th { background: #f8fafb; color: #5e7587; font-weight: 600; white-space: nowrap; }
th, td { padding: 14px 15px; border-bottom: 1px solid #e9eff3; }
td { max-width: 250px; }
td a { color: #047f87; text-decoration: none; }
td a:hover { text-decoration: underline; }
tbody tr:hover { background: #f8fbfc; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; }
.tools input { min-width: 240px; }
.modem-actions { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 8px; }
.modem-actions button { flex: 0 0 auto; padding: 8px 11px; white-space: nowrap; }
.modem-actions-hint { margin: 0 0 14px; }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 23px; }
.stack { display: grid; gap: 18px; align-content: start; }
.tabs { display: flex; overflow: auto; gap: 6px; border-bottom: 1px solid var(--line); margin: 20px 0; }
.tabs button { border: none; border-radius: 0; white-space: nowrap; padding: 14px 12px; background: transparent; }
.tabs button.selected { border-bottom: 3px solid var(--teal); color: var(--teal); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f8fa; border: 1px solid var(--line); padding: 20px; line-height: 1.6; max-height: 500px; overflow: auto; font-size: 12px; }
.ports { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; margin-top: 20px; }
.port { display: block; text-align: center; padding: 16px 5px; background: #edf7f4; border: 1px solid #c9e8de; border-radius: 5px; color: #217456; text-decoration: none; }
.port:hover { background: #e0f3ec; }
.port small { display: block; margin-top: 6px; font-size: 10px; }
.port.idle { background: #f3f6f9; border-color: var(--line); color: #718797; }

.login { max-width: 410px; margin: 10vh auto; padding: 36px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.login .brand { color: #10283b; margin: 0 0 5px; }
.login button { width: 100%; margin-top: 12px; }
.login input { width: 100%; }

#toast { position: fixed; bottom: 24px; right: 24px; max-width: 440px; padding: 16px 20px; border-radius: 7px; background: #163e4d; color: white; z-index: 9; display: none; }
dialog { border: 1px solid var(--line); border-radius: 10px; max-width: 560px; width: 90%; padding: 26px; }
dialog::backdrop { background: #10283b88; }
dialog.wide { width: min(960px, 95vw); max-width: 960px; }
dialog input:not([type=checkbox]), dialog select, dialog textarea { width: 100%; min-width: 0; }
dialog fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 15px 0 0; padding: 0 14px 6px; }
dialog legend { padding: 0 6px; color: #5e7587; font-size: 12px; }

svg.chart { width: 100%; height: 230px; background: #f8fbfc; }
svg.chart text { font-size: 10px; fill: #6a7f90; }
svg.compact-chart { height: 170px; }
.signal-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.signal-summary .metric { padding: 10px 12px; }
.signal-summary .metric strong { font-size: 18px; margin-top: 5px; }
.optical-legend { margin: 4px 0 8px; }
.rx-key { color: #087f83; font-weight: 700; }
.tx-key { color: #c87827; font-weight: 700; }
.signal-history-table { max-height: 260px; overflow: auto; }
.bar { height: 12px; border-radius: 9px; background: #e6edf1; overflow: hidden; margin: 12px 0 25px; }
.bar i { display: block; height: 100%; background: #39a978; }
.status-row { display: flex; justify-content: space-between; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .sidebar { width: 70px; padding: 20px 7px; }
  .brand { font-size: 17px; margin: 0; }
  .brand-sub, .sidebar .label, .sidebar .foot { display: none; }
  .sidebar a { justify-content: center; padding: 14px 5px; }
  .shell { margin-left: 70px; }
  .main { padding: 20px 13px; }
  .topbar { padding: 0 14px; height: auto; min-height: 75px; }
  .heading { align-items: flex-start; flex-direction: column; }
  .ports { grid-template-columns: repeat(4, 1fr); }
  .metric, .card { padding: 15px; }
  .tools input { min-width: 0; width: 100%; }
  .signal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
