:root {
  --bg: #f2f5fa;
  --panel: #ffffff;
  --ink: #12203a;
  --ink-2: #45536b;
  --muted: #7b8798;
  --line: #e3e9f2;
  --accent: #2b7fff;
  --accent-soft: #eaf2ff;
  --green: #12b76a;
  --red: #f04438;
  --amber: #f79009;
  --violet: #7a5af8;
  --nav: #101c2e;
  --nav-2: #17253c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 28, 46, .06), 0 6px 18px rgba(16, 28, 46, .06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Segoe UI", Arial, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--nav);
  color: #e6ecf6;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
}

.brand { padding: 4px 10px 18px; }
.brand-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
}
.brand-logo::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 6px;
  vertical-align: 8px;
}
.brand-sub { font-size: 11px; color: #8fa1bd; margin-top: 2px; letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #b9c6da;
  font-size: 13.5px;
  text-align: left;
  width: 100%;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 6px 14px rgba(43, 127, 255, .35); }
.nav-item span { flex: 1; }
.nav-badge {
  background: rgba(255, 255, 255, .22);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}
.nav-item.active .nav-badge { background: rgba(255, 255, 255, .3); }

.sidebar-foot { margin-top: auto; padding: 12px 6px 0; border-top: 1px solid rgba(255,255,255,.07); }
.me { display: flex; align-items: center; gap: 9px; }
.me-name { font-size: 12.5px; color: #eaf0fa; font-weight: 600; }
.me-role { font-size: 11px; color: #7f8faa; }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  flex: none;
  letter-spacing: .02em;
}

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }

.topbar {
  height: 62px;
  flex: none;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
}
.topbar-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.crumb { color: var(--muted); font-size: 12.5px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.view { flex: 1; overflow: auto; padding: 18px 22px 28px; min-width: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: #f6f9fe; border-color: #cfdcef; color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(43,127,255,.25); }
.btn-primary:hover { background: #1f6fe8; border-color: #1f6fe8; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #eef3fb; }
.btn-danger { color: var(--red); border-color: #fbd5d1; background: #fff7f6; }
.btn-danger:hover { background: #fee9e7; color: #b42318; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: #eef3fb; color: var(--ink); }

/* ---------- board ---------- */
.board-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tabs { display: flex; gap: 4px; background: #e7edf6; padding: 3px; border-radius: 9px; }
.tab {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 7px;
  font-size: 13px; color: var(--ink-2); font-weight: 550;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,28,46,.12); }
.spacer { flex: 1; }

.field {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 11px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,127,255,.14); }
select.field { padding-right: 26px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; color: var(--muted); }
.search .field { padding-left: 32px; width: 232px; }

.board {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 10px;
  min-height: calc(100vh - 200px);
}
.col {
  width: 286px;
  flex: none;
  background: #eaeff7;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 190px);
  border: 1px solid transparent;
}
.col.drop-ok { border-color: var(--accent); background: #e4eeff; }
.col-head {
  padding: 11px 13px 9px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; }
.col-name { font-size: 12.5px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.col-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.col-body {
  padding: 0 9px 9px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 40px;
}

.card {
  background: #fff;
  border-radius: 9px;
  padding: 10px 11px;
  box-shadow: 0 1px 2px rgba(16,28,46,.08);
  cursor: grab;
  border: 1px solid transparent;
  transition: box-shadow .15s, transform .1s, border-color .15s;
}
.card:hover { box-shadow: 0 4px 14px rgba(16,28,46,.12); border-color: #dbe6f6; }
.card.dragging { opacity: .45; }
.card-title { font-size: 13px; font-weight: 600; line-height: 1.35; margin-bottom: 6px; color: var(--ink); }
.card-amount { font-size: 13.5px; font-weight: 700; color: var(--accent); }
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.card-date { font-size: 11px; color: var(--muted); }
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #eef3fb;
  color: #47607f;
  font-weight: 600;
}
.tag.hot { background: #fff1e8; color: #b54708; }

/* ---------- tables ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 14px; font-weight: 650; }
.panel-body { padding: 14px 16px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 650; padding: 9px 14px; background: #f8fafd;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f9fbff; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--muted); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: .5; }
tr:hover .row-actions { opacity: 1; }

.cmp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.cmp-head-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.cmp-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-actions .btn { white-space: nowrap; }

/* письмо из карточки клиента */
.mail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.mail-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid #e3e9f2; border-radius: 8px; font-size: 12px; cursor: pointer; background: #fff; }
.mail-chip input { margin: 0; }
.mail-docs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.mail-docs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.mail-doc { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid #e3e9f2; border-radius: 8px; font-size: 12.5px; cursor: pointer; background: #fff; }
.mail-doc:hover { background: #f6f9fe; }
.mail-doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-doc-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.mail-doc .icon-btn { opacity: 0.55; }
.mail-doc:hover .icon-btn { opacity: 1; }

/* напоминания о праздниках */
.holiday-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; border-radius: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 13px; }
.holiday-bar.today { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.holiday-bar strong { font-weight: 600; }
.holiday-bar .holiday-actions { margin-left: auto; display: flex; gap: 6px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px 20px;
  font-size: 13px;
}

/* ---------- drawer ---------- */
.drawer-root { position: fixed; inset: 0; z-index: 40; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(16, 28, 46, .34); backdrop-filter: blur(1px); }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 520px; max-width: 94vw;
  background: #fff; box-shadow: -12px 0 40px rgba(16,28,46,.18);
  display: flex; flex-direction: column;
  animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: .7; } to { transform: none; opacity: 1; } }
.drawer-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex: none;
}
.drawer-body { padding: 16px 18px 24px; overflow-y: auto; }
.drawer-title { font-size: 15px; font-weight: 650; flex: 1; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.lbl { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; letter-spacing: .02em; }
.field-block { margin-bottom: 12px; }
input.field, select.field, textarea.field { width: 100%; display: block; }
textarea.field { height: auto; padding: 8px 11px; resize: vertical; min-height: 62px; line-height: 1.45; }
.field-lg { font-size: 15px; font-weight: 600; height: 40px; }

.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; margin: 20px 0 9px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-item { display: flex; gap: 9px; font-size: 12.5px; }
.feed-body { flex: 1; }
.feed-text { color: var(--ink); }
.feed-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.feed-item.note .feed-text { background: #f6f9fe; border-radius: 8px; padding: 8px 10px; }
.note-box { display: flex; gap: 8px; margin-top: 8px; }
.note-box textarea { flex: 1; min-height: 54px; }

.task-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; margin-bottom: 7px; background: #fff;
}
.task-row.done { opacity: .55; }
.task-row .tx { flex: 1; font-size: 13px; }
.task-row.overdue { border-color: #fbd5d1; background: #fff9f8; }
.check {
  width: 18px; height: 18px; border-radius: 5px; border: 1.6px solid #c3cfdf;
  background: #fff; flex: none; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; color: transparent;
}
.check svg { width: 12px; height: 12px; }
.task-row.done .check { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-root[hidden] { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(16,28,46,.4); }
.modal {
  position: relative; background: #fff; border-radius: 14px; width: 520px; max-width: 100%;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(16,28,46,.28);
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
.modal.wide { width: 720px; }
.modal-head { padding: 16px 20px 12px; display: flex; align-items: center; gap: 10px; }
.modal-title { font-size: 15.5px; font-weight: 650; flex: 1; }
.modal-body { padding: 4px 20px 8px; overflow-y: auto; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 10px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.field-err { font-size: 12px; color: #b42318; margin-top: 5px; }

/* ---------- analytics ---------- */
.filters {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px;
}
.filters .grp { display: flex; flex-direction: column; gap: 4px; }
.filters .grp span { font-size: 11px; font-weight: 600; color: var(--muted); }
.quick { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 4px 10px; font-size: 12px; color: var(--ink-2);
}
.chip:hover { border-color: #cfdcef; background: #f7faff; }
.chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.report-shell {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 24px 26px; box-shadow: var(--shadow);
}
.report-shell .rpt-kpis { grid-template-columns: repeat(4, 1fr); }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.settings-nav { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; position: sticky; top: 0; }
.settings-nav button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 9px 11px; border-radius: 8px; font-size: 13px; color: var(--ink-2);
}
.settings-nav button:hover { background: #f5f8fd; }
.settings-nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.settings-body { min-width: 0; }
.form-row { display: grid; grid-template-columns: 180px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.form-row > span { font-size: 12.5px; color: var(--ink-2); }
.form-row .field { width: 100%; }
.list-edit { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list-edit-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #eef2f8; }
.list-edit-row:last-child { border-bottom: 0; }
.list-edit-row .field { height: 30px; flex: 1; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }

.stage-editor { border-left: 3px solid var(--accent); padding: 8px 0 8px 12px; margin-bottom: 10px; }
.stage-row { display: flex; gap: 7px; align-items: center; margin-bottom: 6px; }
.stage-row .field { height: 30px; flex: 1; }
.stage-row select { flex: 0 0 122px; }
.stage-row input[type=color] { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: #fff; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast {
  background: #101c2e; color: #fff; border-radius: 10px; padding: 10px 14px;
  font-size: 12.5px; box-shadow: 0 12px 30px rgba(16,28,46,.3); max-width: 420px;
  animation: pop .16s ease-out;
}
.toast.ok { background: #0d7a4a; }
.toast.err { background: #b42318; }
.toast.warn { background: #b54708; }

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

.kbd { font-size: 11px; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 11.5px; word-break: break-all; }
.hr { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- auth ---------- */
body.auth-mode .app { display: none; }
.auth-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1100px 620px at 12% 8%, #1c3c6e 0%, #12233c 52%, #0a1320 100%);
  z-index: 30;
  overflow: auto;
}
.auth-card {
  width: 404px;
  max-width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .38);
}
.auth-logo { font-size: 22px; font-weight: 800; letter-spacing: .06em; color: var(--ink); }
.auth-logo::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 6px;
  vertical-align: 8px;
}
.auth-title { font-size: 16px; font-weight: 650; margin: 16px 0 4px; }
.auth-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.auth-field { margin-bottom: 11px; }
.auth-field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.auth-field .field { width: 100%; height: 36px; }
.auth-error {
  background: #fee4e2;
  color: #b42318;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12.5px;
  margin-bottom: 11px;
  line-height: 1.4;
}
.auth-card .btn-primary { width: 100%; justify-content: center; height: 38px; margin-top: 8px; }
.auth-note { font-size: 11.5px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
.me-text { flex: 1; min-width: 0; }
.me-out { color: #8fa1bd; flex: none; }
.me-out svg { width: 16px; height: 16px; }
.me-out:hover { background: rgba(255, 255, 255, .08); color: #fff; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 68px 1fr; }
  .brand-sub, .nav-item span, .me-text, .nav-badge { display: none; }
  .nav-item { justify-content: center; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ---------- телефон: нижняя навигация и крупные элементы ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: 100dvh; }
  .main { height: 100dvh; }

  .sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    flex-direction: row;
    align-items: stretch;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: var(--nav);
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; flex: 1; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px;
    font-size: 10.5px;
    text-align: center;
    border-radius: 8px;
  }
  .nav-item span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-item svg { width: 20px; height: 20px; }
  .nav-item span { flex: none; }
  .nav-badge { position: absolute; margin: -4px 0 0 22px; padding: 0 5px; font-size: 10px; }

  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar h1 { font-size: 15px; }
  .topbar-left { flex-wrap: wrap; }
  .topbar-actions { overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
  .view { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }

  .panel { border-radius: 12px; }
  .panel-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .panel-head > div { flex-wrap: wrap; }
  .panel-body, .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .panel { overflow-x: auto; }
  .table { min-width: 640px; }
  .table td, .table th { white-space: nowrap; }
  .table .cell-sub { white-space: normal; }

  .filters { flex-wrap: wrap; gap: 10px; }
  .filters .field { width: 100%; }
  .report-shell { padding: 14px 12px; max-width: 100%; border-radius: 12px; }

  .board { gap: 10px; padding: 10px; }
  .col { min-width: 248px; max-width: 260px; }
  .card { padding: 10px; }
  .card-title { font-size: 13px; }

  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100% !important; max-width: 100%; border-radius: 0; }
  .drawer-root .drawer { height: 100dvh; }
  .modal { width: calc(100% - 20px); max-height: 88dvh; }
  .modal.wide { width: calc(100% - 16px); }

  .search input { width: 100%; }
  .search { width: 100%; }
  .section-title { margin-top: 14px; }

  /* крупные кнопки для пальца */
  .btn, .icon-btn { min-height: 38px; }
  .icon-btn { min-width: 38px; }
}

@media (max-width: 480px) {
  .rpt-kpis { grid-template-columns: repeat(2, 1fr) !important; }
  .rpt-two { grid-template-columns: 1fr !important; }
  .topbar h1 { font-size: 14px; }
  .page-sub { display: none; }
  .view { padding: 10px 10px calc(80px + env(safe-area-inset-bottom)); }
  .report-shell { padding: 12px 10px; }
  .filters { padding: 10px 12px; }
  .cmp-actions { width: 100%; }
  .cmp-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* очень узкий экран (крупный системный шрифт, зум браузера) */
@media (max-width: 400px) {
  .nav-item span { display: none; }
  .nav-item { padding: 8px 2px; }
  .nav-badge { margin: -6px 0 0 4px; }
  .topbar { padding: 8px 10px; }
  .topbar-actions { gap: 6px; }
  .btn { padding: 6px 10px; font-size: 12.5px; }
}
