/* ═══════════════════════════════════════════════════════════════════════════
   TMS Design System — v2.0
   Complete UI Redesign: Modern, clean, animated, feature-rich
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   DESIGN TOKENS — Dark Theme (default)
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Backgrounds */
  --bg:           #0d0f14;
  --bg-2:         #111318;
  --surface:      #181b22;
  --surface-2:    #1f2330;
  --surface-3:    #272c3a;
  --surface-elevated: #1e2230;

  /* Borders */
  --border:       #272c3a;
  --border-2:     #323748;
  --border-3:     #3e4460;

  /* Text */
  --text:         #e2e4ed;
  --text-muted:   #8b91a8;
  --text-dim:     #555c77;

  /* Brand / Accent */
  --accent:       #6366f1;
  --accent-h:     #4f46e5;
  --accent-2:     #818cf8;
  --accent-glow:  rgba(99, 102, 241, 0.25);
  --accent-faint: rgba(99, 102, 241, 0.07);

  /* Semantic colors */
  --green:        #22c55e;
  --green-dark:   #16a34a;
  --green-bg:     rgba(34, 197, 94, 0.1);
  --green-border: rgba(34, 197, 94, 0.2);

  --yellow:       #f59e0b;
  --yellow-bg:    rgba(245, 158, 11, 0.1);
  --yellow-border:rgba(245, 158, 11, 0.2);

  --orange:       #f97316;
  --orange-bg:    rgba(249, 115, 22, 0.1);
  --orange-border:rgba(249, 115, 22, 0.2);

  --red:          #f43f5e;
  --red-dark:     #dc2626;
  --red-bg:       rgba(244, 63, 94, 0.1);
  --red-border:   rgba(244, 63, 94, 0.2);

  --purple:       #a855f7;
  --purple-bg:    rgba(168, 85, 247, 0.1);
  --purple-border:rgba(168, 85, 247, 0.2);

  --cyan:         #06b6d4;
  --cyan-bg:      rgba(6, 182, 212, 0.1);

  --gray:         #6b7280;
  --gray-bg:      rgba(107, 114, 128, 0.1);
  --gray-border:  rgba(107, 114, 128, 0.2);

  /* Shadows */
  --shadow-xs:    0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow:       0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-md:    0 8px 32px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.7), 0 8px 24px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 20px rgba(99,102,241,0.3), 0 0 40px rgba(99,102,241,0.15);
  --shadow-card:  0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.03);

  /* Border radius */
  --radius-xs:    4px;
  --radius-sm:    6px;
  --radius:       8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-xl:    20px;
  --radius-2xl:   24px;
  --radius-full:  9999px;

  /* Transitions */
  --t-fast:       0.1s ease;
  --t-base:       0.18s ease;
  --t-slow:       0.28s ease;
  --t-spring:     0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --t-bounce:     0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Nav */
  --nav-height:   60px;
  --nav-bg:       rgba(13, 15, 20, 0.92);
  --nav-border:   rgba(255,255,255,0.06);

  /* Misc */
  --logo-filter:  brightness(0) invert(1);
  --hover-bg:     rgba(99, 102, 241, 0.07);
  --stripe-odd:   rgba(255,255,255,0.015);
}

/* ══════════════════════════════════════════════════════════════════════════
   LIGHT THEME
   ══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:           #f3f4f8;
  --bg-2:         #eceef4;
  --surface:      #ffffff;
  --surface-2:    #f7f8fc;
  --surface-3:    #eef0f7;
  --surface-elevated: #ffffff;

  --border:       #e3e5ee;
  --border-2:     #d5d8e8;
  --border-3:     #c5c9da;

  --text:         #111827;
  --text-muted:   #6b7280;
  --text-dim:     #9ca3af;

  --accent:       #4f46e5;
  --accent-h:     #4338ca;
  --accent-2:     #6366f1;
  --accent-glow:  rgba(79, 70, 229, 0.15);
  --accent-faint: rgba(79, 70, 229, 0.05);

  --green:        #16a34a;
  --green-bg:     rgba(22, 163, 74, 0.08);
  --green-border: rgba(22, 163, 74, 0.2);

  --yellow:       #d97706;
  --yellow-bg:    rgba(217, 119, 6, 0.08);
  --yellow-border:rgba(217, 119, 6, 0.2);

  --orange:       #ea580c;
  --orange-bg:    rgba(234, 88, 12, 0.08);
  --orange-border:rgba(234, 88, 12, 0.2);

  --red:          #dc2626;
  --red-dark:     #b91c1c;
  --red-bg:       rgba(220, 38, 38, 0.07);
  --red-border:   rgba(220, 38, 38, 0.2);

  --purple:       #7c3aed;
  --purple-bg:    rgba(124, 58, 237, 0.08);
  --purple-border:rgba(124, 58, 237, 0.2);

  --gray:         #9ca3af;
  --gray-bg:      rgba(156, 163, 175, 0.1);
  --gray-border:  rgba(156, 163, 175, 0.2);

  --shadow-xs:    0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:    0 2px 6px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow:       0 4px 14px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-md:    0 8px 28px rgba(0,0,0,0.09), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.07);
  --shadow-glow:  0 0 20px rgba(79,70,229,0.15), 0 0 40px rgba(79,70,229,0.08);
  --shadow-card:  0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.05);

  --nav-bg:       rgba(255,255,255,0.92);
  --nav-border:   rgba(0,0,0,0.07);

  --logo-filter:  none;
  --hover-bg:     rgba(79, 70, 229, 0.05);
  --stripe-odd:   rgba(0,0,0,0.015);
}

/* ══════════════════════════════════════════════════════════════════════════
   ANIMATIONS & KEYFRAMES
   ══════════════════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

@keyframes pulseRing {
  0%   { transform: scale(1); opacity: 0.8; }
  70%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes htmxProgress {
  0%   { left: -40%; width: 40%; }
  50%  { width: 60%; }
  100% { left: 110%; width: 40%; }
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes borderGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(99,102,241,0.3); }
  50%       { box-shadow: 0 0 20px rgba(99,102,241,0.6); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rowEntrance {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes badgeBounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25); }
  60%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ══════════════════════════════════════════════════════════════════════════
   BASE
   ══════════════════════════════════════════════════════════════════════════ */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* Selection color */
::selection { background: var(--accent-glow); color: var(--text); }

/* Focus visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Smooth transitions for theme switching */
body, .nav, .card, .auth-card, .nav-dropdown, .form-control, .form-control-v2,
.edit-input, .edit-select, .edit-textarea, .table-wrap, thead th, tbody tr,
.neighbor-card, .count-chip, .badge, .icon-btn, .toast, .breadcrumb,
.btn, .select, .input, .stat-card, .drawer, .modal, .alert {
  transition: background-color var(--t-base), color var(--t-base), border-color var(--t-base);
}

/* x-cloak hides Alpine elements until initialized */
[x-cloak] { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════════════════════ */
.page-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.page-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.125rem 1.5rem;
  flex-wrap: wrap;
}

.page-header-title h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
}

.page-header-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.page-body {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-body--detail { padding-top: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════════════════════════════════════ */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  height: var(--nav-height);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: var(--nav-height);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  flex-shrink: 0;
  margin-right: 0.5rem;
  transition: opacity var(--t-base);
}

.nav-logo:hover { opacity: 0.8; }

.nav-logo-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}

