/* Manthan — hand-authored, no build step (same approach as the Dhandare console).
   A warm, low-contrast reading surface: the product is text people READ, so the page gets
   out of the way. Dark mode follows the OS rather than adding a toggle nobody asks for. */

:root {
  --bg: #faf9f7;            /* warm off-white, easier on the eye than pure white */
  --surface: #ffffff;
  --surface-2: #f3f1ed;
  --text: #1f1e1c;
  --muted: #6b6862;
  --line: #e5e1da;
  --accent: #b4530a;        /* terracotta — warm, not the usual SaaS blue */
  --accent-soft: #fdf3ea;
  --ok: #1a7f4b;
  --warn: #9a6b00;
  --bad: #a33a2a;
  --radius: 12px;
  --maxw: 46rem;            /* ~75 characters: the comfortable line length for prose */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1917; --surface: #232220; --surface-2: #2b2a27;
    --text: #ece9e4; --muted: #a5a099; --line: #35332f;
    --accent: #e08b4c; --accent-soft: #2e2620;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; }

/* ── shell ─────────────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 16rem; flex-shrink: 0; background: var(--surface-2);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: .75rem; gap: .5rem;
}
.sidebar .brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 650; font-size: 1.05rem; color: var(--text); text-decoration: none;
  padding: .35rem .25rem .6rem;
}
.logo {
  width: 1.75rem; height: 1.75rem; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .95rem;
}
.newchat {
  display: block; text-align: center; padding: .55rem; border-radius: 10px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600;
  font-size: .9rem;
}
.newchat:hover { filter: brightness(1.06); }
.convos { flex: 1; overflow-y: auto; margin-top: .5rem; }
.convo {
  display: block; padding: .45rem .55rem; border-radius: 8px; color: var(--text);
  text-decoration: none; font-size: .875rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.convo:hover { background: var(--surface); }
.convo.active { background: var(--surface); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding-top: .6rem; font-size: .8rem; color: var(--muted); }
.side-foot a { display: block; padding: .25rem 0; text-decoration: none; color: var(--muted); }
.side-foot a:hover { color: var(--text); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.thread { flex: 1; overflow-y: auto; padding: 2rem 1.25rem 1rem; }
.inner { max-width: var(--maxw); margin: 0 auto; }

/* ── messages ──────────────────────────────────────────────────────────────────── */
.msg { margin-bottom: 1.75rem; }
.msg.user .bubble {
  background: var(--accent-soft); border: 1px solid var(--line);
  padding: .7rem .9rem; border-radius: var(--radius); display: inline-block;
  max-width: 100%; font-weight: 500;
}
.ans { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.ans.refusal { background: var(--surface-2); }
.direct { font-size: 1.075rem; font-weight: 550; margin: 0 0 .5rem; }
.sec {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 1.1rem 0 .4rem; font-weight: 650;
}
.points, .steps, .sources { margin: 0; padding-left: 1.15rem; }
.points li, .steps li { margin-bottom: .5rem; }
.sources { font-size: .85rem; }
.sources li { margin-bottom: .3rem; }
.sources .dom, .sources .date { color: var(--muted); margin-left: .4rem; font-size: .8rem; }

/* A citation must be unmissable but must not break the line it sits in. */
.cite { font-size: .75rem; text-decoration: none; vertical-align: super; font-weight: 700; }
.corr { color: var(--ok); font-size: .7rem; vertical-align: super; font-weight: 700; }

.caveat {
  margin: 1rem 0 0; padding: .6rem .75rem; border-left: 3px solid var(--warn);
  background: var(--surface-2); font-size: .875rem; color: var(--muted); border-radius: 0 8px 8px 0;
}
.meta { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; font-size: .75rem; }
.conf { padding: .12rem .5rem; border-radius: 999px; font-weight: 650; }
.conf-high { background: rgba(26,127,75,.14); color: var(--ok); }
.conf-medium { background: rgba(154,107,0,.14); color: var(--warn); }
.conf-low, .conf-none { background: rgba(163,58,42,.12); color: var(--bad); }
.ms { color: var(--muted); }
.muted { color: var(--muted); }

/* ── composer ──────────────────────────────────────────────────────────────────── */
.composer { border-top: 1px solid var(--line); background: var(--bg); padding: .9rem 1.25rem 1.25rem; }
.composer form { max-width: var(--maxw); margin: 0 auto; display: flex; gap: .5rem; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem;
  min-height: 3rem; max-height: 12rem;
}
.composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.send {
  background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: .75rem 1.1rem; font-weight: 650; cursor: pointer; font-size: .9rem;
}
.send:disabled { opacity: .5; cursor: not-allowed; }
.quota { max-width: var(--maxw); margin: .5rem auto 0; font-size: .78rem; color: var(--muted); text-align: center; }

/* ── empty state ───────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 3.5rem 0 2rem; }
.hero h1 { font-size: 1.9rem; margin: 0 0 .4rem; font-weight: 650; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 32rem; }
.examples { display: grid; gap: .5rem; margin: 1.75rem auto 0; max-width: 34rem; }
.example {
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .65rem .8rem; cursor: pointer; font: inherit;
  color: var(--text); font-size: .9rem;
}
.example:hover { border-color: var(--accent); }

/* ── thinking indicator ────────────────────────────────────────────────────────── */
.thinking { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; } }

/* ── auth + generic pages ──────────────────────────────────────────────────────── */
.page { max-width: 26rem; margin: 4rem auto; padding: 0 1.25rem; }
.page.wide { max-width: 46rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.card h1 { font-size: 1.35rem; margin: 0 0 1rem; }
label { display: block; font-size: .85rem; font-weight: 600; margin: .9rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number] {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--text);
}
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: .6rem 1rem; font-weight: 650; cursor: pointer; text-decoration: none; font-size: .9rem;
}
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.oauth { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.oauth a {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem; text-decoration: none;
  color: var(--text); background: var(--surface); font-weight: 550; font-size: .9rem;
}
.oauth a:hover { border-color: var(--accent); }
.divider { text-align: center; color: var(--muted); font-size: .8rem; margin: .9rem 0; }
.err { background: rgba(163,58,42,.1); color: var(--bad); padding: .55rem .7rem; border-radius: 8px; font-size: .875rem; margin-bottom: .75rem; }
.ok-box { background: rgba(26,127,75,.1); color: var(--ok); padding: .55rem .7rem; border-radius: 8px; font-size: .875rem; margin-bottom: .75rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

/* ── mobile ────────────────────────────────────────────────────────────────────── */
.menu-btn { display: none; background: none; border: 0; font-size: 1.35rem; cursor: pointer; color: var(--text); }
.topbar { display: none; }

@media (max-width: 800px) {
  /* The sidebar becomes a drawer. Without this the conversation list eats half a phone
     screen, and the thread — the thing people came for — has nowhere to go. */
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%);
             transition: transform .18s ease; box-shadow: 0 0 2rem rgba(0,0,0,.18); }
  .sidebar.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem;
            border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
  .menu-btn { display: block; }
  .thread { padding: 1.25rem .9rem 1rem; }
  .composer { padding: .75rem .9rem 1rem; }
  .hero { padding: 2rem 0 1.25rem; }
  .hero h1 { font-size: 1.5rem; }
}

