:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fbff;
  --text: #111827;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #dce3ee;
  --line-strong: #c9d3e2;
  --cyan: #0ea5e9;
  --blue: #2563eb;
  --green: #16a34a;
  --emerald: #059669;
  --amber: #f59e0b;
  --red: #dc2626;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(14, 165, 233, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 165, 233, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--text);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 245px;
  gap: 12px;
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 36px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand strong {
  font-size: 18px;
  font-weight: 800;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.search {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.search span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.filter {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.filter.is-active {
  color: var(--text);
  background: #eef7ff;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.22);
}

.clock {
  min-width: 128px;
  text-align: right;
}

.clock strong,
.clock span {
  display: block;
}

.clock strong {
  font-size: 22px;
  line-height: 1.1;
}

.clock span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

main {
  width: min(1500px, calc(100% - 32px));
  margin: 18px auto 36px;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) repeat(3, minmax(180px, 260px));
  gap: 16px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 255, 0.94));
  box-shadow: var(--shadow);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
  letter-spacing: 0;
}

.summary-band p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
}

.signal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: #0f7a45;
  font-size: 13px;
  font-weight: 800;
}

.signal span,
.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.metric {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  column-gap: 14px;
  align-items: center;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: var(--radius);
  color: var(--blue);
  background: #eff6ff;
  font-size: 12px;
  font-weight: 900;
}

.metric-icon.accent {
  color: var(--emerald);
  background: #ecfdf5;
}

.metric-icon.warn {
  color: #b45309;
  background: #fffbeb;
}

.metric strong {
  font-size: 34px;
  line-height: 1;
}

.metric small {
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.directory,
.rail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.section-head,
.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.section-head h2,
.rail-head h2 {
  font-size: 18px;
}

.section-head p,
.rail-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.select-label {
  display: grid;
  gap: 5px;
  min-width: 184px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.select-label select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
}

.service-groups {
  display: grid;
}

.group {
  padding: 14px 18px 18px;
  border-bottom: 1px solid var(--line);
}

.group:last-child {
  border-bottom: 0;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.group-title h3 {
  font-size: 15px;
  font-weight: 900;
}

.group-title span {
  min-width: 28px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(246px, 1fr));
  gap: 10px;
}

.service-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.service-card:hover,
.service-card:focus-visible {
  border-color: rgba(14, 165, 233, 0.62);
  box-shadow: 0 12px 22px rgba(14, 165, 233, 0.12);
  outline: 0;
  transform: translateY(-1px);
}

.badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: var(--blue);
  background: #eff6ff;
  font-size: 12px;
  font-weight: 900;
}

.service-card[data-access="public"] .badge {
  color: var(--emerald);
  background: #ecfdf5;
}

.service-card[data-access="netbird"] .badge {
  color: var(--cyan);
  background: #ecfeff;
}

.service-card[data-access="lan"] .badge {
  color: #b45309;
  background: #fffbeb;
}

.card-main {
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-top strong {
  overflow: hidden;
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-top .status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.card-top .status-dot.auth {
  background: var(--blue);
}

.card-top .status-dot.private {
  background: var(--amber);
}

.url {
  overflow: hidden;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desc {
  margin-top: 7px;
  color: #475467;
  font-size: 12px;
  line-height: 1.35;
}

.meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.meta span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 800;
}

.right-rail {
  display: grid;
  gap: 14px;
}

.rail-panel {
  padding: 16px;
}

.status-list {
  display: grid;
  gap: 13px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.status-list li {
  display: grid;
  grid-template-columns: 12px 42px 1fr;
  align-items: center;
  gap: 11px;
}

.status-list strong {
  font-size: 18px;
}

.status-list small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dot.live {
  background: var(--green);
}

.dot.netbird {
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

.dot.lan {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.13);
}

.dot.auth {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.quick-links {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.quick-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.quick-links a span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.host-map {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.host-map div {
  display: grid;
  gap: 4px;
  padding-left: 12px;
  border-left: 3px solid var(--cyan);
}

.host-map strong {
  font-size: 13px;
}

.host-map span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.empty-state {
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .brand {
    min-width: 0;
  }

  .clock {
    text-align: left;
  }

  .summary-band,
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  main {
    width: min(100% - 20px, 1500px);
  }

  .topbar {
    padding: 12px;
    gap: 10px;
  }

  .filters {
    overflow-x: auto;
  }

  .filter {
    flex: 1 0 auto;
  }

  .summary-band {
    padding: 14px;
  }

  .metric {
    min-height: 88px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .cards {
    grid-template-columns: 1fr;
  }
}
