/* ============================================================================
   GapSync — component skeletons (docs/10 §2) not present in the donor system.
   Consumes semantic tokens from tokens.css and the shell tokens from app.css
   (radii, shadows, lines, inks, typography). Load order:
   fonts.css → tokens.css → app.css → components.css.
   ========================================================================== */

/* ---------------------------------------------------------------- Badges
   Color + text label, never color alone (docs/10 §8). Background is a faint
   tint of the same token; text and border carry the AA-checked color. */
.status-badge, .severity-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid currentColor; background: transparent;
  background: color-mix(in srgb, currentColor var(--badge-tint, 12%), transparent);
}
.status-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.status-badge.draft     { color: var(--s-draft); }
.status-badge.review    { color: var(--s-review); }
.status-badge.approved  { color: var(--s-approved); }
.status-badge.active    { color: var(--s-active); }
.status-badge.suspended { color: var(--s-suspended); }
.status-badge.rejected  { color: var(--s-rejected); }
.status-badge.closed    { color: var(--s-closed); }
.status-badge.expired   { color: var(--s-expired); }

/* Severity adds a color-independent icon shape per level (docs/10 §8):
   ▪ low, ● medium, ▲ high, ▲ critical (filled, heavier). */
.severity-badge::before { content: '\25AA'; font-size: 10px; line-height: 1; }
.severity-badge.low      { color: var(--sev-low); }
.severity-badge.medium   { color: var(--sev-medium); }
.severity-badge.medium::before   { content: '\25CF'; }
.severity-badge.high     { color: var(--sev-high); }
.severity-badge.high::before     { content: '\25B2'; }
.severity-badge.critical { color: var(--sev-critical); font-weight: 700; }
.severity-badge.critical::before { content: '\25B2'; }

/* ---------------------------------------------------------------- Stepper
   Permit wizard progress (docs/10 §2). <ol class="stepper"> of <li>, mark
   the current step .on and completed steps .done. */
.stepper { display: flex; list-style: none; margin: 0 0 22px; padding: 0; gap: 4px; counter-reset: step; }
.stepper li {
  flex: 1 1 0; min-width: 0; counter-increment: step; position: relative;
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.stepper li::before {
  content: counter(step); flex: 0 0 auto; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%; font-family: var(--mono); font-size: 11px;
  background: var(--sink); color: var(--ink-dim); border: 1px solid var(--line-2);
}
.stepper li.on { border-color: var(--emerald); color: var(--ink); background: var(--panel); box-shadow: var(--shadow-sm); }
.stepper li.on::before { background: linear-gradient(130deg, var(--emerald), var(--emerald-dim)); color: var(--ink-on-accent); border-color: transparent; }
.stepper li.done { color: var(--ink-dim); }
.stepper li.done::before { content: '\2713'; background: rgba(47, 157, 104, 0.14); color: var(--emerald-2); border-color: rgba(47, 157, 104, 0.4); }
.stepper .step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .stepper { flex-direction: column; }
}

/* ---------------------------------------------------------------- SLA clock
   Due countdown (docs/10 §2); .overdue flips to the critical severity token. */
.sla-clock {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--raise);
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--ink-dim); white-space: nowrap;
}
.sla-clock::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--emerald-bright); box-shadow: var(--glow-emerald); flex: 0 0 auto;
}
.sla-clock.warn { color: var(--sev-medium); border-color: currentColor; }
.sla-clock.warn::before { background: var(--sev-medium); box-shadow: none; }
.sla-clock.overdue {
  color: var(--sev-critical); border-color: currentColor; font-weight: 700;
  background: color-mix(in srgb, currentColor var(--badge-tint, 12%), transparent);
}
.sla-clock.overdue::before { background: var(--sev-critical); box-shadow: var(--glow-red); animation: livePulse 1.6s ease-in-out infinite; }

/* ---------------------------------------------------------------- Filter bar
   GET form above every list (docs/10 §6): fields + chips for active filters. */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px;
  padding: 14px 16px; margin-bottom: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.filter-bar .field { flex: 1 1 160px; }
