/* Оболочка: левая навигация, верхняя строка, рабочая область, панель карточки справа, вход, телефон. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--t-md); line-height: 1.5;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
body.noscroll { overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s5); box-shadow: var(--shadow-2); display: grid; gap: var(--s4); }
.login-card h1 { font-size: var(--t-xl); margin: 0; letter-spacing: -.01em; }
.login-card form { display: grid; gap: var(--s3); }
.login-card .sub { color: var(--muted); font-size: var(--t-sm); margin-top: calc(var(--s1) * -2); }

/* оболочка */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s1); padding: var(--s4) var(--s3);
  border-right: 1px solid var(--line); background: var(--sunk); }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 650; font-size: var(--t-lg); padding: var(--s1) var(--s2) var(--s4); letter-spacing: -.01em; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); }
.brand-mark svg { width: 15px; height: 15px; }
.nav a { display: flex; align-items: center; gap: var(--s3); padding: 7px var(--s2); border-radius: var(--r-sm); color: var(--muted);
  text-decoration: none; font-size: var(--t-md); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--line-soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a .short { display: none; }
.nav-foot { margin-top: auto; padding: var(--s2); font-size: var(--t-xs); color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; height: var(--top-h); display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .searchrow { flex: 1; max-width: 560px; position: relative; display: block; }
.top .searchrow input { width: 100%; padding-right: 36px; }
.top .kbd-hint { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.top .spacer { flex: 1; }
.top .who { color: var(--muted); font-size: var(--t-sm); white-space: nowrap; }

/* строка свежести данных: кнопка в шапке, по нажатию список источников под ней. «Внимание» = --warn */
.fresh { position: relative; flex: none; min-width: 0; }
button.fresh-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px 4px 10px; border-radius: var(--r-pill);
  background: transparent; color: var(--muted); border: 1px solid transparent; font-size: var(--t-sm); font-weight: 500; white-space: nowrap; }
button.fresh-btn:hover { background: var(--line-soft); color: var(--ink); filter: none; }
button.fresh-btn svg { width: 15px; height: 15px; flex: none; }
button.fresh-btn .chev { width: 14px; height: 14px; transition: transform .12s; }
button.fresh-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
button.fresh-btn.warn { color: var(--warn); background: var(--warn-soft); }
button.fresh-btn.warn:hover { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.fresh-text { overflow: hidden; text-overflow: ellipsis; }
.fresh-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 6; width: 440px; max-width: calc(100vw - 2 * var(--s3));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: var(--s3) var(--s4); display: grid; gap: var(--s2); }
.fresh-panel h2 { font-size: var(--t-md); font-weight: 600; }
.fresh-list { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--s4); margin: 0; font-size: var(--t-sm); }
.fresh-list dt { color: var(--ink); min-width: 0; }
.fresh-list dd { margin: 0; color: var(--ink); white-space: nowrap; text-align: right; }
.fresh-list dd.warn { color: var(--warn); font-weight: 600; }
.fresh-list dd.none { color: var(--muted); }
.fresh-note { margin: 0; padding: 6px var(--s2); border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: var(--t-sm); }
.fresh-tz { margin: 0; color: var(--muted); font-size: var(--t-xs); }
.view { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--s5); display: grid; gap: var(--s5); align-content: start; }
.page-head h1 { font-size: var(--t-2xl); line-height: 1.2; margin: 0; letter-spacing: -.015em; font-weight: 650; }
.page-head p { margin: var(--s1) 0 0; color: var(--muted); }

/* панель карточки */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-w), 100vw); background: var(--bg); z-index: 21;
  border-left: 1px solid var(--line); box-shadow: var(--shadow-2); display: flex; flex-direction: column; }
.drawer-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s2) var(--s4);
  border-bottom: 1px solid var(--line); background: var(--surface); }
.drawer-bar .link { color: var(--muted); font-size: var(--t-sm); }
.drawer-body { overflow-y: auto; padding: var(--s4); display: grid; gap: var(--s4); align-content: start; flex: 1; overscroll-behavior: contain; }

/* узкий экран: строка свежести уходит второй строкой шапки, под поиск */
@media (max-width: 1100px) {
  .top { flex-wrap: wrap; height: auto; min-height: var(--top-h); row-gap: 2px; padding-top: var(--s2); padding-bottom: 6px; }
  .fresh { order: 5; flex-basis: 100%; }
  button.fresh-btn { padding: 2px 8px 2px 6px; }
}

/* телефон: нижняя панель, карточка на весь экран */
@media (max-width: 760px) {
  .shell { display: block; }
  .nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; top: auto; height: auto; flex-direction: row; gap: 0;
    padding: var(--s1) var(--s1) calc(var(--s1) + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: var(--surface); }
  .brand, .nav-foot { display: none; }
  .nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 6px 0; justify-content: center; font-size: 10px; border-radius: var(--r-sm); }
  .nav a .full { display: none; }
  .nav a .short { display: inline; }
  .top { padding: var(--s2) var(--s3) 6px; }
  .top .who, .top .kbd-hint, .top .spacer { display: none; }
  .top .theme span { display: none; }
  .top .searchrow { max-width: none; }
  .view { padding: var(--s4) var(--s3) calc(88px + env(safe-area-inset-bottom, 0px)); gap: var(--s4); }
  .page-head h1 { font-size: var(--t-xl); }
  .drawer { width: 100vw; border-left: 0; }
  .scrim { display: none; }
}
