/* ============================================================
   GrantPit — "Funded green" design system
   Light, warm, mostly-neutral, one confident green.
   green = solid / approved / good-to-go
   amber = a reviewer would flag this
   neutral = draft / in-progress / inert
   ============================================================ */

:root {
  /* surfaces */
  --bg: #FAF8F3;
  --surface: #FFFFFF;
  --surface-2: #F4F1E9;
  --surface-sunk: #F0ECE2;

  /* ink */
  --ink: #14342A;
  --ink-2: #3F524A;
  --ink-3: #6E7C74;
  --ink-4: #9AA39C;

  /* brand green — accent shade is tweak-driven via --primary */
  --primary: #1E8E5A;
  --primary-deep: #0F6B43;
  --primary-ink: #0C4D31;
  --primary-soft: #E3F0E8;
  --primary-soft-2: #D2E8DC;

  /* amber = reviewer flag */
  --amber: #E0922E;
  --amber-deep: #B9701A;
  --amber-ink: #855011;
  --amber-soft: #FBEEDA;
  --amber-soft-2: #F6E1BE;

  /* hard error (rare) */
  --red: #C0492E;
  --red-soft: #F7E2DB;

  /* neutral chip */
  --neutral-bg: #ECE7DC;
  --neutral-ink: #5E6B62;

  /* borders */
  --border: #E8E1D3;
  --border-strong: #D9D1BF;
  --border-green: #BFE0CD;

  /* tweak-driven */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --pad: 24px;            /* density base */
  --row-h: 46px;

  --font-head: "Schibsted Grotesk", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;

  --shadow-1: 0 1px 2px rgba(20, 52, 42, 0.04), 0 1px 3px rgba(20, 52, 42, 0.05);
  --shadow-2: 0 6px 20px rgba(20, 52, 42, 0.07), 0 2px 6px rgba(20, 52, 42, 0.05);
  --shadow-pop: 0 18px 50px rgba(20, 52, 42, 0.16), 0 4px 14px rgba(20, 52, 42, 0.08);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5 { font-family: var(--font-head); font-weight: 600; margin: 0; line-height: 1.12; letter-spacing: -0.01em; color: var(--ink); }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--primary-soft-2); color: var(--primary-ink); }

