/* ============================================================
   Pine Forest of Oak Island — Development Status App
   Shared design system (blue / white brand identity)
   ============================================================ */

:root {
  /* Brand */
  --pf-navy: #0f2b45;
  --pf-blue: #135788;
  --pf-blue-dark: #0d3f63;
  --pf-blue-light: #4a8bc2;
  --pf-blue-pale: #eaf2f9;
  --pf-blue-pale-2: #dbe9f5;
  --pf-white: #ffffff;
  --pf-sand: #f6f4ef;

  /* Neutrals */
  --ink: #1b2733;
  --ink-soft: #4c5b6b;
  --ink-faint: #7c8896;
  --line: #dde5ec;
  --line-soft: #eef2f6;
  --bg: #f4f7fa;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 43, 69, 0.06), 0 1px 1px rgba(15, 43, 69, 0.04);
  --shadow-md: 0 6px 20px rgba(15, 43, 69, 0.10), 0 2px 6px rgba(15, 43, 69, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 43, 69, 0.20), 0 6px 16px rgba(15, 43, 69, 0.10);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  /* Status colors (non year-based) */
  --status-available: #135788;
  --status-available-bg: #ffffff;
  --status-contract: #d98c1f;
  --status-unreleased: #8b95a1;
  --status-model: #6a3fb5;
  --status-parking: #9aa4ad;

  /* Year palette — coastal, brand-adjacent, distinct at a glance */
  --year-2021: #2E86AB;
  --year-2022: #1B998B;
  --year-2023: #E3A72E;
  --year-2024: #D9714E;
  --year-2025: #8E7DBE;
  --year-2026: #4C7A3F;
  --year-2027: #C1566B;
  --year-2028: #33627A;
  --year-2029: #B08900;
  --year-2030: #6E7C87;

  --font-display: "Georgia", "Iowan Old Style", "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: var(--pf-blue); }

/* ---------- Scrollbar polish ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3d2de; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #a9bccb; }

/* ============================================================
   LOGIN / GATE
   ============================================================ */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 700px at 20% -10%, #1a5c8f 0%, var(--pf-navy) 55%, #081b2c 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(600px 300px at 85% 10%, rgba(255,255,255,0.06), transparent 60%),
    radial-gradient(500px 260px at 10% 95%, rgba(255,255,255,0.05), transparent 60%);
  pointer-events: none;
}
.gate-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.98);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 32px;
  text-align: center;
  animation: gateIn .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.gate-logo { width: 220px; margin: 0 auto 22px; }