.nav-logo img {
  height: 26px;
  width: auto;
  filter: var(--logo-filter);
}

.nav-logo-text {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent-2) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--t-base), color var(--t-base);
  position: relative;
  white-space: nowrap;
}

.nav-link svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--t-base); }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: var(--accent-faint);
  color: var(--accent-2);
  font-weight: 600;
}

.nav-link.active svg { opacity: 1; color: var(--accent-2); }

/* Notification bell */
.nav-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--t-base), color var(--t-base);
  flex-shrink: 0;
}

.nav-bell:hover { background: var(--surface-2); color: var(--text); }

.nav-bell-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--red);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--nav-bg);
}

.nav-bell-badge:not(:empty) {
  animation: badgeBounce 0.4s var(--t-bounce);
}

/* Bell pulse ring (when unread > 0) */
.nav-bell.has-unread::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: pulseRing 2s ease-out infinite;
}

/* User avatar/dropdown */
.nav-user { position: relative; flex-shrink: 0; }

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.625rem 0.3rem 0.3rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
}

.nav-user-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  box-shadow: var(--shadow-xs);
}

/* Avatar initials */
.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.nav-chevron {
  color: var(--text-muted);
  transition: transform var(--t-base);
}

[x-data] .nav-chevron { }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 300;
  animation: fadeInDown 0.15s ease;
}

.nav-dropdown a,
.nav-dropdown button {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.875rem;
  text-align: left;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  font-family: inherit;
}

.nav-dropdown a:hover,
.nav-dropdown button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-dropdown .divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

.nav-dropdown .dropdown-label {
  display: block;
  padding: 0.5rem 0.875rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════════════════
   HTMX LOADING INDICATOR
   ══════════════════════════════════════════════════════════════════════════ */
.htmx-indicator {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 9999;
  overflow: hidden;
}

.htmx-indicator::after {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), var(--purple), var(--accent), transparent);
  animation: htmxProgress 1.2s ease-in-out infinite;
  width: 40%;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   COMMAND PALETTE
   ══════════════════════════════════════════════════════════════════════════ */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(5vh, 10vh, 120px);
  animation: fadeIn 0.12s ease;
  backdrop-filter: blur(4px);
}

.cmd-palette {
  width: 560px;
  max-width: 95vw;
  background: var(--surface-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99,102,241,0.1);
  overflow: hidden;
  animation: scaleIn 0.14s ease;
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.cmd-search-icon { color: var(--text-muted); flex-shrink: 0; }

.cmd-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
  font-weight: 500;
}

.cmd-input::placeholder { color: var(--text-dim); }

.cmd-kbd {
  font-size: 0.6875rem;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.3rem;
  font-family: inherit;
  flex-shrink: 0;
}

.cmd-results { padding: 0.25rem; max-height: 320px; overflow-y: auto; }

.cmd-section-label {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.cmd-item:hover, .cmd-item.active {
  background: var(--accent-faint);
  color: var(--text);
}

.cmd-item-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.cmd-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  font-size: 0.6875rem;
  color: var(--text-dim);
}

.cmd-hint { display: flex; align-items: center; gap: 0.25rem; }

/* ══════════════════════════════════════════════════════════════════════════
   BREADCRUMB
   ══════════════════════════════════════════════════════════════════════════ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.75rem 0 0;
  max-width: 1440px;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t-fast);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--text-dim); font-size: 0.75rem; }
.breadcrumb-current { color: var(--text); font-weight: 600; }

.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color var(--t-base);
  margin-bottom: 0.375rem;
}

.breadcrumb-back:hover { color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.card-header h3 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-body { }

.card--danger {
  border-color: var(--red-border);
  background: linear-gradient(135deg, var(--surface), var(--red-bg) 100%);
}

.card--success {
  border-color: var(--green-border);
  background: linear-gradient(135deg, var(--surface), var(--green-bg) 100%);
}

.card--warning {
  border-color: var(--yellow-border);
}

.card-footer-link {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
}

.card-footer-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--t-fast);
}

.card-footer-link a:hover { color: var(--accent-2); text-decoration: underline; }

[data-theme="light"] .card { box-shadow: var(--shadow-card); }

/* ══════════════════════════════════════════════════════════════════════════
   STATUS BADGES / PILLS
   ══════════════════════════════════════════════════════════════════════════ */
.badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity var(--t-base), transform var(--t-fast);
  user-select: none;
  letter-spacing: 0.01em;
}

.badge:hover { opacity: 0.85; transform: translateY(-1px); }
.badge.inactive { opacity: 0.35; }
.badge-count {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xs);
  padding: 0.05rem 0.35rem;
  font-size: 0.6875rem;
}

[data-theme="light"] .badge-count { background: rgba(0,0,0,0.08); }

.badge-active        { background: var(--green-bg);  color: var(--green);  border-color: var(--green-border); }
.badge-planned       { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-border); }
.badge-staging       { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }
.badge-decommissioning { background: var(--purple-bg); color: var(--purple); border-color: var(--purple-border); }
.badge-retired       { background: var(--red-bg);    color: var(--red);    border-color: var(--red-border); }
.badge-unknown       { background: var(--gray-bg);   color: var(--gray);   border-color: var(--gray-border); }
.badge-primary       { background: var(--accent-faint); color: var(--accent-2); border-color: var(--accent-glow); }
.badge-danger        { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

/* Status pill (for tables/lists) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-active        { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.status-planned       { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.status-staging       { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }
.status-decommissioning { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
.status-retired       { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.status-unknown       { background: var(--gray-bg);   color: var(--gray);   border: 1px solid var(--gray-border); }

/* Network status pills */
.status-container    { background: rgba(6,182,212,0.1); color: #22d3ee; border: 1px solid rgba(6,182,212,0.25); }
.status-reserved     { background: var(--yellow-bg);   color: var(--yellow); border: 1px solid var(--yellow-border); }
.status-deprecated   { background: var(--gray-bg);     color: var(--gray);   border: 1px solid var(--gray-border); }
.status-dhcp         { background: var(--accent-faint); color: var(--accent-2); border: 1px solid var(--accent-glow); }
.status-slaac        { background: var(--purple-bg);   color: var(--purple); border: 1px solid var(--purple-border); }

/* Status badge (workflow) */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.status-badge.status-failed { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-base), border-color var(--t-base), color var(--t-base), box-shadow var(--t-base), transform var(--t-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  letter-spacing: 0.01em;
}

.btn:active { transform: scale(0.97); }
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(99,102,241,0.3), 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0) scale(0.97); box-shadow: 0 1px 3px rgba(99,102,241,0.3); }

/* Full-width primary (auth pages) */
.auth-wrap .btn-primary,
form .btn-primary[style*="100%"] { width: 100%; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  box-shadow: var(--shadow-xs);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
}

/* Loading state */
.htmx-request .btn-primary,
.drawer-form.htmx-request .btn-primary {
  pointer-events: none;
  opacity: 0.8;
}

.htmx-request .btn-primary::after,
.drawer-form.htmx-request .btn-primary::after {
  content: '';
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.5s linear infinite;
  margin-left: 0.375rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   ICON BUTTON
   ══════════════════════════════════════════════════════════════════════════ */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn.primary:hover {
  background: var(--accent-faint);
  border-color: var(--accent-glow);
  color: var(--accent);
}

.icon-btn-danger { color: var(--red); }
.icon-btn-danger:hover { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1rem; }

.form-label, .label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.required { color: var(--red); margin-left: 2px; }

.form-control,
.input,
.edit-input,
.select,
.edit-select,
.edit-textarea,
.textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.875rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
  -webkit-appearance: none;
}

