/* ETA status dashboard — visual language borrowed from
   tourbot/mtourbot/styles/style.css and etadventures.com:
   Work Sans typeface, deep navy primary text, ETA green for action,
   restrained surface treatment, 4px border-radius on controls. */

:root {
  /* Tourbot tokens (verbatim from /mtourbot/styles/style.css) */
  --blue: hsl(208.5deg 100% 15.69%);
  --light-blue: hsl(208.5deg 100% 29%);
  --green: hsl(140 50% 30% / 1);
  --light-green: hsl(140 50% 35% / 1);
  --gray: hsl(0 0% 53% / 1);
  --light-gray: hsl(0 0% 94% / 1);
  --off-white: hsl(0 0% 97% / 1);
  --red: hsl(0.72deg 66.94% 51.37%);
  --dark-red: hsl(1 64% 47% / 1);
  --yellow: hsl(60deg 100% 51%);

  /* Dashboard-specific derivations (status colors are softened so
     they read as states, not warnings to dismiss). */
  --status-green:  hsl(140 50% 35%);
  --status-yellow: hsl(38 95% 45%);
  --status-red:    hsl(1 64% 47%);
  --status-grey:   hsl(0 0% 70%);

  --bold: 700;
  --readable-width: 75ch;

  --surface:        #ffffff;
  --surface-alt:    var(--off-white);
  --border:         var(--light-gray);
  --border-strong:  hsl(0 0% 85%);

  --shadow-sm: 0 1px 2px hsl(208 30% 20% / 0.04);
  --shadow-md: 0 4px 14px hsl(208 30% 20% / 0.08);

  /* Semantic role tokens — overridden in dark mode. */
  --text:           var(--blue);
  --text-muted:     var(--gray);
  --link:           var(--light-blue);
  --focus-ring:     hsl(208.5deg 100% 29% / 0.15);
}

/* Dark mode: triggered by either a manual toggle (data-theme="dark")
   or the OS preference (when no manual override is set). */
:root[data-theme="dark"],
:root[data-theme="dark"] body {
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

:root[data-theme="dark"] {
  --surface:       #161a22;
  --surface-alt:   #0f1115;
  --border:        #262c38;
  --border-strong: #36404f;

  --text:          #e6e9ef;
  --text-muted:    #8a93a4;
  --link:          #7fb1ff;
  --focus-ring:    hsl(208 70% 60% / 0.25);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 6px 20px rgb(0 0 0 / 0.45);

  /* Status hues stay the same wavelength but lift in lightness so
     they don't sink into the dark surface. */
  --status-green:  hsl(140 55% 55%);
  --status-yellow: hsl(40 92% 60%);
  --status-red:    hsl(1 75% 62%);
  --status-grey:   hsl(0 0% 50%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface:       #161a22;
    --surface-alt:   #0f1115;
    --border:        #262c38;
    --border-strong: #36404f;

    --text:          #e6e9ef;
    --text-muted:    #8a93a4;
    --link:          #7fb1ff;
    --focus-ring:    hsl(208 70% 60% / 0.25);

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
    --shadow-md: 0 6px 20px rgb(0 0 0 / 0.45);

    --status-green:  hsl(140 55% 55%);
    --status-yellow: hsl(40 92% 60%);
    --status-red:    hsl(1 75% 62%);
    --status-grey:   hsl(0 0% 50%);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  font-family: 'Work Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--surface-alt);
}
body {
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: var(--bold);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
.brand .brand-accent { color: var(--light-green); }
.who { color: var(--text-muted); margin-right: 12px; font-size: 0.85rem; }
.logout-form { display: inline-flex; align-items: center; }

main { padding: 28px 24px; max-width: 1200px; margin: 0 auto; }
.muted { color: var(--text-muted); }

/* ---------- top-bar actions cluster ---------- */
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ---------- dark-mode toggle ---------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
}
.btn-icon:hover {
  color: var(--text);
  background: var(--surface-alt);
}
.theme-icon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root:not([data-theme="dark"]) .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]) .icon-sun  { display: block; }
}
.small { font-size: 0.8rem; }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.45rem 1.1rem;
  border-radius: 4px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s ease-in-out, border-color 0.1s ease-in-out;
}
.btn-primary {
  background: var(--light-green);
  color: #fff;
  border-color: var(--light-green);
}
.btn-primary:hover { background: var(--green); border-color: var(--green); }
.btn-ghost { border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-alt); }

/* ---------- gate (sign-in) cards ---------- */
.gate-card {
  max-width: 440px;
  margin: 64px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 32px 32px 28px;
  box-shadow: var(--shadow-md);
}
.gate-card h1 {
  margin: 0 0 6px 0;
  font-size: 1.5rem;
  font-weight: var(--bold);
  color: var(--text);
}
.gate-card .muted { font-size: 0.95rem; }
.gate-card label {
  display: block;
  margin: 18px 0 6px 0;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.gate-card input {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
}
.gate-card input:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.gate-card .btn { margin-top: 18px; }

.error {
  background: hsl(1 64% 47% / 0.10);
  border: 1px solid hsl(1 64% 47% / 0.35);
  color: var(--status-red);
  padding: 10px 12px;
  border-radius: 4px;
  margin: 14px 0 0 0;
  font-size: 0.9rem;
}

/* ---------- dashboard summary pills ---------- */
.dash-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.pill {
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  background: var(--surface);
}
.pill-green  { background: hsl(140 50% 35% / 0.10);   color: var(--status-green);  border-color: hsl(140 50% 35% / 0.4); }
.pill-yellow { background: hsl(38 95% 45% / 0.10);    color: var(--status-yellow); border-color: hsl(38 95% 45% / 0.4); }
.pill-red    { background: hsl(1 64% 47% / 0.10);     color: var(--status-red);    border-color: hsl(1 64% 47% / 0.4); }

/* ---------- server cards grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.card.status-green  { border-left-color: var(--status-green); }
.card.status-yellow { border-left-color: var(--status-yellow); }
.card.status-red    { border-left-color: var(--status-red); }
.card.status-grey   { border-left-color: var(--status-grey); }

.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: var(--bold);
  color: var(--text);
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-green  { background: var(--status-green); }
.dot-yellow { background: var(--status-yellow); }
.dot-red    { background: var(--status-red); }
.dot-grey   { background: var(--status-grey); }

.card-meta div:first-child {
  color: var(--text);
  font-size: 0.85rem;
}
.card-meta .muted {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.probe-list {
  list-style: none;
  margin: 0; padding: 8px 0 0 0;
  display: flex; flex-direction: column; gap: 4px;
  border-top: 1px solid var(--border);
}
.probe-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}
.probe-name {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  flex: none;
}
.probe-result {
  text-align: right;
  max-width: 70%;
  word-break: break-word;
  color: var(--text);
}
.probe-ok  { color: var(--status-green); }
.probe-bad { color: var(--status-red); }

.footer {
  margin-top: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}