.gate-card h1 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--pf-navy);
  margin: 0 0 6px;
  font-weight: 600;
}
.gate-card p.sub {
  color: var(--ink-faint);
  font-size: 14px;
  margin: 0 0 26px;
}
.gate-form { display: flex; flex-direction: column; gap: 14px; }
.pf-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  font-size: 15px;
  background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.pf-input:focus {
  border-color: var(--pf-blue-light);
  box-shadow: 0 0 0 4px var(--pf-blue-pale);
  background: #fff;
}
.pf-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.pf-btn:active { transform: translateY(1px); }
.pf-btn-primary {
  background: linear-gradient(180deg, var(--pf-blue), var(--pf-blue-dark));
  color: #fff;
  box-shadow: 0 6px 16px rgba(19,87,136,0.32);
}
.pf-btn-primary:hover { box-shadow: 0 8px 22px rgba(19,87,136,0.4); }
.pf-btn-ghost {
  background: transparent;
  color: var(--pf-blue);
  border: 1.5px solid var(--line);
}
.pf-btn-ghost:hover { background: var(--pf-blue-pale); border-color: var(--pf-blue-pale-2); }
.pf-btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.pf-btn-danger { background: #fff; color: #b3372c; border: 1.5px solid #f1c9c2; }
.pf-btn-danger:hover { background: #fdf1ef; }
.pf-btn:disabled { opacity: .55; cursor: not-allowed; }

.gate-error {
  color: #b3372c;
  background: #fdf1ef;
  border: 1px solid #f1c9c2;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  text-align: left;
  display: none;
}
.gate-error.show { display: block; }
.gate-footer {
  margin-top: 22px;
  font-size: 12px;
  color: var(--ink-faint);
}
.gate-footer a { color: var(--ink-faint); text-decoration: underline; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: none; min-height: 100vh; flex-direction: column; }
.app.ready { display: flex; }

.topbar {
  background: linear-gradient(180deg, var(--pf-navy), #0c2338);
  color: #fff;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 66px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .brand img { height: 30px; width: auto; }
.topbar .brand .divider { width: 1px; height: 26px; background: rgba(255,255,255,0.22); }
.topbar .brand .title {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.2;
  color: #dce9f4;
  white-space: nowrap;
}
.topbar .brand .title small { display: block; font-family: var(--font-body); font-size: 11px; color: #93aec4; font-weight: 500; letter-spacing: .3px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar .pf-btn-ghost { color: #dce9f4; border-color: rgba(255,255,255,0.28); }
.topbar .pf-btn-ghost:hover { background: rgba(255,255,255,0.1); }
.topbar-updated { font-size: 11.5px; color: #8fa9c0; white-space: nowrap; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 7px;
}
.icon-btn svg { width: 15px; height: 15px; }

/* ============================================================
   LAYOUT: sidebar + map
   ============================================================ */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 0;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .map-wrap { order: 1; }
}

/* ---------- Responsive topbar ---------- */
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 58px; padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar .brand img { height: 22px; }
  .topbar .brand .divider { display: none; }
  .topbar .brand .title small { display: none; }
  .topbar .brand .title { font-size: 13px; }
  .topbar-updated { display: none; }
  .topbar-spacer { flex-basis: 100%; height: 0; order: 2; }
  .topbar-actions { gap: 6px; order: 3; width: 100%; flex-wrap: wrap; }
  .topbar-actions .pf-btn { padding: 7px 10px; font-size: 11.5px; }
  .icon-btn svg { width: 13px; height: 13px; }
}
@media (max-width: 560px) {
  .topbar-actions span.btn-label { display: none; }
  .topbar-actions .pf-btn { padding: 8px; }
  .icon-btn svg { margin: 0; }
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 16px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.side-section h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--ink-faint);
  margin: 0 0 10px;
  font-weight: 700;
}
.pct-sold {
  background: linear-gradient(135deg, #eaf6ef, #e3f1e9);
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin-bottom: 10px;
}
.pct-sold-num { font-size: 28px; font-weight: 800; color: #1d7a4c; line-height: 1; }
.pct-sold-lbl { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; font-weight: 600; }
.pct-sold-track {
  margin-top: 9px;
  height: 6px;
  border-radius: 4px;
  background: rgba(29, 122, 76, .15);
  overflow: hidden;
}
.pct-sold-fill {
  height: 100%;
  border-radius: 4px;
  background: #1d7a4c;
  transition: width .3s ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.stat-card {
  background: var(--pf-blue-pale);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat-card .num { font-size: 20px; font-weight: 700; color: var(--pf-navy); line-height: 1.1; }
.stat-card .lbl { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.stat-card.accent { background: #fff4e6; }
.stat-card.accent .num { color: #a2620c; }
.stat-card.green { background: #eaf6ef; }
.stat-card.green .num { color: #1d7a4c; }

.search-box { position: relative; }
.search-box input {
  width: 100%;
  padding: 10px 12px 10px 34px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  font-size: 13.5px;
  outline: none;
}
.search-box input:focus { border-color: var(--pf-blue-light); box-shadow: 0 0 0 3px var(--pf-blue-pale); }
.search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--ink-faint);
}

.legend-list { display: flex; flex-direction: column; gap: 6px; }
.legend-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--ink-soft);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 7px;
  user-select: none;
  transition: background .12s;
}
.legend-row:hover { background: var(--pf-blue-pale); }
.legend-row.off { opacity: .38; }
.legend-swatch {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.legend-row .cnt { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-faint); font-size: 11.5px; }
.legend-link {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
  flex-shrink: 0;
  opacity: .6;
  transition: opacity .12s, color .12s;
}
.legend-link:hover { opacity: 1; color: var(--pf-blue); }
.legend-row-summary {
  font-weight: 700; color: var(--pf-navy);
  padding-bottom: 9px; margin-bottom: 4px; border-bottom: 1px dashed var(--line);
}
.legend-row-summary.active { background: #eaf6ef; }
.year-avg {
  margin-top: 10px;
  background: var(--pf-blue-pale);
  border-radius: 10px;
  padding: 10px 12px;
}
.year-avg-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--pf-navy); margin-bottom: 6px;
}
.year-avg-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--ink-soft);
  padding: 2px 0;
}
.year-avg-row span:last-child { font-weight: 700; color: var(--pf-navy); font-variant-numeric: tabular-nums; }
.legend-label-group { display: flex; flex-direction: column; line-height: 1.35; }
.legend-label-group small { font-weight: 500; color: var(--ink-faint); font-size: 10px; }
.legend-swatch.status-outline { background: #fff; border: 2px solid var(--status-available); }
.legend-swatch.construction {
  border-radius: 4px; background: #fff; border: 2px solid #b6641f;
  display: flex; align-items: center; justify-content: center;
}

.filter-actions { display: flex; gap: 8px; }
.filter-actions button { flex: 1; }

/* ============================================================
   MAP VIEWER
   ============================================================ */
.map-wrap {
  position: relative;
  background: #ffffff;
  overflow: hidden;
  min-height: 480px;
}
.map-toolbar {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-toolbar button {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--pf-navy);
  font-size: 17px;
  font-weight: 700;
}
.map-toolbar button:hover { background: var(--pf-blue-pale); }

.map-brand-mark {
  position: absolute;
  bottom: 14px; right: 14px;
  z-index: 20;
  width: 40px; height: 40px;
  border-radius: 9px;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(15,43,69,0.08);
  pointer-events: none;
  user-select: none;
}
@media (max-width: 760px) {
  .map-brand-mark { display: none; }
}

.map-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
  /* Without this, flex's default `stretch` forces .map-canvas to the
     viewport's height instead of its natural (image) height — which then
     throws off every lot marker's top:% position (they're a % of
     .map-canvas's height). Keep the canvas sized to its own content. */
  align-items: flex-start;
}
.map-scroll.grabbing { cursor: grabbing; }
.map-canvas {
  position: relative;
  transform-origin: 0 0;
  width: 2600px;
  flex-shrink: 0;
  will-change: transform;
}
.map-canvas img.plan { width: 100%; display: block; user-select: none; -webkit-user-drag: none; }

.map-callout {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: rgba(15,43,69,0.38);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: .3px;
}

/* Lot markers */
.lot-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 25px; height: 25px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(15,43,69,0.45), 0 0 0 1px rgba(15,43,69,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  z-index: 5;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.lot-marker.active {
  transform: translate(-50%, -50%) scale(1.35);
  z-index: 15;
  box-shadow: 0 4px 14px rgba(15,43,69,0.5), 0 0 0 2px #fff;
}
/* Only scale on true hover-capable pointers (mouse/trackpad) — on touch devices
   scaling on hover shifts the element out from under the finger mid-tap. */
@media (hover: hover) and (pointer: fine) {
  .lot-marker:hover {
    transform: translate(-50%, -50%) scale(1.35);
    z-index: 15;
    box-shadow: 0 4px 14px rgba(15,43,69,0.5), 0 0 0 2px #fff;
  }
}
.lot-marker.dim { opacity: .22; filter: grayscale(40%); }
.lot-marker.hover-glow {
  --glow: #ff2d2d;
  z-index: 20;
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--glow), 0 0 16px 7px var(--glow);
  animation: hover-glow-pulse 1s ease-in-out infinite;
}
@keyframes hover-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--glow), 0 0 16px 7px var(--glow); }
  50% { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--glow), 0 0 22px 12px var(--glow); }
}
.lot-marker.builder-glow-trusst {
  z-index: 18;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #16a34a, 0 0 12px 5px rgba(22,163,74,.75);
}
.lot-marker.builder-glow-clark {
  z-index: 18;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563eb, 0 0 12px 5px rgba(37,99,235,.75);
}
.lot-marker.status-available { background: #fff; color: var(--status-available); border-color: var(--status-available); }
.lot-marker.status-avail-model { background: var(--status-model); }
.lot-marker.status-under-contract { background: repeating-linear-gradient(135deg, var(--status-contract), var(--status-contract) 4px, #fff0da 4px, #fff0da 8px); color: #6b4408; border-color: var(--status-contract); }
.lot-marker.status-unreleased { background: #fff; color: var(--status-unreleased); border-color: var(--status-unreleased); border-style: dashed; }
.lot-marker.status-parking { background: var(--status-parking); font-size: 8px; }

.lot-marker .badge-flag {
  position: absolute;
  top: -6px; right: -7px;
  width: 15px; height: 15px;
  border-radius: 4px;
  background: #fff;
  border: 1.5px solid #b6641f;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.lot-marker .badge-flag svg { width: 9px; height: 9px; color: #b6641f; }

.lot-marker.flood::after {
  content: "";
  position: absolute;
  bottom: -6px; left: -7px;
  width: 14px; height: 14px;
  border-radius: 4px;
  background: #2274c9;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* Tooltip / popover card */
.lot-pop {
  position: absolute;
  z-index: 60;
  width: 300px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
}
.lot-pop.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lot-pop-head {
  padding: 14px 16px 12px;
  color: #fff;
  position: relative;
}
.lot-pop-head .lotnum { font-size: 20px; font-weight: 700; font-family: var(--font-display); }
.lot-pop-head .status-line { font-size: 12px; opacity: .92; margin-top: 2px; }
.lot-pop-body { padding: 13px 16px 15px; }
.lot-pop-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.lot-pop-row:last-child { border-bottom: none; }
.lot-pop-row .k { color: var(--ink-faint); }
.lot-pop-row .v { color: var(--ink); font-weight: 600; text-align: right; max-width: 62%; }
.lot-pop-construction {
  margin-top: 10px;
  background: #fff8ef;
  border: 1px solid #f2dfb9;
  border-radius: 9px;
  padding: 9px 11px;
}
.lot-pop-construction .ct-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: #a2620c; display: flex; align-items: center; gap: 5px; margin-bottom: 5px;
}
.lot-pop-construction .ct-title svg { width: 12px; height: 12px; }
.lot-pop-close {
  position: absolute; top: 8px; right: 10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.22);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}

/* ============================================================
   Buttons row on mobile bottom sheet variant
   ============================================================ */
@media (max-width: 640px) {
  .lot-pop { width: min(92vw, 340px); }
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-shell { min-height: 100vh; background: var(--bg); }
.admin-tabs {
  display: flex; gap: 4px; padding: 10px 22px 0; background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 66px; z-index: 36;
}
.admin-tab {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 9px 16px 11px; font-size: 13px; font-weight: 700; color: var(--ink-faint);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.admin-tab.active { color: var(--pf-blue-dark); border-bottom-color: var(--pf-blue-dark); }
.tab-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 20px;
  background: #d64545; color: #fff; font-size: 10.5px; font-weight: 800; vertical-align: 2px;
}
.admin-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 111px; z-index: 30;
}
@media (max-width: 760px) {
  .admin-tabs { position: static; }
  .admin-toolbar { position: static; }
}
.admin-toolbar input[type=search] {
  padding: 9px 12px; border-radius: 8px; border: 1.5px solid var(--line);
  font-size: 13.5px; width: 220px; outline: none;
}
.admin-toolbar select {
  padding: 9px 10px; border-radius: 8px; border: 1.5px solid var(--line); font-size: 13.5px; background: #fff;
}
.admin-main { padding: 20px 22px 60px; max-width: 1400px; margin: 0 auto; }

.admin-table-wrap {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1100px; }
table.admin-table th {
  text-align: left; padding: 10px 12px; background: var(--pf-blue-pale);
  color: var(--pf-navy); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.admin-table th.sortable {
  cursor: pointer; user-select: none;
  transition: background .1s;
}
table.admin-table th.sortable:hover { background: var(--pf-blue-pale-2); }
table.admin-table th.sortable::after {
  content: "";
  display: inline-block;
  margin-left: 5px;
  width: 0; height: 0;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: .35;
}
table.admin-table th.sortable.sort-desc::after { border-top: 5px solid var(--pf-navy); opacity: 1; }
table.admin-table th.sortable.sort-asc::after { border-bottom: 5px solid var(--pf-navy); opacity: 1; }
table.admin-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.admin-table tbody tr { cursor: pointer; transition: background .1s; }
table.admin-table tbody tr:hover { background: var(--pf-blue-pale); }
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.pill-closed { background: #eaf6ef; color: #1d7a4c; }
.pill-available { background: var(--pf-blue-pale); color: var(--pf-blue-dark); }
.pill-contract { background: #fff4e2; color: #a2620c; }
.pill-unreleased { background: #eef0f2; color: #5b6672; }
.pill-model { background: #f1eafb; color: #6a3fb5; }
.pill-role-super { background: #fdeee0; color: #a2620c; }
.pill-role-lot { background: #e6f0fb; color: #1d5aa0; }
.pill-role-viewer { background: #eef0f2; color: #5b6672; }
.pill-user-active { background: #eaf6ef; color: #1d7a4c; }
.pill-user-inactive { background: #f6e9e8; color: #a23c1f; }
button.lead-toggle { border: none; cursor: pointer; font-family: inherit; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,25,40,0.55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 32px 16px; overflow-y: auto; z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 760px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: gateIn .18s ease;
}
.modal.modal-sm { max-width: 440px; }
.modal-head {
  padding: 18px 24px; background: linear-gradient(180deg, var(--pf-navy), #0c2338); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 20px; }
.modal-head button { background: rgba(255,255,255,0.15); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; }
.modal-body { padding: 20px 24px; max-height: 70vh; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form-grid.wide { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.span-2 { grid-column: span 2; }
.field label { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .3px; }
.field input, .field select, .field textarea {
  padding: 9px 11px; border-radius: 8px; border: 1.5px solid var(--line); font-size: 13.5px; outline: none;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--pf-blue-light); box-shadow: 0 0 0 3px var(--pf-blue-pale); }
.field textarea { resize: vertical; min-height: 56px; }
.field-check { display: flex; align-items: center; gap: 8px; flex-direction: row; }
.field-check input { width: 16px; height: 16px; }
.fieldset-title {
  font-size: 12.5px; font-weight: 700; color: var(--pf-blue-dark); margin: 18px 0 4px;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
  text-transform: uppercase; letter-spacing: .4px;
}
.fieldset-title:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.save-msg { font-size: 12.5px; color: #1d7a4c; opacity: 0; transition: opacity .2s; }
.save-msg.show { opacity: 1; }

.field-hint { font-size: 12px; color: var(--ink-faint); margin: 12px 2px 0; line-height: 1.5; }
.cred-box { background: var(--pf-blue-pale); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cred-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cred-row .k { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--ink-soft); }
.cred-row .v { font-size: 14px; font-weight: 600; color: var(--pf-navy); }
.cred-row .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15.5px; letter-spacing: .4px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--pf-navy); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #7a2620; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-faint); }

/* Utility */
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }
