/* ============================================
   AcreView CRM — Styles
   Brand: Forest Black, Gold, Cream, Warm Slate
   Fonts: Cormorant Garamond, Outfit
   ============================================ */

:root {
  --forest: #060D06;
  --forest-light: #0f1a0f;
  --forest-card: #111a11;
  --gold: #E8C547;
  --gold-dim: #c9a83a;
  --gold-glow: rgba(232, 197, 71, 0.15);
  --cream: #EDE9E1;
  --cream-dim: rgba(237, 233, 225, 0.7);
  --slate: #8A8580;
  --red: #e05252;
  --red-dim: rgba(224, 82, 82, 0.15);
  --green: #4caf50;
  --green-dim: rgba(76, 175, 80, 0.15);
  --sidebar-w: 200px;
  --header-h: 56px;
  --mobile-nav-h: 64px;
  --radius: 8px;
  --radius-lg: 12px;
}

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

html { font-size: 15px; }

body {
  font-family: 'Outfit', sans-serif;
  font-weight: 300;
  background: var(--forest);
  color: var(--cream);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--cream); }

.hidden { display: none !important; }

/* ---- Password Gate ---- */
.gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.gate-card {
  background: var(--forest-light);
  border: 1px solid rgba(232, 197, 71, 0.2);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.gate-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.6rem;
  letter-spacing: 0.25em;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.gate-sub {
  color: var(--slate);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#gate-input {
  width: 100%;
  padding: 0.7rem 1rem;
  min-height: 48px;
  border: 1px solid var(--slate);
  border-radius: var(--radius);
  background: var(--forest);
  color: var(--cream);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

#gate-input:focus { border-color: var(--gold); }

.gate-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  min-height: 44px;
  border: 1px solid var(--slate);
  border-radius: var(--radius);
  background: transparent;
  color: var(--cream);
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--gold); color: var(--gold); }

.btn-gold {
  background: var(--gold);
  color: var(--forest);
  border-color: var(--gold);
  font-weight: 500;
}

.btn-gold:hover { background: var(--gold-dim); color: var(--forest); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }

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

.btn-approve { background: var(--green); color: #fff; border-color: var(--green); }
.btn-approve:hover { background: #43a047; }

.btn-skip { border-color: var(--slate); color: var(--slate); }
.btn-skip:hover { border-color: var(--cream); color: var(--cream); }

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--forest);
  border-bottom: 1px solid rgba(232, 197, 71, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem 0 1.25rem;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--slate);
}

.header-crm {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--slate);
  text-transform: uppercase;
}

.header-right {
  display: flex;
  gap: 0.5rem;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--forest);
  border-right: 1px solid rgba(232, 197, 71, 0.08);
  padding: 1rem 0;
  z-index: 90;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1.25rem;
  color: var(--slate);
  font-size: 0.9rem;
  font-weight: 400;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover { color: var(--cream); background: var(--gold-glow); }

.nav-item.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: var(--gold-glow);
}

/* ---- Main Content ---- */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 1.5rem;
  min-height: calc(100vh - var(--header-h));
}

.view { display: none; }
.view.active { display: block; }

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
}

