:root {
  --bg: #070a0f;
  --panel: #101722;
  --panel2: #0c111a;
  --text: #e8f0ff;
  --muted: #7d8da8;
  --accent: #5eead4;
  --accent2: #38bdf8;
  --border: rgba(255,255,255,.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.16), transparent 35%),
    radial-gradient(circle at top right, rgba(94,234,212,.10), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  letter-spacing: -0.06em;
  text-transform: lowercase;
}

.hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.clock {
  text-align: right;
  padding-top: 10px;
}

.clock span {
  display: block;
  font-size: 24px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

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

.band-card {
  display: grid;
  grid-template-columns: 1fr 1.8fr auto;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, rgba(16,23,34,.95), rgba(12,17,26,.88));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  margin-bottom: 18px;
}

.band-card h2 {
  margin: 0;
  font-size: 28px;
}

.band-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.meter {
  height: 22px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.meter div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: inherit;
  transition: width .35s ease;
}

.band-stats {
  text-align: right;
}

.band-stats strong {
  display: block;
  font-size: 38px;
  color: var(--accent);
  line-height: 1;
}

.band-stats span {
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  align-items: center;
}

input,
select {
  width: 100%;
  background: rgba(10,15,24,.88);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 15px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(94,234,212,.55);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10,15,24,.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 14px;
  color: var(--muted);
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  background: rgba(10,15,24,.80);
  border: 1px solid var(--border);
  border-radius: 18px;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.055);
  text-align: left;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #0d1420;
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}

