/* ============ Print Checker — стили ============ */
:root {
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efeb;
  --line: #e4e3dc;
  --line-2: #d3d2ca;
  --text: #121212;
  --text-2: #52514e;
  --muted: #8a8980;
  --accent: #2f5bea;
  --accent-ink: #fff;
  --accent-soft: #e8eefe;
  --side: #151821;
  --side-2: #1e2230;
  --side-text: #c9ccd6;
  /* статусы (фиксированная палитра) */
  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #d03b3b;
  --blue: #2a78d6;
  --violet: #6250d6;
  --gray: #9a998f;
  --good-soft: #e3f5e3;
  --warn-soft: #fff3d6;
  --crit-soft: #fbe5e5;
  --blue-soft: #e4effb;
  --violet-soft: #ecebfb;
  --gray-soft: #ecebe6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 20, 15, .05), 0 4px 16px rgba(20, 20, 15, .05);
  --shadow-lg: 0 10px 40px rgba(10, 10, 20, .18);
  --font: "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Roboto Mono", ui-monospace, monospace;
  --side-w: 240px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f1013;
  --surface: #1a1a19;
  --surface-2: #232321;
  --line: #2c2c2a;
  --line-2: #3a3a37;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8d8c84;
  --accent: #5b82ff;
  --accent-soft: #1f2a4a;
  --side: #0b0c10;
  --side-2: #161821;
  --blue: #3987e5;
  --violet: #9085e9;
  --good-soft: #15301a;
  --warn-soft: #3a2f12;
  --crit-soft: #3d1b1b;
  --blue-soft: #16273d;
  --violet-soft: #241f45;
  --gray-soft: #2a2a28;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 26px; height: 26px; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hide { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- каркас ---------- */
#app { display: flex; min-height: 100vh; }
#sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 22px; color: #fff; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3d6bff, #7b4dff); box-shadow: 0 6px 18px rgba(80, 90, 255, .35); }
.brand-logo svg { width: 26px; height: 26px; }
.brand b { display: block; font-size: 16px; letter-spacing: .2px; }
.brand small { display: block; color: #8b90a0; font-size: 12px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
#nav .sep { height: 1px; background: #262a38; margin: 10px 8px; }
#nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--side-text); font-weight: 500; font-size: 14.5px; position: relative;
}
#nav a:hover { background: var(--side-2); color: #fff; }
#nav a.on { background: linear-gradient(90deg, rgba(61, 107, 255, .28), rgba(61, 107, 255, .08)); color: #fff; }
#nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #5b82ff; }
#nav .badge { margin-left: auto; background: #2b3043; color: #dfe3f0; font-size: 12px; padding: 1px 8px; border-radius: 20px; font-weight: 600; }
#nav .badge.hot { background: var(--crit); color: #fff; }
.side-foot { border-top: 1px solid #262a38; padding-top: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 8px; border-radius: 10px; cursor: pointer; text-align: left; color: #fff; }
.side-user:hover { background: var(--side-2); }
.side-user small { display: block; color: #8b90a0; font-size: 12px; }

#main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }
#topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
#page-title { font-size: 20px; margin: 0; font-weight: 650; letter-spacing: -.2px; white-space: nowrap; }
.top-search { position: relative; margin-left: auto; width: min(420px, 40vw); }
.top-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.top-search input { width: 100%; padding: 9px 12px 9px 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.top-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 60vh; overflow: auto; padding: 6px; }
.search-pop a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; }
.search-pop a:hover, .search-pop a.sel { background: var(--surface-2); }
.search-pop .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 8px 10px 4px; }
.sync { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.sync.off i { background: var(--crit); box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 22%, transparent); }
.sync.pulse i { animation: pulse 1s ease; }
@keyframes pulse { 50% { transform: scale(1.8); } }
#view { padding: 24px 28px 60px; max-width: 1480px; width: 100%; }
#tabbar, #fab, .only-mobile, .icon-btn.only-mobile { display: none; }

/* ---------- элементы ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  cursor: pointer; font-weight: 550; font-size: 14px; white-space: nowrap; transition: .15s; min-height: 38px;
}
.btn:hover { border-color: var(--text-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--crit); }
.btn.danger.solid { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.btn-group { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--surface); }
.btn-group button { border: 0; background: none; padding: 7px 11px; cursor: pointer; color: var(--text-2); display: flex; align-items: center; gap: 6px; font-weight: 550; font-size: 13.5px; }
.btn-group button.on { background: var(--accent-soft); color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-h .act { margin-left: auto; display: flex; gap: 6px; }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
.grid > *, .stack > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; font-size: 17px; font-weight: 650; }
.section-title .cnt { color: var(--muted); font-weight: 500; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 20px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pill svg.i { width: 14px; height: 14px; stroke-width: 2.2; }
.pill.good { background: var(--good-soft); color: color-mix(in srgb, var(--good) 75%, var(--text)); }
.pill.warn { background: var(--warn-soft); color: color-mix(in srgb, #b07400 85%, var(--text)); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pill.gray { background: var(--gray-soft); color: var(--text-2); }
.pill.serious { background: color-mix(in srgb, var(--serious) 18%, var(--surface)); color: color-mix(in srgb, var(--serious) 70%, var(--text)); }
[data-theme="dark"] .pill.warn { color: var(--warn); }
[data-theme="dark"] .pill.good { color: #4fd34f; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 7px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: #5b6bd6; flex: none; text-transform: uppercase; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 550; }
.field label .req { color: var(--crit); }
.input, .field input, .field select, .field textarea, select.input {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  outline: none; min-height: 40px;
}
.field textarea { min-height: 84px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input { width: auto; min-width: 150px; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search .input { width: 100%; padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 9px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 550; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* ---------- KPI ---------- */
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; position: relative; overflow: hidden; cursor: pointer; transition: transform .15s; }
.kpi:hover { transform: translateY(-2px); }
.kpi .k-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi .k-val { font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .k-lbl { color: var(--text-2); font-size: 13.5px; font-weight: 550; }
.kpi .k-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.hero {
  border-radius: 18px; padding: 22px 26px; color: #fff; margin-bottom: 20px; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 90% -60%, rgba(123, 77, 255, .55), transparent 60%),
              linear-gradient(120deg, #1a2140, #22306a 55%, #2f5bea);
}
.hero h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.3px; }
.hero p { margin: 0; color: #c8d1f5; }
.hero .hero-act { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .2); }
.hero .btn.primary { background: #fff; color: #1a2140; border-color: #fff; }
.hero-deco { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); opacity: .9; }

/* ---------- графики ---------- */
.seg-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin: 6px 0 14px; }
.seg-bar > span { height: 100%; min-width: 4px; cursor: pointer; transition: filter .15s; }
.seg-bar > span:first-child { border-radius: 4px 0 0 4px; }
.seg-bar > span:last-child { border-radius: 0 4px 4px 0; }
.seg-bar > span:hover { filter: brightness(1.1) saturate(1.2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.legend .li { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.legend .li b { color: var(--text); font-variant-numeric: tabular-nums; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.stock-row { display: grid; grid-template-columns: 130px 1fr 52px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.stock-row:last-child { border-bottom: 0; }
.stock-row:hover .stock-name { color: var(--accent); }
.stock-name { font-weight: 600; font-size: 13.5px; }
.stock-bar { display: flex; gap: 2px; height: 22px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.stock-bar span { height: 100%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; min-width: 18px; }
.stock-bar span.warn { color: #0b0b0b; }
.stock-total { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.donut-wrap { display: flex; gap: 20px; align-items: center; }
.donut-wrap svg { flex: none; }
.tip { position: fixed; z-index: 200; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12.5px; padding: 6px 9px; border-radius: 7px; box-shadow: var(--shadow-lg); white-space: nowrap; }

/* ---------- техника ---------- */
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.dev-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: .15s; position: relative; }
.dev-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 8px 26px rgba(20, 20, 40, .09); }
.dev-card .top { display: flex; gap: 12px; align-items: flex-start; }
.dev-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; position: relative; }
.dev-ico .st { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--surface); }
.dev-card .name { font-weight: 650; line-height: 1.25; }
.dev-card .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dev-card .loc { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.dev-card .tasks-badge { position: absolute; top: 12px; right: 12px; background: var(--crit); color: #fff; border-radius: 20px; font-size: 11.5px; font-weight: 700; padding: 1px 8px; }
.group-h { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; font-weight: 650; }
.group-h:first-child { margin-top: 0; }
.group-h .cnt { color: var(--muted); font-weight: 500; font-size: 13px; }
.group-h .line { flex: 1; height: 1px; background: var(--line); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tr.checked td { background: var(--accent-soft); }
.tbl-wrap { overflow-x: auto; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ---------- карточка аппарата ---------- */
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13.5px; margin-bottom: 12px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--accent); }
.obj-head { display: flex; gap: 18px; align-items: flex-start; padding: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.obj-head .dev-ico { width: 64px; height: 64px; border-radius: 16px; }
.obj-head .dev-ico svg { width: 32px; height: 32px; }
.obj-head h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.3px; }
.obj-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-basis: 100%; margin: -4px 0 0 82px; }
dl.props { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; margin: 0; font-size: 14px; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; word-break: break-word; }
.qr-box { display: flex; gap: 16px; align-items: center; }
.qr-box svg { width: 120px; height: 120px; border-radius: 8px; border: 1px solid var(--line); flex: none; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 15px; top: 40px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tl-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; z-index: 1; }
.timeline .tl-ico svg { width: 15px; height: 15px; }
.timeline .tl-b { min-width: 0; font-size: 14px; }
.timeline .tl-t { font-size: 12.5px; color: var(--muted); }
.timeline .tl-d { color: var(--text-2); word-break: break-word; }
.mini-list { display: flex; flex-direction: column; }
.mini-list > a, .mini-list > div.it, .mini-list > label.it { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.mini-list > a:last-child, .mini-list > div.it:last-child, .mini-list > label.it:last-child { border-bottom: 0; }
.mini-list > a:hover { background: var(--surface-2); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg.i { width: 40px; height: 40px; stroke-width: 1.3; margin-bottom: 8px; opacity: .6; }
.empty.sm { padding: 18px; }

/* ---------- канбан ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; border: 1px solid var(--line); transition: .15s; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col-h { min-height: 46px; display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-weight: 650; }
.col-h .cnt { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 0 9px; font-size: 12.5px; color: var(--text-2); }
.col-h .bar { width: 4px; height: 16px; border-radius: 3px; }
.col-h .add { margin-left: auto; }
.col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 10px 14px; cursor: grab; position: relative; box-shadow: var(--shadow); transition: .12s; }
.task:hover { border-color: var(--line-2); }
.task.dragging { opacity: .45; transform: rotate(1.5deg); }
.task::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--prio, transparent); }
.task .t-title { font-weight: 600; line-height: 1.3; margin: 6px 0 6px; }
.task .t-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.task .t-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.task .t-foot .next { margin-left: auto; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.overdue { color: var(--crit) !important; font-weight: 600; }

/* ---------- локации ---------- */
.bld { margin-bottom: 20px; }
.bld-h { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.bld-h .b-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.bld-h h3 { margin: 0; font-size: 17px; }
.bld-stats { display: flex; gap: 18px; margin-left: auto; text-align: center; }
.bld-stats b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.bld-stats small { color: var(--muted); font-size: 12px; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding: 0 18px 18px; }
.room { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; cursor: pointer; background: var(--surface); transition: .15s; display: flex; flex-direction: column; gap: 7px; }
.room:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.room .r-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.room .r-dept { font-size: 12.5px; color: var(--text-2); }
.room .r-devs { display: flex; gap: 4px; flex-wrap: wrap; }
.room .r-dev { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; }
.room .r-dev svg { width: 15px; height: 15px; }
.room.add { border-style: dashed; color: var(--muted); align-items: center; justify-content: center; min-height: 90px; }
.floor-h { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 4px 6px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.floor-h:first-child { margin-top: 0; border-top: 0; }
.floor-h b { white-space: nowrap; }
.floor-h .muted { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fl-badge { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.fl-act { margin-left: auto; display: flex; gap: 2px; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.danger:hover { color: var(--crit); background: var(--crit-soft); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.room.add { min-height: 64px; flex-direction: row; gap: 6px; font-size: 14px; }
.bld-act { display: flex; gap: 6px; align-items: center; }
/* палитра */
.cpick { display: flex; flex-direction: column; gap: 12px; }
.cp-top { display: flex; gap: 10px; align-items: center; }
.cp-prev { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: background .15s; }
.cp-top .input { width: 120px; flex: none; text-transform: lowercase; }
.cp-top .input.bad { border-color: var(--crit); box-shadow: 0 0 0 3px var(--crit-soft); }
.cp-native { position: relative; overflow: hidden; }
.cp-native input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.cp-sw { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; }
.cp-sw .sw { aspect-ratio: 1; border-radius: 10px; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .12s; }
.cp-sw .sw:hover { transform: scale(1.08); }
.cp-sw .sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

/* ---------- модальные окна ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 20, .45); display: grid; place-items: center; padding: 20px; animation: fade .15s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { width: min(820px, 100%); }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin-top: 10px; }
.pick { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); text-align: left; width: 100%; }
.pick:hover { border-color: var(--accent); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick .dev-ico { width: 38px; height: 38px; border-radius: 10px; }

#toasts { position: fixed; z-index: 300; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1b1e2a; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-weight: 550; animation: pop .2s; max-width: 90vw; }
.toast.err { background: var(--crit); }
.toast svg { color: #6ee36e; }
.toast.err svg { color: #fff; }

/* ---------- печать наклеек ---------- */
#print-sheet { display: none; }
.labels-preview { display: flex; flex-wrap: wrap; gap: 10px; }
.lbl { width: 62mm; height: 30mm; border: 1px dashed #bbb; border-radius: 3px; padding: 2mm; display: flex; gap: 2.5mm; align-items: center; background: #fff; color: #000; overflow: hidden; break-inside: avoid; }
.lbl svg { width: 26mm; height: 26mm; flex: none; }
.lbl .l-txt { font-size: 8.5pt; line-height: 1.2; min-width: 0; }
.lbl .l-org { font-size: 6.5pt; text-transform: uppercase; letter-spacing: .3px; color: #555; }
.lbl .l-inv { font-size: 12pt; font-weight: 800; font-family: var(--mono); margin: .5mm 0; }
.lbl .l-name { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lbl .l-room { font-size: 7.5pt; color: #333; }
.lbl.small { width: 40mm; height: 22mm; padding: 1.5mm; gap: 1.5mm; }
.lbl.small svg { width: 19mm; height: 19mm; }
.lbl.small .l-inv { font-size: 9pt; }
.lbl.small .l-name { font-size: 6.5pt; -webkit-line-clamp: 2; }
.lbl.small .l-org, .lbl.small .l-room { display: none; }
@media print {
  body > *:not(#print-sheet) { display: none !important; }
  #print-sheet { display: flex !important; flex-wrap: wrap; gap: 2mm; }
  #print-sheet .lbl { border: .2mm solid #999; }
  @page { margin: 8mm; }
}

/* ---------- подсказки моделей ---------- */
.sg-wrap { position: relative; }
.sg-pop { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 5; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; max-height: 360px; overflow-y: auto; }
.sg-it { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 9px; border-radius: 9px; cursor: pointer; }
.sg-it.on, .sg-it:hover { background: var(--accent-soft); }
.sg-ico { width: 34px !important; height: 34px !important; border-radius: 9px !important; background: var(--surface-2); color: var(--text-2); }
.sg-ico svg { width: 18px; height: 18px; }
.sg-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-use { color: var(--good); font-weight: 600; }
.sg-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 2px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 12.5px; }
.sg-foot button, .link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; display: inline-flex; gap: 4px; align-items: center; font-weight: 600; font-size: 12.5px; padding: 0; }
.sg-note { color: var(--good); display: flex; gap: 5px; align-items: center; font-weight: 550; }
.sg-note:empty { display: none; }
mark { background: color-mix(in srgb, var(--warn) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

.cred { display: flex; gap: 16px; align-items: center; }
.cred-qr svg { width: 110px; height: 110px; border-radius: 8px; border: 1px solid var(--line); }
.cred dl.props { grid-template-columns: 70px 1fr; flex: 1; }

/* ---------- срочность ---------- */
.pbars { flex: none; }
.prio-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.prio-seg button { flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 10px 12px; }
.prio-seg button span { display: flex; flex-direction: column; line-height: 1.25; }
.prio-seg button small { color: var(--muted); font-weight: 450; font-size: 12px; }
.prio-seg button.on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 12%, var(--surface)); color: var(--text); box-shadow: 0 0 0 1px var(--pc) inset; }
.prio-quick button { flex-direction: row; align-items: center; padding: 8px 10px; }
.pill .pbars rect[fill="var(--line-2)"] { fill: color-mix(in srgb, currentColor 22%, transparent); }

/* ---------- вход ---------- */
#auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  background: radial-gradient(900px 500px at 85% -10%, rgba(123, 77, 255, .45), transparent 60%),
              radial-gradient(700px 500px at -10% 110%, rgba(47, 91, 234, .45), transparent 60%), #12152a; }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: 22px; padding: 28px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.auth-card h2 { margin: 22px 0 4px; font-size: 24px; letter-spacing: -.3px; }
.auth-card > p { margin: 0 0 20px; font-size: 14px; }
.auth-logo { display: flex; gap: 12px; align-items: center; }
.auth-logo b { display: block; font-size: 17px; }
.auth-logo small { color: var(--muted); font-size: 12.5px; }
.auth-err { background: var(--crit-soft); color: var(--crit); padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 550; }
.auth-card input { font-size: 16px; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 280px); overflow-x: auto; padding-bottom: 10px; }
}
@media (max-width: 860px) {
  body { font-size: 15.5px; }
  /* iOS увеличивает страницу при фокусе на поле со шрифтом меньше 16px */
  input, select, textarea, .input { font-size: 16px !important; }
  #sidebar { display: none; }
  #main { margin-left: 0; }
  .only-mobile { display: inline-grid; }
  #topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); gap: 8px; flex-wrap: wrap; }
  #page-title { font-size: 18px; flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .top-search { order: 10; width: 100%; margin: 0; }
  .sync span { display: none; }
  .only-desktop { display: none; }
  #view { padding: 14px 14px 110px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid { gap: 12px; }
  .kpi { padding: 12px; gap: 10px; flex-direction: column; }
  .kpi .k-ico { width: 36px; height: 36px; border-radius: 10px; }
  .kpi .k-val { font-size: 25px; }
  .hero { padding: 18px; border-radius: 16px; }
  .hero h2 { font-size: 20px; }
  .hero-deco { display: none; }
  .dev-grid { grid-template-columns: 1fr; gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 8px; }
  .toolbar .input { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .toolbar .search { flex-basis: 100%; }
  dl.props { grid-template-columns: 120px 1fr; }
  .obj-head { padding: 16px; gap: 14px; }
  .obj-actions { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
  .obj-actions .btn.primary { grid-column: 1 / -1; }
  .bld-act { position: absolute; top: 12px; right: 10px; }
  .bld-h > div:nth-child(2) { padding-right: 120px; }
  .cp-sw { grid-template-columns: repeat(6, 1fr); }
  .fl-act .icon-btn.sm { width: 34px; height: 34px; }
  .floor-h { gap: 6px; }
  .mod-intro .k-ico { display: none !important; }
  .mod-intro .grow { flex-basis: 100%; }
  .mod-intro .muted { display: none; }
  .mod-intro .btn { width: 100%; }
  .prio-seg { grid-template-columns: 1fr 1fr; }
  .cred { flex-direction: column; align-items: stretch; }
  .cred-qr { text-align: center; }
  .tbl.resp, .tbl.resp tbody { display: block; }
  .qr-box { flex-wrap: wrap; }
  .board { grid-template-columns: repeat(4, 86vw); scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 10px; gap: 10px; }
  .col { scroll-snap-align: center; }
  .bld-h { flex-wrap: wrap; }
  .bld-stats { margin-left: 0; width: 100%; justify-content: space-around; }
  .rooms { grid-template-columns: 1fr 1fr; padding: 0 12px 12px; }
  .stock-row { grid-template-columns: 92px 1fr 40px; gap: 8px; }
  .tbl.resp thead { display: none; }
  .tbl.resp tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .tbl.resp td { border: 0; padding: 0; }
  .tbl.resp td[data-m="hide"] { display: none; }
  .tbl.resp td[data-m="wide"] { grid-column: 2 / -1; }

  .overlay { place-items: end center; padding: 0; }
  .modal, .modal.wide { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; animation: sheet .22s cubic-bezier(.2, .9, .3, 1); }
  .modal-h::before { content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); transform: translateX(-50%); }
  .modal-h { position: relative; padding-top: 20px; }
  .modal-f { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
  @keyframes sheet { from { transform: translateY(100%); } }

  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom));
  }
  #tabbar a, #tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0; background: none; border: 0; cursor: pointer; font-weight: 600; position: relative; }
  #tabbar a.on { color: var(--accent); }
  #tabbar svg.i { width: 23px; height: 23px; }
  #tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); background: var(--crit); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 10px; }
  #fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 41;
    width: 56px; height: 56px; border-radius: 18px; border: 0; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, #3d6bff, #7b4dff); box-shadow: 0 10px 26px rgba(70, 80, 255, .45);
  }
  #fab svg.i { width: 26px; height: 26px; stroke-width: 2.4; }
  .tip { display: none; }
}
@media (max-width: 380px) {
  .rooms { grid-template-columns: 1fr; }
}
