/* Draven — monochrome design system (black / white / gray only). */
:root {
  --bg: #ffffff;
  --fg: #0d0d0d;
  --muted: #6f6f6f;
  --faint: #9c9c9c;
  --border: #e5e5e5;
  --surface: #f7f7f7;
  --surface-2: #efefef;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 30px rgba(0, 0, 0, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --fg: #f2f2f2;
    --muted: #9a9a9a;
    --faint: #6e6e6e;
    --border: #262626;
    --surface: #171717;
    --surface-2: #1f1f1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 30px rgba(0, 0, 0, 0.45);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, 'Segoe UI', system-ui, Roboto, 'Noto Sans Bengali', 'Hind Siliguri', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

/* ---------- shared controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px;
  background: var(--bg); transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface); }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-primary:hover { opacity: 0.88; background: var(--fg); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }
.btn-block { width: 100%; }
.field { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; outline: none; }
.field:focus { border-color: var(--fg); }
.label { font-size: 12px; color: var(--muted); margin: 14px 0 6px; display: block; }
.chip {
  font-size: 10px; letter-spacing: 1px; border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px; color: var(--muted); white-space: nowrap;
}
.divider { height: 1px; background: var(--border); margin: 10px 0; }

/* ---------- landing / login ---------- */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; border-bottom: 1px solid var(--border); }
.wordmark { font-family: Georgia, 'Times New Roman', serif; font-size: 20px; letter-spacing: 0.5px; }
.landing-main { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.landing-box { width: 100%; max-width: 400px; }
.landing-hero { text-align: center; margin-bottom: 26px; }
.landing-hero h1 { font-family: Georgia, serif; font-size: 44px; margin: 0 0 8px; font-weight: 500; }
.landing-hero p { color: var(--muted); margin: 0; }
.login-card { border: 1px solid var(--border); border-radius: 16px; padding: 26px; background: var(--bg); box-shadow: var(--shadow); }
.login-tabs { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 6px; }
.login-tab { flex: 1; padding: 8px; border-radius: 7px; color: var(--muted); }
.login-tab.active { background: var(--bg); color: var(--fg); border: 1px solid var(--border); }
.login-note { text-align: center; color: var(--faint); font-size: 12px; margin-top: 14px; }
.login-error { color: var(--fg); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-top: 10px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 264px 1fr; height: 100vh; }
.sidebar {
  border-right: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; padding: 14px; gap: 8px; min-height: 0;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px; }
.new-chat { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--bg); border-radius: 10px; padding: 10px; }
.new-chat:hover { border-color: var(--fg); }
.nav-section { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; padding: 10px 6px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--muted); text-align: left; width: 100%;
}
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.active { background: var(--surface-2); color: var(--fg); }
.nav-item .chip { margin-left: auto; }
.conversations { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.convo-item { padding: 8px 10px; border-radius: 8px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-item:hover, .convo-item.active { background: var(--surface-2); color: var(--fg); }
.plan-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--bg); }
.plan-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.plan-sub { color: var(--faint); font-size: 11px; margin-top: 2px; }
.signout { color: var(--faint); font-size: 12px; padding: 8px 6px; text-align: left; }
.signout:hover { color: var(--fg); }

