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

/* приложение: тёмная навигация слева, контент справа */
.lk-app { display: flex; min-height: 100vh; }
.lk-app > .fl-sidebar { width: 240px; flex: none; min-height: 100vh; position: sticky; top: 0; align-self: flex-start; }
.lk-app > .fl-main { flex: 1 1 auto; }
.fl-nav-item[aria-disabled="true"] { opacity: .56; cursor: default; }
.fl-nav-item[aria-disabled="true"]:hover { background: transparent; }

/* меню профиля из аватара — без JS, на <details> */
.lk-profile { position: relative; margin-top: auto; }
.lk-profile > summary { list-style: none; cursor: pointer; }
.lk-profile > summary::-webkit-details-marker { display: none; }
.lk-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); }
.lk-profile .fx-pop .fl-nav-item { color: var(--ink); height: 40px; }
.lk-profile .fx-pop .fl-nav-item:hover { background: var(--surface-subtle); color: var(--ink); }
.lk-profile .fx-pop button.fl-nav-item { width: 100%; border: 0; background: transparent; font: inherit; cursor: pointer; }
.lk-name { font: 500 14px/20px var(--font-sans); color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* вход и первая смена пароля: бренд-панель + карточка формы */
.lk-auth { display: flex; flex-wrap: wrap; min-height: 100vh; }
.lk-auth__brand { flex: 1 1 420px; min-width: 0; display: flex; }
.lk-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; }
.lk-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; }
.lk-brand h2 { font: 800 40px/44px var(--font-display); letter-spacing: -0.02em; color: var(--ink-on-brand); text-wrap: pretty; margin: 0; }
.lk-brand p { font: 400 18px/28px var(--font-sans); color: rgba(255,255,255,.78); margin: 0; }
.lk-brand__facts { display: flex; gap: 24px; flex-wrap: wrap; position: relative; }
.lk-brand__facts b { display: block; font: 800 24px/28px var(--font-display); }
.lk-brand__facts span { font: 400 13px/18px var(--font-sans); color: rgba(255,255,255,.72); }
.lk-brand__deco { position: absolute; width: 320px; height: 320px; border-radius: 56px; }
.lk-card { width: 440px; max-width: 100%; padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.lk-card h1 { font: 700 24px/32px var(--font-display); letter-spacing: -0.01em; }
.lk-lead { color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.lk-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); font: 400 14px/20px var(--font-sans); }
.lk-note b { font-weight: 600; }
.lk-note--info { background: var(--info-soft); color: var(--info); }
.lk-note--danger { background: var(--danger-soft); color: var(--danger); }
.lk-note--warning { background: var(--warning-soft); color: var(--warning); }
.lk-note svg { flex: none; }
.lk-eye { position: absolute; right: 8px; top: 8px; }
.lk-hint-ok { color: var(--green-text); }
.lk-legal { font: 400 12px/16px var(--font-sans); color: var(--ink-muted); text-align: center; max-width: 440px; }

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

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

