:root {
  --navy:      #002B5C;
  --navy-dark: #001E42;
  --red:       #C8102E;
  --green:     #1A8754;
  --bg:        #0E1422;
  --panel:     #18203A;
  --line:      #25304D;
  --ink:       #F5F7FB;
  --muted:     #8492B5;
  --accent:    #6FA3FF;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Lock screen */
.lock {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 100;
}
.lock-card {
  background: var(--panel);
  padding: 32px;
  border-radius: 8px;
  width: 320px;
  border-top: 3px solid var(--navy);
}
.lock-card h1 { margin: 0 0 4px; font-size: 20px; }
.lock-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.lock-card input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lock-card input:focus { outline: none; border-color: var(--accent); }
.lock-card button {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.lock-card button:hover { background: var(--navy-dark); }
.lock-error { color: var(--red); margin-top: 12px; min-height: 16px; font-size: 12px; }

/* App */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-dot {
  width: 10px;
  height: 10px;
  background: var(--red);
  border-radius: 50%;
}
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s;
}
.conn-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.conn-dot.err { background: var(--red); }
.lock-out {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.lock-out:hover { color: var(--ink); border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border-radius: 8px;
  padding: 20px;
  border-top: 2px solid var(--navy);
  min-height: 110px;
}
.card.big { border-top-color: var(--accent); }
.card.wide { grid-column: span 2; }
@media (max-width: 900px) { .card.wide { grid-column: span 2; } }
@media (max-width: 560px) { .card.wide { grid-column: span 1; } }

.card-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.card-num {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.top-links, .recent {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  max-height: 240px;
  overflow-y: auto;
}
.top-links li, .recent li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.top-links li:last-child, .recent li:last-child { border-bottom: none; }
.top-links .label, .recent .label { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.top-links .count { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.recent .time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-style: italic; justify-content: center !important; }

.foot {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 16px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
}

/* Router status panel */
.card.router {
  border-top-color: #ff8a3d;
}
.router-age {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
}
.router-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-top: 4px;
}
@media (max-width: 900px) {
  .router-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .router-grid { grid-template-columns: repeat(2, 1fr); }
}
.r-cell {
  background: var(--bg);
  padding: 12px 10px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid var(--line);
}
.r-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.r-lbl {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.router-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
  font-style: italic;
}
