/* Score 800 — Credit Expert Chat
   The chat is a phone-sized surface because that is where customers meet it.
   The rail beside it is the operator view: report, plan, and what this costs. */

:root {
  --ink: #16211d;
  --ink-2: #4a5a53;
  --ink-3: #8a978f;
  --paper: #efece4;
  --surface: #fffefb;
  --line: #e0dcd1;
  --line-soft: #ece8de;

  --brand: #12513a;
  --brand-2: #1a7a56;
  --brand-wash: #e8f0ea;

  --clay: #c2562f;
  --clay-wash: #fbeee7;
  --amber: #a8720f;
  --amber-wash: #fbf2e0;

  --bubble-them: #ffffff;
  --bubble-me: #12513a;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d3cec2; border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }

.app {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  height: 100vh;
}
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .rail { order: 2; border-right: 0; border-top: 1px solid var(--line); }
}

/* ============================ RAIL ============================ */
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px 20px 30px;
}
.wordmark { display: flex; align-items: baseline; gap: 7px; margin-bottom: 3px; }
.wordmark b {
  font: 700 21px/1 var(--serif);
  letter-spacing: -.015em;
  color: var(--brand);
}
.wordmark span {
  font-size: 10px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-3);
}
.tagline { font-size: 12px; color: var(--ink-3); margin-bottom: 22px; }

.sec { margin-bottom: 24px; }
.sec + .sec { border-top: 1px solid var(--line-soft); padding-top: 22px; }
.sec h2 {
  margin: 0 0 13px;
  font-size: 10px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-3);
}

.who-input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font: inherit; background: #fdfcf9; color: var(--ink);
}
.who-input:focus { outline: 2px solid var(--brand-wash); border-color: var(--brand-2); }
.note { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; margin-top: 9px; }

/* sample reports */
.reports { display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 9px; overflow: hidden; }
.rep {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 0; background: var(--surface); padding: 10px 12px; text-align: left; width: 100%;
  transition: background .12s;
}
.rep:hover { background: var(--brand-wash); }
.rep-name { font-size: 13px; font-weight: 600; }
.rep-score { font: 700 14px/1 var(--serif); }
.rep-kind {
  font-size: 10px; font-weight: 650; letter-spacing: .02em;
  color: var(--ink-3); flex: 0 0 auto;
}
.rep-kind.slow { color: var(--clay); }

.drop {
  margin-top: 9px; border: 1.5px dashed #cfc9bb; border-radius: 9px;
  padding: 14px 10px; text-align: center; color: var(--ink-3); font-size: 12px;
  background: #fdfcf9; transition: .14s;
}
.drop.over { border-color: var(--brand-2); background: var(--brand-wash); color: var(--brand); }

/* report on file */
.file-head { display: flex; gap: 13px; align-items: center; margin-bottom: 14px; }
.dial {
  width: 66px; height: 66px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; text-align: center; line-height: 1;
  border: 2px solid currentColor;
}
.dial b { font: 700 22px/1 var(--serif); display: block; }
.dial i {
  font-style: normal; font-size: 8.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; opacity: .8;
}
.file-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.file-facts { font-size: 12px; color: var(--ink-2); margin-top: 3px; }

.flags { display: grid; gap: 8px; }
.flag { display: flex; gap: 9px; font-size: 12.5px; line-height: 1.45; }
.flag i {
  width: 3px; border-radius: 2px; flex: 0 0 auto; margin: 3px 0;
  font-style: normal;
}
.flag.critical i { background: var(--clay); }
.flag.high i { background: var(--amber); }
.flag.medium i { background: #c9a227; }
.flag.none i { background: var(--brand-2); }
.provenance { font-size: 11px; color: var(--ink-3); margin-top: 13px; line-height: 1.5; }

/* plan */
.plan { display: grid; gap: 7px; }
.task { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; }
.task i {
  width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid #cfc9bb;
  flex: 0 0 auto; margin-top: 2px; display: grid; place-items: center;
  font-size: 9px; font-style: normal; color: #fff;
}
.task.done i { background: var(--brand-2); border-color: var(--brand-2); }
.task.done { color: var(--ink-3); }
.task.next i { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-wash); }

/* ============================ STAGE ============================ */
.stage {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 20px 24px; overflow-y: auto; min-height: 0;
}