.form-control:focus,
.input:focus,
.edit-input:focus,
.select:focus,
.edit-select:focus,
.edit-textarea:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}

.form-control::placeholder,
.input::placeholder,
.edit-input::placeholder,
.edit-textarea::placeholder,
.textarea::placeholder { color: var(--text-dim); }

/* Select arrow */
.select, .edit-select, .filter-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.edit-select[multiple] {
  background-image: none;
  padding-right: 0.875rem;
  min-height: 110px;
}

.edit-select option,
.select option,
.filter-select option {
  background: var(--surface);
  color: var(--text);
}

/* Edit-specific forms */
.edit-input { height: 36px; padding: 0 0.75rem; }

.edit-textarea {
  height: auto;
  padding: 0.5rem 0.75rem;
  resize: vertical;
  min-height: 80px;
}

/* Input sizes */
.input-sm { padding: 0.3rem 0.75rem; font-size: 0.8125rem; height: 32px; }
.select-sm { padding: 0.3rem 2rem 0.3rem 0.75rem; font-size: 0.8125rem; height: 32px; }

/* Search input */
.search-input {
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b91a8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
}

.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-input::placeholder { color: var(--text-dim); }

/* Filter select */
.filter-select {
  padding: 0.5rem 2.25rem 0.5rem 0.875rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t-base);
}

.filter-select:focus { border-color: var(--accent); }

/* Edit forms */
.edit-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; text-transform: uppercase; margin-bottom: 0.25rem; }
.edit-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.875rem; }

.edit-page-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.edit-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 -1rem -4rem;
  z-index: 20;
  backdrop-filter: blur(8px);
}

/* Form errors */
.field-error { font-size: 0.75rem; color: var(--red); margin-top: 0.2rem; }

.error-banner, .form-errors {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--red);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-errors ul { padding-left: 1.25rem; }

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-muted);
  user-select: none;
  padding: 0.25rem 0;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background var(--t-base), border-color var(--t-base);
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* Form sections */
.form-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; }
.form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ══════════════════════════════════════════════════════════════════════════
   FILTER BAR
   ══════════════════════════════════════════════════════════════════════════ */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-height);
  z-index: 50;
}

.filter-bar-row {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════════════════ */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--surface-2);
  padding: 0.625rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: color var(--t-fast), background var(--t-fast);
}

thead th:hover { color: var(--text); background: var(--surface-3); }
thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }

.sort-icon {
  display: inline-block;
  margin-left: 0.25rem;
  opacity: 0.35;
  font-size: 0.7rem;
  transition: opacity var(--t-fast);
}

thead th.sorted-asc .sort-icon,
thead th.sorted-desc .sort-icon { opacity: 1; color: var(--accent); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

tbody tr:nth-child(odd) { background: var(--stripe-odd); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--hover-bg); }
tbody tr:hover td { color: var(--text); }

tbody td {
  padding: 0.625rem 1rem;
  color: var(--text);
  vertical-align: middle;
}

.site-link, .tower-name-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--t-fast);
}

.site-link:hover, .tower-name-link:hover { color: var(--accent-2); text-decoration: underline; }
.tower-name-link { color: var(--text); font-weight: 500; }
.tower-name-link:hover { color: var(--accent); text-decoration: none; }

.site-id-link {
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, monospace;
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
}

.coords-cell { display: flex; align-items: center; gap: 0.375rem; white-space: nowrap; }
.coords-text { font-family: monospace; font-size: 0.78rem; color: var(--text-muted); }

/* No results */
.no-results, .empty-state-inline {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.no-results-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  background: var(--surface-3);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

/* ══════════════════════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════════════════════ */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.alert-error   { background: var(--red-bg);    border-color: var(--red-border);    color: var(--red); }
.alert-success { background: var(--green-bg);  border-color: var(--green-border);  color: var(--green-dark); }
.alert-info    { background: var(--accent-faint); border-color: var(--accent-glow); color: var(--accent-2); }
.alert-warning { background: var(--yellow-bg); border-color: var(--yellow-border); color: var(--yellow); }

.text-danger { color: var(--red); }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 0.875rem; }

/* ══════════════════════════════════════════════════════════════════════════
   SECTION HEADINGS
   ══════════════════════════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::after {
  content: '';
  display: block;
  height: 1px;
  flex: 1;
  background: var(--border);
  min-width: 20px;
}

.section-meta { font-size: 0.8rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
}

.toast {
  background: var(--surface-elevated);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastSlideUp 0.2s ease;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════════════════════════════════════ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at top left, rgba(99,102,241,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at bottom right, rgba(168,85,247,0.06) 0%, transparent 60%),
              var(--bg);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease;
}

[data-theme="light"] .auth-card {
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: block;
  height: 48px;
  width: auto;
  margin: 0 auto 1.25rem;
  filter: var(--logo-filter);
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.375rem;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
}

.auth-theme-toggle:hover { background: var(--surface-3); color: var(--text); }

/* Landing */
.landing-wrap {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.landing-card {
  text-align: center;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-lg);
}

.landing-logo {
  display: block;
  margin: 0 auto 1.75rem;
  height: 64px;
  width: auto;
  filter: var(--logo-filter);
}

.landing-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.landing-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.75rem; line-height: 1.6; }
.landing-meta { margin-top: 2rem; font-size: 0.75rem; color: var(--text-dim); }

/* ══════════════════════════════════════════════════════════════════════════
   SITE DETAIL — SIDEBAR LAYOUT
   ══════════════════════════════════════════════════════════════════════════ */
.detail-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.detail-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 0.75rem);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-sidebar .card { padding: 0; overflow: hidden; }

.detail-map-wrap { height: 200px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.detail-map-wrap #detail-map { width: 100%; height: 100%; }

.sidebar-quick-info { padding: 1rem; }

.sidebar-quick-info .qi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.sidebar-quick-info .qi-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.qi-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.2rem 0.5rem;
  align-items: baseline;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: background var(--t-fast);
}

.qi-row:hover { background: var(--surface-2); border-radius: var(--radius-xs); }

.qi-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.qi-value { color: var(--text); word-break: break-word; font-size: 0.8125rem; }
.qi-value a { color: var(--accent); text-decoration: none; }
.qi-value a:hover { text-decoration: underline; }

.qi-value.lease-warning { color: var(--yellow); font-weight: 600; }

.sidebar-timestamps {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.6875rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* Detail page header */
.detail-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
}

.detail-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.detail-page-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }
.detail-page-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* Detail header (simpler) */
.detail-header { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.detail-back { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--text-muted); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: color var(--t-base); flex-shrink: 0; }
.detail-back:hover { color: var(--text); }
.detail-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.025em; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════════════════════ */
.tab-strip,
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-strip::-webkit-scrollbar,
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-base), border-color var(--t-base);
  margin-bottom: -2px;
  font-family: inherit;
  position: relative;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}

.tab-btn.active::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 2px 2px 0 0;
}

/* Tab panels */
.tab-panels { padding: 1.25rem 1.5rem; }
.tab-panel { display: none; animation: fadeInUp 0.2s ease; }
.tab-panel[x-show] { display: block; }

/* Tab section heading */
.tab-section-heading {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-section-heading::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.tab-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.tab-panel-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Tab edit button */
.tab-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
  font-family: inherit;
}

