/* Next Step — Ivory & Ink design system (The Planner Edition).
   Navy #1C2E47 · Ivory #FAF6EF · Gold #C2A059 (fills only) ·
   Gold text on ivory #8A6A12 (>= 4.5:1). No red anywhere. */
@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display.woff2') format('woff2');
  font-weight: 600 800;
  font-display: swap;
}

:root {
  --ink: #1C2E47;
  --ink-soft: #3D5170;
  --ivory: #FAF6EF;
  --paper: #FFFFFF;
  --line: #E7DFCE;
  --gold: #C2A059;
  --gold-text: #8A6A12;
  --gold-pale: #F1E7CE;
  --muted: #5C6672;
  --shadow: 0 2px 10px rgba(28, 46, 71, .08), 0 12px 32px rgba(28, 46, 71, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
}
html[data-theme="ink"] {
  --ink: #F3EDDF;
  --ink-soft: #C9D2DE;
  --ivory: #14213A;
  --paper: #1C2E47;
  --line: #3D5170;
  --gold-text: #E9C979;
  --gold-pale: #2A3D5C;
  --muted: #A9B4C2;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
}
html[data-textsize="0"] { font-size: 100%; }
html[data-textsize="1"] { font-size: 106.25%; }
html[data-textsize="2"] { font-size: 118.75%; }
html[data-textsize="3"] { font-size: 137.5%; }
html[data-font="dyslexia"] body { font-family: 'Comic Sans MS', 'Segoe UI', var(--font-body); letter-spacing: .01em; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--ivory);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
small { color: var(--muted); }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold-text); outline-offset: 2px; border-radius: 4px; }
.noscript-note { padding: 2rem; font-family: Georgia, serif; background: #FAF6EF; color: #1C2E47; }

/* ---- demo ribbon: gold bar, wraps instead of clipping ---- */
#demo-ribbon {
  background: var(--gold);
  color: #1C2E47;
  text-align: center;
  padding: .45rem max(.75rem, env(safe-area-inset-left)) .45rem max(.75rem, env(safe-area-inset-right));
  font-size: .9rem;
  display: flex; flex-wrap: wrap; gap: .35rem .6rem;
  align-items: center; justify-content: center;
}
#demo-ribbon .ribbon-btn {
  display: inline-block; background: #1C2E47; color: #E9C979; text-decoration: none;
  font-weight: 700; padding: .32rem .9rem; border-radius: 999px; white-space: nowrap;
  min-height: 36px; line-height: 1.7;
}

