/* Админка Flipio: раскладка страниц поверх дизайн-системы кабинета
   (/static/lk/theme.css + /static/lk/flipio.css). Префикс классов ad-. */
html, body { margin: 0; height: 100%; }
body { background: var(--surface-subtle); }

/* приложение: тёмная навигация слева, контент справа */
.ad-app { display: flex; min-height: 100vh; }
.ad-app > .fl-sidebar { width: 240px; flex: none; min-height: 100vh; position: sticky; top: 0; align-self: flex-start; box-sizing: border-box; }
.ad-app > .fl-main { flex: 1 1 auto; min-width: 0; }
.ad-logo { display: flex; align-items: center; gap: 10px; }
.ad-logo img { height: 28px; }
.ad-logo .fl-badge { background: var(--green); color: var(--ink-on-green); border-color: transparent; }
.ad-profile { position: relative; margin-top: auto; }
.ad-profile > summary { list-style: none; cursor: pointer; }
.ad-profile > summary::-webkit-details-marker { display: none; }
.ad-profile .fx-pop { position: absolute; left: 0; bottom: calc(100% + 8px); width: 280px; padding: 8px;
  display: flex; flex-direction: column; gap: 4px; z-index: 20; color: var(--ink); }
.ad-profile .fx-pop .fl-nav-item { color: var(--ink); height: 40px; }
.ad-profile .fx-pop .fl-nav-item:hover { background: var(--surface-subtle); color: var(--ink); }
.ad-profile .fx-pop button.fl-nav-item { width: 100%; border: 0; background: transparent; font: inherit; cursor: pointer; }
.ad-name { font: 500 14px/20px var(--font-sans); color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* вход и смена пароля: бренд-панель + карточка формы */
.ad-auth { display: flex; flex-wrap: wrap; min-height: 100vh; }
.ad-auth__brand { flex: 1 1 420px; min-width: 0; display: flex; }
.ad-auth__main { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 24px; padding: 48px 24px; position: relative; }
.ad-brand { width: 100%; min-height: 100vh; box-sizing: border-box; background: var(--surface-brand);
  color: var(--ink-on-brand); padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  gap: 40px; position: relative; overflow: hidden; }
.ad-brand h2 { font: 800 40px/44px var(--font-display); letter-spacing: -0.02em; color: var(--ink-on-brand); margin: 0; }
.ad-brand p { font: 400 18px/28px var(--font-sans); color: rgba(255,255,255,.78); margin: 0; }
.ad-brand__deco { position: absolute; width: 320px; height: 320px; border-radius: 56px; }
.ad-card { width: 440px; max-width: 100%; padding: 32px; display: flex; flex-direction: column; gap: 20px; box-sizing: border-box; }
.ad-card h1 { font: 700 24px/32px var(--font-display); letter-spacing: -0.01em; margin: 0; }
.ad-lead { color: var(--ink-muted); font-size: 14px; line-height: 20px; margin: 0; }
.ad-eye { position: absolute; right: 8px; top: 8px; }
.ad-hint-ok { color: var(--green-text); }

/* уведомления */
.ad-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); font: 400 14px/20px var(--font-sans); }
.ad-note b { font-weight: 600; }
.ad-note svg { flex: none; }
.ad-note--info { background: var(--info-soft); color: var(--info); }
.ad-note--success { background: var(--success-soft); color: var(--success); }
.ad-note--danger { background: var(--danger-soft); color: var(--danger); }
.ad-note--warning { background: var(--warning-soft); color: var(--warning); }
.ad-secret { font: 600 18px/24px var(--font-mono); letter-spacing: .04em; background: var(--surface); color: var(--ink);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 4px 10px; user-select: all; }

/* пустые и ошибочные состояния */
.ad-center { display: flex; align-items: center; justify-content: center; padding: 48px 0; }
.ad-state { max-width: 520px; width: 100%; padding: 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; box-sizing: border-box; }
.ad-state h1 { font: 700 28px/36px var(--font-display); letter-spacing: -0.01em; margin: 0; }
.ad-empty { padding: 32px 16px; text-align: center; color: var(--ink-muted); }

