/* ════════════════════════════════════════════════════════════════
   SHELL · sidebar + topbar + workspace + right inbox
═══════════════════════════════════════════════════════════════ */

.app {
  display: grid;
  grid-template-columns: 232px minmax(0,1fr) 380px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(13,148,136,.05), transparent 60%),
    var(--bg);
}
.app.no-inbox { grid-template-columns: 232px minmax(0,1fr); }
.app.no-side  { grid-template-columns: minmax(0,1fr) 380px; }

/* ───── SIDEBAR ───── */
.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 14px 10px 14px;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 16px;
  font-weight: 700; font-size: var(--fs-13);
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.brand .lg {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #0891b2);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: var(--fs-13);
  box-shadow: 0 4px 12px -3px rgba(13,148,136,.45);
}
.brand .name { flex: 1; line-height: 1.2; }
.brand .name small {
  display: block; font-size: 12px; color: var(--text-secondary, #cbd5e1);
  font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
  margin-top: 1px;
}

.nav-group { margin-bottom: 4px; }
.nav-h .caret {
  width: 12px; height: 12px;
  transition: transform .15s ease;
  color: var(--muted);
}
.nav-group.collapsed .caret { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items {
  max-height: 0;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-md);
  color: var(--soft); font-size: var(--fs-13); font-weight: 500;
  margin-bottom: 1px; cursor: pointer;
  transition: background .12s ease, color .12s ease;
  position: relative;
}
.nav-item .ico { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: color .12s; }
.nav-item:hover { background: var(--surface); color: var(--text); }
/* Клавиатурный фокус на пункте меню был невидим: base.css рисует кольцо только
   button/input/select/[tabindex], а пункт — ссылка. Замер 18.09: после Tab
   outline 0px, box-shadow none на 9 экранах. */
.nav-item:focus-visible { outline: none; box-shadow: var(--sh-glow); background: var(--surface); color: var(--text); }
.nav-item:hover .ico { color: var(--soft); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.active .ico { color: var(--accent); }
.nav-item .badge {
  margin-left: auto; font-size: 12px; font-family: var(--ff-mono);
  background: var(--surface-3); color: var(--text-secondary, #cbd5e1);
  padding: 1px 6px; border-radius: var(--r-sm);
}
.nav-item.active .badge {
  background: var(--accent-soft); color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-line);
}

.side-foot {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  padding-left: 8px; padding-right: 4px;
}
.side-foot .nm { font-size: var(--fs-12); font-weight: 600; flex: 1; line-height: 1.2; }
.side-foot .role { font-size: 12px; color: var(--text-secondary, #cbd5e1); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.side-foot .icon-btn {
  box-sizing: border-box;
  /* flex-shrink: 0 обязателен: .side-foot — флекс-строка, соседний блок
     с flex:1 поджимал кнопку до 29.6px по ширине при заданных 34. */
  flex: 0 0 auto;
  width: 34px; height: 34px; min-width: 34px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.side-foot .icon-btn:hover { background: var(--surface); color: var(--text); }

/* ───── WORKSPACE ───── */
.ws { display: flex; flex-direction: column; min-width: 0; }
.ws-top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--overlay);
  backdrop-filter: blur(14px) saturate(140%);
  position: sticky; top: 0; z-index: 10;
}
.top-segments {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.seg {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 2px;
}
.seg button {
  border-radius: var(--r-sm);
  padding: 5px 8px;
  font-size: 12px;
  color: var(--text-secondary, #cbd5e1);
  font-weight: 600;
  line-height: 1;
}
.seg button:hover {
  color: var(--soft);
}
.seg button.on {
  background: var(--accent-soft);
  color: var(--accent);
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--text-secondary, #cbd5e1); }
.crumb b { color: var(--text); font-weight: 500; }
.crumb .sl { color: var(--faint); }
.crumb .i { width: 14px; height: 14px; color: var(--text-secondary, #cbd5e1); vertical-align: -3px; }
.ws-kbd { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-secondary, #cbd5e1); }
.inbox-toggle-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--soft);
  font-size: var(--fs-12);
  font-weight: 600;
}
.inbox-toggle-btn .badge {
  font-size: 12px;
  font-family: var(--ff-mono);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}

.ws-body { padding: 22px; display: flex; flex-direction: column; gap: 18px; }

/* ───── INBOX (right rail) ───── */
.inbox {
  background: var(--side); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh;
  overflow: hidden;
}
.inbox-top .ct { font-size: var(--fs-12); color: var(--accent); font-family: var(--ff-mono); font-weight: 600; }
.inbox-close {
  display: none;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  color: var(--muted);
  align-items: center;
  justify-content: center;
}
.inbox-close:hover {
  background: var(--surface);
  color: var(--text);
}
.inbox-tabs .tab {
  padding: 10px 10px; font-size: var(--fs-12); color: var(--text-secondary, #cbd5e1);
  border-bottom: 2px solid transparent; cursor: pointer;
  transition: color .12s, border-color .12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: max-content;
  flex: 0 0 auto;
}
.inbox-tabs .tab:hover { color: var(--soft); }
.inbox-tabs .tab.on { color: var(--text); border-bottom-color: var(--accent); }
.inbox-tabs .tab .ct {
  font-size: 12px; background: var(--surface-3); padding: 1px 5px;
  border-radius: var(--r-sm); margin-left: 5px; color: var(--text-secondary, #cbd5e1);
  font-family: var(--ff-mono);
}
.inbox-tabs .tab.on .ct { background: var(--accent-soft); color: var(--accent); }

.inbox-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px 0;
}
.inbox-controls select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 7px 8px;
  color: var(--text);
  font-size: var(--fs-12);
}
.inbox-controls select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--sh-glow);
}

.inbox-list { padding: 8px; overflow-y: auto; flex: 1; }
.inbox-empty .i { width: 32px; height: 32px; color: var(--faint); margin-bottom: 10px; }
.inbox-empty.small {
  padding: 8px;
  text-align: left;
  font-size: var(--fs-12);
}

/* ───── ACTION ITEM ───── */
.item {
  padding: 12px 12px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 6px; background: var(--surface);
  cursor: pointer;
  transition: all .15s cubic-bezier(.21,.61,.35,1);
  animation: p-fade-up .4s cubic-bezier(.21,.61,.35,1) backwards;
}
.item:hover { border-color: var(--line-2); box-shadow: var(--sh-1); transform: translateY(-1px); }
.item.selected {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-line), var(--sh-1);
}
.item-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.item-due { margin-left: auto; font-size: 12px; color: var(--text-secondary, #cbd5e1); font-family: var(--ff-mono); }
.item h4 { margin: 0; font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.item .meta { font-size: var(--fs-12); color: var(--text-secondary, #cbd5e1); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.life-chip {
  font-size: 12px;
  font-family: var(--ff-mono);
  letter-spacing: .03em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  padding: 2px 6px;
}

.item-row { display: flex; gap: 5px; margin-top: 9px; }
.item-row .micro {
  padding: 4px 8px; font-size: 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); color: var(--text-secondary, #cbd5e1);
  font-family: var(--ff-mono); background: var(--surface-2);
  display: inline-flex; align-items: center; gap: 4px;
  transition: all .12s;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-row { flex-wrap: wrap; }
.item-row .micro .i { flex-shrink: 0; }
.item-row .micro:hover { color: var(--text); background: var(--surface); }
.item-row .micro .kbd { background: var(--line); padding: 0 4px; border: 0; font-size: 12px; border-radius: 2px; margin-left: 2px; min-width: auto; height: auto; }
.item-row .micro.done:hover { color: var(--good); border-color: var(--good-line); background: var(--good-soft); }
.item-row .micro.snooze:hover { color: var(--plum); border-color: var(--plum-line); background: var(--plum-soft); }
.item-row .micro.escalate:hover { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }

.inbox-focus {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--surface);
  overflow-y: auto;
  max-height: 48vh;
}

.deal-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 13, .55);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
}
.deal-drawer {
  width: min(1560px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.deal-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.deal-drawer-head .l {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.deal-drawer-head h3 {
  margin: 0;
  font-size: var(--fs-14);
}
.deal-drawer-head .r {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.deal-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}
.entity-command-header {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, .95fr);
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 42%),
    var(--surface);
  box-shadow: var(--sh-1);
}
.entity-command-main {
  min-width: 0;
}
.entity-command-main h2 {
  margin: 8px 0 8px;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.entity-command-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-secondary, #cbd5e1);
  font-size: var(--fs-12);
}
.entity-command-sub span {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface-2) 76%, transparent);
}
.entity-command-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-self: start;
}
.entity-command-metrics div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
}
.entity-command-metrics small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.entity-command-metrics b {
  display: block;
  color: var(--text);
  font-size: var(--fs-16);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.entity-command-actions .btn {
  white-space: nowrap;
}
.entity-command-next {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line-2);
  color: var(--text-secondary, #cbd5e1);
  font-size: var(--fs-12);
}
.entity-command-next b {
  color: var(--text);
}
.entity360-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(to bottom, var(--bg), var(--bg));
}
.entity360-section[hidden] {
  display: none;
}
.entity360-tabs .tab360 {
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-size: var(--fs-12);
  color: var(--text-secondary, #cbd5e1);
  background: var(--surface);
  transition: all .12s ease;
}
.entity360-tabs .tab360:hover {
  color: var(--text);
  border-color: var(--line-3);
}
.entity360-tabs .tab360.on {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.entity360-section {
  margin-bottom: 14px;
}
.entity360-rel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.entity360-rel .chip-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--soft);
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-size: var(--fs-12);
}
body.drawer-open {
  overflow: hidden;
}
.inbox-focus h4 {
  margin: 0 0 6px;
  font-size: var(--fs-12);
}
.inbox-focus p {
  margin: 0 0 8px;
  color: var(--text-secondary, #cbd5e1);
  font-size: var(--fs-12);
  line-height: 1.4;
}
.focus-evidence {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px;
  margin-bottom: 8px;
  background: var(--surface-2);
}
.focus-evidence .e-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 5px;
}
.focus-evidence .e-head b {
  color: var(--accent);
  font-family: var(--ff-mono);
  font-size: 12px;
  text-transform: none;
}
.focus-evidence ul {
  margin: 0;
  padding-left: 15px;
  color: var(--text);
  font-size: var(--fs-12);
  line-height: 1.4;
}
.focus-evidence .e-missing {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-2);
}
.focus-evidence .e-missing span {
  color: var(--text-secondary, #cbd5e1);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.focus-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.focus-actions .btn {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.focus-lifecycle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.focus-lifecycle .micro {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  color: var(--text-secondary, #cbd5e1);
  font-family: var(--ff-mono);
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  width: 100%;
  justify-content: center;
}
.focus-lifecycle .micro.on {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.e-form {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.e-form label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary, #cbd5e1);
}
.e-form select,
.e-form textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-12);
  padding: 7px 8px;
}
.e-form select:focus,
.e-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--sh-glow);
}

