/* Aurora UI — graphite + electric lime, no framework. */
:root {
  --bg: #0b0d10;
  --bg-2: #10131a;
  --panel: #14181f;
  --line: #232936;
  --text: #e8ecf1;
  --muted: #8b95a5;
  --accent: #b6f36a;
  --accent-dim: #7ea84a;
  --danger: #ff6b6b;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(120% 80% at 85% -10%, rgba(182,243,106,.07), transparent 60%),
    radial-gradient(90% 60% at 0% 110%, rgba(120,160,255,.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.app { display: grid; grid-template-columns: 268px 1fr; height: 100dvh; }

/* ---------------------------------------------------------------- rail */
.rail {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.015), transparent);
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: .2px; padding: 2px 6px 8px; }
.new-chat {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 12px; border-radius: 11px; cursor: pointer;
  border: 1px solid #2e3a24; background: rgba(182,243,106,.08); color: var(--accent);
  font: inherit; font-weight: 600;
}
.new-chat:hover { background: rgba(182,243,106,.14); }
.rail-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rail-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 6px 8px; }
.chat-list { overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-list button {
  text-align: left; background: none; border: 0; color: var(--text); font: inherit;
  padding: 8px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; opacity: .82;
}
.chat-list button:hover { background: rgba(255,255,255,.05); opacity: 1; }
.chat-list button[aria-current="true"] { background: rgba(182,243,106,.09); color: var(--accent); opacity: 1; }

.rail-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.quota-bar { height: 4px; background: #1b212b; border-radius: 3px; overflow: hidden; }
.quota-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width .3s; }
.quota-text, .credits { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.account { display: flex; gap: 8px; align-items: center; }
.rail-links { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }
.rail-links a { color: #5d6674; text-decoration: none; }
.rail-links a:hover { color: var(--muted); }

/* ---------------------------------------------------------------- main */
.main { display: flex; flex-direction: column; min-height: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: rgba(11,13,16,.7); backdrop-filter: blur(8px);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.model-select {
  appearance: none; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 30px 8px 12px; font: inherit; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.pill {
  font-size: 11px; font-family: var(--mono); color: var(--accent);
  border: 1px solid #2e3a24; background: rgba(182,243,106,.07);
  padding: 3px 9px; border-radius: 999px;
}

.thread { flex: 1; overflow: auto; padding: 26px 22px 8px; min-height: 0; }
.empty { max-width: 680px; margin: 8vh auto 0; text-align: center; }
.empty h1 { font-size: 27px; font-weight: 640; margin: 0 0 8px; letter-spacing: -.01em; }
.empty p { color: var(--muted); margin: 0 0 22px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggestions button {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 9px 13px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
}
.suggestions button:hover { border-color: #38404f; }

.msg { max-width: 780px; margin: 0 auto 18px; display: grid; grid-template-columns: 62px 1fr; gap: 14px; }
.msg .who { font: 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .1em; padding-top: 4px; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg.user .body { color: #cfd6e0; }
.msg.assistant .body { color: var(--text); }
.msg .reasoning {
  border-left: 2px solid #2b3341; padding-left: 10px; margin: 0 0 10px;
  color: var(--muted); font-size: 13px; white-space: pre-wrap;
}
.msg .meta { font: 11px var(--mono); color: #5d6674; margin-top: 6px; }
.msg .verified {
  display: inline-block; font: 11px var(--mono); color: var(--accent);
  border: 1px solid #2e3a24; background: rgba(182,243,106,.07);
  border-radius: 999px; padding: 2px 9px; margin-bottom: 8px;
}
.msg img.gen { max-width: 420px; border-radius: 12px; border: 1px solid var(--line); margin-top: 10px; }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0 } }

.composer { border-top: 1px solid var(--line); padding: 14px 22px 18px; background: rgba(11,13,16,.85); }
.composer textarea {
  width: 100%; max-width: 780px; margin: 0 auto; display: block;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 13px; padding: 12px 14px; font: inherit; resize: none; min-height: 48px; max-height: 40vh;
}
.composer textarea:focus { outline: 2px solid rgba(182,243,106,.35); outline-offset: -1px; }
.composer-actions { max-width: 780px; margin: 9px auto 0; display: flex; align-items: center; gap: 10px; }
.hint { flex: 1; font-size: 12px; color: #5d6674; }

button.primary, button.danger, button.ghost {
  font: inherit; font-weight: 600; border-radius: 10px; padding: 8px 14px; cursor: pointer;
}
button.primary { background: var(--accent); color: #10160a; border: 1px solid #a5dd5f; }
button.primary:hover { filter: brightness(1.05); }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.danger { background: rgba(255,107,107,.12); color: var(--danger); border: 1px solid #4a2424; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 6px 11px; }
button.ghost:hover { color: var(--text); border-color: #38404f; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; padding: 6px 0; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- dialogs */
.dialog {
  border: 1px solid var(--line); border-radius: 16px; background: var(--bg-2); color: var(--text);
  padding: 0; width: min(94vw, 420px);
}
.dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body h2 { margin: 0 0 2px; font-size: 18px; }
.dialog-body label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.dialog-body input {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font: inherit;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.small { font-size: 12px; }
.err { color: var(--danger); font-size: 13px; margin: 0; }

.dialog.wide { width: min(94vw, 620px); }
.proof-body { display: flex; flex-direction: column; gap: 12px; max-height: 52vh; overflow: auto; }
.proof-head { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.proof-head .pill.bad { color: var(--danger); border-color: #4a2424; background: rgba(255,107,107,.08); }
.proof { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.proof th { text-align: left; color: var(--muted); font-weight: 500; padding: 5px 8px 5px 0; white-space: nowrap; vertical-align: top; }
.proof td { padding: 5px 0; color: #c9d1dc; }
.proof .mono, .mono { font-family: var(--mono); font-size: 12px; }
.proof .ellipsis { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof.checks td.ok { color: var(--accent); }
.proof.checks td.bad { color: var(--danger); }
.proof.checks thead th { border-bottom: 1px solid var(--line); padding-bottom: 6px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .msg { grid-template-columns: 1fr; gap: 4px; }
  .msg .who { padding-top: 0; }
}