.filter-bar .filter-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.filter-bar .filter-chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px;
  border-radius: 999px; border: 1px solid rgba(47, 157, 104, 0.4);
  background: rgba(47, 157, 104, 0.1); color: var(--emerald-2); font-size: 12px;
}
.filter-chip a, .filter-chip button {
  display: inline-grid; place-items: center; background: none; border: 0; padding: 0;
  color: inherit; cursor: pointer; font-size: 13px; line-height: 1; font-family: inherit;
}
@media (max-width: 720px) {
  .filter-bar .field { flex: 1 1 100%; }
  .filter-bar .filter-actions { flex: 1 1 100%; }
  .filter-bar .filter-actions .btn { flex: 1; }
}

/* ---------------------------------------------------------------- Map panel
   Fixed-height embedded map container (docs/10 §3); the full-screen explorer
   uses .map-wrap from app.css instead. Legend chips reuse app.css .lg dots. */
.map-panel {
  position: relative; height: 380px; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: var(--map-bg);
}
.map-panel .map-canvas, .map-panel > .leaflet-container { width: 100%; height: 100%; }
.map-panel__legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 500;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--overlay-strong); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 7px 12px; backdrop-filter: blur(6px); font-size: 12px;
}
.map-panel__legend i.lg { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
@media (max-width: 720px) { .map-panel { height: 300px; } }

/* ---------------------------------------------------------------- Empty state
   Icon + message + CTA for every empty list (docs/10 §6). */
.empty-state {
  display: grid; place-items: center; gap: 6px; text-align: center;
  padding: 44px 20px; color: var(--muted);
}
.empty-state .empty-ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--raise); border: 1px solid var(--line); margin-bottom: 6px;
}
.empty-state .empty-ico svg { width: 22px; height: 22px; fill: var(--muted); }
.empty-state h3 { margin: 0; font-size: 15px; color: var(--ink); }
.empty-state p { margin: 0; font-size: 13px; max-width: 46ch; }
.empty-state .btn { margin-top: 12px; }

/* ---------------------------------------------------------------- Timeline
   Status-history extensions. The base .timeline/.tl-dot/.tl-type/.tl-ts rail
   ships in app.css; these add semantic dot variants + an actor line. */
.timeline .tl-dot.amber { background: var(--amber); box-shadow: none; }
.timeline .tl-dot.red   { background: var(--red); box-shadow: var(--glow-red); }
.timeline .tl-dot.sky   { background: var(--sky); box-shadow: none; }
.timeline .tl-dot.muted { background: var(--faint); box-shadow: none; }
.timeline .tl-actor { color: var(--ink-dim); font-size: 12px; }
.timeline .tl-note { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* ---------------------------------------------------------------- Descriptor list
   Detail key/value pairs (docs/10 §2 descriptor-list). */
.kv-descriptor { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 0 18px; margin: 0; }
.kv-descriptor dt {
  padding: 9px 0; color: var(--muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line-soft);
}
.kv-descriptor dd { margin: 0; padding: 9px 0; font-size: 13.5px; color: var(--ink); border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.kv-descriptor dt:last-of-type, .kv-descriptor dd:last-of-type { border-bottom: 0; }
@media (max-width: 480px) {
  .kv-descriptor { grid-template-columns: 1fr; }
  .kv-descriptor dt { border-bottom: 0; padding-bottom: 0; }
}

/* ---------------------------------------------------------------- Pagination
   Skeleton for templates/partials/pagination.php. */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination .page-current, .pagination .page-gap {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px;
  border-radius: 9px; font-size: 13px; font-family: var(--mono);
}
.pagination a { border: 1px solid var(--line-2); color: var(--ink-dim); background: var(--raise); transition: all var(--ease); }
.pagination a:hover { border-color: var(--emerald); color: var(--emerald-2); text-decoration: none; }
.pagination .page-current { background: linear-gradient(130deg, var(--emerald), var(--emerald-dim)); color: var(--ink-on-accent); font-weight: 700; }
.pagination .page-gap { color: var(--faint); }
.pagination .page-meta { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- Flash toasts
   Session-flash toasts (partials/flash.php) reuse app.css .toast but pin to
   the viewport instead of the nearest positioned ancestor. */
.toasts-fixed { position: fixed; bottom: 18px; right: 18px; z-index: 90; }