.entity-panel {
  margin-top: 14px;
}
.entity-panel .card-hd h3 {
  font-size: 15px;
}
.entity-overview-actions,
.entity-overview-history {
  margin-top: 12px;
}
.entity-feed-kind {
  color: var(--accent);
  font-size: var(--fs-12);
  font-weight: 700;
}
.entity-muted {
  color: var(--text-secondary, #cbd5e1);
  font-size: var(--fs-12);
}
.entity-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.entity-form-card {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  padding: 12px;
}
.entity-form-card + .entity-form-card {
  margin-top: 8px;
}
.entity-form-title {
  margin: 0;
  font-size: var(--fs-12);
  color: var(--text);
  font-weight: 650;
}
.entity-form-note {
  margin-top: 4px;
  font-size: var(--fs-12);
  color: var(--text-secondary, #cbd5e1);
}
.entity-kv-line {
  margin-top: 6px;
  font-size: var(--fs-12);
  color: var(--soft);
}
.entity-kv-line b {
  color: var(--text);
  font-weight: 650;
}
.entity-form-grid .full {
  grid-column: 1 / -1;
}
.entity-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-12);
  color: var(--text-secondary, #cbd5e1);
}
.entity-input,
.entity-textarea{
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  font-size: var(--fs-12);
}
.entity-textarea {
  resize: vertical;
  min-height: 88px;
  font-family: var(--ff-mono);
  font-size: 12px;
}
.entity-input:focus,
.entity-textarea:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--sh-glow);
}
.entity-toolbar {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.entity-toolbar .status {
  font-size: var(--fs-12);
  color: var(--text-secondary, #cbd5e1);
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.entity-row-task-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entity-row-task-status {
  color: var(--text-secondary, #cbd5e1);
  font-size: var(--fs-12);
}
.kv-diff {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.kv-diff > div {
  display: grid;
  grid-template-columns: minmax(92px, .8fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.kv-diff > div.changed {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.kv-diff b {
  color: var(--text);
  font-size: var(--fs-12);
}
.kv-diff span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--text-secondary, #cbd5e1);
}
.entity-divider {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}
.entity-rel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.entity-rel-grid {
  margin-top: 10px;
}
.entity-rel-pager {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

/* stagger items by index */
.inbox-list .item:nth-child(1)  { animation-delay: .05s; }
.inbox-list .item:nth-child(2)  { animation-delay: .08s; }
.inbox-list .item:nth-child(3)  { animation-delay: .11s; }
.inbox-list .item:nth-child(4)  { animation-delay: .14s; }
.inbox-list .item:nth-child(5)  { animation-delay: .17s; }
.inbox-list .item:nth-child(6)  { animation-delay: .20s; }
.inbox-list .item:nth-child(7)  { animation-delay: .23s; }
.inbox-list .item:nth-child(8)  { animation-delay: .26s; }
.inbox-list .item:nth-child(9)  { animation-delay: .29s; }
.inbox-list .item:nth-child(10) { animation-delay: .32s; }

/* ───── MOBILE ───── */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0 4px;
    border-right: 0; border-top: 1px solid var(--line);
    z-index: 50;
    overflow: visible;
    background: var(--side);
  }
.brand,
.side-foot{ display: none; }
  /* Desktop nav-group layout is hidden on mobile; mob-bottom-bar is a flex row */
  .nav-group { display: none; }
  .mob-bottom-bar {
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    gap: 0;
  }
  .mob-bottom-bar .nav-item,
  .mob-more-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 4px 6px;
    font-size: 12px;
    line-height: 1.2;
    color: var(--text-secondary, #94a3b8);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .12s;
  }
  .mob-bottom-bar .nav-item .ico,
  .mob-more-btn .ico {
    width: 20px; height: 20px;
    color: var(--muted);
    flex-shrink: 0;
    transition: color .12s;
  }
  .mob-bottom-bar .nav-item:hover,
  .mob-more-btn:hover { color: var(--text); }
  .mob-bottom-bar .nav-item:hover .ico,
  .mob-more-btn:hover .ico { color: var(--soft); }
  .mob-bottom-bar .nav-item.active {
    color: var(--accent);
    box-shadow: inset 0 2px 0 var(--accent);
  }
  .mob-bottom-bar .nav-item.active .ico { color: var(--accent); }
  .mob-bottom-bar .nav-label,
  .mob-more-btn .nav-label {
    display: block;
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mob-more-btn.active { color: var(--accent); }
  .mob-more-btn.active .ico { color: var(--accent); }
  .nav-item .badge { display: none; }

  /* "Ещё" full-screen drawer */
  #mobile-more-drawer {
    position: fixed;
    bottom: 56px; left: 0; right: 0; top: 0;
    background: var(--bg);
    z-index: 200;
    overflow-y: auto;
    flex-direction: column;
  }
  .mob-drawer-inner {
    padding: 0 0 24px;
  }
  .mob-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0;
    background: var(--bg);
    z-index: 1;
  }
  .mob-drawer-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
  }
  .mob-drawer-subtitle {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.25;
  }
  .mob-drawer-search {
    display: grid;
    gap: 6px;
    padding: 10px 16px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 58px;
    z-index: 1;
  }
  .mob-drawer-search input {
    min-width: 0;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 500;
  }
  .mob-drawer-tree {
    overflow-y: auto;
    overscroll-behavior: contain;
    max-height: calc(100dvh - 154px);
    padding-bottom: 18px;
  }
  .mob-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: none; background: none;
    cursor: pointer;
    color: var(--muted);
    border-radius: var(--r-md);
    transition: background .12s, color .12s;
  }
  .mob-drawer-close:hover { background: var(--surface); color: var(--text); }
  .mob-drawer-close .i { width: 18px; height: 18px; }
  .mob-drawer-group {
    padding: 12px 14px 4px;
  }
  .mob-drawer-h {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: 0 2px 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
  }
  .mob-drawer-items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .mob-drawer-item {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    text-align: left;
    border-radius: var(--r-md);
  }
  .mob-drawer-item .ico { width: 20px !important; height: 20px !important; }
  .mob-drawer-route {
    margin-left: auto;
    max-width: 46%;
    overflow: hidden;
    color: var(--muted);
    font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .inbox {
    position: fixed; bottom: 64px; right: 8px;
    width: min(360px, calc(100vw - 16px));
    height: min(60vh, 520px);
    border-radius: var(--r-2xl);
    border: 1px solid var(--line);
    box-shadow: var(--sh-3);
    z-index: 40;
    display: none;
  }
  .top-segments { display: none; }
  .inbox.open { display: flex; }
  .inbox-close { display: inline-flex; }
  .inbox-toggle-btn { display: inline-flex; }
  .ws-body { padding: 16px 14px 72px; }
  .ws-top { padding: 10px 14px; }
}

@media (max-width: 720px) {
  .ws-top .ws-kbd { display: none; }
  .deal-drawer-overlay {
    padding: 0;
  }
  .deal-drawer {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .entity-command-header {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .entity-command-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .entity-command-actions .btn {
    flex: 1 1 140px;
  }
  .focus-actions,
  .entity-form-grid {
    grid-template-columns: 1fr;
  }
}
