/* =========================================================================
   Invoice Analyser — design system
   Purple/violet, gradient-led, data-first. Space Grotesk (display + numbers)
   paired with Instrument Sans (body). Signature element: the BPR arc gauge.
   ========================================================================= */

:root {
  /* Violet scale (deep indigo -> violet -> light accent) */
  --v-900: #2a0e5f;
  --v-800: #3b1178;
  --v-700: #5b21b6;
  --v-600: #6d28d9;   /* primary */
  --v-500: #7c3aed;
  --v-400: #a78bfa;   /* accent */
  --v-100: #f1ecfb;   /* tint fill */
  --v-050: #f7f5fd;

  --grad: linear-gradient(135deg, #3b1178 0%, #6d28d9 55%, #8b5cf6 100%);
  --grad-soft: linear-gradient(135deg, #f5f1fe 0%, #efe8fc 100%);

  --ink: #191330;
  --muted: #6b6588;
  --faint: #9893ad;
  --bg: #faf9fe;
  --surface: #ffffff;
  --border: #ece8f6;
  --border-strong: #ddd6ee;

  --up: #0e9f6e;      /* above target / good */
  --up-bg: #e7f6ef;
  --down: #e5484d;    /* below target */
  --down-bg: #fdecec;
  --warn: #b9770a;

  --shadow-sm: 0 1px 2px rgba(41, 16, 84, .06);
  --shadow: 0 6px 24px -8px rgba(52, 20, 105, .18);
  --shadow-lg: 0 18px 48px -16px rgba(52, 20, 105, .32);

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;

  --font-display: "Space Grotesk", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", -apple-system, "Segoe UI", system-ui, sans-serif;

  --maxw: 1120px;
}

/* ---- reset-ish ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.4rem); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 1.05rem + .9vw, 1.7rem); font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: 0; }

/* Small eyebrow label for grouping fields inside a form (a tier below h3). */
.group-label { font-family: var(--font-body); font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--v-600);
  margin: .2rem 0 .9rem; }
p { margin: 0 0 1rem; }
a { color: var(--v-600); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .82rem; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---- layout scaffold ---------------------------------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.app-main { padding: 2.6rem 0 4rem; }
.stack > * + * { margin-top: var(--stack-gap, 1.1rem); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* ---- top bar ------------------------------------------------------------ */
.topbar { background: var(--grad); color: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 40; }
.topbar .wrap { display: flex; align-items: center; gap: 1.25rem; height: 62px; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.16); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.brand .mark svg { display: block; }
.beta { display: inline-flex; align-items: center; font-family: var(--font-body); font-size: .58rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; padding: .14rem .38rem; border-radius: 5px; line-height: 1;
  background: rgba(255,255,255,.22); color: #fff; margin-left: .45rem; }
.foot-brand .beta { background: var(--v-100); color: var(--v-700); font-size: .55rem; margin-left: .35rem; }
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a { color: rgba(255,255,255,.82); padding: .4rem .7rem; border-radius: 8px; font-size: .93rem; font-weight: 500; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.12); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255,255,255,.18); }
.nav .sep { width: 1px; height: 20px; background: rgba(255,255,255,.22); margin: 0 .35rem; }
.nav .nav-locked { position: relative; display: inline-flex; align-items: center; gap: .35rem; color: rgba(255,255,255,.5); padding: .4rem .7rem; font-size: .93rem; font-weight: 500; cursor: not-allowed; outline: none; }
.nav-tip { position: absolute; top: calc(100% + 6px); left: 50%; width: max-content; max-width: 220px;
  background: var(--ink); color: #fff; font-size: .78rem; font-weight: 500; line-height: 1.3;
  padding: .4rem .6rem; border-radius: 7px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
  z-index: 80; pointer-events: none; }
.nav-locked:hover .nav-tip, .nav-locked:focus .nav-tip { opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(0); transition: opacity .15s ease, transform .15s ease, visibility 0s; }
.nav-tip::before { content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-bottom-color: var(--ink); }
@media (max-width: 620px) { .nav-tip { display: none; } }

/* Centered main menu + user dropdown */
.nav-main { margin-left: 0; flex: 1; justify-content: center; }
.user-menu { position: relative; flex: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.35); font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.avatar:hover { background: rgba(255,255,255,.3); }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 10px); min-width: 200px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .35rem;
  display: none; z-index: 60; }
