/* ─────────────── Дизайн-система: спокойная, плотная, без лишнего ─────────────── */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --sidebar: #0e1726;
  --sidebar-2: #16223a;
  --border: #e4e9f0;
  --border-strong: #d2dae6;
  --text: #16202e;
  --text-2: #5a6a80;
  --text-3: #8a97a8;
  --accent: #2f6feb;
  --accent-soft: #e8f0fe;
  --accent-dark: #1d54c4;
  --ok: #12805c;
  --ok-soft: #e3f5ee;
  --warn: #b45309;
  --warn-soft: #fdf1e0;
  --danger: #c02626;
  --danger-soft: #fdeaea;
  --violet: #6d4aca;
  --violet-soft: #f0ebfd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .16);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", -apple-system, "Inter", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9d2df; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aab6c6; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ───────────────────────────── каркас ───────────────────────────── */
.app { display: grid; grid-template-columns: 244px 1fr; height: 100vh; overflow: hidden; }
/* пока не выполнен вход, рабочая область не должна рисоваться под заставкой */
.app[hidden] { display: none; }

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #cfd8e6;
  display: flex; flex-direction: column;
  padding: 18px 12px;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 20px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), #57a0ff);
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .5px;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(47, 111, 235, .4);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { color: #fff; font-size: 14px; }
.brand-text span { font-size: 11px; color: #7c8ba3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: #b3c0d4; cursor: pointer;
  font-size: 13.5px; text-align: left; width: 100%;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(47, 111, 235, .18); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-item em {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600;
  color: #8fa0b8; background: rgba(255, 255, 255, .07); padding: 1px 7px; border-radius: 20px;
}
.nav-item.active em { background: rgba(255, 255, 255, .16); color: #fff; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .07); margin: 10px 8px; }

.sidebar-foot { padding: 12px 10px 2px; border-top: 1px solid rgba(255, 255, 255, .07); }
.pulse { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: #93a2b8; }
.pulse i { width: 7px; height: 7px; border-radius: 50%; background: #35c489; box-shadow: 0 0 0 3px rgba(53, 196, 137, .18); }
.pulse.off i { background: #e05252; box-shadow: 0 0 0 3px rgba(224, 82, 82, .18); }
.sidebar-foot small { display: block; margin-top: 4px; font-size: 10.5px; color: #61708a; }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 15px 26px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-title h1 { font-size: 19px; }
.topbar-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.topbar-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-actions { display: flex; gap: 8px; }

.search { position: relative; display: flex; align-items: center; }
.search .ico { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.search input {
  width: 330px; padding: 8px 44px 8px 34px;
  border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface-2);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.search kbd {
  position: absolute; right: 10px; font: 11px var(--mono); color: var(--text-3);
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px;
}

.content { flex: 1; overflow-y: auto; padding: 22px 26px 40px; }

/* ───────────────────────────── элементы ───────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background .13s, border-color .13s, box-shadow .13s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: #bcc7d6; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: #f1c9c9; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #e8b0b0; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eef1f6; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14px; }
.card-head .sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px 18px; }

.grid { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500;
  background: #eef1f6; color: var(--text-2); border: 1px solid transparent; white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent-dark); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; opacity: .6; padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.chip button:hover { opacity: 1; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: #16a06f; } .dot.warn { background: #e08c1a; }
.dot.danger { background: #d64545; } .dot.mute { background: #b3bdcb; }

.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 5px; }

/* ───────────────────────────── KPI ───────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; }
@media (min-width: 1240px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow); cursor: pointer; position: relative; overflow: hidden;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16, 24, 40, .1); border-color: var(--border-strong); }
.kpi::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: .85;
}
.kpi.ok::after { background: #16a06f; } .kpi.warn::after { background: #e08c1a; }
.kpi.danger::after { background: #d64545; } .kpi.violet::after { background: #7b5bd6; }
.kpi-label { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi-value { font-size: 27px; font-weight: 650; letter-spacing: -.02em; margin: 5px 0 2px; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi-hint { font-size: 11.5px; color: var(--text-2); }

/* ───────────────────────────── графики ───────────────────────────── */
.section-title {
  font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin: 26px 0 12px; display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 16px; }
.chart-card .card-body { padding: 12px 14px 14px; }
.chart-box { position: relative; height: 248px; }
.chart-box.tall { height: 330px; }
.chart-hint { font-size: 11px; color: var(--text-3); padding: 8px 2px 0; display: flex; align-items: center; gap: 5px; }

/* ───────────────────────────── таблицы ───────────────────────────── */
.table-wrap { overflow: auto; max-height: calc(100vh - 290px); border-radius: 0 0 var(--radius) var(--radius); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--accent); }
table.data th .arrow { opacity: .45; font-size: 10px; margin-left: 3px; }
table.data td { padding: 9px 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; white-space: nowrap; }
table.data td.clip { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
table.data tbody tr { cursor: pointer; transition: background .1s; }
table.data tbody tr:hover { background: #f7f9fc; }
table.data tbody tr.selected { background: var(--accent-soft); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .cell-main { font-weight: 550; }
table.data .cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
table.data .actions { opacity: 0; transition: opacity .1s; white-space: nowrap; }
table.data tr:hover .actions { opacity: 1; }

.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.toolbar select, .toolbar input[type=text], .toolbar input[type=search] {
  padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; max-width: 190px;
}
.toolbar select:focus, .toolbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters-active { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.count-badge { font-size: 12.5px; color: var(--text-3); margin-left: auto; white-space: nowrap; }

/* ───────────────────────── боковая карточка ───────────────────────── */
.drawer-backdrop, .modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 38, .38);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 40;
  backdrop-filter: blur(1.5px);
}
.drawer-backdrop.show, .modal-backdrop.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 94vw);
  background: var(--bg); box-shadow: var(--shadow-lg); z-index: 50;
  transform: translateX(102%); transition: transform .24s cubic-bezier(.32, .72, 0, 1);
  display: flex; flex-direction: column;
}
.drawer.show { transform: none; }
.drawer-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 22px 0; }
.drawer-title { display: flex; align-items: flex-start; gap: 14px; }
.drawer-title h2 { font-size: 18px; }
.drawer-title .meta { font-size: 12.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.drawer-title .spacer { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

.tabs { display: flex; gap: 2px; margin-top: 14px; }
.tab {
  padding: 9px 14px; border: 0; background: none; cursor: pointer;
  font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.info-cell { background: var(--surface); padding: 11px 14px; min-width: 0; }
.info-cell .k { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.info-cell .v { margin-top: 3px; word-break: break-word; }
.info-cell .v.empty-v { color: var(--text-3); }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--text-3); padding: 7px 10px; border-bottom: 1px solid var(--border); font-weight: 600; letter-spacing: .03em; }
.mini-table td { padding: 8px 10px; border-bottom: 1px solid #eef1f6; }
.mini-table tr:last-child td { border-bottom: 0; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 128px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef1f6; font-size: 13px; }
.tl-item:last-child { border-bottom: 0; }
.tl-time { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.tl-change { display: flex; gap: 7px; flex-wrap: wrap; align-items: baseline; }
.tl-old { color: var(--danger); text-decoration: line-through; opacity: .75; }
.tl-new { color: var(--ok); font-weight: 500; }

/* ───────────────────────────── формы ───────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.field input, .field select, .field textarea {
  padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; width: 100%;
  transition: border-color .13s, box-shadow .13s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; min-height: 62px; }
.field.wide { grid-column: 1 / -1; }
.field .hint { font-size: 11.5px; color: var(--text-3); }

/* ───────────────────────────── модальное ───────────────────────────── */
.modal {
  position: fixed; z-index: 60; top: 50%; left: 50%; transform: translate(-50%, -46%) scale(.98);
  width: min(660px, 94vw); max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s;
}
.modal.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-head { padding: 18px 22px 12px; display: flex; align-items: center; gap: 12px; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 4px 22px 8px; }
.modal-foot { padding: 14px 22px 18px; display: flex; gap: 9px; justify-content: flex-end; }

/* ───────────────────────────── уведомления ───────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 250px; max-width: 400px;
  padding: 12px 15px; border-radius: var(--radius-sm); background: #17233a; color: #eaf0f8;
  box-shadow: var(--shadow-lg); font-size: 13px;
  animation: slideIn .22s cubic-bezier(.32, .72, 0, 1);
}
.toast.ok { background: #10513c; } .toast.err { background: #7a1f1f; } .toast.warn { background: #7a4a12; }
.toast b { display: block; margin-bottom: 2px; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }

/* ───────────────────────── импорт / экспорт ───────────────────────── */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .ico { color: var(--accent); }
.dropzone strong { display: block; margin: 9px 0 4px; font-size: 15px; }
.dropzone span { font-size: 12.5px; color: var(--text-3); }

.file-list { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px;
}
.file-row .name { font-weight: 500; }
.file-row .size { color: var(--text-3); font-size: 12px; }
.file-row .spacer { margin-left: auto; }

.diff-list { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.diff-row { display: grid; grid-template-columns: 168px 1fr; gap: 10px; font-size: 12.5px; padding: 4px 0; }
.diff-row .k { color: var(--text-2); }

.step-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none;
}

.code {
  background: #0f1a2b; color: #cfe0f5; border-radius: var(--radius-sm);
  padding: 13px 15px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto;
  white-space: pre; line-height: 1.65;
}
.code .c { color: #7d90ab; }
.code .s { color: #8fd694; }

.stat-line { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-line div { display: flex; flex-direction: column; }
.stat-line b { font-size: 21px; font-weight: 650; }
.stat-line span { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }

/* ───────────────── экран входа «Единый контур управления» ───────────────── */
.gate {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 50% 42%, #16243d 0%, #0d1524 55%, #080d17 100%);
  color: #dbe6f6; overflow: hidden; transition: opacity .5s ease;
}
.gate[hidden] { display: none; }
.gate.leaving { opacity: 0; pointer-events: none; }

.gate-grid {
  position: absolute; inset: -40%;
  background-image: linear-gradient(rgba(120, 165, 235, .07) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(120, 165, 235, .07) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(600px) rotateX(58deg) translateY(-8%);
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
  animation: gateDrift 26s linear infinite;
}
@keyframes gateDrift { to { background-position: 46px 46px; } }

.gate-contour {
  position: absolute; width: min(94vh, 780px); height: min(94vh, 780px);
  color: rgba(120, 170, 245, .5); opacity: .8;
}
.gate-contour .ring { stroke-dasharray: 3 9; transform-origin: 280px 280px; }
.gate-contour .r1 { animation: gateSpin 44s linear infinite; }
.gate-contour .r2 { animation: gateSpin 32s linear infinite reverse; stroke-dasharray: 2 14; }
.gate-contour .r3 { animation: gateSpin 24s linear infinite; stroke-dasharray: 1 7; }
.gate-contour .trace { stroke: rgba(90, 190, 255, .75); stroke-dasharray: 340; stroke-dashoffset: 340; }
.gate-contour .nodes circle { opacity: 0; }
@keyframes gateSpin { to { transform: rotate(360deg); } }

.gate.intro .gate-contour .trace { animation: gateDraw 1.3s cubic-bezier(.4, 0, .2, 1) forwards; }
.gate.intro .gate-contour .t2 { animation-delay: .1s; }
.gate.intro .gate-contour .t3 { animation-delay: .2s; }
.gate.intro .gate-contour .t4 { animation-delay: .3s; }
.gate.intro .gate-contour .nodes circle { animation: gateNode .5s ease .9s forwards; }
.gate:not(.intro) .gate-contour .trace { stroke-dashoffset: 0; }
.gate:not(.intro) .gate-contour .nodes circle { opacity: .85; }
@keyframes gateDraw { to { stroke-dashoffset: 0; } }
@keyframes gateNode { from { opacity: 0; } to { opacity: .85; } }

.gate-inner {
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center;
  gap: 26px; padding: 24px; width: min(430px, 92vw);
}
.gate-brand { text-align: center; }
.gate-mark {
  width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 16px;
  display: grid; place-items: center; font-weight: 700; font-size: 17px; letter-spacing: .06em;
  color: #eaf2ff; background: linear-gradient(145deg, #2f6feb, #1b3f8f);
  box-shadow: 0 12px 34px rgba(47, 111, 235, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.gate-title {
  font-size: 25px; font-weight: 600; letter-spacing: .01em; line-height: 1.25;
  background: linear-gradient(92deg, #ffffff, #a9c9ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-sub { margin-top: 8px; font-size: 12.5px; color: #7f93b3; letter-spacing: .02em; }
.gate-progress {
  width: 210px; height: 2px; margin: 20px auto 0; border-radius: 2px;
  background: rgba(140, 175, 230, .18); overflow: hidden;
}
.gate-progress i {
  display: block; height: 100%; width: 0; border-radius: 2px;
  background: linear-gradient(90deg, #2f6feb, #6fb4ff);
  box-shadow: 0 0 12px rgba(79, 150, 255, .7);
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
}
.gate-status {
  margin-top: 10px; font-size: 11.5px; letter-spacing: .06em; text-transform: lowercase;
  color: #6f86a8; min-height: 14px;
}
.gate-status::after { content: '…'; opacity: .6; }
.gate:not(.intro) .gate-status { opacity: .5; }

.gate.intro .gate-mark { animation: gateMark .8s cubic-bezier(.2, .8, .2, 1) both; }
.gate.intro .gate-title { animation: gateRise .8s cubic-bezier(.2, .8, .2, 1) .18s both; }
.gate.intro .gate-sub { animation: gateRise .8s cubic-bezier(.2, .8, .2, 1) .34s both; }
.gate.intro .gate-progress,
.gate.intro .gate-status { animation: gateRise .6s ease .5s both; }
/* пока идёт заставка, форма не занимает место и не мигает раньше времени */
.gate.intro .gate-card { opacity: 0; transform: translateY(18px); pointer-events: none; }
.gate-card { transition: opacity .5s ease .05s, transform .5s cubic-bezier(.2, .8, .2, 1) .05s; }
@keyframes gateRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes gateMark {
  from { opacity: 0; transform: translateY(14px) scale(.82); }
  to { opacity: 1; transform: none; }
}

.gate-card {
  width: 100%; padding: 26px 26px 22px; border-radius: 16px;
  background: rgba(19, 29, 48, .82); border: 1px solid rgba(122, 160, 220, .22);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .5); backdrop-filter: blur(9px);
}
.gate-card h2 { font-size: 16px; font-weight: 600; color: #eef4ff; }
.gate-hint { margin: 5px 0 20px; font-size: 12px; color: #7488a6; }
.gate-field { display: block; margin-bottom: 14px; }
.gate-field span {
  display: block; margin-bottom: 6px; font-size: 11px; letter-spacing: .05em;
  text-transform: uppercase; color: #8ea3c2; font-weight: 600;
}
.gate-field input {
  width: 100%; padding: 11px 13px; border-radius: 9px; font-size: 14px; color: #eaf1ff;
  background: rgba(9, 15, 27, .75); border: 1px solid rgba(122, 160, 220, .26);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.gate-field input:focus { border-color: #4d97ff; box-shadow: 0 0 0 3px rgba(77, 151, 255, .18); }
.gate-btn {
  width: 100%; margin-top: 6px; padding: 12px; border: 0; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: #fff; letter-spacing: .01em;
  background: linear-gradient(145deg, #3b7ef0, #2258c8);
  box-shadow: 0 10px 26px rgba(47, 111, 235, .38); transition: filter .15s, transform .06s;
}
.gate-btn:hover { filter: brightness(1.08); }
.gate-btn:active { transform: translateY(1px); }
.gate-btn[disabled] { opacity: .65; cursor: default; }
.gate-error {
  margin: 2px 0 12px; padding: 9px 12px; border-radius: 8px; font-size: 12.5px;
  background: rgba(190, 60, 60, .16); border: 1px solid rgba(215, 90, 90, .35); color: #ffc4c4;
}
.gate-foot { margin-top: 14px; font-size: 11.5px; color: #6f829f; text-align: center; line-height: 1.5; }
.gate-card.shake { animation: gateShake .34s ease; }
@keyframes gateShake {
  20% { transform: translateX(-7px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}

.user-chip {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 10px;
  padding: 7px 9px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 12.5px;
  color: #b9c7dc; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08);
}
.user-chip:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.user-chip .exit { margin-left: auto; opacity: .6; }
.user-chip:hover .exit { opacity: 1; }

/* ─────────────────────── подсказки общего поиска ─────────────────────── */
.search-wrap { position: relative; }
.search-drop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  max-height: min(66vh, 560px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.sd-group + .sd-group { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.sd-title {
  padding: 6px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
}
.sd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; font: inherit;
}
.sd-item:hover, .sd-item.active { background: var(--accent-soft); }
.sd-item .ico { color: var(--text-3); }
.sd-item.active .ico { color: var(--accent); }
.sd-main { display: flex; flex-direction: column; min-width: 0; }
.sd-main b { font-size: 13px; font-weight: 550; }
.sd-main span { font-size: 11.5px; color: var(--text-3); }
.sd-hint { margin-left: auto; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.sd-item mark { background: #ffe9a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.sd-empty { padding: 22px 14px; text-align: center; color: var(--text-3); font-size: 13px; }
.sd-foot {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 4px; margin-top: 4px;
  border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3);
}
.sd-all {
  margin-left: auto; border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 12px; cursor: pointer; font-weight: 550;
}

/* ───────────────────────────── колокольчик ───────────────────────────── */
.bell {
  position: relative; width: 36px; height: 36px; flex: none; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border-strong);
}
.bell:hover { background: var(--surface-2); color: var(--text); }
.bell.has { color: var(--accent); }
.bell.urgent { color: var(--danger); border-color: #f0c7c7; animation: bellRing 2.4s ease-in-out 3; }
.bell em {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-style: normal;
  font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface);
}
.bell em[hidden] { display: none; }
@keyframes bellRing {
  0%, 92%, 100% { transform: rotate(0); }
  94% { transform: rotate(-11deg); } 96% { transform: rotate(9deg); } 98% { transform: rotate(-5deg); }
}

.rem-group + .rem-group { margin-top: 18px; }
.rem-title { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; font-size: 12.5px; }
.rem-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 7px; font-size: 13px;
}
.rem-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.rem-main { display: flex; flex-direction: column; min-width: 0; }
.rem-main span { font-size: 11.5px; color: var(--text-3); }
.rem-when { margin-left: auto; font-size: 12px; font-weight: 550; white-space: nowrap; }
.rem-when.overdue { color: var(--danger); }
.rem-when.today { color: var(--warn); }
.rem-when.soon { color: var(--text-2); }
.rem-date { font-size: 11.5px; white-space: nowrap; }

/* ───────────────────────────── оплата ───────────────────────────── */
.rent-list { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rent-row {
  display: flex; gap: 16px; padding: 14px 16px; cursor: pointer;
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); background: var(--surface);
  transition: box-shadow .13s, transform .06s, border-color .13s;
}
.rent-row:hover { box-shadow: 0 6px 20px rgba(16, 24, 40, .09); border-color: var(--border-strong); }
.rent-row.tone-ok { border-left-color: #16a06f; }
.rent-row.tone-warn { border-left-color: #e08c1a; }
.rent-row.tone-danger { border-left-color: #d64545; }
.rent-row.tone-plain { border-left-color: #b3bdcb; }
.rent-main { flex: 1; min-width: 0; }
.rent-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.rent-head b { font-size: 14px; }
.rent-sub { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 5px; font-size: 12.5px; color: var(--text-2); }
.rent-sub span { display: inline-flex; align-items: center; gap: 5px; }
.rent-bar { height: 5px; border-radius: 3px; background: #eef1f6; margin: 11px 0 6px; overflow: hidden; }
.rent-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #2f6feb, #6fb4ff); }
.rent-row.tone-warn .rent-bar i { background: linear-gradient(90deg, #e08c1a, #f5c169); }
.rent-row.tone-danger .rent-bar i { background: linear-gradient(90deg, #d64545, #f08a8a); }
.rent-dates { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); }
.rent-left { font-weight: 600; color: var(--text-2); }
.rent-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; }
.rent-amount { font-size: 16px; font-weight: 650; white-space: nowrap; }
.rent-actions { display: flex; gap: 6px; }

/* ───────────────────────── доска заданий ───────────────────────── */
.board-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.board-stats { display: flex; gap: 7px; flex-wrap: wrap; }
.board {
  display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px;
  align-items: start; overflow-x: auto; padding-bottom: 8px;
}
@media (max-width: 1250px) { .board { grid-template-columns: repeat(2, minmax(240px, 1fr)); } }
@media (max-width: 700px) { .board { grid-template-columns: 1fr; } }

.board-col {
  background: linear-gradient(180deg, #eef1f6, #f4f6fa); border: 1px solid var(--border);
  border-radius: var(--radius); min-height: 220px;
}
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px 8px; }
.board-col-head h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.board-col-head .count {
  font-size: 11px; color: var(--text-3); background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 1px 7px;
}
.board-col-head button { margin-left: auto; }
.board-drop { padding: 4px 12px 14px; min-height: 120px; display: flex; flex-direction: column; gap: 14px; }
.board-drop.over { background: rgba(47, 111, 235, .07); border-radius: var(--radius); }
.board-empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 20px 10px; text-align: center; font-size: 12px; color: var(--text-3);
}

.sticky {
  position: relative; padding: 16px 14px 12px; border-radius: 2px; cursor: pointer;
  font-family: 'Segoe Script', 'Bradley Hand', 'Comic Sans MS', cursive;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 6px 14px rgba(16, 24, 40, .16), inset 0 -18px 24px -20px rgba(0, 0, 0, .16);
  transition: transform .14s ease, box-shadow .14s ease;
  background: #ffe9a3;
}
.sticky:hover { transform: rotate(0) translateY(-3px) scale(1.015); box-shadow: 0 14px 26px rgba(16, 24, 40, .22); }
.sticky.dragging { opacity: .5; }
.sticky.flash { animation: stickyFlash 1.6s ease 2; }
@keyframes stickyFlash { 50% { box-shadow: 0 0 0 3px var(--accent); } }
.sticky.c-yellow { background: linear-gradient(160deg, #fff3bf, #ffe9a3); }
.sticky.c-mint { background: linear-gradient(160deg, #d6f5e3, #bfead2); }
.sticky.c-blue { background: linear-gradient(160deg, #d7e9ff, #c3dcfb); }
.sticky.c-pink { background: linear-gradient(160deg, #ffdfe8, #ffcbdb); }
.sticky.c-violet { background: linear-gradient(160deg, #e6ddfb, #d6c9f7); }
.sticky.c-peach { background: linear-gradient(160deg, #ffe3cc, #ffd2b0); }
.sticky.done { opacity: .62; }
.sticky.done h4 { text-decoration: line-through; }
.sticky-pin {
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #ff8a8a, #c53030);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}
.sticky h4 { font-size: 15px; font-weight: 600; line-height: 1.35; color: #2b2a20; word-break: break-word; }
.sticky p { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: #4a4838; }
.sticky-flag {
  position: absolute; top: 8px; right: 8px; font-family: var(--font);
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: #d64545; color: #fff; padding: 2px 6px; border-radius: 3px;
}
.sticky-foot {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  font-family: var(--font); font-size: 11px;
}
.sticky-due, .sticky-link, .sticky-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, .6); border-radius: 20px; padding: 2px 8px; color: #4a4838;
}
.sticky-due.overdue { background: rgba(214, 69, 69, .18); color: #932020; font-weight: 600; }
.sticky-due.today { background: rgba(224, 140, 26, .2); color: #8a5310; font-weight: 600; }
.sticky-actions {
  position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; opacity: 0;
  transition: opacity .12s;
}
.sticky:hover .sticky-actions { opacity: 1; }
.sticky-actions button {
  width: 24px; height: 24px; border-radius: 6px; cursor: pointer; display: grid; place-items: center;
  border: 1px solid rgba(0, 0, 0, .1); background: rgba(255, 255, 255, .8); color: #4a4838;
}
.sticky-actions button:hover { background: #fff; color: var(--accent); }

/* ───────────────────── прогресс пакетной загрузки ───────────────────── */
.progress-box {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 15px; background: var(--surface-2);
}
.progress { height: 7px; border-radius: 20px; background: #e2e8f0; overflow: hidden; }
.progress .bar {
  height: 100%; background: linear-gradient(90deg, var(--accent), #5b9cff);
  border-radius: 20px; transition: width .25s ease;
}

/* ─────────────────────── инвентаризация: кампании ─────────────────────── */
.split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.list { max-height: calc(100vh - 250px); overflow-y: auto; }
.list-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 16px; border: 0; border-bottom: 1px solid #eef1f6; border-left: 3px solid transparent;
  background: none; cursor: pointer; font: inherit; transition: background .1s;
}
.list-row:hover { background: #f7f9fc; }
.list-row.active { background: var(--accent-soft); border-left-color: var(--accent); }
.list-row:last-child { border-bottom: 0; }
.list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-main strong { font-size: 13px; font-weight: 550; }
.list-main span { font-size: 11.5px; color: var(--text-3); }
.list-side { margin-left: auto; display: flex; gap: 4px; flex: none; }

.kpis.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpis.compact .kpi { padding: 12px 14px; cursor: default; }
.kpis.compact .kpi-value { font-size: 22px; }

/* ───────────────────── панель расширенных фильтров ───────────────────── */
.input {
  padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; font: inherit; font-size: 13px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-sm { padding: 5px 9px; font-size: 12.5px; }

.filter-panel {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.filter-panel .field label { font-size: 11px; }
.filter-panel .field input, .filter-panel .field select { padding: 6px 10px; font-size: 13px; }
.filter-panel .range { display: flex; gap: 6px; }
.filter-panel .range input { min-width: 0; }

.attention-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid #eef1f6;
  cursor: pointer; font-size: 13px;
}
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover .att-name { color: var(--accent); }
.att-name { font-weight: 550; }
.att-sub { font-size: 11.5px; color: var(--text-3); }
.att-reasons { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ico svg { display: block; }

.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 50%, #eef1f6 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
  .app { grid-template-columns: 68px 1fr; }
  .brand-text, .sidebar-foot small, .pulse span { display: none; }
  /* подписи пунктов — текстовые узлы, поэтому прячем их обнулением кегля */
  .nav-item { justify-content: center; padding: 11px; font-size: 0; }
  .nav-item em { display: none; }
  .user-chip { justify-content: center; font-size: 0; }
  .user-chip .exit { display: none; }
  .search input { width: 200px; }
}
@media (max-width: 720px) {
  .content { padding: 16px 14px 30px; }
  .topbar { padding: 12px 14px; }
  .search input { width: 150px; }
}
