/* HPSILab AI Consulting — landing page + admin console.
   Light palette on :root, dark redefined under prefers-color-scheme only. */

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --border: #e2e5ea;
  --ink: #14171c;
  --muted: #5a6472;
  --accent: #1f5eff;
  --accent-ink: #ffffff;
  --ok: #0d7a4a;
  --warn: #9a6b00;
  --err: #b3261e;
  --hot: #b3261e;
  --warm: #9a6b00;
  --cold: #5a6472;
  --radius: 10px;
  --wrap: 940px;

  /* Card accents. Cards carry a coloured left edge that cycles through these, the
     same treatment as hpsilab.com/etf. Tailwind's 400 level, which holds up as a
     4px bar on both the light and the dark background. */
  --a1: #38bdf8;  /* sky    */
  --a2: #a78bfa;  /* violet */
  --a3: #34d399;  /* emerald*/
  --a4: #fbbf24;  /* amber  */
  --a5: #fb7185;  /* rose   */
  --a6: #22d3ee;  /* cyan   */
  --card-shadow: rgba(15, 18, 22, .10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #161a20;
    --border: #262c35;
    --ink: #e8ebef;
    --muted: #99a3b0;
    --accent: #6f9bff;
    --accent-ink: #0f1216;
    --ok: #4ec98a;
    --warn: #e0b64a;
    --err: #ff7b72;
    --hot: #ff7b72;
    --warm: #e0b64a;
    --cold: #99a3b0;

    /* The accents hold on dark; only the shadow needs to go deeper to be seen. */
    --card-shadow: rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.band { padding: 56px 24px; border-top: 1px solid var(--border); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: clamp(32px, 5vw, 52px); letter-spacing: -0.02em; }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }

