/* servicedash - tokens follow the reference data-viz palette.
   Status colors are the reserved status palette and are always paired with a
   text label, never carrying meaning by hue alone. */

:root {
  color-scheme: light;
  --plane:          #f9f9f7;
  --surface:        #fcfcfb;
  --surface-hover:  #f2f1ed;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --hairline:       #e1e0d9;
  --border:         rgba(11, 11, 11, 0.10);
  --accent:         #2a78d6;

  --good:     #0ca30c;
  --warning:  #fab219;
  --critical: #d03b3b;

  --radius: 10px;
  --gap: 12px;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 1px 1px rgba(11, 11, 11, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane:          #0d0d0d;
    --surface:        #1a1a19;
    --surface-hover:  #242423;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --hairline:       #2c2c2a;
    --border:         rgba(255, 255, 255, 0.10);
    --accent:         #3987e5;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:          #0d0d0d;
  --surface:        #1a1a19;
  --surface-hover:  #242423;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --hairline:       #2c2c2a;
  --border:         rgba(255, 255, 255, 0.10);
  --accent:         #3987e5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

/* ---- header ---- */

header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

/* the one hero figure on the view */
.hero {
  font-size: 48px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 2px 0 0;
}
.hero small {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0;
  margin-left: 6px;
}

.meta {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 6px 0 22px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.tools {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
}

input[type="search"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  padding: 7px 11px;
  width: 210px;
}
input[type="search"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button.ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  padding: 7px 11px;
}
button.ghost:has(svg) { align-items: center; display: inline-flex; justify-content: center; }
button.ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
button.ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- groups & grid ---- */

section { margin-bottom: 30px; }

.ghead {
  align-items: center;
  color: var(--text-secondary);
  display: flex;
  font-size: 11.5px;
  font-weight: 600;
  gap: 10px;
  letter-spacing: 0.07em;
  margin: 0 0 11px;
  text-transform: uppercase;
}
.ghead::after {
  background: var(--hairline);
  content: "";
  flex: 1;
  height: 1px;
}

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

/* ---- tile ---- */

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  text-decoration: none;
  transition: background 120ms ease, transform 120ms ease;
}
.tile:hover { background: var(--surface-hover); transform: translateY(-1px); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.icon {
  align-items: center;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  display: flex;
  flex: 0 0 34px;
  height: 34px;
  justify-content: center;
  overflow: hidden;
  width: 34px;
}
.icon img { height: 22px; width: 22px; object-fit: contain; }
.icon span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.names { min-width: 0; }
.name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub {
  color: var(--text-muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* status: dot + text label, so hue is never the only channel */
.status {
  align-items: center;
  display: flex;
  font-size: 12px;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}
.dot {
  border-radius: 50%;
  flex: 0 0 8px;
  height: 8px;
  width: 8px;
}
.s-up   .dot { background: var(--good); }
.s-down .dot { background: var(--critical); }
.s-warn .dot { background: var(--warning); }
.s-none .dot { background: var(--text-muted); opacity: 0.5; }

.s-up   .label { color: var(--good); }
.s-down .label { color: var(--critical); }
.s-warn .label { color: var(--text-secondary); }
.s-none .label { color: var(--text-muted); }
.label { font-weight: 600; }

.latency {
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* widget rows - a column of aligned numbers, so tabular figures apply */
.widget {
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 3px;
  padding-top: 9px;
}
.row {
  display: flex;
  font-size: 12.5px;
  gap: 10px;
  justify-content: space-between;
}
.row dt { color: var(--text-secondary); margin: 0; }
.row dd {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin: 0;
}
.detail {
  color: var(--text-muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.werr {
  align-items: baseline;
  color: var(--text-muted);
  display: flex;
  font-size: 11.5px;
  gap: 5px;
}
.werr b { color: var(--warning); }

.empty { color: var(--text-muted); padding: 40px 0; text-align: center; }

@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tools { margin-left: 0; width: 100%; }
  input[type="search"] { flex: 1; width: auto; }
}

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

.login {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  width: 100%;
  max-width: 330px;
}
.card h1 { margin-bottom: 18px; }
.card label {
  color: var(--text-secondary);
  display: block;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.card input[type="password"] {
  background: var(--plane);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  margin-bottom: 14px;
  padding: 9px 11px;
  width: 100%;
}
.card input[type="password"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.card button {
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 9px;
  width: 100%;
}
.card button:hover { filter: brightness(1.07); }
.err {
  align-items: baseline;
  color: var(--text-secondary);
  display: flex;
  font-size: 12.5px;
  gap: 6px;
  margin-bottom: 14px;
}
.err b { color: var(--critical); }
