:root {
  --bg: #0e0c14;
  --panel: #15121d;
  --card: #1d1928;
  --line: #2b2538;
  --ink: #ece9f4;
  --muted: #9a93ad;
  --purple: #7c4dcc;
  --purple-soft: #2a2140;
  --gold: #f0b429;
  --gold-soft: #2e2511;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.app { display: flex; height: 100dvh; }

/* sidebar */
.sidebar { width: 272px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; transition: margin-left .2s; overflow: hidden; }
.app.collapsed .sidebar { margin-left: -272px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; padding: 0 4px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--purple), var(--gold)); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.logo-mark.big { width: 56px; height: 56px; font-size: 26px; border-radius: 16px; margin: 0 auto 18px; }
.new-chat { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font-weight: 600; text-align: left; }
.new-chat:hover { border-color: var(--purple); }
.side-label { margin: 8px 6px 0; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.history { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.history-empty { color: var(--muted); font-size: 13px; padding: 6px; }
.history-item { display: flex; align-items: center; border-radius: 10px; }
.history-item:hover, .history-item.active { background: var(--card); }
.history-item .title { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 9px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.history-item .del { background: none; border: 0; color: var(--muted); padding: 6px 10px; font-size: 16px; visibility: hidden; }
.history-item:hover .del, .history-item.active .del { visibility: visible; }
.history-item .del:hover { color: var(--gold); }
.side-note { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 0 6px; }

/* main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.topbar-title { font-weight: 700; color: var(--muted); }
.icon-btn { background: none; border: 0; border-radius: 10px; width: 38px; height: 38px; font-size: 20px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--card); color: var(--ink); }
.icon-btn.small { width: 28px; height: 28px; font-size: 18px; }
.scroll { flex: 1; overflow-y: auto; padding: 8px 16px; }
.scroll > * { max-width: 760px; margin-left: auto; margin-right: auto; }

/* welcome: centered until the first message */
.welcome { text-align: center; padding-top: 14vh; }
.welcome h1 { margin: 0 0 8px; font-size: 28px; font-weight: 600; }
.welcome p { margin: 0 auto; color: var(--muted); max-width: 440px; }
.welcome.hidden { display: none; }

/* messages */
#chat { display: flex; flex-direction: column; gap: 18px; padding: 8px 0 16px; }
.msg { line-height: 1.6; font-size: 15px; overflow-wrap: anywhere; }
.user { align-self: flex-end; max-width: 85%; background: var(--purple); color: #fff; padding: 11px 16px; border-radius: 18px 18px 4px 18px; }
.user img { display: block; max-width: 240px; max-height: 180px; border-radius: 10px; margin-bottom: 8px; }
.user .shot-note { display: block; font-size: 12px; opacity: .8; margin-bottom: 4px; }
.bot { align-self: flex-start; max-width: 100%; display: flex; gap: 12px; }
.bot .avatar { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--purple), var(--gold)); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; margin-top: 2px; }
.bot .body { min-width: 0; }
.bot.unsure .body, .bot.note .body { color: var(--gold); }
.typing .body { color: var(--muted); font-style: italic; }
.tag { display: inline-block; background: var(--purple-soft); color: #c9b3f5; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.scores { margin-top: 12px; display: grid; gap: 6px; max-width: 420px; }
.row { display: grid; grid-template-columns: 70px 1fr 38px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: var(--card); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--purple); }
.bar > span.top { background: var(--gold); }
.links { margin-top: 14px; }
.links b { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.links a { display: block; margin-top: 6px; color: var(--ink); font-weight: 600; text-decoration: none; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold); }
.links a:hover { border-color: var(--purple); border-left-color: var(--gold); }

/* composer */
.dock { width: 100%; max-width: 792px; margin: 0 auto; padding: 0 16px; }
.attachment { display: flex; align-items: center; gap: 10px; background: var(--gold-soft); border: 1px solid var(--gold); color: var(--gold); border-radius: 14px; padding: 8px 10px; margin-bottom: 8px; font-size: 12px; line-height: 1.4; }
.attachment img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.attachment span { flex: 1; }
.composer { display: flex; align-items: flex-end; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 8px; }
.composer:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,77,204,.2); }
.composer textarea { flex: 1; resize: none; max-height: 150px; font: inherit; font-size: 16px; line-height: 1.5; padding: 8px 6px; border: 0; outline: none; background: none; color: var(--ink); }
.composer textarea::placeholder { color: var(--muted); }
.send { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--gold); color: #1a1405; font-size: 16px; flex-shrink: 0; }
.send:disabled { opacity: .5; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.chips.hidden { display: none; }
.chips button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--muted); }
.chips button:hover { border-color: var(--purple); color: var(--ink); }
.fineprint { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 12px; }

