:root {
  --paper: #f6f2ea;
  --surface: #fffdf8;
  --ink: #241f1a;
  --soft: #756d61;
  --faint: #a89f92;
  --line: #e8dfce;
  --line-soft: #f0e9db;
  --accent: #b8543a;
  --accent-press: #a2452e;
  --accent-soft: #f3e2da;
  --sage: #5c7a63;
  --user: #ece3d3;
  --shadow: 0 10px 34px rgba(70, 50, 32, .10);
  --shadow-soft: 0 4px 16px rgba(70, 50, 32, .07);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
.app { display: flex; flex-direction: column; height: 100dvh; max-width: 720px; margin: 0 auto; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 18px 10px; }
.brand { font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: -.01em; line-height: 1; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--soft); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 500; cursor: pointer; max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { color: var(--ink); }
.top-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: none; background: transparent; color: var(--soft); border-radius: 12px; cursor: pointer; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }

/* ---------- feed ---------- */
.feed { flex: 1; overflow-y: auto; padding: 8px 16px 18px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.feed::-webkit-scrollbar { width: 0; }

.greeting { margin: auto 0; padding: 24px 6px; text-align: left; }
.greeting h1 { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.18; letter-spacing: -.015em; margin: 0 0 14px; color: var(--ink); }
.greeting h1 em { font-style: italic; color: var(--accent); }
.greeting p { color: var(--soft); font-size: 16px; margin: 0 0 20px; max-width: 30em; }
.eg-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 8px; }
.eg { display: flex; flex-direction: column; gap: 8px; }
.eg button { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-family: inherit; font-size: 14.5px; color: var(--ink); cursor: pointer; line-height: 1.45; box-shadow: var(--shadow-soft); }
.eg button:hover { border-color: var(--accent); }
.eg button span { color: var(--faint); }

/* messages */
.msg { max-width: 86%; padding: 12px 15px; border-radius: 18px; font-size: 15.5px; line-height: 1.5; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow-soft); }
.msg.ai .answer { white-space: pre-wrap; }
.msg.ai b { font-weight: 600; }
.msg.thinking { color: var(--faint); font-style: italic; }
.dots span { display: inline-block; width: 5px; height: 5px; margin: 0 1px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.dots span:nth-child(2){ animation-delay: .2s; } .dots span:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,60%,100%{ opacity:.25; } 30%{ opacity:1; } }

