/* Instant Business Plan — matches the Cashflow Forecaster's dark, premium UI.
   Screen is dark; the printed plan (bottom) forces the light brand-template look. */

:root {
  /* Surfaces */
  --bg: #070a10;
  --panel: #10151f;
  --panel-2: #141b27;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --ink: #eaf1f8;
  --ink-soft: #b8c4d2;
  --muted: #7c8a9c;

  /* Accent — teal→cyan, fintech (same as the Forecaster) */
  --accent: #2dd4bf;
  --accent-2: #22d3ee;
  --accent-strong: #14b8a6;
  --accent-ink: #06231f;
  --accent-wash: rgba(45, 212, 191, 0.12);
  --accent-line: rgba(45, 212, 191, 0.30);

  /* Status */
  --danger: #f87171;
  --warning: #fbbf24;
  --warning-wash: rgba(251, 191, 36, 0.10);

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --focus: 0 0 0 3px rgba(45, 212, 191, 0.4);

  /* Plan document palette (used for the printed PDF only) */
  --doc-deep: #002d2d;
  --doc-teal: #35b2aa;
  --doc-mint: #c1f0d0;
  --doc-gold: #f6ae27;

  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at -8% -12%, rgba(45, 212, 191, 0.16) 0, transparent 42%),
    radial-gradient(820px 480px at 108% -6%, rgba(124, 140, 248, 0.14) 0, transparent 42%),
    radial-gradient(1200px 700px at 50% 120%, rgba(34, 211, 238, 0.08) 0, transparent 50%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

.site-header { text-align: center; padding: 40px 20px 18px; }
.site-header h1 {
  margin: 0 0 6px; font-size: 2rem; letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0; color: var(--ink-soft); }

main { max-width: 820px; margin: 0 auto; padding: 16px 20px 40px; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  margin: 0 0 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 4px; font-size: 1.15rem; letter-spacing: -0.01em; }
.hint { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }

.import-card { border-color: var(--accent-line); background: var(--accent-wash); }
.import-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.import-row h2 { margin: 0 0 4px; }
.import-row .hint { margin: 0; max-width: 48ch; }
.import-row button { white-space: nowrap; }

label { display: block; font-weight: 700; margin: 0 0 6px; font-size: 0.94rem; }

textarea, input, select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #566172; }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.22); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus); background: rgba(255, 255, 255, 0.05);
}
select option { background: var(--panel-2); color: var(--ink); }

.tapchips { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tapchips .field.wide { grid-column: 1 / -1; }
.field { margin: 0 0 14px; }
.field:last-child { margin-bottom: 0; }
.field-note { color: var(--muted); font-size: 0.82rem; margin: 4px 0 0; }

.toggle { display: flex; gap: 8px; }
.toggle button {
  flex: 1; padding: 10px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04); color: var(--ink-soft); border-radius: var(--r-md);
}
.toggle button.on {
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
  color: var(--accent-ink); border-color: transparent; font-weight: 700;
}

.swot { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Itemised finance rows */
.rows { display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; }
.finance-row { display: flex; gap: 10px; align-items: center; }
.finance-cell { flex: 0 0 120px; }
.finance-cell.grow { flex: 1 1 auto; }
.finance-row input { width: 100%; }
.row-remove { flex: 0 0 auto; background: none; border: none; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0 6px; }
.row-remove:hover { color: var(--danger); }
.add-row { font-size: 0.9rem; padding: 8px 14px; }

.actions { display: flex; align-items: center; gap: 14px; margin: 4px 0 40px; }
.status { color: var(--muted); }

button.primary {
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
  color: var(--accent-ink); border: none; padding: 12px 24px; border-radius: var(--r-md);
  font-weight: 700; box-shadow: 0 8px 22px rgba(45, 212, 191, 0.3);
}
button.primary:hover { filter: brightness(1.06); }
button.primary:disabled { opacity: 0.55; filter: none; }
button.secondary {
  background: rgba(255, 255, 255, 0.04); color: var(--ink);
  border: 1px solid var(--line-strong); padding: 11px 18px; border-radius: var(--r-md); font-weight: 600;
}
button.secondary:hover { border-color: var(--accent-line); background: rgba(255, 255, 255, 0.07); }

.result-toolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; flex-wrap: wrap; }
.verify { color: var(--muted); font-size: 0.85rem; }

