:root { --asw-brand: #0848ca; --asw-accent: #235b94; }
body { background: #f4f6fa; }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 250px; min-width: 250px; background: #14243f; color: #cfd6e4;
  min-height: 100vh; padding: 0 0 2rem;
}
.app-main { flex: 1 1 auto; min-width: 0; }

.app-brand {
  font-size: 1.15rem; font-weight: 700; color: #fff; padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08); line-height: 1.1;
}
.app-brand-sub { font-size: .7rem; font-weight: 500; color: #7ea2e0; letter-spacing: .12em; text-transform: uppercase; }
.app-nav-heading { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #6f86b6; padding: 1rem 1.25rem .35rem; }

.app-sidebar .nav-link { color: #cfd6e4; padding: .6rem 1.25rem; display: flex; align-items: center; gap: .6rem; border-left: 3px solid transparent; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.app-sidebar .nav-link.active { background: rgba(8,72,202,.22); color: #fff; border-left-color: var(--asw-brand); }

.kpi-card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.kpi-value { font-size: 1.7rem; font-weight: 700; }
.kpi-label { color: #667085; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 7px; }
.kpi-flag { display: inline-block; width: 22px; height: 15px; flex: 0 0 auto; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(16,24,40,.1); }
.kpi-flag svg { display: block; width: 100%; height: 100%; }
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #667085; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #14243f, #0848ca); }
.auth-card { width: 100%; max-width: 400px; border-radius: 14px; }

/* Shared add/edit drawer */
#appDrawer { width: 560px; max-width: 94vw; }
#appDrawer .offcanvas-body { padding-top: 1rem; }
#appDrawerBody > h1 { display: none; }
#appDrawerBody form { max-width: none !important; }

/* ============================================================
   Skeleton loading screen — pure-CSS shimmer + navigation overlay.
   The animation is 100% CSS; footer.ejs only toggles `.is-loading`.
   Theme via custom properties: light by default, dark by override.
   ============================================================ */
:root {
  --skeleton-page-bg: #f4f6fa;
  --skeleton-base: #e4e8ef;
  --skeleton-card-bg: #ffffff;
  --skeleton-card-border: rgba(16, 24, 40, 0.08);
  --skeleton-shimmer-soft: rgba(255, 255, 255, 0.35);
  --skeleton-shimmer-strong: rgba(255, 255, 255, 0.70);
  --skeleton-speed: 1.8s;
}
/* Dark override — the palette from the original spec. */
:root[data-theme="dark"], .skeleton-dark {
  --skeleton-page-bg: #0a0a0a;
  --skeleton-base: #1a1a1a;
  --skeleton-card-bg: #111213;
  --skeleton-card-border: rgba(255, 255, 255, 0.06);
  --skeleton-shimmer-soft: rgba(255, 255, 255, 0.04);
  --skeleton-shimmer-strong: rgba(255, 255, 255, 0.08);
}

@keyframes ap-skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton { position: relative; overflow: hidden; background-color: var(--skeleton-base); border-radius: 8px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(90deg, transparent 0%, var(--skeleton-shimmer-soft) 20%, var(--skeleton-shimmer-strong) 50%, var(--skeleton-shimmer-soft) 80%, transparent 100%);
  background-size: 200% 100%; background-repeat: no-repeat;
  animation: ap-skeleton-shimmer var(--skeleton-speed) ease-in-out infinite;
}
.skeleton--circle  { border-radius: 50%; }
.skeleton--text    { height: 14px; }
.skeleton--text-sm { height: 11px; }
.skeleton--image   { width: 100%; aspect-ratio: 16 / 9; }

.sk-w-100 { width: 100%; } .sk-w-80 { width: 80%; } .sk-w-65 { width: 65%; }
.sk-w-55 { width: 55%; } .sk-w-50 { width: 50%; } .sk-w-40 { width: 40%; } .sk-w-35 { width: 35%; }

/* Full-page navigation overlay: hidden until footer.ejs adds `.is-loading`. */
.app-skeleton {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--skeleton-page-bg); overflow: auto;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .15s ease;
}
.app-skeleton.is-loading { opacity: 1; visibility: visible; pointer-events: auto; }
.app-skeleton .sk-page { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }
.app-skeleton .sk-section { margin-bottom: 40px; }

.sk-profile { display: flex; align-items: center; gap: 16px; }
.sk-profile__avatar { width: 56px; height: 56px; flex: 0 0 56px; }
.sk-profile__lines { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 640px) { .sk-grid { grid-template-columns: 1fr; } }
.sk-card { background: var(--skeleton-card-bg); border: 1px solid var(--skeleton-card-border); border-radius: 12px; padding: 14px; }
.sk-card__body { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }

.sk-list { display: flex; flex-direction: column; }
.sk-list__row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--skeleton-card-border); }
.sk-list__row:last-child { border-bottom: none; }
.sk-list__avatar { width: 40px; height: 40px; flex: 0 0 40px; }
.sk-list__lines { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
  .app-skeleton { transition: none; }
}
