/* AppWatch dashboard – hand-written, no framework. Dark first, light theme supported. */

:root {
  --bg: #0a0d12;
  --bg-elev: #0f131a;
  --surface: #131821;
  --surface-2: #19202b;
  --surface-3: #212937;
  --border: #222a36;
  --border-strong: #303a4a;
  --text: #e8edf4;
  --text-2: #a5afbd;
  --text-3: #6d7887;
  --accent: #8fb3ff;
  --accent-strong: #5d8dff;
  --accent-ink: #0a0d12;
  --up: #3dd68c;
  --up-soft: rgba(61, 214, 140, 0.14);
  --minor: #b5d65a;
  --warn: #f5b44a;
  --warn-soft: rgba(245, 180, 74, 0.14);
  --down: #ff5d6e;
  --down-soft: rgba(255, 93, 110, 0.14);
  --paused: #7b8696;
  --paused-soft: rgba(123, 134, 150, 0.16);
  --pending: #8fb3ff;
  --pending-soft: rgba(143, 179, 255, 0.14);
  --empty-bar: #232b38;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sidebar: 236px;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f4f6f9;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #e8ecf1;
  --border: #e3e7ed;
  --border-strong: #cfd6df;
  --text: #121823;
  --text-2: #4d5868;
  --text-3: #808b9a;
  --accent: #3563e9;
  --accent-strong: #2449c9;
  --accent-ink: #ffffff;
  --up: #12a564;
  --up-soft: rgba(18, 165, 100, 0.1);
  --minor: #86b02b;
  --warn: #d48806;
  --warn-soft: rgba(212, 136, 6, 0.1);
  --down: #e23a4e;
  --down-soft: rgba(226, 58, 78, 0.09);
  --paused: #8a94a3;
  --paused-soft: rgba(138, 148, 163, 0.14);
  --pending: #3563e9;
  --pending-soft: rgba(53, 99, 233, 0.09);
  --empty-bar: #e3e7ed;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f4f6f9;
    --bg-elev: #ffffff;
    --surface: #ffffff;
    --surface-2: #f3f5f8;
    --surface-3: #e8ecf1;
    --border: #e3e7ed;
    --border-strong: #cfd6df;
    --text: #121823;
    --text-2: #4d5868;
    --text-3: #808b9a;
    --accent: #3563e9;
    --accent-strong: #2449c9;
    --accent-ink: #ffffff;
    --up: #12a564;
    --up-soft: rgba(18, 165, 100, 0.1);
    --minor: #86b02b;
    --warn: #d48806;
    --warn-soft: rgba(212, 136, 6, 0.1);
    --down: #e23a4e;
    --down-soft: rgba(226, 58, 78, 0.09);
    --paused: #8a94a3;
    --paused-soft: rgba(138, 148, 163, 0.14);
    --pending: #3563e9;
    --pending-soft: rgba(53, 99, 233, 0.09);
    --empty-bar: #e3e7ed;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.04);
    color-scheme: light;
  }
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 22px;
}
h2 {
  font-size: 15px;
}
h3 {
  font-size: 13px;
}
code,
.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--text-2);
}
.faint {
  color: var(--text-3);
}
.small {
  font-size: 12px;
}
.nowrap {
  white-space: nowrap;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- shell */

.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 18px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 550;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  background: var(--surface-3);
  color: var(--text);
}
.nav-link .badge {
  margin-left: auto;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  gap: 6px;
  padding: 10px 4px 0;
  border-top: 1px solid var(--border);
}

.main {
  min-width: 0;
  padding: 28px 32px 64px;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head .sub {
  margin-top: 4px;
  color: var(--text-2);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  margin-bottom: 12px;
  font-weight: 550;
}

.topbar {
  display: none;
}

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    height: auto;
    z-index: 30;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--border);
  }
  .sidebar .brand,
  .sidebar-foot {
    display: none;
  }
  .nav-link {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    font-size: 11px;
    position: relative;
  }
  .nav-link .badge {
    position: absolute;
    top: 0;
    right: calc(50% - 22px);
    margin: 0;
  }
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev);
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .topbar .brand {
    padding: 0;
  }
  .main {
    padding: 18px 16px calc(96px + env(safe-area-inset-bottom));
  }
  h1 {
    font-size: 19px;
  }
}

/* ---------------------------------------------------------------- buttons & inputs */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.btn.danger {
  color: var(--down);
}
.btn.danger:hover {
  background: var(--down-soft);
  border-color: var(--down);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn.sm {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}
.btn.icon-only {
  width: 34px;
  padding: 0;
}
.btn.sm.icon-only {
  width: 28px;
}
.btn.busy {
  position: relative;
  color: transparent !important;
}
.btn.busy::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-2);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea {
  min-height: 84px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}
.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.input-group {
  display: flex;
  gap: 8px;
}
.input-group > * {
  min-width: 0;
}

.search {
  position: relative;
  min-width: 200px;
}
.search .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}
.search .input {
  padding-left: 32px;
}

/* ---------------------------------------------------------------- forms */

.form {
  display: grid;
  gap: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.form-grid .span-2 {
  grid-column: span 2;
}
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: auto;
  }
}
.field {
  display: grid;
  gap: 6px;
  align-content: start;
}
.field > label,
.field > .label {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
}
.hint {
  font-size: 12px;
  color: var(--text-3);
}
.hint code {
  font-size: 11.5px;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  padding: 2px 0;
}
.check input {
  margin: 3px 0 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: none;
}
.check .t {
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}
.switch input {
  appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  margin: 0;
  flex: none;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked::after {
  transform: translateX(16px);
  background: var(--accent-ink);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
:root[data-theme='light'] .segmented button.active {
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

/* ---------------------------------------------------------------- cards & layout */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head .sub {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
}
.card-body {
  padding: 18px;
}
.card-body.tight {
  padding: 0;
}
.card-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.stack {
  display: grid;
  gap: 16px;
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row.wrap {
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 980px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------- KPIs */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.kpi .label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi .value {
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -0.02em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi .value small {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-left: 3px;
}
.kpi .foot {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-up {
  color: var(--up);
}
.c-minor {
  color: var(--minor);
}
.c-warn {
  color: var(--warn);
}
.c-down {
  color: var(--down);
}
.c-paused {
  color: var(--paused);
}

/* ---------------------------------------------------------------- banners */

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 16px;
  font-weight: 600;
}
.banner .dot {
  width: 10px;
  height: 10px;
}
.banner.up {
  background: var(--up-soft);
  border-color: color-mix(in srgb, var(--up) 35%, transparent);
}
.banner.down {
  background: var(--down-soft);
  border-color: color-mix(in srgb, var(--down) 40%, transparent);
}
.banner.warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}
.banner .muted {
  font-weight: 500;
}

/* ---------------------------------------------------------------- status */

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paused);
  flex: none;
  position: relative;
}
.dot.up {
  background: var(--up);
}
.dot.down {
  background: var(--down);
}
.dot.pending {
  background: var(--pending);
}
.dot.retrying {
  background: var(--warn);
}
.dot.down::after,
.dot.retrying::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: var(--down);
  opacity: 0;
  animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.dot.retrying::after {
  color: var(--warn);
}
@keyframes ping {
  0% {
    transform: scale(0.6);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dot::after {
    animation: none !important;
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--paused-soft);
  color: var(--paused);
}
.pill.up {
  background: var(--up-soft);
  color: var(--up);
}
.pill.down {
  background: var(--down-soft);
  color: var(--down);
}
.pill.pending {
  background: var(--pending-soft);
  color: var(--pending);
}
.pill.retrying,
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill .dot {
  width: 7px;
  height: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--down);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- monitor list */

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.toolbar .search {
  flex: 1;
  max-width: 320px;
}

.mon-list {
  display: grid;
}
.mon-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(160px, 1.2fr) 190px 170px 130px;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  cursor: pointer;
}
.mon-row:last-child {
  border-bottom: 0;
}
.mon-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.mon-name {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.mon-name .dot {
  width: 10px;
  height: 10px;
}
.mon-name .title {
  font-weight: 650;
  color: var(--text);
}
.mon-name .target {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}
.mon-uptimes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  text-align: right;
}
.mon-uptimes .v {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.mon-uptimes .k {
  font-size: 11px;
  color: var(--text-3);
}
.mon-resp {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}
.mon-resp .v {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 52px;
  text-align: right;
}
.mon-meta {
  text-align: right;
  font-size: 12px;
  color: var(--text-3);
  display: grid;
  gap: 4px;
  justify-items: end;
}
@media (max-width: 1180px) {
  .mon-row {
    grid-template-columns: minmax(200px, 1.6fr) minmax(140px, 1fr) 170px 120px;
  }
  .mon-row .mon-resp {
    display: none;
  }
}
@media (max-width: 760px) {
  .mon-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 12px 14px;
  }
  .mon-row .mon-bars-cell {
    grid-column: 1 / -1;
    order: 3;
  }
  .mon-row .mon-uptimes {
    display: none;
  }
}

/* uptime bars */
.bars {
  display: flex;
  gap: 2px;
  align-items: stretch;
  height: 26px;
}
.bars.lg {
  height: 34px;
  gap: 2px;
}
.bars i {
  flex: 1;
  min-width: 2px;
  border-radius: 2px;
  background: var(--empty-bar);
}
.bars i.up {
  background: var(--up);
}
.bars i.minor {
  background: var(--minor);
}
.bars i.warn {
  background: var(--warn);
}
.bars i.down {
  background: var(--down);
}
.bars i:hover {
  opacity: 0.7;
}
.bars-legend {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}

.spark {
  display: block;
  overflow: visible;
}

/* ---------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto;
}
table.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover td {
  background: var(--surface-2);
}
.table td.r,
.table th.r {
  text-align: right;
}
.table .err {
  color: var(--down);
  font-size: 12.5px;
  max-width: 460px;
  word-break: break-word;
}
.table .clickable {
  cursor: pointer;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-2);
}
.empty .big {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 6px;
}
.empty .icon {
  width: 34px;
  height: 34px;
  color: var(--text-3);
  margin-bottom: 10px;
  stroke-width: 1.5;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------- charts */

.chart {
  position: relative;
  width: 100%;
  height: 260px;
}
.chart svg {
  display: block;
  width: 100%;
  height: 100%;
}
.chart .grid line {
  stroke: var(--border);
  stroke-width: 1;
}
.chart .axis text {
  fill: var(--text-3);
  font-size: 11px;
  font-family: var(--font);
}
.chart .band {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
}
.chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .area {
  fill: url(#areaGrad);
}
.chart .fail {
  fill: var(--down);
}
.chart .cursor {
  stroke: var(--text-3);
  stroke-dasharray: 3 3;
}
.chart .cursor-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  white-space: nowrap;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 10px));
}
.chart-tip b {
  font-variant-numeric: tabular-nums;
}
.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-2);
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* floating tooltip for bars */
.tip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  max-width: 280px;
}

