/* components.css — shared building blocks. View CSS must reuse these instead of re-inventing them. */

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: var(--r-pill); padding: 10px 16px; font: 700 13.5px var(--sans); white-space: nowrap; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast); color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--red); color: #fff; box-shadow: var(--glow-red); }
.btn-primary:hover { background: var(--red-d); }
.btn-brand { background: var(--brand); color: #fff; box-shadow: var(--glow-brand); }
.btn-brand:hover { background: var(--brand-d); }
.btn-ghost { background: var(--surface); border: 1.5px solid var(--line2); color: var(--ink); padding: 8.5px 15px; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-text { background: transparent; color: var(--red); padding: 6px 4px; font-weight: 700; }
.btn-text:hover { color: var(--red-d); text-decoration: underline; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-ghost.btn-sm { padding: 5px 12px; }
.btn-xs { padding: 3px 10px; font-size: 11.5px; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--line2); color: #fff; box-shadow: none; }
.btn-ghost:disabled { background: var(--surface); color: var(--mut3); border-color: var(--line); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.icon-btn:hover { background: rgba(0,0,0,.06); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------------- chips & filters ---------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line2); background: var(--surface); border-radius: var(--r-pill); padding: 6px 14px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--ink); transition: border-color var(--t-fast), background var(--t-fast); }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--brand-t); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.chip .count { font-family: var(--mono); font-size: 11px; color: var(--mut2); }
.chip-primary { border-color: var(--red); color: var(--red); font-weight: 700; }
.chip-primary:hover { background: var(--pink-t); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.search-pill { display: flex; align-items: center; gap: 9px; border: 1.5px solid var(--line2); background: var(--surface); border-radius: var(--r-pill); padding: 8px 16px; min-width: 260px; }
.search-pill input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 14px; min-width: 0; }
.search-pill svg { width: 16px; height: 16px; color: var(--mut2); }
.search-pill:focus-within { border-color: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; background: var(--nested); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.seg button { padding: 6px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; color: var(--mut); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------------- tags / labels ---------------- */
.tag { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; border-radius: 20px; padding: 2px 8px; white-space: nowrap; font-weight: 600; line-height: 1.5; background: rgba(0,0,0,.06); color: var(--mut); }
.tag-sim { background: var(--amber-t); color: var(--amber-d); }        /* SIMULATED: outbound/write actions */
.tag-live { background: var(--blue-t); color: var(--bblue); }           /* LIVE: model output */
.tag-concept { background: transparent; border: 1px dashed var(--mut3); color: var(--mut); }  /* CONCEPT: not wired */
.tag-guided { background: var(--ink); color: #fff; }
.tag-full { background: var(--pink-t); color: var(--red-d); }
.tag-light { background: var(--blue-t); color: var(--bblue); }
.tag-touch { background: var(--teal-t); color: var(--teal-d); }
.tag-brand { background: var(--brand-t); color: var(--brand); }
.demo-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .04em; background: rgba(0,0,0,.07); color: var(--mut); border-radius: 20px; padding: 2px 9px; vertical-align: middle; }
.demo-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---------------- status pills (reference .state) ---------------- */
.state { display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--sans); padding: 4px 10px; border-radius: var(--r-pill); white-space: nowrap; background: var(--graphite-t); color: var(--graphite); }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.state.s-review, .state.s-renewing { background: var(--brand-t); color: var(--brand); }
.state.s-approval, .state.s-yourturn { background: var(--emph-t); color: var(--emph); }
.state.s-active, .state.s-progress { background: var(--teal-t); color: var(--teal-d); }
.state.s-sourcing, .state.s-done, .state.s-paid { background: var(--blue-t); color: var(--bblue); }
.state.s-scoping, .state.s-intake, .state.s-waiting { background: var(--graphite-t); color: var(--graphite); }
.state.s-hold, .state.s-blocked, .state.s-danger { background: var(--danger-bg); color: var(--danger-fg); }
.state.s-canceled { background: #F2EEEE; color: var(--mut2); }
.state.plain::before { display: none; }

/* governance pills: RECORDED / CAPTURED / ASSIGNED / PENDING M4 — the whole row tints */
.gov { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.govrow { display: grid; grid-template-columns: 140px 1fr auto; gap: 11px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.govrow:last-child { border-bottom: 0; }
.govrow .k { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.govrow.ok { background: var(--ok-bg); }
.govrow.pend { background: var(--warn-bg); }
.govrow.block { background: var(--danger-bg); }
.govst { font: 700 9px var(--mono); text-transform: uppercase; letter-spacing: .04em; padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.govst.ok { color: var(--ok-fg); border: 1px solid var(--ok-fg); background: transparent; }
.govst.pend { background: transparent; color: var(--warn-fg); }
.govst.block { color: var(--danger-fg); border: 1px solid var(--danger-fg); }
/* compact standalone variants: <span class="govst ok">RECORDED</span> */

/* ---------------- UCI classification badge ---------------- */
.uci { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.uci::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--uci-c, var(--mut3)); flex: none; }
.uci-green { --uci-c: var(--uci-green); } .uci-yellow { --uci-c: var(--uci-yellow); } .uci-orange { --uci-c: var(--uci-orange); } .uci-red { --uci-c: var(--uci-red); }
.uci.badge { font: 600 11px var(--mono); letter-spacing: .03em; padding: 3px 9px 3px 8px; border-radius: var(--r-pill); background: var(--uci-t, var(--nested)); color: var(--ink); }
.uci-green.badge { --uci-t: var(--uci-green-t); } .uci-yellow.badge { --uci-t: var(--uci-yellow-t); } .uci-orange.badge { --uci-t: var(--uci-orange-t); } .uci-red.badge { --uci-t: var(--uci-red-t); }
.uci-swatches { display: inline-flex; gap: 6px; }
.uci-swatch { width: 26px; height: 26px; border-radius: 7px; background: var(--uci-c); border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.uci-swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }

/* ---------------- cards ---------------- */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 20px; }
.card-bar { border-top: 3px solid var(--brand); }
.card-bar-red { border-top: 3px solid var(--red); }
.card-bar-blue { border-top: 3px solid var(--bblue); }
.card-bar-ink { border-top: 3px solid var(--ink); }
.card-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-hd h3 { font-size: 15.5px; font-weight: 800; }
.card-flat { box-shadow: none; border: 1px solid var(--line); }
.sechd { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; font-weight: 600; margin: 24px 0 10px; border-left: 3px solid var(--brand); padding-left: 10px; text-transform: uppercase; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sechd .act { font-family: var(--sans); letter-spacing: 0; text-transform: none; font-size: 13px; color: var(--red); font-weight: 600; }
.secnum { display: inline-flex; width: 24px; height: 24px; border-radius: 6px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; margin-right: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* KPI tiles */
.kpi { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px 18px; border-top: 3px solid var(--brand); }
.kpi .k { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mut2); font-weight: 600; }
.kpi .v { font-family: var(--mono); font-size: 27px; font-weight: 600; color: var(--bblue); margin-top: 4px; line-height: 1.15; }
.kpi .v.emph { color: var(--emph); }
.kpi .s { font-size: 12.5px; color: var(--mut); margin-top: 4px; }

/* status block (project overview) */
.statusblk { background: var(--surface); border-radius: 10px; border-top: 3px solid var(--brand); box-shadow: var(--shadow); padding: 14px 16px; display: grid; grid-template-columns: 110px 1fr; gap: 7px 14px; font-size: 14px; }
.statusblk .k { font-family: var(--mono); font-size: 11.5px; letter-spacing: .05em; color: var(--ink); text-transform: uppercase; padding-top: 2px; }
.statusblk em { font-style: normal; color: var(--red); font-weight: 600; }

/* key/value table */
.kv { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; font-size: 13.5px; }
.kv > div { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: baseline; }
.kv > div:first-child { border-top: 0; }
.kv .k { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }

/* ---------------- tables (CSS grid rows, reference style) ---------------- */
.tbl-head { display: grid; gap: 14px; padding: 0 16px 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); font-weight: 500; }
.tbl { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--r-lg); overflow: hidden; }
.tbl-row { display: grid; gap: 14px; align-items: center; min-height: 46px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 13.5px; transition: background var(--t-fast), box-shadow var(--t-fast); }
.tbl-row:first-child { border-top: 0; }
a.tbl-row:hover, .tbl-row.hover:hover { background: var(--bg); box-shadow: var(--shadow); }
.tbl-row .sub { font-size: 12px; color: var(--mut2); }
.tbl-row .id { font-family: var(--mono); font-size: 11px; color: var(--mut2); }
.tbl-row .r { text-align: right; justify-self: end; }
.tbl-row .money { font-family: var(--mono); font-weight: 600; }
.tbl-group { padding: 10px 16px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--mut2); background: var(--soft2); border-top: 1px solid var(--line); }
table.t { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13.5px; }
table.t th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; }

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid rgba(0,0,0,.08); }
.tab { padding: 14px 13px 11px; font-weight: 600; font-size: 14px; color: var(--mut); border-bottom: 2.5px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--ink2); }
.tab.on, .tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab .count { font-family: var(--mono); font-size: 10.5px; background: var(--nested); border-radius: 10px; padding: 0 6px; color: var(--mut); }