/* ---------- chat ---------- */
.chat-col { display: flex; flex-direction: column; min-height: 0; }
.chat-top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.chat-title { font-weight: 500; }
.chat-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mode-select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 10px; font-size: 13px; color: var(--muted); outline: none;
}
.messages { flex: 1; overflow-y: auto; min-height: 0; }
.messages-inner { max-width: 720px; margin: 0 auto; padding: 28px 20px 12px; display: flex; flex-direction: column; gap: 18px; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px 20px; }
.empty-greet { font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.empty-sub { color: var(--muted); font-size: 14px; }
.suggestion-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.suggestion { border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; color: var(--muted); font-size: 13px; }
.suggestion:hover { color: var(--fg); border-color: var(--fg); }
.msg { display: flex; flex-direction: column; gap: 4px; }
.msg-role { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body.user { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.caret { display: inline-block; width: 8px; height: 15px; background: var(--fg); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }
.composer-wrap { padding: 8px 20px 18px; }
.composer {
  max-width: 720px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--bg);
  padding: 10px 12px; box-shadow: var(--shadow);
}
.composer:focus-within { border-color: var(--fg); }
.composer textarea {
  flex: 1; border: 0; outline: none; resize: none; background: transparent;
  max-height: 160px; min-height: 24px; padding: 4px 2px;
}
.send-btn {
  background: var(--fg); color: var(--bg); border-radius: 10px; padding: 8px 12px;
  display: inline-flex; align-items: center;
}
.send-btn:disabled { opacity: 0.3; cursor: default; }
.foot-note { text-align: center; color: var(--faint); font-size: 11px; margin-top: 8px; }

/* ---------- plans ---------- */
.plans-page { max-width: 940px; margin: 0 auto; padding: 44px 24px; }
.plans-head { text-align: center; margin-bottom: 28px; }
.plans-head h1 { font-family: Georgia, serif; font-weight: 500; font-size: 32px; margin: 0 0 6px; }
.plans-head p { color: var(--muted); margin: 0; }
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-tile { border: 1px solid var(--border); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.plan-tile.current { border-color: var(--fg); }
.plan-tier { color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.plan-price { font-size: 34px; font-weight: 500; }
.plan-price span { font-size: 13px; color: var(--muted); font-weight: 400; }
.plan-list { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.plan-list b { color: var(--fg); font-weight: 500; }
.plan-list .tick { display: inline-block; width: 14px; color: var(--fg); }
.plan-note { color: var(--faint); font-size: 12px; text-align: center; margin-top: 18px; }
.plans-back { display: inline-flex; gap: 6px; color: var(--muted); font-size: 13px; padding: 8px 0; }
.plans-back:hover { color: var(--fg); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .plans-grid { grid-template-columns: 1fr; }
}

/* ---------- sidebar toggle / full-screen chat ---------- */
.side-toggle {
  color: var(--muted); padding: 6px 9px; border-radius: 8px;
  border: 1px solid transparent; font-size: 15px; line-height: 1;
}
.side-toggle:hover { background: var(--surface-2); color: var(--fg); }
.shell.full { grid-template-columns: 1fr; }
.shell.full .sidebar { display: none; }

/* ---------- composer with inline mode selector ---------- */
.composer { flex-direction: column; gap: 8px; }
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-row .mode-select { margin-right: auto; }

/* reasoning mode: light ghost text style inside composer */
.composer-row .mode-select {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  font-size: 12px; letter-spacing: 0.4px; padding: 6px 8px; border-radius: 8px; outline: none;
}
.composer-row .mode-select:hover { background: var(--surface-2); color: var(--fg); }
.composer-row .mode-select:focus { border-color: var(--border); }

/* ---------- rooms (feature screens) ---------- */
.room { flex: 1; overflow-y: auto; min-height: 0; }
.room-inner { max-width: 860px; margin: 0 auto; padding: 28px 22px 40px; }
.room-title { font-family: Georgia, serif; font-weight: 500; font-size: 26px; margin: 0 0 6px; }
.room-sub { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; margin: 22px 0 8px; }
.room-form { display: flex; gap: 8px; margin-top: 14px; }
.room-form .field { flex: 1; }
.room-note { margin-top: 10px; font-size: 13px; color: var(--muted); }
.room-list { display: flex; flex-direction: column; gap: 6px; }
.room-list .convo-item { white-space: normal; border: 1px solid var(--border); border-radius: 10px; }
.room-pre { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; }

/* ---------- room components (cards, tables, chips, progress) ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.stat-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.stat-label { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 24px; font-weight: 500; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.room-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.room-table th { text-align: left; color: var(--faint); font-weight: 400; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.room-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.room-table tr:hover td { background: var(--surface); }
.status-chip { font-size: 10px; letter-spacing: 1px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; color: var(--muted); white-space: nowrap; }
.progress-track { height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--fg); }
.subject-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.doc-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.doc-title { font-size: 14px; }
.doc-excerpt { font-size: 12.5px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.mini-btn { border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 12px; }
.mini-btn:hover { border-color: var(--fg); }
.room-actions { float: right; display: flex; gap: 6px; }

/* conversation delete affordance */
.convo-del { color: var(--faint); font-size: 13px; padding: 2px 6px; border-radius: 6px; flex: none; }
.convo-del:hover { color: var(--fg); background: var(--surface-2); }
