/* ========================= pages ========================= */

/* system status strip (dashboard) */
.sys-strip { display: flex; gap: 0; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); margin-bottom: 16px; }
.sys-strip .ss { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12.5px; border-right: 1px solid var(--border); }
.sys-strip .ss:last-child { border-right: 0; }
.sys-strip .ss b { font-weight: 600; }

/* heatmap (channel x level) */
.heat { display: grid; gap: 3px; font-size: 11.5px; }
.heat .hc { height: 30px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; border: 0; color: var(--text); }
.heat .hc:hover { outline: 2px solid var(--brand); }
.heat .hh { color: var(--text-3); display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.15; min-height: 30px; }
.heat .hr { display: flex; align-items: center; }

/* urgent list */
.urgent { display: flex; flex-direction: column; }
.urgent .u-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); align-items: center; }
.urgent .u-item:last-child { border-bottom: 0; }

/* taxonomy */
.scale { display: flex; flex-direction: column; gap: 6px; }
.scale-row { display: grid; grid-template-columns: 28px 64px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.scale-row:hover { border-color: var(--border-strong); }
.scale-row.active { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.scale-row.drag-over { box-shadow: inset 0 3px 0 var(--brand); }
.scale-row .rank { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.scale-axis { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); margin: 2px 0 8px; }
.scale-axis .bar { flex: 1; height: 4px; border-radius: 2px; }
.tree { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.tree ul { list-style: none; margin: 0; padding-left: 20px; border-left: 1px dashed var(--border-strong); margin-left: 9px; }
.tree .tn { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.tree .tn:hover { background: var(--surface-2); }
.tree .tn.active { background: var(--brand-soft); }
.tree .tw { width: 18px; height: 18px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-3); padding: 0; border-radius: 4px; }
.tree .tw.leaf { visibility: hidden; }
.tree .tw[aria-expanded="false"] svg { transform: rotate(-90deg); }
.tree .meta { margin-left: auto; display: flex; gap: 10px; font-size: 12px; color: var(--text-3); }

/* sources */
.src-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.src-card .src-top { display: flex; gap: 10px; align-items: flex-start; }
.src-logo { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.src-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; font-size: 12px; }
.src-meta div span { display: block; color: var(--text-3); font-size: 11px; }
.pipeline { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 4px 0; }
.pipe-step { flex: 1; min-width: 150px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface); font-size: 12.5px; position: relative; }
.pipe-step b { display: block; font-size: 12.5px; margin-bottom: 2px; }
.pipe-arrow { display: flex; align-items: center; padding: 0 6px; color: var(--text-3); }

/* mapping grid */
.map-grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.map-grid th, .map-grid td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: center; }
.map-grid th:first-child, .map-grid td:first-child { text-align: left; }
.map-grid thead th { background: var(--surface-2); position: sticky; top: 0; z-index: 1; font-size: 12px; }
.map-grid .mcell { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.map-grid .mcell[aria-checked="true"] { border-color: var(--c); background: var(--c); color: #fff; }
.map-grid tr.gap td { background: color-mix(in srgb, #f59e0b 10%, transparent); }
.map-grid tr.inv td { background: color-mix(in srgb, #dc2626 8%, transparent); }

/* matrix */
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.matrix th, .matrix td { padding: 6px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 190px; }
.matrix thead th { background: var(--surface-2); font-weight: 600; font-size: 11.5px; color: var(--text-2); vertical-align: bottom; position: sticky; top: 0; z-index: 2; }
.matrix thead th:first-child { z-index: 3; background: var(--surface-2); }
.matrix .th-ch { display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1.2; min-width: 76px; }
.matrix td.cell { cursor: pointer; position: relative; }
.matrix td.cell:hover { background: var(--surface-2); }
.matrix td.cell.changed { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.matrix td.cell.changed::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.matrix td.cell .cf { position: absolute; top: 2px; left: 3px; color: var(--warn); }
.matrix td.cell button.cellbtn { border: 0; background: none; padding: 0; cursor: pointer; }
.matrix tr.special td:first-child { background: var(--surface-2); }
.matrix tr.sep td { padding: 4px 8px; background: var(--surface-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); text-align: left; }

/* playground */
.trace { list-style: none; margin: 0; padding: 0; counter-reset: tr; }
.trace li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.trace li::before { counter-increment: tr; content: counter(tr); width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text-2); }
.trace li.used::before { background: var(--brand); color: #fff; }
.trace li.fail::before { background: var(--danger); color: #fff; }
.trace li.skip { color: var(--text-3); }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r-md); padding: 22px; text-align: center; color: var(--text-2); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.hl-preview { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; max-height: 260px; overflow: auto; line-height: 1.6; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); display: flex; flex-direction: column; min-height: 300px; }
.kcol-h { padding: 10px 12px; font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.kcol-b { padding: 8px; display: flex; flex-direction: column; gap: 8px; max-height: 640px; overflow: auto; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 12.5px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--sh-1); }
.kcard:hover { border-color: var(--border-strong); }

/* end-user popups (Windows-like) */
.eu-stage { background: linear-gradient(135deg, #1e3a5f, #0f766e 60%, #134e4a); border-radius: var(--r-lg); padding: 28px; min-height: 460px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.eu-win { width: 460px; max-width: 100%; background: #ffffff; color: #0f172a; border-radius: 10px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); overflow: hidden; font-family: "Segoe UI", var(--font); }
.eu-win .eu-tb { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f1f5f9; font-size: 12px; color: #334155; border-bottom: 1px solid #e2e8f0; }
.eu-win .eu-tb .logo-s { width: 16px; height: 16px; }
.eu-win .eu-b { padding: 16px 18px; display: flex; gap: 14px; }
.eu-win .eu-ic { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.eu-win h3 { font-size: 15px; margin-bottom: 6px; color: #0f172a; }
.eu-win p { font-size: 13px; color: #334155; margin-bottom: 8px; }
.eu-win .eu-f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.eu-win .eu-btn { height: 30px; padding: 0 14px; border-radius: 4px; border: 1px solid #cbd5e1; background: #fff; font-size: 12.5px; cursor: pointer; color: #0f172a; }
.eu-win .eu-btn.pri { background: #0f766e; color: #fff; border-color: #0f766e; }
.eu-win .eu-btn.dan { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.eu-win select, .eu-win textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 4px; padding: 6px 8px; font-size: 12.5px; background: #fff; color: #0f172a; }
.eu-win textarea { min-height: 60px; margin-top: 6px; }
.eu-win .eu-meta { font-size: 11.5px; color: #64748b; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 8px; }
.eu-tray { position: absolute; right: 18px; bottom: 18px; width: 340px; background: #1f2937; color: #f9fafb; border-radius: 8px; padding: 12px 14px; font-size: 12.5px; box-shadow: 0 16px 40px rgba(0, 0, 0, .4); font-family: "Segoe UI", var(--font); }
.eu-tray b { display: block; margin-bottom: 2px; }
.eu-mini { transform: scale(.86); transform-origin: top left; width: 116%; }

/* permission matrix */
.perm th, .perm td { text-align: center; }
.perm td:first-child, .perm th:first-child { text-align: left; }
.perm .pc { width: 18px; height: 18px; accent-color: var(--brand); }
.perm tr.sensitive td:first-child { color: var(--danger); font-weight: 600; }

/* integrations */
.int-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.int-logo { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 12px; flex: none; }

/* report preview */
.rpt-prev { border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; background: var(--surface); }
.rpt-prev .rp-h { display: flex; justify-content: space-between; border-bottom: 2px solid var(--brand); padding-bottom: 8px; margin-bottom: 12px; }

/* kill switch */
.kill { border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); border-radius: var(--r-md); padding: 14px 16px; }

/* wizard layout */
.wiz { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.wiz-side { position: sticky; top: calc(var(--top-h) + 12px); display: flex; flex-direction: column; gap: 12px; }
.wiz-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.estimate { display: flex; gap: 16px; }
.estimate div b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.estimate div span { font-size: 12px; color: var(--text-3); }
.nl-summary { font-size: 14px; line-height: 1.7; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--border); }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.ch-opt { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); cursor: pointer; font-size: 13px; background: var(--surface); }
.ch-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.ch-opt input { accent-color: var(--brand); }
@media (max-width: 1279px) { .wiz { grid-template-columns: minmax(0, 1fr); } .wiz-side { position: static; } }
