:root {
  color-scheme: dark;
  --bg: #14171b;
  --bg-accent: #1b1f25;
  --card: rgba(27, 33, 40, 0.88);
  --card-border: rgba(108, 122, 137, 0.25);
  --text: #e6edf5;
  --muted: #98a6b3;
  --green: #2bd47f;
  --orange: #f6a63a;
  --red: #ff5c5c;
  --gray: #6c7a88;
  --teal: #35c8c1;
  --shadow: 0 24px 60px rgba(5, 10, 15, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% -10%, rgba(53, 200, 193, 0.2), transparent 50%),
    radial-gradient(circle at 90% 10%, rgba(246, 166, 58, 0.15), transparent 45%),
    linear-gradient(135deg, #111317 0%, #1a1f26 50%, #121519 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.2;
  pointer-events: none;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  gap: 18px;
  align-items: center;
}

.brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), #4de1a1);
  box-shadow: 0 0 24px rgba(53, 200, 193, 0.6);
}

.brand h1 {
  font-size: 22px;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}

.brand p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.meta {
  font-family: "IBM Plex Mono", "Fira Code", monospace;
  font-size: 13px;
  color: var(--muted);
  padding: 10px 16px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(20, 23, 27, 0.7);
}

.table-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px 18px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  margin-bottom: 12px;
}

.table-header .hint {
  font-size: 12px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table-wrapper {
  overflow-x: auto;
  flex: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

thead th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 12px 12px;
}

tbody td {
  padding: 16px 12px;
  border-top: 1px solid rgba(108, 122, 137, 0.18);
  font-size: 15px;
}

thead th:nth-child(3),
tbody td:nth-child(3) {
  padding-right: 2px;
}

thead th:nth-child(4),
tbody td:nth-child(4) {
  padding-left: 2px;
}

tbody tr:hover {
  background: rgba(32, 38, 46, 0.65);
}

.client-name {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-cell,
.camera-cell,
.disk-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.camera-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.camera-primary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.timeline-row {
  justify-self: start;
}

.camera-state-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.camera-uptime-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.camera-state-cell .status-dot.has-tooltip {
  display: inline-flex;
}

.camera-state-cell .status-dot.has-tooltip .tooltip {
  left: 0;
  top: 100%;
  margin-top: 10px;
  min-width: 220px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gray);
  position: relative;
  flex: 0 0 12px;
}

.status-dot.pulse::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(43, 212, 127, 0.35);
  animation: pulse 2.2s infinite;
}

.status-up {
  background: var(--green);
  box-shadow: 0 0 16px rgba(43, 212, 127, 0.55);
}

.status-down {
  background: var(--red);
  box-shadow: 0 0 16px rgba(255, 92, 92, 0.45);
}

.status-missing {
  background: var(--gray);
  box-shadow: 0 0 16px rgba(108, 122, 137, 0.35);
}

.badge {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(35, 42, 50, 0.7);
  font-family: "IBM Plex Mono", monospace;
}

.badge-ok {
  color: var(--green);
  border-color: rgba(43, 212, 127, 0.4);
}

.badge-warn {
  color: var(--orange);
  border-color: rgba(246, 166, 58, 0.4);
}

.badge-danger {
  color: var(--red);
  border-color: rgba(255, 92, 92, 0.4);
}

.badge-none {
  color: var(--gray);
  border-color: rgba(108, 122, 137, 0.4);
}

.has-tooltip {
  position: relative;
}

.tooltip {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 10px;
  min-width: 240px;
  background: #0f1216;
  border: 1px solid rgba(108, 122, 137, 0.4);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
  box-shadow: 0 16px 36px rgba(5, 10, 15, 0.45);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.tooltip-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tooltip ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.has-tooltip:hover .tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.timeline-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid rgba(108, 122, 137, 0.35);
  background: rgba(15, 18, 22, 0.6);
}

.timeline-indicator.ok {
  border-color: rgba(43, 212, 127, 0.4);
}

.timeline-indicator.warn {
  border-color: rgba(246, 166, 58, 0.4);
}

.timeline-indicator:hover .timeline-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.timeline-indicator[data-open="true"] .timeline-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.timeline-tooltip:hover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.timeline {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 2px;
}

.timeline.preview {
  grid-auto-columns: 4px;
  height: 10px;
}

.timeline.detail {
  grid-auto-columns: 8px;
  height: 14px;
  margin-top: 6px;
}

.segment {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: rgba(108, 122, 137, 0.4);
}

.segment.up {
  background: var(--green);
}

.segment.partial {
  background: var(--orange);
}

.segment.down {
  background: var(--red);
}

.segment.none {
  background: rgba(108, 122, 137, 0.4);
}

.timeline-tooltip {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0;
  min-width: 260px;
  background: #0f1216;
  border: 1px solid rgba(108, 122, 137, 0.4);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
  box-shadow: 0 16px 36px rgba(5, 10, 15, 0.45);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 12;
}

.timeline-detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.timeline-legend {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-item.ok::before {
  background: var(--green);
}

.legend-item.warn::before {
  background: var(--orange);
}

.legend-item.danger::before {
  background: var(--red);
}

.metric-text {
  color: var(--text);
}

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

.empty-state {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.8;
  }
  70% {
    transform: scale(1.2);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 36px 16px 56px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  table {
    min-width: 560px;
  }
}