.tab-edit-btn:hover {
  background: var(--accent-faint);
  border-color: var(--accent-glow);
  color: var(--accent-2);
}

/* Missing doc indicator */
.tab-btn.missing-doc { position: relative; }
.tab-btn.missing-doc::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulseRing 2s ease-out infinite;
}

/* ══════════════════════════════════════════════════════════════════════════
   FIELD GRIDS (info display)
   ══════════════════════════════════════════════════════════════════════════ */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.field-item, .field-item-v2 {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.625rem 0.875rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color var(--t-base);
}

.field-item:hover, .field-item-v2:hover { border-color: var(--border-2); }

.field-label, .field-label-v2 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.field-value, .field-value-v2 {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}

.field-value.empty, .field-value-v2.empty { color: var(--text-dim); font-style: italic; font-weight: 400; }
.field-value a, .field-value-v2 a { color: var(--accent); text-decoration: none; }
.field-value a:hover, .field-value-v2 a:hover { text-decoration: underline; }

/* Overview grid (key-value) */
.overview-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: baseline;
}

.overview-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.overview-value { font-size: 0.875rem; color: var(--text); word-break: break-word; }
.overview-value a { color: var(--accent); text-decoration: none; }
.overview-value a:hover { text-decoration: underline; }

/* DL grid */
.dl-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.875rem;
}

.dl-grid dt { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.dl-grid dd { margin: 0; font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════════════════════════════════════════ */
.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  cursor: pointer;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-2);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: background var(--t-base);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.active-filter { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.stat-card.active-filter::before { background: var(--accent); }

.stat-card--active     ::before { background: var(--green); }
.stat-card--planned    ::before { background: var(--yellow); }
.stat-card--staging    ::before { background: var(--orange); }
.stat-card--decommissioning::before { background: var(--purple); }
.stat-card--retired    ::before { background: var(--red); }
.stat-card--total      ::before { background: linear-gradient(90deg, var(--accent), var(--purple)); }

.stat-card__number {
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  margin-bottom: 0.25rem;
  letter-spacing: -0.03em;
  animation: countUp 0.3s ease;
}

.stat-card__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Dashboard grid variant */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* stat-card in workflow dashboards */
.stat-card-number { font-size: 2.5rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.stat-card-label { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin-top: 0.3rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card--primary::before { background: var(--accent); }
.stat-card--success::before { background: var(--green); }
.stat-card--warning::before { background: var(--yellow); }
.stat-card--danger::before  { background: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════
   MAP
   ══════════════════════════════════════════════════════════════════════════ */
.map-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  height: 500px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

#site-map { width: 100%; height: 100%; }

.map-label {
  text-shadow:
    -1px -1px 2px rgba(0,0,0,0.8),
     1px -1px 2px rgba(0,0,0,0.8),
    -1px  1px 2px rgba(0,0,0,0.8),
     1px  1px 2px rgba(0,0,0,0.8),
     0    0   4px rgba(0,0,0,0.6);
}

.detail-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  align-items: stretch;
}

.detail-map-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 350px;
  background: var(--surface);
}

#detail-map { width: 100%; height: 100%; }

.dashboard-main-panel { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }

.dashboard-map-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
  height: calc(100vh - 280px);
  min-height: 480px;
  box-shadow: var(--shadow-card);
}

/* View toggle (List / Map) */
.view-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover { background: var(--hover-bg); color: var(--text); }
.view-toggle-btn.active { background: var(--accent); color: #fff; }

.dashboard-map-panel #site-map { width: 100%; height: 100%; }

.dashboard-table-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.dashboard-table-panel .table-toolbar {
  padding: 0.875rem 1rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.dashboard-table-panel .table-wrap {
  overflow-y: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   NEIGHBOR / COUNT CHIPS
   ══════════════════════════════════════════════════════════════════════════ */
.neighbor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.neighbor-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.875rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base), box-shadow var(--t-base);
}

.neighbor-card:hover {
  border-color: var(--accent);
  background: var(--accent-faint);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.neighbor-name { font-size: 0.875rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.neighbor-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }

.count-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.count-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.125rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  min-width: 90px;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
}

.count-chip:hover { border-color: var(--accent); background: var(--accent-faint); transform: translateY(-1px); }
.count-number { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -0.03em; }
.count-label { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ══════════════════════════════════════════════════════════════════════════
   PAGINATOR
   ══════════════════════════════════════════════════════════════════════════ */
.paginator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.paginator-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  user-select: none;
  font-family: inherit;
}

.paginator-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.paginator-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.paginator-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.paginator-ellipsis { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--text-dim); font-size: 0.875rem; }

/* ══════════════════════════════════════════════════════════════════════════
   DRAWER
   ══════════════════════════════════════════════════════════════════════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  animation: fadeIn 0.18s ease;
  backdrop-filter: blur(4px);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 301;
  display: flex;
  flex-direction: column;
  animation: slideInRight var(--t-spring);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.drawer-title { font-size: 0.9375rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.drawer-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.drawer-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-section-title:first-child { margin-top: 0; }

.drawer-form { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* ══════════════════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════════════════ */
.review-modal-overlay,
.photo-modal-overlay,
.tag-manager-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(6px);
}

.review-modal, .photo-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.18s var(--t-spring);
  overflow: hidden;
}

.review-modal { width: 720px; }
.photo-modal { width: min(700px, 95vw); min-height: 60vh; }

.review-modal-header, .photo-modal-header, .tag-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.review-modal-title { font-size: 0.9375rem; font-weight: 700; color: var(--text); }

.photo-modal-header h3, .tag-manager-header h3 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
}

.review-modal-body, .photo-modal-body { flex: 1; overflow-y: auto; padding: 1.5rem; }

.review-modal-footer, .photo-modal-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.photo-modal-footer { justify-content: flex-end; }

/* Review field rows */
.review-field-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.review-field-row:last-child { border-bottom: none; }
.review-field-edit { grid-column: 1 / -1; }

.review-field-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 0.5rem;
}

.review-field-col { display: flex; flex-direction: column; gap: 0.25rem; }

.review-field-col .col-header {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.review-field-col input[type="text"],
.review-field-col input[type="number"],
.review-field-col input[type="date"] {
  width: 100%;
  padding: 0.375rem 0.5rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.review-field-col input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.review-field-current {
  padding: 0.375rem 0.5rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-height: 2rem;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
}

.review-field-current.empty { color: var(--text-dim); font-style: italic; }

.review-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.review-section-title:first-child { margin-top: 0; }

.confidence-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 0.375rem; flex-shrink: 0; }
.confidence-dot.high   { background: var(--green); }
.confidence-dot.medium { background: var(--yellow); }
.confidence-dot.low    { background: var(--red); }

.review-source-toggle { display: flex; gap: 0.375rem; margin-top: 0.25rem; }
.review-source-toggle label { display: flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--text-muted); cursor: pointer; }

/* HTML5 dialog */
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: 520px;
  width: 95vw;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.modal::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }

.modal-content { padding: 1.5rem; }
.modal-content h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.75rem; letter-spacing: -0.02em; }

.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

/* ══════════════════════════════════════════════════════════════════════════
   LEASE UPLOAD
   ══════════════════════════════════════════════════════════════════════════ */
.lease-upload-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base);
  margin-bottom: 1rem;
  background: var(--surface-2);
}