/* ---- layout: sidebar >= 1024px, bottom tabs below ---- */
.layout { display: block; }
.sidebar { display: none; }
main {
  padding: 1rem max(1rem, env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  max-width: 760px; margin: 0 auto; width: 100%;
}
@media (min-width: 1024px) {
  .layout { display: flex; align-items: flex-start; }
  .sidebar {
    display: flex; flex-direction: column; gap: .5rem; width: 264px; flex: 0 0 264px;
    padding: 1.25rem; background: #1C2E47; color: #F3EDDF;
    position: sticky; top: 0; height: 100dvh;
  }
  html[data-theme="ink"] .sidebar { background: #0E1930; }
  .sidebar .nav-btn { background: transparent; color: #F3EDDF; border: 1px solid transparent; text-align: left; min-height: 48px; border-radius: var(--radius-sm); padding: .6rem .9rem; font-size: 1rem; }
  .sidebar .nav-btn.active { border-left: 4px solid var(--gold); background: rgba(255, 255, 255, .07); font-weight: 700; }
  .sidebar .toolkit-btn { margin-top: 1rem; }
  .side-note { color: #C9D2DE; font-size: .85rem; margin-top: auto; }
  .tabbar { display: none !important; }
  .brand-mobile { display: none !important; }
  main { padding-bottom: 3rem; max-width: 1180px; flex: 1 1 auto; min-width: 0; }
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; z-index: 30;
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .nav-btn { flex: 1; border: 0; border-radius: 0; background: transparent; font-size: .82rem; min-height: 60px; color: var(--muted); }
.tabbar .nav-btn.active { color: var(--ink); font-weight: 700; box-shadow: inset 0 3px 0 var(--gold); }

/* ---- top bar (holds the toolkit button; never floats) ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; }
.brand strong { font-family: var(--font-display); font-size: 1.15rem; display: block; line-height: 1.1; }
.brand small { letter-spacing: .14em; font-size: .62rem; color: var(--gold-text); display: block; }
.sidebar .brand small { color: #E9C979; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: var(--gold);
  color: #1C2E47; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 42px;
}
.toolkit-btn {
  background: var(--gold-pale); color: var(--ink); border: 1px solid var(--gold);
  border-radius: 999px; padding: .5rem 1rem; min-height: 48px; font-weight: 600; white-space: nowrap;
}
.offline { background: var(--gold-pale); border: 1px solid var(--gold); border-radius: var(--radius-sm); padding: .5rem .8rem; }
.error-banner { background: var(--gold-pale); border: 1px solid var(--gold-text); border-radius: var(--radius-sm); padding: .6rem .8rem; }

/* ---- generic controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  padding: .55rem 1.1rem; min-height: 48px; font-weight: 600; text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--ivory); border-color: var(--ink); font-size: 1.05rem; padding: .7rem 1.6rem; }
html[data-theme="ink"] .btn-primary { background: var(--gold); color: #1C2E47; border-color: var(--gold); }
.btn-gold { background: var(--gold); color: #1C2E47; border-color: var(--gold); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-soft); font-weight: 500; }
.btn-danger-quiet { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.chip {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: .35rem .85rem; min-height: 40px; font-size: .9rem;
}
.chip.active { background: var(--ink); color: var(--ivory); border-color: var(--ink); font-weight: 700; }
html[data-theme="ink"] .chip.active { background: var(--gold); color: #1C2E47; border-color: var(--gold); }
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; margin: .6rem 0 1rem; }
.stage-tag {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .05em;
  background: var(--gold-pale); color: #75590B; border-radius: 999px; padding: .15rem .6rem;
  text-transform: uppercase;
}
html[data-theme="ink"] .stage-tag { color: #E9C979; }
.tag { display: inline-block; font-size: .78rem; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .55rem; color: var(--muted); }

/* ---- Today ---- */
.energy-picker { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1.1rem; }
.energy-btn {
  flex: 1 1 30%; min-height: 56px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--paper); padding: .5rem; font-weight: 600;
}
.energy-btn.active { border-color: var(--gold); background: var(--gold-pale); box-shadow: inset 0 0 0 1px var(--gold); }
.action-card { border: 1px solid var(--gold); background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); padding: 1.4rem; margin-bottom: 1.2rem; }
.action-card .kicker { color: var(--gold-text); font-weight: 700; letter-spacing: .08em; font-size: .78rem; text-transform: uppercase; margin-bottom: .4rem; }
.action-card h2 { font-size: 1.55rem; margin-bottom: .4rem; }
.action-card .why { color: var(--ink-soft); font-size: 1.02rem; }
.ts-note { display: inline-block; background: var(--gold-pale); border-radius: 999px; padding: .15rem .7rem; font-size: .82rem; font-weight: 600; margin-bottom: .6rem; }
.nudge-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.nudge-row:last-child { border-bottom: 0; }

/* ---- Pipeline ---- */
.job-card { text-align: left; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; margin-bottom: .7rem; display: block; }
.job-card h3 { margin-bottom: .15rem; font-size: 1.08rem; }
.job-card .meta { color: var(--muted); font-size: .88rem; }
.job-card .card-actions { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.mini-btn { min-height: 40px; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--ivory); font-size: .88rem; font-weight: 600; }
.search-input, .field input, .field select, .field textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); min-height: 48px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field { display: block; margin-bottom: .9rem; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.board { display: none; }
@media (min-width: 1024px) {
  .board { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
  .board-col { background: rgba(28, 46, 71, .03); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; min-height: 200px; }
  html[data-theme="ink"] .board-col { background: rgba(255, 255, 255, .04); }
  .board-col h3 { font-size: .95rem; display: flex; justify-content: space-between; }
  .board-col.drag-over { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
  .pipeline-list { display: none; }
}
.stage-group h2 { margin-top: 1.1rem; }
h2.small-head { font-size: 1.12rem; }

/* ---- overlays / sheet / toast ---- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 33, 58, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.overlay[hidden] { display: none; }
.sheet {
  background: var(--paper); color: var(--ink); width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 1.2rem max(1.2rem, env(safe-area-inset-right)) calc(1.2rem + env(safe-area-inset-bottom)) max(1.2rem, env(safe-area-inset-left));
}
@media (min-width: 700px) { .overlay { align-items: center; padding: 1rem; } .sheet { border-radius: 20px; } }
.sheet .stage-option { display: block; width: 100%; text-align: left; min-height: 52px; padding: .6rem .9rem; margin-bottom: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ivory); font-weight: 600; }
.sheet .stage-option.current { border-color: var(--gold); background: var(--gold-pale); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--ink); color: var(--ivory); border-radius: 999px;
  padding: .6rem .6rem .6rem 1.1rem; display: flex; align-items: center; gap: .7rem;
  box-shadow: var(--shadow); max-width: min(92vw, 520px);
}
html[data-theme="ink"] .toast { background: var(--gold); color: #1C2E47; }
.toast[hidden] { display: none; }
.toast button { background: var(--gold); color: #1C2E47; border: 0; border-radius: 999px; font-weight: 700; padding: .4rem .95rem; min-height: 40px; }
html[data-theme="ink"] .toast button { background: #1C2E47; color: #E9C979; }

/* ---- misc ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .45rem 0 .45rem 1rem; border-left: 2px solid var(--gold); margin-left: .3rem; }
.timeline .when { color: var(--muted); font-size: .82rem; }
.check-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; }
.check-row input { width: 22px; height: 22px; }
.empty-note { color: var(--muted); }
.view-head { margin-bottom: .8rem; }
.view-head p { color: var(--ink-soft); }
.frame-note { border: 1px dashed var(--gold); border-radius: var(--radius); padding: 1.1rem 1.2rem; background: var(--paper); }
/* ---- offers compare table ---- */
.offers-table { border-collapse: collapse; width: 100%; }
.offers-table th, .offers-table td { border: 1px solid var(--line); padding: .5rem .6rem; text-align: left; vertical-align: top; font-size: .92rem; }
.offers-table th { background: var(--gold-pale); font-weight: 700; }
html[data-motion="reduce"] * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print { .tabbar, .sidebar, .topbar, #demo-ribbon, .toast { display: none !important; } main { padding: 0; } }