/* added-summary card */
.added { align-self: flex-start; max-width: 88%; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; border-bottom-left-radius: 6px; padding: 13px 15px; box-shadow: var(--shadow-soft); }
.added-head { font-size: 13px; color: var(--sage); font-weight: 600; margin-bottom: 9px; display: flex; align-items: center; gap: 6px; }
.added-lines { display: flex; flex-direction: column; gap: 5px; margin-bottom: 6px; }
.added-line { font-size: 14.5px; line-height: 1.45; }
.added-line .r { color: var(--accent); font-weight: 500; }
.added-status { font-size: 14.5px; line-height: 1.5; color: var(--sage); font-weight: 500; margin-bottom: 8px; }
.added-summary { font-size: 14px; line-height: 1.5; color: var(--ink); margin-bottom: 9px; }
.added-caveat { font-size: 12.5px; line-height: 1.45; color: var(--soft); margin-top: 8px; }
.added-sources { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px; margin-top: 9px; font-size: 12px; }
.added-sources .src-label { color: var(--soft); }
.added-sources .src { color: var(--soft); text-decoration: underline; text-underline-offset: 2px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.added-sources .src:hover { color: var(--accent); }
/* "want me to look them up?" prompt */
.offer { align-self: flex-start; max-width: 88%; background: var(--surface); border: 1px dashed var(--line); border-radius: 18px; border-bottom-left-radius: 6px; padding: 13px 15px; }
.offer-q { font-size: 14.5px; line-height: 1.45; color: var(--ink); margin-bottom: 10px; }
.offer-row { display: flex; flex-wrap: wrap; gap: 8px; }
.offer-yes { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 7px 14px; font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.offer-yes:hover { filter: brightness(1.07); }
.offer-no { background: none; border: none; color: var(--soft); font-family: inherit; font-size: 13px; cursor: pointer; padding: 7px 4px; }
.offer-no:hover { color: var(--ink); }
.added-nodes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ntag { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-soft); color: #7a3a28; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 500; }
.added-foot { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.added-foot button { background: none; border: none; color: var(--soft); font-family: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.added-foot .insight { color: var(--accent); font-weight: 500; text-decoration: none; }

/* ---------- composer ---------- */
.composer { padding: 8px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--paper) 24%); }
.mode-toggle { position: relative; display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin: 0 auto 10px; box-shadow: var(--shadow-soft); }
.mode-btn { position: relative; z-index: 1; border: none; background: transparent; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--soft); padding: 7px 22px; border-radius: 999px; cursor: pointer; transition: color .2s; }
.mode-btn.active { color: #fff; }
.mode-slider { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); background: var(--accent); border-radius: 999px; transition: transform .24s cubic-bezier(.4,1.2,.4,1); }
.mode-toggle.ask .mode-slider { transform: translateX(100%); background: var(--sage); }
.input-row { display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); }
.input-row:focus-within { border-color: var(--accent); }
#composer { flex: 1; border: none; background: transparent; resize: none; font-family: inherit; font-size: 16px; line-height: 1.45; color: var(--ink); outline: none; max-height: 40vh; padding: 8px 0; }
#composer::placeholder { color: var(--faint); }
.mic-btn, .send-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: none; display: grid; place-items: center; cursor: pointer; }
.mic-btn { background: var(--paper); color: var(--soft); }
.mic-btn:hover { color: var(--ink); }
.mic-btn.recording { background: var(--accent); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(184,84,58,.4);} 50%{ box-shadow: 0 0 0 10px rgba(184,84,58,0);} }
.send-btn { background: var(--accent); color: #fff; }
.send-btn:hover { background: var(--accent-press); }
.send-btn:disabled { opacity: .4; cursor: default; }
body.ask-mode .send-btn { background: var(--sage); }
body.ask-mode .input-row:focus-within { border-color: var(--sage); }
body.ask-mode .mic-btn.recording { background: var(--sage); }

/* ---------- graph overlay ---------- */
.overlay { position: fixed; inset: 0; background: var(--paper); z-index: 40; display: none; flex-direction: column; }
.overlay.open { display: flex; }
.overlay-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.overlay-title { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.overlay-head .icon-btn { margin-left: auto; }
#graph { flex: 1; width: 100%; display: block; touch-action: none; cursor: grab; }
.node-card { position: absolute; left: 14px; right: 14px; bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 15px 16px; box-shadow: var(--shadow); display: none; max-height: 52dvh; overflow-y: auto; }
.node-card.open { display: block; }
.nc-name { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.nc-kind { color: var(--faint); font-size: 13px; margin-bottom: 8px; }
.nc-count { position: sticky; top: -15px; background: var(--surface); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 6px 0 2px; }
.nc-line { font-size: 14.5px; line-height: 1.5; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.nc-line:first-of-type { border-top: none; }
.nc-line .r { color: var(--accent); }

/* ---------- settings sheet ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(40,30,20,.28); backdrop-filter: blur(2px); z-index: 50; display: none; align-items: flex-end; justify-content: center; }
.sheet-bg.open { display: flex; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--paper); border-radius: 26px 26px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(40,30,20,.2); }
.sheet-grip { width: 42px; height: 4px; background: var(--line); border-radius: 3px; margin: 8px auto 6px; }
.sheet h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 6px 0 16px; }
.set-block { margin-bottom: 20px; }
.set-label { font-size: 13px; font-weight: 600; color: var(--soft); margin-bottom: 8px; }
.set-hint { font-size: 12.5px; color: var(--faint); margin-top: 7px; line-height: 1.5; }
.acct-who { font-size: 14.5px; color: var(--ink); margin-bottom: 10px; }
#account-body .btn { width: 100%; }
.set-hint code { background: var(--surface); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.set-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.manual { display: flex; flex-direction: column; gap: 8px; }
.field { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; font-family: inherit; font-size: 15px; color: var(--ink); outline: none; margin-bottom: 8px; }
.field:last-child { margin-bottom: 0; }
.field:focus { border-color: var(--accent); }
select.field { -webkit-appearance: none; appearance: none; }

.btn { font-family: inherit; font-size: 15px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 11px 16px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-press); }
.btn.ghost { background: transparent; font-weight: 500; font-size: 14px; padding: 9px 13px; }
.btn.danger { color: var(--accent); }
.btn.wide { width: 100%; margin-top: 6px; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(14px); background: var(--ink); color: var(--paper); padding: 11px 17px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .22s; z-index: 90; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 640px) { .greeting h1 { font-size: 34px; } }

/* ---------- login gate ---------- */
.login-screen { position: fixed; inset: 0; z-index: 120; background: radial-gradient(120% 90% at 50% -10%, #fbf7ef 0%, var(--paper) 60%); display: flex; align-items: center; justify-content: center; padding: 28px; }
.login-screen[hidden] { display: none; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-brand { font-family: "Fraunces", Georgia, serif; font-size: 46px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.login-tag { margin: 12px auto 30px; max-width: 300px; font-size: 16px; line-height: 1.55; color: var(--soft); }
.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 11px; width: 100%; background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 12px; padding: 13px 18px; font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-soft); transition: .16s; }
.google-btn:hover { box-shadow: 0 2px 10px rgba(60,64,67,.18); border-color: #cfd3d8; }
.google-btn:active { transform: translateY(1px); }
.login-note { margin-top: 18px; font-size: 12.5px; color: var(--faint); }

/* ---------- mock google account chooser ---------- */
.gauth-bg { position: fixed; inset: 0; z-index: 130; background: rgba(32,26,20,.42); display: flex; align-items: center; justify-content: center; padding: 22px; }
.gauth-bg[hidden] { display: none; }
.gauth { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 16px 50px rgba(0,0,0,.28); font-family: "Roboto", "Inter", system-ui, sans-serif; }
.gauth-head { padding: 26px 26px 14px; border-bottom: 1px solid #ebebeb; }
.gauth-logo { font-size: 22px; font-weight: 500; letter-spacing: -.5px; }
.gauth-title { margin-top: 16px; font-size: 21px; color: #202124; }
.gauth-sub { margin-top: 3px; font-size: 14px; color: #5f6368; }
.gauth-list { padding: 6px 0; }
.gauth-acct { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 26px; background: none; border: none; text-align: left; cursor: pointer; font-family: inherit; }
.gauth-acct:hover { background: #f7f8f8; }
.gauth-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; font-weight: 500; flex: none; }
.gauth-meta { line-height: 1.35; }
.gauth-name { font-size: 14px; color: #202124; font-weight: 500; }
.gauth-email { font-size: 13px; color: #5f6368; }
.gauth-add .gauth-avatar { background: #f1f3f4; color: #5f6368; }
.gauth-demo { padding: 12px 26px 20px; font-size: 12px; color: #9aa0a6; }

/* ---------- projects home ---------- */
.home-screen { position: fixed; inset: 0; z-index: 50; background: var(--paper); display: flex; flex-direction: column; overflow-y: auto; }
.home-screen[hidden] { display: none; }
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; position: sticky; top: 0; background: var(--paper); }
.home-top .brand { font-family: "Fraunces", Georgia, serif; font-size: 24px; font-weight: 600; color: var(--ink); }
.home-body { flex: 1; padding: 8px 20px calc(40px + env(safe-area-inset-bottom)); max-width: 760px; width: 100%; margin: 0 auto; }
.home-head { padding: 14px 4px 22px; }
.home-head h1 { font-family: "Fraunces", Georgia, serif; font-size: 30px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.home-sub { margin-top: 7px; font-size: 15px; line-height: 1.5; color: var(--soft); max-width: 460px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.card { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 16px; cursor: pointer; transition: .16s; box-shadow: var(--shadow-soft); min-height: 118px; display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-name { font-family: "Fraunces", Georgia, serif; font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.2; padding-right: 22px; }
.card-stat { margin-top: auto; padding-top: 14px; font-size: 13px; color: var(--faint); }
.card-x { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; border: none; background: transparent; color: var(--faint); font-size: 17px; line-height: 1; cursor: pointer; opacity: 0; transition: .14s; }
.card:hover .card-x { opacity: 1; }
.card-x:hover { background: var(--accent-soft); color: var(--accent); }
.card.new-card { align-items: center; justify-content: center; text-align: center; border-style: dashed; background: transparent; color: var(--soft); }
.card.new-card:hover { color: var(--accent); transform: translateY(-2px); }
.card.new-card .plus { font-size: 30px; font-weight: 300; line-height: 1; }
.card.new-card .new-label { margin-top: 8px; font-size: 14px; font-weight: 600; }
.home-empty { text-align: center; padding: 30px 10px; color: var(--soft); font-size: 15px; }

/* topbar: back button + project title */
.back-btn { margin-right: 2px; }
.proj-title { flex: 1; font-family: "Fraunces", Georgia, serif; font-size: 19px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- graph isolate hint ---------- */
.graph-hint { position: absolute; top: 60px; left: 50%; transform: translateX(-50%) translateY(-8px); display: none; align-items: center; gap: 12px; background: var(--ink); color: var(--paper); padding: 8px 8px 8px 15px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); z-index: 5; max-width: 90vw; }
.graph-hint.show { display: flex; }
.graph-hint b { font-weight: 600; }
.graph-hint button { font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink); background: var(--paper); border: none; border-radius: 999px; padding: 6px 13px; cursor: pointer; white-space: nowrap; }
.graph-hint button:hover { background: #fff; }

/* ---------- graph right-click context menu ---------- */
.ctx-menu { position: fixed; z-index: 20; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 5px; }
.ctx-menu[hidden] { display: none; }
.ctx-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); padding: 7px 10px 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-item { display: block; width: 100%; text-align: left; font-family: inherit; font-size: 14px; color: var(--ink); background: none; border: none; border-radius: 8px; padding: 9px 10px; cursor: pointer; }
.ctx-item:hover { background: var(--accent-soft); color: var(--accent); }

/* Google Identity Services renders its own button here */
.gsi-button { display: flex; justify-content: center; margin-top: 4px; min-height: 44px; }

/* live lookup panel */
.lookup { align-self: flex-start; max-width: 88%; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; border-bottom-left-radius: 6px; padding: 13px 15px; box-shadow: var(--shadow-soft); }
.lookup-head { font-size: 13px; font-weight: 600; color: var(--sage); margin-bottom: 9px; }
.lookup-steps { display: flex; flex-direction: column; gap: 5px; }
.lookup-step { font-size: 13px; line-height: 1.45; color: var(--soft); word-break: break-word; }
.lookup-step .si { color: var(--faint); margin-right: 5px; }
.lookup-step.search { color: var(--ink); }
.lookup-step.results { color: var(--soft); font-size: 12.5px; }
.lookup-foot { margin-top: 11px; display: flex; gap: 8px; }
.lookup-stop { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 5px 13px; font-family: inherit; font-size: 12.5px; cursor: pointer; }
.lookup-stop:hover { border-color: var(--accent); color: var(--accent); }
.lookup-stop:disabled { opacity: .5; cursor: default; }
.lookup-more { background: none; border: none; color: var(--soft); font-family: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.lookup-end { margin-top: 9px; font-size: 12.5px; color: var(--faint); }

#composer.steering { color: var(--accent); }
.input-row:has(#composer.steering) { border-color: var(--accent); }
.lookup-step.steer { color: var(--accent); font-weight: 500; }

/* ---------- research tray ---------- */
.tray-pill { background: var(--accent-soft); color: #7a3a28; border: none; border-radius: 999px; padding: 6px 12px; font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tray-pill:hover { filter: brightness(.97); }

.review-overlay { position: fixed; inset: 0; background: var(--paper); z-index: 60; display: none; flex-direction: column; }
.review-overlay.open { display: flex; }
.review-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px calc(10px); border-bottom: 1px solid var(--line-soft); }
.review-title { font-family: var(--serif); font-size: 19px; font-weight: 600; flex: 1; text-align: center; }
.review-body { flex: 1; overflow-y: auto; padding: 16px 18px calc(28px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; width: 100%; }

.rv-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px; margin-bottom: 12px; cursor: pointer; box-shadow: var(--shadow-soft); }
.rv-card:hover { border-color: var(--accent); }
.rv-card-name { font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.rv-card-sub { font-size: 13.5px; color: var(--soft); }
.rv-card-state { font-size: 12px; color: var(--faint); margin-top: 7px; }

.rv-name { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.2; }
.rv-role { font-size: 15px; color: var(--soft); margin-top: 4px; }
.rv-warn { margin-top: 14px; background: #fdf3ee; border: 1px solid var(--accent-soft); border-radius: 12px; padding: 11px 13px; font-size: 13.5px; line-height: 1.5; color: #7a3a28; }
.rv-sec { margin-top: 20px; }
.rv-sec h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 0 0 8px; font-weight: 600; }
.rv-sec p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.rv-row { font-size: 14.5px; line-height: 1.5; padding: 4px 0; }
.rv-row .r { color: var(--accent); }
.rv-src { display: block; font-size: 13px; color: var(--soft); padding: 4px 0; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.rv-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--paper) 30%); padding: 18px 0 4px; display: flex; flex-wrap: wrap; gap: 9px; }
.rv-actions .btn-yes { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 11px 20px; font-family: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.rv-actions .btn-no { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 11px 18px; font-family: inherit; font-size: 14.5px; cursor: pointer; }
.rv-actions .btn-drop { background: none; border: none; color: var(--soft); font-family: inherit; font-size: 14px; cursor: pointer; padding: 11px 8px; }


/* chat inside the review page */
.rv-chat { border-top: 1px solid var(--line-soft); padding-top: 18px; }
.rv-thread { display: flex; flex-direction: column; gap: 7px; margin-bottom: 11px; }
.rv-msg { font-size: 14px; line-height: 1.45; padding: 9px 12px; border-radius: 14px; max-width: 90%; }
.rv-msg.me { align-self: flex-end; background: var(--user); border-bottom-right-radius: 5px; }
.rv-msg.it { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; color: var(--soft); }
.rv-chatrow { display: flex; gap: 8px; }
.rv-input { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 11px 16px; font-family: inherit; font-size: 15px; color: var(--ink); outline: none; min-width: 0; }
.rv-input:focus { border-color: var(--accent); }
.rv-send { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 11px 18px; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.rv-send:disabled { opacity: .5; cursor: default; }


.rv-row.dim { opacity: .55; }
.rv-card.dim { opacity: .62; }


.rv-tag { font-size: 11.5px; font-weight: 600; white-space: nowrap; border-radius: 999px; padding: 1px 8px; }
.rv-tag.new     { color: var(--accent); background: var(--accent-soft); }
.rv-tag.linked  { color: #7a6a3b; background: #f4ecd8; }
.rv-tag.waiting { color: #6a5a8a; background: #ece6f4; }
.rv-tag.added   { color: var(--sage); background: #e6efe7; }

/* cost dashboard */
.cost-tiles { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cost-tile { flex: 1; min-width: 140px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px; }
.ct-val { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; }
.ct-label { font-size: 12.5px; color: var(--soft); margin-top: 6px; }
.ct-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.cost-note { font-size: 12.5px; color: var(--soft); line-height: 1.5; margin-bottom: 16px; }
.cost-table { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cost-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.cost-row:last-child { border-bottom: none; }
.cost-head { background: var(--surface); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; }
.cost-row .cell.num { text-align: right; font-variant-numeric: tabular-nums; min-width: 62px; }
.cost-name { font-size: 14.5px; font-weight: 500; }
.cost-meta { font-size: 12px; color: var(--soft); margin-top: 2px; }
.cost-row .cell.num.over { color: var(--accent); font-weight: 600; }
.cost-row .cell.num.under { color: var(--sage); font-weight: 600; }
.cost-row .cell.num.muted { color: var(--faint); }

/* budget control on the cost dashboard */
.cost-budget { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px; margin-bottom: 14px; }
.cb-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; margin-bottom: 9px; }
.cb-row { display: flex; align-items: center; gap: 8px; }
.cb-dollar { font-size: 18px; color: var(--soft); }
.cb-input { width: 110px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-family: inherit; font-size: 16px; color: var(--ink); outline: none; }
.cb-input:focus { border-color: var(--accent); }
.cb-save { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 9px 16px; font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.cb-hint { font-size: 12.5px; color: var(--soft); margin-top: 9px; line-height: 1.5; }
