/* adivaha R&D sandbox UI - not part of the adivaha21 application */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --ink: #14181f;
  --ink-2: #5a6473;
  --ink-3: #8d97a5;
  --line: #e3e7ed;
  --line-2: #eef1f5;
  --accent: #2f6bff;
  --accent-ink: #ffffff;
  --accent-soft: #eaf0ff;
  --bubble-user: #2f6bff;
  --bubble-ai: #f2f4f8;
  --ok: #129d6b;
  --warn: #d9822b;
  --err: #d93b3b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .05), 0 8px 24px rgba(20, 24, 31, .06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0e1116;
  --panel: #151a21;
  --panel-2: #11161c;
  --ink: #e8ecf2;
  --ink-2: #9aa5b4;
  --ink-3: #6b7686;
  --line: #232b35;
  --line-2: #1c232c;
  --accent: #5b8cff;
  --accent-soft: #1b2537;
  --bubble-user: #3b6ff0;
  --bubble-ai: #1b222b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 32px 28px 26px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.brand .dot {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), #8a5bff);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.brand h1 { font-size: 16px; margin: 0; letter-spacing: -.2px; }
.brand small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; }
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost {
  background: transparent; color: var(--ink-2); border-color: var(--line);
}
.btn.ghost:hover { background: var(--panel-2); }
.err {
  display: none;
  margin-top: 12px; padding: 9px 12px;
  background: rgba(217, 59, 59, .1);
  border: 1px solid rgba(217, 59, 59, .3);
  color: var(--err);
  border-radius: 9px; font-size: 13px;
}
.err.on { display: block; }
.login-foot { margin-top: 18px; font-size: 11.5px; color: var(--ink-3); text-align: center; }

/* ---------- app shell ---------- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.side {
  width: 268px; flex: 0 0 268px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.side-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line-2); }
.side-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.side-foot {
  padding: 12px 16px; border-top: 1px solid var(--line-2);
  display: flex; gap: 8px; align-items: center;
}
.group { margin-bottom: 20px; }
.group h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); margin: 0 0 8px;
}
.sel {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); cursor: pointer;
}
textarea.input { resize: vertical; min-height: 74px; font-size: 13px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-row .val {
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  min-width: 32px; text-align: right;
}
.stat {
  display: flex; justify-content: space-between;
  padding: 5px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-2);
}
.stat:last-child { border-bottom: 0; }
.stat span:first-child { color: var(--ink-3); }
.stat span:last-child { font-family: var(--mono); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.pill.ok { background: rgba(18, 157, 107, .12); color: var(--ok); }
.pill.bad { background: rgba(217, 59, 59, .12); color: var(--err); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex: 0 0 56px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
}
.topbar .title { font-weight: 650; letter-spacing: -.2px; }
.topbar .title small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.topbar .tools { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

.stream {
  flex: 1; overflow-y: auto; padding: 26px 0 8px;
  scroll-behavior: smooth;
}
.rail { max-width: 780px; margin: 0 auto; padding: 0 22px; }
.msg { display: flex; gap: 12px; margin-bottom: 22px; }
.msg .av {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
}
.msg.user .av { background: var(--bubble-user); }
.msg.ai .av { background: linear-gradient(140deg, #8a5bff, var(--accent)); }
.msg .body { min-width: 0; flex: 1; }
.msg .who { font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 4px; }
.msg .bubble {
  background: var(--bubble-ai); border: 1px solid var(--line-2);
  padding: 12px 14px; border-radius: 12px;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: var(--bubble-user); border-color: transparent; color: #fff;
}
.msg .meta { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.cursor { display: inline-block; width: 7px; height: 15px; background: var(--ink-3);
  vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty h2 { color: var(--ink); font-size: 19px; margin: 0 0 6px; letter-spacing: -.3px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 20px; }
.chip {
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); cursor: pointer; font-size: 13px; color: var(--ink-2);
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 14px 0 18px; }
.composer .rail { display: flex; flex-direction: column; gap: 8px; }
.box {
  display: flex; align-items: flex-end; gap: 10px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel-2); padding: 8px 8px 8px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.box textarea {
  flex: 1; border: 0; background: transparent; outline: none;
  resize: none; max-height: 190px; padding: 6px 0; line-height: 1.5;
}
.send {
  width: 36px; height: 36px; flex: 0 0 36px;
  border: 0; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.send:disabled { opacity: .4; cursor: not-allowed; }
.hint { font-size: 11.5px; color: var(--ink-3); display: flex; justify-content: space-between; }
kbd {
  font-family: var(--mono); font-size: 10.5px; padding: 1px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; background: var(--panel);
}

@media (max-width: 860px) {
  .side { position: fixed; z-index: 20; height: 100%; transform: translateX(-100%);
    transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .rail { padding: 0 16px; }
}
@media (min-width: 861px) { .icon-btn.menu { display: none; } }

/* markdown inside a reply bubble */
.msg .bubble { white-space: normal; }
.msg.user .bubble { white-space: pre-wrap; }
.msg .bubble ul { margin: 8px 0; padding-left: 20px; }
.msg .bubble li { margin: 3px 0; }
.msg .bubble h4 { margin: 12px 0 6px; font-size: 14px; }
.msg .bubble h4:first-child { margin-top: 0; }
.msg .bubble code {
  font-family: var(--mono); font-size: 12.5px;
  background: rgba(127, 140, 160, .16); padding: 1px 5px; border-radius: 5px;
}
.msg .bubble pre.code {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 13px; margin: 10px 0;
  overflow-x: auto;
}
.msg .bubble pre.code code { background: none; padding: 0; font-size: 12.5px; }
.msg .bubble strong { font-weight: 650; }
.note {
  margin-top: 6px; font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); word-break: break-all;
}

/* On a phone the subtitle wrapped to three lines and burst the 56px topbar
   (seen in 08_mobile.png, 2026-08-28). Drop it and keep the bar one line. */
@media (max-width: 860px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .title small { display: none; }
  .topbar .tools { flex: 0 0 auto; }
}
.msg .bubble blockquote {
  margin: 8px 0; padding: 6px 0 6px 12px;
  border-left: 3px solid var(--accent); color: var(--ink-2);
}
