/* ============================================================
   Strategy Modeler — app styles (light theme only)
   ============================================================ */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-users: #2563eb;
  --accent-usecases: #0d9488;
  --accent-logical: #7c3aed;
  --accent-physical: #ea580c;
  --danger: #dc2626;
  --warning: #f59e0b;

  --nav-w: 220px;
  --header-h: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.18);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

a { color: var(--accent); }

/* ---------- Layout shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas:
    "brand header"
    "nav   main";
  height: 100vh;
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
}
.brand .brand-mark { color: var(--accent); font-size: 18px; }

.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.app-header .strategy-title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: text;
  max-width: 640px;
  margin: 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-header .strategy-title:hover { border-color: var(--border); background: var(--bg); }
.app-header .strategy-title:focus { outline: none; border-color: var(--accent); background: #fff; }

/* ---------- Nav ---------- */

.app-nav {
  grid-area: nav;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.nav-items { display: flex; flex-direction: column; padding: 10px 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-weight: 500;
  white-space: nowrap;
}
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 16px; flex: none; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: #eff6ff;
  font-weight: 600;
}
.nav-sep { height: 1px; background: var(--border); margin: 8px 16px; }
.nav-footer {
  padding: 12px 18px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

/* ---------- Main ---------- */

.app-main {
  grid-area: main;
  overflow-y: auto;
  padding: 24px 28px 60px;
}
.view-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.view-header h1 { font-size: 22px; font-weight: 600; margin: 0; flex: 1; }
.view-header .spacer { flex: 1; }
.search-input {
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); font-size: 14px; width: 220px;
}
.search-input:focus { outline: none; border-color: var(--accent); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  line-height: 1;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon {
  border: none; background: transparent; color: var(--text-muted);
  padding: 4px; border-radius: 4px; font-size: 15px; line-height: 1;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards / grids ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-head { display: flex; align-items: flex-start; gap: 8px; }
.card-head h3 { margin: 0; font-size: 16px; flex: 1; }
.card .desc { color: var(--text-muted); font-size: 13.5px; margin: 0; }
.card .biz-value { font-style: italic; color: var(--text-muted); font-size: 13px; }
.card .field-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600; margin-top: 4px;
}
.card ul.bullets { margin: 2px 0 0; padding-left: 18px; font-size: 13px; }
.card ul.bullets li { margin: 1px 0; }
.card-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: auto; padding-top: 6px; }