/* ---------------------------------------------------------------- detail */

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.detail-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.detail-title .dot {
  width: 12px;
  height: 12px;
}
.detail-meta {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  color: var(--text-2);
  font-size: 12.5px;
  margin-top: 8px;
  align-items: center;
}
.detail-meta a {
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
}

.status-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.status-hero .big {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.status-hero.down {
  border-color: color-mix(in srgb, var(--down) 45%, transparent);
  background: linear-gradient(0deg, var(--down-soft), var(--down-soft)), var(--surface);
}
.status-hero.up {
  border-color: color-mix(in srgb, var(--up) 30%, transparent);
}
.status-hero .ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}
.status-hero.up .ring {
  background: var(--up-soft);
  color: var(--up);
}
.status-hero.down .ring {
  background: var(--down-soft);
  color: var(--down);
}
.status-hero.pending .ring,
.status-hero.paused .ring,
.status-hero.retrying .ring {
  background: var(--paused-soft);
  color: var(--paused);
}
.status-hero.retrying .ring {
  background: var(--warn-soft);
  color: var(--warn);
}
.status-hero .ring .icon {
  width: 22px;
  height: 22px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.timeline li:last-child {
  border-bottom: 0;
}
.timeline .icon {
  margin-top: 2px;
  color: var(--text-3);
}
.timeline .when {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}
.timeline .what {
  min-width: 0;
  word-break: break-word;
}

/* ---------------------------------------------------------------- settings */

.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 2px;
}
.settings-nav a {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 550;
}
.settings-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
@media (max-width: 880px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 4px;
  }
  .settings-nav a {
    white-space: nowrap;
  }
}
.section-anchor {
  scroll-margin-top: 80px;
}

.meter {
  display: grid;
  gap: 6px;
}
.meter .bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.meter .bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--up);
}
.meter.warn .bar > span {
  background: var(--warn);
}
.meter.danger .bar > span {
  background: var(--down);
}
.meter .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.callout {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
}
.callout b {
  color: var(--text);
}
.callout.ok {
  background: var(--up-soft);
  border-color: color-mix(in srgb, var(--up) 30%, transparent);
}
.callout.bad {
  background: var(--down-soft);
  border-color: color-mix(in srgb, var(--down) 35%, transparent);
}
.callout.warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}
.result-line {
  font-size: 12.5px;
  word-break: break-word;
}

/* ---------------------------------------------------------------- login */

.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent), var(--bg);
}
.login .card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
}
.login .logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  margin-bottom: 16px;
}
.login h1 {
  font-size: 20px;
}
.login p {
  margin: 6px 0 20px;
  color: var(--text-2);
}

/* ---------------------------------------------------------------- toast & dialog */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
}
@media (max-width: 880px) {
  .toasts {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}
.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in 0.18s ease-out;
  word-break: break-word;
}
.toast .icon {
  margin-top: 2px;
}
.toast.ok .icon {
  color: var(--up);
}
.toast.err .icon {
  color: var(--down);
}
@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

dialog.modal {
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(460px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
dialog.modal::backdrop {
  background: rgba(5, 8, 12, 0.6);
  backdrop-filter: blur(2px);
}
dialog.modal .body {
  padding: 20px;
}
dialog.modal h2 {
  font-size: 16px;
  margin-bottom: 8px;
}
dialog.modal p {
  margin: 0;
  color: var(--text-2);
}
dialog.modal .foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------- misc */

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.loading-page {
  display: grid;
  gap: 12px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}
.chip:hover {
  color: var(--text);
  background: var(--surface-2);
}
.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.chip .n {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  font-size: 13px;
}
.kv dt {
  color: var(--text-3);
}
.kv dd {
  margin: 0;
  word-break: break-word;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.main-col {
  min-width: 0;
}
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.channel {
  display: grid;
  gap: 8px;
}
.channel .recipients {
  margin-left: 26px;
  max-width: 640px;
}
.test-results {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.test-results .callout {
  display: grid;
  gap: 2px;
}
