/* AUT-A6-100 (FR-21): изолированный Jinja shell для /board, /metrics, /people.
   AUT-A6-102: палитра принятого макета «АкваЛаб — сдержанный поток заявок».
   Все правила scoped под .app-shell — никакого влияния на /backlog, /ui,
   /login и другие non-shell страницы. style.css не изменяется. */

.app-shell {
  --shell-navy: #111E2E;
  --shell-navy-deep: #152538;
  --shell-blue: #2255D9;
  --shell-blue-dark: #2149C4;
  --shell-cyan: #69C8E8;
  --shell-logo: #2B8CD8;
  --shell-workspace: #F3F6FA;
  --shell-paper: #FFFDF7;
  --shell-ink: #172438;
  --shell-muted: #6D7683;
  --shell-line: #DDE4EE;
  --shell-line-soft: #DDDED8;
  --shell-column: #EDF2F9;
  --shell-column-border: #E2E8F1;
  --shell-nav-text: #C7D2E0;

  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: var(--shell-workspace);
  color: var(--shell-ink);
}

/* ---------- Sidebar ---------- */

.app-shell .shell-sidebar {
  flex: 0 0 236px;
  width: 236px;
  background: linear-gradient(180deg, var(--shell-navy) 0%, var(--shell-navy-deep) 100%);
  color: var(--shell-nav-text);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 20px;
}

.app-shell .shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.app-shell .shell-brand-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 26px;
}

.app-shell .shell-brand-bars i {
  display: block;
  width: 3px;
  border-radius: 2px;
}

/* Три полосы логотипа — точные цвета контракта A6-99/A6-102. */
.app-shell .shell-brand-bars i:nth-child(1) {
  background: #69C8E8;
  height: 18px;
}

.app-shell .shell-brand-bars i:nth-child(2) {
  background: #2B8CD8;
  height: 26px;
}

.app-shell .shell-brand-bars i:nth-child(3) {
  background: #2255D9;
  height: 22px;
}

.app-shell .shell-brand-word {
  color: var(--shell-paper);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.12em;
}

.app-shell .shell-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-shell .shell-nav-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--shell-nav-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.app-shell .shell-nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--shell-paper);
}

/* Активный пункт макета: синяя заливка + cyan контур 2px. */
.app-shell .shell-nav-item.active {
  background: var(--shell-blue);
  color: var(--shell-paper);
  box-shadow: inset 0 0 0 2px var(--shell-cyan);
}

.app-shell .shell-nav-item:focus-visible {
  outline: 2px solid var(--shell-cyan);
  outline-offset: 2px;
}

/* Нижний блок sidebar: состав потока (только когда страница передала columns). */
.app-shell .shell-flow {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
}

.app-shell .shell-flow-caption {
  color: var(--shell-cyan);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
}

.app-shell .shell-flow-title {
  color: var(--shell-paper);
  font-weight: 600;
  font-size: 13px;
}

.app-shell .shell-flow-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-shell .shell-flow-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 3px 8px;
  color: var(--shell-nav-text);
}

.app-shell .shell-flow-count b {
  color: var(--shell-paper);
  font-weight: 600;
}

.app-shell .shell-flow-meta {
  color: var(--shell-muted);
  line-height: 1.5;
}

.app-shell .shell-flow-meta b {
  color: var(--shell-nav-text);
  font-weight: 500;
}

/* ---------- Main column: topbar + content ---------- */

.app-shell .shell-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-shell .shell-topbar {
  height: 66px;
  flex: 0 0 66px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: var(--shell-paper);
  border-bottom: 1px solid var(--shell-line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-shell .shell-menu-button {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: var(--shell-paper);
  color: var(--shell-ink);
  cursor: pointer;
}

.app-shell .shell-menu-button:focus-visible {
  outline: 2px solid var(--shell-blue);
  outline-offset: 2px;
}

.app-shell .shell-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
}

.app-shell .shell-crumb-root {
  color: var(--shell-muted);
  text-decoration: none;
  white-space: nowrap;
}

.app-shell .shell-crumb-root:hover {
  color: var(--shell-blue);
  text-decoration: underline;
}

.app-shell .shell-crumb-sep {
  color: var(--shell-line);
}

.app-shell .shell-crumb-current {
  color: var(--shell-ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell .shell-service {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-shell .shell-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: var(--shell-paper);
  color: var(--shell-ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.app-shell .shell-btn:hover {
  background: var(--shell-workspace);
}

.app-shell .shell-btn-primary {
  background: var(--shell-blue);
  border-color: var(--shell-blue);
  color: var(--shell-paper);
}

.app-shell .shell-btn-primary:hover {
  background: var(--shell-blue-dark);
}

.app-shell .shell-btn:focus-visible {
  outline: 2px solid var(--shell-blue);
  outline-offset: 2px;
}

.app-shell .shell-heart {
  background: none;
  border: none;
  border-radius: 10px;
}

.app-shell .shell-heart:focus-visible {
  outline: 2px solid var(--shell-blue);
  outline-offset: 2px;
}

/* Контент по системе координат макета: область контента x=264…1412 →
   max-width 1204 (28px поля с каждой стороны, внутренняя ширина 1148);
   верхний отступ 28px (eyebrow y=94). */
.app-shell .shell-content {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1204px;
  margin: 0 auto;
  padding: 28px;
}

.app-shell .shell-anon-note {
  margin-bottom: 20px;
  background: var(--shell-paper);
  border: 1px solid var(--shell-line-soft);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Контейнеризация широких таблиц контента (metrics aging-table): на узких
   экранах прокрутка остаётся внутри таблицы, документ без горизонтального
   overflow. Содержимое страниц не меняется. */
.app-shell .shell-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.app-shell .shell-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 40;
}

/* ---------- Mobile drawer (<1024px) ---------- */

@media (max-width: 1023px) {
  .app-shell .shell-menu-button {
    display: inline-flex;
  }

  .app-shell .shell-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.35);
  }

  .app-shell.drawer-open .shell-sidebar {
    transform: translateX(0);
  }

  .app-shell .shell-topbar {
    padding: 0 16px;
  }

  .app-shell .shell-content {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .shell-sidebar,
  .app-shell .shell-nav-item,
  .app-shell .shell-btn {
    transition: none;
  }
}

/* A6-136-MOBILE-ADAPTATION: мобильная шапка и светлая палитра ≤1023px. */
@media (max-width: 1023px) {
  .app-shell {
    --shell-blue: #4F86E8;
    --shell-blue-dark: #2F67C8;
    --shell-workspace: #F4F6FA;
    --shell-paper: #FFFDF8;
    --shell-ink: #17233C;
    --shell-muted: #65708A;
    --shell-line: #DDE3ED;
  }

  .app-shell .shell-topbar {
    height: 58px; flex-basis: 58px; gap: 8px; padding: 0 16px;
  }
  .app-shell .shell-crumbs { flex: 1 1 auto; gap: 6px; min-width: 0; font-size: 13px; }
  .app-shell .shell-service { flex: 0 0 auto; gap: 4px; }
  .app-shell .shell-heart {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; flex: 0 0 44px;
  }
  .app-shell .shell-btn { min-height: 44px; padding: 8px 10px; font-size: 12px; }
  .app-shell .shell-content { padding: 16px; }
}

@media (max-width: 360px) {
  .app-shell .shell-crumb-root,
  .app-shell .shell-crumb-sep { display: none; }
  .app-shell .shell-crumb-current { display: block; min-width: 0; }
}
