
/* ─── THEME VARIABLES ──────────────────────────────────────────────────── */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f7fa;
  --text-primary: #1a1a2e;
  --text-secondary: #666666;
  --border-color: #dde1e7;
  --sidebar-bg: #2c3e50;
  --sidebar-text: #ecf0f1;
  --sidebar-hover: #34495e;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --button-primary-bg: #4f8ef7;
  --button-primary-text: #ffffff;
}

[data-theme="dark"] {
  --bg-primary: #2a2a2a;
  --bg-secondary: #1f1f1f;
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --border-color: #3a3a3a;
  --sidebar-bg: #1a1a1a;
  --sidebar-text: #e8e8e8;
  --sidebar-hover: #333333;
  --card-bg: #333333;
  --input-bg: #3a3a3a;
  --button-primary-bg: #d4a574;
  --button-primary-text: #1a1a1a;
}

/* ═══════════════════════════════════════════════════
   Barcelona Mission App – style.css
   ═══════════════════════════════════════════════════ */

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

html { overflow-x: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffffff;
  color: #1a1a2e;
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ═══════ SIDEBAR ═══════ */
.sidebar {
  width: 220px;
  height: 100vh;
  background: #1a1a2e;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(0,0,0,0.3);
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon { font-size: 22px; }
.logo-text  { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; }

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-item { margin: 4px 12px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255,255,255,0.75);
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active .nav-link { background: #4f8ef7; color: #fff; }

.nav-icon  { font-size: 16px; width: 20px; text-align: center; }
.nav-label { font-size: 13px; font-weight: 500; }

/* ═══════ MAIN WRAPPER ═══════ */
.main-wrapper {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ═══════ TOPBAR ═══════ */
.topbar {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.page-title { font-size: 18px; font-weight: 700; color: #1a1a2e; }

.topbar-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-wrapper {
  display: flex;
  align-items: center;
}

.search-input {
  padding: 7px 12px;
  border: 1px solid #dde1e7;
  border-radius: 6px;
  font-size: 13px;
  width: 200px;
  outline: none;
  transition: border 0.15s;
}
.search-input:focus { border-color: #4f8ef7; }

.filter-select {
  padding: 7px 10px;
  border: 1px solid #dde1e7;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  outline: none;
}

/* ═══════ PAGE CONTENT ═══════ */
.page-content { padding: 20px 24px 0 24px; flex: 1; }

/* ═══════ FLASH MESSAGES ═══════ */
.flash-container { padding: 0 24px; }
.flash {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.flash-success { background: #d1f5e8; color: #0d6e46; border: 1px solid #2dc88a; }
.flash-error   { background: #fde8e8; color: #c0392b; border: 1px solid #f75f5f; }
.flash-close   { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; }

/* ═══════ STAT CARDS ═══════ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-cards-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid transparent;
}

.stat-blue   { border-left-color: #4f8ef7; }
.stat-orange { border-left-color: #f7944f; }
.stat-green  { border-left-color: #2dc88a; }
.stat-red    { border-left-color: #f75f5f; }

.stat-icon  { font-size: 28px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* ═══════ CHARTS ═══════ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }

.chart-container {
  position: relative;
  height: 280px;
}

/* ═══════ DATA TABLE ═══════ */
.section-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.section-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  color: #374151;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}

.data-table tr:hover td { background: #f8f9fa; }
.empty-row { text-align: center; color: #9ca3af; padding: 24px; }

/* ═══════ VIEW TABS ═══════ */
.view-tabs {
  display: flex;
  gap: 8px;
  background: #fff;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.view-tab {
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  transition: background 0.15s, color 0.15s;
}

.view-tab:hover { background: #f3f4f6; color: #1f2937; }
.view-tab.active { background: #2563eb; color: #fff; }

/* ═══════ SUB-TABS ═══════ */
.sub-tabs {
  display: flex;
  gap: 4px;
  background: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sub-tab {
  padding: 8px 18px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: transparent;
  cursor: pointer;
}

.sub-tab:hover { background: #f0f2f5; color: #1a1a2e; }
.sub-tab.active { background: #4f8ef7; color: #fff; }

/* ── Other Dropdown ── */
.sub-tabs-other-dropdown {
  position: relative;
  display: flex;
}

.other-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  margin-top: 4px;
  min-width: 200px;
}

.other-dropdown-item {
  display: block;
  padding: 10px 16px;
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-bottom: 1px solid #f0f2f5;
}

.other-dropdown-item:last-child {
  border-bottom: none;
}

.other-dropdown-item:hover {
  background: #f0f2f5;
  color: #1a1a2e;
}

/* Dark mode support */
[data-theme="dark"] .other-dropdown-menu {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .other-dropdown-item {
  color: var(--text-secondary);
}

[data-theme="dark"] .other-dropdown-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Submenu for waiting status filters */
.other-dropdown-item-with-submenu {
  position: relative;
}

.submenu {
  position: absolute;
  top: 0;
  left: 100%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  min-width: 160px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  margin-left: 4px;
}

[data-theme="dark"] .submenu {
  background: var(--card-bg);
  border-color: var(--border-color);
}

.submenu .other-dropdown-item {
  border-bottom: 1px solid #f0f2f5;
}

[data-theme="dark"] .submenu .other-dropdown-item {
  border-bottom-color: var(--border-color);
}

.submenu .other-dropdown-item:last-child {
  border-bottom: none;
}

/* ═══════ SPLIT LAYOUT ═══════ */
.split-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px 16px 0 16px;
  transition: grid-template-columns 0.2s;
  height: 100%;
}

.split-layout.panel-open {
  grid-template-columns: 1fr 380px;
}

/* ═══════ CARD LIST ═══════ */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  height: 100%;
  padding-right: 4px;
}

.list-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.list-card:hover {
  border-color: #c7d8fb;
  box-shadow: 0 4px 12px rgba(79,142,247,0.12);
  transform: translateY(-1px);
}

.list-card.selected {
  border-color: #4f8ef7;
  box-shadow: 0 4px 12px rgba(79,142,247,0.2);
}

.list-card.card-danger {
  border-color: #f87171;
  background: #fff5f5;
}
.list-card.card-danger:hover {
  border-color: #ef4444;
  box-shadow: 0 4px 12px rgba(239,68,68,0.15);
}
[data-theme="dark"] .list-card.card-danger {
  border-color: #ef4444;
  background: #3a1f1f;
}
[data-theme="dark"] .list-card.card-danger:hover {
  border-color: #f87171;
  box-shadow: 0 4px 12px rgba(239,68,68,0.2);
}

/* Month heading for upcoming releases filter */
.month-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 16px 0 12px 0;
  margin-top: 8px;
  border-bottom: 2px solid var(--border-color);
}

.card-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.card-name.green { color: #2dc88a; }
.card-name.red   { color: #f75f5f; }

.card-subname {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
  align-items: center;
}

/* ═══════ STATUS PILLS ═══════ */
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-green  { background: #d1f5e8; color: #0d6e46; }
.status-red    { background: #fde8e8; color: #c0392b; }
.status-yellow { background: #fef9c3; color: #854d0e; }
.status-blue   { background: #dbeafe; color: #1e40af; }
.status-gray   { background: #f3f4f6; color: #4b5563; }
.status-orange { background: #fff3e0; color: #b45309; }
.status-purple { background: #f3e8ff; color: #6b21a8; }

/* ═══════ DETAIL PANEL ═══════ */
.detail-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  height: calc(100vh - 160px);
  overflow-y: auto;
  position: fixed;
  top: 140px;
  right: 24px;
  width: 380px;
  display: none;
}

.detail-panel.active {
  display: block;
}

.detail-placeholder {
  display: none;
  gap: 12px;
}
.placeholder-icon { font-size: 40px; }

.detail-loading {
  padding: 40px;
  text-align: center;
  color: #9ca3af;
}

.detail-content { display: flex; flex-direction: column; height: 100%; }

.detail-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d5e 100%);
  padding: 24px;
  color: #fff;
  text-align: center;
  position: relative;
}

.close-panel-btn {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.close-panel-btn:hover { background: rgba(255,255,255,0.3); }

.detail-avatar {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  margin: 0 auto 12px;
  color: #fff;
}

.detail-photo {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
  display: block;
  border: 3px solid rgba(255,255,255,0.3);
}

.detail-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.detail-body {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
}

.detail-section {
  margin-bottom: 16px;
  border-bottom: 1px solid #f0f2f5;
  padding-bottom: 16px;
}
.detail-section:last-child { border-bottom: none; }

.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
}
.detail-label { color: #6b7280; min-width: 110px; flex-shrink: 0; font-weight: 500; }
.detail-value { color: #1a1a2e; flex: 1; word-break: break-word; }
.detail-value a { color: #4f8ef7; text-decoration: none; }
.detail-value a:hover { text-decoration: underline; }

/* Clickable values on travel page */
.clickable-value { 
  cursor: pointer; 
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color 0.2s, color 0.2s;
}
.clickable-value:hover { 
  background-color: #e8f1ff;
  color: #2c5cdb;
}

.detail-notes { font-size: 13px; color: #374151; line-height: 1.5; }

.detail-actions {
  padding: 16px;
  border-top: 1px solid #f0f2f5;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: #f8f9fa;
}

/* ═══════ BUTTONS ═══════ */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.btn:hover { opacity: 0.85; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.16); }
.btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.btn-primary   { background: #4f8ef7; color: #fff; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-danger    { background: #f75f5f; color: #fff; }
.btn-warning   { background: #fbbf24; color: #1a1a1a; }
.btn-green     { background: #2dc88a; color: #fff; }
.btn-orange    { background: #f7944f; color: #fff; }
.btn-info      { background: #4f8ef7; color: #fff; }

/* ═══════ PHOTO CARD ═══════ */
.photo-card { display: flex; align-items: center; gap: 12px; }

.photo-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0f2f5;
  display: flex; align-items: center; justify-content: center;
}
.photo-avatar img { width: 100%; height: 100%; object-fit: cover; }

.initials-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #4f8ef7;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}

.photo-info { flex: 1; min-width: 0; }

/* ═══════ CONTACT ═══════ */
.contact-zone-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #fff;
  margin-top: 4px;
}

.contact-quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.quick-action-btn {
  flex: 1;
  padding: 10px;
  background: #f0f2f5;
  border-radius: 8px;
  text-decoration: none;
  color: #374151;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.quick-action-btn:hover { background: #e5e7eb; }

/* ═══════ MAPS LINK ═══════ */
.maps-link {
  color: #4f8ef7;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.maps-link:hover { text-decoration: underline; }

/* ═══════ DOCS LIST ═══════ */
.doc-list, .areas-list {
  list-style: none;
  padding: 0;
}
.doc-list li, .areas-list li {
  padding: 4px 0;
  font-size: 13px;
  color: #374151;
}
.doc-list li a { color: #4f8ef7; text-decoration: none; }
.doc-list li a:hover { text-decoration: underline; }

/* ═══════ EMPTY STATE ═══════ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
  font-size: 14px;
  background: #fff;
  border-radius: 10px;
}

/* ═══════ MODAL ═══════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.confirm-box { max-width: 400px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  background: none; border: none;
  font-size: 22px;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
}
.modal-close:hover { color: #1a1a2e; }

.modal-body { padding: 20px; }

/* ═══════ FORMS ═══════ */
.form-group { margin-bottom: 14px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #dde1e7;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border 0.15s;
  background: #fff;
}
.form-control:focus { border-color: #4f8ef7; box-shadow: 0 0 0 3px rgba(79,142,247,0.1); }

textarea.form-control { resize: vertical; }

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f0f2f5;
}

/* ═══════ LOGIN PAGE ═══════ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d5e 100%);
  margin: 0;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo   { font-size: 48px; margin-bottom: 12px; }
.login-title  { font-size: 22px; font-weight: 700; color: #1a1a2e; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: #6b7280; margin-bottom: 32px; }

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  width: 100%;
  cursor: pointer;
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* ═══════ SIDEBAR USER ═══════ */
.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-avatar-initials {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #4f8ef7;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name  { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-link { font-size: 11px; color: rgba(255,255,255,0.5); text-decoration: none; }
.logout-link:hover { color: #fff; }

/* ═══════ SCROLLBAR ═══════ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dde1e7; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b0b8c6; }

/* ═══════ HAMBURGER BUTTON ═══════ */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-right: 12px;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: #1a1a2e;
  border-radius: 2px;
  transition: all 0.2s;
}

/* ═══════ SIDEBAR OVERLAY (mobile) ═══════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ═══════ TABLE SCROLL WRAPPER ═══════ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ═══════ RESPONSIVE – TABLET (≤900px) ═══════ */
@media (max-width: 900px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .split-layout.panel-open { grid-template-columns: 1fr; }
}

/* ═══════ RESPONSIVE – MOBILE (≤768px) ═══════ */
@media (max-width: 768px) {
  /* Sidebar: slide off-screen, toggle with hamburger */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content takes full width */
  .main-wrapper {
    margin-left: 0;
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Show hamburger */
  .hamburger-btn { display: flex; }

  /* Topbar */
  .topbar { padding: 0 14px; }
  .page-title { font-size: 16px; }

  /* Topbar filters wrap below */
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; max-width: 100vw; }
  .topbar-left { flex: 1; display: flex; align-items: center; min-width: 0; }
  .topbar-right { width: 100%; min-width: 0; }
  .topbar-filters { width: 100%; min-width: 0; }
  .filter-form { width: 100%; flex-wrap: wrap; min-width: 0; }
  .search-input { width: 100%; min-width: 0; }
  .filter-select { max-width: 100%; }

  /* Flash container */
  .flash-container { padding: 0 14px; }

  /* Page content */
  .page-content { padding: 14px; overflow-x: hidden; max-width: 100vw; }

  /* Stat cards: 2 columns */
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-cards-3 { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .stat-icon { font-size: 22px; }

  /* Charts: single column */
  .charts-row { grid-template-columns: 1fr; gap: 12px; }
  .chart-container { height: 220px; }

  /* View-tabs: horizontal scroll */
  .view-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 10px;
    scrollbar-width: none;
  }
  .view-tabs::-webkit-scrollbar { display: none; }
  .view-tab { white-space: nowrap; padding: 8px 16px; font-size: 13px; }

  /* Sub-tabs: horizontal scroll */
  .sub-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 8px 10px;
    scrollbar-width: none;
  }
  .sub-tabs::-webkit-scrollbar { display: none; }
  .sub-tab { white-space: nowrap; padding: 7px 14px; font-size: 12px; }

  /* Split layout: panel overlays on mobile */
  .split-layout { grid-template-columns: 1fr !important; }

  .detail-panel {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    z-index: 150;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
  }
  .detail-panel.mobile-open { display: block; }

  /* Let the whole panel scroll as one — disable inner scroll on mobile */
  .detail-panel .detail-content {
    display: block;
    height: auto;
    min-height: 100%;
  }
  .detail-panel .detail-body {
    overflow-y: visible;
    max-height: none;
  }

  /* Back button replaces × on mobile */
  .close-panel-btn {
    position: static;
    width: auto;
    height: auto;
    border-radius: 6px;
    font-size: 0;
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .close-panel-btn::before {
    content: "← Back";
    font-size: 14px;
    font-weight: 600;
    color: #fff;
  }

  /* Reposition header to put back button at top-left */
  .detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 16px;
  }
  .detail-header .close-panel-btn {
    align-self: flex-start;
    margin-bottom: 12px;
  }

  /* Card list: remove max-height restriction on mobile */
  .card-list { max-height: none; padding-right: 0; }

  /* Section card */
  .section-card { padding: 14px; }

  /* Data table: force horizontal scroll */
  .data-table { min-width: 500px; }
  .section-card { overflow-x: auto; }

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

  /* Modal: full width */
  .modal-box { margin: 10px; max-width: calc(100% - 20px); }
  .modal-overlay { padding: 10px; }

  /* Detail label min-width */
  .detail-label { min-width: 90px; }
}

/* ═══════ PREPARE APPOINTMENT ═══════ */
.prepare-appointment-info {
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
}

.info-section {
  margin-bottom: 20px;
}

.info-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #1a1a2e;
  border-bottom: 2px solid #4f8ef7;
  padding-bottom: 10px;
}

.info-row {
  display: flex;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
  align-items: flex-start;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 600;
  color: #555;
  min-width: 150px;
  flex-shrink: 0;
}

.info-value {
  color: #1a1a2e;
  word-break: break-word;
  flex-grow: 1;
  line-height: 1.5;
}

/* ═══════ DOCUMENTS ═══════ */
.detail-documents-section {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #e0e0e0;
}

.documents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f0f4ff;
  border-radius: 6px;
  color: #4f8ef7;
  text-decoration: none;
  border-left: 3px solid #4f8ef7;
  transition: all 0.2s;
  word-break: break-word;
  max-width: 100%;
}

.document-link:hover {
  background: #e8f0ff;
  transform: translateX(2px);
  color: #2563eb;
}

.document-link:visited {
  color: #7c3aed;
}

/* ── Document section (detail panel + edit modal) ── */
.doc-section-inner {
  width: 100%;
}

.doc-type-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.doc-type-row:last-child { border-bottom: none; }

.doc-type-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  padding-top: 0;
}

.doc-type-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.doc-file-link {
  display: inline-block;
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
  padding: 2px 8px;
  background: #eff6ff;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-file-link:hover { background: #dbeafe; }

.doc-none {
  font-size: 12px;
  color: #bbb;
}

/* Upload row inside edit modal */
.doc-upload-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}
.doc-file-input {
  flex: 1;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-width: 0;
}
.btn-sm-upload {
  padding: 4px 10px;
  font-size: 12px;
  background: #4f8ef7;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
.btn-sm-upload:hover { background: #3d7be6; }

[data-theme="dark"] .btn-sm-upload {
  background: #c9a84c;
  color: #1a1a1a;
}
[data-theme="dark"] .btn-sm-upload:hover {
  background: #b89638;
}

.btn-sm-delete {
  padding: 4px 10px;
  font-size: 12px;
  background: #f75f5f;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease;
  margin-left: 6px;
}
.btn-sm-delete:hover { background: #e64d4d; }

[data-theme="dark"] .btn-sm-delete {
  background: #b84040;
  color: #fff;
}
[data-theme="dark"] .btn-sm-delete:hover {
  background: #a83636;
}

.btn-doc-delete {
  font-size: 11px;
  padding: 1px 5px;
  background: none;
  color: #999;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.btn-doc-delete:hover { color: #e53e3e; border-color: #e53e3e; }

[data-theme="dark"] .btn-doc-delete { color: #666; border-color: #444; }
[data-theme="dark"] .btn-doc-delete:hover { color: #f87171; border-color: #f87171; }

.btn-doc-upload {
  font-size: 11px;
  padding: 2px 8px;
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-doc-upload:hover { color: #2563eb; border-color: #2563eb; }

[data-theme="dark"] .btn-doc-upload:hover { color: #7eb3f7; border-color: #7eb3f7; }

/* Upload status messages */
.doc-status { font-size: 11px; margin-top: 3px; padding: 3px 6px; border-radius: 3px; }
.doc-status-loading { background: #eff6ff; color: #2563eb; }
.doc-status-ok      { background: #f0fdf4; color: #16a34a; }
.doc-status-err     { background: #fef2f2; color: #dc2626; }

/* When docs section is inside edit modal, make it scrollable */
.document-upload-section .doc-section-inner {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Document upload/re-upload buttons */
.doc-btn-upload {
  padding: 4px 10px;
  font-size: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}
.doc-btn-upload:hover { background: #1d4ed8; }

.doc-btn-reupload {
  padding: 4px 10px;
  font-size: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  margin-left: 8px;
}
.doc-btn-reupload:hover { background: #1d4ed8; }

/* ─── SETTINGS PAGE ────────────────────────────────────────────────────── */
.settings-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.settings-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  margin-top: 0;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background-color: var(--bg-secondary);
  border-radius: 6px;
  gap: 20px;
}

.settings-label-group {
  flex: 1;
}

.settings-label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* Theme toggle buttons */
.theme-toggle-wrapper {
  display: flex;
  gap: 12px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background-color: var(--input-bg);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.theme-option:hover {
  border-color: var(--button-primary-bg);
  background-color: var(--bg-primary);
}

.theme-option.active {
  background-color: var(--button-primary-bg);
  border-color: var(--button-primary-bg);
  color: var(--button-primary-text);
}

.theme-icon {
  font-size: 20px;
}

.theme-name {
  font-size: 12px;
}

/* Version badge */
.version-badge {
  display: inline-block;
  background-color: var(--button-primary-bg);
  color: var(--button-primary-text);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .settings-container {
    padding: 10px;
  }

  .settings-card {
    padding: 16px;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .theme-toggle-wrapper {
    width: 100%;
  }

  .theme-option {
    flex: 1;
  }
}


/* ═══════════════════════════════════════════════════
   DARK MODE – Dark Grey & Gold
   ═══════════════════════════════════════════════════ */

[data-theme="dark"] body {
  background: #242424;
  color: #e8e8e8;
}

/* ── Topbar ── */
[data-theme="dark"] .topbar {
  background: #2e2e2e;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
[data-theme="dark"] .page-title { color: #e8e8e8; }

/* ── Sidebar ── */
[data-theme="dark"] .sidebar {
  background: #1a1a1a;
  box-shadow: 2px 0 8px rgba(0,0,0,0.5);
}
[data-theme="dark"] .sidebar-header { border-color: rgba(255,255,255,0.07); }
[data-theme="dark"] .nav-link { color: rgba(232,232,232,0.7); }
[data-theme="dark"] .nav-link:hover { background: rgba(201,168,76,0.12); color: #c9a84c; }
[data-theme="dark"] .nav-item.active .nav-link { background: #c9a84c; color: #1a1a1a; }
[data-theme="dark"] .sidebar-user { border-color: rgba(255,255,255,0.07); }
[data-theme="dark"] .user-name { color: #e8e8e8; }
[data-theme="dark"] .logout-link { color: rgba(232,232,232,0.45); }
[data-theme="dark"] .logout-link:hover { color: #c9a84c; }

/* ── Stat Cards ── */
[data-theme="dark"] .stat-card {
  background: #2e2e2e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .stat-label { color: #a0a0a0; }
[data-theme="dark"] .stat-blue   { border-left-color: #c9a84c; }
[data-theme="dark"] .stat-orange { border-left-color: #c9a84c; }
[data-theme="dark"] .stat-green  { border-left-color: #c9a84c; }
[data-theme="dark"] .stat-red    { border-left-color: #c9a84c; }

/* ── Charts ── */
[data-theme="dark"] .chart-card {
  background: #2e2e2e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Section / Data Table ── */
[data-theme="dark"] .section-card {
  background: #2e2e2e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .data-table th {
  background: #3a3a3a;
  border-color: #444;
  color: #c9a84c;
}
[data-theme="dark"] .data-table td {
  border-color: #383838;
  color: #e8e8e8;
}
[data-theme="dark"] .data-table tr:hover td { background: #363636; }
[data-theme="dark"] .empty-row { color: #666; }

/* ── Tabs ── */
[data-theme="dark"] .view-tabs {
  background: #2e2e2e;
  border-color: #3a3a3a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
[data-theme="dark"] .view-tab { color: #a0a0a0; }
[data-theme="dark"] .view-tab:hover { background: #3a3a3a; color: #e8e8e8; }
[data-theme="dark"] .view-tab.active { background: #c9a84c; color: #1a1a1a; }

[data-theme="dark"] .sub-tabs {
  background: #2e2e2e;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
[data-theme="dark"] .sub-tab { color: #a0a0a0; }
[data-theme="dark"] .sub-tab:hover { background: #3a3a3a; color: #e8e8e8; }
[data-theme="dark"] .sub-tab.active { background: #c9a84c; color: #1a1a1a; }

/* ── Card List ── */
[data-theme="dark"] .list-card {
  background: #2e2e2e;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  border-color: transparent;
}
[data-theme="dark"] .list-card:hover {
  border-color: rgba(201,168,76,0.4);
  box-shadow: 0 4px 12px rgba(201,168,76,0.1);
}
[data-theme="dark"] .list-card.selected {
  border-color: #c9a84c;
  box-shadow: 0 4px 12px rgba(201,168,76,0.2);
}
[data-theme="dark"] .card-name { color: #e8e8e8; }
[data-theme="dark"] .card-subname { color: #a0a0a0; }
[data-theme="dark"] .card-meta { color: #a0a0a0; }
[data-theme="dark"] .card-name.green { color: #4fd4a0; }
[data-theme="dark"] .card-name.red   { color: #f47c7c; }

/* ── Status Pills ── */
[data-theme="dark"] .status-green  { background: rgba(45,200,138,0.15); color: #4fd4a0; }
[data-theme="dark"] .status-red    { background: rgba(247,95,95,0.15);  color: #f47c7c; }
[data-theme="dark"] .status-yellow { background: rgba(201,168,76,0.15); color: #c9a84c; }
[data-theme="dark"] .status-blue   { background: rgba(79,142,247,0.15); color: #7fb3f5; }
[data-theme="dark"] .status-gray   { background: rgba(156,163,175,0.15); color: #a0a0a0; }
[data-theme="dark"] .status-orange { background: rgba(247,148,79,0.15); color: #f7a96a; }
[data-theme="dark"] .status-purple { background: rgba(167,139,250,0.15); color: #c4aff5; }

/* ── Detail Panel ── */
[data-theme="dark"] .detail-panel {
  background: #2e2e2e;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
[data-theme="dark"] .detail-placeholder { color: #666; }
[data-theme="dark"] .detail-loading { color: #666; }
[data-theme="dark"] .detail-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2211 100%);
}
[data-theme="dark"] .detail-section { border-color: #3a3a3a; }
[data-theme="dark"] .detail-section-title { color: #c9a84c; }
[data-theme="dark"] .detail-label { color: #c9a84c; }
[data-theme="dark"] .detail-value { color: #e8e8e8; }
[data-theme="dark"] .detail-value a { color: #c9a84c; }
[data-theme="dark"] .detail-notes { color: #c0c0c0; }
[data-theme="dark"] .detail-actions {
  border-color: #3a3a3a;
  background: #272727;
}

/* ── Clickable values ── */
[data-theme="dark"] .clickable-value:hover {
  background-color: rgba(201,168,76,0.12);
  color: #c9a84c;
}

/* ── Buttons ── */
[data-theme="dark"] .btn-primary   { background: #c9a84c; color: #1a1a1a; }
[data-theme="dark"] .btn-secondary { background: #3a3a3a; color: #e8e8e8; }
[data-theme="dark"] .btn-danger    { background: #b84040; color: #fff; }
[data-theme="dark"] .btn-warning   { background: #a8860a; color: #e8e8e8; }
[data-theme="dark"] .btn-green     { background: #2a8a5e; color: #fff; }
[data-theme="dark"] .btn-orange    { background: #b8742e; color: #fff; }
[data-theme="dark"] .btn-info      { background: #c9a84c; color: #1a1a1a; }

/* ── Photo / Initials ── */
[data-theme="dark"] .photo-avatar { background: #3a3a3a; }
[data-theme="dark"] .initials-avatar { background: #c9a84c; color: #1a1a1a; }

/* ── Contact quick actions ── */
[data-theme="dark"] .quick-action-btn { background: #3a3a3a; color: #e8e8e8; }
[data-theme="dark"] .quick-action-btn:hover { background: #444; }

/* ── Docs / Areas list ── */
[data-theme="dark"] .doc-list li,
[data-theme="dark"] .areas-list li { color: #c0c0c0; }
[data-theme="dark"] .doc-list li a { color: #c9a84c; }

/* ── Empty state ── */
[data-theme="dark"] .empty-state { background: #2e2e2e; color: #666; }

/* ── Modal ── */
[data-theme="dark"] .modal-box { background: #2e2e2e; }
[data-theme="dark"] .confirm-box { background: #2e2e2e; }
[data-theme="dark"] .modal-header { border-color: #3a3a3a; }
[data-theme="dark"] .modal-title { color: #e8e8e8; }
[data-theme="dark"] .modal-close { color: #a0a0a0; }
[data-theme="dark"] .modal-close:hover { color: #e8e8e8; }

/* ── Forms ── */
[data-theme="dark"] .form-group label { color: #c9a84c; }
[data-theme="dark"] .form-control {
  background: #3a3a3a;
  border-color: #4a4a4a;
  color: #e8e8e8;
  color-scheme: dark;
}
[data-theme="dark"] .form-control:focus {
  border-color: #c9a84c;
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}
[data-theme="dark"] .form-actions { border-color: #3a3a3a; }

/* ── Search / Filter inputs ── */
[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select {
  background: #3a3a3a;
  border-color: #4a4a4a;
  color: #e8e8e8;
}
[data-theme="dark"] .search-input:focus,
[data-theme="dark"] .filter-select:focus { border-color: #c9a84c; }

/* ── Flash messages ── */
[data-theme="dark"] .flash-success { background: #2a3a2a; color: #4fd4a0; border-color: #3a6a3a; }
[data-theme="dark"] .flash-error   { background: #3a2a2a; color: #f47c7c; border-color: #6a3a3a; }

/* ── Settings page ── */
[data-theme="dark"] .settings-card {
  background: #2e2e2e;
  border-color: #3a3a3a;
}
[data-theme="dark"] .settings-title { color: #e8e8e8; }
[data-theme="dark"] .settings-row { background: #272727; }
[data-theme="dark"] .settings-label { color: #e8e8e8; }
[data-theme="dark"] .settings-description { color: #a0a0a0; }
[data-theme="dark"] .theme-option {
  background: #3a3a3a;
  border-color: #4a4a4a;
  color: #e8e8e8;
}
[data-theme="dark"] .theme-option:hover { border-color: #c9a84c; }
[data-theme="dark"] .theme-option.active { background: #c9a84c; border-color: #c9a84c; color: #1a1a1a; }
[data-theme="dark"] .version-badge { background: #c9a84c; color: #1a1a1a; }

/* ── Users / Manage pages ── */
[data-theme="dark"] table { color: #e8e8e8; }
[data-theme="dark"] .section-card table th { color: #c9a84c; }

/* ── Calendar ── */
[data-theme="dark"] .calendar-grid { background: #2e2e2e; }
[data-theme="dark"] .cal-day { background: #272727; border-color: #3a3a3a; color: #a0a0a0; }
[data-theme="dark"] .cal-day.has-cita { background: #2a2416; border-color: #c9a84c; }
[data-theme="dark"] .cal-day.today { border-color: #c9a84c; color: #c9a84c; }

/* ── Document sections ── */
[data-theme="dark"] .doc-type-row { border-color: #3a3a3a; }
[data-theme="dark"] .doc-type-label { color: var(--text-primary); }
[data-theme="dark"] .doc-file-link { background: #2a3450; border-color: #3a4a6a; color: #7eb3f7; }
[data-theme="dark"] .doc-file-link:hover { background: #334266; }
[data-theme="dark"] .doc-none { color: #555; }
[data-theme="dark"] .doc-file-input { background: #3a3a3a; border-color: #4a4a4a; color: #e8e8e8; }

/* ── Yes/No Toggle Boxes ── */
.yes-no-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
}

.yes-no-toggle .toggle-box {
  padding: 8px 16px;
  border: 2px solid #dde1e7;
  border-radius: 6px;
  background: #ffffff;
  color: #666666;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  flex: 1;
  text-align: center;
  user-select: none;
}

.yes-no-toggle .toggle-box:hover {
  border-color: #4f8ef7;
  background: #f0f5ff;
}

.yes-no-toggle .toggle-box.selected {
  background: #4f8ef7;
  color: #ffffff;
  border-color: #4f8ef7;
}

[data-theme="dark"] .yes-no-toggle .toggle-box {
  background: #3a3a3a;
  border-color: #4a4a4a;
  color: #b0b0b0;
}

[data-theme="dark"] .yes-no-toggle .toggle-box:hover {
  border-color: #d4a574;
  background: #3a3a2a;
}

[data-theme="dark"] .yes-no-toggle .toggle-box.selected {
  background: #d4a574;
  color: #1a1a1a;
  border-color: #d4a574;
}

/* ─── AREA TAGS (Email-style selector) ──────────────────────────────────── */
.area-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #4f8ef7;
  color: white;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.area-tag-remove {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  margin-left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.area-tag-remove:hover {
  opacity: 0.8;
}

[data-theme="dark"] .area-tag {
  background: #d4a574;
  color: #1a1a1a;
}

/* Area badges for piso cards */
.area-badge {
  display: inline-block;
  padding: 6px 12px;
  background: #4f8ef7;
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

[data-theme="dark"] .area-badge {
  background: #c9a84c;
  color: #1a1a1a;
}

/* ─── SEARCHABLE DROPDOWN ──────────────────────────────────────────────── */
.searchable-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #dde1e7;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.searchable-dropdown-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.15s ease;
}

.searchable-dropdown-item:hover {
  background-color: #f0f2f5;
}

.searchable-dropdown-item:last-child {
  border-bottom: none;
}

[data-theme="dark"] .searchable-dropdown {
  background: #3a3a3a;
  border-color: #4a4a4a;
}

[data-theme="dark"] .searchable-dropdown-item {
  border-bottom-color: #4a4a4a;
}

[data-theme="dark"] .searchable-dropdown-item:hover {
  background-color: #4a4a4a;
}

/* ─── MANAGEMENT VIEW (Zones & Areas) ──────────────────────────────────── */
.management-section {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
}

.management-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.management-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.management-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.management-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.management-item:hover {
  border-color: var(--button-primary-bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.management-item-content {
  flex: 1;
}

.management-item-name {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.management-item-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.management-item-actions {
  display: flex;
  gap: 10px;
  margin-left: 16px;
}

.management-action-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: capitalize;
}

.management-action-btn.edit {
  background: #4f8ef7;
  color: white;
}

.management-action-btn.edit:hover {
  background: #3a73d1;
  box-shadow: 0 2px 4px rgba(79, 142, 247, 0.3);
}

.management-action-btn.delete {
  background: #dc3545;
  color: white;
}

.management-action-btn.delete:hover {
  background: #c82333;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.management-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

[data-theme="dark"] .management-section {
  background: var(--card-bg);
  border-color: #3a3a3a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .management-header {
  border-bottom-color: #3a3a3a;
}

[data-theme="dark"] .management-item {
  background: #3a3a3a;
  border-color: #4a4a4a;
}

[data-theme="dark"] .management-item:hover {
  border-color: #d4a574;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .management-action-btn.edit {
  background: #5a7fa8;
}

[data-theme="dark"] .management-action-btn.edit:hover {
  background: #4a6f98;
  box-shadow: 0 2px 4px rgba(212, 165, 116, 0.2);
}

[data-theme="dark"] .management-action-btn.delete {
  background: #8b3a3a;
}

[data-theme="dark"] .management-action-btn.delete:hover {
  background: #7a2a2a;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

/* ─── INLINE DOCUMENT DELETE BUTTON ───────────────────── */
.btn-icon-delete {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-icon-delete:hover {
  background: #c82333;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

[data-theme="dark"] .btn-icon-delete {
  background: #8b3a3a;
}

[data-theme="dark"] .btn-icon-delete:hover {
  background: #7a2a2a;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

/* ═══════ CALENDAR VIEW ═══════ */
.calendar-view {
  padding: 20px;
  background: var(--card-bg);
  border-radius: 8px;
  width: 100%;
  overflow-y: auto;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
}

.calendar-title {
  margin: 0;
  font-size: 18px;
  flex: 1;
  text-align: center;
  color: var(--text-primary);
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.calendar-header-row {
  background: #4f8ef7;
  color: white;
}

.calendar-header-cell {
  padding: 12px;
  border: 1px solid var(--border-color);
  font-weight: 600;
  text-align: center;
}

.calendar-table td {
  padding: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 120px;
  vertical-align: top;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow-y: auto;
}

.calendar-table td:hover {
  background: var(--bg-secondary);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
}

.calendar-table td.today {
  background: linear-gradient(rgba(79, 142, 247, 0.1), rgba(79, 142, 247, 0.1)), var(--bg-primary);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--button-primary-bg), inset 0 0 12px rgba(79, 142, 247, 0.15);
  border-radius: 4px;
}

.calendar-table td.today:hover {
  box-shadow: inset 0 0 0 2px var(--button-primary-bg), inset 0 0 12px rgba(79, 142, 247, 0.25);
}

.calendar-table td.has-citas {
  border: 2px solid #4f8ef7;
}

.calendar-table td.has-citas.today {
  border: 2px solid rgba(255,255,255,0.5);
}

[data-theme="dark"] .calendar-table td.today {
  background: linear-gradient(rgba(212, 165, 116, 0.15), rgba(212, 165, 116, 0.15)), var(--bg-primary);
  box-shadow: inset 0 0 0 2px #d4a574, inset 0 0 12px rgba(212, 165, 116, 0.2);
}

[data-theme="dark"] .calendar-table td.today:hover {
  box-shadow: inset 0 0 0 2px #d4a574, inset 0 0 12px rgba(212, 165, 116, 0.3);
}

.calendar-table .other-month {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

/* Dark mode calendar */
[data-theme="dark"] .calendar-header-row {
  background: #4f8ef7;
  color: white;
}
