:root {
  /* CureSight brand: deep clinical teal on warm ivory, gold used only as the insight accent. */
  --bg: #F6F4EF; --panel: #FFFFFF; --ink: #0E2226; --muted: #5E6F70; --line: #E6E2D8;
  --side: #0A2A2B; --side-ink: #B8CCC8; --teal: #12806F; --teal-deep: #0A3D3A; --mint: #5FD3B8;
  --gold: #C9A15E; --green: #1F8A5B; --red: #B8433A; --amber: #B7791F;
  --blue: var(--teal); --grad: linear-gradient(135deg, #12806F, #0A3D3A);
  --radius: 16px; --shadow: 0 1px 2px rgba(14, 34, 38, .05), 0 8px 28px rgba(14, 34, 38, .06);
  --font: "Manrope", system-ui, sans-serif; --display: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--blue); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.015em; margin: 0; }
.eyebrow { font: 600 11.5px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }

.btn { border: 0; border-radius: 999px; padding: 10px 20px; font: 600 14px var(--font); cursor: pointer; background: #ECE8DE; color: var(--ink); }
.btn.primary { background: var(--teal-deep); color: #F7F4EC; } .btn.primary:hover { background: var(--teal); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(900px 500px at 85% 10%, rgba(95,211,184,.18), transparent 60%), radial-gradient(900px 600px at 0% 100%, rgba(201,161,94,.14), transparent 55%), var(--side); }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 20px; padding: 32px; display: grid; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-logo { width: 56px; }
.login-card h1 { font-size: 30px; } .login-card h1 span { color: var(--gold); }
.login-card label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card input { font: 15px var(--font); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.error { color: var(--red); min-height: 1em; margin: 0; font-size: 13px; }

/* shell */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font: 500 22px var(--display); color: #F7F4EC; padding: 0 8px 22px; }
.brand img { width: 32px; } .brand b { color: var(--gold); font-weight: 500; }
nav { display: grid; gap: 2px; }
nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-weight: 500; }
nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
nav a:hover { background: rgba(255,255,255,.06); }
nav a.active { background: rgba(95,211,184,.12); color: #fff; box-shadow: inset 3px 0 0 var(--mint); }
.side-foot { margin-top: auto; display: grid; gap: 10px; font-size: 12.5px; padding: 0 8px; }
.side-foot a { color: var(--side-ink); }
.fresh .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); margin-right: 6px; }
.lang-switch { display: inline-flex; background: rgba(255,255,255,.08); border-radius: 8px; padding: 2px; width: max-content; }
.lang-switch button { border: 0; background: transparent; color: inherit; font: 600 12px var(--font); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.lang-switch button.on { background: #fff; color: var(--ink); }
.lang-switch.small { background: #EFECE4; color: var(--muted); justify-self: center; }
main { overflow: hidden; display: flex; }
.view { flex: 1; overflow: auto; }
#view-ask { display: flex; flex-direction: column; overflow: hidden; }
#view-ask.hidden { display: none; }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 28px 60px; display: grid; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 26px; }

/* chat */
.thread { flex: 1; overflow: auto; padding: 28px 28px 12px; display: flex; flex-direction: column; gap: 18px; max-width: 1000px; width: 100%; margin: 0 auto; }
.hero { margin: auto 0; text-align: center; padding: 30px 0; }
.hero h2 { font-size: 40px; margin: 10px 0 8px; } .hero h2 em { font-style: italic; color: var(--teal); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font: 13.5px var(--font); cursor: pointer; color: var(--ink); text-align: left; }
.chip:hover { border-color: #9fd8c9; background: #EEF7F4; }
.msg-q { align-self: flex-end; background: var(--teal-deep); color: #F7F4EC; padding: 10px 16px; border-radius: 16px 16px 4px 16px; max-width: 80%; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.answer { display: grid; gap: 12px; }
.answer .lead { font-size: 16.5px; }
.answer ul { margin: 0; padding-left: 20px; display: grid; gap: 3px; }
.answer .chart { height: 300px; }
.answer .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.answer .meta .sp { flex: 1; }
.tag { background: #EFECE4; padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.tag.ai { background: #F6EEDC; color: #8A6424; }
details.how summary { cursor: pointer; font-size: 13px; color: var(--muted); }
details.how table { margin-top: 8px; }
details.how pre { background: var(--side); color: #d6e6e2; padding: 12px; border-radius: 10px; font-size: 11.5px; overflow: auto; white-space: pre-wrap; }
.clarify { border-left: 4px solid var(--amber); }
.thinking { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; }
.thinking i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .2; transform: scale(.6); } }
.composer { display: flex; gap: 10px; padding: 14px 28px 22px; max-width: 1000px; width: 100%; margin: 0 auto; }
.composer input { flex: 1; font: 15.5px var(--font); padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.composer input:focus { outline: 2px solid #9fd8c9; }
.icon-btn { width: 48px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; }
.icon-btn.rec { background: var(--teal); border-color: var(--teal); } .icon-btn.rec svg { stroke: #fff; }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1px solid #f0f2f7; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.hl td { background: #EEF7F4; font-weight: 600; }
.table-wrap { overflow-x: auto; }
.up { color: var(--green); } .down { color: var(--red); }
.bar { height: 8px; background: #EFECE4; border-radius: 4px; min-width: 80px; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--teal); }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi .k { font-size: 12.5px; color: var(--muted); }
.kpi .v { white-space: nowrap; font: 500 clamp(18px, 1.7vw, 25px) var(--display); margin: 4px 0 2px; }
.kpi .g { font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.card .chart { height: 290px; }
.pin-grid { display: grid; gap: 18px; }
.empty { text-align: center; padding: 40px; color: var(--muted); }
.def-market { border-top: 1px solid var(--line); padding: 10px 0; }
.def-market b { display: block; }
.def-market span { font-size: 12.5px; color: var(--muted); }
.note { background: #FBF5E8; border: 1px solid #EAD9B5; border-radius: 12px; padding: 12px 16px; font-size: 13.5px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100dvh; }
  .side { flex-direction: row; align-items: center; padding: 8px 12px; gap: 8px; overflow-x: auto; }
  .brand { padding: 0; } .brand span { display: none; }
  nav { display: flex; } nav a span { display: none; } nav a { padding: 8px; }
  .side-foot { margin: 0 0 0 auto; display: flex; align-items: center; } .side-foot .fresh, .side-foot .who { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .thread, .composer, .page { padding-left: 16px; padding-right: 16px; }
  .hero h2 { font-size: 26px; }
}

.login-card { border: 1px solid rgba(255,255,255,.4); }
.login-card h1 { font-size: 34px; }
.kpi { border-top: 3px solid transparent; } .kpi:first-child { border-top-color: var(--gold); }
.answer .lead b, .answer li b { color: var(--teal-deep); }
.disclaimer { font-size: 12px; color: var(--muted); }

/* insights */
.insights { padding: 16px 18px; text-align: left; }
.insights:empty { display: none; }
#hero-ins { margin: 26px auto 0; max-width: 920px; box-shadow: none; background: transparent; padding: 0; }
.ins-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.small { font-size: 12.5px; }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.ins { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 14px 14px 12px; cursor: pointer;
  display: grid; gap: 4px; font: 13px/1.4 var(--font); color: var(--ink); position: relative; transition: transform .15s, box-shadow .15s; }
.ins:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ins b { font-size: 14px; font-weight: 700; padding-right: 22px; }
.ins span { color: var(--muted); }
.ins em { font-style: normal; color: var(--teal); font-weight: 600; font-size: 12.5px; margin-top: 4px; }
.ins-ic { position: absolute; right: 12px; top: 10px; font-size: 15px; }
.ins.bad { border-left: 3px solid var(--red); } .ins.bad .ins-ic { color: var(--red); }
.ins.good { border-left: 3px solid var(--green); } .ins.good .ins-ic { color: var(--green); }
.ins.watch { border-left: 3px solid var(--gold); } .ins.watch .ins-ic { color: var(--gold); }
/* follow-ups and why */
.chips.left { justify-content: flex-start; margin: 0; }
.follow .chip { font-size: 13px; padding: 6px 12px; }
.chip.why-chip { background: var(--teal-deep); color: #F7F4EC; border-color: var(--teal-deep); font-weight: 600; }
.chip.why-chip:hover { background: var(--teal); }
.answer.why { border-top: 3px solid var(--gold); }
.contribs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 22px; }
.contrib { display: grid; gap: 6px; }
.crow { display: grid; grid-template-columns: minmax(90px, 1fr) 1.2fr auto; gap: 10px; align-items: center; font-size: 13px; }
.crow b { font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.cbar { height: 8px; background: #EFECE4; border-radius: 4px; position: relative; }
.cbar i { position: absolute; inset: 0 auto 0 0; background: var(--teal); border-radius: 4px; }
.cbar.neg i { background: var(--red); }
/* region map */
.regmap { width: 100%; max-width: 760px; display: block; }
.regmap .t-name { font: 600 13px var(--font); }
.regmap .t-val { font: 500 13px var(--font); }
/* talk mode */
.talk-btn svg { stroke: var(--teal-deep); }
.talk { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; padding: 24px;
  background: radial-gradient(700px 420px at 50% 40%, rgba(95,211,184,.22), transparent 70%), rgba(10,42,43,.96); color: #F7F4EC; }
.talk-orb { width: 150px; height: 150px; position: relative; margin-bottom: 10px; }
.talk-orb span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(95,211,184,.55); }
.talk-orb span:nth-child(1) { background: radial-gradient(circle at 35% 30%, #5FD3B8, #12806F 55%, #0A3D3A); border: 0; transform: scale(.62); box-shadow: 0 0 60px rgba(95,211,184,.45); }
.talk.listening .talk-orb span:nth-child(2) { animation: ring 1.6s infinite; }
.talk.listening .talk-orb span:nth-child(3) { animation: ring 1.6s .8s infinite; }
.talk.speaking .talk-orb span:nth-child(1) { animation: speak .5s infinite alternate; }
@keyframes ring { from { transform: scale(.62); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
@keyframes speak { from { transform: scale(.6); } to { transform: scale(.7); } }
.talk-state { font: 600 12px var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--mint); min-height: 1em; }
.talk-text { font: 400 28px/1.3 var(--display); max-width: 760px; min-height: 1.3em; }
.talk-hint { color: #9FB8B3; margin: 0; }
.talk .btn { background: rgba(255,255,255,.12); color: #F7F4EC; }

/* composer: dictation lives inside the field; voice chat is its own labelled button */
.composer .field { flex: 1; position: relative; display: flex; }
.composer .field input { flex: 1; padding-right: 54px; }
.dictate { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; display: grid; place-items: center; }
.dictate:hover { background: #EFECE4; }
.dictate svg { width: 21px; height: 21px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.dictate.rec { background: var(--red); animation: pulse-rec 1.2s infinite; } .dictate.rec svg { stroke: #fff; }
@keyframes pulse-rec { 50% { box-shadow: 0 0 0 6px rgba(184,67,58,.2); } }
.voice-chat { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--teal-deep); background: #fff; color: var(--teal-deep);
  border-radius: 12px; padding: 0 16px; font: 600 14px var(--font); cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; }
.voice-chat:hover { background: var(--teal-deep); color: #F7F4EC; }
.voice-chat svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.talk-orb { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.talk.tap .talk-orb span:nth-child(1) { animation: breathe 1.6s infinite; }
.talk.tap .talk-state { color: var(--gold); }
@keyframes breathe { 50% { transform: scale(.7); box-shadow: 0 0 90px rgba(201,161,94,.55); } }
.talk-text { max-height: 40vh; overflow: auto; }
@media (max-width: 600px) {
  .voice-chat span { display: none; } .voice-chat { padding: 0 12px; }
  .talk-text { font-size: 22px; }
}
.composer .field, .composer .field input { min-width: 0; }   /* flex inputs refuse to shrink otherwise */
@media (max-width: 600px) {
  .composer { gap: 8px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .composer .btn.primary { padding: 0 16px; }
  .composer .field input { font-size: 16px; }   /* 16px stops iOS zooming into the field */
}