/* cost bar */
.cost {
  width: 100%; max-width: 430px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  margin-bottom: 14px; flex: 0 0 auto;
}
.cost-top {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  width: 100%; border: 0; background: transparent; text-align: left;
}
.cost-top:hover { background: #faf8f3; }
.cost-main { flex: 1; min-width: 0; }
.cost-k {
  font-size: 9.5px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--ink-3);
}
.cost-v { font: 700 19px/1.1 var(--serif); margin-top: 2px; letter-spacing: -.01em; }
.cost-v small { font: 600 11px/1 var(--sans); color: var(--ink-3); margin-left: 5px; }
.cost-side { text-align: right; }
.cost-side .n { font-size: 13px; font-weight: 700; }
.cost-side .n.good { color: var(--brand-2); }
.cost-chev { color: var(--ink-3); font-size: 11px; transition: transform .18s; }
.cost.open .cost-chev { transform: rotate(180deg); }

.cost-body { display: none; border-top: 1px solid var(--line-soft); }
.cost.open .cost-body { display: block; }
.line {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px;
}
.line:last-child { border-bottom: 0; }
.line .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line .tok { font-size: 11px; color: var(--ink-3); flex: 0 0 auto; }
.line .amt { font-weight: 700; flex: 0 0 auto; min-width: 52px; text-align: right; }
.line.ingest { background: #fbf9f4; color: var(--ink-3); }
.line.ingest .lbl { font-weight: 600; }
.line.outside .amt { font-weight: 600; }
.line.outside .lbl::after {
  content: ' · one-time, not in the total';
  font-size: 10.5px; font-weight: 500; color: var(--ink-3);
}
.line-note { padding: 0 14px 9px; font-size: 11px; color: var(--ink-3); line-height: 1.5; margin-top: -3px; }
.cost-foot {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: #faf8f3; border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-2);
}
.cost-foot b { color: var(--ink); }

/* phone */
.phone {
  width: 100%; max-width: 430px; flex: 1 1 auto; min-height: 420px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 26px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(22,33,29,.05), 0 18px 44px -14px rgba(22,33,29,.22);
}
.bar {
  background: var(--brand); color: #fff; padding: 13px 15px;
  display: flex; align-items: center; gap: 11px; flex: 0 0 auto;
  box-shadow: 0 3px 10px -2px rgba(22,33,29,.35);
  position: relative; z-index: 2;
}
.face {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  background: rgba(255,255,255,.16); display: grid; place-items: center;
  font: 700 15px/1 var(--serif); border: 1px solid rgba(255,255,255,.22);
}
.bar-mid { flex: 1; min-width: 0; }
.bar-name { font-weight: 650; display: flex; align-items: center; gap: 7px; font-size: 14.5px; }
.tag-ai {
  font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  background: rgba(255,255,255,.18); border-radius: 3px; padding: 2px 5px;
}
.bar-sub { font-size: 11.5px; opacity: .82; margin-top: 1px; }

.switch { display: inline-flex; background: rgba(255,255,255,.12); border-radius: 8px; padding: 2px; }
.switch button {
  border: 0; background: transparent; border-radius: 6px; padding: 5px 8px;
  font-size: 11px; font-weight: 650; color: rgba(255,255,255,.72); white-space: nowrap;
}
.switch button .n {
  display: inline-block; min-width: 15px; padding: 0 4px; margin-left: 4px;
  border-radius: 8px; background: rgba(255,255,255,.22); font-size: 9.5px; line-height: 15px; text-align: center;
}
.switch button.on .n { background: var(--brand-wash); color: var(--brand); }
.switch button.on { background: rgba(255,255,255,.94); color: var(--brand); }
.switch button:disabled { opacity: .38; cursor: not-allowed; }

.thread {
  flex: 1; overflow-y: auto; padding: 18px 14px 12px; min-height: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(18,81,58,.035), transparent 46%),
    radial-gradient(circle at 82% 78%, rgba(194,86,47,.03), transparent 44%),
    #f7f5ef;
}
.stamp { text-align: center; margin: 2px 0 14px; }
.stamp span {
  font-size: 10.5px; font-weight: 650; color: var(--ink-3);
  background: rgba(255,255,255,.8); padding: 3px 11px; border-radius: 20px;
  border: 1px solid var(--line-soft);
}
.row { display: flex; margin-bottom: 7px; }
.row.me { justify-content: flex-end; }
.said {
  max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 13.5px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 1px rgba(22,33,29,.07);
}
.row.them .said { background: var(--bubble-them); border-bottom-left-radius: 4px; }
.row.me .said { background: var(--bubble-me); color: #fff; border-bottom-right-radius: 4px; }
.at { font-size: 9.5px; color: var(--ink-3); align-self: flex-end; margin: 0 5px 3px; }

.dots .said { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: #bcc4bf; animation: bob 1.25s infinite; }
.dots i:nth-child(2) { animation-delay: .16s; }
.dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bob { 0%,62%,100% { opacity:.32; transform: translateY(0);} 32% { opacity:1; transform: translateY(-3px);} }

/* action cards inside the thread */
.act {
  max-width: 82%; margin: 3px 0 11px; background: #fff;
  border: 1px solid var(--line); border-radius: 13px; overflow: hidden;
  box-shadow: 0 2px 7px rgba(22,33,29,.07);
}
.act-in { padding: 11px 13px; }
.act-kind {
  font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brand-2); margin-bottom: 5px;
}
.act-kind.settlement { color: var(--clay); }
.act-kind.referral { color: #7a5199; }
.act-kind.email_draft { color: var(--amber); }
.act-title { font-weight: 700; font-size: 14px; line-height: 1.35; letter-spacing: -.01em; }
.act-sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.act-meta { font-size: 11px; color: var(--ink-3); margin-top: 7px; line-height: 1.45; }
.act-go {
  display: block; text-align: center; text-decoration: none;
  background: var(--brand-2); color: #fff; padding: 10px; font-weight: 700; font-size: 12.5px;
  border-top: 1px solid var(--line-soft);
}
.act-go:hover { background: #126043; }
.act-go.mail { background: var(--amber); }
.act-go.mail:hover { background: #8c5f0b; }
.mail-body {
  border-top: 1px solid var(--line-soft); padding: 10px 13px; background: #fbf9f4;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-2); white-space: pre-wrap; max-height: 120px; overflow-y: auto;
}

/* composer */
.write { border-top: 1px solid var(--line-soft); padding: 9px 12px 11px; background: var(--surface); flex: 0 0 auto; }
.quick { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick[hidden] { display: none; }
.quick button {
  border: 1px solid var(--line); background: #fdfcf9; border-radius: 16px;
  padding: 5px 11px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; flex: 0 0 auto;
}
.quick button:hover { background: var(--brand-wash); border-color: #bcd3c4; color: var(--brand); }
.write-row { display: flex; gap: 8px; align-items: flex-end; }
.write textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 18px;
  padding: 9px 14px; font: inherit; font-size: 13.5px; max-height: 108px;
  background: #fdfcf9; color: var(--ink);
}
.write textarea:focus { outline: 2px solid var(--brand-wash); border-color: var(--brand-2); }
.go {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex: 0 0 auto;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 14px;
}
.go:hover { background: #0e412f; }
.go:disabled { background: #c4ccc7; }

/* states */
.blank { display: grid; place-items: center; height: 100%; text-align: center; padding: 34px 26px; }
.blank b { display: block; font: 700 17px/1.3 var(--serif); margin-bottom: 7px; }
.blank p { color: var(--ink-2); font-size: 13px; max-width: 290px; margin: 0 auto; }

.alert {
  margin: 9px 12px 0; padding: 9px 12px; border-radius: 9px; font-size: 12px; line-height: 1.5;
  background: var(--clay-wash); color: #8a3a1c; border: 1px solid #eecfc0;
}
.alert.working { background: var(--brand-wash); color: var(--brand); border-color: #c3ddcc; }
.alert .spin {
  display: inline-block; width: 10px; height: 10px; margin-right: 7px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* past chats */
.past-list { display: grid; gap: 8px; padding: 4px 2px; }
.past-item {
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 11px 13px; text-align: left; width: 100%; display: grid; gap: 4px;
  box-shadow: 0 1px 1px rgba(22,33,29,.06); transition: background .12s, border-color .12s;
}
.past-item:hover { background: var(--brand-wash); border-color: #bcd3c4; }
.past-when { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--brand-2); text-transform: uppercase; }
.past-preview { font-size: 13px; color: var(--ink); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.past-meta { font-size: 11px; color: var(--ink-3); }
.past-banner {
  position: sticky; top: -18px; z-index: 1; margin: -6px -2px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  box-shadow: 0 3px 10px -4px rgba(22,33,29,.25);
}
.past-banner .t { flex: 1 1 100%; min-width: 0; }
.past-banner button { flex: 0 0 auto; white-space: nowrap; }
.past-banner button.resume { margin-left: auto; }
.past-banner .t b { display: block; font-size: 12.5px; }
.past-banner .t span { font-size: 11px; color: var(--ink-3); }
.past-banner button {
  border: 1px solid var(--line); background: #fdfcf9; border-radius: 8px;
  padding: 6px 10px; font-size: 11.5px; font-weight: 650; color: var(--ink-2);
}
.past-banner button.resume { background: var(--brand); border-color: var(--brand); color: #fff; }
.past-banner button:hover { filter: brightness(.97); }
.thread.readonly { background: #f2f0ea; }
