:root {
  --ink: #090b0f;
  --paper: #f4f6f8;
  --platinum: #c8d3de;
  --platinum-deep: #9aabba;
  --line: #d5dde6;
  --muted: #5c6775;
  --danger: #8c3a3a;
  --ok: #1f6b4a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --serif: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  --sans: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--platinum); outline-offset: 2px; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.card {
  width: min(440px, 100%);
  background: var(--paper);
  color: var(--ink);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
}
.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  margin: 0 0 8px;
}
.wordmark span { color: var(--platinum-deep); letter-spacing: 0.22em; }
h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; margin: 0 0 8px; letter-spacing: -0.02em; }
.lede { color: var(--muted); margin: 0 0 24px; }
.primary, .ghost, .danger {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
}
.primary { background: var(--ink); color: var(--platinum); }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.danger { background: transparent; color: var(--danger); border: 1px solid #e4c8c8; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
textarea { min-height: 80px; resize: vertical; }
.note { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; }
.ok { color: var(--ok); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.rail {
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rail button {
  text-align: left;
  background: transparent;
  color: var(--platinum);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
}
.rail button[aria-current="page"] { background: #151922; color: white; }
.rail .who { margin-top: auto; color: var(--platinum-deep); font-size: 13px; padding: 12px; }
.stage { padding: 22px 22px 22px 0; }
.sheet {
  background: var(--paper);
  color: var(--ink);
  min-height: calc(100vh - 44px);
  border-radius: 22px;
  padding: 28px 32px 40px;
  box-shadow: inset 0 0 0 1px rgba(200, 211, 222, 0.7);
}
.top { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 22px; }
.searchrow { display: flex; gap: 8px; }
.searchrow input { min-width: 280px; }
.results { display: grid; gap: 8px; }
.result {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--ink);
}
.mid { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e7edf2;
  color: #243040;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.block { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; }
.block h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin: 0 0 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.chat { background: #f7f9fb; border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.chat .role { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.banner { background: #eef2f5; border-radius: 12px; padding: 10px 12px; margin-bottom: 16px; color: #243040; }
footer.fine { margin-top: 28px; color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button:disabled { opacity: 0.7; cursor: wait; }
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--platinum);
  border-top-color: var(--ink);
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.meter { height: 8px; background: #e7edf2; border-radius: 99px; overflow: hidden; margin: 8px 0 12px; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.usage-mid { background: #fbf3e4; border-color: #e2c98a; }
.usage-mid .meter > span { background: #a67920; }
.usage-high { background: #fbeeee; border-color: #e4b4b4; }
.usage-high .meter > span { background: var(--danger); }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .stage { padding: 0 12px 16px; }
  .rail { flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .grid, .result { grid-template-columns: 1fr; }
  .searchrow { flex-direction: column; }
}