/* сетки и блоки */
.ad-stack { display: flex; flex-direction: column; gap: 24px; }
.ad-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.ad-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.ad-panel { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ad-panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ad-panel__head h2 { font: 700 18px/26px var(--font-display); margin: 0; }
.ad-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ad-muted { color: var(--ink-muted); }
.ad-mono { font-family: var(--font-mono); font-size: 13px; }
.ad-kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font: 400 14px/20px var(--font-sans); }
.ad-kv dt { color: var(--ink-muted); }
.ad-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ad-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ad-person > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.ad-person b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-person .fx-caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* таблицы */
.ad-table { overflow-x: auto; }
.ad-table td { vertical-align: top; }
.ad-table .fl-table { min-width: 720px; }
.ad-table .ad-wide { min-width: 200px; }
.ad-table .ad-person { min-width: 180px; }
.ad-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.ad-actions form { display: inline; }
.ad-row-link { cursor: pointer; }

/* фильтры над таблицей и вкладки */
.ad-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.ad-filters .fl-field { min-width: 160px; }
.ad-filters .ad-search { flex: 1 1 260px; }
.ad-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ad-tabs a { padding: 10px 14px; font: 500 14px/20px var(--font-sans); color: var(--ink-muted); text-decoration: none !important; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ad-tabs a:hover { color: var(--ink) !important; }
.ad-tabs a[aria-current="page"] { color: var(--ink) !important; border-bottom-color: var(--navy); }
.ad-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* столбики по дням */
.ad-cols { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.ad-cols__col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; position: relative; }
.ad-cols__col span { display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--chart-1); }
.ad-cols__col--zero span { background: var(--chart-grid); }
.ad-cols__col:hover span { background: var(--navy); }
.ad-cols__axis { display: flex; justify-content: space-between; font: 500 11px/16px var(--font-sans); color: var(--ink-faint); }

/* горизонтальные полосы: воронка и топы */
.ad-bars { display: flex; flex-direction: column; gap: 10px; }
.ad-bars__row { display: grid; grid-template-columns: minmax(120px, 200px) 1fr 88px; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; font-size: 14px; }
.ad-bars__bar { height: 12px; border-radius: 6px; background: var(--surface-subtle); overflow: hidden; }
.ad-bars__bar span { display: block; height: 100%; border-radius: 6px; background: var(--chart-1); }
.ad-bars__num { text-align: right; }

/* лента событий */
.ad-feed { display: flex; flex-direction: column; }
.ad-feed__item { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 20px; }
.ad-feed__item:last-child { border-bottom: 0; }
.ad-feed__at { color: var(--ink-muted); font-variant-numeric: tabular-nums; font-size: 13px; }

/* уведомление в углу */
.ad-toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; }

@media (max-width: 1100px) {
  .ad-grid3 { grid-template-columns: 1fr; }
  .fl-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) { .ad-grid2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .ad-app { flex-direction: column; }
  .ad-app > .fl-sidebar { width: auto; min-height: 0; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 16px; align-self: stretch; }
  .ad-app > .fl-sidebar .fl-sidebar__group { flex-direction: row; flex-wrap: wrap; }
  .ad-app > .fl-sidebar .fl-nav-item { white-space: nowrap; }
  .ad-nav-label { display: none; }
  .ad-profile { margin-top: 0; margin-left: auto; }
  .ad-profile > summary > span:not(.fl-avatar) { display: none !important; }
  .ad-profile .fx-pop { left: auto; right: 0; top: calc(100% + 8px); bottom: auto; }
  .fl-main { padding: 20px 16px 32px; }
  .fl-stat-grid { grid-template-columns: 1fr; gap: 12px; }
  .ad-auth__brand { flex-basis: 100%; }
  .ad-brand { min-height: 0; padding: 32px 20px 24px; gap: 16px; }
  .ad-brand h2 { font-size: 24px; line-height: 28px; }
  .ad-brand p, .ad-brand__deco { display: none; }
  .ad-auth__main { padding: 20px 16px 32px; justify-content: flex-start; }
  .ad-card { padding: 24px 20px; }
  .ad-bars__row { grid-template-columns: 1fr 64px; }
  .ad-bars__bar { grid-column: 1 / -1; grid-row: 2; }
  .ad-feed__item { grid-template-columns: 1fr; gap: 2px; }
  .ad-toast { left: 16px; right: 16px; bottom: 16px; }
  .ad-toast .fl-toast { width: auto; }
}
