/* ============ New Day — Idea Engine ============ */
:root {
  --bg: #070d1a;
  --bg-2: #0a1220;
  --card: #0e1830;
  --card-2: #12203c;
  --line: #1d2c4d;
  --text: #e7edf8;
  --muted: #8fa1c0;
  --cyan: #22d3ee;
  --cyan-dim: #0e7490;
  --gold: #f59e0b;
  --green: #34d399;
  --red: #f87171;
  --violet: #a78bfa;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --radius: 14px;
  --font-head: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(900px 420px at 0% 0%, rgba(245, 158, 11, .07), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

main { max-width: 1180px; margin: 0 auto; padding: 20px 22px 60px; }

a { color: var(--cyan); }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

/* ============ Topbar ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(10, 18, 32, .8); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; background: linear-gradient(135deg, #1e2c50, #0d3b46);
  border: 1px solid var(--line);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; letter-spacing: .14em; }
.brand-sub { font-size: .74rem; color: var(--muted); letter-spacing: .02em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.target-chip {
  font-size: .82rem; font-weight: 600; color: var(--gold);
  background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .35);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}

/* ============ Buttons ============ */
.btn {
  font-family: var(--font-body); font-size: .88rem; font-weight: 600;
  padding: 9px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  transition: transform .06s ease, filter .15s ease, border-color .15s ease;
}
.btn:hover { filter: brightness(1.15); border-color: #2c4270; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #0891b2, #0e7490); border-color: #0891b2; }
.btn.gold { background: linear-gradient(135deg, #b45309, #92400e); border-color: #b45309; color: #fff7e6; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(248, 113, 113, .4); }
.btn.icon { padding: 6px 10px; font-size: 1rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.busy { pointer-events: none; opacity: .7; }

/* ============ Cards / sections ============ */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-top: 20px;
}

/* ============ Intake ============ */
.intake-head h1 { font-size: 1.45rem; margin-bottom: 6px; }
.intake-head p { max-width: 760px; }
.intake-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin-top: 18px; }
.dropzone {
  border: 2px dashed #2b406e; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 26px 14px; cursor: pointer; text-align: center;
  transition: border-color .15s ease, background .15s ease; min-height: 170px;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--cyan); background: rgba(34, 211, 238, .05); outline: none; }
.dropzone.dragover { border-color: var(--gold); background: rgba(245, 158, 11, .08); }
.dz-icon { font-size: 1.9rem; }
.dz-title { font-weight: 700; }
.dz-sub { color: var(--muted); font-size: .84rem; }
.paste-side { display: flex; flex-direction: column; gap: 10px; }
.paste-side textarea {
  width: 100%; min-height: 130px; resize: vertical;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; font-family: var(--font-body); font-size: .92rem;
}
.paste-side textarea:focus { outline: 2px solid var(--cyan-dim); border-color: var(--cyan-dim); }
.paste-actions { display: flex; gap: 10px; }

/* ============ Dashboard ============ */
.dash-top { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.dash-top h2 { font-size: 1.15rem; }
.dash-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.stat b { font-family: var(--font-head); font-size: 1.02rem; }
.stat span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat b.green { color: var(--green); }
.stat b.gold { color: var(--gold); }
.stat b.cyan { color: var(--cyan); }

.pathbar {
  position: relative; height: 34px; margin-top: 14px; border-radius: 999px;
  background: #0b1428; border: 1px solid var(--line); overflow: hidden;
}
.pathbar-fill {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0%;
  background: linear-gradient(90deg, #274067, #33507f);
  transition: width .5s ease, left .5s ease;
}
/* the ideas layer starts where the base ends — JS sets left + width */
.pathbar-fill.ideas { background: linear-gradient(90deg, #0e7490, #22d3ee); }
.pathbar-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; letter-spacing: .03em; text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.pathbar-legend { display: flex; gap: 18px; margin-top: 8px; font-size: .76rem; color: var(--muted); flex-wrap: wrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.base { background: #33507f; }
.dot.ideas { background: var(--cyan); }
.dot.gap { background: #1d2c4d; border: 1px solid #33507f; }

/* ============ Toolbar ============ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }
.rank-mode { font-size: .78rem; }

/* ============ Board ============ */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 14px; margin-top: 14px; }
.board-more { grid-column: 1 / -1; padding: 14px; font-size: .9rem; }

.idea-card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  position: relative; transition: border-color .15s ease, transform .1s ease;
}
.idea-card:hover { border-color: #2c4270; }
.idea-card.excluded { opacity: .55; }

.rank-badge {
  position: absolute; top: -10px; left: -8px;
  background: linear-gradient(135deg, var(--gold), #b45309); color: #1a1206;
  font-family: var(--font-head); font-weight: 800; font-size: .82rem;
  border-radius: 999px; padding: 3px 10px; box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.rank-badge.top { font-size: .95rem; }

.idea-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.idea-title { font-weight: 700; font-size: .98rem; line-height: 1.35; }
.idea-raw { font-size: .82rem; color: var(--muted); font-style: italic; border-left: 2px solid var(--line); padding-left: 8px; }
.idea-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.chip {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.chip.kind { border-color: var(--line); color: var(--muted); }
.chip.src-gemini { border-color: rgba(167, 139, 250, .5); color: var(--violet); }
.chip.overlap { border-color: rgba(245, 158, 11, .55); color: var(--gold); }

.score-dial { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.score-num { font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; color: var(--cyan); }
.score-cap { font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.idea-rev { font-size: .85rem; }
.idea-rev b { color: var(--green); }
.rank-note { font-size: .8rem; color: var(--gold); }

.idea-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; align-items: center; }
.idea-actions .btn { font-size: .8rem; padding: 7px 12px; }

.include-toggle { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--muted); cursor: pointer; user-select: none; }
.include-toggle input { accent-color: var(--cyan); width: 15px; height: 15px; cursor: pointer; }

.status-select {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted); font-size: .74rem; font-weight: 600; padding: 6px 6px;
  cursor: pointer; text-transform: capitalize;
}
.status-select.status-approved { color: var(--cyan); border-color: rgba(34, 211, 238, .4); }
.status-select.status-piloting { color: var(--gold); border-color: rgba(245, 158, 11, .4); }
.status-select.status-live { color: var(--green); border-color: rgba(52, 211, 153, .45); }
.status-select.status-parked { opacity: .6; }

.stale-warn { color: var(--gold); }

/* ============ Empty state ============ */
.empty-state { text-align: center; padding: 60px 20px 30px; display: none; }
.empty-state.show { display: block; }
.empty-icon { font-size: 2.6rem; margin-bottom: 8px; }

/* ============ Modal ============ */
/* The hidden attribute must always win, even over display:flex below */
[hidden] { display: none !important; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 8, 16, .7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; z-index: 60;
  overflow-y: auto;
}
.modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); width: min(880px, 100%); max-height: 92vh;
  display: flex; flex-direction: column;
}
.modal.narrow { width: min(560px, 100%); }
.modal:focus { outline: none; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 1.15rem; padding-right: 12px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ============ Brief rendering ============ */
.brief-section { margin-bottom: 22px; }
.brief-section h3 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--cyan); margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.brief-section h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.brief-big { font-size: .97rem; line-height: 1.7; }
.brief-big .raw-quote { color: var(--gold); font-style: italic; }

.brief-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

ul.brief-list { padding-left: 20px; display: flex; flex-direction: column; gap: 5px; font-size: .92rem; }

.rev-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.rev-range { font-family: var(--font-head); font-size: 1.2rem; color: var(--green); margin-bottom: 6px; }
.rev-formula { font-family: Consolas, monospace; font-size: .82rem; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 8px 0; overflow-x: auto; }
.working-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.working-row input[type=range] { flex: 1; min-width: 160px; accent-color: var(--gold); }
.working-val { font-family: var(--font-head); font-weight: 800; color: var(--gold); min-width: 90px; }

.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan-phase { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.plan-phase h4 { font-size: .8rem; color: var(--gold); margin-bottom: 8px; line-height: 1.4; }
.plan-phase ol { padding-left: 18px; font-size: .84rem; display: flex; flex-direction: column; gap: 5px; }

table.risk-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.risk-table th, .risk-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.risk-table th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.risk-table td:first-child { color: var(--red); }
.risk-table td:last-child { color: var(--green); }

.ice-row { display: flex; gap: 14px; flex-wrap: wrap; }
.ice-item { flex: 1; min-width: 120px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.ice-item .lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ice-item .val { font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; }
.ice-bar { height: 5px; border-radius: 4px; background: var(--line); margin-top: 6px; overflow: hidden; }
.ice-bar i { display: block; height: 100%; background: var(--cyan); border-radius: 4px; }

/* ============ Settings ============ */
.set-h { font-size: .95rem; margin: 18px 0 10px; }
.set-h:first-child { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.field input, .field select {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-size: .92rem; font-family: var(--font-body);
}
.field input:focus, .field select:focus { outline: 2px solid var(--cyan-dim); }
.pill.optional {
  font-size: .64rem; background: rgba(34,211,238,.12); color: var(--cyan);
  border-radius: 999px; padding: 2px 8px; vertical-align: middle; margin-left: 6px;
  letter-spacing: .06em; text-transform: uppercase;
}
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ============ Summary table ============ */
.summary-scroll { overflow-x: auto; }
table.summary-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 760px; }
.summary-table th, .summary-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.summary-table th { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; background: var(--bg-2); }
.summary-table tr.dim { opacity: .5; }

/* ============ Execution fields ============ */
.exec-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field.slim { flex: 1; min-width: 180px; margin-bottom: 0; }

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--card-2); border: 1px solid #2c4270; color: var(--text);
  border-radius: 12px; padding: 12px 20px; font-size: .9rem; z-index: 80;
  box-shadow: var(--shadow); max-width: min(560px, 90vw); text-align: center;
}
.toast.err { border-color: rgba(248, 113, 113, .55); }
.toast .toast-act { margin-left: 10px; padding: 5px 12px; font-size: .82rem; border-color: var(--gold); color: var(--gold); }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ============ Footer ============ */
.footer {
  max-width: 1180px; margin: 0 auto; padding: 18px 22px 34px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line);
}

/* ============ Responsive ============ */
@media (max-width: 760px) {
  .intake-grid { grid-template-columns: 1fr; }
  .dropzone { order: 2; min-height: 110px; padding: 16px 14px; }
  .paste-side { order: 1; }
  .plan-grid { grid-template-columns: 1fr; }
  .dash-stats { justify-content: flex-start; }
  .stat { align-items: flex-start; }
  .brand-sub { display: none; }
  .btn { padding: 11px 16px; }
  .idea-actions .btn { padding: 10px 14px; }
  .include-toggle input { width: 18px; height: 18px; }
}

/* ============ Print: brief one-pager ============ */
@media print {
  body { background: #fff; color: #111; }
  .topbar, .intake, .dash, .toolbar, .board, .footer, .empty-state, .modal-foot, .modal-head .btn, .toast, .working-row input { display: none !important; }
  .modal-backdrop { position: static; padding: 0; background: none; display: block; overflow: visible; }
  .modal { max-height: none; border: none; box-shadow: none; background: #fff; color: #111; width: 100%; }
  .modal-body { overflow: visible; color: #111; }
  .brief-section h3 { color: #0e7490; }
  .plan-phase, .rev-box, .ice-item { background: #f6f8fb; border-color: #d8dee9; color: #111; }
  .rev-formula { background: #eef1f6; color: #333; }
  .brief-big { color: #111; }
  .idea-raw, .muted { color: #555; }
  .summary-table th { color: #555; background: #fff; }
  .summary-table th, .summary-table td { border-color: #d8dee9; }
  .exec-row input { border: 1px solid #d8dee9; background: #fff; color: #111; }
}