/* type badge */
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 20px;
  white-space: nowrap;
}
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #e2e8f0; color: #334155; }
.badge-external { background: #ede9fe; color: #6d28d9; }

/* ---------- Chips ---------- */

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
  border: 1px solid transparent; background: var(--bg); color: var(--text);
  cursor: pointer; line-height: 1.4; max-width: 100%;
}
.chip:hover { filter: brightness(0.97); box-shadow: var(--shadow-sm); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip-user { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.chip-usecase { background: #f0fdfa; border-color: #99f6e4; color: #0f766e; }
.chip-component { background: #faf5ff; border-color: #e9d5ff; color: #7e22ce; }
.chip-overflow { background: var(--surface); border-color: var(--border); color: var(--text-muted); font-weight: 600; }
.chip-static { cursor: default; }

/* ---------- Empty states ---------- */

.empty-state {
  text-align: center; color: var(--text-muted);
  padding: 60px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.empty-state .big { font-size: 17px; color: var(--text); font-weight: 500; }

/* ---------- Modal / overlay ---------- */

.overlay-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal.wide { max-width: 820px; }
.modal.xl { max-width: 1500px; width: 96vw; max-height: 92vh; }

/* ---------- Document preview ---------- */

.doc-preview-body { background: var(--bg); }
.doc-preview .export-section { margin-bottom: 30px; }
.doc-preview .export-title { font-size: 26px; font-weight: 700; }
.doc-preview .export-sub { color: var(--text-muted); font-size: 15px; margin-top: 4px; }
.doc-preview .export-h {
  font-size: 20px; font-weight: 600; margin: 0 0 14px;
  border-bottom: 1px solid var(--border); padding-bottom: 6px;
}
.doc-preview h2 { font-size: 20px; }
.doc-preview h3 { font-size: 15px; color: var(--accent); margin: 14px 0 4px; }
.modal-head {
  display: flex; align-items: center; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.modal-foot .spacer { flex: 1; }
.modal-foot .export-label { color: var(--text-muted); font-size: 13px; white-space: nowrap; }

/* ---------- Forms ---------- */

.form-field { margin-bottom: 14px; }
.form-field > label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 5px; color: var(--text);
}
.form-field .req { color: var(--danger); }
.form-field input[type="text"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  color: var(--text); background: var(--surface);
}
.form-field textarea { resize: vertical; min-height: 64px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-field.invalid input, .form-field.invalid select, .form-field.invalid textarea { border-color: var(--danger); }
.form-field .err-msg { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

.checklist {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 220px; overflow-y: auto; padding: 6px;
}
.checklist .group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 700; padding: 8px 6px 3px;
}
.checklist label {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  border-radius: 4px; font-size: 13.5px; cursor: pointer;
}
.checklist label:hover { background: var(--bg); }
.checklist input { margin: 0; }
.color-input-row { display: flex; align-items: center; gap: 10px; }
.color-input-row input[type="color"] { width: 44px; height: 38px; padding: 2px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* swatch picker */
.swatch-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
  border: 2px solid transparent; width: 72px; font-size: 11px; color: var(--text-muted);
}
.swatch:hover { background: var(--bg); }
.swatch.selected { border-color: var(--accent); }
.swatch .chip-preview { width: 100%; height: 26px; border-radius: 5px; border: 1px solid; }

/* ---------- Tables ---------- */

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border);
}
.data-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.data-table tbody tr:hover { background: var(--bg); }
.data-table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* ---------- Config tabs ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 9px 14px; border: none; background: transparent; color: var(--text-muted);
  font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.section-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.section-card h3 { margin-top: 0; }
.danger-card { border-color: #fecaca; background: #fef2f2; }
.danger-card h3 { color: var(--danger); }

/* Document screen section rows */
.doc-section-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-top: 8px; cursor: pointer; background: var(--surface);
}
.doc-section-row:hover { background: var(--bg); }
.doc-section-row input { margin-top: 3px; }

/* ---------- Home ---------- */

.home-hero { text-align: center; padding: 12px 0 28px; }
.home-hero h1 { font-size: 28px; margin: 0 0 6px; }
.home-hero .sub { color: var(--text-muted); font-size: 16px; }

.flow {
  display: flex; align-items: stretch; justify-content: center;
  gap: 0; flex-wrap: wrap; margin: 22px auto; max-width: 900px;
}
.flow-card {
  flex: 1; min-width: 150px; border: 2px solid; border-radius: var(--radius);
  padding: 16px 14px; text-align: center; background: var(--surface);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.flow-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); transition: all .15s; }
.flow-card .step-num {
  width: 26px; height: 26px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; margin: 0 auto;
}
.flow-card .step-name { font-weight: 700; font-size: 15px; }
.flow-card .step-tag { font-size: 12px; color: var(--text-muted); }
.flow-arrow { display: flex; align-items: center; color: var(--text-muted); font-size: 22px; padding: 0 6px; }

.getting-started {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 20px; margin: 24px auto; max-width: 720px;
  box-shadow: var(--shadow-sm);
}
.getting-started h3 { margin-top: 0; }
.getting-started .gs-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* Example template gallery (scales from one example to many domains) */
.template-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 8px; }
.template-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); padding: 12px 14px;
}
.template-card .tc-body { flex: 1; min-width: 0; }
.template-card .tc-desc { font-size: 12.5px; margin-top: 2px; }
.template-card .tc-source { display: inline-block; font-size: 11.5px; margin-top: 5px; color: var(--accent); text-decoration: none; }
.template-card .tc-source:hover { text-decoration: underline; }
.template-card .btn { flex: none; }

.home-credit { text-align: center; color: var(--text-muted); font-size: 13px; margin: 30px auto 0; max-width: 860px; }
.home-credit a { color: var(--accent); }

.methodology { max-width: 860px; margin: 20px auto 0; }
.methodology h2 { font-size: 20px; margin-top: 28px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.methodology p { color: var(--text); }
.methodology .lead-in { font-weight: 700; }
.methodology .callout {
  background: #eff6ff; border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 16px 0;
}
.methodology .callout ul { margin: 8px 0 0; }
.methodology .flow-line { font-weight: 700; font-size: 17px; text-align: center; color: var(--accent); }

/* ---------- Logical / Physical model ---------- */

.model-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; }
.legend .legend-item { display: flex; align-items: center; gap: 6px; }
.legend .legend-swatch { width: 14px; height: 14px; border-radius: 3px; }
.toggle-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; }

