﻿[hidden] { display: none !important; }
:root {
  /* "CAD" theme: dark panels, amber accent (palette shared with the admin panel, css/admin.css) */
  --bg: #0e1116; --panel: #161b22; --panel-2: #1c232d; --panel-3: #232b36; --canvas: #0a0d11;
  --border: #2a323d; --border-soft: #222a35; --line: #1f2731;
  --sel: #2a2416; --selb: #6b5320; --accent: #f2a93b; --accent-2: #fbbf24; --accent-soft: rgba(242,169,59,.14); --accent-text: #0e1116;
  --teal: #2dd4bf; --result: #13202a; --text: #e6eaf0; --text-2: #c9d1dc; --gray: #8892a0; --dim: #9aa4b2; --err: #f87171;
  --ok: #34d399; --warn: #fbbf24;
  --radius: 8px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.35);
  --shadow-pop: 0 16px 40px -10px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.04);
  --mono: "Cascadia Mono", "IBM Plex Mono", Consolas, monospace;
  font-family: "Segoe UI Variable Text", "Segoe UI", "IBM Plex Sans", system-ui, -apple-system, Roboto, sans-serif; font-size: 12.5px; color: var(--text);
  --bar: #12161c; --bar-2: #0b0e12; --hover-border: #3a4452; --muted-2: #5b6574; --strong: #fff;
  --icon: #c9d1dc; --icon-2: #aab3c0; --icon-off: #4a5360; --water: #38bdf8; --tog: #6b7685;
  --scroll: #2f3844; --scroll-h: #46515f; --danger: #ef4444; --invalid-bg: #2a1414; --row-hover: #1a2029;
  --sel-focus: #3a2e14; --sel-focus-2: #3f3218; --result-text: #9fd8e6; --backdrop: rgba(3,5,8,.62);
  --info: #7dd3fc; --info-bg: rgba(56,189,248,.14); --tip-bg: #05070a; --plan-dot: #1d242e;
  --float: rgba(28,35,45,.94); --float-2: rgba(22,27,34,.92); --veil: rgba(10,13,17,.72); --row-on: #1b1f26;
  color-scheme: dark;
}
/* Light theme (js/theme.js sets html[data-theme]); dark stays the default. */
:root[data-theme="light"] {
  --bg: #f3f5f8; --panel: #ffffff; --panel-2: #f1f4f8; --panel-3: #e5eaf1; --canvas: #fbfcfd;
  --border: #cfd6df; --border-soft: #dfe4ea; --line: #e8ecf1;
  --sel: #fdf0d8; --selb: #e3b25a; --accent: #c97a0a; --accent-2: #b06a06; --accent-soft: rgba(201,122,10,.12); --accent-text: #ffffff;
  --teal: #0f9488; --result: #eaf5f8; --text: #1b2330; --text-2: #354152; --gray: #6a7584; --dim: #5b6676; --err: #c62828;
  --ok: #15965f; --warn: #b7791f;
  --shadow: 0 1px 2px rgba(16,24,40,.08);
  --shadow-pop: 0 16px 40px -12px rgba(16,24,40,.25), 0 0 0 1px rgba(16,24,40,.06);
  --bar: #f6f8fa; --bar-2: #ffffff; --hover-border: #b8c1cc; --muted-2: #98a2b0; --strong: #10161f;
  --icon: #455265; --icon-2: #5b6676; --icon-off: #b8c0ca; --water: #0284c7; --tog: #8a94a3;
  --scroll: #c9d0d9; --scroll-h: #aab3bf; --danger: #dc2626; --invalid-bg: #fdecec; --row-hover: #f3f6fa;
  --sel-focus: #fbe2b4; --sel-focus-2: #f7d79c; --result-text: #0e6378; --backdrop: rgba(15,23,35,.35);
  --info: #0369a1; --info-bg: rgba(2,132,199,.12); --tip-bg: #ffffff; --plan-dot: #dde3ea;
  --float: rgba(255,255,255,.95); --float-2: rgba(255,255,255,.94); --veil: rgba(243,245,248,.75); --row-on: #fff8ea;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-height: 100%; }

/* ---------- controls ---------- */
button { font: inherit; font-weight: 500; padding: 4px 12px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); cursor: pointer; border-radius: var(--radius-sm); transition: background .12s, border-color .12s, box-shadow .12s, color .12s; }
button:hover:not(:disabled) { background: var(--panel-3); border-color: var(--hover-border); }
button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-soft); border-color: var(--accent); }
button:disabled { color: var(--muted-2); cursor: default; background: var(--panel); }
button.sq { width: 28px; padding: 4px 0; }
button.w44 { width: 44px; padding: 4px 0; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
button.bold, .bold { font-weight: 650; }
input, select, textarea { font: inherit; border: 1px solid var(--border); padding: 4px 7px; background: var(--bg); color: var(--text); border-radius: var(--radius-sm); outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
select option { background: var(--panel); color: var(--text); }
input[type=checkbox], input[type=radio] { margin: 0 6px 0 0; vertical-align: middle; accent-color: var(--accent); width: 14px; height: 14px; padding: 0; }
input[type=range] { padding: 0; border: 0; accent-color: var(--accent); box-shadow: none; background: transparent; }
input.invalid { border: 1px solid var(--danger); background: var(--invalid-bg); }
input:disabled, select:disabled, textarea:disabled { background: var(--panel); color: var(--gray); }
h2 { font-size: 17px; font-weight: 600; margin: 2px 0 8px; letter-spacing: -.01em; }
b { font-weight: 650; }
a { color: var(--accent); } a:hover { color: var(--accent-2); }
.gray { color: var(--gray); } .dim { color: var(--dim); margin: 4px 0 8px; }
.pre { white-space: pre-wrap; } .mono { font-family: var(--mono); font-size: 13px; }
.grow { flex: 1 1 auto; min-height: 0; min-width: 0; }
.col { display: flex; flex-direction: column; min-height: 0; }
.hsplit { display: flex; flex-direction: row; min-height: 0; flex: 1 1 auto; }
.pane { min-width: 0; min-height: 0; position: relative; }
.pad4 { padding: 4px; } .pad6 { padding: 6px; } .pad8 { padding: 8px; } .pad16 { padding: 16px; }
.mb6 { margin-bottom: 6px; } .mb8 { margin-bottom: 8px; } .mt8 { margin-top: 8px; margin-bottom: 8px; } .mt12 { margin-top: 12px; } .mt14 { margin-top: 14px; padding: 6px 10px; }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; flex: none; background: var(--bar); border-bottom: 1px solid var(--border-soft); color: var(--dim); }
.toolbar.wrap { flex-wrap: wrap; } .toolbar.between { justify-content: space-between; }
.toolbar b { color: var(--text); font-weight: 600; }
.toolbar .chk { margin: 0 8px; }
.hint { color: var(--dim); padding: 4px 10px; flex: none; }
.summary { padding: 6px 10px; flex: none; color: var(--text-2); }
.scroll { overflow: auto; min-height: 0; }
.chart-host { position: relative; overflow: hidden; background: var(--canvas); }
.chk, .radio { display: inline-flex; align-items: center; white-space: nowrap; user-select: none; cursor: pointer; }
.radio { margin: 6px; }
textarea.mono { background: var(--canvas); color: var(--text-2); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-h); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- top bar: logo, project, workspaces, language, user ---------- */
#topbar { display: flex; align-items: stretch; gap: 0 16px; padding: 0 12px; background: var(--bar-2); border-bottom: 1px solid var(--border-soft); flex: none; min-height: 44px; user-select: none; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; }
/* js/layout.js: the tabs did not fit beside the brand and the user menu, so they get a row of their own. */
#topbar.stacked { flex-wrap: wrap; }
#topbar.stacked .brand, #topbar.stacked .top-right { min-height: 44px; }
#topbar.stacked .tabbar { order: 3; flex-basis: 100%; flex-wrap: wrap; margin: 0 -12px; padding: 0 4px; border-top: 1px solid var(--border-soft); }
#topbar.stacked .tabbar button { height: 36px; }
.brand-logo { width: 26px; height: 26px; border-radius: 6px; border: 2px solid var(--accent); color: var(--accent); display: grid; place-items: center; font: 600 10.5px var(--mono); flex: none; }
#topProject { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
#topAlign { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.tabbar { display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button { border: 0; border-radius: 0; background: transparent; padding: 0 12px; font-size: 12.5px; font-weight: 500; color: var(--dim); white-space: nowrap; }
.tabbar button:hover:not(:disabled) { background: transparent; color: var(--text); }
.tabbar button.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.tabbar button.extlink { color: var(--accent); }
.tabbar button.extlink::after { content: " ↗"; }
.tabbar button .badge { margin-left: 6px; color: var(--accent); font-family: var(--mono); font-size: 11px; }
.top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lang-menu { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.lang-current { display: flex; align-items: center; gap: 6px; }
.lang-menu .flag { width: 20px; height: 13px; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.18); display: block; }
.lang-code { font: 500 11px var(--mono); color: var(--dim); }
.lang-caret { width: 9px; height: 6px; fill: none; stroke: var(--dim); stroke-width: 1.5; }
.lang-list { min-width: 180px; }
.lang-item { display: flex; align-items: center; gap: 10px; }
.lang-list button.active { background: var(--accent-soft); color: var(--accent); }
.rsel { display: flex; align-items: center; gap: 6px; padding: 2px 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.rsel select { font: inherit; padding: 1px 4px; }
.lang button { border: 0; border-radius: 0; background: transparent; padding: 3px 8px; font: 500 11px var(--mono); color: var(--dim); }
.lang button + button { border-left: 1px solid var(--border); }
.lang button.active { background: var(--accent-soft); color: var(--accent); }
.theme-btn { display: grid; place-items: center; width: 30px; height: 26px; padding: 0; border-radius: 6px; background: transparent; color: var(--dim); }
.theme-btn:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); border-color: var(--border); }
.theme-btn svg.ic { width: 16px; height: 16px; }
.theme-btn .moon, :root[data-theme="light"] .theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-btn .moon { display: block; }
.admin-link { color: var(--accent); font-weight: 600; cursor: pointer; padding: 5px 8px; border-radius: 6px; white-space: nowrap; }
.admin-link:hover { background: var(--accent-soft); }