.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  color: var(--gold);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* ---- Dashboard Grid ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.dash-section {
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.dash-column { display: flex; flex-direction: column; gap: 1.5rem; }

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

.section-header h2 { font-size: 1.2rem; }

.badge {
  background: var(--gold);
  color: var(--forest);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  font-family: 'Outfit', sans-serif;
}

.view-all-link {
  display: block;
  text-align: right;
  font-size: 0.82rem;
  margin-top: 0.75rem;
}

/* ---- Queue Cards ---- */
.queue-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.queue-card {
  background: var(--forest-light);
  border: 1px solid rgba(232, 197, 71, 0.15);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.queue-card:hover { border-color: var(--gold); }

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

.queue-contact {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: var(--cream);
}

.queue-firm { color: var(--slate); font-size: 0.85rem; }

.queue-phone {
  color: var(--gold);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.queue-phone a { color: var(--gold); }

.queue-trigger {
  background: var(--gold-glow);
  border-left: 3px solid var(--gold);
  padding: 0.6rem 0.8rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0.75rem;
}

.queue-trigger-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.queue-trigger-text {
  color: var(--cream);
  font-size: 0.9rem;
}

.queue-deal {
  color: var(--slate);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.queue-email-section { margin-bottom: 1rem; }

.queue-email-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.queue-email-text {
  background: var(--forest);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius);
  padding: 0.8rem;
  font-size: 0.9rem;
  color: var(--cream-dim);
  line-height: 1.5;
  white-space: pre-wrap;
  min-height: 80px;
}

.queue-email-text[contenteditable="true"] {
  outline: none;
  border-color: var(--gold);
  color: var(--cream);
}

.queue-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---- Data Tables ---- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead th {
  background: var(--forest-card);
  color: var(--gold);
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.7rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(232, 197, 71, 0.15);
  position: sticky;
  top: 0;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(232, 197, 71, 0.06);
  cursor: pointer;
  transition: background 0.1s;
}

.data-table tbody tr:hover { background: var(--gold-glow); }

.data-table td {
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
}

.data-table td a { color: var(--gold); }

/* Priority indicators */
.priority-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.3rem;
}

.priority-high { background: var(--red); }
.priority-medium { background: var(--gold); }
.priority-low { background: var(--green); }

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 400;
}

.status-new { background: rgba(76, 175, 80, 0.15); color: var(--green); }
.status-contacted { background: rgba(232, 197, 71, 0.15); color: var(--gold); }
.status-qualified { background: rgba(100, 181, 246, 0.15); color: #64b5f6; }
.status-proposal { background: rgba(171, 71, 188, 0.15); color: #ab47bc; }
.status-won { background: rgba(76, 175, 80, 0.25); color: var(--green); }
.status-lost { background: rgba(224, 82, 82, 0.15); color: var(--red); }

.relationship-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
}

.rel-new { background: rgba(100, 181, 246, 0.15); color: #64b5f6; }
.rel-active { background: rgba(76, 175, 80, 0.15); color: var(--green); }
.rel-repeat { background: rgba(232, 197, 71, 0.15); color: var(--gold); }
.rel-inactive { background: rgba(92, 88, 84, 0.3); color: var(--slate); }

.overdue { color: var(--red) !important; font-weight: 500; }

/* ---- Kanban Board ---- */
.kanban {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-col {
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.08);
  border-radius: var(--radius-lg);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-bottom: 1px solid rgba(232, 197, 71, 0.08);
}

.kanban-col-header h3 {
  font-size: 0.85rem;
  color: var(--cream);
}

.kanban-count {
  background: rgba(232, 197, 71, 0.15);
  color: var(--gold);
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: 'Outfit', sans-serif;
}

.kanban-cards {
  flex: 1;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 100px;
}

.kanban-cards:empty::after {
  content: 'Drag jobs here';
  color: var(--slate);
  font-size: 0.78rem;
  text-align: center;
  padding: 1.5rem 0.5rem;
  opacity: 0.6;
}

.kanban-cards.drag-over {
  background: var(--gold-glow);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.kanban-card {
  background: var(--forest-light);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius);
  padding: 0.75rem;
  cursor: grab;
  transition: transform 0.1s, border-color 0.15s;
}

.kanban-card:hover { border-color: var(--gold); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }

.kanban-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.kanban-card-meta {
  font-size: 0.78rem;
  color: var(--slate);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kanban-card-value { color: var(--gold); font-weight: 400; }

/* ---- Follow-ups ---- */
.followups-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.followup-card {
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.followup-card.overdue-card { border-left: 3px solid var(--red); }

.followup-info { flex: 1; }
.followup-contact { font-size: 1rem; margin-bottom: 0.2rem; }
.followup-about { font-size: 0.85rem; color: var(--slate); }
.followup-context { font-size: 0.8rem; color: var(--red); font-style: italic; margin-top: 0.2rem; }
.followup-date { font-size: 0.85rem; color: var(--slate); white-space: nowrap; }
.followup-date.overdue { color: var(--red); }

/* ---- Scanner Tabs ---- */
.scanner-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(232, 197, 71, 0.12);
  margin-bottom: 1rem;
  overflow-x: auto;
}

.scanner-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--slate);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  min-height: 48px;
}

.scanner-tab:hover { color: var(--cream); }
.scanner-tab.active { color: var(--cream); border-bottom-color: var(--gold); }
.scanner-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.tab-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tab-dot-hot { background: var(--red); }
.tab-dot-warm { background: var(--gold); }
.tab-dot-volume { background: var(--green); }
.tab-dot-large { background: #64b5f6; }

.tab-count {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
}

.scan-panel { display: none; }
.scan-panel.active { display: block; }

.scan-summary {
  font-size: 0.8rem;
  color: var(--slate);
}

/* ---- Scanner Cards ---- */
.scan-card {
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}

.scan-card:hover { border-color: var(--gold); }

.scan-card-hot { border-left: 3px solid var(--red); }
.scan-card-warm { border-left: 3px solid var(--gold); }
.scan-card-volume { border-left: 3px solid var(--green); }
.scan-card-large { border-left: 3px solid #64b5f6; }

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

.scan-card-address {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  color: var(--cream);
  line-height: 1.3;
}

.scan-card-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  font-family: 'Outfit', sans-serif;
}

.badge-hot { background: rgba(224, 82, 82, 0.2); color: var(--red); }
.badge-warm { background: rgba(232, 197, 71, 0.2); color: var(--gold); }
.badge-volume { background: rgba(76, 175, 80, 0.2); color: var(--green); }
.badge-large { background: rgba(100, 181, 246, 0.2); color: #64b5f6; }
.badge-residential { background: rgba(171, 71, 188, 0.15); color: #ab47bc; }
.badge-transfer { background: rgba(255, 152, 0, 0.15); color: #ff9800; }

.scan-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.82rem;
  color: var(--slate);
  margin-bottom: 0.5rem;
}

.scan-card-meta strong { color: var(--cream); font-weight: 400; }

.scan-card-reason {
  background: var(--gold-glow);
  border-left: 3px solid var(--gold);
  padding: 0.5rem 0.7rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--cream);
  margin-bottom: 0.6rem;
}

.scan-card-reason.reason-hot { border-left-color: var(--red); background: var(--red-dim); }

.scan-card-drive {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--slate);
  background: var(--forest);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.scan-card-media {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.media-missing { background: rgba(224, 82, 82, 0.15); color: var(--red); }
.media-poor { background: rgba(255, 152, 0, 0.15); color: #ff9800; }
.media-has { background: rgba(76, 175, 80, 0.1); color: var(--green); }

.scan-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.scan-card-feasibility {
  font-size: 0.8rem;
  color: #64b5f6;
  font-style: italic;
  margin-top: 0.4rem;
}

.scan-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate);
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(232, 197, 71, 0.08);
}

/* ---- Scanner ---- */
.scanner-status {
  background: var(--gold-glow);
  border: 1px solid rgba(232, 197, 71, 0.2);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.scanner-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--gold);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(232, 197, 71, 0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.source-item, .chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--cream-dim);
  cursor: pointer;
  transition: border-color 0.15s;
}

.source-item:hover, .chip:hover { border-color: var(--gold); }

.source-item input, .chip input { accent-color: var(--gold); }

.county-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.scanner-sources h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--cream-dim);
}

.scanner-results {
  margin-top: 1rem;
}

/* ---- Detail Panel ---- */
.detail-panel {
  position: fixed;
  top: var(--header-h);
  right: -460px;
  bottom: 0;
  width: 450px;
  background: var(--forest-light);
  border-left: 1px solid rgba(232, 197, 71, 0.15);
  z-index: 200;
  transition: right 0.25s ease;
  overflow-y: auto;
}

.detail-panel.open { right: 0; }

.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 190;
}

