/* ns · claude — nightshade ink + aureus gold.
   All styling lives here (CSP forbids inline styles / external fonts). */

:root {
  --ink:      #14121c;
  --ink-2:    #100e17;
  --panel:    #1c1a28;
  --panel-2:  #252235;
  --edge:     #322e45;
  --edge-2:   #423c5a;

  --gold:     #e8b84b;   /* Aureus — you, primary action, focus */
  --gold-dim: #b99433;
  --violet:   #9a86e0;   /* belladonna — Claude, links */
  --teal:     #5ec8c0;   /* co-author / helper */

  --text:     #ece9f5;
  --muted:    #9891ad;
  --faint:    #6f6a83;

  --danger:   #e0806f;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;

  --wrap: 760px;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(232,184,75,0.28); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--edge-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--edge-2); border-radius: 8px; border: 2px solid var(--ink); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* ---------- Wordmark ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.wordmark:hover { text-decoration: none; }
.glyph { width: 22px; height: 22px; display: block; filter: drop-shadow(0 0 6px rgba(154,134,224,0.35)); }
.glyph .petals ellipse { fill: var(--violet); }
.glyph .eye { fill: var(--gold); }
.wordmark-text { font-family: var(--mono); font-size: 0.95rem; letter-spacing: 0.02em; color: var(--text); }
.wordmark-text b { font-weight: 700; color: var(--gold); }
.wordmark-text i { color: var(--faint); font-style: normal; margin: 0 3px; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--edge);
}
.topbar-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who b { color: var(--text); font-weight: 600; }
.badge {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 999px; padding: 2px 8px;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions form { display: inline; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans); font-size: 0.9rem; font-weight: 600; line-height: 1;
  padding: 0.6em 0.95em; border-radius: 9px; border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s, filter .15s;
  color: var(--text); background: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-ghost { border-color: var(--edge); background: var(--panel); color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--edge-2); }
.btn-primary { background: var(--gold); color: #211a06; border-color: var(--gold); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { filter: saturate(0.4) brightness(0.8); cursor: not-allowed; }

/* ---------- Conversation stream ---------- */
.stream {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 20px 40px;
  gap: 22px;
}
.stream-inner-pad { height: 4px; } /* spacer to breathe at top */

.msg {
  width: 100%; max-width: var(--wrap);
  padding-left: 16px; border-left: 3px solid var(--edge-2);
}
.msg > strong {
  display: block; font-family: var(--mono);
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 6px; color: var(--muted);
}
.msg > span { display: block; white-space: pre-wrap; word-wrap: break-word; color: var(--text); }

.msg.self      { border-left-color: var(--gold); }
.msg.self > strong    { color: var(--gold); }
.msg.assistant { border-left-color: var(--violet); }
.msg.assistant > strong { color: var(--violet); }
.msg.coauthor  { border-left-color: var(--teal); }
.msg.coauthor > strong { color: var(--teal); }
.msg.owner     { border-left-color: var(--edge-2); }
.msg.owner > strong   { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .msg { animation: rise .18s ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

.empty { color: var(--faint); font-family: var(--mono); font-size: 0.85rem; margin-top: 12vh; }

/* ---------- Composer ---------- */
.composer { border-top: 1px solid var(--edge); background: var(--ink); padding: 14px 20px 20px; }
.composer-inner { max-width: var(--wrap); margin: 0 auto; }
.composer-box {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius);
  padding: 10px 10px 10px 14px; transition: border-color .15s, box-shadow .15s;
}
.composer-box:focus-within { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(232,184,75,0.16); }
.composer-box textarea {
  flex: 1; resize: none; border: none; outline: none; background: transparent;
  color: var(--text); font-family: var(--sans); font-size: 1rem; line-height: 1.5;
  max-height: 200px; padding: 6px 0;
}
.composer-box textarea::placeholder { color: var(--faint); }
.hint { margin: 8px 2px 0; font-family: var(--mono); font-size: 0.68rem; color: var(--faint); text-align: right; }
.hint kbd {
  font-family: var(--mono); background: var(--panel-2); border: 1px solid var(--edge);
  border-radius: 4px; padding: 0 5px; color: var(--muted);
}

/* ---------- Login ---------- */
body.auth { display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
body.auth::before {
  content: ""; position: absolute; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(50% 45% at 30% 22%, rgba(154,134,224,0.16), transparent 70%),
    radial-gradient(45% 40% at 78% 82%, rgba(232,184,75,0.10), transparent 70%);
}
.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px; text-align: center;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 16px;
  padding: 40px 34px 34px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.auth-card .wordmark { justify-content: center; margin-bottom: 22px; }
.auth-card .glyph { width: 30px; height: 30px; }
.auth-card .wordmark-text { font-size: 1.15rem; }
.auth-title { font-size: 1.35rem; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.01em; }
.auth-sub { color: var(--muted); font-size: 0.92rem; margin: 0 0 26px; }
.auth-card .btn { width: 100%; padding: 0.8em; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 0.95rem; }
.dsvg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Notices ---------- */
.notice {
  max-width: var(--wrap); margin: 0 auto 4px; width: 100%;
  font-size: 0.9rem; border-radius: 10px; padding: 10px 14px;
  border: 1px solid var(--edge); background: var(--panel); color: var(--muted);
}
.notice.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--edge)); color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.notice.copilot {
  border-color: var(--gold-dim); color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--panel));
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em;
}

/* ---------- Admin ---------- */
.page { flex: 1; overflow-y: auto; }
.page-inner { max-width: 880px; margin: 0 auto; padding: 30px 20px 60px; }
.crumb { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.crumb a { color: var(--muted); }
.h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.01em; margin: 14px 0 4px; }
.sub { color: var(--muted); margin: 0 0 26px; font-size: 0.92rem; }

.conv-list { display: flex; flex-direction: column; gap: 10px; }
.conv {
  display: block; padding: 15px 18px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--edge);
  transition: border-color .15s, background .15s, transform .05s;
}
.conv:hover { text-decoration: none; background: var(--panel-2); border-color: var(--edge-2); transform: translateY(-1px); }
.conv-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.conv-user { font-family: var(--mono); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }
.conv-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.conv-preview { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .topbar { padding: 10px 14px; }
  .wordmark-text { font-size: 0.85rem; }
  .badge { display: none; }
  .stream { padding: 20px 14px 32px; gap: 18px; }
  .composer { padding: 12px 14px 16px; }
  .hint { display: none; }
}

.empty.empty-flush { margin-top: 0; }