.user-dropdown.open { display: block; }
.user-dropdown a { display: block; padding: .55rem .7rem; border-radius: 8px; color: var(--ink); font-size: .92rem; font-weight: 500; }
.user-dropdown a:hover { background: var(--v-050); text-decoration: none; }
.user-dropdown-head { padding: .5rem .7rem .55rem; border-bottom: 1px solid var(--border); margin-bottom: .25rem;
  font-size: .9rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.user-dropdown-head small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.only-mobile { display: none; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .4rem 1.5rem; padding-top: .9rem; padding-bottom: .9rem; font-size: .74rem; color: var(--faint); }
.foot-brand { display: inline-flex; align-items: center; gap: .35rem; font-family: var(--font-display); font-weight: 600; font-size: .78rem; color: var(--v-600); }
.foot-brand svg { width: 13px; height: 13px; }
.nav-toggle { display: none; margin-left: auto; background: rgba(255,255,255,.14); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px; font-size: 1.2rem; cursor: pointer; }

/* ---- cards -------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.35rem 1.4rem; box-shadow: var(--shadow-sm); }
.card.pad-lg { padding: 1.75rem; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
/* Reserve two lines for labels in dense field grids so inputs line up. */
.grid.cols-4 .field > label, .grid.cols-5 .field > label { min-height: 2.5em; }
.split { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1.4rem; align-items: start; }
/* Clickable card / row affordance. */
.card-link { transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease; }
.card-link:hover { text-decoration: none; border-color: var(--v-400); box-shadow: var(--shadow); }
.card-link:active { transform: translateY(1px); }
/* Centre a gauge (or similar) inside a feature card. */
.gauge-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---- stat tiles --------------------------------------------------------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 600; letter-spacing: -.02em; margin-top: .15rem; }
.stat .sub { font-size: .85rem; color: var(--muted); margin-top: .15rem; }
.stat.feature { background: var(--grad); color: #fff; border: 0; box-shadow: var(--shadow); }
.stat.feature .label, .stat.feature .sub { color: rgba(255,255,255,.85); }

/* ---- deltas (above/below target) --------------------------------------- */
.delta { display: inline-flex; align-items: center; gap: .3rem; font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 600; font-size: .85rem; padding: .12rem .5rem; border-radius: 999px; }
.delta.up { color: var(--up); background: var(--up-bg); }
.delta.down { color: var(--down); background: var(--down-bg); }
.delta.flat { color: var(--muted); background: var(--v-100); }

/* ---- buttons ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-family: var(--font-body); font-weight: 600; font-size: .95rem; padding: .62rem 1.1rem; border-radius: 11px; border: 1px solid transparent; cursor: pointer; transition: transform .05s ease, box-shadow .15s ease, background .15s ease; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.btn-ghost { background: var(--surface); color: var(--v-700); border-color: var(--border-strong); }
.btn-ghost:hover { text-decoration: none; border-color: var(--v-400); background: var(--v-050); }
.btn-subtle { background: var(--v-100); color: var(--v-700); }
.btn-subtle:hover { text-decoration: none; background: #e8dffb; }
/* White button, for sitting on the gradient / dark surfaces. */
.btn-white { background: #fff; color: var(--v-700); }
.btn-white:hover { text-decoration: none; background: #f3eefe; box-shadow: var(--shadow-lg); }
/* Ghost button on a dark/gradient surface (transparent with light border). */
.btn-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-on-dark:hover { text-decoration: none; background: rgba(255,255,255,.14); }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.02rem; }
.btn-sm { padding: .38rem .72rem; font-size: .85rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-danger { background: var(--down-bg); color: var(--down); }
.btn-danger:hover { text-decoration: none; background: #fbdada; }

/* ---- forms -------------------------------------------------------------- */
.field { margin-bottom: 1.05rem; }
.field > label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.input, .select, textarea.input {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: .6rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--v-500); box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.input.money-input { text-align: right; font-variant-numeric: tabular-nums; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.input-prefix { position: relative; }
.input-prefix .pfx { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-prefix .input { padding-left: 1.5rem; }
fieldset { border: 0; padding: 0; margin: 0; }

/* ---- compact cost lines (public BPR calculator) ------------------------- */
.calc-lines { display: grid; grid-template-columns: auto 1fr 4.6rem; gap: .4rem .45rem; align-items: center; }
.calc-lines .clh { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.calc-lines .clh.r { text-align: right; }
.calc-lines label { font-size: .72rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.calc-lines .input { padding: .42rem .5rem; font-size: .92rem; }
.calc-lines .input-prefix .input { padding-left: 1.3rem; }
.calc-lines .input-prefix .pfx { left: .5rem; }
.calc-lines .pct-input { position: relative; }
.calc-lines .pct-input .input { padding-right: 1.15rem; text-align: right; }
.calc-lines .pct-input .sfx { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: .85rem; }
.calc-lines .atcost { font-size: .78rem; color: var(--faint); text-align: right; }

/* ---- hero split layout + highlight card (on the gradient) --------------- */
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: center; }
.hero-split .hero-stat-wrap { display: flex; align-items: center; justify-content: center; }
.hero-stat { text-align: center; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 20px; padding: 1.5rem 2rem; box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .35); }
.hero-stat .cap { text-transform: uppercase; letter-spacing: .12em; font-size: .82rem; font-weight: 700; opacity: .9; }
.hero-stat .big { font-family: var(--font-display); font-size: clamp(2.4rem, 1.4rem + 4.5vw, 3.8rem);
  font-weight: 700; line-height: 1.02; margin: .35rem 0 .15rem; }
.hero-stat .sub { font-size: .85rem; opacity: .85; }
@media (max-width: 620px) { .hero-split { grid-template-columns: 1fr; } }

/* ---- hero trust list (on the gradient) ---------------------------------- */
.hero-points { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: .6rem; }
.hero-points li { position: relative; padding-left: 2rem; font-size: 1.02rem; opacity: .95; }
.hero-points li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 1.35rem; height: 1.35rem; border-radius: 999px;
  background: rgba(255, 255, 255, .18); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700;
}

/* ---- autocomplete ------------------------------------------------------- */
.ac { position: relative; }
.ac-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; display: none; }
.ac-menu.open { display: block; }
.ac-menu.ac-fixed { position: fixed; right: auto; z-index: 60; }
.ac-item { padding: .42rem .65rem; cursor: pointer; font-size: .86rem; display: flex; justify-content: space-between; gap: .5rem; }
.ac-item:hover, .ac-item.active { background: var(--v-050); }
.ac-item.create { color: var(--v-700); font-weight: 600; border-top: 1px solid var(--border); }
.ac-item .tag { color: var(--faint); font-size: .8rem; }
/* A committed autocomplete pick reads as a locked-in pill. */
.input.ac-committed { background: var(--v-100); border-color: var(--v-400); color: var(--v-700); font-weight: 600; border-radius: 999px; }
.input.ac-committed::placeholder { color: transparent; }

/* ---- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .65rem .8rem; text-align: left; white-space: nowrap; }
table.data thead th { font-family: var(--font-body); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600; }
table.data tbody tr + tr td { border-top: 1px solid var(--border); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
table.data tbody tr:hover td { background: var(--v-050); }
.rank { color: var(--faint); font-variant-numeric: tabular-nums; }

/* Compact multi-row entry grid (e.g. the 20-row invoice history sample). */
#histtable th, #histtable td { padding: .24rem .32rem; }
#histtable thead th { font-size: .68rem; letter-spacing: .02em; }
#histtable .input { padding: .28rem .42rem; border-radius: 6px; font-size: .82rem; }
#histtable td.rank { color: var(--muted); font-weight: 600; text-align: center; }
/* Entry-grid header tooltips open leftward + over the rows, so the last column's
   popup never spills past the right edge (no horizontal scroll). */
#histtable .tip-pop { left: auto; right: 0; }
#histtable .tip-pop::before { left: auto; right: 6px; }

/* Historical results table: compact so the extra Costs column fits. */
.hist-results th, .hist-results td { padding: .32rem .5rem; font-size: .85rem; }

/* Highlighted column (yellow marker). */
.hl-yellow { background: #fff3b0; }
table.data tbody tr:hover td.hl-yellow { background: #ffe98a; }

/* Year-to-date report: compact wide table with grouped columns. */
.ytd-report th, .ytd-report td { padding: .32rem .5rem; font-size: .82rem; white-space: nowrap; }
.ytd-report .grp { border-left: 1px solid var(--border); }
.ytd-report thead tr:first-child th { text-align: center; font-size: .72rem; }
.ytd-report tbody td:first-child { font-weight: 600; }

/* ---- badges / pills ----------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; padding: .18rem .55rem; border-radius: 999px; background: var(--v-100); color: var(--v-700); }
.badge.soon { background: #fff4e2; color: var(--warn); }
.pill-tab { display: inline-flex; gap: .25rem; background: var(--v-100); padding: .25rem; border-radius: 12px; }
.pill-tab a { padding: .35rem .8rem; border-radius: 9px; font-size: .9rem; font-weight: 600; color: var(--v-700); }
.pill-tab a.active { background: var(--surface); box-shadow: var(--shadow-sm); }
.pill-tab a:hover { text-decoration: none; }

/* ---- flash -------------------------------------------------------------- */
.flash { padding: .8rem 1.1rem; border-radius: 11px; margin-bottom: 1rem; font-weight: 500; border: 1px solid transparent; }
.flash.ok { background: var(--up-bg); color: #0a6b4a; border-color: #bfe6d4; }
.flash.error { background: var(--down-bg); color: #a5292d; border-color: #f4c9cb; }
.flash.info { background: var(--v-100); color: var(--v-700); border-color: #ded1f6; }

/* ---- help tooltip ------------------------------------------------------- */
.tip { position: relative; display: inline-flex; vertical-align: middle; margin-left: .3rem; cursor: help; outline: none; }
.tip-q { width: 16px; height: 16px; border-radius: 50%; background: var(--v-100); color: var(--v-700);
  font-family: var(--font-body); font-size: 11px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; }
.tip:hover .tip-q, .tip:focus .tip-q { background: var(--v-500); color: #fff; }
.tip-pop { position: absolute; top: calc(100% + 8px); left: 0; width: max-content; max-width: 270px;
  background: var(--ink); color: #fff; font-size: .78rem; font-weight: 500; line-height: 1.45;
  text-transform: none; letter-spacing: normal;   /* don't inherit uppercase table headers */
  padding: .5rem .65rem; border-radius: 7px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98);
  /* Fade + slide in and out; delay hiding visibility until the fade finishes. */
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
  z-index: 70; text-align: left; white-space: normal; pointer-events: none; }
.tip:hover .tip-pop, .tip:focus .tip-pop { opacity: 1; visibility: visible; transform: translateY(0) scale(1);
  transition: opacity .15s ease, transform .15s ease, visibility 0s; }
.tip-pop::before { content: ""; position: absolute; bottom: 100%; left: 6px;
  border: 6px solid transparent; border-bottom-color: var(--ink); }

/* ---- Peter's Tip banner ------------------------------------------------- */
.peter-tip { display: flex; align-items: center; gap: 1.2rem; margin-top: 1.75rem;
  background: var(--grad-soft); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  padding: 1.15rem 1.4rem; box-shadow: var(--shadow-sm); }
.disclaimer { margin: 2rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--border);
  font-size: .72rem; line-height: 1.6; color: var(--faint); }

/* ---- shared small components (retire duplicated inline blocks) ---------- */
.gauge-title { color: #fff; margin-bottom: .6rem; text-align: center; }
.list-row { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.bar { height: 8px; background: var(--v-100); border-radius: 999px; overflow: hidden; margin-top: .2rem; }
.bar > span { display: block; height: 100%; background: var(--grad); border-radius: 999px; }
table.data tr.is-current { background: var(--v-050); font-weight: 600; }

.peter-tip-img { flex: none; align-self: center; }
.peter-tip-img img { height: 118px; width: auto; display: block;
  filter: drop-shadow(0 7px 9px rgba(52,20,105,.22)); }
.peter-tip-label { font-family: var(--font-display); font-weight: 700; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .09em; color: var(--v-600); margin-bottom: .25rem; }
.peter-tip-head { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--ink); margin: 0 0 .3rem; }
.peter-tip-body p { margin: 0; color: var(--ink); font-size: .86rem; line-height: 1.55; font-style: italic; }
.peter-tip-body p + p { margin-top: .55rem; }
@media (max-width: 620px) { .peter-tip { flex-direction: column; text-align: center; gap: .8rem; } .peter-tip-img { align-self: center; } }
/* Compact inline variant (e.g. the dashboard "what this means" note). */
.peter-tip-sm { margin-top: 0; gap: .9rem; padding: .85rem 1rem; border-radius: var(--r); }
.peter-tip-sm .peter-tip-img img { height: 76px; }
.peter-tip-sm .peter-tip-label { font-size: .72rem; margin-bottom: .12rem; }
.peter-tip-sm .peter-tip-body p { font-size: .82rem; line-height: 1.45; }

/* ---- explain strip (plain-language metric help) ------------------------- */
.explain { font-size: .85rem; color: var(--muted); border-left: 2px solid var(--v-400); padding-left: .7rem; margin-top: .4rem; }

/* ---- auth / narrow pages ------------------------------------------------ */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside { background: var(--grad); color: #fff; padding: clamp(2rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-aside .kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; opacity: .8; margin-bottom: 1rem; }
.auth-aside h1 { color: #fff; font-size: clamp(1.8rem, 1.3rem + 2vw, 2.8rem); max-width: 14em; }
.auth-aside .lead { font-size: 1.1rem; opacity: .92; max-width: 42ch; }
.auth-aside .glow { position: absolute; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%); right: -140px; bottom: -160px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 380px; }
.narrow { max-width: 620px; margin: 0 auto; }

/* ---- BPR gauge (signature) --------------------------------------------- */
.gauge { display: flex; flex-direction: column; align-items: center; }
.gauge svg { width: 100%; max-width: 260px; height: auto; }
.gauge .track { fill: none; stroke: rgba(255,255,255,.22); }
.gauge .fill { fill: none; stroke: url(#gaugeGrad); stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1); }
.gauge.on-light .track { stroke: var(--v-100); }
.gauge .tick { stroke: #fff; stroke-width: 2; }
.gauge.on-light .tick { stroke: var(--v-700); }
.gauge-value { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 600; }
.gauge-caption { font-size: .85rem; opacity: .85; margin-top: .1rem; }

/* ---- setup progress: phase bar (top level) + step stepper (sub level) ---- */
.phase-bar { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1.6rem 0 1rem; }
.phase-seg { display: flex; align-items: center; gap: .75rem; padding: .75rem .95rem; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface); }
.phase-seg .pn { width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; background: var(--v-100); color: var(--v-700); }
.phase-seg .pl { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--faint); }
.phase-seg .pt { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: var(--ink); line-height: 1.15; }
.phase-seg.done .pn { background: var(--up); color: #fff; }
.phase-seg.done .pt { color: var(--v-700); }
.phase-seg.current { background: var(--grad); border-color: transparent; box-shadow: var(--shadow); }
.phase-seg.current .pn { background: rgba(255,255,255,.22); color: #fff; }
.phase-seg.current .pl { color: rgba(255,255,255,.75); }
.phase-seg.current .pt { color: #fff; }
.phase-seg.locked { opacity: .55; }

.step-row { display: flex; align-items: stretch; gap: .4rem; margin: 0 0 1.5rem; }
.step-chip { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-size: .9rem; font-weight: 500;
  color: var(--muted); padding: .58rem .8rem; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; text-align: center; transition: background .15s, border-color .15s; }
.step-chip:hover { text-decoration: none; background: var(--v-050); border-color: var(--border-strong); }
.step-chip .sn { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-size: .7rem; font-weight: 700; background: var(--v-100); color: var(--v-700); }
.step-chip.done { color: var(--v-700); background: var(--v-050); border-color: var(--border-strong); }
.step-chip.done .sn { background: var(--up); color: #fff; }
.step-chip.current { color: var(--ink); font-weight: 700; background: var(--v-100); border-color: var(--v-400); }
.step-chip.current .sn { background: var(--grad); color: #fff; }
.step-sep { color: var(--faint); font-size: .9rem; flex: none; align-self: center; }
@media (max-width: 620px) { .step-row { flex-wrap: wrap; } .step-chip { flex: 1 1 100%; justify-content: flex-start; } .step-sep { display: none; } }

/* Compact phase label used inside the setup-dashboard checklist card. */
.phase-mini { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 600; font-size: .98rem; }
.phase-mini .pn { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .78rem; }
.phase-mini .faint { font-weight: 500; font-size: .85rem; }

@media (max-width: 620px) { .phase-bar { grid-template-columns: 1fr; } }
.wiz-steps li { display: flex; align-items: center; gap: .5rem; font-size: .86rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .8rem .3rem .35rem; }
.wiz-steps li .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; background: var(--v-100); color: var(--v-700); font-family: var(--font-display); }
.wiz-steps li.done { color: var(--v-700); }
.wiz-steps li.done .n { background: var(--up); color: #fff; }
.wiz-steps li.current { color: #fff; background: var(--grad); border-color: transparent; box-shadow: var(--shadow-sm); }
.wiz-steps li.current .n { background: rgba(255,255,255,.25); color: #fff; }

/* ---- misc --------------------------------------------------------------- */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.2rem; margin-bottom: .5rem; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; border: 0; }
.row-actions { display: flex; gap: .4rem; }
.inline-form { display: inline; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--v-050); border: 1px solid var(--border); border-radius: 999px; padding: .25rem .3rem .25rem .7rem; font-size: .88rem; }
.tag-chip form { display: inline; }
.tag-chip button { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .2rem; border-radius: 50%; }
.tag-chip button:hover { color: var(--down); }
.hero-gradient { background: var(--grad); color: #fff; border-radius: var(--r-lg); padding: clamp(1.4rem, 3vw, 2.2rem); box-shadow: var(--shadow); }
.hero-gradient h1, .hero-gradient h2 { color: #fff; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 1040px) {
  .grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 620px) {
  .nav { position: fixed; inset: 62px 0 auto 0; background: var(--v-800); flex-direction: column; align-items: stretch; padding: .5rem; gap: .15rem; display: none; box-shadow: var(--shadow-lg); }
  .nav.open { display: flex; }
  .nav .sep { display: none; }
  .nav-toggle { display: block; }
  .nav-main { flex: none; }
  .only-mobile { display: block; }
  .user-menu { display: none; }
  .grid.cols-4, .grid.cols-5, .grid.cols-2 { grid-template-columns: 1fr; }
  .grid.cols-4 .field > label, .grid.cols-5 .field > label { min-height: 0; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 3px solid var(--v-400); outline-offset: 2px; border-radius: 4px; }
