:root {
  --bg: #0b1119;
  --bg-2: #101927;
  --panel: #ffffff;
  --panel-2: #f3f6fa;
  --text: #172033;
  --muted: #5f6f85;
  --brand: #0d6bff;
  --brand-dark: #0057d9;
  --accent: #0f2740;
  --success: #197b4c;
  --danger: #b42318;
  --line: #d8e0ea;
  --shadow: 0 18px 50px rgba(13, 24, 38, 0.16);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f9fc;
  color: var(--text);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.hidden { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 17, 25, 0.9);
  backdrop-filter: blur(14px);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.02em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #ffd16f);
  color: #15120a;
  box-shadow: 0 10px 26px rgba(245, 165, 36, 0.25);
}
.brand-text { font-size: 1.15rem; }
.nav-links { display: flex; gap: 18px; color: rgba(255,255,255,0.8); font-size: 0.95rem; flex-wrap: wrap; }
.nav-links a:hover { color: #fff; }

.hero {
  background:
    radial-gradient(circle at 20% 20%, rgba(245,165,36,0.22), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(58,113,168,0.28), transparent 35%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: #fff;
  padding: 90px 0 70px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.75fr);
  gap: 48px;
  align-items: center;
}
.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--brand-dark);
}
.hero .eyebrow { color: #ffd16f; }
.hero h1, .section-heading h2, .roadmap-grid h2, .calibration-grid h2 {
  margin: 0;
  letter-spacing: -0.045em;
  line-height: 1.02;
}
.hero h1 { font-size: clamp(2.4rem, 6vw, 5rem); max-width: 950px; }
.lead { margin: 22px 0 0; font-size: 1.18rem; color: rgba(255,255,255,0.82); max-width: 760px; }
.hero-actions, .tool-actions, .inline-actions, .profile-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-actions { margin-top: 30px; }
.hero-note { margin-top: 22px; color: rgba(255,255,255,0.68); max-width: 780px; }
.hero-card { display: flex; justify-content: center; }
.summary-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: 0 22px 60px rgba(0,0,0,0.25);
}
.summary-title { font-weight: 800; font-size: 1.1rem; margin-bottom: 18px; }
.summary-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.12); gap: 20px; }
.summary-row span { color: rgba(255,255,255,0.74); }
.summary-row strong { text-align: right; }
.mini-bars { display: grid; gap: 8px; margin-top: 24px; }
.mini-bars span { display: block; height: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #ffe2a3); }

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--brand); color: #15120a; box-shadow: 0 10px 24px rgba(245,165,36,0.25); }
.button-primary:hover { background: #ffc45b; }
.button-secondary { background: #e8eef6; color: var(--accent); }
.button-secondary:hover { background: #dce7f3; }
.button-danger { background: #fde7e4; color: var(--danger); }
.button-danger:hover { background: #fbd2cd; }
.button-small { padding: 9px 13px; font-size: 0.9rem; }
.compact { margin-top: 14px; }

.section { padding: 72px 0; }
.section-muted { background: #edf3f9; }
.trust-strip { padding: 26px 0; background: #fff; border-bottom: 1px solid var(--line); }
.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.trust-grid div { padding: 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-md); }
.trust-grid strong { display: block; margin-bottom: 4px; }
.trust-grid span { display: block; color: var(--muted); font-size: 0.92rem; }
.section-heading { margin-bottom: 28px; max-width: 850px; }
.section-heading h2, .roadmap-grid h2, .calibration-grid h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
.section-heading p, .roadmap-grid p, .calibration-grid p { color: var(--muted); font-size: 1.04rem; }

.tool-card, .profile-card, .result-card {
  background: var(--panel);
  border: 1px solid rgba(216,224,234,0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 26px;
}
.subsection-title { margin: 8px 0 16px; padding-top: 8px; }
.subsection-title:not(:first-child) { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 24px; }
.subsection-title h3, .cut-list-heading h3 { margin: 0; font-size: 1.18rem; }
.subsection-title p, .cut-list-heading p, .small-note { margin: 6px 0 0; color: var(--muted); font-size: 0.93rem; }
.form-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; }
.field span { font-weight: 800; font-size: 0.92rem; color: #25324a; }
.field small { color: var(--muted); line-height: 1.35; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(245,165,36,0.18); }
.advanced-panel {
  margin: 20px 0;
  border: 1px solid var(--line);
  background: #f9fbfe;
  border-radius: var(--radius-md);
  padding: 16px;
}
.advanced-panel summary { cursor: pointer; font-weight: 900; }
.advanced-panel .form-grid { margin-top: 16px; margin-bottom: 0; }
.cut-list-wrap, .notes-wrap { margin-top: 26px; }
.cut-list-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.cut-table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #f2f6fb; color: #33445f; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.04em; }
td { background: #fff; }
.cut-table tr:last-child td { border-bottom: 0; }
.remove-row { border: 0; color: var(--danger); background: transparent; font-weight: 800; cursor: pointer; }
.tool-actions { margin-top: 24px; }
code { background: #eef3f8; border: 1px solid var(--line); padding: 2px 5px; border-radius: 6px; }

.results-grid { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 28px; scroll-margin-top: 90px; }
.result-card h2 { margin: 0 0 16px; letter-spacing: -0.035em; font-size: clamp(1.8rem, 3vw, 2.8rem); }
.result-card h3 { margin: 0 0 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 15px; }
.metric span { display: block; color: var(--muted); font-size: 0.86rem; margin-bottom: 5px; }
.metric strong { display: block; font-size: 1.25rem; line-height: 1.1; }
.warning-box, .success-box, .info-box {
  margin-top: 18px;
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.warning-box { background: #fff7e5; border: 1px solid #f5d28b; color: #6b4300; }
.success-box { background: #e8f7ef; border: 1px solid #a9dfbf; color: #145c38; }
.info-box { background: #eaf2fb; border: 1px solid #bdd4ec; color: #24415f; }
.piece-list { color: var(--muted); margin: 10px 0 0; }
.plan-list { display: grid; gap: 14px; }
.bar-plan { background: #f9fbfe; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; break-inside: avoid; }
.bar-plan-title { display: flex; justify-content: space-between; gap: 12px; font-weight: 900; margin-bottom: 10px; }
.bar-visual { display: flex; width: 100%; height: 28px; border-radius: 999px; overflow: hidden; background: #e2e9f2; border: 1px solid #cbd7e6; }
.segment { display: block; min-width: 4px; background: linear-gradient(90deg, var(--brand), #ffcf75); border-right: 1px solid rgba(0,0,0,0.12); }
.segment.offcut { background: repeating-linear-gradient(45deg, #d8e0ea, #d8e0ea 6px, #c8d3e1 6px, #c8d3e1 12px); }
.bar-pieces { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid var(--line); padding: 7px 9px; border-radius: 999px; font-size: 0.88rem; }
.table-mini { width: 100%; border-collapse: collapse; margin-top: 12px; }
.table-mini th, .table-mini td { padding: 9px; font-size: 0.92rem; }
.table-mini th { background: #eef3f8; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.profile-actions { align-self: end; }
.roadmap-grid, .calibration-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr); gap: 38px; align-items: start; }
.roadmap-list { display: grid; gap: 14px; }
.roadmap-list article { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; display: grid; gap: 6px; box-shadow: 0 10px 30px rgba(13, 24, 38, 0.06); }
.roadmap-list strong { color: var(--brand-dark); }
.roadmap-list span { color: var(--muted); }
.calibration-result { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }

.site-footer { background: var(--bg); color: #fff; padding: 34px 0; }
.footer-grid { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.footer-grid p { margin: 6px 0 0; color: rgba(255,255,255,0.68); }
.footer-note { max-width: 600px; text-align: right; }

.modal-card {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 90px rgba(0,0,0,0.3);
  padding: 0;
  width: min(720px, calc(100vw - 32px));
}
.modal-card::backdrop { background: rgba(8, 12, 18, 0.62); }
.modal-card form { padding: 24px; }
.modal-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.modal-heading h3 { margin: 0; }
.modal-heading button { border: 0; background: transparent; font-size: 2rem; line-height: 1; cursor: pointer; }
#csvPaste { margin-top: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

@media (max-width: 980px) {
  .hero-grid, .roadmap-grid, .calibration-grid { grid-template-columns: 1fr; }
  .form-grid.four, .trust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-wrap { align-items: flex-start; flex-direction: column; padding: 14px 0; }
  .nav-links { gap: 10px 14px; }
  .hero { padding: 58px 0 46px; }
  .form-grid.three, .form-grid.four, .trust-grid, .metric-grid { grid-template-columns: 1fr; }
  .cut-list-heading, .footer-grid { flex-direction: column; align-items: flex-start; }
  .footer-note { text-align: left; }
  .tool-card, .profile-card, .result-card { padding: 18px; }
}

@media print {
  body { background: #fff; }
  .site-header, .hero, .trust-strip, #profiles, #saved-jobs, #calibration, #roadmap, .site-footer, .tool-card, .section-heading, .tool-actions { display: none !important; }
  .section { padding: 0; }
  .container { width: 100%; }
  #results { display: grid !important; margin: 0; }
  .result-card { box-shadow: none; border: 1px solid #999; page-break-inside: avoid; }
  .bar-plan { page-break-inside: avoid; }
}

/* v0.3 quick modes and clutter controls */
.mode-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: #e8eef6;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 0 0 18px;
}
.mode-tab {
  border: 0;
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 900;
  cursor: pointer;
  color: var(--accent);
  background: transparent;
}
.mode-tab.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 8px 22px rgba(13, 24, 38, 0.09);
}
.quick-panel { margin-bottom: 22px; }
.quick-heading, .full-planner-intro {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.quick-heading h3, .full-planner-intro h3 { margin: 0; font-size: 1.28rem; }
.quick-heading p, .full-planner-intro p { margin: 6px 0 0; color: var(--muted); }
.mode-badge {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 11px;
  background: #fff7e5;
  border: 1px solid #f5d28b;
  color: #7a4d00;
  font-size: 0.84rem;
  font-weight: 900;
}
.full-planner-intro { margin-bottom: 14px; }
.section-switches {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(480px, 100%);
}
.section-switches label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.9rem;
  font-weight: 800;
  color: #31415c;
}
.section-switches input { width: auto; }
.optional-block {
  transition: opacity 0.16s ease, filter 0.16s ease, background 0.16s ease;
}
.optional-block.is-muted {
  opacity: 0.42;
  filter: grayscale(0.45);
  pointer-events: none;
  user-select: none;
}
.small-subsection { margin-top: 20px !important; }
.slim-panel { margin-top: 4px; }
.quick-result-note { margin-bottom: 18px; }

@media (max-width: 720px) {
  .mode-switch { width: 100%; border-radius: var(--radius-md); }
  .mode-tab { flex: 1 1 100%; }
  .quick-heading, .full-planner-intro { flex-direction: column; }
  .section-switches { justify-content: flex-start; min-width: 0; }
}


/* v0.4 branding and timing transparency */
.brand-logo-wrap {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(13, 107, 255, 0.22);
}
.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.hero-brand-card {
  flex-direction: column;
  gap: 18px;
}
.hero-banner-img {
  width: min(520px, 100%);
  border-radius: 24px;
  display: block;
  box-shadow: 0 24px 70px rgba(0,0,0,0.32);
  border: 1px solid rgba(255,255,255,0.16);
}
.compact-summary {
  width: min(520px, 100%);
}
.assumption-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.assumption-strip span {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 800;
}
@media (max-width: 760px) {
  .brand-logo-wrap { width: 42px; height: 42px; }
  .brand-logo { width: 34px; height: 34px; object-fit: contain; }
  .hero-banner-img { border-radius: 16px; }
}
