/* Lancelot — "Obsidian & Gold". Calm, regal, Jarvis-like. */
:root {
  --bg: #0a0a0e;
  --bg-2: #101019;
  --panel: #14141f;
  --panel-2: #1a1a28;
  --line: #25253a;
  --ink: #f3eddf;
  --ink-dim: #a39d8e;
  --ink-faint: #6f6a5e;
  --gold: #e8b64b;
  --gold-deep: #c8922f;
  --ember: #e07a3c;
  --live: #38d3c8;        /* listening/teal */
  --danger: #e0556b;
  --ok: #57c98a;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0,0,0,.55);
  --display: "Fraunces", Georgia, serif;
  --body: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(232,182,75,.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(56,211,200,.06), transparent 55%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  letter-spacing: .1px;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--body); cursor: pointer; }

/* ---------- shell layout ---------- */
.app { max-width: 880px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column;
  padding: 0 18px 110px; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 22px 4px 14px; position: sticky;
  top: 0; z-index: 20; background: linear-gradient(var(--bg), rgba(10,10,14,.75) 70%, transparent);
  backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 11px; }
.crest { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #1a1205;
  font-family: var(--display); font-weight: 600; box-shadow: 0 6px 18px rgba(232,182,75,.3); }
.wordmark { font-family: var(--display); font-size: 22px; font-weight: 500; letter-spacing: .3px; }
.wordmark b { color: var(--gold); font-weight: 600; }
.spacer { flex: 1; }
.pill-link { font-size: 13px; color: var(--ink-dim); padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel); }
.pill-link:hover { color: var(--ink); border-color: var(--gold-deep); }

h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: .2px; }
.page-title { font-size: 30px; margin: 8px 4px 18px; }
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 14px; }
@media (min-width: 620px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
.card { background: linear-gradient(160deg, var(--panel), var(--panel-2)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232,182,75,.5), transparent); }
.card h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.card h3 .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.kpi { font-family: var(--display); font-size: 40px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.015); }
.item:hover { border-color: var(--gold-deep); }
.item .t { font-weight: 600; }
.item .s { color: var(--ink-dim); font-size: 13px; margin-top: 3px; }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; padding: 3px 8px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim); }
.tag.gold { color: var(--gold); border-color: var(--gold-deep); }
.tag.live { color: var(--live); border-color: #1f5c58; }
.tag.danger { color: var(--danger); border-color: #5c2330; }
.tag.ok { color: var(--ok); border-color: #21503a; }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .15s; }
.btn:hover { border-color: var(--gold-deep); transform: translateY(-1px); }
.btn.primary { background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #1a1205;
  border: none; box-shadow: 0 8px 22px rgba(232,182,75,.28); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #5c2330; color: var(--danger); }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

input, textarea, select { width: 100%; background: #0d0d15; border: 1px solid var(--line);
  color: var(--ink); border-radius: 12px; padding: 13px 14px; font-family: var(--body); font-size: 15px; }
input:focus, textarea:focus { outline: none; border-color: var(--gold-deep); }
label { display: block; font-size: 13px; color: var(--ink-dim); margin: 14px 0 6px; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: linear-gradient(transparent, rgba(8,8,12,.92) 30%); padding: 10px 14px max(14px, env(safe-area-inset-bottom)); }
.nav-inner { max-width: 880px; margin: 0 auto; display: flex; justify-content: space-around;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px;
  color: var(--ink-faint); padding: 7px 12px; border-radius: 12px; min-width: 56px; }
.nav a .ic { font-size: 19px; }
.nav a.active { color: var(--gold); background: rgba(232,182,75,.08); }

/* ---------- voice orb / chat ---------- */
.chat-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.orb { --glow: var(--gold); width: 176px; height: 176px; border-radius: 50%; margin: 26px 0 10px;
  position: relative; display: grid; place-items: center; }
.orb .core { width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a2a3d, #0d0d16 70%);
  border: 1px solid var(--line); box-shadow: 0 0 0 1px rgba(232,182,75,.15), inset 0 0 40px rgba(0,0,0,.6);
  display: grid; place-items: center; font-family: var(--display); font-size: 13px; color: var(--ink-dim);
  transition: .3s; }
.orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--glow);
  opacity: .0; }
.orb.idle .core { color: var(--ink-faint); }
.orb.listening { --glow: var(--live); }
.orb.thinking { --glow: var(--gold); }
.orb.speaking { --glow: var(--ember); }
.orb:not(.idle) .ring { animation: pulse 1.6s ease-out infinite; opacity: 1; }
.orb:not(.idle) .ring:nth-child(2) { animation-delay: .5s; }
.orb:not(.idle) .ring:nth-child(3) { animation-delay: 1s; }
.orb:not(.idle) .core { box-shadow: 0 0 60px var(--glow), inset 0 0 40px rgba(0,0,0,.5);
  border-color: var(--glow); color: var(--ink); }
@keyframes pulse { 0% { transform: scale(.78); opacity: .55; } 100% { transform: scale(1.25); opacity: 0; } }

.transcript { width: 100%; display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.bubble { max-width: 86%; padding: 12px 15px; border-radius: 16px; line-height: 1.5; font-size: 15px; }
.bubble.user { align-self: flex-end; background: linear-gradient(145deg, #1d1d2c, #16161f);
  border: 1px solid var(--line); border-bottom-right-radius: 5px; }
.bubble.bot { align-self: flex-start; background: rgba(232,182,75,.06); border: 1px solid #3a3220;
  border-bottom-left-radius: 5px; }
.bubble .who { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--gold);
  margin-bottom: 5px; }
.bubble.partial { opacity: .55; font-style: italic; }

.composer { position: fixed; bottom: 86px; left: 0; right: 0; padding: 0 18px; }
.composer-inner { max-width: 880px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 10px; box-shadow: var(--shadow); }
.composer textarea { border: none; background: transparent; min-height: 24px; max-height: 120px; padding: 10px; }
.mic-btn { width: 52px; height: 52px; border-radius: 50%; flex: none; border: none;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #1a1205; font-size: 22px;
  display: grid; place-items: center; box-shadow: 0 8px 22px rgba(232,182,75,.3); }
.mic-btn.rec { background: linear-gradient(145deg, var(--live), #209c93); color: #04201e;
  animation: micpulse 1.2s infinite; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(56,211,200,.5);} 50% { box-shadow: 0 0 0 12px rgba(56,211,200,0);} }
.send-btn { width: 52px; height: 52px; border-radius: 50%; flex: none; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font-size: 19px; }

/* ---------- assistant switcher ---------- */
.agents { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; margin-bottom: 6px; }
.agent-chip { white-space: nowrap; font-size: 13px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim); }
.agent-chip.active { color: var(--gold); border-color: var(--gold-deep); background: rgba(232,182,75,.08); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .card { width: 100%; max-width: 380px; }
.auth .crest { width: 52px; height: 52px; font-size: 22px; margin: 4px auto 14px; }

/* ---------- misc ---------- */
.toast { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 60;
  background: var(--panel-2); border: 1px solid var(--gold-deep); color: var(--ink); padding: 12px 18px;
  border-radius: 12px; box-shadow: var(--shadow); opacity: 0; transition: .25s; max-width: 90%; }
.toast.show { opacity: 1; bottom: 162px; }
.empty { text-align: center; color: var(--ink-faint); padding: 40px 10px; }
.skeleton { background: linear-gradient(90deg, #14141f, #1c1c2a, #14141f); background-size: 200% 100%;
  animation: sk 1.2s infinite; border-radius: 10px; height: 14px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.diff-add { color: var(--ok); }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
