/* CFO Sidekick — app styles. Same tokens as the landing page and holding page. */
:root {
  --navy: #0B5B9B; --navy-deep: #073E6B; --sky: #1998CA; --sky-wash: #E8F4FA;
  --green: #8CC543; --green-deep: #6FA32F; --green-wash: #EEF7E2;
  --amber: #C98A1B; --amber-wash: #FBF3E3; --red: #B9412F; --red-wash: #FBEAE7;
  --ink: #15202B; --muted: #5B6B7B; --line: #DCE5EE; --paper: #FFFFFF; --wash: #F3F8FC;
  --radius: 12px; --shadow: 0 1px 2px rgba(11,91,155,.06), 0 6px 20px rgba(11,91,155,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--wash); line-height: 1.55; -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy); }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 520px; }

/* header */
header.top { background: var(--paper); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--navy), var(--sky)); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; left: 8.5px; top: 8.5px; width: 15px; height: 15px; border-radius: 4px; background: var(--green); }
.brand-name { font-weight: 700; font-size: 16px; color: var(--navy-deep); letter-spacing: -0.01em; }
.brand-by { font-size: 11.5px; color: var(--muted); display: block; margin-top: -3px; font-weight: 500; }
nav.links { display: flex; align-items: center; gap: 18px; font-size: 14px; font-weight: 600; }
nav.links a { text-decoration: none; color: var(--navy); }
nav.links a:hover { text-decoration: underline; }
nav.links form { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--navy); background: var(--sky-wash); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; }
.pill.amber { color: var(--amber); background: var(--amber-wash); }
.pill.green { color: var(--green-deep); background: var(--green-wash); }
.pill.red { color: var(--red); background: var(--red-wash); }

main { flex: 1; padding: 28px 0 48px; }
h1 { font-size: 26px; letter-spacing: -0.02em; color: var(--navy-deep); margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 18px; color: var(--navy-deep); margin: 0 0 10px; }
h3 { font-size: 15px; color: var(--navy-deep); margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 22px; font-size: 15.5px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.card { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* forms */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--navy-deep); margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.btn { display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 15px; padding: 11px 18px;
  border-radius: 10px; text-decoration: none; background: var(--green); color: #fff; box-shadow: 0 2px 0 var(--green-deep); }
.btn:hover { background: var(--green-deep); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.secondary { background: var(--paper); color: var(--navy); border: 1px solid var(--line); box-shadow: none; }
.btn.secondary:hover { background: var(--sky-wash); }
.btn.danger { background: var(--paper); color: var(--red); border: 1px solid var(--line); box-shadow: none; }
.btn.small { font-size: 13.5px; padding: 7px 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.mt { margin-top: 16px; }

/* notices */
.notice { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 0 0 16px; border: 1px solid var(--line); background: var(--sky-wash); color: var(--navy-deep); }
.notice.ok { background: var(--green-wash); color: var(--green-deep); }
.notice.warn { background: var(--amber-wash); color: var(--amber); }
.notice.err { background: var(--red-wash); color: var(--red); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 6px 0 18px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.tile .v { font-size: 24px; font-weight: 700; color: var(--navy-deep); letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* benchmark band */
.band { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.band.normal { background: var(--green-wash); color: var(--green-deep); }
.band.low, .band.high { background: var(--amber-wash); color: var(--amber); }
.band.well { background: var(--red-wash); color: var(--red); }
.band.na { background: var(--wash); color: var(--muted); }

/* narrative + chat */
.narrative p { margin: 0 0 12px; font-size: 15.5px; }
.chat-card { padding: 0; overflow: hidden; }
.chat { display: flex; flex-direction: column; gap: 14px; padding: 22px; max-height: 62vh; overflow-y: auto; background: var(--wash); }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.msg.user .when { color: rgba(255,255,255,.65); font-size: 11.5px; margin-top: 4px; text-align: right; }
.msg.assistant { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg .who { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--navy-deep); letter-spacing: .02em; margin-bottom: 6px; }
.msg .who .when { font-weight: 500; color: var(--muted); font-size: 11.5px; margin-left: 4px; }
.mark.sm { width: 18px; height: 18px; border-radius: 5px; }
.mark.sm::after { left: 5px; top: 5px; width: 8px; height: 8px; border-radius: 2px; }
.msg .body > :first-child { margin-top: 0; }
.msg .body > :last-child { margin-bottom: 0; }
.msg .body p { margin: 0 0 10px; }
.msg .body ul, .msg .body ol { margin: 0 0 10px; padding-left: 22px; }
.msg .body li { margin: 3px 0; }
.msg .body h4, .msg .body h3 { font-size: 14px; color: var(--navy-deep); margin: 12px 0 6px; }
.msg .body strong { color: var(--navy-deep); }
.msg.user .body strong { color: #fff; }
.msg .body table { width: auto; min-width: 60%; margin: 8px 0 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.msg .body th, .msg .body td { padding: 7px 12px; border-bottom: 1px solid var(--line); }
.msg .body thead th { background: var(--sky-wash); text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--navy-deep); }
.msg .body thead th:empty { background: var(--sky-wash); }
.msg .body tr:last-child td { border-bottom: 0; }
.msg .body td:first-child { color: var(--muted); }
.msg .body td:first-child strong { color: var(--navy-deep); }
.msg .body td:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg .body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--wash); padding: 1px 5px; border-radius: 4px; }
.msg .body blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--sky); color: var(--muted); }
.msg .body a { color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; max-width: 82%; }
.chip { font: inherit; font-size: 13.5px; font-weight: 600; color: var(--navy); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; cursor: pointer; }
.chip:hover { background: var(--sky-wash); border-color: var(--sky); }
.thinking .body { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--sky); animation: sk-bounce 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sk-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 14px 22px 6px; border-top: 1px solid var(--line); background: var(--paper); }
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 220px; border-radius: 12px; }
.composer .send { padding: 11px 22px; }
.composer .send:disabled { opacity: .6; cursor: default; }
.review { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 14px; }
.chat-card .review { margin: 8px 22px 16px; }
footer { border-top: 1px solid var(--line); padding: 18px 0; font-size: 13px; color: var(--muted); background: var(--paper); }
footer .row { justify-content: space-between; }

/* QR */
.qr { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.qr svg { width: 100%; height: 100%; }
.code-input { font-size: 24px; letter-spacing: .3em; text-align: center; }

@media (max-width: 720px) {
  .grid.two, .grid.three, .tiles { grid-template-columns: 1fr; }
  .bar { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .brand-by { display: none; }
  .msg, .chips { max-width: 96%; }
  .chat { padding: 14px; max-height: none; }
  .composer { padding: 12px 14px 4px; }
  .chat-card .review { margin: 8px 14px 14px; }
  main { padding-top: 18px; }
}

/* internal prep note */
.prep h3 { font-size: 15px; color: var(--navy-deep); margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prep h3:first-child { margin-top: 0; }
.prep ul { margin: 0 0 8px; padding-left: 22px; }
.prep li { margin: 5px 0; font-size: 15px; }
.prep strong { color: var(--navy-deep); }