.lease-upload-zone:hover,
.lease-upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-faint);
}

.lease-upload-zone input[type="file"] { display: none; }

.lease-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
}

.lease-upload-label svg { opacity: 0.5; }
.lease-upload-label strong { color: var(--text); font-size: 0.875rem; }

.lease-file-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.lease-file-info .file-name { flex: 1; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lease-file-info .file-meta { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.lease-file-info .file-actions { display: flex; gap: 0.25rem; align-items: center; }

/* Parse status */
.parse-status {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.parse-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.parse-status-text { flex: 1; color: var(--text-muted); }
.parse-status.parsed { border-color: var(--green-border); background: var(--green-bg); }
.parse-status.parsed .parse-status-text { color: var(--green); }
.parse-status.failed { border-color: var(--red-border); background: var(--red-bg); }
.parse-status.failed .parse-status-text { color: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════
   PHOTO GRID
   ══════════════════════════════════════════════════════════════════════════ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.875rem;
}

@media (max-width: 1200px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } }

.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}

.photo-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.photo-card-image { aspect-ratio: 4/3; overflow: hidden; background: var(--bg); }
.photo-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.photo-card:hover .photo-card-image img { transform: scale(1.03); }

.photo-card-body { padding: 0.625rem; }
.photo-card-name { font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card-tags { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-bottom: 0.375rem; }
.photo-card-meta { font-size: 0.6875rem; color: var(--text-muted); }
.photo-card-devices { font-size: 0.6875rem; color: var(--text-muted); margin-top: 0.125rem; }
.photo-card-actions { display: flex; gap: 0.35rem; margin-top: 0.35rem; opacity: 0; transition: opacity var(--t-base); }
.photo-card:hover .photo-card-actions { opacity: 1; }

/* Tag pills */
.photo-tag-pill {
  display: inline-flex;
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.photo-tag-pill:hover { border-color: var(--accent); color: var(--accent); }
.photo-tag-active { background: var(--accent-faint); color: var(--accent-2); border-color: var(--accent-glow); }

/* Device chips */
.photo-device-chip { display: inline-flex; align-items: center; background: var(--surface-3); color: var(--text-muted); padding: 0.1rem 0.45rem; border-radius: var(--radius-full); font-size: 0.6875rem; }

/* Upload drop zone */
.photo-upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  transition: border-color var(--t-base), background var(--t-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.photo-upload-dropzone.dragover { border-color: var(--accent); background: var(--accent-faint); }

.photo-upload-dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.photo-upload-dropzone-title { color: var(--text); font-weight: 600; }
.photo-upload-dropzone-hint { font-size: 0.75rem; }

.photo-upload-row { display: flex; gap: 0.75rem; align-items: center; padding: 0.6rem; background: var(--surface-2); border-radius: var(--radius); margin-bottom: 0.5rem; border: 1px solid var(--border); }
.photo-upload-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }
.photo-upload-fields { flex: 1; min-width: 0; }
.photo-upload-fields input[type="text"] { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0.3rem 0.5rem; color: var(--text); width: 100%; font-size: 0.75rem; box-sizing: border-box; font-family: inherit; outline: none; }
.photo-upload-fields input[type="text"]:focus { border-color: var(--accent); }
.photo-upload-meta { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; margin-top: 0.35rem; }
.photo-upload-meta-divider { width: 1px; height: 14px; background: var(--border); margin: 0 0.15rem; }

.device-link-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--t-base), background var(--t-base), color var(--t-base);
  color: var(--text-muted);
}

.device-link-btn:hover, .device-link-btn.active { border-color: var(--accent); background: var(--accent-faint); color: var(--accent); }

.device-link-popover {
  position: absolute;
  right: 0;
  top: 36px;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10;
  padding: 0.4rem;
  animation: scaleIn 0.12s ease;
}

.device-link-popover input { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0.3rem 0.5rem; color: var(--text); width: 100%; font-size: 0.75rem; margin-bottom: 0.35rem; box-sizing: border-box; font-family: inherit; outline: none; }
.device-link-popover-list { max-height: 150px; overflow-y: auto; }
.device-link-popover-item { padding: 0.35rem 0.5rem; border-radius: var(--radius-xs); color: var(--text); font-size: 0.75rem; cursor: pointer; transition: background var(--t-fast); }
.device-link-popover-item:hover { background: var(--surface-2); }
.device-link-popover-item.selected { background: var(--accent-faint); color: var(--accent-2); }
.device-link-popover-item-type { color: var(--text-muted); }

.device-chip { display: inline-flex; align-items: center; gap: 0.2rem; background: var(--cyan-bg); color: var(--cyan); padding: 0.1rem 0.5rem; border-radius: var(--radius-full); font-size: 0.6875rem; font-weight: 600; }
.device-chip-remove { background: none; border: none; color: inherit; cursor: pointer; padding: 0; opacity: 0.6; font-size: 0.8rem; line-height: 1; }
.device-chip-remove:hover { opacity: 1; }

.photo-drop-zone { margin-top: 1rem; border: 2px dashed var(--border); border-radius: var(--radius-md); padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.8125rem; transition: border-color var(--t-base), background var(--t-base); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.photo-drop-zone.dragover { border-color: var(--accent); background: var(--accent-faint); }

.photo-count-badge { display: inline-flex; align-items: center; gap: 0.25rem; background: var(--surface-3); color: var(--text-muted); padding: 0.15rem 0.5rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: border-color var(--t-fast); }
.photo-count-badge:hover { border-color: var(--accent); color: var(--accent); }

/* Photo viewer */
.photo-viewer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 1100; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s ease; }
.photo-viewer-close { position: absolute; top: 1rem; right: 1.5rem; color: rgba(255,255,255,0.7); font-size: 1.5rem; cursor: pointer; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%; width: 2.25rem; height: 2.25rem; display: flex; align-items: center; justify-content: center; z-index: 10; transition: background var(--t-fast), color var(--t-fast); }
.photo-viewer-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
.photo-viewer-content { max-width: 90vw; max-height: 90vh; }
.photo-viewer-img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: var(--radius-md); box-shadow: 0 0 80px rgba(0,0,0,0.8); }

/* Device photo row */
.device-photo-row { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 1.25rem; border-bottom: 1px solid var(--border); }
.device-photo-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; flex-shrink: 0; }

/* Tag manager */
.tag-manager-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: min(480px, 95vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.15s ease;
}

.tag-manager-header-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--accent-faint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.tag-manager-close { background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; padding: 0; line-height: 1; transition: color var(--t-fast); }
.tag-manager-close:hover { color: var(--text); }
.tag-manager-create { display: flex; gap: 0.5rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); }
.tag-manager-create input { flex: 1; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.75rem; color: var(--text); font-size: 0.8125rem; font-family: inherit; outline: none; }
.tag-manager-create input:focus { border-color: var(--accent); }
.tag-manager-search { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); }
.tag-manager-search input { width: 100%; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 0.4rem 0.75rem; color: var(--text); font-size: 0.8125rem; box-sizing: border-box; font-family: inherit; outline: none; }
.tag-manager-list { overflow-y: auto; flex: 1; }
.tag-manager-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.25rem; }
.tag-manager-row + .tag-manager-row { border-top: 1px solid var(--border); }
.tag-manager-row-actions { margin-left: auto; display: flex; gap: 0.35rem; }
.tag-manager-footer { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1.25rem; border-top: 1px solid var(--border); }
.tag-manager-footer-count { color: var(--text-muted); font-size: 0.6875rem; }

