/* Portal shell: design tokens, sidebar, and shared controls.
 *
 * The tokens below are the dashboard's original palette, lifted out so every
 * page — public status, login, dashboard, per-API pages — shares one source of
 * truth instead of drifting apart copy by copy.
 *
 * This file is served publicly (the login page needs it), so it must never
 * contain anything that is not styling.
 */

:root {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #898781;
  --grid:        #e1e0d9;
  --border:      rgba(11,11,11,0.10);
  --good:        #0ca30c;
  --warning:     #fab219;
  --critical:    #d03b3b;
  --accent:      #0b0b0b;
  --sidebar:     #f2f1ed;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page:      #0d0d0d;
    --surface:   #1a1a19;
    --ink:       #ffffff;
    --ink-2:     #c3c2b7;
    --muted:     #898781;
    --grid:      #2c2c2a;
    --border:    rgba(255,255,255,0.10);
    --accent:    #ffffff;
    --sidebar:   #131312;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:      #0d0d0d;
  --surface:   #1a1a19;
  --ink:       #ffffff;
  --ink-2:     #c3c2b7;
  --muted:     #898781;
  --grid:      #2c2c2a;
  --border:    rgba(255,255,255,0.10);
  --accent:    #ffffff;
  --sidebar:   #131312;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a { color: inherit; }

/* ---- app layout: sidebar + content ---- */

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

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand .mark {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  flex: 0 0 8px;
}
.brand .mark.degraded { background: var(--warning); }
.brand .mark.down     { background: var(--critical); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .section {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 8px 4px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13px;
}
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.active { background: var(--surface); color: var(--ink); font-weight: 600; }
.nav a .ico { width: 15px; text-align: center; opacity: 0.75; font-size: 13px; }
.nav a.disabled {
  opacity: 0.42;
  pointer-events: none;
}
.nav a .tag {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
}

.sidebar .foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }

.content { flex: 1; min-width: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 48px; }

header.page {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
header.page h1 { font-size: 18px; margin: 0; font-weight: 650; }
header.page .sub { color: var(--muted); font-size: 12px; }

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar {
    width: auto; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 10px;
    overflow-x: auto; padding: 10px 12px;
  }
  .sidebar .foot { margin-top: 0; }
  .nav { flex-direction: row; }
  .nav .section { display: none; }
  .nav a .tag { display: none; }
}

/* ---- shared surfaces ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pill.up   { color: var(--good); }
.pill.up .dot { background: var(--good); }
.pill.down { color: var(--critical); }
.pill.down .dot { background: var(--critical); }
.pill.warn { color: var(--warning); }
.pill.warn .dot { background: var(--warning); }
.pill.unknown { color: var(--muted); }
.pill.unknown .dot { background: var(--muted); }

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

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.field input {
  font: inherit;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--page);
  color: var(--ink);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button.primary {
  font: inherit;
  font-weight: 650;
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--page);
  cursor: pointer;
}
button.primary:hover { filter: brightness(1.15); }

.error {
  background: color-mix(in srgb, var(--critical) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--critical) 40%, transparent);
  color: var(--critical);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  margin-bottom: 14px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
