/* FyeLabs Proposal Engine — compact, professional, subtle.
 * Density: 14px base, 8px grid. No shadows, no gradients. Hairlines only.
 * Typography: Plus Jakarta Sans (UI) + Helvetica/Arial (document editor).
 */

:root {
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-doc: Arial, "Liberation Sans", "Helvetica Neue", Helvetica, Arimo, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f1;
  --ink: #0f1419;
  --ink-soft: #2a2f37;
  --muted: #57606a;
  --muted-2: #8b929c;
  --border: #e3e6ea;
  --border-strong: #c8ccd2;
  --accent: #1f6feb;
  --accent-hover: #1958c4;
  --accent-soft: #e8f0fe;
  --success: #1a7f37;
  --danger: #cf222e;
  --radius: 4px;
  --radius-lg: 6px;
  --gap: 8px;
  --max: 1564px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131722;
    --surface: #1c2230;
    --surface-2: #262e40;
    --ink: #e6e9ef;
    --ink-soft: #c4c9d2;
    --muted: #8b929c;
    --muted-2: #6a7280;
    --border: #2d3548;
    --border-strong: #3a435a;
    --accent: #4f8af0;
    --accent-hover: #6fa1f3;
    --accent-soft: #16243a;
    --success: #4ac26b;
    --danger: #f15863;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: -0.011em;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

code, kbd, pre, .mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---- Topbar ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 48px;
  display: flex;
  align-items: center;
}
.topbar-inner {
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.022em;
}
.brand:hover { text-decoration: none; }
.brand-mark { font-weight: 700; }
.brand-sub {
  font-family: var(--font-mono), monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.008em;
}
.nav a { color: var(--ink-soft); }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav-user {
  font-family: var(--font-mono), monospace;
  color: var(--muted);
  font-size: 12px;
}
.nav-logout { display: inline; margin: 0; }

/* ---- Layout ---- */
.main {
  max-width: var(--max);
  margin: 24px auto 64px;
  padding: 0 16px;
}
.footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---- Cards / panels ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.card + .card { margin-top: 16px; }
.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.018em;
}

/* ---- Collapsible detail sections ---- */
details.section { padding: 0; overflow: hidden; }
details.section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  user-select: none;
}
details.section > summary::-webkit-details-marker { display: none; }
.section-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.section-chev {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1;
  transition: transform 0.15s ease;
  flex: none;
}
details.section[open] > summary .section-chev { transform: rotate(90deg); }
.section-title { font-size: 15px; font-weight: 700; letter-spacing: -0.016em; }
.section-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.section-hint { color: var(--muted); font-size: 12px; }
details.section > summary:hover .section-title { color: var(--accent); }
details.section[open] > summary { border-bottom: 1px solid var(--border); }
.section-body { padding: 16px; }

/* Compact meta dl on the overview page */
.meta-row { margin: 0; }

/* ---- Pipeline: Overview/home step ---- */
.pipeline-step.home .pipeline-dot { color: var(--muted); border-color: var(--border-strong); }
.pipeline-step.home .pipeline-label { color: var(--ink); }
a.pipeline-step.home:hover .pipeline-dot { color: var(--accent); }

/* Proposal list: clickable title cell */
a.row-link { color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
a.row-link:hover { color: var(--accent); text-decoration: underline; }

/* ---- Page header ---- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.page-head h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.028em;
  margin: 0;
  line-height: 1.15;
}
.page-head .sub {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 4px;
  letter-spacing: -0.006em;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  height: 30px;
  cursor: pointer;
  transition: background-color 0.08s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { height: 26px; padding: 4px 10px; font-size: 12px; }

/* ---- Forms ---- */
form .field { margin-bottom: 14px; }
form label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}
form input[type=text],
form input[type=email],
form input[type=password],
form select,
form textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.008em;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.45;
}
form input:focus, form select:focus, form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
form textarea {
  font-family: var(--font-mono), monospace;
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
form ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 4px;
}
form ul li label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: -0.006em;
  margin-bottom: 0;
  cursor: pointer;
}
form .errorlist {
  color: var(--danger);
  font-size: 12px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ---- Tables ---- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
}
.table tbody tr:hover { background: var(--surface-2); }
.table .col-mono { font-family: var(--font-mono), monospace; font-size: 12px; color: var(--ink-soft); }