/* ══════════════════════════════════════════════════════════════════════════
   CHECKBOX LIST (RF links drawer)
   ══════════════════════════════════════════════════════════════════════════ */
.checkbox-list-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.checkbox-list-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  transition: box-shadow var(--t-base);
}

.checkbox-list-search::placeholder { color: var(--text-dim); }
.checkbox-list-search:focus { box-shadow: inset 0 -2px 0 var(--accent); }

.checkbox-list { max-height: 240px; overflow-y: auto; padding: 0.25rem 0; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast);
  user-select: none;
}

.checkbox-list label:hover { background: var(--hover-bg); }
.checkbox-list label.checked { background: var(--accent-faint); }
.checkbox-list label.checked:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.checkbox-list-count {
  padding: 0.4375rem 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--surface);
}

.fiber-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.fiber-row .edit-input { flex: 1; min-width: 0; }

.fiber-remove-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-dim); cursor: pointer; transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast); }
.fiber-remove-btn:hover { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }

.fiber-add-btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.75rem; margin-top: 0.25rem; border: 1px dashed var(--border-2); border-radius: var(--radius); background: transparent; color: var(--text-muted); font-size: 0.8125rem; font-family: inherit; cursor: pointer; transition: color var(--t-base), background var(--t-base), border-color var(--t-base); }
.fiber-add-btn:hover { color: var(--accent); background: var(--accent-faint); border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   FINANCE RESTRICTED / TIMESTAMPS
   ══════════════════════════════════════════════════════════════════════════ */
.finance-restricted {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.detail-timestamps {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   NETWORK TAB
   ══════════════════════════════════════════════════════════════════════════ */
.network-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ip-assignment-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', Consolas, monospace;
  color: var(--text);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   WORKFLOW — TOWER LIST / DETAIL
   ══════════════════════════════════════════════════════════════════════════ */

/* Tower rows */
.tower-row.aging-yellow td { border-left: 3px solid var(--yellow); }
.tower-row.aging-red td { border-left: 3px solid var(--red); }
.tower-row--failed { opacity: 0.5; }
.tower-row--failed td { text-decoration: line-through; text-decoration-color: var(--border-2); }

.phase-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}

.phase-name { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.market-label { font-size: 0.75rem; color: var(--text-muted); }

/* Status/Aging indicators */
.aging-indicator.aging-yellow { color: var(--yellow); font-weight: 700; }
.aging-indicator.aging-red { color: var(--red); font-weight: 700; }

/* Status bar (tower detail header) */
.status-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
}

.status-bar--failed {
  background: linear-gradient(135deg, var(--red-bg), var(--surface));
  border-bottom-color: var(--red-border);
}

.status-bar-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-id-header {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
}

.status-bar-aging.aging-yellow { color: var(--yellow); font-weight: 600; }
.status-bar-aging.aging-red { color: var(--red); font-weight: 600; }

/* Sub-phase nav/tabs */
.sub-phase-nav { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 0.875rem; overflow-x: auto; }
.sub-phase-panel { padding: 0.5rem 0; }
.sub-phase-status { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.sub-phase-status-label { font-weight: 600; }
.sub-phase-meta { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   CHECKLIST
   ══════════════════════════════════════════════════════════════════════════ */
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.125rem; }

.checklist-dept-header {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.125rem 0 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checklist-dept-header::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  transition: background var(--t-fast);
}

.checklist-item:hover { background: var(--surface-2); }
.checklist-item--overdue { background: var(--red-bg); border-radius: var(--radius); }
.checklist-item--done { opacity: 0.45; }
.checklist-check { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0; flex-shrink: 0; transition: color var(--t-fast); }
.checklist-check:hover { color: var(--accent); }
.checklist-check--done { color: var(--green); }
.checklist-body { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.checklist-description { font-size: 0.875rem; }
.checklist-due { font-size: 0.75rem; color: var(--text-muted); }
.checklist-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════
   NOTES
   ══════════════════════════════════════════════════════════════════════════ */
.note-form { margin-bottom: 1.25rem; }

.note-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  margin-bottom: 0.625rem;
  background: var(--surface);
  transition: border-color var(--t-base);
  animation: rowEntrance 0.2s ease;
}

.note-card:hover { border-color: var(--border-2); }
.note-card--sensitive { border-color: var(--yellow-border); background: var(--yellow-bg); }
.note-header { display: flex; gap: 0.5rem; align-items: baseline; margin-bottom: 0.375rem; flex-wrap: wrap; }
.note-author { font-weight: 700; font-size: 0.875rem; }
.note-date { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.note-body { font-size: 0.875rem; line-height: 1.6; color: var(--text); }
.note-body p { margin: 0.25rem 0; }

/* ══════════════════════════════════════════════════════════════════════════
   BLOCKERS
   ══════════════════════════════════════════════════════════════════════════ */
.blocker-card {
  border: 2px solid var(--red-border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  margin-bottom: 0.875rem;
  background: var(--red-bg);
  animation: rowEntrance 0.2s ease;
}

.blocker-card--overdue { background: color-mix(in srgb, var(--red) 12%, transparent); }
.blocker-header { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.5rem; }
.blocker-type { background: var(--red); color: #fff; }
.blocker-description { font-size: 0.875rem; margin: 0.25rem 0; font-weight: 500; }
.blocker-owner, .blocker-target { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.blocker-actions { margin-top: 0.625rem; }
.add-blocker { margin-top: 0.875rem; }
.blocker-form { margin-top: 0.5rem; }

/* ══════════════════════════════════════════════════════════════════════════
   CORRESPONDENCE
   ══════════════════════════════════════════════════════════════════════════ */
.correspondence-log { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }

.correspondence-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  background: var(--surface);
  transition: border-color var(--t-base);
}

.correspondence-entry:hover { border-color: var(--border-2); }
.correspondence-header { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: baseline; margin-bottom: 0.375rem; }
.correspondence-person { font-weight: 700; font-size: 0.875rem; }
.correspondence-date { font-size: 0.75rem; color: var(--text-muted); }
.correspondence-by { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.correspondence-outcome { font-size: 0.875rem; margin: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   APPROVALS
   ══════════════════════════════════════════════════════════════════════════ */
.approval-card {
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  margin-bottom: 0.625rem;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color var(--t-base);
}

.approval-card--approved { border-left: 4px solid var(--green); }
.approval-card--rejected { border-left: 4px solid var(--red); }
.approval-card--on_hold  { border-left: 4px solid var(--yellow); }
.approval-header { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.375rem; }
.approval-gate { font-weight: 700; font-size: 0.875rem; }
.approval-approver { font-size: 0.8rem; color: var(--text-muted); }
.approval-date { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.approval-notes { font-size: 0.875rem; margin: 0.25rem 0 0; }
.approval-rejection { font-size: 0.875rem; margin: 0.25rem 0 0; color: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════
   TIMELINE / HISTORY
   ══════════════════════════════════════════════════════════════════════════ */
.timeline { display: flex; flex-direction: column; gap: 0; padding-left: 1rem; }

.timeline-item {
  display: flex;
  gap: 0.875rem;
  padding-bottom: 1.25rem;
  position: relative;
  animation: rowEntrance 0.2s ease;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -0.625rem;
  top: 1.25rem;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--border-2), transparent);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 0.375rem;
  position: absolute;
  left: -1.25rem;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.timeline-content { flex: 1; padding-left: 0; }
.timeline-header { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.timeline-status { font-weight: 700; font-size: 0.875rem; }
.timeline-date { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.timeline-by { font-size: 0.75rem; color: var(--text-muted); }
.timeline-notes { font-size: 0.8125rem; color: var(--text-muted); margin: 0.25rem 0 0; line-height: 1.5; }

/* Audit log */
.audit-log { display: flex; flex-direction: column; gap: 0; }
.audit-entry { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; font-size: 0.8125rem; padding: 0.375rem 0; border-bottom: 1px solid var(--border); }
.audit-desc { flex: 1; }
.audit-user, .audit-date { color: var(--text-muted); font-size: 0.75rem; }

/* ══════════════════════════════════════════════════════════════════════════
   ACQUISITION GATE (step flow)
   ══════════════════════════════════════════════════════════════════════════ */
.gate-steps { display: flex; flex-direction: column; gap: 1rem; }
.gate-step { display: flex; gap: 0.875rem; }
.gate-step--locked { opacity: 0.45; pointer-events: none; }

.gate-step-number {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  font-size: 0.875rem;
  transition: background var(--t-base), border-color var(--t-base);
}

.gate-step--done   .gate-step-number { background: var(--green); color: #fff; border-color: transparent; box-shadow: 0 0 0 3px var(--green-bg); }
.gate-step--active .gate-step-number { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 0 0 3px var(--accent-glow); }

.gate-step-content { flex: 1; }
.gate-step-title { font-weight: 700; margin-bottom: 0.5rem; font-size: 0.875rem; }
.gate-step-result.approved { color: var(--green); font-size: 0.875rem; font-weight: 600; }
.gate-step-pending { color: var(--text-muted); font-size: 0.875rem; }
.gate-step-locked { color: var(--text-dim); font-size: 0.8125rem; }

.gate-result-final {
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-top: 1.25rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.9375rem;
}

.gate-result-final.success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.gate-result-final.danger  { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }

/* ══════════════════════════════════════════════════════════════════════════
   LANDOWNER CRM
   ══════════════════════════════════════════════════════════════════════════ */
.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  margin-bottom: 0.875rem;
  background: var(--surface);
  transition: border-color var(--t-base);
}

.contact-card--followup { border-color: var(--yellow-border); background: var(--yellow-bg); }
.contact-header { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.375rem; }
.contact-name { font-weight: 700; font-size: 0.9rem; }
.contact-relationship { font-size: 0.8rem; color: var(--text-muted); }
.contact-details { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.375rem; }
.contact-notes { font-size: 0.875rem; margin: 0.25rem 0 0; }
.contact-form { margin-top: 0.5rem; }
.add-contact { margin-top: 0.875rem; }

/* ══════════════════════════════════════════════════════════════════════════
   RF STUDIES
   ══════════════════════════════════════════════════════════════════════════ */
.rf-studies-list { display: flex; flex-direction: column; gap: 0.875rem; margin-top: 1rem; }

.rf-study-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  background: var(--surface);
}

.rf-study-header { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.375rem; }
.bsl-count-badge { background: linear-gradient(135deg, var(--accent), var(--purple)); color: #fff; padding: 0.2rem 0.625rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 800; }
.rf-study-notes { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }
.geotiff-toggle { margin-top: 0.5rem; }

/* ══════════════════════════════════════════════════════════════════════════
   PERMIT DEADLINES
   ══════════════════════════════════════════════════════════════════════════ */
.deadlines-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }

.deadline-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  background: var(--surface);
  transition: border-color var(--t-base);
}

.deadline-card--overdue { border-color: var(--red-border); background: var(--red-bg); }
.deadline-header { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: baseline; margin-bottom: 0.25rem; }
.deadline-date { font-weight: 700; font-size: 0.875rem; }
.deadline-urgent { color: var(--red); }
.deadline-desc { font-size: 0.875rem; margin: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════════ */
.notifications-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--surface-2); }

.notification-item--unread {
  background: var(--accent-faint);
}
.notification-item--unread:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-2);
  flex-shrink: 0;
  margin-top: 0.375rem;
}
.notification-dot--active {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.notification-header { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.25rem; }
.notification-subject { font-size: 0.875rem; margin: 0; font-weight: 600; }
.notification-tower { font-family: monospace; font-size: 0.8rem; color: var(--accent); }
.notification-date { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }

/* ══════════════════════════════════════════════════════════════════════════
   CONSTRUCTION TAB
   ══════════════════════════════════════════════════════════════════════════ */
.construction-tab { display: flex; flex-direction: column; gap: 1.25rem; }
.construction-header-bar { display: flex; align-items: center; justify-content: space-between; }
.construction-header-bar h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.construction-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.photo-req-item { display: flex; align-items: flex-start; gap: 0.625rem; padding: 0.625rem 0; border-bottom: 1px solid var(--border); }
.photo-req-icon { width: 1.4rem; font-size: 1.1rem; flex-shrink: 0; color: var(--text-muted); }
.photo-req-item.satisfied .photo-req-icon { color: var(--green); }
.photo-req-name { font-weight: 600; font-size: 0.875rem; }
.photo-req-desc { font-size: 0.8rem; color: var(--text-muted); margin-left: 0.5rem; }

.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.875rem; }
.photo-thumb { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.5rem; background: var(--surface-2); }
.photo-thumb-label { font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.photo-thumb-filename { font-size: 0.8rem; word-break: break-all; }
.photo-thumb-caption { font-size: 0.75rem; color: var(--text-muted); }
.photo-thumb-meta { font-size: 0.6875rem; color: var(--text-dim); margin-top: 0.25rem; }

.card--construction { border-left: 4px solid var(--accent); }
.card--production { border-left: 4px solid var(--green); }

.inline-upload-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-left: auto; }
.inline-upload-form input[type="file"] { font-size: 0.8rem; }
.inline-upload-form input[type="text"] { padding: 0.25rem 0.5rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8rem; background: var(--surface-2); color: var(--text); width: 160px; font-family: inherit; outline: none; }

/* ══════════════════════════════════════════════════════════════════════════
   DASHBOARDS / REPORTS
   ══════════════════════════════════════════════════════════════════════════ */
.exec-stats { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.5rem; }
.exec-map-card .card-header { border-radius: var(--radius-md) var(--radius-md) 0 0; }

.blocker-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.875rem; margin-bottom: 1.25rem; }

.blocker-type-card {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
}

.blocker-type-count { font-size: 2rem; font-weight: 800; color: var(--red); letter-spacing: -0.04em; }
.blocker-type-label { font-size: 0.8rem; font-weight: 700; }
.blocker-type-sites { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.sub-section { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.compact-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.compact-list li { margin-bottom: 0.375rem; font-size: 0.875rem; display: flex; gap: 0.375rem; align-items: baseline; }
.compact-list li::before { content: '·'; color: var(--text-dim); flex-shrink: 0; }

.phase-legend { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.legend-item { font-size: 0.6875rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border); }

/* Compare table */
.compare-table-wrapper { overflow-x: auto; margin-top: 1rem; }
.compare-table { min-width: 600px; }
.compare-label { font-weight: 600; white-space: nowrap; color: var(--text-muted); background: var(--surface-2); }
.compare-site-header { text-align: center; min-width: 160px; }
.compare-site-name { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }
.compare-section-header td { font-weight: 800; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; background: var(--accent-faint); color: var(--accent-2); padding: 0.375rem 0.875rem; border-left: 3px solid var(--accent); }

/* Detail grid (workflow tower_detail cards layout) */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }

/* Empty state inline */
.empty-inline { color: var(--text-muted); font-size: 0.875rem; }
.empty-inline a { color: var(--accent); text-decoration: none; }
.empty-inline a:hover { text-decoration: underline; }

/* Equipment */
.equipment-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.equipment-search {
  flex: 1 1 200px;
  min-width: 160px;
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-base);
}

.equipment-search:focus { border-color: var(--accent); }

.equipment-filter {
  flex: 0 1 auto;
  padding: 0.4rem 2rem 0.4rem 0.625rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t-base);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.equipment-filter:focus { border-color: var(--accent); }

.equipment-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.equipment-table thead th { background: var(--surface-2); padding: 0.625rem 1rem; text-align: left; font-weight: 700; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); white-space: nowrap; border-bottom: 1px solid var(--border); }
.equipment-table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--t-fast); }
.equipment-table tbody tr:last-child { border-bottom: none; }
.equipment-table tbody tr:hover { background: var(--surface-2); }
.equipment-table td { padding: 0.625rem 1rem; vertical-align: middle; }
.equipment-table a { color: var(--accent); text-decoration: none; font-weight: 500; }
.equipment-table a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════════
   SKELETON LOADING
   ══════════════════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skeleton-text { height: 0.875rem; margin-bottom: 0.5rem; }
.skeleton-title { height: 1.25rem; width: 60%; margin-bottom: 0.75rem; }
.skeleton-row { height: 42px; margin-bottom: 1px; border-radius: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════════════════ */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem;  }
.mt-4 { margin-top: 1rem;    }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.text-accent { color: var(--accent); }
.font-mono { font-family: 'JetBrains Mono', Consolas, monospace; }

/* ══════════════════════════════════════════════════════════════════════════
   COMPACT DENSITY
   ══════════════════════════════════════════════════════════════════════════ */
[data-density="compact"] .card { padding: 0.875rem; }
[data-density="compact"] thead th { padding: 0.375rem 0.75rem; font-size: 0.6375rem; }
[data-density="compact"] tbody td { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
[data-density="compact"] .badge { padding: 0.2rem 0.5rem; font-size: 0.6875rem; }
[data-density="compact"] .field-grid { gap: 0.5rem; }
[data-density="compact"] .field-item, [data-density="compact"] .field-item-v2 { padding: 0.5rem 0.75rem; }
[data-density="compact"] .field-label, [data-density="compact"] .field-label-v2 { font-size: 0.625rem; }
[data-density="compact"] .field-value, [data-density="compact"] .field-value-v2 { font-size: 0.8125rem; }
[data-density="compact"] .count-chip { padding: 0.625rem 0.875rem; }
[data-density="compact"] .count-number { font-size: 1.25rem; }
[data-density="compact"] .neighbor-card { padding: 0.625rem 0.75rem; }
[data-density="compact"] .overview-label { font-size: 0.6875rem; }
[data-density="compact"] .overview-value { font-size: 0.8125rem; }
[data-density="compact"] .overview-grid { gap: 0.375rem 0.75rem; }
[data-density="compact"] .stat-card { padding: 0.75rem 0.875rem; }
[data-density="compact"] .stat-card__number { font-size: 1.5rem; }
[data-density="compact"] .tab-panels { padding: 0.875rem 1rem; }
[data-density="compact"] .qi-row { padding: 0.1875rem 0; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .dashboard-map-panel { height: 60vh; min-height: 360px; }
}

@media (max-width: 800px) {
  .detail-top { grid-template-columns: 1fr; }
  .nav-links .nav-link span { display: none; }
  .page-header-inner { padding: 0.875rem 1rem; }
  .page-body { padding: 1rem; }
  .filter-bar-row { padding: 0.625rem 1rem; }
}

@media (max-width: 600px) {
  .drawer { width: 100vw; border-radius: var(--radius-xl) var(--radius-xl) 0 0; top: auto; height: 95vh; animation: slideInLeft 0.25s ease; }
  .review-modal { width: 100vw; max-width: 100vw; border-radius: 0; max-height: 100vh; }
  .review-field-row { grid-template-columns: 1fr; }
  .tab-panels { padding: 1rem; }
  .stat-cards-row { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════════════
   THEME ICONS
   ══════════════════════════════════════════════════════════════════════════ */
.tms-icon-sun, .tms-icon-moon { display: none; }

/* ══════════════════════════════════════════════════════════════════════════
   COPILOT (ai_assistant)
   ══════════════════════════════════════════════════════════════════════════ */
/* Handled by copilot.css, but add integration hooks */

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE FIELD MODE
   ══════════════════════════════════════════════════════════════════════════ */
.field-mode-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem;
}

.field-mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════════════════════════
   MARKET MAP — full-screen layout
   ══════════════════════════════════════════════════════════════════════════ */

/* List page: map fills viewport below nav, panel floats over it */
.market-map-page {
  position: fixed;
  inset: 0;
  top: var(--nav-height, 56px);
  display: flex;
  overflow: hidden;
}

.market-map-canvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}

/* Floating side panel */
.market-map-panel {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 340px;
  max-height: calc(100% - 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow: hidden;
}

.market-map-panel-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  background: var(--surface);
}

.market-map-panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  color: var(--text);
}

.market-map-panel-body {
  overflow-y: auto;
  flex: 1 1 auto;
  padding: 0.5rem;
}

.market-map-panel-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-2);
}