/* user menu (and other dropdowns) */
.menu { position: relative; padding: 5px 10px; cursor: default; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.menu:hover, .menu.open { background: var(--panel-2); }
.user-menu { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-3); color: var(--text); display: grid; place-items: center; font-size: 10.5px; font-weight: 600; }
.dropdown { display: none; position: absolute; left: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); z-index: 50; min-width: 250px; padding: 5px; font-weight: 400; color: var(--text); }
.menu.open > .dropdown { display: block; }
.dropdown.right { left: auto; right: 0; }
.dropdown button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 12px; white-space: nowrap; border-radius: 5px; font-weight: 400; }
.dropdown button:hover:not(:disabled) { background: var(--panel-3); border: 0; }
.dropdown button:disabled { background: none; }
.dropdown hr { border: 0; border-top: 1px solid var(--border-soft); margin: 4px 6px; }
kbd { font: 11px var(--mono); color: var(--gray); }

/* ---------- ribbon: grouped commands (replaces the menu bar) ---------- */
#ribbon { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; background: var(--panel); border-bottom: 1px solid var(--border-soft); flex: none; user-select: none; }
.rgroup { flex: none; display: flex; flex-direction: column; padding: 5px 8px 3px; border-right: 1px solid var(--border-soft); }
.rgroup-body { display: flex; gap: 2px; flex: 1; }
.rgroup-name { text-align: center; font-size: 10px; color: var(--gray); letter-spacing: .06em; text-transform: uppercase; padding-top: 3px; }
.rbig { min-width: 58px; height: 54px; padding: 4px 7px; border: 1px solid transparent; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11.5px; font-weight: 400; white-space: nowrap; border-radius: 5px; }
.rbig:hover:not(:disabled) { background: var(--panel-3); border-color: transparent; }
.rbig svg.ic { width: 21px; height: 21px; color: var(--icon); }
.rbig.accent svg.ic { color: var(--accent); }
.rbig.water svg.ic { color: var(--water); }
.rbig:disabled svg.ic { color: var(--icon-off); }
.rstack { display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.rsmall { display: flex; align-items: center; gap: 6px; padding: 2px 8px 2px 4px; height: 17px; box-sizing: content-box; border: 1px solid transparent; background: transparent; font-size: 11.5px; font-weight: 400; white-space: nowrap; border-radius: 4px; }
.rsmall:hover:not(:disabled) { background: var(--panel-3); border-color: transparent; }
.rsmall svg.ic { width: 15px; height: 15px; color: var(--icon-2); }
/* js/layout.js: denser ribbon when one row does not fit; icon-only small buttons keep their name as a tooltip. */
#ribbon.r-compact .rgroup { padding: 4px 4px 2px; }
#ribbon.r-compact .rbig { min-width: 46px; padding: 4px; font-size: 11px; }
#ribbon.r-compact .rsmall { padding: 2px 6px 2px 3px; font-size: 11px; }
#ribbon .rstack.icons .rsmall > span { display: none; }
#ribbon .rstack.icons .rsmall { padding: 2px 4px; }
#ribbon.r-tight .rgroup { padding: 4px 2px 2px; }
#ribbon.r-tight .rbig { min-width: 40px; padding: 4px 3px; }
.menu-new { font: 600 9px var(--mono); letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 4px; }

/* ---------- layout ---------- */
#main { flex: 1 1 auto; display: flex; min-height: 0; }
#treePane { width: 230px; min-width: 140px; background: var(--panel); overflow: auto; flex: none; border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; }
.pane-title { padding: 9px 12px; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--gray); border-bottom: 1px solid var(--border-soft); flex: none; }
#tree { padding: 6px 4px; }
.splitter.v { width: 5px; background: var(--bg); cursor: col-resize; flex: none; position: relative; }
.splitter.v::after { content: ""; position: absolute; left: 2px; top: 0; bottom: 0; width: 1px; background: var(--border-soft); transition: background .12s; }
.splitter.v:hover::after { background: var(--accent); }
.splitter.v.thick { width: 7px; }
#tabsPane { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.tab { display: none; flex: 1 1 auto; flex-direction: column; min-height: 0; background: var(--panel); overflow: hidden; }
.tab.active { display: flex; }
.section-title { font-weight: 600; color: var(--text); }
#statusbar { flex: none; display: flex; align-items: center; background: var(--bar-2); border-top: 1px solid var(--border-soft); padding: 0 12px; height: 26px; white-space: nowrap; overflow: hidden; color: var(--dim); font: 11.5px var(--mono); }
#statusbar .sep { width: 1px; height: 12px; background: var(--border); margin: 0 12px; }
#statusbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 7px; flex: none; }
#statusbar .dot.dirty { background: var(--accent); }
#stMsg { font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
#busyPanel { display: inline-flex; align-items: center; gap: 8px; }
#busyPanel[hidden] { display: none; }
#busyBar { width: 160px; height: 8px; accent-color: var(--accent); }

