:root {
  color-scheme: dark;
  --bg: #0e1116;
  --bg-elev: #171c24;
  --bg-top: #090b0e;
  --line: #2c3544;
  --text: #e7edf5;
  --muted: #93a0b5;
  --orange: #ff7a18;
  --orange-2: #ffb15a;
  --ink: #1a0d04;
  --ok: #3dd68c;
  --bad: #ff6b6b;
  --warn: #f0c14a;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --max: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(255, 122, 24, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--orange-2); text-decoration: none; }
a:hover { color: var(--orange); }
code {
  font-family: Consolas, "Cascadia Mono", monospace;
  color: var(--orange-2);
  background: #10141b;
  padding: 0.05em 0.35em;
  border-radius: 4px;
}
h1, h2, h3 { line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.8rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0.35rem 0; }

.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }
.topbar {
  background: var(--bg-top);
  border-bottom: 3px solid var(--orange);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { color: var(--text); font-weight: 750; letter-spacing: 0.02em; font-size: 1.05rem; }
.brand span { color: var(--orange); margin-left: 0.35rem; }
nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
nav a { color: var(--muted); font-weight: 650; }
nav a.active, nav a:hover { color: var(--text); }
.footer { color: var(--muted); font-size: 0.86rem; padding: 28px 0 40px; }
.eyebrow { color: var(--orange); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 750; margin: 0 0 0.3rem; }
.lead { font-size: 1.05rem; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.warn-text { color: var(--warn); }
.earliest { color: var(--orange-2); }

main.wrap { padding-top: 28px; }
.page-head, .identity { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.login-card { max-width: 640px; margin: 48px auto; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.link-card { color: inherit; display: block; }
.link-card:hover { border-color: var(--orange); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat span { display: block; color: var(--muted); font-size: 0.85rem; }
.stat strong { font-size: 1.6rem; }
.notice, .flash { border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.notice { background: #24180f; border: 1px solid #6a4018; color: #ffd7b0; }
.flash-ok { background: #10261c; border: 1px solid #1f6b45; }
.flash-error { background: #2a1214; border: 1px solid #8a3038; }
.flash-info { background: #172033; border: 1px solid #31486e; }

.button, button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--orange);
  color: var(--ink);
  font-weight: 750;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
}
.button:hover, button.button:hover { background: var(--orange-2); color: var(--ink); }
.button.secondary, button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.button.tiny { padding: 4px 8px; font-size: 0.85rem; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.linkish {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.linkish:hover { color: var(--text); }
.inline { display: inline; }
.row-actions, .identity form { display: flex; gap: 8px; flex-wrap: wrap; }

.portrait { width: 72px; height: 72px; border-radius: 10px; background: #0b0e13; object-fit: cover; }
.character-row, .identity { display: flex; gap: 16px; align-items: flex-start; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 750;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill-ok { color: var(--ok); border-color: #1f6b45; }
.pill-bad { color: var(--bad); border-color: #8a3038; }
.pill-warn { color: var(--warn); border-color: #8a6a16; }
.pill-muted { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; vertical-align: top; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.planet { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.form { display: grid; gap: 12px; max-width: 520px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.92rem; }
input, select, textarea {
  background: #0e131b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); border-color: transparent; }
.chains { margin: 0; padding-left: 1.2rem; }
.error-page { padding-top: 48px; }

@media (max-width: 800px) {
  .grid, .stats { grid-template-columns: 1fr; }
  .page-head, .identity, .topbar-inner { flex-direction: column; align-items: flex-start; }
  .topbar { position: static; }
}