/* ---- Tags / chips ---- */
.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--border);
  font-family: var(--font-mono), monospace;
  text-transform: lowercase;
}
.tag-accent { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

/* ---- Pipeline tracker ----
 * Horizontal 7-stage progress bar shown on the proposal detail page and on
 * every wizard step. Stages link directly to their editor when available;
 * future-phase stages render as locked.
 */
.pipeline {
  display: flex;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.pipeline-step {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  text-decoration: none;
  color: inherit;
  min-width: 84px;
  padding: 0 4px;
}
.pipeline-step::after {
  content: '';
  position: absolute;
  top: 9px;
  left: calc(50% + 12px);
  right: calc(-50% + 12px);
  height: 1.5px;
  background: var(--border);
  z-index: 0;
}
.pipeline-step:last-child::after { display: none; }
.pipeline-step.done::after { background: var(--accent); }

.pipeline-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono), monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}
.pipeline-step.done .pipeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pipeline-step.current .pipeline-dot {
  border-color: var(--accent);
  border-width: 2px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pipeline-step.locked .pipeline-dot {
  background: var(--surface-2);
  border-style: dashed;
  color: var(--muted-2);
}
.pipeline-label {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}
.pipeline-step.done .pipeline-label,
.pipeline-step.current .pipeline-label { color: var(--ink); }
.pipeline-step.locked .pipeline-label { color: var(--muted-2); }

.pipeline-status {
  margin-top: 1px;
  font-size: 10px;
  font-family: var(--font-mono), monospace;
  color: var(--muted-2);
  text-align: center;
  text-transform: lowercase;
  letter-spacing: 0;
  white-space: nowrap;
}
.pipeline-step.done .pipeline-status { color: var(--success); }
.pipeline-step.current .pipeline-status { color: var(--accent); font-weight: 600; }

a.pipeline-step:hover { text-decoration: none; }
a.pipeline-step:hover .pipeline-label { color: var(--accent); }
a.pipeline-step:hover .pipeline-dot { border-color: var(--accent); }
div.pipeline-step.locked { cursor: not-allowed; }

/* ---- Empty state ---- */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty .empty-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

/* ---- Auth (login) ---- */
.auth-shell {
  max-width: 360px;
  margin: 64px auto;
}
.auth-shell h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.024em;
  margin: 0 0 4px;
}
.auth-shell .sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ---- Messages ---- */
.messages { margin-bottom: 16px; }
.msg {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 6px;
}
.msg-error { color: var(--danger); border-color: var(--danger); }
.msg-success { color: var(--success); border-color: var(--success); }

/* ---- Misc ---- */
.row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px 16px;
  align-items: baseline;
}
.row dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
}
.row dd { margin: 0; font-size: 13px; }
.callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.callout strong { color: var(--accent); }
.list-tight { padding-left: 18px; margin: 0; }
.list-tight li { margin-bottom: 4px; }

/* Deliverables wizard list */
.deliverables-list { list-style: none; padding-left: 0; }
.deliverables-list .deliverable { padding: 2px 0; display: flex; gap: 8px; align-items: baseline; }
.deliverables-list .deliverable.lvl-0::before { content: "•"; color: var(--muted); width: 12px; flex: 0 0 12px; }
.deliverables-list .deliverable.lvl-1 { padding-left: 22px; }
.deliverables-list .deliverable.lvl-1::before { content: "◦"; color: var(--muted-2); width: 12px; flex: 0 0 12px; }
.deliverables-list .deliverable.group .deliverable-text { font-weight: 500; }
.deliverables-list .deliverable.suggested .deliverable-text { color: var(--muted); }

/* Risks & dependencies list */
.risks-list { list-style: none; padding-left: 0; }
.risks-list .risk { padding: 6px 0; line-height: 1.5; }
.risks-list .risk + .risk { border-top: 1px dashed var(--muted-2); }
.risks-list .risk-title { color: var(--ink); }
.risks-list .risk.suggested .risk-title,
.risks-list .risk.suggested .risk-text { color: var(--muted); }