/* ---------- tree ---------- */
.tree ul { list-style: none; margin: 0; padding-left: 14px; }
.tree > ul { padding-left: 2px; }
.tree li > span { display: inline-block; padding: 3px 8px; cursor: default; white-space: nowrap; border-radius: 4px; color: var(--text-2); }
.tree li > span:hover { background: var(--panel-2); }
.tree li > span.sel { background: var(--panel-3); color: var(--strong); font-weight: 600; outline: 0; box-shadow: inset 2px 0 0 var(--accent); }
.tree .tog { width: 14px; display: inline-block; color: var(--tog); cursor: pointer; font-size: 10px; }
.tree .tog + span { padding-left: 4px; }

/* ---------- list box ---------- */
.listbox { border: 1px solid var(--border); background: var(--bg); overflow: auto; outline: none; border-radius: var(--radius-sm); margin: 0 4px; font-family: var(--mono); font-size: 12px; }
.listbox:focus { border-color: var(--accent); }
.listbox div { padding: 3px 8px; white-space: nowrap; cursor: default; color: var(--text-2); }
.listbox div:hover { background: var(--panel-2); }
.listbox div.sel { background: var(--sel); color: var(--strong); font-weight: 600; }
.listbox:focus div.sel { background: var(--accent); color: var(--accent-text); }

