/* devmonitor design system
   ------------------------------------------------------------------
   One accent, a neutral ramp, and four semantic colours. Everything else is
   spacing and type. Dark is the default because this is a monitoring tool that
   sits open on a second screen; light is fully supported. */

:root {
  color-scheme: dark;

  /* Neutrals — slightly cool, so the accent reads warm against them. */
  --bg:        #0b0d12;
  --bg-soft:   #10131a;
  --surface:   #141821;
  --surface-2: #1a1f2b;
  --border:    #232a38;
  --border-soft: #1b212c;

  --text:      #e8ecf3;
  --text-dim:  #9aa5b8;
  --text-faint:#6b7688;

  /* Accent */
  --accent:    #6366f1;
  --accent-hi: #818cf8;
  --accent-bg: rgba(99, 102, 241, 0.14);

  /* Semantic */
  --ok:      #22c55e;   --ok-bg:   rgba(34, 197, 94, 0.13);
  --warn:    #f59e0b;   --warn-bg: rgba(245, 158, 11, 0.13);
  --bad:     #ef4444;   --bad-bg:  rgba(239, 68, 68, 0.13);
  --idle:    #64748b;   --idle-bg: rgba(100, 116, 139, 0.15);

  --radius:    12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow:    0 4px 16px -4px rgba(0,0,0,.5);
  --shadow-lg: 0 18px 48px -12px rgba(0,0,0,.65);

  --sidebar-w: 236px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:        #f6f7f9;
  --bg-soft:   #eef0f4;
  --surface:   #ffffff;
  --surface-2: #f7f8fa;
  --border:    #dfe3ea;
  --border-soft: #e9ecf1;
  --text:      #111827;
  --text-dim:  #556072;
  --text-faint:#8b95a6;
  --accent-bg: rgba(99, 102, 241, 0.10);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow:    0 4px 14px -4px rgba(16,24,40,.12);
  --shadow-lg: 0 18px 40px -12px rgba(16,24,40,.18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: .88em; }

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

.shell { display: flex; min-height: 100vh; }

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

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
  font-size: 16px; font-weight: 650; letter-spacing: -.01em;
  color: var(--text);
}
.brand .dot {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: grid; place-items: center; font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--text-faint); }

.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500; font-size: 14px;
  transition: background .13s ease, color .13s ease;
}
.nav-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-bg); color: var(--accent-hi); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .9; }
.nav-item .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-dim);
  padding: 1px 7px; border-radius: var(--radius-pill);
}

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.who { padding: 6px 10px; font-size: 12.5px; color: var(--text-faint); word-break: break-all; }

.main { flex: 1 1 auto; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.015em; }
.topbar .sub { color: var(--text-faint); font-size: 12.5px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 56px; max-width: 1280px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; overflow-x: auto;
    padding: 10px; gap: 6px;
  }
  .brand { padding: 0 10px 0 4px; }
  .brand small, .nav-label, .sidebar-foot { display: none; }
  .nav-item { white-space: nowrap; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 0 0 18px;
  overflow: hidden;
}
.card > .head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
}
.card > .head h2 {
  margin: 0; font-size: 12px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim);
}
.card > .head .right { margin-left: auto; }
.card > .body { padding: 16px; }
.card > .body.tight { padding: 0; }

/* ------------------------------------------------------------------- stats */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent); opacity: .55;
}
.stat.ok::after   { background: var(--ok); }
.stat.warn::after { background: var(--warn); }
.stat.bad::after  { background: var(--bad); }
.stat .n {
  font-size: 27px; font-weight: 680; line-height: 1.1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.stat .l {
  margin-top: 3px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint);
}
.stat .hint { margin-top: 6px; font-size: 12px; color: var(--text-dim); }