td:first-child {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

tr:hover td {
  background: rgba(255,255,255,.035);
}

@media (max-width: 800px) {
  .app {
    padding: 18px;
  }

  .hero,
  .band-card,
  .controls {
    grid-template-columns: 1fr;
  }

  .hero {
    display: block;
  }

  .clock,
  .band-stats {
    text-align: left;
  }

  .toggle {
    min-height: 48px;
  }
}

.version {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(10,15,24,.72);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 8px;
  padding: 16px 2px;
  color: var(--muted);
  font-size: 13px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-links {
  display: flex;
  gap: 14px;
}

@media (max-width: 800px) {
  .footer {
    flex-direction: column;
  }
}

.activity-card {
  background: rgba(10,15,24,.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.activity-bands {
  display: grid;
  gap: 10px;
}

.activity-row {
  display: grid;
  grid-template-columns: 52px 1fr 50px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.activity-name {
  color: var(--text);
  font-weight: 700;
}

.activity-meter {
  height: 10px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
}

.activity-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.activity-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr.live-row td {
  background: rgba(94,234,212,.035);
}

tr.live-row td:first-child {
  position: relative;
}

tr.live-row td:first-child::before {
  content: "●";
  color: var(--accent);
  margin-right: 7px;
  font-size: 10px;
}

tr {
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.68);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  background: #0d1420;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  position: relative;
}

.modal-card h2 {
  margin: 0 0 12px;
  color: var(--accent);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
}

.modal-meta {
  display: grid;
  gap: 8px;
}

.modal-meta div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding-bottom: 8px;
}

.modal-meta span {
  color: var(--muted);
}

.insights-grid {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 18px;
  margin-bottom: 18px;
}

.insight-card {
  background: rgba(10,15,24,.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.target-list {
  display: grid;
  gap: 10px;
}

.target-row {
  display: grid;
  grid-template-columns: 130px 1fr 46px;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.target-name {
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-meter {
  height: 10px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
}

.target-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.target-count {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.snapshot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.snapshot div {
  background: rgba(255,255,255,.035);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

.snapshot strong {
  display: block;
  color: var(--accent);
  font-size: 34px;
  line-height: 1;
}

.snapshot span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.muted-toggle {
  opacity: .55;
}

.clock span::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: pulseDot 1.8s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% {
    opacity: .35;
    transform: scale(.75);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}


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

.auto-btn {
  background: linear-gradient(135deg, rgba(94,234,212,.18), rgba(56,189,248,.14));
  color: var(--accent);
  border: 1px solid rgba(94,234,212,.35);
  border-radius: 14px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.auto-btn:hover {
  border-color: rgba(94,234,212,.75);
  box-shadow: 0 0 20px rgba(94,234,212,.12);
}

.band-reason {
  color: var(--accent);
  font-size: 13px;
  margin-top: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.controls input[type="search"] {
  flex: 1 1 320px;
  min-width: 220px;
}

.controls select {
  min-width: 110px;
}

.auto-btn {
  flex-shrink: 0;
}

.toggle input {
  width: 18px;
  height: 18px;

}

/* iPad / Safari controls fix */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  align-items: stretch;
}

.controls input[type="search"] {
  flex: 1 1 360px;
  min-width: 260px;
}

.controls select {
  flex: 0 0 130px;
  width: auto;
  min-width: 130px;
}

.auto-btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 18px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 14px;
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: #5eead4;
}

.toggle span {
  display: inline-block;
  line-height: 1;
}

@media (max-width: 700px) {
  .controls input[type="search"] {
    flex-basis: 100%;
    min-width: 100%;
  }
}

.empty-row {
  text-align: center;
  color: var(--muted) !important;
  padding: 28px 14px;
  font-style: italic;
}

.live-row {
  transition: background .25s ease;
}

.band-card,
.activity-card,
.insight-card,
.table-wrap {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

@media (max-width: 700px) {
  h1 {
    font-size: 40px;
  }

  .band-card {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
  }

  .target-row {
    grid-template-columns: 110px 1fr 38px;
  }

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

.about-btn {
  display: inline-block;
  margin-left: 8px;
  margin-bottom: 6px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  background: rgba(10,15,24,.72);
  cursor: pointer;
}

.about-btn:hover {
  border-color: rgba(94,234,212,.55);
}

.about-card {
  max-height: min(760px, 88vh);
  overflow: auto;
}

.about-section {
  margin-top: 18px;
}

.about-section h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 16px;
}

.about-section p,
.about-section li {
  color: var(--muted);
  line-height: 1.55;
}

.about-section ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.log-row {
  display: grid;
  grid-template-columns: 100px 110px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.log-row span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.log-row strong {
  color: var(--accent);
  font-size: 13px;
}

.log-row p {
  margin: 0;
}

@media (max-width: 700px) {
  .log-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.conditions-card {
  background: rgba(10,15,24,.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.conditions-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.conditions-top strong {
  display: block;
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
}

.conditions-top span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.condition-bands {
  display: grid;
  gap: 10px;
}

.condition-row {
  display: grid;
  grid-template-columns: 52px 1fr 92px;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.condition-name {
  color: var(--text);
  font-weight: 700;
}

.condition-meter {
  height: 10px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
}

.condition-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.condition-label {
  color: var(--muted);
  text-align: right;
  font-size: 13px;
}

@media (max-width: 700px) {
  .conditions-top {
    flex-direction: column;
    align-items: stretch;
  }

  .condition-row {
    grid-template-columns: 52px 1fr 78px;
  }
}

/* Cross-browser custom checkboxes - compact */
.toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin: 0;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.toggle input[type="checkbox"]:checked {
  background: rgba(94,234,212,.85);
  border-color: rgba(94,234,212,.95);
  box-shadow: 0 0 10px rgba(94,234,212,.18);
}

.toggle input[type="checkbox"]:checked::after {
  content: none;
}

.toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(94,234,212,.45);
  outline-offset: 3px;
}

.toggle:has(input[type="checkbox"]:checked) {
  color: var(--text);
  border-color: rgba(94,234,212,.22);
  background: rgba(94,234,212,.055);
}

/* Buttons */
.auto-btn,
.about-btn {
  appearance: none;
  -webkit-appearance: none;

  background: linear-gradient(
    135deg,
    rgba(94,234,212,.16),
    rgba(56,189,248,.12)
  );

  color: var(--accent);
  border: 1px solid rgba(94,234,212,.28);
  border-radius: 14px;

  padding: 0 16px;
  min-height: 46px;

  font-size: 14px;
  font-weight: 700;

  cursor: pointer;

  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

.auto-btn:hover,
.about-btn:hover {
  border-color: rgba(94,234,212,.65);

  box-shadow:
    0 0 20px rgba(94,234,212,.10),
    inset 0 0 0 1px rgba(255,255,255,.03);
}

.auto-btn:active,
.about-btn:active {
  transform: translateY(1px);
}