/* ---------------- split pane (project view: chat 46% | 7px gutter | detail) ---------------- */
.split { display: grid; grid-template-columns: minmax(320px, var(--split-l, 46%)) 7px minmax(360px, 1fr); height: 100%; min-height: 0; }
.split-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.split-left { background: var(--surface); }
.split-right { overflow-y: auto; }
.split-gutter { background: rgba(0,0,0,.05); position: relative; cursor: col-resize; border: 0; padding: 0; }
.split-gutter::after { content: ""; position: absolute; left: 2.5px; top: 48%; width: 2px; height: 30px; background: #9A958E; border-radius: 2px; }
.split-gutter:hover, .split-gutter:focus-visible { background: rgba(0,0,0,.10); }

/* ---------------- avatars ---------------- */
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--av, var(--ink)); flex: none; letter-spacing: .02em; }
.av-sm { width: 22px; height: 22px; font-size: 9px; }
.av-lg { width: 38px; height: 38px; font-size: 13px; }
.av-stack { display: inline-flex; }
.av-stack .av { box-shadow: 0 0 0 2px var(--bg); margin-left: -6px; }
.av-stack .av:first-child { margin-left: 0; }

/* ---------------- empty states, skeletons, notes ---------------- */
.empty { text-align: center; color: var(--mut); padding: 40px 20px; font-size: 14px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 16px; }
.empty .hint { font-size: 13px; color: var(--mut2); margin-top: 6px; }
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--nested) 0, #F6F5F2 60px, var(--nested) 120px); background-size: 800px 100%; animation: shimmer 1.2s linear infinite; }
.skel + .skel { margin-top: 8px; }
.skel.w-60 { width: 60%; } .skel.w-80 { width: 80%; } .skel.w-40 { width: 40%; }
.skel-card { background: var(--surface); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.note { font-size: 12.5px; color: var(--mut); border-left: 3px solid var(--line2); padding: 4px 0 4px 10px; }
.note.ai { border-color: var(--ai); }
.callout { display: flex; gap: 10px; align-items: flex-start; background: var(--ai-t); color: var(--ink); border-radius: var(--r-md); padding: 10px 14px; font-size: 13.5px; }
.callout.warn { background: var(--warn-bg); }
.callout.danger { background: var(--danger-bg); }
.callout svg { width: 16px; height: 16px; margin-top: 2px; color: var(--ai); }
.disclaimer { font-size: 12px; color: var(--mut2); }
.disclaimer::before { content: "✦ "; color: var(--ai); }

/* ---------------- placeholder (stub views) ---------------- */
.stub { margin-top: 18px; border: 1.5px dashed var(--line2); border-radius: var(--r-lg); padding: 28px; background: rgba(255,255,255,.45); color: var(--mut); }
.stub h3 { color: var(--ink); margin-bottom: 6px; }
.stub code { background: var(--surface); }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mut2); font-weight: 600; }
.input, .select, .textarea { border: 1.5px solid var(--line2); border-radius: 10px; padding: 9px 12px; background: var(--surface); font-size: 14px; outline: 0; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.switch-row:first-child { border-top: 0; }
.switch-row .t b { display: block; font-size: 14px; }
.switch-row .t small { color: var(--mut); font-size: 12.5px; }