/* ----- App scaffold ----- */
.app { min-height: 100vh; }
.screen-pad { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.screen-wide { max-width: 1320px; margin: 0 auto; padding: 0 32px; }

/* ----- top app bar (in-product) ----- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 248, 243, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.appbar-inner { display: flex; align-items: center; gap: 22px; height: 64px; }
.appbar-nav { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
.appbar-link {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 8px 13px; border-radius: var(--radius-pill);
  color: var(--ink-3); font-weight: 500; font-size: 14.5px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.appbar-link:hover { color: var(--ink); background: var(--surface-2); }
.appbar-link.active { color: var(--primary-deep); background: var(--primary-soft); }
.appbar-spacer { flex: 1; }

/* hamburger (mobile only) */
.appbar-burger { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.appbar-burger:hover { background: var(--surface-2); }
/* Desktop: the hamburger is ONLY for mobile — never show it above the breakpoint. */
@media (min-width: 821px) { .appbar-burger { display: none !important; } .appbar-menu { display: none !important; } }
.appbar-menu { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px 14px; border-top: 1px solid var(--border); background: rgba(250, 248, 243, 0.98); backdrop-filter: blur(10px); }
.appbar-menu-link { display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 15.5px; cursor: pointer; }
.appbar-menu-link:hover { background: var(--surface-2); color: var(--ink); }
.appbar-menu-link.active { background: var(--primary-soft); color: var(--primary-deep); }

/* ----- brand mark ----- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 600; font-size: 19px; letter-spacing: -0.02em; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; flex: none; }

/* ----- buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 11px 18px; line-height: 1;
  transition: transform .12s var(--ease), filter .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 0 rgba(12,77,49,.25); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-deep { background: var(--primary-deep); color: #fff; }
.btn-deep:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn-soft { background: var(--primary-soft); color: var(--primary-deep); }
.btn-soft:hover { background: var(--primary-soft-2); }
.btn-quiet { background: transparent; color: var(--ink-3); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-lg { padding: 15px 26px; font-size: 16.5px; border-radius: var(--radius-sm); }
.btn-sm { padding: 8px 13px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ----- cards ----- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow-wrap: anywhere; }
.card-pad { padding: var(--pad); }
.card-hover { transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease); cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--border-strong); }

/* ----- status chips ----- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-weight: 600; font-size: 12.5px; line-height: 1;
  padding: 5px 11px 5px 9px; border-radius: var(--radius-pill);
  letter-spacing: .01em; white-space: normal; overflow-wrap: anywhere; max-width: 100%;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip svg { width: 13px; height: 13px; flex: none; }
/* tones */
.chip-green   { background: var(--primary-soft); color: var(--primary-ink); }
.chip-green .dot { background: var(--primary); }
.chip-amber   { background: var(--amber-soft); color: var(--amber-ink); }
.chip-amber .dot { background: var(--amber); }
.chip-neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.chip-neutral .dot { background: #A7AC9F; }
.chip-filled-green { background: var(--primary-deep); color: #fff; }
.chip-filled-green .dot { background: #fff; }
/* outline variant (tweak) */
.chips-outline .chip { background: transparent; border: 1.5px solid currentColor; padding: 4px 11px 4px 9px; }
.chips-outline .chip-green { color: var(--primary-deep); }
.chips-outline .chip-amber { color: var(--amber-deep); }
.chips-outline .chip-neutral { color: var(--neutral-ink); }
.chips-outline .chip-filled-green { background: var(--primary-deep); color: #fff; border-color: var(--primary-deep); }
/* dot-only label variant (tweak) hides the pill background, keeps dot + label */
.chips-dot .chip { background: transparent !important; padding: 4px 2px; color: var(--ink-2); font-weight: 600; }
.chips-dot .chip svg { display: none; }
.chips-dot .chip .dot { width: 8px; height: 8px; }

/* ----- eyebrow / labels ----- */
.eyebrow { font-family: var(--font-body); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--primary-deep); }
.meta { color: var(--ink-3); font-size: 13.5px; }
.muted { color: var(--ink-3); }

/* ----- form fields ----- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-weight: 600; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.hint { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.input, .textarea, .selectbox {
  width: 100%; background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 15px; line-height: 1.45;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .textarea:focus, .selectbox:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { resize: vertical; min-height: 96px; }
.input-invalid { border-color: var(--amber) !important; box-shadow: 0 0 0 3px var(--amber-soft) !important; }

/* ----- progress ----- */
.pbar { height: 7px; background: var(--surface-sunk); border-radius: 999px; overflow: hidden; }
.pbar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .5s var(--ease); }
/* indeterminate (green) loading bar — for "reading…" / AI work */
.pbar.indet { position: relative; }
.pbar.indet > span { position: absolute; left: -40%; width: 40%; transition: none;
  background: linear-gradient(90deg, var(--primary-soft) 0%, var(--primary) 50%, var(--primary-soft) 100%);
  animation: pbarIndet 1.05s var(--ease) infinite; }
@keyframes pbarIndet { 0% { left: -42%; } 100% { left: 100%; } }
/* spinner */
.gp-spin { display: inline-block; width: 16px; height: 16px; border: 2.5px solid var(--primary-soft-2); border-top-color: var(--primary); border-radius: 50%; animation: gpSpin .7s linear infinite; vertical-align: middle; }
@keyframes gpSpin { to { transform: rotate(360deg); } }

/* Working state for AI buttons: a gentle pulse so the user knows it's thinking. */
.pulse { animation: gpPulse 1.4s ease-in-out infinite; }
@keyframes gpPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* "Filling" shimmer for an empty input/textarea while AI is generating into it.
   Gated to the empty/generating state so it never sits behind real text. */
.gp-shimmer {
  background-image: linear-gradient(100deg, var(--surface-2) 30%, var(--primary-soft) 50%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: gpShimmer 1.3s ease-in-out infinite;
}
@keyframes gpShimmer { 0% { background-position: 180% 0; } 100% { background-position: -80% 0; } }

@media (prefers-reduced-motion: reduce) {
  .pulse, .gp-shimmer, .gp-searching, .pbar.indet > span { animation: none; }
}

/* Magnifying-glass "scanning" animation for the funder research button. */
.gp-searching { display: inline-flex; transform-origin: center; animation: gpSearch 1.05s ease-in-out infinite; }
@keyframes gpSearch {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(2px, -1.5px) rotate(-14deg); }
  45% { transform: translate(1px, 2px) rotate(2deg); }
  70% { transform: translate(-2px, -1px) rotate(14deg); }
}

/* ----- markdown-lite (chat bubbles) ----- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md-p { margin: 0 0 8px; }
.md-h { margin: 10px 0 5px; font-weight: 700; font-size: 1em; }
.md-ul, .md-ol { margin: 4px 0 8px; padding-left: 20px; }
.md-ul li, .md-ol li { margin: 2px 0; }
.md-hr { height: 1px; background: var(--border); border: 0; margin: 10px 0; }
.md-code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-family: var(--font-mono, monospace); font-size: .92em; }

/* ----- divider ----- */
.hr { height: 1px; background: var(--border); border: 0; }

/* ----- generic helpers ----- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* ----- icon tile ----- */
.itile { display: inline-grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary-deep); flex: none; }
.itile.amber { background: var(--amber-soft); color: var(--amber-deep); }
.itile.neutral { background: var(--surface-2); color: var(--ink-2); }

/* ----- entrance -----
   Content is ALWAYS visible (opacity:1). Entrance only nudges transform, so a
   stalled/paused animation can never leave anything blank. */
@keyframes fadeUp { from { transform: translateY(10px); } to { transform: none; } }
.fade-up { opacity: 1; }
.anim .fade-up { animation: fadeUp .5s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .anim .fade-up { animation: none; } }

/* ----- tooltip-ish flag note ----- */
.note-amber { background: var(--amber-soft); border: 1px solid var(--amber-soft-2); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--amber-ink); font-size: 13.5px; line-height: 1.5; display: flex; gap: 10px; }
.note-green { background: var(--primary-soft); border: 1px solid var(--border-green); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--primary-ink); font-size: 13.5px; line-height: 1.5; display: flex; gap: 10px; }

/* ============================================================
   Auth — login + sign-up / billing
   ============================================================ */
.auth { display: grid; grid-template-columns: 1.04fr 1fr; min-height: 100vh; }

/* left brand panel */
.auth-aside {
  position: sticky; top: 0; align-self: start; height: 100vh;
  background:
    radial-gradient(120% 80% at 12% 8%, rgba(255,255,255,0.10), transparent 60%),
    linear-gradient(158deg, var(--primary-deep) 0%, var(--primary-ink) 100%);
  color: #fff; padding: 52px 56px;
  display: flex; flex-direction: column; overflow: hidden;
}
/* oversized ghost mark */
.auth-aside::after {
  content: ""; position: absolute; right: -120px; bottom: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.10), transparent 64%);
  pointer-events: none;
}
.auth-aside .brand span { color: #fff; }
.auth-aside .brand .gp-pit { color: var(--primary-soft); }
.auth-eyebrow { font-family: var(--font-body); font-weight: 700; font-size: 12px; letter-spacing: .15em; text-transform: uppercase; color: rgba(255,255,255,0.62); }
.auth-aside h2 { color: #fff; font-size: 33px; line-height: 1.12; letter-spacing: -0.025em; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-points li { display: flex; gap: 12px; font-size: 15px; line-height: 1.5; color: rgba(255,255,255,0.92); }
.auth-points .ic { flex: none; margin-top: 1px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(255,255,255,0.14); }
.auth-trust { display: flex; gap: 11px; align-items: flex-start; padding: 15px 16px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,0.88); }

/* right form column */
.auth-main { display: flex; align-items: flex-start; justify-content: center; padding: 56px 40px; }
.auth-main.center { align-items: center; }
.auth-form { width: 100%; max-width: 440px; }
.auth-form.wide { max-width: 520px; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 26px; cursor: pointer; }
.auth-back:hover { color: var(--ink); }

/* password input with reveal toggle */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-4); border-radius: 7px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink-2); background: var(--surface-2); }