/* Design-standards exclusion list */
.exclusion-preamble { color: var(--ink-soft); margin: 8px 0 12px; }
.exclusions-list { list-style: none; padding-left: 0; }
.exclusions-list .exclusion { padding: 6px 0; line-height: 1.5; }
.exclusions-list .exclusion + .exclusion { border-top: 1px dashed var(--muted-2); }
.exclusions-list .exclusion-title { color: var(--ink); }
.exclusions-list .exclusion.suggested .exclusion-title,
.exclusions-list .exclusion.suggested .exclusion-text { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; line-height: 1.6; }
.badge-ghost { background: transparent; color: var(--muted); border: 1px solid var(--muted-2); }
.badge-ok { background: rgba(26, 127, 55, 0.12); color: var(--success); border: 1px solid rgba(26, 127, 55, 0.35); }
.badge-warn { background: rgba(218, 165, 32, 0.14); color: #9a6b00; border: 1px solid rgba(218, 165, 32, 0.5); }
.badge-bad { background: rgba(207, 34, 46, 0.12); color: var(--danger); border: 1px solid rgba(207, 34, 46, 0.4); }

@media (prefers-color-scheme: dark) {
  .badge-warn { color: #f5c451; border-color: rgba(245, 196, 81, 0.45); background: rgba(218, 165, 32, 0.10); }
}

/* ---- Danger button + bulk-delete toolbar ---- */
.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-danger:disabled:hover { background: var(--surface); color: var(--danger); border-color: var(--danger); }

.link-danger { color: var(--danger); font-size: 12px; }
.link-danger:hover { color: var(--danger); text-decoration: underline; }

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}
.bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.bulk-count { color: var(--muted); }
.bulk-toolbar .btn-danger { margin-left: auto; }

/* ---- Documents card ---- */
.docs-list { list-style: none; padding: 0; margin: 0 0 12px; }
.docs-list .doc {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.docs-list .doc:last-child { border-bottom: none; }
.docs-list .doc.doc-active {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0 -12px 6px;
  border-bottom: none;
}
.doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.doc-name {
  font-weight: 500;
  color: var(--ink);
  font-size: 13px;
}
.doc-name:hover { color: var(--accent); }
.doc-meta { font-size: 11px; }
.doc-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.doc-preview {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-family: var(--font-mono), monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 100px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.doc-error {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(207, 34, 46, 0.06);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 12px;
  border: 1px solid rgba(207, 34, 46, 0.2);
}
.doc-upload {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.doc-upload input[type=file] { width: auto; flex: 1; padding: 5px; }

.tag-mono { font-family: var(--font-mono), monospace; font-size: 10.5px; padding: 1px 6px; }

/* === Pricing wizard ===================================================== */
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
}
.pricing-table th,
.pricing-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.pricing-table th {
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.pricing-table th.num,
.pricing-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pricing-table tr.group-row td {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-strong);
}
.pricing-table tr.task-row.suggested .task-title { color: var(--muted); }
.pricing-table tr.task-row.suggested .task-desc { color: var(--muted-2); }
.pricing-table tr.task-row.excluded {
  background: var(--surface-2);
  opacity: 0.55;
}
.pricing-table tr.task-row.excluded .task-title,
.pricing-table tr.task-row.excluded .task-desc { text-decoration: line-through; }
.pricing-table .check-cell { padding-top: 12px; }
.pricing-table .task-title {
  font-weight: 500;
  color: var(--ink);
  font-size: 13px;
}
.pricing-table .task-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
  max-width: 600px;
}
/* Remove the native number spinner (up/down arrows) from pricing number
   fields — both the arrow keys and these buttons are unwanted here. */
.pricing-table input[type="number"]::-webkit-outer-spin-button,
.pricing-table input[type="number"]::-webkit-inner-spin-button,
.pricing-summary input[type="number"]::-webkit-outer-spin-button,
.pricing-summary input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pricing-table input[type="number"],
.pricing-summary input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.pricing-table .hrs-input {
  width: 72px;
  padding: 3px 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.pricing-table .hrs-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
.pricing-table .line-fee {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-size: 13px;
  padding-top: 12px;
}
.pricing-table tfoot tr.totals-row td {
  background: var(--surface-2);
  border-top: 2px solid var(--border-strong);
  border-bottom: none;
  padding-top: 10px;
  padding-bottom: 10px;
}
.pricing-table .subtotal-hint {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

/* Editable task grid (drag/insert/delete, editable titles & groups) */
.pricing-table.editable td { vertical-align: middle; padding-top: 3px; padding-bottom: 3px; }
.pricing-table.editable .line-fee { padding-top: 3px; }
/* Group header row: a slight (not strong) tint. */
.pricing-table.editable tr.group-row td {
  background: rgba(245, 166, 108, 0.12);
  border-bottom: 1px solid var(--border-strong);
}
/* Standalone task (its own row, no group): a slightly stronger tint, hinting
   the dark / bold standalone styling it gets in the rendered fee table. */
.pricing-table.editable tr.task-row.standalone td { background: rgba(245, 166, 108, 0.22); }
.pricing-table.editable tr.task-row.standalone .task-title-input { font-weight: 600; }
.pricing-table .drag-cell {
  cursor: grab;
  color: var(--muted);
  text-align: center;
  user-select: none;
  font-size: 14px;
  width: 22px;
}
.pricing-table .serial-cell { color: var(--muted); font-size: 12px; }
.pricing-table .task-title-input {
  width: 100%;
  min-width: 220px;
  padding: 3px 8px;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.pricing-table .task-title-input:focus,
.pricing-table .group-title-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pricing-table tr.group-row .group-title-input {
  width: 100%;
  min-width: 220px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
}
.pricing-table tr.group-row .group-title-input:hover { border-color: var(--border-strong); background: var(--surface); }
.pricing-table .row-actions { white-space: nowrap; text-align: right; }
.pricing-table .icon-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1;
  padding: 3px 6px;
  cursor: pointer;
  margin-left: 3px;
}
.pricing-table .icon-btn:hover { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.pricing-table tr.dragging { opacity: 0.45; }
.pricing-table tr.task-row[draggable="true"] .drag-cell:active { cursor: grabbing; }

.pricing-summary { margin-top: 16px; }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.pricing-grid .field-wide { grid-column: 1 / -1; }
.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-inline label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.field-inline input,
.field-inline select {
  padding: 6px 8px;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.field-inline input:focus,
.field-inline select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
/* The rate inputs sit beside the currency selector. */
.rate-pair {
  display: flex;
  gap: 8px;
  align-items: end;
}
.rate-pair > .field-inline { flex: 1; }
.rate-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.rate-note a { color: var(--accent); text-decoration: none; }
.rate-note a:hover { text-decoration: underline; }
.rate-card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#rc-defaults { color: var(--ink-soft); }
#rc-defaults.rc-overridden { color: var(--warn, #d98324); font-weight: 600; }
.fee-breakdown {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 24px;
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.fee-breakdown dt { color: var(--muted); }
.fee-breakdown dd { margin: 0; color: var(--ink-soft); text-align: right; }
.fee-breakdown dt.dt-total,
.fee-breakdown dd.dd-total {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  padding-top: 6px;
  border-top: 1px solid var(--border-strong);
  margin-top: 4px;
}
.ph { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.payment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.payment-table th, .payment-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.payment-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.payment-table th.num, .payment-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.payment-table input.sched-label {
  width: 100%;
  min-width: 180px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  padding: 4px 8px;
  font-size: 13px;
}
.payment-table input.sched-pct {
  width: 64px;
  text-align: right;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  padding: 4px 6px;
  font-size: 13px;
}
.payment-table select.sched-oop {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  padding: 4px 6px;
  font-size: 12.5px;
}
.payment-table tfoot td { border-top: 2px solid var(--border); border-bottom: none; }
.sched-actions { display: flex; gap: 8px; margin-top: 10px; }
.sched-warn { color: var(--warn, #d98324); font-size: 12.5px; font-weight: 600; }

.badge.badge-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  text-transform: lowercase;
}

/* === SOW wizard ========================================================= */
.sow-group h2 {
  margin-top: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-strong);
}
.sow-task {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.sow-task:last-child { border-bottom: none; padding-bottom: 0; }
.sow-task-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.sow-task-num {
  font-family: var(--font-mono), monospace;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  min-width: 56px;
}
.sow-task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.sow-task-tag {
  font-size: 10.5px;
  color: var(--muted-2);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-left: auto;
}
.sow-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.sow-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  overflow: hidden;
}
.sow-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* === Schedule / Gantt wizard =========================================== */

/* ---- Row-height constants (shared between left and right panels) ---- */
:root {
  --row-hdr:  52px;   /* column header row — two text lines (date + week) */
  --row-grp:  28px;   /* section group heading row */
  --row-task: 34px;   /* task data row */
  --gantt-col-w: 28px; /* week column width — overridden by JS zoom */
}

/* ---- Top toolbar ---- */
.sched-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 0;
}
.sched-toolbar-left {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.sched-toolbar-left .field-inline { flex: 0 0 auto; min-width: 140px; }
.sched-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sched-zoom-label { white-space: nowrap; }
#zoom-slider { width: 130px; cursor: pointer; }
.sched-zoom-tag {
  min-width: 52px;
  text-align: left;
  font-family: var(--font-mono), monospace;
  font-size: 11px;
  color: var(--muted);
}

/* ---- §5 boilerplate card ---- */
.sched-boilerplate {
  padding: 10px 14px;
  line-height: 1.55;
  margin-bottom: 0;
}

/* ---- Two-panel shell ---- */
.gantt-shell {
  display: flex;
  width: 100%;
  border-top: 1px solid var(--border);
}

/* ---- Left panel (frozen metadata columns) ---- */
.gantt-left {
  flex: 0 0 auto;
  width: 468px;     /* 32+180+52+52+52+80+borders */
  border-right: 2px solid var(--border-strong);
  background: var(--surface);
  /* sits above right panel in z-order so shadow shows if we ever add one */
  position: relative;
  z-index: 2;
}

/* Generic left row */
.gantt-lrow {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.gantt-lrow--hdr {
  height: var(--row-hdr);
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--muted);
}
.gantt-lrow--grp {
  height: var(--row-grp);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.gantt-lrow--task {
  height: var(--row-task);
  background: var(--surface);
}
.gantt-lrow--task:hover { background: var(--accent-soft); }

/* Left column cells */
.glc {
  flex: 0 0 auto;
  padding: 0 6px;
  overflow: hidden;
  white-space: nowrap;
}
.glc-num   { width: 32px; text-align: center; font-family: var(--font-mono), monospace; font-size: 11px; color: var(--muted-2); }
.glc-name  { width: 180px; font-size: 12.5px; color: var(--ink); text-overflow: ellipsis; font-weight: 500; }
.glc-dur   { width: 52px; }
.glc-start { width: 52px; }
.glc-end   { width: 52px; }
.glc-preds { width: 80px; }
.glc-grp-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-left: 12px;
}

/* Compact inputs inside the left panel */
.gi {
  width: 100%;
  padding: 2px 5px;
  font-size: 12px;
  font-family: var(--font-mono), monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  height: 24px;
}
.gi:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.gi-preds {
  text-align: left;
  font-size: 11.5px;
  width: 68px;
}

/* ---- Right panel (scrollable bar area) ---- */
.gantt-right {
  flex: 1 1 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
}

/* Generic right row — each row is a flex container of week cells */
.gantt-rrow {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.gantt-rrow--hdr {
  height: var(--row-hdr);
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  position: sticky;
  top: 0;
  z-index: 1;
}
.gantt-rrow--grp {
  height: var(--row-grp);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.gantt-rrow--task {
  height: var(--row-task);
  position: relative;   /* bar is absolute within this */
}

/* Week guide cells — one per week, set width by JS via CSS var */
.gantt-wcell {
  flex: 0 0 var(--gantt-col-w);
  height: 100%;
  font-family: var(--font-mono), monospace;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  border-right: 1px solid transparent;
  box-sizing: border-box;
}
/* Time header cells: two stacked lines */
.gantt-rrow--hdr .gantt-wcell {
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 4px;
  gap: 1px;
}
.hd-date {
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.2;
  min-height: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.hd-wk {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
  font-family: var(--font-mono), monospace;
}
/* Alternating shading on task rows only */
.gantt-rrow--task .gantt-wcell--even {
  background: rgba(0,0,0,0.025);
}
@media (prefers-color-scheme: dark) {
  .gantt-rrow--task .gantt-wcell--even { background: rgba(255,255,255,0.03); }
}

/* ---- Gantt bar (absolutely positioned inside .gantt-rrow--task) ---- */
.gantt-bar {
  position: absolute;
  top: 6px;
  height: 22px;
  /* left and width set by JS */
  background: var(--accent);
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  min-width: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  cursor: grab;
  transition: background-color 0.08s;
  z-index: 1;
  pointer-events: auto;
  user-select: none;
}
.gantt-bar:hover { background: var(--accent-hover); }
.gantt-bar--locked {
  cursor: default;
}
.gantt-bar--locked .gantt-bar-handle { display: none; }
.gantt-bar--moving {
  cursor: grabbing;
  opacity: 0.92;
  z-index: 3;
}
.gantt-bar-lbl {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono), monospace;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  pointer-events: none;
}
.gantt-bar-handle {
  position: absolute;
  top: 0;
  width: 8px;
  height: 100%;
  z-index: 2;
  cursor: ew-resize;
}
.gantt-bar-handle--left {
  left: 0;
  border-radius: 3px 0 0 3px;
}
.gantt-bar-handle--right {
  right: 0;
  border-radius: 0 3px 3px 0;
}
.gantt-bar-handle:hover,
.gantt-bar-handle:active {
  background: rgba(255, 255, 255, 0.28);
}
body.gantt-resizing,
body.gantt-moving {
  user-select: none;
}
body.gantt-resizing {
  cursor: ew-resize;
}
body.gantt-moving {
  cursor: grabbing;
}
body.gantt-resizing .gantt-bar,
body.gantt-moving .gantt-bar {
  transition: none;
}

@media (prefers-color-scheme: dark) {
  .gantt-bar { box-shadow: 0 1px 3px rgba(0,0,0,0.5); }
}

/* The "Resources required" line — FyeLabs blue, mirrors the SOW
   blue paragraph style in every 2026 proposal. */
.sow-resources {
  margin-top: 6px;
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}
.sow-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---- AI busy overlay (LLM wizard steps) ---- */
body.ai-busy-active {
  overflow: hidden;
}
.ai-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(4px);
}
.ai-busy-overlay[hidden] {
  display: none !important;
}
.ai-busy-card {
  width: min(480px, 100%);
  padding: 28px 26px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
.ai-busy-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-busy-spin 0.85s linear infinite;
}
@keyframes ai-busy-spin {
  to { transform: rotate(360deg); }
}
.ai-busy-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ai-busy-detail {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.ai-busy-tip {
  margin: 0 0 10px;
  min-height: 2.8em;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  transition: opacity 0.25s ease;
}
.ai-busy-foot {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted-2);
}
.ai-prepare-shell {
  margin-top: 0;
}

/* ---- Proposals list: search / filter ---- */
.list-filters {
  margin-bottom: 16px;
  padding: 14px 16px 12px;
}
.list-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.list-filters-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.list-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px 14px;
}
.list-filters .field { margin-bottom: 0; }
.list-filters .field label {
  font-size: 10.5px;
  margin-bottom: 3px;
}
.list-filters input,
.list-filters select {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink);
}
.list-filters input:focus,
.list-filters select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.list-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.filter-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}
.list-filters-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.list-table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table-proposals { font-size: 12.5px; }
.table-proposals .col-title {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-proposals .col-user { font-weight: 600; color: var(--ink-soft); }
.table-proposals .col-value .mono { font-size: 11.5px; }
.table-proposals .col-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.table-proposals .col-updated { color: var(--muted); font-size: 12px; white-space: nowrap; }
.table-proposals .col-actions { text-align: right; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.muted-dash { color: var(--muted-2); }

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}
.list-page-info {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* ---- Settings ---- */
.settings-grid {
  display: grid;
  gap: 16px;
}
.settings-card h2 { margin-bottom: 6px; }
.settings-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
  line-height: 1.45;
}
.settings-subhead {
  font-size: 13px;
  font-weight: 700;
  margin: 18px 0 8px;
  letter-spacing: -0.01em;
}
.settings-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-bottom: 14px;
}
.settings-inline-row .field { flex: 0 1 200px; margin-bottom: 0; }
.settings-rates-table input[type="text"],
.settings-rates-table input[type="number"] {
  width: 100%;
  max-width: 120px;
  padding: 5px 8px;
  font-size: 13px;
}
.settings-rates-table td:first-child + td input { max-width: 180px; }
.settings-rates-table td:nth-child(3) input { max-width: 64px; }
.settings-meta { margin-bottom: 14px; }
.settings-upload-form .field input[type="file"] {
  font-size: 13px;
}
.settings-archive-table { font-size: 12px; margin-top: 8px; }

/* ---- LLM cost badge ---- */
.page-head-trailing {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.llm-cost-badge {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: default;
  user-select: none;
}
.llm-cost-badge--zero .llm-cost-amount { color: var(--muted-2); }
.llm-cost-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.llm-cost-amount {
  font-family: var(--font-mono), monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.llm-cost-breakdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 12px;
}
.llm-cost-badge:hover .llm-cost-breakdown,
.llm-cost-badge:focus-within .llm-cost-breakdown {
  display: block;
}
.llm-cost-breakdown-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.llm-cost-breakdown-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 11.5px;
}
.llm-cost-breakdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.llm-cost-breakdown-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.llm-cost-breakdown-list li:last-child { border-bottom: 0; }
.llm-cost-breakdown-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-strong);
  font-weight: 700;
}
.table-proposals .col-llm-cost .mono { font-size: 11.5px; color: var(--accent); }
