/* IHMA ERP — «Рисклар» bo'limi (erp.ihma.uz/risk, 11.11.2026 holatiga mos dizayn) */
:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --border: #e6e6ea;
  --border-strong: #d4d4da;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --muted-2: #a1a1aa;
  --primary: #7c3aed;
  --primary-600: #6d28d9;
  --primary-50: #f5f3ff;
  --primary-100: #ede9fe;
  --primary-200: #ddd6fe;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --row-active: #ecfdf3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  font-size: 13px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
svg.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.ic.sm { width: 14px; height: 14px; }
svg.ic.xs { width: 12px; height: 12px; vertical-align: -2px; }
svg.ic.lg { width: 20px; height: 20px; }
.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------------- Layout ---------------- */
.layout { display: flex; min-height: 100vh; }
.rail {
  width: 44px; flex: none; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0;
  position: sticky; top: 0; height: 100vh;
}
.rail .logo { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--primary); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 7px; letter-spacing: -.2px; margin-bottom: 10px; overflow: hidden; }
.rail .r-item { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.rail .r-item:hover { background: #f4f4f5; color: var(--text); }
.rail .r-item.active { background: var(--primary); color: #fff; }
.rail .spacer { flex: 1; }

.sidebar {
  width: 210px; flex: none; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sb-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 16px 14px; }
.sb-title { font-weight: 700; font-size: 13px; }
.sb-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.sb-search { margin: 0 10px 14px; display: flex; align-items: center; gap: 8px; background: #f4f4f5; border-radius: 999px; padding: 7px 10px; color: var(--muted); cursor: text; }
.sb-search span { flex: 1; }
.kbd { font-size: 10px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.sb-menu { flex: 1; overflow-y: auto; padding: 0 8px; }
.sb-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 2px 0; border-radius: 999px; color: var(--text-2); cursor: pointer; text-decoration: none !important; white-space: nowrap; overflow: hidden; }
.sb-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-item:hover { background: #f4f4f5; }
.sb-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.sb-item .chev { transition: transform .15s; }
.sb-item.open .chev { transform: rotate(180deg); }
.sb-sub-list { margin: 2px 0 6px 18px; border-left: 1px solid var(--border); padding-left: 6px; }
.sb-leaf { display: flex; align-items: center; gap: 6px; padding: 7px 10px; margin: 2px 0; border-radius: 999px; color: var(--text-2); text-decoration: none !important; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.sb-leaf .lbl { overflow: hidden; text-overflow: ellipsis; }
.sb-leaf:hover { background: #f4f4f5; }
.sb-leaf.active { background: var(--primary-100); color: var(--primary-600); font-weight: 600; box-shadow: inset 0 0 0 1px var(--primary-200); }
.sb-user { border-top: 1px solid var(--border); padding: 12px 12px; display: flex; align-items: center; gap: 10px; position: relative; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #f4f4f5; color: var(--text-2); display: grid; place-items: center; font-weight: 700; font-size: 11px; flex: none; }
.sb-user .u-name { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.sb-user .u-org { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

/* ---------------- Page head ---------------- */
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 18px; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 11.5px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--muted-2); }
.title-badges { display: flex; gap: 6px; align-items: center; margin: 8px 0 6px; flex-wrap: wrap; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #fafafa; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.primary[disabled] { background: #c4b5fd; border-color: #c4b5fd; cursor: not-allowed; }
.btn.outline-primary { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f4f4f5; }
.btn.danger { color: var(--red); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: #fff; display: grid; place-items: center; color: var(--text-2); cursor: pointer; padding: 0; }
.icon-btn.ghost { border-color: transparent; background: transparent; width: 26px; height: 26px; }
.icon-btn:hover { background: #f4f4f5; }
.link-btn { background: none; border: none; color: var(--text); font-weight: 600; cursor: pointer; padding: 0 6px; font-size: 12.5px; }

/* ---------------- Cards ---------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-title { font-weight: 700; font-size: 13px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-title .count { color: var(--muted); font-weight: 500; margin-left: auto; }
.section-title { font-weight: 700; font-size: 13px; margin: 18px 0 10px; }

/* ---------------- Forms ---------------- */
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; align-items: end; }
.field label, .field .lbl { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input[type=text], .field input[type=date], .field input[type=number], .field select, .field textarea, .input {
  width: 100%; height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 10px; font-size: 12.5px; color: var(--text); background: #fff; font-family: inherit;
}
.field textarea, textarea.input { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: #fafafa; color: var(--muted); }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.field.span-2 { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.input-icon > input { padding-left: 32px !important; }
.input-icon .clear { position: absolute; right: 8px; top: 8px; color: var(--muted); cursor: pointer; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); margin: 0; }
.filter-bar { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .field { min-width: 0; }
.filter-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; padding-bottom: 1px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* ---------------- Badges / pills ---------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.status-detected { background: var(--primary-100); color: var(--primary-600); border-color: var(--primary-200); }
.pill.status-not_detected { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.pill.status-not_detected .dot { background: transparent; border: 1.5px solid var(--muted); width: 7px; height: 7px; }
.pill.status-closed { background: #f4f4f5; color: var(--muted); }
.pill.gray { background: #f4f4f5; color: var(--text-2); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.violet { background: var(--primary-100); color: var(--primary-600); }
.pill.outline { background: #fff; border-color: var(--border-strong); color: var(--text-2); }
.pill.finished { background: var(--green-bg); color: var(--green); }
.pill.failed { background: var(--red-bg); color: var(--red); }
.pill.executing { background: var(--primary-100); color: var(--primary-600); }
.pill.archived { background: #f4f4f5; color: var(--muted); }
.pill.canceled { background: var(--red-bg); color: var(--red); }
.pill.approved { background: var(--green-bg); color: var(--green); }
.pill.created, .pill.modified { background: #e0f2fe; color: #0369a1; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; color: var(--text-2); background: #f4f4f5; border: 1px solid var(--border); white-space: nowrap; }
.level-bars { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 10px; }
.level-bars i { width: 2.5px; background: var(--muted-2); border-radius: 1px; }
.level-bars i:nth-child(1) { height: 4px; } .level-bars i:nth-child(2) { height: 7px; } .level-bars i:nth-child(3) { height: 10px; }
.level-bars i.on { background: var(--text-2); }
.sev-count { display: inline-flex; align-items: center; gap: 3px; margin-right: 8px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.sev-count i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.band-chips { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.band-chips .rng { color: var(--text-2); font-size: 12px; margin-right: 6px; }
.dot-inline { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------------- Status chips (registry) ---------------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text); }
.chip .n { color: var(--muted); font-weight: 500; }
.chip:hover { border-color: var(--border-strong); }
.chip.active { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }
.chip .ring { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--primary); }

/* ---------------- KPI tiles ---------------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 14px; min-height: 92px; }
.kpi .k-label { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 21px; font-weight: 700; margin-top: 8px; }
.kpi .k-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--border-strong); }
.kpi.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; background: var(--primary-50); }

/* ---------------- Config strip ---------------- */
.cfg-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-size: 12px; color: var(--text-2); }
.cfg-strip .sep { color: var(--muted-2); }
.cfg-strip.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th { position: sticky; top: 0; z-index: 1; background: #fafafa; text-align: left; font-size: 11px; font-weight: 500; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid th.num { text-align: right; }
table.grid thead tr:nth-child(2) th { top: 36px; }
table.grid th.center { text-align: center; }
table.grid th .sort { color: var(--muted-2); margin-left: 3px; cursor: pointer; }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sorted { color: var(--text); }
table.grid td { padding: 11px 10px; border-bottom: 1px solid #f0f0f2; vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: #fafafa; }
table.grid tr.active-row td { background: var(--row-active); }
table.grid tr.active-row:hover td { background: #e2f8ea; }
table.grid tr.dim td { color: var(--muted-2); }
table.grid tr.dim td b, table.grid tr.dim td a { color: var(--muted-2); }
table.grid tr.total td { background: #fafafa; font-weight: 700; }
td .sub-line { color: var(--muted); font-size: 11.5px; margin-top: 3px; font-weight: 400; }
td .name { font-weight: 600; }
.th-group { text-align: center !important; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.th-sub-first { border-left: 1px solid var(--border); }
.th-sub-last { border-right: 1px solid var(--border); }
.th-tip { display: inline-flex; align-items: center; gap: 4px; cursor: help; }
.empty { text-align: center; color: var(--muted); padding: 26px !important; }
.report-table { max-height: calc(100vh - 160px); }
.tree-name { display: flex; align-items: flex-start; gap: 8px; }
.tree-name .tg { width: 16px; flex: none; color: var(--muted); padding-top: 1px; }
.tree-name .tg.leaf { visibility: hidden; }
.acc-code { font-variant-numeric: tabular-nums; }

/* ---------------- Pagination ---------------- */
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.pager select { height: 30px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 24px 0 10px; font-family: inherit; }
.pager .pages { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pager .pg { min-width: 28px; height: 28px; border-radius: 7px; border: none; background: transparent; cursor: pointer; color: var(--text-2); font-weight: 600; }
.pager .pg.active { background: var(--primary); color: #fff; }
.pager .pg:disabled { color: var(--muted-2); cursor: default; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 0 0 10px; cursor: pointer; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab .n { background: #f4f4f5; color: var(--text-2); border-radius: 999px; padding: 1px 7px; font-size: 11px; }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab.active .n { background: var(--primary-100); color: var(--primary-600); }

/* ---------------- Detail page ---------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
dl.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); margin: 0; }
dl.kv dt { color: var(--text-2); padding: 10px 0; border-top: 1px solid #f0f0f2; }
dl.kv dd { margin: 0; padding: 10px 0; border-top: 1px solid #f0f0f2; }
dl.kv dt:first-of-type, dl.kv dd:first-of-type { border-top: none; }
.values-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.values-table th { background: #fafafa; text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.values-table th.num { text-align: right; }
.values-table td { padding: 9px 12px; border-bottom: 1px solid #f0f0f2; }
.values-table tr:last-child td { border-bottom: none; }
.values-table tr.metric td { font-weight: 700; }
.values-table td.changed { background: #fef6e0; }
.values-table td.changed .arr { color: var(--amber); margin-right: 4px; }
.note { color: var(--muted); font-size: 11.5px; margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.big-metric { font-size: 26px; font-weight: 700; }
.metric-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.scale { margin-top: 22px; }
.scale .bar { display: flex; height: 6px; gap: 3px; position: relative; }
.scale .bar span { border-radius: 3px; }
.scale .marker { position: absolute; top: -20px; transform: translateX(-50%); font-size: 10.5px; font-weight: 600; text-align: center; white-space: nowrap; }
.scale .marker::after { content: ''; display: block; margin: 2px auto 0; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--text); }
.scale .labels { display: flex; gap: 3px; margin-top: 6px; }
.scale .labels div { font-size: 10.5px; color: var(--text-2); line-height: 1.35; }
.scale .labels div span { color: var(--muted); display: block; }
.timeline { margin-top: 14px; }
.tl-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 12px; top: 26px; bottom: 0; width: 1px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-ic { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-100); color: var(--primary-600); display: grid; place-items: center; }
.tl-ic.user { background: #f4f4f5; color: var(--text-2); }
.tl-ic.objection { background: var(--amber-bg); color: var(--amber); }
.tl-ic.close { background: var(--green-bg); color: var(--green); }
.tl-title { font-weight: 600; font-size: 12.5px; }
.tl-who { color: var(--muted); font-size: 11px; margin-top: 2px; }
.tl-text { margin-top: 5px; font-size: 12px; color: var(--text-2); white-space: pre-wrap; }
.tl-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.sev-change { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); }
.sev-change .tag { border-radius: 999px; }
.chart { width: 100%; }
.chart text { font-family: inherit; }

/* ---------------- Org page ---------------- */
.org-card { display: flex; gap: 14px; align-items: flex-start; }
.org-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-100); color: var(--primary-600); display: grid; place-items: center; flex: none; }
.org-name { font-weight: 700; font-size: 14px; }
.org-meta { color: var(--text-2); font-size: 12px; margin-top: 6px; }
.type-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.type-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; min-height: 140px; display: flex; flex-direction: column; }
.type-card:hover { border-color: var(--border-strong); }
.type-card .tc-mod { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.type-card .tc-name { font-weight: 700; margin-top: 12px; }
.type-card .tc-status { margin-top: 10px; display: flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 12px; flex-wrap: wrap; }
.type-card .tc-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid #f0f0f2; color: var(--muted); font-size: 11.5px; }

/* ---------------- Run modal ---------------- */
.run-summary { display: grid; grid-template-columns: 1fr 1.6fr 0.9fr; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.run-summary > div { padding: 16px 18px; }
.run-summary > div + div { border-left: 1px solid var(--border); }
.rs-label { font-size: 11.5px; color: var(--text-2); }
.rs-value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.rs-value small { font-size: 12px; color: var(--muted); font-weight: 500; }
.progress { height: 6px; border-radius: 3px; background: #f0f0f2; margin-top: 10px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.progress.dark i { background: var(--text); }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.rs-side { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.rs-side div { display: flex; align-items: center; gap: 8px; }
.rs-side .ico { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; }
.rs-side b { margin-left: auto; }

/* ---------------- Modal ---------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(24, 24, 27, .45); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 20px; overflow-y: auto; }
.modal-backdrop.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 980px; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.modal.narrow { max-width: 480px; margin-top: 18vh; }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px 6px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .sub { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 12px 20px 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 20px 18px; align-items: center; }

/* ---------------- Dropdown ---------------- */
.menu-pop { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); padding: 6px; z-index: 40; min-width: 200px; }
.menu-pop .mi { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.menu-pop .mi:hover { background: #f4f4f5; }
.menu-pop .mi.danger { color: var(--red); }
.menu-pop .mi.disabled { opacity: .45; pointer-events: none; }
.menu-pop .sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-pop .head { font-size: 11px; color: var(--muted); padding: 6px 10px 4px; }
.menu-pop select { width: 100%; height: 30px; margin-top: 4px; border: 1px solid var(--border-strong); border-radius: 6px; font-family: inherit; font-size: 12px; }

/* ---------------- Config edit ---------------- */
.bands-editor { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; max-width: 560px; }
.bands-editor .row { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 10px; padding: 8px 12px; align-items: center; border-bottom: 1px solid #f0f0f2; }
.bands-editor .row:last-child { border-bottom: none; }
.bands-editor .row.head { background: #fafafa; color: var(--muted); font-size: 11px; }
.bands-editor input { height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 8px; font-family: inherit; width: 100%; }
.bands-editor.off { opacity: .45; pointer-events: none; }

/* ---------------- Toast / mock pill / tech ---------------- */
.toast { position: fixed; right: 20px; bottom: 64px; background: #18181b; color: #fff; padding: 12px 16px; border-radius: 10px; max-width: 460px; font-size: 12.5px; line-height: 1.5; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(8px); transition: all .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: none; }
.mock-pill { position: fixed; right: 16px; bottom: 14px; display: flex; align-items: center; gap: 12px; background: #fffbeb; border: 1px dashed #f59e0b; color: #92400e; border-radius: 999px; padding: 6px 14px; font-size: 11.5px; z-index: 45; box-shadow: var(--shadow); }
.mock-pill a { color: #92400e; font-weight: 600; }
.mock-pill .checkbox { font-size: 11.5px; color: #92400e; }
.tech { background: #f8fafc; border: 1px dashed #94a3b8; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 12px; color: #334155; line-height: 1.55; }
.tech code, .note code { background: #e2e8f0; border-radius: 4px; padding: 0 4px; font-size: 11.5px; }
body.hide-tech .tech, body.hide-tech .tech-only { display: none !important; }
.demo-card { border: 1px dashed #f59e0b; background: #fffdf6; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .type-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print { .rail, .sidebar, .mock-pill { display: none; } }