.detail-overlay.open { display: block; }

.detail-panel-inner { padding: 1.5rem; }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.detail-header h2 { font-size: 1.3rem; }

.detail-close {
  background: none;
  border: none;
  color: var(--slate);
  font-size: 1.8rem;
  cursor: pointer;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.detail-close:hover { color: var(--cream); }
.detail-close:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.detail-content .field-group {
  margin-bottom: 1rem;
}

.detail-content .field-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate);
  margin-bottom: 0.2rem;
}

.detail-content .field-value {
  font-size: 0.95rem;
  color: var(--cream);
}

/* ---- Modal ---- */
.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--forest-light);
  border: 1px solid rgba(232, 197, 71, 0.2);
  border-radius: var(--radius-lg);
  z-index: 300;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal.open { display: block; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 290;
}

.modal-overlay.open { display: block; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(232, 197, 71, 0.1);
}

.modal-header h2 { font-size: 1.2rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--slate);
  font-size: 1.6rem;
  cursor: pointer;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.modal-close:hover { color: var(--cream); }
.modal-close:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.modal-body { padding: 1.5rem; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(232, 197, 71, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ---- Form Inputs ---- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
  margin-bottom: 0.3rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--forest);
  border: 1px solid var(--slate);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--gold);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235C5854' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.search-input {
  padding: 0.4rem 0.75rem;
  background: var(--forest);
  border: 1px solid var(--slate);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  outline: none;
  width: 200px;
}

.search-input:focus { border-color: var(--gold); }

.select-input {
  padding: 0.4rem 0.75rem;
  background: var(--forest);
  border: 1px solid var(--slate);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  outline: none;
  appearance: none;
  padding-right: 1.5rem;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235C5854' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

/* ---- View Header ---- */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.view-header h2 { font-size: 1.4rem; }

.view-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---- Activity List ---- */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(232, 197, 71, 0.06);
  font-size: 0.88rem;
}

.activity-item:last-child { border-bottom: none; }
.activity-name { color: var(--cream); }
.activity-meta { color: var(--slate); font-size: 0.8rem; }

/* ---- Empty State ---- */
.empty-state {
  color: var(--slate);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.2);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.88rem;
  color: var(--cream);
  animation: slideIn 0.25s ease;
  max-width: 360px;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--gold); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Calendar View ---- */
.calendar-view {
  background: var(--forest-card);
  border: 1px solid rgba(232, 197, 71, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-header-cell {
  text-align: center;
  font-size: 0.72rem;
  color: var(--gold);
  text-transform: uppercase;
  padding: 0.5rem 0;
}

.calendar-cell {
  min-height: 80px;
  background: var(--forest);
  border-radius: 4px;
  padding: 0.3rem;
}

.calendar-cell-date {
  font-size: 0.75rem;
  color: var(--slate);
  margin-bottom: 0.2rem;
}

.calendar-cell-today .calendar-cell-date { color: var(--gold); font-weight: 500; }

.calendar-event {
  background: var(--gold-glow);
  border-left: 2px solid var(--gold);
  border-radius: 0 3px 3px 0;
  padding: 0.15rem 0.3rem;
  font-size: 0.7rem;
  color: var(--cream);
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Mobile Nav ---- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  z-index: 105;
  left: 0;
  right: 0;
  height: var(--mobile-nav-h);
  background: var(--forest);
  border-top: 1px solid rgba(232, 197, 71, 0.12);
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--slate);
  font-size: 0.65rem;
  padding: 0.4rem;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
}

.mobile-nav-item svg { width: 20px; height: 20px; }

.mobile-nav-item.active { color: var(--gold); }
.mobile-nav-item:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: var(--radius); }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .kanban { grid-template-columns: repeat(3, 1fr); }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }

  .main {
    margin-left: 0;
    margin-bottom: var(--mobile-nav-h);
    padding: 1rem;
  }

  .header-right { display: none; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stats-row .stat-card:last-child { grid-column: span 2; }

  .kanban {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .kanban-col { min-height: auto; }

  .view-header { flex-direction: column; align-items: flex-start; }

  .view-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-input { width: 100%; }

  .queue-card { padding: 1rem; }

  .queue-actions { flex-direction: column; }
  .queue-actions .btn { width: 100%; justify-content: center; min-height: 48px; }

  .detail-panel {
    width: 100%;
    right: -100%;
  }

  .modal {
    width: 95%;
    max-height: 90vh;
  }

  .form-row { grid-template-columns: 1fr; }

  .data-table { font-size: 0.82rem; }
  .data-table td, .data-table th { padding: 0.5rem; }

  .toast-container {
    bottom: calc(var(--mobile-nav-h) + 0.5rem);
    left: 0.5rem;
    right: 0.5rem;
  }

  .toast { max-width: none; }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }
  .stats-row .stat-card { scroll-snap-align: start; }
  .stats-row .stat-card:last-child { grid-column: auto; }

  .gate-card { padding: 2rem 1.5rem; }
  .gate-logo { font-size: 2rem; }
}