/* ── landing / sign-in page ──────────────────────────────────────────────────────
   The signed-out page carries the whole product story, so it gets a WIDER measure than
   the reading surface above (--maxw is sized for prose, not for a card grid). */
.lp { --lpw: 68rem; }
.lp-inner { max-width: var(--lpw); margin: 0 auto; padding: 0 1.25rem; }
.lp h2 { font-size: 1.6rem; letter-spacing: -.01em; margin: 0 0 .5rem; }
.lp-center { text-align: center; }
.lp-sub { margin: 0 auto 2rem; max-width: 34rem; }

.lp-nav {
  max-width: var(--lpw); margin: 0 auto; padding: 1.1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.lp-nav nav { display: flex; align-items: center; gap: 1.25rem; }
.lp-nav nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.lp-nav nav a:hover { color: var(--text); }
.lp-nav-cta {
  background: var(--accent); color: #fff !important; padding: .45rem .95rem;
  border-radius: 9px; font-weight: 600;
}
/* The nav collapses rather than scrolling sideways — a phone gets the CTA, not six links. */
@media (max-width: 46rem) { .lp-nav nav a:not(.lp-nav-cta) { display: none; } }

.lp-brand {
  display: flex; align-items: center; gap: .55rem;
  font-weight: 650; font-size: 1.1rem; color: var(--text); text-decoration: none;
}
.lp-mark { width: 1.9rem; height: 1.9rem; color: var(--accent); display: block; }
.lp-mark svg { width: 100%; height: 100%; display: block; }
.lp-brand-sm { font-size: 1rem; }

.lp-hero {
  max-width: var(--lpw); margin: 0 auto; padding: 2.5rem 1.25rem 3.5rem;
  display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: start;
}
@media (min-width: 60rem) { .lp-hero { grid-template-columns: 1.15fr .85fr; gap: 3.5rem; } }
.lp-eyebrow {
  color: var(--accent); font-weight: 600; font-size: .85rem; letter-spacing: .04em;
  margin: 0 0 .6rem;
}
.lp-hero h1 {
  font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 1rem;
}
.lp-lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 1.25rem; max-width: 34rem; }
.lp-lede em { color: var(--text); font-style: normal; font-weight: 600; }
.lp-ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.lp-ticks li { position: relative; padding-left: 1.6rem; color: var(--muted); font-size: .95rem; }
.lp-ticks li::before {
  content: ""; position: absolute; left: 0; top: .45rem; width: .95rem; height: .5rem;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.lp-signin { padding: 1.5rem; }
.lp-signin h2 { font-size: 1.25rem; }
.lp-fine { font-size: .82rem; margin-top: 1rem; }
.oauth { display: grid; gap: .55rem; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .6rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); text-decoration: none;
  font-weight: 600; font-size: .92rem;
}
.oauth-btn:hover { background: var(--surface-2); }
.oauth-ico { flex-shrink: 0; }
.divider {
  text-align: center; color: var(--muted); font-size: .8rem; margin: .9rem 0;
  display: flex; align-items: center; gap: .75rem;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.lp-band { background: var(--surface-2); border-block: 1px solid var(--line); padding: 3.5rem 0; }
.lp-inner > h2 { margin-top: 0; }
section.lp-inner { padding-block: 3.5rem; }
.lp-split { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: center; }
@media (min-width: 56rem) { .lp-split { grid-template-columns: 1fr 1fr; gap: 3rem; } }
.lp-illus { width: 100%; height: auto; }

.lp-steps, .lp-cards { display: grid; gap: 1.25rem; }
.lp-steps { grid-template-columns: 1fr; }
@media (min-width: 52rem) { .lp-steps { grid-template-columns: repeat(3, 1fr); } }
.lp-step h3, .lp-card h3 { margin: .6rem 0 .35rem; font-size: 1.05rem; }
.lp-step p, .lp-card p { margin: 0; color: var(--muted); font-size: .93rem; }
.lp-num {
  display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem;
}

.lp-cards { grid-template-columns: 1fr; }
@media (min-width: 40rem) { .lp-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 68rem) { .lp-cards { grid-template-columns: repeat(4, 1fr); } }
.lp-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem;
}
.lp-ico { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.lp-card-note {
  margin-top: .6rem !important; font-size: .82rem !important; color: var(--warn) !important;
}

.lp-nots { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 52rem) { .lp-nots { grid-template-columns: 1fr 1fr; } }
.lp-nots > div {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 10px;
  padding: .9rem 1.1rem; color: var(--muted); font-size: .94rem;
}
.lp-nots strong { color: var(--text); }

.lp-soon { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.lp-soon span {
  background: var(--surface); border: 1px dashed var(--line); color: var(--muted);
  border-radius: 999px; padding: .4rem .9rem; font-size: .88rem;
}

.lp-foot { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; }
.lp-foot-inner { display: grid; gap: .9rem; justify-items: center; text-align: center; }
.lp-foot-links { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.lp-foot-links a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.lp-foot-links a:hover { color: var(--text); }
.lp-copy { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.7; }
/* The "can make mistakes" line is deliberately the smallest thing on the page: present for
   honesty on every surface, never competing with the content it qualifies. */
.lp-disclaimer { margin: 0; color: var(--muted); font-size: .75rem; opacity: .85; max-width: 34rem; }

/* Sits under the composer, the same place every assistant puts it. Small and quiet, but
   never hidden behind a dismiss button — a warning you can permanently close is not a
   warning. */
.disclaimer {
  margin: .45rem 0 0; text-align: center;
  font-size: .72rem; line-height: 1.5; color: var(--muted); opacity: .8;
}

/* The sidebar brand carries the same mark as the landing page. Sized to match the old
   square badge so the header height does not shift. */
.sidebar .brand .lp-mark { width: 1.75rem; height: 1.75rem; color: var(--accent); }

/* ── composer controls ───────────────────────────────────────────────────────────
   Sit under the input, wrap on a phone rather than scrolling sideways. Quiet by
   default: they are settings, not the point of the screen. */
.controls {
  display: flex; flex-wrap: wrap; gap: .5rem .9rem;
  margin: .55rem 0 0; align-items: center;
}
.ctl { display: inline-flex; align-items: center; gap: .35rem; }
.ctl > span { font-size: .74rem; color: var(--muted); letter-spacing: .02em; }
.ctl select {
  font: inherit; font-size: .8rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: .2rem 1.5rem .2rem .5rem; cursor: pointer;
  /* Native arrow is inconsistent across platforms; one drawn arrow keeps the row tidy. */
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right .72rem center, right .5rem center;
  background-size: .3rem .3rem, .3rem .3rem;
  background-repeat: no-repeat;
}
.ctl select:hover { border-color: var(--muted); }
.ctl select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