/* phones */
.scrim { display: none; }
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; margin-left: -272px; transition: margin-left .2s; }
  .app.collapsed .sidebar { margin-left: -272px; }
  .app.open .sidebar { margin-left: 0; }
  .app.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 10; }
  .welcome { padding-top: 8vh; }
  .welcome h1 { font-size: 23px; }
  .user { max-width: 92%; }
  .dock { padding: 0 10px; }
}

/* ---------- account, quick replies (sign-in screen: shared/auth.css) ---------- */
.account { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 4px; font-size: 0.8rem; color: #aaa; }
.account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { background: none; border: 1px solid #3a3a4c; color: #ccc; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick button { background: transparent; color: #e8b84a; border: 1px solid #5a4a20; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 0.85rem; }
.quick button:hover { background: #2a2418; }

/* Laurier seal used as the logo */
.logo-seal { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #fff; flex-shrink: 0; }
.logo-seal.big { width: 72px; height: 72px; display: block; margin: 0 auto 18px; }
.bot .avatar { background: #fff; overflow: hidden; padding: 0; }
.bot .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

.account-links { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 8px; font-size: 0.78rem; }
.account-links a, .link-btn { color: #9d8cff; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.link-btn { color: #ff9a9a; }

/* ---------- light theme ---------- */
:root[data-theme="light"] {
  --bg: #f7f5fb; --panel: #ffffff; --card: #f0ecf8; --line: #ddd6ec;
  --ink: #1f1b2e; --muted: #6a6482; --purple: #6a3fc0; --purple-soft: #ece5fb;
  --gold: #b97a00; --gold-soft: #fbf1d9;
}
:root[data-theme="light"] .account, :root[data-theme="light"] .account-links a { color: #6a6482; }
:root[data-theme="light"] .logout { border-color: #cfc6e3; color: #1f1b2e; }
:root[data-theme="light"] .quick button { color: #8a5a00; border-color: #e0c27a; }
:root[data-theme="light"] .quick button:hover { background: #fbf1d9; }

/* ---------- search, rename, message actions, settings ---------- */
.chat-search { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 0.9rem; }
.history-item .rename { background: none; border: 0; color: var(--muted); padding: 0 6px; opacity: 0; }
.history-item:hover .rename, .history-item:focus-within .rename, .history-item.active .rename { opacity: 1; }
@media (hover: none) { .history-item .rename { opacity: 1; } }
.link-btn.plain { color: var(--muted); text-decoration: underline; }
.actions { display: flex; gap: 6px; margin-top: 10px; }
.actions button { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 4px 10px; font-size: 0.8rem; }
.actions button:hover { color: var(--ink); border-color: var(--muted); }
.actions button[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.retry { margin-left: 10px; background: var(--gold); color: #1a1a1a; border: 0; border-radius: 8px; padding: 4px 12px; font-weight: 600; }
.theme-btn { margin-left: auto; }
.send.stop { background: #c0392b; }
.settings { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--panel); color: var(--ink); width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.settings::backdrop { background: rgba(0, 0, 0, 0.55); }
.settings-card { padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-head h2 { margin: 0; font-size: 1.2rem; }
.settings h3 { margin: 18px 0 6px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.settings label { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.settings input, .settings select { width: 100%; padding: 10px 12px; margin-top: 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
.settings .primary { margin-top: 10px; background: var(--gold); color: #1a1a1a; border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.settings .danger { margin: 6px 8px 0 0; background: transparent; border: 1px solid #c0392b; color: #e5655a; border-radius: 10px; padding: 8px 14px; }
:root[data-theme="light"] .settings .danger { color: #b42318; }
.settings .hint, .msg-line { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; min-height: 1.1em; }
.settings a { color: var(--purple); }
@media (max-width: 760px) { .actions button, .quick button { min-height: 36px; } }

.side-link { text-decoration: none; margin-top: 8px; display: block; text-align: center; }

.model-badge { margin-left: 10px; padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; color: var(--gold); border: 1px solid var(--gold); }

.settings .model-line { margin: 0; }

button.model-badge { cursor: pointer; background: transparent; font: inherit; font-size: 0.78rem; font-weight: 600; }
button.model-badge:hover { background: var(--gold-soft); }
.cap-list { margin: 4px 0 8px; padding-left: 1.2em; font-size: 0.9rem; line-height: 1.5; color: var(--ink); }
.cap-list li { margin-bottom: 6px; }
.about { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 4px 0 8px; font-size: 0.9rem; }
.about dt { color: var(--muted); }
.about dd { margin: 0; font-weight: 600; }
#model-info p { margin: 8px 0; font-size: 0.92rem; line-height: 1.5; }