/* ---------- grid (row height 22 px is fixed in js/grid.js) ---------- */
.grid { display: flex; flex-direction: column; border: 1px solid var(--border-soft); background: var(--panel); outline: none; min-height: 60px; position: relative; }
.grid:focus-within { border-color: var(--selb); }
.grid-head { overflow: hidden; flex: none; background: var(--bar); border-bottom: 1px solid var(--border); }
.grid-body { overflow: auto; position: relative; flex: 1 1 auto; min-height: 0; font-family: var(--mono); font-size: 12px; }
.grid-spacer { position: absolute; left: 0; top: 0; width: 1px; }
.grid-rows { position: absolute; left: 0; top: 0; }
.grid-row { display: grid; position: absolute; left: 0; height: 22px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.grid-body .grid-row:hover:not(.sel) { background: var(--row-hover); }
.grid-header-row { position: relative; height: 24px; border-bottom: 0; }
.grid-cell { padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid transparent; line-height: 15px; }
.grid-cell.center { text-align: center; padding-top: 2px; }
.grid-hcell { border-right: 1px solid var(--border-soft); font-weight: 500; padding-top: 4px; color: var(--gray); font-size: 11.5px; }
.grid-header-row .grid-hcell { position: relative; }
.grid-col-grip { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; z-index: 1; }
.grid-col-grip:hover { background: var(--selb); opacity: .5; }
.grid-head-grouped { display: grid; grid-auto-rows: minmax(22px, auto); }
.grid-head-grouped .grid-hcell { display: flex; align-items: center; justify-content: center; text-align: center; white-space: normal;
  line-height: 14px; padding: 3px 4px; border-bottom: 1px solid var(--border-soft); overflow: hidden; }
/* Bo‘ylama profil: the layout of the existing/design levels Excel table, in the app's own colours. */
.grid-hcell.h-group { color: var(--text); font-weight: 600; }
.grid-hcell.h-design { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.grid-excel .grid-head-grouped .grid-hcell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.grid-excel .grid-body .grid-cell { border-right: 1px solid var(--line); text-align: center; }
.grid-hcell.h-name { color: var(--gray); font-weight: 500; }
.grid-row.sel { background: var(--sel); color: var(--strong); }
.grid-sink { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; }
.grid:focus-within .grid-row.sel { background: var(--sel-focus); color: var(--strong); }
.grid:focus-within .grid-row.sel .result { background: var(--sel-focus-2); }
.grid-row.newrow { background: var(--panel); }
.grid-cell.cur { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 2px; }
.grid:focus-within .grid-row.sel .grid-cell.cur { outline-color: var(--accent-2); }
.grid-cell.result { background: var(--result); color: var(--result-text); }
.grid-cell.manual-hc { color: var(--warn); font-weight: 650; }
.grid-cell.invalid { outline: 1px solid var(--danger); outline-offset: -1px; }
.grid-cell.lining-bad { background: var(--invalid-bg); color: var(--danger); font-weight: 600; }
/* Compact grid: centred cells, headers wrap onto two lines so the columns stay narrow. */
.grid-compact .grid-cell { text-align: center; padding-left: 2px; padding-right: 2px; }
.grid-compact .grid-header-row { height: 32px; }
.grid-compact .grid-hcell { display: flex; align-items: center; justify-content: center; white-space: normal; line-height: 12px; padding-top: 0; }
.grid-compact .grid-editor { text-align: center; padding: 2px 2px; }
.grid-editor { position: absolute; border: 2px solid var(--accent); padding: 2px 5px; z-index: 5; outline: none; border-radius: 3px; box-shadow: none; background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 12px; }
.grid-editor.invalid { border-color: var(--danger); background: var(--invalid-bg); }

/* ---------- dialogs ---------- */
.modal-back { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fadeIn .12s ease-out; }
.modal-back.nonmodal { background: transparent; backdrop-filter: none; pointer-events: none; }
.modal-back.nonmodal .modal { pointer-events: auto; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); max-width: 96vw; max-height: 94vh; display: flex; flex-direction: column; min-width: 300px; animation: popIn .14s ease-out; }
.modal-title { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 10px 16px; font-size: 13.5px; font-weight: 600; cursor: move; user-select: none; border-bottom: 1px solid var(--border-soft); background: var(--bar); border-radius: 10px 10px 0 0; }
.modal-x { border: 0; background: none; font-size: 20px; padding: 0 8px; line-height: 24px; color: var(--gray); border-radius: 5px; }
.modal-x:hover { background: var(--panel-3) !important; color: var(--text); border: 0; }
.modal-body { padding: 14px 16px 12px; overflow: auto; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border-soft); }
.modal-foot button { min-width: 88px; padding: 6px 16px; }
.msg { white-space: pre-wrap; max-width: 600px; padding-left: 44px; min-height: 34px; position: relative; line-height: 1.5; color: var(--text-2); }
.msg::before { content: "i"; position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--info-bg); color: var(--info); text-align: center; font: italic 700 17px/32px Georgia, serif; }
.msg.error::before { content: "✕"; background: rgba(248,113,113,.15); color: #f87171; font: 700 14px/32px system-ui; font-style: normal; }
.msg.warn::before { content: "!"; background: var(--accent-soft); color: var(--accent); font: 800 17px/32px system-ui; font-style: normal; }
.form { display: flex; flex-direction: column; gap: 6px; }
.form .form-sep { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-weight: 600; }
.frow { display: grid; grid-template-columns: 210px 1fr; align-items: center; gap: 8px; margin: 3px 0; }
.frow > span { color: var(--dim); font-weight: 500; }
.form2 { display: grid; grid-template-columns: 170px 1fr; align-items: center; row-gap: 6px; column-gap: 8px; color: var(--dim); }
.form2 [hidden] { display: none; }
fieldset.group { border: 1px solid var(--border-soft); border-radius: var(--radius); margin: 10px 0 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--panel-2); color: var(--text-2); }
fieldset.group legend { font-weight: 600; color: var(--gray); padding: 0 6px; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; }
fieldset.group input:not([type]) { margin: 2px 0 6px; }
.indent { margin-left: 18px !important; }
details summary { cursor: pointer; padding: 8px 0; font-weight: 600; color: var(--accent); }
.wrapline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 3px 0; }
.wrapline input:not([type]) { width: 65px; }
.orange { color: var(--accent); font-weight: 600; } .err { color: var(--err); }
.all-chart { margin: 8px; background: var(--canvas); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.all-chart .title { font-weight: 600; padding: 8px 12px 0; }
.all-chart .nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 12px 0; }
.all-chart .nav input:not([type]) { width: 75px; }
.all-chart .chart-host { flex: 1 1 auto; min-height: 240px; }
.all-chart .all-body { display: flex; height: 420px; }
.all-chart .all-tables { width: var(--all-tables-w, 380px); flex: none; display: flex; flex-direction: column; }
.all-chart .all-tables > .grow { min-height: 0; }
.all-chart .all-right { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
@media (max-width: 760px) { .all-chart .all-body { flex-direction: column; height: auto; } .all-chart .all-tables { width: auto; height: 360px; } .all-chart .splitter { display: none; } .all-chart .chart-host { height: 260px; } }
.tip { position: fixed; background: var(--tip-bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; white-space: pre-wrap; pointer-events: none; z-index: 200; max-width: 520px; box-shadow: var(--shadow-pop); font-size: 12px; }
.ctxmenu { position: fixed; z-index: 150; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 5px; min-width: 160px; }
.ctxmenu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 14px; border-radius: 5px; font-weight: 400; }
.ctxmenu button:hover { background: var(--panel-3); border: 0; }
.ctxmenu button.danger { color: var(--err); }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (max-width: 900px) {
  #treePane { width: 160px; }
  #topProject { max-width: 160px; } #topAlign { display: none; }
}

/* ---------- DWG survey import (js/dwgimport.js) ---------- */
.modal.dwg-modal { width: min(1500px, 96vw); height: min(940px, 92vh); }
.dwg-modal .modal-body { padding: 6px 16px 8px; }
.dwg { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
.dwg-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.dwg-field { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dwg-field > span:first-child { color: var(--dim); font-weight: 550; }
.dwg-field select { max-width: 300px; }
.dwg-field input.num { width: 72px; text-align: right; }
.dwg-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.dwg-chip { padding: 3px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border-soft); font-weight: 600; color: var(--dim); white-space: nowrap; }
.dwg-chip.accent { background: var(--accent-soft); border-color: var(--selb); color: var(--accent); }
.dwg-chip.warn { background: rgba(251,191,36,.12); border-color: var(--selb); color: var(--warn); }
.dwg-main { display: flex; gap: 10px; flex: 1 1 auto; min-height: 0; }
.dwg-plan { position: relative; flex: 1 1 auto; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at 1px 1px, var(--plan-dot) 1px, transparent 0) 0 0 / 22px 22px, var(--canvas); }
.dwg-plan canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.dwg-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.dwg-zoom button { width: 32px; height: 32px; padding: 0; font-size: 16px; box-shadow: var(--shadow); background: var(--float); }
.dwg-legend { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 12px; padding: 6px 10px; background: var(--float-2); border: 1px solid var(--border-soft); border-radius: 8px; box-shadow: var(--shadow); color: var(--dim); font-size: 11.5px; }
.dwg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dwg-legend i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.dwg-legend i.dash { background: repeating-linear-gradient(90deg, #9aa3b5 0 5px, transparent 5px 9px); }
.dwg-tip { position: absolute; pointer-events: none; background: var(--tip-bg); color: var(--strong); border: 1px solid var(--border); padding: 6px 9px; border-radius: 7px; font-size: 11.5px; line-height: 1.45; box-shadow: var(--shadow-pop); white-space: nowrap; }
.dwg-tip span { color: var(--dim); }
.dwg-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--veil); color: var(--dim); font-weight: 600; }
.dwg-loading i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--selb); border-top-color: var(--accent); animation: dwgSpin .8s linear infinite; }
@keyframes dwgSpin { to { transform: rotate(360deg); } }
.dwg-side { width: 360px; flex: none; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.dwg-quick { display: flex; gap: 6px; }
.dwg-quick button { flex: 1; }
.dwg-list { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.dwg-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.dwg-row:hover { background: var(--panel-2); }
.dwg-row.on { background: var(--row-on); }
.dwg-row.on:hover { background: var(--accent-soft); }
.dwg-row.active { box-shadow: inset 3px 0 0 var(--teal); }
.dwg-row:not(.on) .dwg-pk, .dwg-row:not(.on) .dwg-meta { color: var(--gray); }
.dwg-pk { width: 84px; font-weight: 650; font-variant-numeric: tabular-nums; padding: 2px 6px; border-color: transparent; background: transparent; }
.dwg-pk:hover { border-color: var(--border); background: var(--panel); }
.dwg-meta { color: var(--dim); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dwg-badge { margin-left: auto; font-size: 10.5px; font-weight: 650; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.dwg-badge:empty { display: none; }
.dwg-badge.muted { color: var(--gray); background: var(--panel-2); }
.dwg-badge.warn { color: var(--warn); background: rgba(251,191,36,.12); }
.dwg-prev-head { display: flex; align-items: baseline; gap: 4px; padding: 2px 2px 0; }
.dwg-prev { width: 100%; height: 170px; flex: none; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
.dwg-hint { color: var(--gray); font-size: 11.5px; }

.dwg-legend i.dot { width: 9px; height: 9px; border-radius: 50%; }
.dwg-field input.num::placeholder { color: var(--muted-2); }

/* Yer ishlari: «Пикетаж»-style statement (section rows with areas, interval rows with volumes). */
#ewGrid { overflow: auto; border: 1px solid var(--border); background: var(--panel); }
table.ew { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
table.ew th, table.ew td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 3px 6px; text-align: center; white-space: nowrap; }
table.ew thead th { position: sticky; background: var(--panel-2); color: var(--text); font-weight: 600; white-space: normal; vertical-align: middle; z-index: 1; }
table.ew thead tr:nth-child(3) th { min-width: 70px; font-weight: 500; font-size: 11px; }
table.ew th.ew-title { font-weight: 700; }
table.ew th.ew-rot { min-width: 34px; }
table.ew th.ew-rot span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; }
table.ew td.num { font-variant-numeric: tabular-nums; }
table.ew tr.ew-gap td { color: var(--dim); }
table.ew tr.ew-gap td.num { color: var(--text); }
table.ew tr.ew-pk td:first-child, table.ew tr.ew-pk td:nth-child(2) { font-weight: 600; }
table.ew tr.ew-err td { color: var(--err); }
table.ew tr.ew-sub td { font-weight: 700; }
table.ew tr.ew-total td { font-weight: 700; background: var(--panel-2); position: sticky; bottom: 0; }
table.ew tbody tr:hover td { background: var(--panel-3); }

/* ---------- built-in calculators (js/calcs) ---------- */
.calc-host { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 16px 16px; }
.calc-appbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 12px; }
.calc-appbar b { font-size: 15px; }
.calc-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; max-width: 900px; }
.calc-menu-btn { padding: 14px 16px; text-align: left; font-size: 14px; border-radius: var(--radius); background: var(--panel); }
.calc-menu-btn:hover:not(:disabled) { background: var(--panel-3); border-color: var(--accent); }
.calc-form { display: grid; grid-template-columns: minmax(300px, 380px) minmax(320px, 520px); gap: 16px; align-items: start; max-width: 940px; }
@media (max-width: 860px) { .calc-form { grid-template-columns: 1fr; } }
.calc-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 14px; margin-bottom: 12px; }
.calc-card-title { font-weight: 650; color: var(--text); margin-bottom: 8px; }
.calc-grid { display: grid; grid-template-columns: minmax(120px, 1fr) 96px 52px; align-items: center; gap: 6px 8px; color: var(--dim); }
.calc-grid [hidden] { display: none; }
.calc-grid input, .calc-grid select { width: 100%; min-width: 0; }
.calc-grid select { grid-column: 2 / span 2; }
.calc-label { text-align: right; color: var(--text-2); }
.calc-unit { color: var(--gray); font-size: 12px; }
.calc-grid-res input { background: var(--result); color: var(--result-text); font-variant-numeric: tabular-nums; font-weight: 600; }
.calc-group-title { font-weight: 600; margin: 6px 0; }
.calc-g-normal { color: var(--danger); } .calc-g-crit { color: var(--info); }
.calc-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.calc-mode { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); cursor: pointer; color: var(--dim); }
.calc-mode.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.calc-mode-title { font-size: 20px; font-weight: 650; margin-bottom: 10px; }
.calc-actions { margin: 4px 0 8px; } .calc-run { min-width: 160px; padding: 8px 18px; }
.calc-status { min-height: 20px; color: var(--dim); } .calc-status.err { color: var(--err); }
.calc-figure { margin-top: 12px; color: var(--dim); } .calc-svg { width: 100%; max-width: 300px; height: auto; display: block; }
.calc-table { border-collapse: collapse; width: 100%; max-width: 720px; }
.calc-table th, .calc-table td { border: 1px solid var(--border-soft); padding: 5px 9px; text-align: left; }
.calc-table th { background: var(--panel-2); color: var(--text-2); font-weight: 600; }
.calc-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
.mc3-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.mc3-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-width: 1000px; }
.mc3-groups .calc-menu-btn { display: block; width: 100%; margin: 4px 0; padding: 8px 12px; font-size: 13px; }
.mc3-page { max-width: 520px; } .mc3-radio { display: flex; align-items: center; gap: 6px; padding: 4px 0; cursor: pointer; }
.mc3-grid { grid-template-columns: minmax(150px, 1fr) minmax(130px, 1.1fr) 90px; }