/* KPI summary cards (echo the Forecaster's kpi-card) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 20px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--accent), transparent); }
.kpi-label { margin: 0 0 4px; color: var(--muted); font-size: 0.82rem; }
.kpi-value { margin: 0; font-size: 1.35rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpis-note { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }

/* Detailed, editable financial breakdown */
.fin-detail { margin: 16px 0 0; display: grid; gap: 16px; }
.fin-table h3 { margin: 0 0 6px; font-size: 1rem; color: var(--accent); }
.fin-table table { width: 100%; border-collapse: collapse; }
.fin-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-soft); }
.fin-table td strong { color: var(--ink); font-weight: 600; }
.fin-table td.fin-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-table .fin-sub { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.fin-table tr.fin-total td { border-top: 2px solid var(--line-strong); border-bottom: none; font-weight: 700; color: var(--ink); }
.fin-table [contenteditable]:focus { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* Export strips the working prompts from the finished plan */
body.exporting .flags { display: none !important; }

/* ---- the plan document (dark on screen) ---- */
.plan {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px;
}
.cover-page {
  background: var(--doc-deep); color: #fff; border-radius: var(--r-md); padding: 48px 40px; margin: 0 0 22px;
}
.cover-kicker { margin: 0 0 18px; color: var(--doc-mint); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.cover-title { margin: 0 0 16px; font-size: 2.4rem; line-height: 1.08; font-weight: 800; }
.cover-rule { height: 6px; width: 64px; background: var(--doc-gold); border: none; border-radius: 3px; margin: 0 0 20px; }
.cover-sub { margin: 0; color: var(--doc-mint); font-size: 0.96rem; }

.contents { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 24px 30px; margin: 0 0 22px; }
.contents h2 { margin: 0 0 12px; color: var(--accent); font-size: 1.15rem; }
.contents ol { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.contents li { margin: 0 0 8px; }

.plan section { margin: 0 0 26px; break-inside: avoid; }
.plan h2 { font-size: 1.25rem; margin: 0 0 10px; color: var(--ink); border-bottom: 1px solid var(--accent-line); padding-bottom: 6px; }
.plan [contenteditable] { outline: none; color: var(--ink-soft); }
.plan [contenteditable]:focus { box-shadow: var(--focus); border-radius: 8px; }
.plan p { margin: 0 0 10px; }

.flags { background: var(--warning-wash); border: 1px solid rgba(251, 191, 36, 0.3); border-radius: var(--r-md); padding: 12px 16px; margin: 12px 0 0; }
.flags .flags-title { font-weight: 700; margin: 0 0 6px; font-size: 0.9rem; color: var(--warning); }
.flags ul { margin: 0; padding-left: 18px; color: var(--ink-soft); }
.flags li { margin: 0 0 4px; }

.swot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.swot-grid .swot-cell { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.swot-grid h3 { margin: 0 0 4px; font-size: 0.95rem; color: var(--accent); }

.result-foot { color: var(--muted); font-size: 0.88rem; margin: 16px 2px 60px; }

/* Guided builder ("Help me build") */
.build-switch { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; }
.build-switch .hint { margin: 0; }
.linkbtn { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.wizard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin: 0 0 16px; }
.wizard-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.wizardlog { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; max-height: 420px; overflow-y: auto; }
.wizardcontrols { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wiz-group { flex-basis: 100%; color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin: 8px 0 0; }
.wiz-opt { padding: 10px 16px; border: 1px solid var(--line-strong); background: rgba(255,255,255,0.04); color: var(--ink); border-radius: var(--r-md); cursor: pointer; font: inherit; }
.wiz-opt.chip { border-radius: 999px; }
.wiz-opt:hover { border-color: var(--accent-line); }
.wiz-opt.on { background: var(--accent-wash); border-color: var(--accent-line); color: #eafffb; }
.wiz-input { flex: 1 1 240px; }

/* Plan chat */
.chat { margin-top: 18px; }
.chatlog { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; margin: 0 0 12px; }
.chat-msg { padding: 10px 14px; border-radius: var(--r-md); max-width: 85%; white-space: pre-wrap; line-height: 1.45; }
.chat-user { align-self: flex-end; background: var(--accent-wash); border: 1px solid var(--accent-line); color: var(--ink); }
.chat-assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-soft); }
.chatform { display: flex; gap: 10px; }
.chatform input { flex: 1 1 auto; }
.chatform button { flex: 0 0 auto; }

@media (max-width: 560px) {
  .tapchips, .swot, .swot-grid { grid-template-columns: 1fr; }
  .finance-cell { flex: 1 1 auto; }
}

/* ---- print: force the light brand-template document ---- */
@media print {
  @page { margin: 16mm 15mm; }
  @page cover { margin: 0; }
  html, body {
    background: #fff; color: #000; font-size: 11.5pt;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .site-header, .no-print, .intake { display: none !important; }
  main { max-width: none; padding: 0; }
  .plan { border: none; padding: 0; background: #fff; box-shadow: none; }

  .cover-page {
    page: cover; break-after: page; border-radius: 0; margin: 0;
    min-height: 96vh; box-sizing: border-box; padding: 55mm 24mm;
    display: flex; flex-direction: column; justify-content: center;
    background: var(--doc-deep); color: #fff;
  }
  .cover-title { font-size: 40pt; }

  .contents { break-after: page; border: none; padding: 0; background: #fff; }
  .contents h2 { color: var(--doc-deep); }
  .contents ol { color: #000; }

  .plan section, .flags, .swot-cell { break-inside: avoid; }
  .plan h2 { color: var(--doc-deep); border-bottom: 2px solid var(--doc-mint); }
  .plan [contenteditable] { color: #000; }
  .flags { border-color: #e0cf87; background: #fffdf5; }
  .flags .flags-title { color: #8a6d00; }
  .flags ul { color: #000; }
  .swot-grid .swot-cell { background: #fff; border-color: #ddd; }
  .swot-grid h3 { color: var(--doc-deep); }
  .fin-table h3 { color: var(--doc-deep); }
  .fin-table td { color: #000; border-color: #ddd; }
  .fin-table td strong { color: #000; }
  .fin-table .fin-sub { color: #555; }
  .fin-table tr.fin-total td { border-top-color: #999; color: #000; }
  [contenteditable]:focus { box-shadow: none; }
  .plan::after {
    content: "Prepared with Me Myself Employment  ·  memyselfemployment.org";
    display: block; margin-top: 28px; padding-top: 10px;
    border-top: 1px solid #ddd; color: #666; font-size: 9pt; text-align: center;
  }
}
