/* ProductForge. Copied from wireframe/style.css:
   gray-50 canvas, white left sidebar, white bordered cards, indigo accents. */
:root {
  --bg: #f9fafb; --card: #fff; --border: #e5e7eb; --border-2: #f3f4f6;
  --text: #111827; --text-2: #374151; --muted: #6b7280; --faint: #6b7280;
  --indigo: #4f46e5; --indigo-600: #4f46e5; --indigo-700: #4338ca; --indigo-50: #eef2ff; --indigo-100: #e0e7ff; --indigo-800: #3730a3;
  --amber: #f59e0b; --amber-bg: #fef3c7; --amber-text: #92400e;
  --green-bg: #dcfce7; --green-text: #166534; --red-bg: #fee2e2; --red-text: #991b1b; --blue-bg: #dbeafe; --blue-text: #1e40af;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
#app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
h1 { font-size: 24px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
h2 { font-size: 14px; font-weight: 600; margin: 0; }
h3, h2.h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
p { margin: 0 0 6px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .strong { font-weight: 600; } .block { display: block; }
.red { color: #b91c1c; } .flex1 { flex: 1; } .between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* Top bar */
.topbar { height: 48px; flex-shrink: 0; background: #111827; color: #f9fafb; display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; }
.logo { width: 24px; height: 24px; border-radius: 6px; background: var(--indigo); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.ws { color: #d1d5db; font-size: 13px; }
.sep { width: 1px; height: 20px; background: #374151; }
.topbar .muted { color: #9ca3af; }
.topbar .select { background-color: #1f2937; color: #f9fafb; border-color: #374151; }
.search { width: 300px; background: #1f2937; border: 1px solid #374151; color: #f9fafb; border-radius: 6px; padding: 5px 10px; font-size: 13px; }
.wf-tag { font-size: 10px; letter-spacing: .1em; padding: 2px 6px; border: 1px dashed #6b7280; border-radius: 4px; color: #9ca3af; }

/* Layout */
.body { flex: 1; display: flex; overflow: hidden; }
.sidebar { width: 224px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border); overflow-y: auto; }
.nav-sec { padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
.nav-sec ul { list-style: none; margin: 0; padding: 0; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 4px 8px; border-radius: 4px; color: var(--text-2); text-decoration: none; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--indigo-50); color: var(--indigo-700); font-weight: 500; }
.nav-count { background: var(--indigo); color: #fff; border-radius: 9999px; font-size: 11px; padding: 0 6px; }
.main { flex: 1; overflow-y: auto; padding: 24px; }
.content { max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; }
.spec { font-size: 11px; font-weight: 400; color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* Cards, grids */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.04); padding: 16px; margin-bottom: 16px; }
.card-title { margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-side { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; } .grid-2, .grid-3 { margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.kpi-warn { border-color: #fcd34d; background: #fffbeb; }
.kpi-label { font-size: 12px; color: var(--muted); margin: 0; } .kpi-value { font-size: 26px; font-weight: 600; margin: 2px 0; }
.list { list-style: none; margin: 0; padding: 0; } .list li { padding: 6px 0; border-top: 1px solid var(--border-2); } .list li:first-child { border-top: 0; }
.olist { margin: 0; padding-left: 20px; } .olist li { margin: 6px 0; }
.alert-row { display: flex; gap: 8px; }
.dot-amber { color: var(--amber); } .dot-green { color: #22c55e; } .dot-gray { color: var(--faint); }
.link { color: var(--indigo); text-decoration: none; } .link:hover { text-decoration: underline; }
.link-plain { color: var(--text-2); text-decoration: none; } .link-plain:hover { color: var(--indigo-700); }

/* Controls */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; font: 500 13px/1.3 inherit; border-radius: 6px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.btn-primary { background: var(--indigo-600); color: #fff; } .btn-primary:hover { background: var(--indigo-700); }
.btn-secondary { background: #fff; color: var(--text-2); border-color: #d1d5db; } .btn-secondary:hover { background: var(--bg); }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fecaca; } .btn-danger:hover { background: #fef2f2; }
.btn-link { background: none; color: var(--indigo); padding: 2px 4px; } .btn-link:hover { text-decoration: underline; }
.select, .input, textarea { font: inherit; font-size: 13px; border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 8px; background: #fff; color: var(--text); }
textarea, .input { width: 100%; margin-bottom: 10px; }
.label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin: 6px 0 4px; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; } .actions.wrap { flex-wrap: wrap; }

/* Chips, badges */
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; align-items: center; }
.chip { display: inline-flex; align-items: center; background: #f3f4f6; color: var(--text-2); border-radius: 9999px; padding: 1px 8px; font-size: 12px; white-space: nowrap; }
.chip-green { background: var(--green-bg); color: var(--green-text); } .chip-red { background: var(--red-bg); color: var(--red-text); }
.chip-amber { background: var(--amber-bg); color: var(--amber-text); } .chip-blue { background: var(--blue-bg); color: var(--blue-text); }
.score { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9999px; font-size: 12px; font-weight: 600; border: 3px solid; flex-shrink: 0; }
.score-good { border-color: #22c55e; color: var(--green-text); } .score-mid { border-color: var(--amber); color: var(--amber-text); } .score-low { border-color: #ef4444; color: var(--red-text); }

/* Coaching */
.coach { display: flex; gap: 10px; background: #f5f7ff; border: 1px solid var(--indigo-100); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13px; color: var(--text-2); }
.coach-icon { color: var(--indigo); font-size: 14px; } .coach-actions { margin-top: 4px; }
.coach-suggestion { background: #fff; border: 1px solid var(--indigo-100); border-radius: 6px; padding: 8px 10px; margin-top: 6px; }
.coach-suggestion p { margin: 2px 0; }
.coach-mini { font-size: 12px; color: var(--indigo-700); margin: 4px 0 0; }
.banner { background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 13px; color: var(--text-2); margin-bottom: 16px; }

/* Tables */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.card .table-wrap { border: 0; border-radius: 0; margin: 0; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg); text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 14px; }
td { padding: 9px 14px; border-top: 1px solid var(--border-2); vertical-align: top; color: var(--text-2); }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--bg); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); } .tab.active { color: var(--indigo-700); border-bottom-color: var(--indigo); font-weight: 500; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }
.kanban-5 { grid-template-columns: repeat(5, 1fr); }
.kanban:not(.kanban-5) { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kcol { background: #f3f4f6; border-radius: 8px; padding: 8px; min-height: 240px; }
.kcol-head { display: flex; justify-content: space-between; padding: 2px 4px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #4b5563; }
.kcard { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcard:hover { border-color: #a5b4fc; }
.kcard-title { font-weight: 500; margin-bottom: 4px; }

/* Bars */
.bar { flex: 1; height: 8px; border-radius: 9999px; background: var(--indigo-50); overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--indigo); border-radius: 9999px; }
.bar > span.plan { background: #d1d5db; } .bar > span.warn { background: var(--amber); } .bar > span.good { background: #22c55e; }
.alloc { padding: 10px 0; border-top: 1px solid var(--border-2); } .alloc:first-child { border-top: 0; }
.alloc-label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.alloc-bars .row { display: flex; align-items: center; gap: 10px; margin: 3px 0; } .alloc-bars .row span:last-child { width: 80px; }
.outcome { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.outcome-top { border-bottom: 1px solid var(--border-2); }
.outcome-bar { display: flex; align-items: center; gap: 10px; width: 300px; }
.children { padding-left: 24px; border-left: 2px solid var(--indigo-100); margin-left: 6px; }
.vbars { display: flex; gap: 24px; align-items: flex-end; height: 170px; padding: 10px 0; }
.vbar { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vbar-fill { width: 40px; background: var(--indigo); border-radius: 4px 4px 0 0; }

/* Insights */
.legend { margin-bottom: 12px; }
.toolbar { position: sticky; top: -24px; z-index: 5; display: flex; gap: 8px; align-items: center; background: var(--indigo-50); border: 1px solid var(--indigo-100); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.group { margin-bottom: 20px; }
.group-head { display: flex; align-items: baseline; gap: 10px; } .group-head h3, .group-head .h3 { margin: 0 0 8px; }
.icard { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.icard.selected { border-color: var(--indigo); background: #fafaff; }
.icard input { margin-top: 4px; }
.icard-main { flex: 1; cursor: pointer; } .icard-main:hover .icard-title { color: var(--indigo-700); }
.icard-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.star { background: none; border: 0; font-size: 18px; line-height: 1; color: var(--faint); cursor: pointer; padding: 0; }
.star.on { color: var(--amber); }
.evidence { list-style: none; padding: 0; margin: 0; } .evidence li { padding: 8px 0; border-top: 1px solid var(--border-2); }
.quote { border-left: 3px solid var(--indigo-100); padding-left: 10px; margin: 4px 0 0; color: var(--text-2); }
.log { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.log li { display: flex; flex-direction: column; padding: 6px 0 6px 12px; border-left: 2px solid var(--border); }
.cust-row { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; } .cust-row:hover .strong { color: var(--indigo-700); }
.diff { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.diff-plus { color: #16a34a; font-weight: 700; }

/* Misc */
.conn { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.dropzone { border: 2px dashed #c7d2fe; border-radius: 8px; padding: 32px; text-align: center; background: #fafaff; cursor: pointer; margin-bottom: 16px; }
.template { white-space: pre-wrap; font: 12px/1.5 ui-monospace, Menlo, monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.pb-sec { margin-bottom: 12px; } .pb-sec ul { list-style: none; padding: 0; margin: 0; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay-drawer { justify-content: flex-end; padding: 0; }
.modal { background: #fff; border-radius: 10px; box-shadow: 0 20px 40px rgba(0,0,0,.2); width: 100%; max-width: 680px; max-height: 88vh; display: flex; flex-direction: column; }
.modal-head, .drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2, .drawer-head h2 { font-size: 17px; }
.modal-body { padding: 16px 20px; overflow-y: auto; } .modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer { background: #fff; height: 100%; width: min(66vw, 900px); min-width: min(100vw, 560px); display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.15); }
.drawer-body { padding: 16px 24px; overflow-y: auto; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--faint); cursor: pointer; } .x:hover { color: var(--text); }
.toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 100; box-shadow: 0 6px 18px rgba(0,0,0,.2); max-width: 560px; }
.fb-btn { position: fixed; right: 20px; bottom: 20px; z-index: 40; background: #fff; border: 1px solid #d1d5db; border-radius: 9999px; padding: 8px 14px; font: 500 13px inherit; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.fb-btn:hover { border-color: var(--indigo); color: var(--indigo-700); }
a.kpi { display: block; text-decoration: none; color: inherit; cursor: pointer; }
a.kpi:hover { border-color: #a5b4fc; box-shadow: 0 2px 6px rgba(79,70,229,.12); }
.num { font-size: 11px; font-weight: 500; color: var(--faint); margin-right: 6px; font-variant-numeric: tabular-nums; }
.alloc-total { border-top: 2px solid var(--border); }
td:first-child .muted { white-space: nowrap; }
.ring-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.ring-label { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.select-quiet { border-color: transparent; background-color: transparent; color: var(--muted); font-size: 12px; }
.select-quiet:hover { border-color: #d1d5db; }
/* Dropdowns: custom caret with breathing room on the right */
select.select { -webkit-appearance: none; appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.card.highlight { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--indigo-100); }

.setup { columns: 2; margin: 4px 0 0; padding-left: 20px; } .setup li { margin: 4px 0; break-inside: avoid; } .setup li.done { list-style: none; margin-left: -16px; }
.list li.indent { padding-left: 16px; }
@media print { .sidebar, .topbar, .page-head .actions, .scope-bar { display: none !important; } .main, .content { margin: 0; padding: 0; } .card { break-inside: avoid; box-shadow: none; } }
.btn-block { display: block; text-align: center; margin-top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
