/* =========================================================================
   App navigation skeleton loader
   -------------------------------------------------------------------------
   Replaces the generic full-page spinner ("Loading…") shown while a nav
   link is loading the next page. Instead of a spinner, we paint a skeleton
   of the *target* page (chosen from the destination URL) so the perceived
   load feels instant and on-brand.

   The chrome (sidebar rail + topbar) is shared because the authenticated
   shell is identical on every route. The content area is route-specific:
   the Pipeline route gets a faithful kanban skeleton; other routes fall
   back to generic content blocks.

   All colors come from the --dwi-* design tokens (themes/tokens.css +
   theme-dealworthit.css) with neutral fallbacks so white-label brands and
   pre-token pages still render reasonable greys.
   ========================================================================= */

.skl-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: var(--dwi-color-page, #f7f8fa);
  display: flex;
  overflow: hidden;
  animation: skl-fade-in .12s ease-out;
}
@keyframes skl-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Shimmer placeholder block — the single primitive every variant is built from */
.skl-box {
  position: relative;
  overflow: hidden;
  background: var(--dwi-color-line-soft, #eef0f3);
  border-radius: 8px;
  flex: none;
}
.skl-box::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
  animation: skl-shimmer 1.3s ease-in-out infinite;
}
@keyframes skl-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skl-box::after { animation: none; } }