/* Market cards in the floating panel */
.market-panel-card {
  display: block;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-bottom: 0.375rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: var(--text);
}

.market-panel-card:hover,
.market-panel-card.active {
  background: var(--surface-3);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.market-panel-card-code {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.market-panel-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0.125rem 0 0.375rem;
  color: var(--text);
}

.market-panel-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Detail page: map at top, content below */
.market-detail-map-wrap {
  width: 100%;
  height: 480px;
  position: relative;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.market-detail-map-wrap #market-detail-map {
  width: 100%;
  height: 100%;
}

/* Slide-in target area detail panel */
.ta-detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ta-detail-panel.open {
  transform: translateX(0);
}

.ta-detail-panel-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  background: var(--surface);
}

.ta-detail-panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  color: var(--text);
}

.ta-detail-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
}

.ta-detail-panel-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  background: var(--surface-2);
}

/* Priority color dots */
.ta-priority-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ta-priority-dot.high  { background: #ef4444; }
.ta-priority-dot.medium { background: #f59e0b; }
.ta-priority-dot.low   { background: #22c55e; }

/* Target area list in detail page */
.ta-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.ta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: background 0.15s;
}

.ta-row:hover { background: var(--surface-3); }

.ta-row-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.ta-row-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.ta-row-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Target area add form */
.ta-add-form {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: var(--surface-2);
  margin-top: 0.75rem;
}

.ta-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.ta-form-grid .field-full { grid-column: 1 / -1; }

/* Map show-all button */
.market-map-showall {
  display: none;
  width: 100%;
  margin-top: 0.5rem;
}

.market-map-showall.visible { display: block; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .market-map-panel { width: calc(100vw - 2rem); }
  .ta-detail-panel { width: 100%; }
  .market-detail-map-wrap { height: 320px; }
  .ta-form-grid { grid-template-columns: 1fr; }
}