@media (max-width: 760px) {
  .lk-app { flex-direction: column; }
  .lk-app > .fl-sidebar { width: auto; min-height: 0; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .lk-app > .fl-sidebar .fl-sidebar__group { flex-direction: row; }
  .lk-app > .fl-sidebar .fl-nav-item { white-space: nowrap; }
  .lk-app > .fl-sidebar .fl-nav-item[aria-disabled="true"] { display: none; }
  .lk-profile { margin-top: 0; margin-left: auto; }
  .lk-profile > summary > span:not(.fl-avatar) { display: none !important; }
  .lk-profile .fx-pop { left: auto; right: 0; top: calc(100% + 8px); bottom: auto; }
  .fl-main { padding: 20px 16px 32px; }
  .lk-auth__brand { flex-basis: 100%; }
  .lk-brand { min-height: 0; padding: 32px 20px 24px; gap: 16px; }
  .lk-brand h2 { font-size: 24px; line-height: 28px; }
  .lk-brand p, .lk-brand__facts, .lk-brand__deco { display: none; }
  .lk-auth__main { padding: 20px 16px 32px; justify-content: flex-start; }
  .lk-card { padding: 24px 20px; }
  .lk-toast { left: 16px; right: 16px; bottom: 16px; }
  .lk-toast .fl-toast { width: auto; }
}

/* узкая рейка (карта): только иконки */
.lk-app--compact > .fl-sidebar { width: 64px; padding: 20px 10px; align-items: center; }
.lk-app--compact .fl-sidebar__logo { padding: 0; height: 32px; }
.lk-app--compact .fl-sidebar__logo img { height: 32px; }
.lk-app--compact .fl-nav-item { width: 44px; height: 44px; padding: 0; justify-content: center; }
.lk-app--compact .fl-nav-item .fl-icon { width: 22px; height: 22px; }
.lk-app--compact .lk-nav-label { display: none !important; }
.lk-app--compact .fl-sidebar__user { padding: 6px; }
.lk-app--compact .lk-profile .fx-pop { left: 56px; bottom: 0; }
.lk-bleed { flex: 1 1 auto; min-width: 0; position: relative; }

/* ---------- карта флипов ---------- */
.lk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lk-map { position: relative; height: 100vh; min-height: 560px; overflow: hidden; background: var(--map-ground); }
.lk-map__canvas { position: absolute; inset: 0 var(--lk-panel, 420px) 0 0; }
.lk-map__canvas .lk-map-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--ink-muted); }
.lk-map__top { position: absolute; left: 20px; top: 20px; right: calc(var(--lk-panel, 420px) + 20px); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; z-index: 5; pointer-events: none; }
.lk-map__top > * { pointer-events: auto; }
.lk-search { width: 400px; max-width: 100%; }
.lk-search .fl-input-wrap { box-shadow: var(--shadow-md); border-radius: var(--radius-md); }
.lk-map__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lk-map__chips .fl-chip { box-shadow: var(--shadow-sm); }
.lk-map__zoom { position: absolute; right: calc(var(--lk-panel, 420px) + 20px); bottom: 24px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.lk-map__zoom .fl-btn { width: 44px; height: 44px; box-shadow: var(--shadow-md); }
.lk-map__open { position: absolute; right: 20px; top: 20px; z-index: 6; box-shadow: var(--shadow-md); }
.lk-tip { position: absolute; z-index: 8; width: 272px; pointer-events: none; display: flex; flex-direction: column; gap: 6px; }
.lk-tip dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 0; font-size: 13px; }
.lk-tip dt { color: rgba(255,255,255,.72); }
.lk-tip dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.lk-hexlabel { transform: translate(-50%, -50%); font: 700 13px/1 var(--font-display); font-variant-numeric: tabular-nums; pointer-events: none; text-shadow: 0 0 3px rgba(255,255,255,.7); }
.lk-hexlabel--dark { color: #ffffff; text-shadow: 0 0 3px rgba(26,34,56,.5); }
.lk-dot { transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #ffffff; border: 2px solid #ffffff;
  display: grid; place-items: center; font: 700 12px/1 var(--font-display); box-shadow: 0 1px 3px rgba(26,34,56,.3); cursor: pointer; padding: 0; }
.lk-dot--cluster { width: 36px; height: 36px; font-size: 13px; background: var(--surface-brand); }
.lk-dot:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* фильтры справа */
.lk-filters { position: absolute; top: 0; right: 0; bottom: 0; width: var(--lk-panel, 420px); max-width: 100%; display: flex; flex-direction: column;
  background: var(--surface-raised); border-left: 1px solid var(--border); box-shadow: var(--shadow-md); z-index: 7; }
.lk-filters__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.lk-filters__head h2 { font: 700 18px/26px var(--font-display); }
.lk-filters__body { flex: 1 1 0; min-height: 0; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.lk-filters__body section { display: flex; flex-direction: column; gap: 10px; }
.lk-filters__foot { border-top: 1px solid var(--border); padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-subtle); }
.lk-row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lk-chip { position: relative; display: inline-flex; }
.lk-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lk-chip .fl-chip { cursor: pointer; }
.lk-chip input:checked + .fl-chip { background: var(--navy); color: var(--ink-on-navy); border-color: var(--navy); }
.lk-chip input:focus-visible + .fl-chip { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.fl-segmented label { position: relative; display: inline-flex; }
.fl-segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fl-segmented label span { height: 30px; padding: 0 12px; border-radius: 8px; font: 500 13px/30px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.fl-segmented input:checked + span { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.fl-segmented input:focus-visible + span { outline: 2px solid var(--focus-ring); }
.fl-segmented input:disabled + span { opacity: .5; cursor: default; }
.lk-more summary { cursor: pointer; font-size: 13px; list-style: none; }
.lk-more summary::-webkit-details-marker { display: none; }
.lk-more[open] summary { margin-bottom: 10px; }
.lk-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.lk-legend { display: flex; flex-direction: column; gap: 6px; }
.lk-legend__bar { display: flex; gap: 2px; }
.lk-legend__bar span { flex: 1; height: 12px; }
.lk-legend__bar span:first-child { border-radius: 3px 0 0 3px; }
.lk-legend__bar span:last-child { border-radius: 0 3px 3px 0; }
.lk-legend__labels { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.lk-map.lk-map--folded { --lk-panel: 0px; }
.lk-map--folded .lk-filters { display: none; }
.lk-map--folded .lk-map__open { display: inline-flex; }

@media (max-width: 760px) {
  .lk-map { height: calc(100vh - 64px); --lk-panel: 0px; }
  .lk-map__top { left: 12px; right: 12px; top: 12px; }
  .lk-map__chips { display: none; }
  .lk-map__open { top: auto; bottom: 24px; right: auto; left: 12px; display: inline-flex; }
  .lk-map__zoom { right: 12px; }
  .lk-filters { width: 100%; top: auto; height: 80%; border-radius: 24px 24px 0 0; display: none; }
  .lk-map--sheet .lk-filters { display: flex; }
}
.lk-map .lk-map__open { display: none; }
.lk-map.lk-map--folded .lk-map__open { display: inline-flex; }
@media (max-width: 760px) { .lk-map .lk-map__open { display: inline-flex; } }
.lk-tip[hidden] { display: none; }
@media (max-width: 760px) {
  .lk-app--compact > .fl-sidebar { width: auto; align-self: stretch; flex-direction: row; align-items: center; padding: 10px 16px; height: 64px; box-sizing: border-box; }
  .lk-app--compact .fl-sidebar__group { flex-direction: row; }
  .lk-app--compact .lk-profile .fx-pop { left: auto; right: 0; top: calc(100% + 8px); bottom: auto; }
}

/* ---------- панель дома и карточка флипа ---------- */
.lk-house { position: absolute; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100%; z-index: 9;
  background: var(--surface-subtle); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; }
.lk-house[hidden] { display: none; }
.lk-house__inner { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.lk-house__head { padding: 16px 20px 14px; border-bottom: 1px solid var(--border); background: var(--surface-raised); display: flex; flex-direction: column; gap: 10px; }
.lk-house__head h2 { font: 700 22px/28px var(--font-display); letter-spacing: -0.01em; }
.lk-house__body { flex: 1 1 0; min-height: 0; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.lk-house__loading { padding: 24px 20px; color: var(--ink-muted); }
.lk-stack { display: flex; flex-direction: column; gap: 12px; }
.lk-stack h3, .lk-flip h3 { font: 700 16px/22px var(--font-display); }
.lk-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lk-grid2--wide { gap: 24px; }
.lk-stat { padding: 14px 16px; gap: 4px; }
.lk-kv { padding: 14px 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; }
.lk-kv dl { margin: 0; }
.lk-kv__note { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--border); color: var(--green-text); font: 500 13px/20px var(--font-sans); }
.lk-kv__note--down { color: var(--ink-muted); }
.lk-flip { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.lk-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lk-pair__side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lk-shot { position: relative; height: 140px; border-radius: var(--radius-md); overflow: hidden; background: var(--navy-soft); }
.lk-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lk-shot img[hidden] { display: none; }
.lk-shot--after { background: var(--green-soft); }
.lk-shot--none { display: grid; place-items: center; align-content: center; gap: 4px; background: var(--surface-subtle); color: var(--ink-muted); border: 1px dashed var(--border-strong); text-align: center; padding: 12px; }
.lk-shot__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; }
.lk-shot__nav--prev { left: 6px; } .lk-shot__nav--next { right: 6px; }
.lk-row-gap { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lk-price { font: 700 16px/22px var(--font-display); font-variant-numeric: tabular-nums; }
.lk-price span { font: 400 13px/20px var(--font-sans); color: var(--ink-muted); }
.lk-flip .fx-timeline { padding-bottom: 18px; }
.lk-delta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lk-delta b { font: 800 20px/24px var(--font-display); color: var(--green-text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.lk-delta__pct { font: 600 14px/20px var(--font-sans); color: var(--green-text); }
.lk-delta--big { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lk-delta--big b { font-size: 28px; line-height: 34px; }
.lk-note-data { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-subtle); font: 400 13px/20px var(--font-sans); color: var(--ink-muted); }
.lk-note-data svg { flex: none; width: 18px; height: 18px; color: var(--navy); }
.lk-page { max-width: 1200px; display: flex; flex-direction: column; gap: 24px; }
.lk-h2 { font: 700 18px/26px var(--font-display); }
.lk-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.lk-gallery__item { margin: 0; position: relative; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 4 / 3; background: var(--navy-soft); }
.lk-gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lk-gallery__item figcaption { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; }
.lk-gallery.lk-only-interior .lk-gallery__item--other { display: none; }
.lk-link-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; text-decoration: none; color: var(--ink); }
.lk-link-card:hover { box-shadow: var(--shadow-md); }
@media (max-width: 760px) {
  .lk-house { width: 100%; top: auto; height: 88%; border-radius: 24px 24px 0 0; overflow: hidden; }
  .lk-grid2--wide { grid-template-columns: 1fr; }
  .lk-kv { grid-template-columns: 1fr; }
  .lk-shot { height: 110px; }
}
.lk-kv dd, .lk-kv dt { white-space: nowrap; } .lk-kv .fx-kv { gap: 8px; }
#lk-house-title:focus { outline: none; }

/* ---------- отчёты ---------- */
.lk-h1 { font: 700 24px/32px var(--font-display); letter-spacing: -0.01em; }
.lk-progress { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 8px; }
.lk-table { overflow-x: auto; }
.lk-table td { vertical-align: top; }
.lk-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.lk-actions form { display: inline; }
.lk-scroll { overflow-x: auto; }
.lk-scroll[hidden] { display: none; }
.fl-table .muted, .lk-page .muted { color: var(--ink-muted); font-weight: 400; }
.fl-table .pos { color: var(--green-text); }
.lk-row-on { background: var(--navy-soft); }
.lk-callout { padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-subtle); font: 500 14px/20px var(--font-sans); }
.lk-bars { display: flex; flex-direction: column; gap: 6px; }
.lk-bars__row { display: grid; grid-template-columns: 96px 1fr 32px; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
.lk-bars__bar { height: 10px; border-radius: 5px; background: var(--surface-subtle); overflow: hidden; }
.lk-bars__bar span { display: block; height: 100%; background: var(--hex-4); }
.lk-chips form { display: inline-flex; }

/* «Флипы вокруг этой точки?» — карточка заказа отчёта на карте */
.lk-point { position: absolute; z-index: 8; width: 320px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.lk-point[hidden] { display: none; }
.lk-point h3 { font: 700 16px/22px var(--font-display); }
.lk-pin { width: 16px; height: 16px; border-radius: 50%; background: var(--navy); border: 3px solid #ffffff; box-shadow: 0 0 0 2px var(--navy); transform: translate(-50%, -50%); }

@media print {
  .lk-app > .fl-sidebar, .lk-noprint, .lk-toast { display: none !important; }
  .fl-main { padding: 0; }
  .fl-card { box-shadow: none; break-inside: avoid; }
}
@media (max-width: 760px) {
  .lk-point { left: 12px !important; right: 12px; top: auto !important; bottom: 80px; width: auto; }
}
.lk-grid-houses { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 960px) { .lk-grid-houses { grid-template-columns: 1fr; } }
.lk-pairs td { white-space: nowrap; }
.lk-pairs td.strong { white-space: normal; min-width: 200px; }
@media (max-width: 760px) {
  .lk-app > .fl-sidebar { flex-wrap: nowrap; }
  .lk-app > .fl-sidebar .lk-nav-label { display: none !important; }
  .lk-app > .fl-sidebar .fl-nav-item { width: 44px; justify-content: center; padding: 0; }
  .lk-table thead { display: none; }
  .lk-table table, .lk-table tbody, .lk-table tr, .lk-table td { display: block; width: auto; }
  .lk-table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .lk-table td { border: 0 !important; padding: 2px 0 !important; text-align: left !important; }
  .lk-table td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-muted); }
  .lk-actions { justify-content: flex-start; margin-top: 8px; }
}
@media (max-width: 760px) { .lk-app > .fl-sidebar { align-self: stretch; } }
