/* Каркас: сайдбар, основная панель, шапка (поиск, тема, уведомления, профиль), заголовок страницы, панель периода. */

/* ── Сайдбар ── */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  display: flex; flex-direction: column; padding: 40px 16px 16px; background: var(--sb-bg); color: var(--sb-ink);
  overflow: hidden auto; scrollbar-width: none; overscroll-behavior: contain;
  transition: width var(--t-slow), padding var(--t-slow), transform var(--t-slow), visibility var(--t-slow);
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar > * { flex-shrink: 0; }
.sb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; }
.sb-close { display: none; width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--sb-field); color: var(--sb-ink-2); place-items: center; flex: none; }
.sb-close svg { width: 18px; height: 18px; }
.sb-close:hover { color: var(--sb-ink); }
.sb-close:active { transform: scale(.94); }
.logo { position: relative; display: flex; align-items: center; gap: 12px; color: var(--sb-ink); min-width: 0; }
.logo-text, .nav a span, .status-text, .sb-collapse span { transition: opacity var(--t-fast); }
.logo-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: var(--dark); display: grid; place-items: center; flex: none; }
/* оптический центр: у знака лёгкая крыша и тяжёлое основание — поднимаем на половину смещения центра масс */
.logo-mark svg { width: 22px; height: 28px; fill: currentColor; transform: translateY(-4%); }
.logo-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
.logo-sub { font-size: 12px; color: var(--sb-muted); font-weight: 500; white-space: nowrap; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-muted); padding: 20px 12px 8px; white-space: nowrap; }
.sb-top + .nav-label { padding-top: 28px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--r-ctl); color: var(--sb-ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-press); }
.nav a:not(.active):hover { background: var(--sb-field); color: var(--sb-ink); }
.nav a:active { transform: scale(.985); }
.nav a.active { background: var(--brand-wash); color: #e3c9a4; font-weight: 600; }
.nav a.active svg { color: var(--brand); }
.nav svg { width: 20px; height: 20px; flex: none; }
.status { position: relative; margin-top: auto; border-radius: 16px; background: var(--brand); color: var(--dark); display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.status.stale { background: #3a2a27; color: #f3d2cd; }
.status-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(26, 26, 26, .12); flex: none; }
.status.stale .status-ic { background: rgba(255, 255, 255, .08); color: #ec7a74; }
.status-ic svg { width: 17px; height: 17px; }
.status-t { font-size: 14px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.status-d { font-size: 12px; opacity: .72; white-space: nowrap; }
.nav-gap { flex: 1 0 20px; }
/* кнопка сворачивания — над карточкой синхронизации, отделена от меню тонкой линией; выглядит как пункт меню */
.sb-collapse { position: relative; margin: 13px 0 12px; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: none; color: var(--sb-ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; text-align: left; }
.sb-collapse::before { content: ''; position: absolute; left: 12px; right: 12px; top: -13px; height: 1px; background: var(--sb-line); }
.sb-collapse svg { width: 20px; height: 20px; flex: none; transition: transform var(--t-slow); }
.sb-collapse:hover { color: var(--sb-ink); background: var(--sb-field); }

/* свёрнутый сайдбар — только иконки */
.app.mini .sidebar { width: var(--sidebar-mini); padding-left: 12px; padding-right: 12px; }
.app.mini .main { margin-left: var(--sidebar-mini); }
.app.mini .sb-top { justify-content: center; padding: 0; }
.app.mini .logo-text, .app.mini .nav a span, .app.mini .status-text, .app.mini .sb-collapse span { position: absolute; opacity: 0; visibility: hidden; pointer-events: none; }
.app.mini .nav-label { font-size: 0; padding: 16px 0 8px; }
.app.mini .nav-label::after { content: ''; display: block; height: 1px; margin: 0 14px; background: var(--sb-line); }
.app.mini .sb-top + .nav-label { padding-top: 20px; }
.app.mini .nav a { justify-content: center; padding: 0; }
.app.mini .status { justify-content: center; padding: 12px 0; }
.app.mini .sb-collapse { justify-content: center; padding: 0; }
.app.mini .sb-collapse::before { left: 14px; right: 14px; }
.app.mini .sb-collapse svg { transform: scaleX(-1); }

/* ── Основная панель ── */
.main { margin-left: var(--sidebar); padding: 12px 12px 12px 0; min-height: 100vh; min-width: 0; transition: margin-left var(--t-slow); }
.panel { background: var(--panel); border-radius: var(--r-panel); min-height: calc(100vh - 24px); padding: 28px 40px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.search { position: relative; width: 360px; max-width: 100%; }
.search-field { height: 40px; border-radius: var(--r-ctl); background: var(--surface-2); display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--muted); }
.search-field svg { width: 18px; height: 18px; flex: none; }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; padding: 0; outline: none; font-size: 14px; color: var(--ink); }
.search-field input::placeholder { color: var(--muted); }
.search-field { transition: box-shadow var(--t-fast), background-color var(--t-fast); }
.search-field:hover { background: var(--track); }
.search-field:focus-within { background: var(--surface-2); box-shadow: 0 0 0 2px var(--brand); }
.search-results {
  position: absolute; z-index: 60; top: 46px; left: 0; right: 0; background: var(--panel); border-radius: 16px; padding: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .14), 0 0 0 1px var(--border); max-height: 360px; overflow-y: auto;
}
.search-results a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-size: 14px; }
.search-results a small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-results:not(.hidden) { animation: popIn var(--t-pop) var(--ease-out) both; transform-origin: top left; }
.search-results a { transition: background-color var(--t-fast); }
.search-results a.on, .search-results a:hover { background: var(--surface-2); }
.search-results .none { padding: 12px; color: var(--muted); font-size: 13px; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.theme-seg { position: relative; display: flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--surface-2); }
/* бегунок переезжает к активной кнопке */
.theme-seg::before { content: ''; position: absolute; top: 4px; left: 4px; width: 34px; height: 32px; border-radius: 999px; background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--border); transition: transform var(--t-slow), background-color var(--t-theme); }
.theme-seg.dark::before { transform: translateX(36px); }
.theme-seg button { position: relative; width: 34px; height: 32px; border-radius: 999px; display: grid; place-items: center; color: var(--muted); border: 0; background: none; transition: color var(--t-fast), transform var(--t-press); }
.theme-seg button svg { width: 17px; height: 17px; }
.theme-seg button:hover { color: var(--ink-2); }
.theme-seg button.on { color: var(--ink); }
.theme-seg button:active { transform: scale(.94); }
.round-btn { position: relative; width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); border: 0; list-style: none; }
.round-btn::-webkit-details-marker { display: none; }
.round-btn { transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-press); }
.round-btn:hover, .drop[open] > .round-btn { background: var(--track); color: var(--ink); }
.round-btn:active { transform: scale(.94); }
.round-btn svg { width: 20px; height: 20px; }
.round-btn.burger { display: none; }
.round-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--surface-2); }
.vsep { width: 1px; height: 28px; background: var(--border); margin: 0 4px; }
.drop { position: relative; }
.drop > summary { cursor: pointer; list-style: none; }
.drop > summary::-webkit-details-marker { display: none; }
.drop-panel {
  position: absolute; z-index: 60; right: 0; top: calc(100% + 8px); width: 340px; background: var(--panel); border-radius: 16px; padding: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .14), 0 0 0 1px var(--border); transform-origin: top right;
}
.drop[open] > .drop-panel { animation: popIn var(--t-pop) var(--ease-out) both; }
.drop-title { font-size: 13px; font-weight: 600; padding: 8px 10px 6px; }
.drop-item { display: flex; gap: 10px; padding: 10px; border-radius: 10px; font-size: 13px; color: var(--ink-2); transition: background-color var(--t-fast); }
.drop-item:hover { background: var(--surface); }
.drop-item svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.drop-item.crit svg { color: var(--critical); }
.drop-item.warn svg { color: var(--warning); }
.drop-item.info svg { color: var(--brand-ink); }
.drop-item b { display: block; color: var(--ink); font-weight: 600; }
.drop-empty { padding: 10px; font-size: 13px; color: var(--muted); }
.drop-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 0; background: none; font-size: 14px; color: var(--ink); text-align: left; }
.drop-btn svg { width: 18px; height: 18px; color: var(--muted); }
.drop-btn { transition: background-color var(--t-fast), transform var(--t-press); }
.drop-btn:hover { background: var(--surface-2); }
.drop-btn:active { transform: scale(.98); }
.user { display: flex; align-items: center; gap: 12px; padding: 4px 8px 4px 4px; margin: -4px -8px -4px -4px; border-radius: 999px; transition: background-color var(--t-fast); }
.user:hover, .drop[open] > .user { background: var(--surface-2); }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px; background: var(--dark); color: var(--brand); flex: none; letter-spacing: .01em; }
:root[data-theme="dark"] .av { background: #3a3631; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .av { background: #3a3631; } }
.av.sm { width: 30px; height: 30px; font-size: 11px; }
.user-name { font-size: 14px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.user-mail { font-size: 12px; color: var(--muted); white-space: nowrap; }
.user > svg { width: 16px; height: 16px; color: var(--muted); transition: transform var(--t-slow); }
.drop[open] > .user > svg { transform: rotate(180deg); }
.user-menu .drop-panel { width: 220px; }

.page-head { margin-top: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
.page-head p b { color: var(--ink-2); font-weight: 500; }
.page-head .tag { margin-left: 10px; vertical-align: 6px; }
.toolbar { margin-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.toolbar:empty { display: none; }
.toolbar .left, .toolbar .right { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.toolbar .right { margin-left: auto; }
.content { margin-top: 20px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.tag { display: inline-flex; align-items: center; height: 22px; font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 999px; background: var(--brand-wash); color: var(--brand-ink); white-space: nowrap; }
.scrim { display: none; }