/* A static hairline (dividers / column rules) — no shimmer */
.skl-line { background: var(--dwi-color-line-soft, #eef0f3); flex: none; }

/* =========================================================================
   Shared chrome: 212px sidebar rail + 58px topbar (mirrors the dwi shell)
   ========================================================================= */
.skl-aside {
  flex: none;
  width: 212px;
  height: 100%;
  background: var(--dwi-color-surface, #ffffff);
  border-right: 1px solid var(--dwi-color-line, #e8eaf0);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
}
/* Logo: mark + wordmark (wordmark hidden when collapsed) */
.skl-aside-logo { display: flex; align-items: center; gap: 10px; padding: 4px 4px 0; margin-bottom: 8px; }
.skl-logo-mark { width: 30px; height: 30px; border-radius: 8px; }
.skl-logo-text { width: 96px; height: 14px; border-radius: 5px; }

/* Nav block is vertically centered in the rail, mirroring the real menu's
   `my-auto` — so collapsed icons sit toward the middle, not pinned to top. */
.skl-nav-region { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.skl-nav { display: flex; flex-direction: column; gap: 4px; }
.skl-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
}
.skl-nav-item.is-selected { background: var(--dwi-color-primary-soft, #e7f3ee); }
.skl-nav-ic { width: 18px; height: 18px; border-radius: 5px; }
.skl-nav-tx { height: 11px; border-radius: 5px; flex: 1; max-width: 96px; }

/* Footer: upgrade CTA + feedback button */
.skl-aside-footer { flex: none; display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.skl-aside-cta { height: 150px; border-radius: 12px; }
.skl-aside-foot { display: flex; gap: 8px; }
.skl-aside-foot .skl-box { flex: 1; height: 34px; border-radius: 8px; }

/* ── Collapsed rail (mirrors body[data-kt-aside-minimize="on"]: 96px,
   centered icon-only rows, no labels, logo mark only, CTA → icon square).
   Triggers on EITHER the JS-applied `.skl-collapsed` (nav overlay, live body
   state) OR the early pre-paint `html[data-dwi-aside-collapsed="1"]` marker
   (server-rendered in-page skeletons, e.g. deal detail) — same value, so both
   paths land on an identical collapsed rail with no flash. ── */
.skl-collapsed .skl-aside,
html[data-dwi-aside-collapsed="1"] .skl-aside { width: 96px; padding: 14px 10px; }
.skl-collapsed .skl-aside-logo,
html[data-dwi-aside-collapsed="1"] .skl-aside-logo { justify-content: center; padding: 6px 0 0; }
.skl-collapsed .skl-logo-text,
html[data-dwi-aside-collapsed="1"] .skl-logo-text { display: none; }
.skl-collapsed .skl-nav-item,
html[data-dwi-aside-collapsed="1"] .skl-nav-item { justify-content: center; padding: 12px 10px; }
.skl-collapsed .skl-nav-tx,
html[data-dwi-aside-collapsed="1"] .skl-nav-tx { display: none; }
.skl-collapsed .skl-aside-cta,
html[data-dwi-aside-collapsed="1"] .skl-aside-cta { height: 56px; }

.skl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.skl-topbar {
  flex: none;
  height: 58px;
  background: var(--dwi-color-surface, #ffffff);
  border-bottom: 1px solid var(--dwi-color-line, #e8eaf0);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}
.skl-bc { display: flex; align-items: center; gap: 8px; flex: none; }
.skl-bc .skl-box { height: 12px; border-radius: 5px; }
.skl-bc .skl-bc-a { width: 42px; }
.skl-bc .skl-bc-sep { width: 6px; }
.skl-bc .skl-bc-b { width: 86px; }
.skl-search { flex: 0 1 360px; height: 38px; border-radius: 8px; margin: 0 auto; }
.skl-top-right { margin-left: auto; flex: none; display: flex; align-items: center; gap: 12px; }
.skl-top-ic { width: 34px; height: 34px; border-radius: 8px; }
.skl-balance { width: 92px; height: 34px; border-radius: 8px; }
.skl-avatar { width: 38px; height: 38px; border-radius: 50%; }

/* Content viewport — clips horizontally so an overflowing board is cut off
   at the edge exactly like the real (scrollable) pipeline board.

   Geometry contract: every .skl-content ALSO carries the destination page's
   shell classes (`dwi-page-shell dwi-page-shell--<variant>`, defined in
   common_styles.css) — added by init.js skeletonShell() for the JS nav
   overlay and hardcoded in server-rendered skeletons (deal_detail_skeleton
   .html). The shell supplies max-width + margin-inline:auto from the same
   --dwi-page-* tokens as the real page, so the skeleton canvas sits exactly
   where the loaded page's canvas will sit — no horizontal jump when content
   resolves. No width values are duplicated here. */
.skl-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 30px;
  overflow: hidden;
}

@media (max-width: 991px) {
  .skl-aside { display: none; }
  .skl-search { flex-basis: 200px; }
}
@media (max-width: 991.98px) {
  /* Track the page shell's mobile gutter (common_styles.css: 15px). */
  .skl-content { padding-inline: 15px; }
}

/* =========================================================================
   Pipeline route — faithful kanban skeleton
   Geometry mirrors common_styles.css + theme-dealworthit-pipeline.css:
   304px lanes, 16px gaps, 2px column rule, 13px-radius cards, 2-col metrics.
   ========================================================================= */
.skl-pipe-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--dwi-color-line-soft, #eef0f3);
  flex: none;
}
.skl-pipe-icon { width: 44px; height: 44px; border-radius: 11px; }
.skl-pipe-titles { display: flex; flex-direction: column; gap: 8px; }
.skl-pipe-title { width: 168px; height: 20px; border-radius: 6px; }
.skl-pipe-sub { width: 246px; height: 12px; border-radius: 5px; }
.skl-pipe-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.skl-pipe-actions .skl-box { height: 34px; border-radius: 9px; }
.skl-act-filter { width: 84px; }
.skl-act-fav { width: 104px; }
.skl-act-toggle { width: 70px; }
.skl-act-bulk { width: 116px; }

.skl-kboard {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-width: max-content;
  flex: 1;
  min-height: 0;
}
.skl-kcol { width: 304px; flex: none; display: flex; flex-direction: column; }
.skl-kcol-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 4px 12px;
  /* Neutral rule only — stage status colors are NOT applied during loading:
     they read too strong and aren't meaningful until real data resolves. */
  border-bottom: 2px solid var(--dwi-color-line, #e4e6ef);
}
/* Dot and count pill stay neutral shimmer blocks (no stage colors). */
.skl-kcol-dot { width: 8px; height: 8px; border-radius: 50%; }
.skl-kcol-title { width: 92px; height: 11px; border-radius: 5px; }
.skl-kcol-count { width: 30px; height: 18px; border-radius: 7px; margin-left: auto; }
.skl-kzone { display: flex; flex-direction: column; gap: 12px; padding: 12px 2px; }

/* Deal card — mirrors .kcard (border, 13px radius, 13px inner padding) */
.skl-kcard {
  background: var(--dwi-color-surface, #ffffff);
  border: 1px solid var(--dwi-color-line, #eef0f8);
  border-radius: 13px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.skl-kc-head { display: flex; align-items: flex-start; gap: 10px; }
.skl-kc-thumb { width: 38px; height: 38px; border-radius: 9px; }
.skl-kc-htext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.skl-kc-title { width: 82%; height: 12px; border-radius: 5px; }
.skl-kc-addr { width: 58%; height: 9px; border-radius: 5px; }
.skl-kc-grip { width: 8px; height: 16px; border-radius: 3px; }
.skl-kc-badges { display: flex; align-items: center; gap: 5px; }
.skl-kc-badge { height: 15px; border-radius: 20px; }
.skl-kc-badge.b1 { width: 72px; }
.skl-kc-badge.b2 { width: 48px; }
.skl-kc-badge.b3 { width: 56px; }
.skl-kc-divider { height: 1px; margin: 0; }
.skl-kc-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; }
.skl-kc-metric { height: 28px; border-radius: 6px; }
.skl-kc-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.skl-kc-foot-top { border-top: 1px solid var(--dwi-color-line-soft, #f1f3f9); }
.skl-kc-date { width: 56px; height: 24px; border-radius: 5px; }
.skl-kc-actions { display: flex; gap: 4px; }
.skl-kc-act { width: 26px; height: 26px; border-radius: 7px; }

/* =========================================================================
   Generic fallback content (finder / dashboard / table / form)
   ========================================================================= */
.skl-row { display: flex; gap: 18px; }
.skl-grow { flex: 1; min-width: 0; }

/* Finder / search */
.skl-finder-filters { display: flex; gap: 12px; flex-wrap: wrap; flex: none; }
.skl-finder-filters .skl-box { height: 40px; border-radius: 9px; flex: 1; min-width: 120px; }
.skl-finder-body { display: flex; gap: 20px; flex: 1; min-height: 0; }
.skl-finder-list { flex: 0 0 38%; display: flex; flex-direction: column; gap: 16px; }
.skl-finder-card { height: 132px; border-radius: 14px; }
.skl-finder-map { flex: 1; border-radius: 14px; min-height: 320px; }

/* Table pages (team) */
.skl-table { display: flex; flex-direction: column; gap: 12px; }
.skl-table .skl-thead { height: 44px; border-radius: 10px; }
.skl-table .skl-trow { height: 58px; border-radius: 10px; }

/* Market intelligence + dashboard */
.skl-stats { display: flex; gap: 18px; flex-wrap: wrap; flex: none; }
.skl-stats .skl-box { flex: 1; min-width: 160px; height: 110px; border-radius: 14px; }
.skl-charts { display: flex; gap: 18px; flex-wrap: wrap; flex: 1; }
.skl-charts .skl-box { flex: 1; min-width: 280px; min-height: 300px; border-radius: 14px; }

/* Settings / profile */
.skl-form { display: flex; gap: 24px; flex-wrap: wrap; }
.skl-form .skl-form-side { flex: 0 0 240px; height: 320px; border-radius: 14px; }
.skl-form .skl-form-main { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 18px; }
.skl-form .skl-field { height: 52px; border-radius: 10px; }

/* =========================================================================
   Deal detail route — header, tab nav, scenario row, status strip, KPI cards,
   overview cards. Neutral skeleton colors only; geometry tracks property.html
   so nothing jumps when the real page resolves.
   ========================================================================= */
/* Header: title + analysis pill + meta, with New-Deal + more actions at right */
.skl-dd-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--dwi-color-line-soft, #eef0f3);
  flex: none;
}
.skl-dd-titles { display: flex; flex-direction: column; gap: 11px; flex: 1; min-width: 0; }
.skl-dd-title { width: 360px; max-width: 72%; height: 24px; border-radius: 6px; }
.skl-dd-metarow { display: flex; align-items: center; gap: 10px; }
.skl-dd-pill { width: 132px; height: 16px; border-radius: 20px; }
.skl-dd-meta { width: 210px; height: 12px; border-radius: 5px; }
.skl-dd-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.skl-dd-btn { width: 120px; height: 38px; border-radius: 9px; }
.skl-dd-more { width: 46px; height: 38px; border-radius: 9px; }

/* Tab nav card (Overview / Underwrite / Reports / Property Data / … / Notes) */
.skl-dd-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--dwi-color-line, #e8eaf0);
  border-radius: 12px;
  margin-bottom: 18px;
  flex: none;
}
.skl-dd-tab { width: 104px; height: 20px; border-radius: 6px; }

/* Scenario row: Main / Cloned / New / Compare */
.skl-dd-scenarios { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; flex: none; }
.skl-dd-scn { width: 122px; height: 32px; border-radius: 8px; }
.skl-dd-scn.is-wide { width: 152px; }

/* Status / metadata strip: stage · status · created · updated · active scenario,
   then upload + continue-underwriting buttons pushed right */
.skl-dd-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--dwi-color-line, #e8eaf0);
  border-radius: 12px;
  margin-bottom: 20px;
  flex: none;
}
.skl-dd-chip { width: 98px; height: 30px; border-radius: 8px; }
.skl-dd-strip-sp { flex: 1 1 auto; min-width: 12px; }
.skl-dd-strip-btn { width: 156px; height: 34px; border-radius: 8px; }

/* KPI card row: Purchase Price · NOI · Cap Rate · Cash on Cash · DSCR */
.skl-dd-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; flex: none; }
.skl-dd-kpi { height: 96px; border-radius: 12px; }

/* Overview content: investment snapshot card + property facts card + rows */
.skl-dd-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.skl-dd-card {
  border: 1px solid var(--dwi-color-line, #e8eaf0);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.skl-dd-card-title { width: 168px; height: 16px; border-radius: 6px; }
.skl-dd-rows { display: flex; flex-direction: column; gap: 13px; }
.skl-dd-rowline { height: 14px; border-radius: 5px; }
.skl-dd-rowline.w90 { width: 90%; }
.skl-dd-rowline.w70 { width: 70%; }
.skl-dd-rowline.w80 { width: 80%; }
.skl-dd-rowline.w60 { width: 60%; }

@media (max-width: 1200px) {
  .skl-dd-kpis { grid-template-columns: repeat(2, 1fr); }
  .skl-dd-overview { grid-template-columns: 1fr; }
}