/* Ko'ndalang kesim toolbar: AutoCAD export + PK range */
#secCad, #profCad { display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; white-space: nowrap; }
#secCad svg.ic, #profCad svg.ic { width: 16px; height: 16px; }
#tab-sections .toolbar > label:not(.radio), #tab-profile .toolbar > label { display: inline-flex; align-items: center; line-height: 1.2; white-space: nowrap; }
#tab-sections .toolbar > select, #tab-profile .toolbar > select { margin: 0; }

.pkrange { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.pkrange label { display: inline-flex; align-items: center; line-height: 1.2; }
.pkrange select { margin: 0; }

.sec-addrow { display: flex; gap: 6px; }
.sec-addrow button { flex: 1; font-weight: 700; font-size: 16px; line-height: 1; padding: 4px 0; }

/* Drop-down cells: a chevron is visible without clicking */
.grid-cell.has-select { position: relative; padding-right: 22px; cursor: pointer; }
.grid-cell.has-select::after { content: ''; position: absolute; right: 8px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.6px solid var(--dim); border-bottom: 1.6px solid var(--dim); transform: rotate(45deg); pointer-events: none; opacity: .8; }

/* CAD settings: compact groups */
.cad-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.cad-group { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.cad-group:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.cad-group:last-child .cad-group-title { grid-column: 1 / -1; }
.cad-group-title { font-weight: 600; color: var(--text); font-size: 12px; margin-bottom: 2px; }
.cad-group .frow { grid-template-columns: 120px 1fr; margin: 1px 0; min-width: 0; }
.cad-group .pair { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cad-group .pair input { min-width: 0; flex: 1; }

.dwg-row.hot { background: var(--accent-soft); box-shadow: inset 3px 0 0 #f59e0b; }

.dwg-find { margin: 4px 0; padding: 5px 8px; width: 100%; box-sizing: border-box; }
.dwg-find.invalid { outline: 1px solid var(--danger); }

.dwg-selbar { position: absolute; top: 10px; left: 10px; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px;
  background: var(--panel); border: 1px solid #22d3ee; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.dwg-selbar[hidden] { display: none; }

/* Searchable drop-down (core.js searchableSelect) */
.ss-wrap { position: relative; display: inline-block; }
.ss-input { width: 110px; padding-right: 22px; cursor: pointer; }
.ss-wrap::after { content: ''; position: absolute; right: 9px; top: 50%; width: 5px; height: 5px; margin-top: -4px; pointer-events: none;
  border-right: 1.6px solid var(--dim); border-bottom: 1.6px solid var(--dim); transform: rotate(45deg); }
.ss-list { position: absolute; z-index: 60; top: calc(100% + 2px); left: 0; min-width: 100%; max-height: 260px; overflow: auto; padding: 3px 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.ss-list[hidden] { display: none; }
.ss-item, .ss-empty { padding: 4px 12px; white-space: nowrap; cursor: pointer; color: var(--text); }
.ss-item.sel { font-weight: 650; }
.ss-item.hot, .ss-item:hover { background: var(--accent-soft); }
.ss-empty { color: var(--dim); cursor: default; }

/* Gidromodul tab */
.gm-page { overflow: auto; max-width: 980px; }
.gm-fields { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; }
.gm-field { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 12px; }
.gm-field select, .gm-field input { min-width: 150px; }
.gm-mt { margin-top: 10px; }
.gm-info { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.gm-dim { color: var(--dim); font-size: 12px; }
.gm-crops { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.gm-crop { display: grid; grid-template-columns: 32px 150px 70px 110px 1fr; gap: 8px; align-items: center; }
.gm-crop input[type=text] { width: 100%; box-sizing: border-box; }
.gm-crop-head { color: var(--dim); font-size: 12px; }
.gm-period { display: inline-flex; align-items: center; gap: 4px; }
.gm-kpi { display: flex; flex-wrap: wrap; gap: 28px; margin-bottom: 10px; }
.gm-kpi > div { display: flex; flex-direction: column; gap: 2px; }
.gm-kpi b { font-size: 22px; color: var(--accent, #f2a93b); }
.gm-chart { margin: 4px 0 10px; color: var(--text); }
.gm-tablewrap { overflow-x: auto; }
.gm-sum td { font-weight: 650; }
.gm-peak { color: var(--accent, #f2a93b); }
.gm-note { margin-top: 8px; color: var(--err, #e5736a); }
.gm-foot { margin-top: 10px; line-height: 1.45; }

.gm-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gm-custom select { max-width: 190px; }

.gm-kpi b.gm-min { color: var(--text); }

.gm-graph2 { margin: 6px 0 12px; }

.gm-wt input { text-align: right; }
.gm-wt td, .gm-wt th { white-space: nowrap; }
.gm-dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.gm-b { font-weight: 700; }
.gm-neg { color: #d94452; }
.gm-pos { color: #3fae6a; }
.gm-warn { margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: rgba(242,169,59,.14); color: var(--accent, #f2a93b); }

.gm-demand-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.gm-wt th.num { text-align: right; }

.gm-ordsets { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--dim); font-size: 12px; align-items: center; }
.gm-ordset { display: inline-flex; align-items: center; gap: 4px; }
.gm-ordset input { text-align: right; }
.gm-mb { margin-bottom: 8px; }
.gm-demand-bar { gap: 12px; align-items: flex-start; justify-content: space-between; }

.gm-tabs { display: flex; flex-wrap: wrap; gap: 4px 22px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.gm-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 2px; color: var(--dim); font-size: 14px; cursor: pointer; }
.gm-tabs button:hover { color: var(--text); }
.gm-tabs button.active { color: var(--accent, #f2a93b); border-bottom-color: var(--accent, #f2a93b); font-weight: 650; }
.gm-guide-item { margin-bottom: 12px; line-height: 1.5; }
.gm-guide-item b { display: block; margin-bottom: 2px; }

/* Gidromodul tables: use the whole width, headers wrap, no horizontal scrolling */
.gm-page { max-width: none; }
.gm-wt { width: 100%; table-layout: auto; }
.gm-wt th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.gm-wt td, .gm-wt th { padding-left: 6px; padding-right: 6px; }
.gm-wt td:first-child, .gm-wt th:first-child { white-space: nowrap; }
.gm-wt input { width: 100% !important; min-width: 44px; box-sizing: border-box; padding-left: 6px; padding-right: 6px; }
.gm-tablewrap { overflow-x: auto; }

.gm-wt { max-width: none; }

.gm-name { display: inline-block; min-width: 130px; }
.gm-custom > input[type=checkbox] { margin-right: 4px; }

/* Loyiha hujjati (dossier) */
.dz-badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; margin-left: 8px; border: 1px solid var(--border); }
.dz-ok { color: #2e9d57; border-color: #2e9d57; } .dz-warn { color: #d99a1a; border-color: #d99a1a; } .dz-bad { color: #d9534f; } .dz-dim { color: var(--dim); }
.dz-badge.dz-bad { border-color: #d9534f; }
.dz-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; }
.dz-click { cursor: pointer; } .dz-caret { margin-left: auto; color: var(--dim); }
.dz-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 8px; }
.dz-chk { display: inline-flex; align-items: center; gap: 4px; }
.dz-file { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 3px 0; }
.dz-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.dz-text { width: 100%; box-sizing: border-box; font: 13px/1.5 var(--mono, ui-monospace, monospace); }
.dz-job { border: 1px solid var(--accent, #f2a93b); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.dz-prog { height: 6px; background: var(--border); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.dz-prog > div { height: 100%; background: var(--accent, #f2a93b); transition: width .4s; }
.dz-big { height: 10px; margin: 10px 0 14px; }
.dz-q { margin: 10px 0; padding: 8px 12px; border-left: 3px solid #d99a1a; background: rgba(217,154,26,.07); }
.dz-qrow { margin: 8px 0; } .dz-qrow input { min-width: 260px; }
.dz-excl { padding: 8px 12px; border-left: 3px solid var(--dim); }
.dz-prob { padding: 6px 10px; margin: 4px 0; border-left: 3px solid #d99a1a; cursor: pointer; }
.dz-prob.dz-bad { border-left-color: #d9534f; color: inherit; } .dz-prob:hover { background: rgba(127,127,127,.1); }
.dz-ok-line { color: #2e9d57; } .dz-chk-line { padding: 2px 0; cursor: default; }
.dz-chk-line.dz-bad { cursor: pointer; }
.dz-hist { max-height: 340px; overflow: auto; font-size: 13px; line-height: 1.6; }
.dz-ver { margin: 3px 0; }

.dz-comments { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.dz-comment { margin: 4px 0; padding: 4px 8px; border-left: 3px solid #d99a1a; }
.dz-comment button { margin-left: 8px; }
.dz-resolved { opacity: .55; border-left-color: #2e9d57; text-decoration: line-through; }

.dz-sec { margin: 0; padding-left: 18px; line-height: 1.6; font-size: 13px; }

/* Tabs switched off for now */
#tabbar button.tab-off { opacity: .4; cursor: not-allowed; pointer-events: auto; }
#tabbar button.tab-off::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 9V7a5 5 0 0 0-10 0v2H5v13h14V9h-2zM9 7a3 3 0 0 1 6 0v2H9V7z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 9V7a5 5 0 0 0-10 0v2H5v13h14V9h-2zM9 7a3 3 0 0 1 6 0v2H9V7z'/%3E%3C/svg%3E") center/contain no-repeat; }

/* «Polka qo'yish» button over the outer slope of the design line */
.chart-host .bench-btn { position: absolute; z-index: 5; padding: 3px 9px; font-size: 12px; border-radius: 4px; cursor: pointer;
  background: var(--accent, #2563eb); color: #fff; border: 1px solid rgba(255,255,255,.35); box-shadow: 0 2px 8px rgba(0,0,0,.35); white-space: nowrap; }
.chart-host .bench-btn[hidden] { display: none; }
