/* =========================================================
   shell.css — оболочка приложения: сайдбар, топбар, контент
   ========================================================= */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 100vh;
  min-height: 100vh;
}

/* ---------- Сайдбар ---------- */
.sidebar {
  grid-row: 1;
  display: flex; flex-direction: column;
  background: var(--deep);
  color: var(--on-deep-3);
  border-right: 1px solid var(--deep-line);
  height: 100vh;
  position: sticky; top: 0;
  overflow-y: auto;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--deep-line);
  flex: none;
}
.sidebar__mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--brand-fill); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
  letter-spacing: -0.02em; border-radius: var(--radius);
}
.sidebar__title { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar__abbr { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--on-deep); }
.sidebar__sub { font-size: 11px; color: var(--on-deep-4); }

.sidebar__nav { padding: 12px 12px; flex: 1; }
.nav-group { margin-bottom: 6px; }
.nav-group__label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--on-deep-4);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin: 1px 0;
  color: var(--on-deep-3);
  font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  position: relative;
}
.nav-item:hover { background: var(--deep-fill); color: var(--on-deep); }
.nav-item.on { background: var(--deep-fill); color: var(--on-deep); }
.nav-item.on::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item .count { margin-left: auto; }

.sidebar__foot {
  padding: 12px; border-top: 1px solid var(--deep-line); flex: none;
}
.sidebar__user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background var(--dur-fast);
}
.sidebar__user:hover { background: var(--deep-fill); }
.sidebar__user .avatar { background: var(--deep-fill); color: var(--on-deep); }
.sidebar__user-meta { min-width: 0; line-height: 1.25; }
.sidebar__user-name { font-size: 13px; font-weight: 600; color: var(--on-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 11px; color: var(--on-deep-4); }

/* ---------- Область контента ---------- */
.main { grid-row: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow-y: auto; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); flex: none;
  padding: 0 clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; }
.topbar__crumb { font-size: 14px; font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__crumb .dim { color: var(--muted); font-weight: 400; }
.topbar__spacer { flex: 1; }

/* Глобальный поиск */
.gsearch { position: relative; width: min(340px, 40vw); }
.gsearch__input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  font-size: 13.5px; color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 999px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.gsearch__input:focus { outline: none; border-color: var(--brand); background: var(--bg); box-shadow: 0 0 0 3px var(--focus-ring); }
.gsearch__ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.gsearch__pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-3);
  max-height: 60vh; overflow-y: auto; padding: 6px; display: none;
}
.gsearch__pop.on { display: block; }
.ghit { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); cursor: pointer; }
.ghit:hover, .ghit.on { background: var(--bg-soft); }
.ghit__ic { width: 16px; height: 16px; color: var(--muted); flex: none; }
.ghit__t { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghit__type { margin-left: auto; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); flex: none; }

.iconbtn {
  position: relative;
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  color: var(--ink-2); background: none;
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.iconbtn:hover { background: var(--bg-soft); border-color: var(--line); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn__dot {
  position: absolute; top: 7px; right: 8px;
  min-width: 8px; height: 8px; border-radius: 999px;
  background: var(--signal); border: 2px solid var(--bg);
}
.iconbtn__dot--count {
  top: 4px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; color: #fff;
}

.content {
  flex: 1;
  padding: clamp(20px, 3vw, 34px) clamp(16px, 3vw, 34px) 64px;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
}
.content--wide { max-width: 1320px; }

/* Затемнитель под мобильным сайдбаром */
.scrim {
  position: fixed; inset: 0; z-index: 45;
  background: var(--scrim);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur);
}

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-4);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar__menu { display: grid; }
  .gsearch { width: auto; flex: 1; }
}
@media (max-width: 560px) {
  .gsearch { display: none; }
  .gsearch.expanded { display: block; position: absolute; left: 16px; right: 16px; top: 11px; }
}

/* Дропдаун-меню (уведомления, профиль) */
.dropdown {
  position: absolute; top: calc(var(--topbar-h) - 6px); right: clamp(16px, 3vw, 32px); z-index: 70;
  width: min(380px, calc(100vw - 32px));
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: dropIn var(--dur) var(--ease);
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.dropdown__hd { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.dropdown__hd h4 { font-size: 14px; font-weight: 600; }
.dropdown__body { max-height: 62vh; overflow-y: auto; }
.dropdown__foot { padding: 10px 16px; border-top: 1px solid var(--line); text-align: center; }
.linkbtn { background: none; border: 0; color: var(--brand); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 3px; }
.linkbtn:hover { text-decoration: underline; }