/* --- hero --- */
.hero { padding: 72px 0 56px; background: var(--surface); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.lede { font-size: 19px; color: var(--muted); max-width: 620px; }
.tagline { font-style: italic; color: var(--muted); }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.btn {
  display: inline-block; padding: 12px 22px; border-radius: var(--radius);
  text-decoration: none; font-weight: 600; border: 1px solid transparent; cursor: pointer;
  font-size: 15px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: var(--border); color: var(--ink); background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* --- proof bar --- */
.proof { background: var(--bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.proof-row { display: flex; gap: 28px; flex-wrap: wrap; padding: 16px 24px; color: var(--muted); font-size: 13px; }

.big { font-size: 18px; color: var(--muted); max-width: 700px; }
.big.accent { color: var(--ink); font-weight: 600; }
.sub { color: var(--muted); }

/* Cards: a thin neutral border with a coloured left edge, cycling through the
   accent set — the same treatment as the cards on hpsilab.com/etf. The colour is
   carried in --card-accent so one rule can style the border, the hover tint and
   anything else that needs to match. */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid article {
  --card-accent: var(--a1);
  /* Longhands rather than the `border` shorthand, so the selected-package rule
     below can recolour three sides and leave the 4px accent edge alone without
     restating it. */
  border-style: solid;
  border-width: 1px 1px 1px 4px;
  border-top-color: var(--border);
  border-right-color: var(--border);
  border-bottom-color: var(--border);
  border-left-color: var(--card-accent);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.grid article:hover {
  border-top-color: var(--card-accent);
  border-right-color: var(--card-accent);
  border-bottom-color: var(--card-accent);
  box-shadow: 0 2px 12px var(--card-shadow);
  transform: translateY(-1px);
}
.grid article p { color: var(--muted); margin: 0; }

.grid article:nth-child(6n + 1) { --card-accent: var(--a1); }
.grid article:nth-child(6n + 2) { --card-accent: var(--a2); }
.grid article:nth-child(6n + 3) { --card-accent: var(--a3); }
.grid article:nth-child(6n + 4) { --card-accent: var(--a4); }
.grid article:nth-child(6n + 5) { --card-accent: var(--a5); }
.grid article:nth-child(6n + 6) { --card-accent: var(--a6); }

/* The four packages read as a ladder, so they belong on one line: side by side
   the prices compare at a glance, and wrapped they become two unrelated groups
   with the cheapest and the dearest on different rows. auto-fit would wrap at
   this container width, so the count is fixed here and stepped down explicitly.
   minmax(0, …) rather than 1fr: a long package name would otherwise push a
   column past its share and overflow the row. */
.packages { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.packages article { padding: 18px 16px; }
@media (max-width: 900px) { .packages { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (max-width: 540px) { .packages { grid-template-columns: 1fr; } }

.packages .price { font-size: 21px; font-weight: 700; color: var(--ink); margin: 4px 0 0; letter-spacing: -0.01em; }
.packages .dur { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.packages .note { font-size: 13px; margin-top: 12px; }
/* The featured package carries its accent all the way round rather than only down
   the left edge, so it reads as chosen without needing a badge. */
.packages .featured {
  border-top-color: var(--card-accent);
  border-right-color: var(--card-accent);
  border-bottom-color: var(--card-accent);
}

/* The step numbers pick up the same sequence, so the page reads as one system. */
.steps li:nth-child(6n + 1)::before { background: var(--a1); }
.steps li:nth-child(6n + 2)::before { background: var(--a2); }
.steps li:nth-child(6n + 3)::before { background: var(--a3); }
.steps li:nth-child(6n + 4)::before { background: var(--a4); }
.steps li:nth-child(6n + 5)::before { background: var(--a5); }
.steps li:nth-child(6n + 6)::before { background: var(--a6); }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li { counter-increment: step; padding: 14px 0 14px 48px; border-bottom: 1px solid var(--border); position: relative; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 14px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.steps span { display: block; color: var(--muted); font-size: 14px; }

details { border-bottom: 1px solid var(--border); padding: 14px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 10px 0 0; }

/* --- form --- */
form { max-width: 620px; margin-top: 24px; }
label { display: block; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.opt { font-weight: 400; color: var(--muted); }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--ink); font: inherit; font-weight: 400;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.two-up { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#form-msg { margin-top: 14px; font-size: 14px; }
#form-msg.ok { color: var(--ok); }
#form-msg.err { color: var(--err); }

footer { padding: 40px 24px 64px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }

/* --- admin console --- */
.admin-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding: 24px 0; }
.stats { display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-left: auto; }
.stats b { color: var(--ink); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface); }

.tier { font-weight: 700; font-size: 12px; text-transform: uppercase; }
.tier.hot { color: var(--hot); }
.tier.warm { color: var(--warm); }
.tier.cold { color: var(--cold); }
.tier.reject { color: var(--muted); text-decoration: line-through; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--ink);
  max-width: 780px; width: calc(100% - 40px); padding: 0;
}
dialog::backdrop { background: rgba(0,0,0,.5); }
.dlg-body { padding: 24px; max-height: 78vh; overflow: auto; }
.dlg-body h3 { margin-top: 24px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; font-size: 14px; margin-bottom: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--surface); }
.msg.in { border-left: 3px solid var(--ok); }
.msg header { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.msg textarea { font-size: 14px; }
.msg .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.events { font-size: 12px; color: var(--muted); }
.events li { margin-bottom: 4px; }
.empty { color: var(--muted); padding: 32px 0; }

/* --- client-facing proposal page --- */
.doc .doc-head { background: var(--surface); padding: 48px 0 32px; border-bottom: 1px solid var(--border); }
.doc-body { padding: 8px 24px 48px; }
.doc-body section { padding: 28px 0; border-bottom: 1px solid var(--border); }
.doc-body section:last-of-type { border-bottom: none; }
.doc-body h2 { font-size: 20px; }
.doc-body h3 { font-size: 15px; margin-top: 20px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.doc-body ul { margin: 8px 0 0; padding-left: 20px; }
.doc-body li { margin-bottom: 6px; }
.doc-body .excl li { color: var(--muted); }
.scope { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.banner { border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; border: 1px solid var(--border); }
.banner.ok { border-color: var(--ok); color: var(--ok); }
.banner.warn { border-color: var(--warn); color: var(--warn); }

.price-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface); max-width: 420px; }
.price-box .line { display: flex; justify-content: space-between; padding: 6px 0; }
.price-box .credit { color: var(--ok); }
.price-box .total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; font-size: 22px; font-weight: 700; }
.cta-box { padding-top: 28px; }

/* --- delivery board --- */
.wrap.wide { max-width: 1400px; }
.board { display: grid; gap: 14px; grid-template-columns: repeat(6, minmax(180px, 1fr)); align-items: start; overflow-x: auto; padding-bottom: 24px; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(3, minmax(200px, 1fr)); } }
@media (max-width: 700px) { .board { grid-template-columns: 1fr; } }
.column { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.column h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; cursor: pointer; }
.card:hover { border-color: var(--accent); }
.card h4 { font-size: 14px; margin: 0 0 8px; line-height: 1.35; }
.card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); gap: 8px; }
.card-meta .overdue { color: var(--err); font-weight: 600; }
.bar { height: 4px; background: var(--border); border-radius: 2px; margin: 10px 0 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.empty.sm { padding: 8px 0; font-size: 13px; }
.check { display: block; font-weight: 400; font-size: 14px; margin-bottom: 8px; }
.check input { display: inline; width: auto; margin: 0 8px 0 0; }

/* --- proposal panel inside the leads console --- */
.prop { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--surface); }
.prop.paid { border-left: 3px solid var(--ok); }
.prop header { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.prop .amount { font-size: 18px; font-weight: 700; color: var(--ink); }
.prop-field { margin-bottom: 10px; }
.prop-field label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* --- blueprint deliverable --- */
.toc { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 24px; margin: 24px auto; background: var(--surface); }
.toc ol { margin: 8px 0 0; padding-left: 20px; columns: 2; column-gap: 32px; }
.toc li { margin-bottom: 4px; }
.toc a { color: var(--ink); }
.callout { border-left: 3px solid var(--warn); padding: 4px 0 4px 16px; margin: 12px 0; }
.callout p:last-child { margin-bottom: 0; }
.components { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 20px; margin: 12px 0 0; }
.components dt { font-weight: 600; }
.components dd { margin: 0; color: var(--muted); }
.phases { list-style: none; counter-reset: phase; padding: 0; margin: 0; }
.phases li { counter-increment: phase; padding: 12px 0 12px 44px; border-bottom: 1px solid var(--border); position: relative; }
.phases li::before {
  content: counter(phase); position: absolute; left: 0; top: 12px;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.phases span { display: block; color: var(--muted); font-size: 14px; }

@media print {
  .no-print, footer { display: none; }
  body { background: #fff; color: #000; }
  .doc .doc-head { background: #fff; padding: 0 0 16px; }
  .doc-body section { page-break-inside: avoid; border-bottom: none; padding: 16px 0; }
  h2 { page-break-after: avoid; }
  a { color: #000; text-decoration: none; }
  .callout { border-left-color: #666; }
}

/* --- funnel metrics --- */
.stat-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 12px; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.tile-value { display: block; font-size: 26px; font-weight: 700; line-height: 1.2; }
.tile-label { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; text-transform: capitalize; }
.tile-note { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.tile.good { border-color: var(--ok); }
.tile.good .tile-value { color: var(--ok); }
.tile.warn { border-color: var(--warn); }
.tile.warn .tile-value { color: var(--warn); }
.tile.bad { border-color: var(--err); }
.tile.bad .tile-value { color: var(--err); }

.funnel { margin-top: 12px; }
.funnel-row { display: grid; grid-template-columns: 160px 1fr 140px; gap: 14px; align-items: center; padding: 7px 0; }
.funnel-label { font-size: 14px; }
.funnel-track { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; height: 30px; }
.funnel-track i { display: block; height: 100%; background: var(--accent); border-radius: 5px 0 0 5px; }
.funnel-track b { position: absolute; left: 10px; top: 0; line-height: 30px; font-size: 13px; color: var(--ink); mix-blend-mode: difference; filter: invert(1) grayscale(1) contrast(9); }
.funnel-rate { font-size: 12px; color: var(--muted); text-align: right; }
@media (max-width: 700px) { .funnel-row { grid-template-columns: 1fr; gap: 4px; } .funnel-rate { text-align: left; } }

/* --- language switcher --- */
.langs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.langs .chip { text-decoration: none; }

/* --- package picker ---
   A bare radio with no text beside it, so the whole card carries the selected
   state instead of a row inside it. Selecting is a card-level act, and a
   highlight on a 20px control is easy to miss on a 214px card. */
.packages .pick {
  display: block; width: auto; margin: 0 0 12px; padding: 0;
  accent-color: var(--card-accent); cursor: pointer;
}
.packages article:has(.pick:checked) {
  /* Three sides only: the left edge is already this colour and 4px wide. */
  border-top-color: var(--card-accent);
  border-right-color: var(--card-accent);
  border-bottom-color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) 10%, var(--surface));
}
.packages article:has(.pick:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