/* strength meter */
.pw-meter { display: flex; gap: 5px; margin-top: 9px; }
.pw-meter span { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-sunk); transition: background .25s var(--ease); }
.pw-reqs { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.pw-reqs li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-4); transition: color .2s var(--ease); }
.pw-reqs li.ok { color: var(--primary-deep); }
.pw-reqs li .tick { width: 15px; height: 15px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-sunk); color: var(--ink-4); }
.pw-reqs li.ok .tick { background: var(--primary-soft-2); color: var(--primary-deep); }

/* checkbox row */
.auth-check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; cursor: pointer; }
.auth-check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.auth-link { color: var(--primary-deep); font-weight: 600; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }

/* form section heading */
.auth-sec { display: flex; align-items: center; gap: 11px; margin: 4px 0 16px; }
.auth-sec .n { width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--primary-soft); color: var(--primary-deep); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 13.5px; }
.auth-sec h3 { font-size: 17.5px; }

/* plan radio cards */
.plan-opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 15px 16px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease); }
.plan-opt:hover { border-color: var(--ink-4); }
.plan-opt.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.plan-radio { width: 19px; height: 19px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; transition: border-color .15s var(--ease); }
.plan-opt.sel .plan-radio { border-color: var(--primary); }
.plan-opt.sel .plan-radio::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.plan-price { font-family: var(--font-head); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }

/* stripe placeholder card field */
.stripe-note { display: flex; gap: 9px; align-items: center; font-family: "JetBrains Mono", monospace; font-size: 11.5px; letter-spacing: .02em; color: var(--ink-3); background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 9px, var(--surface-sunk) 9px, var(--surface-sunk) 18px); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px; }
.card-group { border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.card-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.card-group .cg-row { display: flex; align-items: center; }
.card-group .cg-row + .cg-row { border-top: 1.5px solid var(--border); }
.card-group .cg-split { display: flex; }
.card-group .cg-split > div { flex: 1; }
.card-group .cg-split > div + div { border-left: 1.5px solid var(--border); }
.cg-input { border: 0; outline: none; background: transparent; width: 100%; padding: 12px 13px; font-size: 15px; color: var(--ink); font-family: inherit; }
.cg-input::placeholder { color: var(--ink-4); }
.cg-icon { padding-right: 12px; color: var(--ink-4); display: flex; gap: 5px; }
.order-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.order-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink-2); }
.order-row + .order-row { margin-top: 9px; }
.order-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-strong); }
.order-total .amt { font-family: var(--font-head); font-weight: 700; font-size: 24px; letter-spacing: -0.02em; color: var(--ink); }

.secure-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-top: 14px; }

@media (max-width: 940px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 40px 24px; }
}

/* scrollbar polish */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #d8d2c4; border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c4bdac; }

/* ============================================================
   Budget engine — categories, inline editing, AI assist
   ============================================================ */