/* Soft outer frame around the whole model (reference-architecture look). */
.model {
  background: linear-gradient(180deg, #f0fdf9 0%, #f8fafc 55%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
}

/* ---------- Roadmap timeline ---------- */

.roadmap-group {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600; margin: 22px 0 10px;
}
.roadmap-group:first-child { margin-top: 0; }
.roadmap-item { display: flex; gap: 14px; margin-bottom: 12px; }
.roadmap-dot {
  flex: none; width: 12px; height: 12px; margin-top: 6px;
  border-radius: 50%; background: var(--surface); border: 3px solid;
}
.roadmap-card {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 4px;
}
.roadmap-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.roadmap-title { font-size: 14px; font-weight: 600; }
.roadmap-status { flex: none; }

/* inline Gantt (SVG scaled to width) */
.gantt-host {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 10px; overflow-x: auto;
}

/* Flat stack: every layer is a full-width band, ordered by `order`. */
.model-stack { display: flex; flex-direction: column; gap: 14px; }

/* compact ("Fit") mode */
.model.compact { padding: 12px; }
.model.compact .model-stack { gap: 10px; }
.model.compact .layer-band { padding: 12px 14px; }
.model.compact .component-box { padding: 8px 6px; font-size: 12px; }
.model.compact .component-box .comp-icon { font-size: 15px; }
.model.compact .layer-name { font-size: 10.5px; }

.layer-band {
  border: 1px solid; border-radius: 16px; padding: 16px 18px;
  position: relative;
}
.layer-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.layer-name {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700;
}
.layer-span-note { font-size: 11px; color: var(--text-muted); font-style: italic; }
.layer-rows { display: flex; flex-direction: column; gap: 12px; }
/* Equal-width component boxes filling each row. */
.layer-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.layer-empty-hint { color: var(--text-muted); font-size: 13px; font-style: italic; }

.component-box {
  background: var(--surface); border: 1px solid; border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); padding: 12px 10px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; transition: box-shadow .12s, transform .12s;
}
.component-box:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.component-box .comp-icon { font-size: 19px; line-height: 1; opacity: 0.9; }
.component-box .comp-name { font-weight: 600; font-size: 13px; }
.component-box .product-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }

.product-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500;
  border: 1px solid; color: var(--text); cursor: pointer; line-height: 1.5;
}
.product-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* pulse highlight for focus navigation */
@keyframes pulse-focus {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
  40%  { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.focus-pulse { animation: pulse-focus 2s ease-out; border-color: var(--accent) !important; }

/* ---------- Popover / side panel ---------- */

.side-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw;
  background: var(--surface); box-shadow: var(--shadow-lg); z-index: 900;
  display: flex; flex-direction: column; border-left: 1px solid var(--border);
}
.side-panel .sp-head { display: flex; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.side-panel .sp-head h2 { margin: 0; font-size: 18px; flex: 1; }
.side-panel .sp-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.side-panel .sp-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.sp-field-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 5px;
}

/* ---------- Toast ---------- */

.toast-host { position: fixed; bottom: 20px; right: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 8px;
  animation: toast-in .2s ease-out;
}
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warning); color: #422006; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Matrix ---------- */

.matrix-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--border); border-radius: var(--radius); }
.matrix { border-collapse: collapse; font-size: 13px; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.matrix tbody th { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; white-space: nowrap; }
.matrix .grp-th { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.matrix .cell { cursor: pointer; width: 30px; }
.matrix .cell:hover { background: #eff6ff; }
.matrix .cell.on { background: var(--accent); color: #fff; }
.matrix .cell.on:hover { background: #1d4ed8; }
.matrix .col-th { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 160px; font-weight: 500; }

/* ---------- Utilities ---------- */

.muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.pdf-error { color: var(--danger); font-size: 13px; }

/* ---------- Icons ---------- */

.icon { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex: none; }
.icon svg { display: block; }

.component-box .comp-icon { opacity: 0.9; margin-bottom: 2px; }
.model.compact .comp-icon svg { width: 16px; height: 16px; }

.card-head { align-items: center; }
.card-icon { color: var(--accent); flex: none; }
.card-head .card-icon + h3 { margin-left: 0; }

.sp-icon { color: var(--accent); margin-right: 10px; flex: none; }

.name-with-icon { display: inline-flex; align-items: center; gap: 8px; }
.cell-icon { color: var(--text-muted); }

/* icon picker */
.icon-picker-field .btn { display: inline-flex; align-items: center; gap: 8px; }
.icon-preview { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; color: var(--accent); }

.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px; max-height: 52vh; overflow-y: auto; padding: 2px;
}
.icon-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-cell:hover { background: var(--bg); border-color: var(--accent); }
.icon-cell.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); }
.icon-cell.icon-none { color: var(--text-muted); font-size: 18px; }
.icon-cell-label {
  font-size: 10px; color: var(--text-muted); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Collapsed nav (< 1280px) ---------- */

@media (max-width: 1279px) {
  :root { --nav-w: 56px; }
  .brand .brand-text { display: none; }
  .nav-item .nav-label { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-footer { display: none; }
  .app-header .strategy-title { text-align: left; margin: 0; }
}
