@font-face { font-family: 'Jakarta'; src: url('/static/fonts/jakarta-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Jakarta'; src: url('/static/fonts/jakarta-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Jakarta'; src: url('/static/fonts/jakarta-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Jakarta'; src: url('/static/fonts/jakarta-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-2: #f2f5f0;
  --mint: #e8f5ed;
  --mint-2: #d5eddf;
  --line: #e6eae3;
  --line-2: #d8ded4;
  --text: #1c2620;
  --text-2: #4f5b53;
  --muted: #7f8a82;
  --primary: #1f7a52;
  --primary-hover: #196845;
  --sun: #f2a93b;
  --danger: #c23b3b;
  --danger-soft: #fdeeee;
  --warn-text: #8a5a00;
  --warn-soft: #fff4dc;
  --shadow-sm: 0 1px 2px rgb(28 38 32 / 6%), 0 1px 1px rgb(28 38 32 / 4%);
  --shadow-md: 0 10px 30px rgb(28 38 32 / 8%), 0 2px 6px rgb(28 38 32 / 4%);
  --shadow-lg: 0 24px 60px rgb(28 38 32 / 14%);
  --font: 'Jakarta', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid #1f7a5259; outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
kbd { font: 600 11px/1 var(--font); color: var(--text-2); background: var(--surface); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px; }
svg { flex: none; }

/* Layout */
.app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.app[data-view="auth"] .signed-in, .app[data-view="boot"] .signed-in { display: none !important; }
.app:not([data-view="workspace"]) .view { display: none !important; }
.app:not([data-view="auth"]) .auth { display: none; }
.main { flex: 1; min-height: 0; position: relative; }
.view[hidden] { display: none !important; }

.header { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 68px; padding: 0 24px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; justify-self: start; }
.logo-kame { width: 38px; height: 38px; display: block; border-radius: 50%; overflow: hidden; background: var(--mint); }
.logo-text { font-weight: 700; font-size: 21px; letter-spacing: -.02em; }
.switch { display: inline-flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.switch button { position: relative; padding: 7px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: background .2s, color .2s, box-shadow .2s; }
.switch button:hover { color: var(--text); }
.switch button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.switch-dot { position: absolute; top: 6px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 6px; }
.ghost-button { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 12px; font-size: 14px; font-weight: 500; color: var(--text-2); transition: background .15s, color .15s; }
.ghost-button:hover { background: var(--surface-2); color: var(--text); }
.ghost-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--mint); color: var(--primary); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.avatar { width: 38px; height: 38px; margin-left: 4px; border-radius: 50%; background: var(--mint-2); color: var(--primary); font-weight: 700; font-size: 15px; transition: box-shadow .15s; }
.avatar:hover, .avatar[aria-expanded="true"] { box-shadow: 0 0 0 4px var(--mint); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); animation: pop .14s ease-out; }
.menu[hidden] { display: none; }
.menu-email { margin: 6px 10px 8px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px; font-size: 14px; }
.menu button:hover { background: var(--surface-2); }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.narrow-only { display: none !important; }

/* Buttons */
.primary-button, .secondary-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; font-size: 14.5px; font-weight: 600; transition: background .15s, box-shadow .15s, transform .1s; }
.primary-button { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgb(31 122 82 / 22%); }
.primary-button:hover:not(:disabled) { background: var(--primary-hover); }
.secondary-button { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); }
.secondary-button:hover:not(:disabled) { background: var(--surface-2); }
.danger-button { background: var(--danger); color: #fff; }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.block { width: 100%; }
.link-button { color: var(--primary); font-weight: 600; font-size: 14px; }
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button { color: var(--text-2); font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 8px; }
.text-button:hover { background: var(--surface-2); color: var(--text); }
.text-button.confirm { background: var(--danger-soft); color: var(--danger); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.button-row.end { justify-content: flex-end; }

/* Auth */
.auth { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 16px 20px 40px; }
.auth-card { width: min(100%, 880px); display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-md); overflow: hidden; }
.auth-hero { padding: 40px; background: radial-gradient(circle at 30% 20%, #ffffff 0%, transparent 55%), linear-gradient(160deg, var(--mint) 0%, #f6f0dc 100%); display: flex; flex-direction: column; justify-content: center; }
.auth-kame { width: 190px; height: 190px; margin: 0 auto 10px; }
.auth-hero-title { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-hero-copy { margin: 0; color: var(--text-2); font-size: 14.5px; }
.auth-form { padding: 44px 40px; display: flex; flex-direction: column; }
.auth-form h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 14.5px; }
.auth-form label, .modal-form label { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 10px 0 6px; }
.auth-form input, .modal-form input, .inline-form input, .search-input { height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.auth-form input:focus, .modal-form input:focus, .inline-form input:focus, .search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--mint); }
.invite-field { display: flex; flex-direction: column; }
.auth-form .primary-button { margin-top: 22px; height: 48px; }
.auth-form .link-button { margin-top: 16px; align-self: center; }

/* Chat */
.view-chat { height: 100%; display: flex; flex-direction: column; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.chat-inner { width: min(100%, 760px); margin: 0 auto; padding: 12px 24px 24px; display: flex; flex-direction: column; gap: 22px; }
.msg-user { align-self: flex-end; max-width: 78%; padding: 11px 16px; border-radius: 20px 20px 6px 20px; background: var(--mint); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; animation: rise .2s ease-out; }
.msg-assistant { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; animation: rise .2s ease-out; }
.msg-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--mint); overflow: hidden; }

.msg-content { min-width: 0; padding-top: 7px; }
.msg-body { color: var(--text); overflow-wrap: anywhere; }
.msg-body p { margin: 0 0 .75em; }
.msg-body p:last-child, .msg-body ul:last-child, .msg-body ol:last-child, .msg-body table:last-child { margin-bottom: 0; }
.msg-body h3 { margin: 1.1em 0 .4em; font-size: 15px; font-weight: 700; }
.msg-body ul, .msg-body ol { margin: 0 0 .75em; padding-left: 1.3em; }
.msg-body li { margin: .2em 0; }
.msg-body li::marker { color: var(--primary); }
.msg-body strong { font-weight: 650; }
.msg-body code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.msg-body .num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg-body table { display: block; width: fit-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: .3em 0 .9em; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.msg-body th { text-align: left; padding: 9px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.msg-body td { padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.msg-body tr:last-child td { border-bottom: 0; }
.msg-body.failed { color: var(--danger); }
.msg-actions { display: flex; gap: 4px; margin-top: 8px; margin-left: -8px; opacity: 0; transition: opacity .15s; }
.msg-assistant:hover .msg-actions, .msg-assistant:focus-within .msg-actions { opacity: 1; }

.working { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.track { position: relative; width: 210px; height: 86px; flex: none; border-bottom: 2px dashed var(--line-2); }
.track .walker { position: absolute; bottom: -12px; left: 0; width: 90px; height: 90px; animation: patrol 5.5s ease-in-out infinite; }
.working-text { font-size: 14px; color: var(--text-2); font-weight: 500; }
.working-text::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }

.welcome { padding: 24px 0 8px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.welcome-kame { width: 180px; height: 180px; margin-bottom: 4px; }
.welcome h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.03em; }
.welcome-copy { margin: 0 0 24px; max-width: 520px; color: var(--text-2); font-size: 16px; }
.start-card { width: 100%; max-width: 560px; margin: 0 0 22px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); text-align: left; display: grid; gap: 4px; }
.start-card strong { font-size: 16px; }
.start-card span { color: var(--text-2); font-size: 14px; }
.start-card .button-row { margin-top: 12px; }
.suggestions { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.suggestion { text-align: left; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 14px; font-weight: 600; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.suggestion:hover { border-color: var(--mint-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.suggestion span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }

.composer-wrap { flex: none; width: min(100%, 760px); margin: 0 auto; padding: 8px 24px 16px; }
.focus-row { display: flex; gap: 6px; overflow-x: auto; padding: 0 2px 8px; scrollbar-width: none; }
.focus-row::-webkit-scrollbar { display: none; }
.focus-chip { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.focus-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.focus-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px 10px 10px 18px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow-md); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: #9fd2b6; box-shadow: var(--shadow-md), 0 0 0 4px var(--mint); }
.composer textarea { flex: 1; min-height: 24px; max-height: 180px; padding: 8px 0; border: 0; outline: 0; resize: none; background: transparent; font-size: 15px; line-height: 24px; }
.composer textarea::placeholder { color: var(--muted); }
.send-button { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); display: grid; place-items: center; transition: background .15s, transform .1s; }
.send-button:hover:not(:disabled) { background: var(--primary-hover); }
.send-button:active { transform: scale(.95); }
.send-button svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.composer-note { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }

/* Insights */
.view-insights { height: 100%; overflow-y: auto; }
.insights-inner { width: min(100%, 860px); margin: 0 auto; padding: 12px 24px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.summary-card { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); }
.summary-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); }
.summary-value { display: block; margin: 6px 0 2px; font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.summary-value.alert { color: var(--danger); }
.summary-sub { font-size: 13px; color: var(--muted); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: var(--warn-soft); color: var(--warn-text); font-size: 14px; }
.notice-icon { font-weight: 700; }
.section-title { margin: 28px 0 12px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.card-list { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.finding { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; }
.finding + .finding, .bill + .bill, .bill-detail + .bill { border-top: 1px solid var(--line); }
.finding-icon, .bill-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; }
.finding-icon.up { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.finding-icon.dupe { background: var(--warn-soft); color: var(--warn-text); font-weight: 700; }
.finding-title { font-weight: 600; }
.finding-sub, .bill-sub { font-size: 13px; color: var(--muted); }
.bill { width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; text-align: left; transition: background .15s; }
.bill:hover, .bill[aria-expanded="true"] { background: #fafbf9; }
.bill-icon { background: var(--surface-2); }
.bill-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-right { text-align: right; display: grid; justify-items: end; gap: 3px; }
.bill-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.up { background: var(--danger-soft); color: var(--danger); }
.pill.down { background: var(--mint); color: var(--primary); }
.pill.soft { background: var(--surface-2); color: var(--text-2); }
.pill.warn { background: var(--warn-soft); color: var(--warn-text); }
.bill-detail { padding: 4px 18px 18px 72px; background: #fafbf9; display: grid; grid-template-columns: auto 1fr; gap: 10px 28px; align-items: start; }
.history { margin: 0; display: grid; grid-template-columns: auto auto; gap: 3px 20px; font-size: 13.5px; color: var(--text-2); justify-content: start; }
.history dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.bill-detail .button-row { grid-column: 1 / -1; margin-top: 4px; }
.meta-line { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.spark polyline { fill: none; stroke: #9aa59d; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--primary); stroke: #fff; stroke-width: 2; }
.spark circle.up { fill: var(--danger); }
.spark .baseline { stroke: var(--line); stroke-width: 1; }
.empty { padding: 48px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.empty .kame-box { width: 160px; height: 160px; margin-bottom: 6px; }
.empty h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.empty p { margin: 0 0 18px; color: var(--text-2); max-width: 440px; }
.loading-state { padding: 64px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.loading-state .track { width: 280px; }
.txn-tools { display: flex; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-input { flex: 1; min-width: 0; height: 40px; font-size: 14px; }
.txn-day { padding: 10px 18px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: #fafbf9; border-bottom: 1px solid var(--line); }
.txn { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.txn:last-child { border-bottom: 0; }
.txn-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.txn-amount.in { color: var(--primary); }
.more-row { padding: 14px 18px; text-align: center; }
.summary-value.good { color: var(--primary); }
.pill.ok { background: var(--mint); color: var(--primary); }
.finding-icon.overlap { background: var(--mint); color: var(--primary); font-weight: 700; }
.finding-icon.fee { background: var(--warn-soft); }
.finding-icon.down { background: var(--mint); color: var(--primary); font-weight: 700; }
a.evidence-name { color: var(--primary); text-decoration: none; }
a.evidence-name:hover { text-decoration: underline; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-head .secondary-button { margin: 0 0 10px; height: 36px; white-space: nowrap; }
.purchase, .offer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.purchase + .purchase, .offer + .offer, .price-form + .offer { border-top: 1px solid var(--line); }
.purchase > div, .offer > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.purchase-check { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.purchase-check.good { color: var(--primary); font-weight: 600; }
.price-form { display: flex; gap: 8px; padding: 14px 18px; }
.price-form .search-input { flex: 1; min-width: 0; }
a.bill-name { color: var(--text); text-decoration: none; }
a.bill-name:hover { text-decoration: underline; }
.offer-right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.opportunity { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 18px; }
.opportunity + .opportunity { border-top: 1px solid var(--line); }
.opportunity.closed { opacity: .72; }
.opportunity-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.opportunity-value { font-size: 17px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.opportunity-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.opportunity-copy { margin: 10px 0 0; color: var(--text-2); font-size: 14px; }
.opportunity-step { margin: 10px 0 0; font-size: 14px; }
.opportunity .button-row { margin-top: 12px; }
.review-cost { color: var(--text); }
.review-source { margin: 6px 0 0; font-size: 13px; }
.review-details { margin-top: 10px; font-size: 14px; }
.review-details summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.review-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); }
.review-list li + li { margin-top: 4px; }
.review-label { margin: 10px 0 0; font-weight: 600; }
.plan-email { margin: 6px 22px 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; }
.plan-email p { margin: 0 0 6px; overflow-wrap: anywhere; }
.plan-email pre { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--text-2); }
#action-body .button-row { margin: 12px 0 18px; }
.modal > .button-row, #action-body .button-row.modal-row { margin: 12px 22px 18px; }
#action-body .activity { margin: 0 22px 10px; }
.research { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.research .review-label { margin-top: 0; }
.research-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.research-form { align-items: flex-end; }
.research-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; min-width: 0; font-size: 12px; color: var(--muted); }
.research-form .search-input { flex: none; width: 100%; min-width: 0; }
.research-form .secondary-button { margin: 0; }
.research-figures li { overflow-wrap: anywhere; }
.research-figures .evidence-name { white-space: normal; overflow: visible; }
.research-compare { display: block; color: var(--text); font-size: 13px; }
.evidence { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.evidence li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; padding: 3px 0; }
.evidence-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.savings-link { display: flex; width: 100%; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 14px 18px; margin-bottom: 16px; border-radius: 14px; background: var(--mint); color: var(--primary); font-size: 14px; font-weight: 600; text-align: left; }
.savings-link:hover { filter: brightness(.98); }
.savings-link-cta { white-space: nowrap; }
.savings-foot { margin: 12px 4px 0; }

/* Drawers and modals */
dialog { color: var(--text); padding: 0; border: 0; }
dialog::backdrop { background: rgb(28 38 32 / 24%); backdrop-filter: blur(3px); }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); height: 100dvh; max-height: none; max-width: none; margin: 0; background: var(--surface); box-shadow: var(--shadow-lg); overflow-y: auto; animation: slide-in .22s cubic-bezier(.2, .8, .2, 1); }
.modal { width: min(480px, calc(100vw - 32px)); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .18s ease-out; padding-bottom: 20px; }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 12px; background: var(--surface); }
.drawer-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.close-button { width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--muted); }
.close-button:hover { background: var(--surface-2); color: var(--text); }
.drawer-intro { margin: 0 22px 6px; color: var(--text-2); font-size: 14px; }
.drawer-section { padding: 14px 22px 18px; display: grid; gap: 8px; }
.drawer-section + .drawer-section { border-top: 1px solid var(--line); }
.drawer-section h3 { margin: 4px 0 2px; font-size: 14px; font-weight: 700; }
.drawer-foot { margin: 8px 22px 24px; font-size: 12.5px; color: var(--muted); line-height: 2; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.list { display: grid; gap: 4px; }
.list-empty { margin: 2px 0; font-size: 14px; color: var(--muted); }
.row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 6px; border-radius: 12px; }
.row.plain { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 10px; background: var(--surface-2); }
.row-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--mint); display: grid; place-items: center; font-size: 17px; }
.row-name, .row-sub { display: block; }
.row-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--muted); }
.row-text { font-size: 14px; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 8px; margin-top: 4px; }
.inline-form input { flex: 1; min-width: 0; height: 42px; font-size: 14px; }
.action-card { display: grid; gap: 2px; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s; }
.action-card:hover:not(:disabled) { border-color: var(--mint-2); box-shadow: var(--shadow-sm); }
.action-card.primary { background: linear-gradient(135deg, var(--mint) 0%, #f7f2df 100%); border-color: var(--mint-2); }
.action-title { font-weight: 650; font-size: 15px; }
.action-sub { font-size: 13px; color: var(--text-2); }
.action-card.confirm { border-color: var(--danger); background: var(--danger-soft); }
.action-card.confirm .action-title { color: var(--danger); }
.action-card.busy .action-title::after { content: '…'; }
.scenarios { display: grid; gap: 6px; }
.scenario { text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; color: var(--text); transition: background .15s; }
.scenario:hover { background: var(--mint); }
.modal-copy { margin: 0 22px 8px; color: var(--text-2); font-size: 14.5px; }
.modal-form { display: flex; flex-direction: column; padding: 0 22px; }
.activity { list-style: none; margin: 0; padding: 0 22px; max-height: 60vh; overflow-y: auto; }
.activity li { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.activity li:last-child { border-bottom: 0; }
.activity time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.activity .bad { color: var(--danger); }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; background: var(--text); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .2s ease-out; pointer-events: auto; }
.toast-icon { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #ffffff26; }
.toast.ok .toast-icon { background: #3fbf80; }
.toast.err .toast-icon { background: #e05a5a; }

/* Kame: sprite strips rendered from the 3D model (scripts/mascot/kame-model.js, scripts/render-mascot.mjs).
   Each mood is one looping strip of square frames, stepped through left to right. */
.kame { display: block; width: 100%; height: 100%; background-repeat: no-repeat; background-position: 0 0; animation: kame-play 4s steps(48, jump-none) infinite; }
.kame, .kame[data-mood="idle"] { background-image: url(/static/mascot/kame-idle.v1.webp); background-size: 4800% 100%; }
.kame[data-mood="wave"] { background-image: url(/static/mascot/kame-wave.v1.webp); background-size: 2400% 100%; animation: kame-play 2s steps(24, jump-none) infinite; }
.kame[data-mood="working"] { background-image: url(/static/mascot/kame-working.v1.webp); background-size: 2400% 100%; animation: kame-play 2s steps(24, jump-none) infinite; }
.kame[data-mood="happy"] { background-image: url(/static/mascot/kame-happy.v1.webp); background-size: 2400% 100%; animation: kame-play 2s steps(24, jump-none) infinite; }
.kame[data-mood="confused"] { background-image: url(/static/mascot/kame-confused.v1.webp); background-size: 4800% 100%; animation: kame-play 4s steps(48, jump-none) infinite; }
@keyframes kame-play { to { background-position: 100% 0; } }

/* The head, for avatars and the logo: a still per mood. */
.kame-head { display: block; width: 100%; height: 100%; background: url(/static/mascot/kame-head-idle.v1.png) center / cover no-repeat; }
.kame-head[data-mood="happy"] { background-image: url(/static/mascot/kame-head-happy.v1.png); }
.kame-head[data-mood="confused"] { background-image: url(/static/mascot/kame-head-confused.v1.png); }

@keyframes patrol { 0% { left: 0; transform: scaleX(1); } 46% { left: calc(100% - 90px); transform: scaleX(1); } 50% { left: calc(100% - 90px); transform: scaleX(-1); } 96% { left: 0; transform: scaleX(-1); } 100% { left: 0; transform: scaleX(1); } }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
  .track .walker { left: calc(50% - 45px) !important; }
}

@media (max-width: 760px) {
  .header { height: 60px; padding: 0 14px; grid-template-columns: auto 1fr auto; gap: 10px; }
  .logo-text { display: none; }
  .logo-kame { width: 34px; height: 34px; }
  .switch { justify-self: center; }
  .switch button { padding: 6px 14px; }
  .wide-only { display: none !important; }
  .narrow-only { display: block !important; }
  .auth-card { grid-template-columns: 1fr; border-radius: 24px; }
  .auth-hero { padding: 26px 24px 22px; text-align: center; }
  .auth-kame { width: 140px; height: 140px; margin-bottom: 4px; }
  .auth-form { padding: 26px 24px 28px; }
  .chat-inner { padding: 8px 16px 20px; }
  .composer-wrap { padding: 6px 12px 10px; }
  .composer-note { font-size: 11.5px; }
  .welcome-kame { width: 150px; height: 150px; }
  .welcome h1 { font-size: 24px; }
  .welcome-copy { font-size: 15px; }
  .suggestions { grid-template-columns: 1fr; }
  .msg-user { max-width: 88%; }
  .msg-actions { opacity: 1; }
  .insights-inner { padding: 8px 14px 40px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary-card:first-child { grid-column: 1 / -1; }
  .summary-value { font-size: 24px; }
  .bill-detail { padding-left: 18px; grid-template-columns: 1fr; }
  .finding { grid-template-columns: 40px minmax(0, 1fr); align-items: start; }
  .finding > .secondary-button { grid-column: 2; justify-self: start; height: 36px; }
  .page-head h1 { font-size: 24px; }
  .opportunity { padding: 16px 14px; gap: 12px; }
  .price-form { flex-direction: column; }
  .offer { align-items: flex-start; flex-direction: column; }
  .offer-right { justify-content: flex-start; }
  .evidence li { grid-template-columns: 52px minmax(0, 1fr) auto; }
}

/* Savings over time. Series colors were checked with the dataviz palette validator against the white surface. */
:root { --series-verified: #1f7a52; --series-reported: #2a78d6; --series-projected: #1f7a52; }
.week-strip { margin: 0 0 14px; padding: 12px 16px; background: var(--mint); border-radius: 14px; font-size: 14px; color: var(--text); }
.sample-pill { margin-left: 6px; font-size: 11px; vertical-align: middle; }
.progress-section { margin: 4px 0 20px; }
.chart { margin: 0 0 16px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); }
.chart-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-key { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--series-verified); }
.chart-key.reported { border-top-color: var(--series-reported); }
.chart-key.projected { border-top-color: var(--series-projected); }
.chart-key.dashed { border-top-style: dashed; }
.chart-plot { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke: var(--series-verified); }
.chart-line.reported { stroke: var(--series-reported); }
.chart-line.projected { stroke: var(--series-projected); }
.chart-line.dashed { stroke-dasharray: 6 5; }
.chart-dot { fill: var(--series-verified); stroke: var(--surface); stroke-width: 2; }
.chart-dot.reported { fill: var(--series-reported); }
.chart-crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tooltip { position: absolute; top: 0; transform: translateX(-50%); display: grid; gap: 2px; padding: 8px 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); font-size: 12px; pointer-events: none; width: max-content; max-width: min(260px, 100%); }
.chart-tooltip[hidden] { display: none; }
.chart-tip-row { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.chart-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.chart-table { margin-top: 8px; font-size: 13px; }
.chart-table summary, .ledger summary { cursor: pointer; color: var(--primary); }
.chart-table table { width: 100%; margin-top: 6px; border-collapse: collapse; }
.chart-table th, .chart-table td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.chart-table th:first-child { text-align: left; }
.ledger { margin: 0 0 16px; font-size: 14px; }
.ledger-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.ledger-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ledger-title { flex: 1 1 200px; }
.ledger-amount { font-variant-numeric: tabular-nums; }
.opportunity-support { margin: 6px 0 0; font-size: 14px; color: var(--text); }
.opportunity-support a { color: var(--primary); }

.row-alert { display: block; margin-top: 2px; font-size: 12px; color: var(--warn-text); }

.auth-form .terms-check { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 4px; font-size: 13px; font-weight: 400; color: var(--muted); }
.auth-form .terms-check input { width: 16px; height: 16px; padding: 0; margin: 1px 0 0; flex: none; accent-color: var(--primary); }
.modal-form .modal-copy { margin-left: 0; margin-right: 0; }
.terms-check a, .legal-links a, .modal-copy a { color: var(--primary); }
.legal-links { margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.menu-link { display: block; padding: 10px 14px; color: var(--text); text-decoration: none; font-size: 14px; }
.menu-link:hover { background: var(--mint); }
