:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #dfe3e8;
  --text: #1c2126;
  --muted: #667080;
  --accent: #2563eb;
  --danger: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --surface: #1c2024; --border: #2e343b;
    --text: #e8eaed; --muted: #98a2b3; --accent: #6aa1ff; --danger: #f97066;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2 { margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

/* sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.signin-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 2rem; text-align: center; max-width: 380px; width: 100%;
}
.signin-card { text-align: left; }
.signin-card h1, .signin-card > .muted { text-align: center; }
.signin-card label {
  display: block; margin-top: 1rem; font-size: .875rem; color: var(--muted);
}
.signin-card input {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit;
}
.signin-card .primary { width: 100%; margin-top: 1.25rem; }
.signin-card #skip-change { display: block; margin: .75rem auto 0; }
.signin-card .error { margin-bottom: 0; text-align: center; }

button.primary {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: .6rem 1rem; font: inherit; cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }

.inline-form {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  margin: .75rem 0;
}
.inline-form input, .inline-form select, td select {
  padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit;
}

.passcode-result {
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: 8px; padding: .8rem 1rem; font-size: .9rem;
}
.passcode-result code {
  font-size: 1.15rem; font-weight: 600; letter-spacing: .04em;
  background: var(--bg); padding: .15rem .45rem; border-radius: 4px;
}

/* chrome */
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .75rem 1.25rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
#tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
#tabs button {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: .4rem .7rem; border-radius: 6px; font: inherit;
}
#tabs button:hover { background: var(--bg); color: var(--text); }
#tabs button.active { background: var(--accent); color: #fff; }
button.link {
  border: 0; background: none; color: var(--accent);
  cursor: pointer; font: inherit; padding: 0;
}
main { padding: 1.25rem; max-width: 1100px; margin: 0 auto; }

/* stats */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.1rem; display: flex; flex-direction: column; gap: .3rem;
}
.stat-value { font-size: 2rem; font-weight: 600; line-height: 1; }
.stat-label { color: var(--muted); font-size: .875rem; }

/* tables */
.table-wrap { overflow-x: auto; margin-top: .75rem; }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: .9rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }

input[type="search"] {
  padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); min-width: min(320px, 100%);
}

.pill {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .8rem; background: var(--bg); border: 1px solid var(--border);
}
.pill-maintenance, .pill-moderate { background: #fef0c7; color: #7a5b00; border-color: #f5d97a; }
.pill-lost, .pill-retired, .pill-serious { background: #fee4e2; color: #912018; border-color: #fda29b; }
.pill-in_service { background: #d1fadf; color: #05603a; border-color: #6ce9a6; }

.notice {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: .7rem .9rem; border-radius: 6px; color: var(--muted); font-size: .9rem;
}