/* inline-editable text (category & line names) */
.edit-inline {
  border: 1px solid transparent; background: transparent; color: inherit;
  font-family: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit;
  border-radius: 7px; padding: 3px 7px; margin: -3px -7px; width: 100%;
  transition: background .14s var(--ease), border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.edit-inline:hover { background: var(--surface-2); }
.edit-inline:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.edit-inline::placeholder { color: var(--ink-4); font-style: italic; }

/* category + line rows: reveal row actions on hover */
.brow { transition: background .14s var(--ease); }
.brow .row-act { opacity: 0; transition: opacity .14s var(--ease); }
.brow:hover .row-act { opacity: 1; }
.brow:hover { background: var(--surface-2); }
.cat-head:hover { background: var(--primary-soft); }

/* caret button */
.caret { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: none; background: transparent; color: var(--ink-3); cursor: pointer; transition: background .14s var(--ease), transform .18s var(--ease); }
.caret:hover { background: var(--surface-sunk); color: var(--ink); }
.caret.open { transform: rotate(90deg); }

/* tiny icon action button used in rows */
.ibtn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--ink-3); cursor: pointer; transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease); }
.ibtn:hover { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.ibtn.danger:hover { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }

/* add-line ghost row */
.add-ghost { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 6px 9px; border-radius: 8px; border: 1px dashed var(--border-strong); background: transparent; color: var(--ink-3); font-weight: 600; font-size: 13px; cursor: pointer; transition: color .14s var(--ease), border-color .14s var(--ease), background .14s var(--ease); }
.add-ghost:hover { color: var(--primary-deep); border-color: var(--primary); background: var(--primary-soft); }

/* AI-suggested figure pill (unconfirmed — never counted until accepted) */
.sugg-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 5px;
  padding: 3px 5px 3px 9px; border-radius: 999px;
  background: var(--amber-soft); border: 1.5px dashed var(--amber); color: var(--amber-ink);
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
  animation: suggIn .3s var(--ease) both;
}
@keyframes suggIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.sugg-pill .sx { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; border: none; cursor: pointer; transition: filter .12s var(--ease); }
.sugg-pill .sx:hover { filter: brightness(.92); }
.sugg-pill .sx.ok { background: var(--primary); color: #fff; }
.sugg-pill .sx.no { background: #fff; color: var(--amber-deep); border: 1px solid var(--amber-soft-2); }

/* AI proposal (diff) card */
.prop-card { border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); overflow: hidden; animation: fadeUp .35s var(--ease) both; box-shadow: var(--shadow-1); }
.anim .prop-card { animation: propIn .4s var(--ease) both; }
@keyframes propIn { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.prop-card .ph { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.diff-line { display: flex; align-items: baseline; gap: 9px; padding: 7px 13px; font-size: 13px; }
.diff-line .mk { font-family: "JetBrains Mono", monospace; font-weight: 700; flex: none; width: 14px; }
.diff-add { background: var(--primary-soft); color: var(--primary-ink); }
.diff-add .mk { color: var(--primary); }
.diff-edit { background: var(--amber-soft); color: var(--amber-ink); }
.diff-edit .mk { color: var(--amber-deep); }
.diff-strike { text-decoration: line-through; color: var(--ink-3); opacity: .8; }

/* AI chat rail */
.assist-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 13px 13px 13px; padding: 11px 13px; font-size: 14px; line-height: 1.5; }
.assist-me { align-self: flex-end; background: var(--primary); color: #fff; border-radius: 13px 4px 13px 13px; padding: 10px 13px; font-size: 14px; line-height: 1.45; max-width: 85%; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; border: none; cursor: pointer; font-weight: 600; font-size: 13px; background: transparent; color: var(--ink-3); transition: background .14s var(--ease), color .14s var(--ease); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* dot badge on a tab */
.tab-badge { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 800; }

/* horizontal-scroll wrapper for wide content (e.g. the budget table) on any screen */
.gp-scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   Mobile / responsive
   .gp-stack  = a flex row that becomes a column on small screens
   .gp-grid2  = a 2-col grid that stacks on small screens
   .gp-rail   = a sticky fixed-width sidebar that goes full-width + static
   ============================================================ */
@media (max-width: 820px) {
  .screen-pad, .screen-wide { padding-left: 14px; padding-right: 14px; }
  .card-pad { padding: 16px; }

  /* app bar: collapse the inline nav into a hamburger menu */
  .appbar-inner { gap: 8px; height: 56px; }
  .brand { font-size: 17px; gap: 8px; }
  .appbar-nav { display: none; }
  .appbar-newgrant { display: none; }
  .appbar-burger { display: inline-flex; }

  .btn { padding: 10px 14px; font-size: 14px; }
  .btn-lg { padding: 12px 18px; font-size: 15px; }

  /* stack two-column layouts */
  .gp-stack { flex-direction: column !important; }
  .gp-stack > * { width: 100% !important; min-width: 0 !important; flex: 1 1 auto !important; }
  .gp-grid2 { display: block !important; }
  .gp-grid2 > * { width: 100% !important; min-width: 0 !important; }
  .gp-grid2 > * + * { margin-top: 16px; }
  .gp-rail { position: static !important; width: 100% !important; max-height: 320px !important; height: auto !important; margin-bottom: 14px; }

  /* floating help button nudged in a bit */
  #gp-help-root > button { right: 14px !important; bottom: 14px !important; }
}

@media (max-width: 520px) {
  .screen-pad, .screen-wide { padding-left: 10px; padding-right: 10px; }
  .auth-main { padding: 28px 16px; }
}

/* GRANTPIT Max "on us" green-heart burst (free full draft celebration). */
@keyframes gp-heart-rise {
  0%   { transform: translateY(0) scale(0.5) rotate(-8deg); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translateY(-92vh) scale(1.15) rotate(8deg); opacity: 0; }
}
.gp-heart { position: absolute; bottom: -12px; will-change: transform, opacity; animation: gp-heart-rise 1.7s cubic-bezier(.22,.61,.36,1) forwards; }