/* ------------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 650; letter-spacing: .02em;
  border: 1px solid transparent; white-space: nowrap;
}
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.pill.ok   { color: var(--ok);   background: var(--ok-bg);   border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.pill.bad  { color: var(--bad);  background: var(--bad-bg);  border-color: color-mix(in srgb, var(--bad) 28%, transparent); }
.pill.idle { color: var(--idle); background: var(--idle-bg); border-color: color-mix(in srgb, var(--idle) 30%, transparent); }
.pill.accent { color: var(--accent-hi); background: var(--accent-bg); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.pill.plain::before { display: none; }

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

.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; }
thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint);
  text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: 14px; vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap, th.nowrap { white-space: nowrap; }
.t-strong { font-weight: 600; }
.t-dim { color: var(--text-dim); }
.t-faint { color: var(--text-faint); font-size: 13px; }

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

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin: 0 0 6px; }

input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; padding: 9.5px 12px;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; transition: border-color .13s ease, box-shadow .13s ease;
}
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
input::placeholder { color: var(--text-faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); font: inherit; font-weight: 550;
  cursor: pointer; transition: background .13s ease, border-color .13s ease, transform .06s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--border-soft); border-color: var(--text-faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5.5px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn svg { width: 15px; height: 15px; }

form.inline { display: inline; }

.searchbar { display: flex; gap: 10px; align-items: stretch; }
.searchbar input { flex: 1 1 auto; }

/* ------------------------------------------------------------------ flashes */

.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid; margin: 0 0 14px; font-size: 14px;
}
.flash.ok    { background: var(--ok-bg);   border-color: color-mix(in srgb, var(--ok) 32%, transparent); }
.flash.error { background: var(--bad-bg);  border-color: color-mix(in srgb, var(--bad) 32%, transparent); }
.flash.warn  { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }

/* -------------------------------------------------------------- empty state */

.empty { padding: 34px 22px; text-align: center; }
.empty .icon {
  width: 42px; height: 42px; margin: 0 auto 12px;
  display: grid; place-items: center; border-radius: 11px;
  background: var(--surface-2); color: var(--text-faint);
}
.empty h3 { margin: 0 0 6px; font-size: 15px; font-weight: 620; }
.empty p { margin: 0 auto; max-width: 62ch; color: var(--text-dim); font-size: 13.5px; }
.empty .cta { margin-top: 16px; }

/* ---------------------------------------------------------- coverage strip */

.strip { display: flex; gap: 2px; align-items: flex-end; height: 34px; }
.strip i {
  flex: 1 1 auto; min-width: 2px; border-radius: 2px;
  background: var(--idle); opacity: .5;
}
.strip i.ok    { background: var(--ok); opacity: .85; height: 100%; }
.strip i.idle  { background: var(--idle); height: 55%; }
.strip i.bad   { background: var(--bad); height: 100%; }
.strip i.warn  { background: var(--warn); height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-faint); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* --------------------------------------------------------------- occupancy */

.meter { display: flex; align-items: center; gap: 9px; min-width: 132px; }
.meter .track {
  flex: 1 1 auto; height: 6px; border-radius: 3px;
  background: var(--surface-2); overflow: hidden;
}
.meter .fill { height: 100%; border-radius: 3px; background: var(--accent); }
.meter .fill.hot  { background: var(--bad); }
.meter .fill.warm { background: var(--warn); }
.meter .fill.cool { background: var(--ok); }
.meter .v { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-dim); min-width: 38px; text-align: right; }

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

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth {
  width: 100%; max-width: 392px;
}
.auth .logo {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  margin-bottom: 6px; font-size: 21px; font-weight: 680; letter-spacing: -.02em;
}
.auth .logo .dot {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: grid; place-items: center; font-size: 17px;
  box-shadow: var(--shadow);
}
.auth .tag { text-align: center; color: var(--text-faint); font-size: 13px; margin: 0 0 22px; }
.auth .card { box-shadow: var(--shadow-lg); margin: 0; }
.auth .field { margin-bottom: 14px; }
.auth .foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-faint); }

/* ------------------------------------------------------------------ utility */

.row-flex { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }
.stack > * + * { margin-top: 14px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
