/* ==========================================================================
   RESTOMAP - COMPLETE STYLESHEET (ALL-IN-ONE ROBUST & RESPONSIVE)
   ========================================================================== */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Primary Theme Colors */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #6366f1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.15);

  /* Status Colors */
  --status-yellow: #f59e0b;
  --status-yellow-bg: #fef3c7;
  --status-yellow-text: #b45309;

  --status-green: #10b981;
  --status-green-bg: #d1fae5;
  --status-green-text: #047857;

  --status-red: #ef4444;
  --status-red-bg: #fee2e2;
  --status-red-text: #b91c1c;

  --status-blue: #3b82f6;
  --status-blue-bg: #dbeafe;
  --status-blue-text: #1d4ed8;

  --status-client: #ec4899;
  --status-client-bg: #fce7f3;
  --status-client-text: #be185d;

  --status-former-client: #64748b;
  --status-former-client-bg: #f1f5f9;
  --status-former-client-text: #334155;

  --status-purple: #8b5cf6;
  --status-purple-bg: #ede9fe;
  --status-purple-text: #6d28d9;

  /* Dimensions & Radius */
  --header-height: 68px;
  --sidebar-width: 440px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Elevation Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 32px -6px rgba(0, 0, 0, 0.18), 0 8px 16px -4px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* ==========================================================================
   TOP NAVBAR
   ========================================================================== */
.top-navbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 175px;
  user-select: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-text h1 span {
  color: var(--primary);
}

.badge-beta {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  display: inline-block;
}

/* VIEW NAVIGATION TABS */
.view-nav-tabs {
  display: inline-flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-full);
  gap: 4px;
  border: 1px solid var(--border-color);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.nav-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.nav-counter-badge {
  background: #e2e8f0;
  color: #475569;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-tab.active .nav-counter-badge {
  background: var(--primary-light);
  color: var(--primary);
}

/* SEARCH BAR */
.search-container {
  flex: 1;
  max-width: 500px;
  position: relative;
}

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

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.search-container input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 40px;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.search-container input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-icon-clear {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
}

.btn-icon-clear:hover {
  color: var(--text-primary);
}

.spinner {
  position: absolute;
  right: 14px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* SEARCH DROPDOWN */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 1100;
}

.search-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

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

.search-item:hover {
  background: #f8fafc;
}

.search-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.search-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.search-item-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.search-item-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  margin-top: 4px;
}

/* HEADER ACTIONS */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.btn-warning-soft {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.btn-warning-soft:hover {
  background: #fde68a;
  color: #92400e;
}

.btn-danger {
  background: var(--status-red);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #f8fafc;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-sm:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.btn-icon-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.btn-icon-close:hover {
  color: var(--text-primary);
  background: #f1f5f9;
}

.counter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  border: 2px solid #ffffff;
  min-width: 18px;
  text-align: center;
}

.badge-amber {
  background: #f59e0b;
}

.badge-pulse-red {
  background: #ef4444;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

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

.dot-yellow { background: var(--status-yellow); }
.dot-green { background: var(--status-green); }
.dot-red { background: var(--status-red); }
.dot-blue { background: var(--status-blue); }
.dot-client { background: var(--status-client); }
.dot-former-client { background: var(--status-former-client); }
.dot-purple { background: var(--status-purple); }

/* ALERTS DROPDOWN */
.alerts-dropdown-wrapper {
  position: relative;
}

.alerts-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1200;
  overflow: hidden;
}

.alerts-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.alerts-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alerts-header-title h4 {
  font-size: 0.92rem;
  font-weight: 700;
}

.alerts-header-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.alerts-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.alert-item-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.alert-item-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.alert-item-card.is-overdue {
  border-left: 4px solid var(--status-red);
  background: #fffafa;
}

.alert-item-card.is-today {
  border-left: 4px solid var(--status-yellow);
  background: #fffdf5;
}

.alert-item-card.is-upcoming {
  border-left: 4px solid var(--status-blue);
}

.alert-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.alert-item-time {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.alert-item-contact {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.alert-item-resto {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.alert-item-comment {
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-top: 6px;
  background: rgba(0,0,0,0.03);
  padding: 4px 8px;
  border-radius: 4px;
}

/* ==========================================================================
   MAIN CONTENT (MAP VIEW + SIDEBAR)
   ========================================================================== */
.main-content {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height));
  position: relative;
  overflow: hidden;
}

.map-wrapper {
  flex: 1;
  height: 100%;
  position: relative;
}

#mapContainer {
  width: 100%;
  height: 100%;
}

/* FLOATING MAP CONTROLS */
.map-floating-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.map-ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-ctrl-btn:hover {
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* GOOGLE MAPS INFOWINDOW STYLING */
.gm-style-iw-c {
  padding: 12px 14px 10px 14px !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22) !important;
  border: 1px solid var(--border-color) !important;
  max-width: 320px !important;
}

.gm-style-iw-d {
  overflow: auto !important;
  max-height: 280px !important;
}

/* InfoWindow Close Button: clean round button with clear contrast */
.gm-ui-hover-effect {
  top: 4px !important;
  right: 4px !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: #f1f5f9 !important;
  opacity: 0.9 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--border-color) !important;
  z-index: 10 !important;
}

.gm-ui-hover-effect:hover {
  background: #e2e8f0 !important;
  opacity: 1 !important;
}

.gm-ui-hover-effect > span {
  margin: 0 !important;
}

/* MAP LEGEND */
.map-legend {
  position: absolute;
  bottom: 24px;
  left: 20px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 100;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-hint {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
}

/* API PROMPT OVERLAY */
.api-prompt-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.api-prompt-card {
  max-width: 520px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.api-prompt-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.api-prompt-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.api-prompt-card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.api-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.api-input-group input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
}

.api-input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-guide-link {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-guide-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
}

.sidebar.closed {
  transform: translateX(100%);
  position: absolute;
  right: 0;
}

.sidebar-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-title-row h2 {
  font-size: 1.1rem;
  font-weight: 800;
}

.tag-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.filter-pill {
  border: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background: #e2e8f0;
}

.filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.filter-pill.pill-yellow.active { background: var(--status-yellow); border-color: var(--status-yellow); }
.filter-pill.pill-green.active { background: var(--status-green); border-color: var(--status-green); }
.filter-pill.pill-client.active { background: var(--status-client); border-color: var(--status-client); }
.filter-pill.pill-former-client.active { background: var(--status-former-client); border-color: var(--status-former-client); }
.filter-pill.pill-red.active { background: var(--status-red); border-color: var(--status-red); }
.filter-pill.pill-blue.active { background: var(--status-blue); border-color: var(--status-blue); }

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sidebar-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  background: #f8fafc;
}

.sidebar-search input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
}

.restaurants-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}

/* RESTAURANT CARD */
.resto-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
}

.resto-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.resto-card.active {
  border-color: var(--primary);
  background: #fafaff;
  box-shadow: 0 0 0 2px var(--primary-glow), var(--shadow-md);
}

.resto-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.resto-card-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.resto-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  width: fit-content;
  margin-top: 2px;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.status-badge-to_contact { background: var(--status-yellow-bg); color: var(--status-yellow-text); }
.status-badge-done { background: var(--status-green-bg); color: var(--status-green-text); }
.status-badge-client { background: var(--status-client-bg); color: var(--status-client-text); }
.status-badge-former_client { background: var(--status-former-client-bg); color: var(--status-former-client-text); }
.status-badge-priority { background: var(--status-red-bg); color: var(--status-red-text); }
.status-badge-in_progress { background: var(--status-blue-bg); color: var(--status-blue-text); }
.status-badge-custom { background: var(--status-purple-bg); color: var(--status-purple-text); }

.resto-card-address {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.resto-card-contacts-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.resto-contact-chip {
  font-size: 0.74rem;
  background: #f1f5f9;
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.resto-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.resto-actions-left {
  display: flex;
  gap: 6px;
}

.btn-card-action {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-card-action:hover {
  background: #ffffff;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-link {
  background: transparent;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

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

.text-danger {
  color: var(--status-red) !important;
}

.text-warning {
  color: var(--status-yellow) !important;
}

/* ==========================================================================
   CONTACTS VIEW (GENERAL DIRECTORY)
   ========================================================================== */
.contacts-view {
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: var(--bg-main);
  padding: 24px 32px 60px;
}

.contacts-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* HERO BAR */
.contacts-hero-bar {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  gap: 20px;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.hero-title-row h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.hero-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 700px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* CONTACTS TOOLBAR */
.contacts-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.contacts-search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.contacts-search-box i {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: 1rem;
}

.contacts-search-box input {
  width: 100%;
  height: 46px;
  padding: 0 44px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.contacts-search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.filter-select-container {
  position: relative;
  min-width: 250px;
}

.filter-select-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.filter-select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.contact-filter-select {
  width: 100%;
  height: 46px;
  padding: 0 36px 0 38px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  appearance: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.contact-filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* CONTACTS GRID */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

/* CONTACT CARD */
.contact-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.contact-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.contact-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #818cf8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.contact-title-group {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.contact-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.role-chef_exec { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.role-chef { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.role-sous_chef { background: #ccfbf1; color: #115e59; border: 1px solid #99f6e4; }
.role-owner { background: #fce7f3; color: #9d174d; border: 1px solid #fbcfe8; }
.role-manager { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.role-sommelier { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.role-other { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* CONTACT CARD DETAILS */
.contact-comms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid #f1f5f9;
}

.contact-comm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.comm-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.comm-value {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
}

.comm-value:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* CONTACT CARD ESTABLISHMENTS */
.contact-etabs-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.etab-group-title {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.etab-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.etab-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.etab-item-name {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.resto-group-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.resto-group-tag.archived {
  color: #64748b;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.optional-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.etab-item-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.etab-item-archived {
  background: #f8fafc;
  border-style: dashed;
  color: var(--text-secondary);
}

/* CONTACT ALERT BANNER */
.contact-alert-strip {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.contact-alert-strip.is-overdue {
  background: #fef2f2;
  border-color: #fecaca;
  border-left-color: #ef4444;
}

.contact-alert-strip.is-today {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: #f59e0b;
}

.contact-alert-strip.is-upcoming {
  background: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #3b82f6;
}

.alert-strip-content {
  flex: 1;
}

.alert-strip-title {
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-strip-comment {
  margin-top: 2px;
  color: var(--text-secondary);
}

/* CONTACT CARD ACTIONS */
.contact-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

/* EMPTY STATE */
.contacts-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1.5px dashed var(--border-color);
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.contacts-empty-state h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.contacts-empty-state p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ==========================================================================
   MODALS (COMMON & SPECIFIC)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-lg {
  max-width: 800px;
}

.modal-xl {
  max-width: 1100px;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  flex-shrink: 0;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-color-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--status-yellow);
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
}

.modal-subtitle-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  flex-shrink: 0;
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-row {
  display: flex;
  gap: 14px;
}

.col-half {
  flex: 1;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.form-group input,
.form-group select,
.form-group textarea,
.input-with-icon input,
.input-with-icon select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-primary);
  background: #ffffff;
  transition: all 0.15s ease;
}

.input-with-icon input,
.input-with-icon select {
  padding-left: 36px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-help-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   STATUS PILLS SELECTOR (MODAL) - ULTRA CLEAN, MODERN & SYMMETRICAL
   ========================================================================== */
.status-selection-group {
  margin-bottom: 18px;
}

.form-section-mini-title {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.status-pills-selector {
  display: flex;
  gap: 8px;
  width: 100%;
}

.status-pill-opt {
  flex: 1;
  display: block;
  cursor: pointer;
  user-select: none;
}

.status-pill-opt input {
  display: none;
}

.status-pill-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 8px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
}

.status-pill-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: var(--text-primary);
  transform: translateY(-1px);
}

.status-pill-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Checked States - Vibrant colored fills with smooth subtle rings */
.status-pill-opt input:checked + .status-pill-btn.pill-yellow {
  border-color: var(--status-yellow);
  background: #fef3c7;
  color: #92400e;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22), 0 2px 6px rgba(245, 158, 11, 0.12);
}

.status-pill-opt input:checked + .status-pill-btn.pill-green {
  border-color: var(--status-green);
  background: #d1fae5;
  color: #065f46;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22), 0 2px 6px rgba(16, 185, 129, 0.12);
}

.status-pill-opt input:checked + .status-pill-btn.pill-client {
  border-color: var(--status-client);
  background: #fce7f3;
  color: #9d174d;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.22), 0 2px 6px rgba(236, 72, 153, 0.12);
}

.status-pill-opt input:checked + .status-pill-btn.pill-former-client {
  border-color: var(--status-former-client);
  background: #f1f5f9;
  color: #334155;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.22), 0 2px 6px rgba(100, 116, 139, 0.12);
}

.status-pill-opt input:checked + .status-pill-btn.pill-red {
  border-color: var(--status-red);
  background: #fee2e2;
  color: #991b1b;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22), 0 2px 6px rgba(239, 68, 68, 0.12);
}

.status-pill-opt input:checked + .status-pill-btn.pill-blue {
  border-color: var(--status-blue);
  background: #dbeafe;
  color: #1e40af;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22), 0 2px 6px rgba(59, 130, 246, 0.12);
}

@media (max-width: 600px) {
  .status-pills-selector {
    flex-wrap: wrap;
  }
  .status-pill-opt {
    flex: 1 1 calc(50% - 4px);
  }
}

.modal-color-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--status-yellow);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.status-name {
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 4px;
}

.status-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* MODAL ACTIONS */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.right-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* CONTACTS SECTION TITLE & INLINE ADD BUTTON */
.contacts-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.contacts-title-with-btn {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contacts-title-with-btn h4 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-add-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
}

.btn-icon-add-inline:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.35);
}

/* SUBFORM CONTACT BOX */
.contact-form-box {
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.contact-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.contact-form-header h5 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.contact-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.contact-alert-subbox {
  background: #ffffff;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 10px;
}

.alert-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.alert-toggle-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* RESTO CONTACT ITEM */
.resto-contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.resto-contact-item.is-archived {
  background: #f8fafc;
  opacity: 0.85;
}

.btn-toggle-archived {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  margin: 12px 0 8px;
}

/* ==========================================================================
   CALENDAR MODAL SPECIFIC STYLES
   ========================================================================== */
.calendar-modal-card {
  height: 85vh;
}

.calendar-modal-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: #fef3c7;
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.calendar-modal-body {
  padding: 18px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.calendar-month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-current-month {
  font-size: 1.15rem;
  font-weight: 800;
  min-width: 180px;
  text-align: center;
}

.calendar-filter-pills {
  display: flex;
  gap: 8px;
}

.cal-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cal-filter-pill:hover {
  background: #f8fafc;
}

.cal-filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.cal-filter-pill.pill-overdue.active { background: var(--status-red); border-color: var(--status-red); }
.cal-filter-pill.pill-today.active { background: var(--status-yellow); border-color: var(--status-yellow); }
.cal-filter-pill.pill-upcoming.active { background: var(--status-blue); border-color: var(--status-blue); }

.pill-badge {
  background: rgba(0,0,0,0.08);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

.cal-filter-pill.active .pill-badge {
  background: rgba(255,255,255,0.25);
  color: #ffffff;
}

/* CALENDAR SPLIT CONTAINER */
.calendar-split-container {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 420px;
}

.calendar-grid-wrapper {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.calendar-weekdays-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 6px;
  flex: 1;
}

.cal-day-cell {
  background: #f8fafc;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  min-height: 58px;
  transition: all 0.15s ease;
}

.cal-day-cell:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-xs);
}

.cal-day-cell.is-other-month {
  opacity: 0.35;
}

.cal-day-cell.is-today {
  border-color: var(--primary);
  background: #fafaff;
}

.cal-day-cell.is-selected {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.cal-day-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cal-day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}

.cal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.cal-dot.dot-overdue { background: var(--status-red); }
.cal-dot.dot-today { background: var(--status-yellow); }
.cal-dot.dot-upcoming { background: var(--status-blue); }

.calendar-agenda-wrapper {
  flex: 0.9;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.agenda-header h5 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.calendar-agenda-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-card {
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: all 0.15s ease;
}

.agenda-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.agenda-card.is-overdue { border-left: 4px solid var(--status-red); }
.agenda-card.is-today { border-left: 4px solid var(--status-yellow); }
.agenda-card.is-upcoming { border-left: 4px solid var(--status-blue); }

.agenda-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.agenda-time-badge {
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.agenda-card-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
}

.agenda-card-resto {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.agenda-card-comment {
  font-size: 0.82rem;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.agenda-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.calendar-legend {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  font-weight: 600;
}

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

/* CONTACT DETAIL MODAL SPECIFIC */
.contact-modal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
}

.contact-etabs-block {
  margin-top: 16px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

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

.etabs-block-header h5 {
  font-size: 0.88rem;
  font-weight: 800;
}

.etabs-hint {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

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

.contact-assign-block {
  margin-top: 16px;
  background: #ffffff;
  border: 1.5px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.assign-block-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.assign-inputs-row {
  display: flex;
  gap: 10px;
}

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3000;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success { border-left: 4px solid var(--status-green); }
.toast.toast-error { border-left: 4px solid var(--status-red); }
.toast.toast-info { border-left: 4px solid var(--status-blue); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* UTILITIES */
.hidden {
  display: none !important;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE STYLES (STRICTLY FOR MOBILE / TABLET / LANDSCAPE)
   DESKTOP (screens > 1024px with height > 600px) REMAINS 100% UNTOUCHED
   ========================================================================== */
.mobile-only {
  display: none !important;
}

@media (max-width: 1024px), (max-height: 600px) {
  .mobile-only {
    display: inline-flex !important;
  }

  body {
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

  .app-container {
    height: auto;
    min-height: 100vh;
  }

  /* TOP NAVBAR ON MOBILE / COMPACT */
  .top-navbar {
    height: auto;
    padding: 8px 12px 10px;
    flex-wrap: wrap;
    gap: 8px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
  }

  .brand {
    min-width: auto;
    gap: 8px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
  }

  .brand-text h1 {
    font-size: 1.05rem;
  }

  .badge-beta {
    display: none;
  }

  /* Compact Navbar Actions: icons only on mobile */
  .header-actions {
    margin-left: auto;
    gap: 6px;
  }

  .header-actions .btn {
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
  }

  .header-actions .btn span {
    display: none;
  }

  .header-actions .btn-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
  }

  /* View Navigation Switcher */
  .view-nav-tabs {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
    padding: 3px;
    background: #f1f5f9;
  }

  .nav-tab {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 0.78rem;
    gap: 6px;
  }

  /* Search Bar */
  .search-container {
    order: 4;
    width: 100%;
    max-width: 100%;
    margin-top: 2px;
  }

  .search-container input {
    height: 36px;
    font-size: 0.82rem;
  }

  .alerts-dropdown {
    position: fixed;
    top: 54px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: calc(100vw - 20px);
    max-height: 80vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
    z-index: 2500;
  }

  .alerts-list {
    max-height: calc(80vh - 100px);
    overflow-y: auto;
  }

  /* MAIN WRAPPER (MAP + SIDEBAR) */
  .main-content {
    height: calc(100vh - 150px);
    min-height: 350px;
    position: relative;
    width: 100%;
  }

  .map-wrapper {
    width: 100%;
    height: 100%;
  }

  .map-floating-controls {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

  .map-ctrl-btn {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }

  .map-legend {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 0.68rem;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-sm);
  }

  .legend-hint {
    display: none;
  }

  /* SIDEBAR: Slide-over Drawer on Mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    z-index: 1500;
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
    background: #ffffff;
    margin-left: auto;
  }

  .sidebar.closed {
    transform: translateX(100%);
    position: fixed;
  }

  .sidebar-header {
    padding: 12px 16px 10px;
  }

  .filter-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .filter-pill {
    flex-shrink: 0;
  }

  .sidebar-footer {
    padding: 10px 12px;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 8px;
  }

  /* CONTACTS VIEW ON MOBILE */
  .contacts-view {
    height: calc(100vh - 150px);
    padding: 12px 10px 60px;
  }

  .contacts-hero-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
    gap: 12px;
    border-radius: var(--radius-lg);
  }

  .hero-title-row h2 {
    font-size: 1.1rem;
  }

  .hero-subtitle {
    font-size: 0.78rem;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .contacts-toolbar {
    flex-direction: column;
    gap: 10px;
  }

  .filter-select-container {
    width: 100%;
    min-width: 100%;
  }

  .contacts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .contact-card {
    padding: 12px;
    border-radius: var(--radius-md);
  }

  /* MODALS ON MOBILE */
  .modal-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100%;
    height: 100dvh;
    padding: 12px 10px;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }

  .modal-card {
    max-width: 100%;
    width: 100%;
    max-height: 80dvh;
    max-height: 80vh;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  }

  .modal-header {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    border-bottom: 1.5px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .btn-icon-close {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #1e293b;
    flex-shrink: 0;
  }

  .btn-icon-close:active {
    background: #e2e8f0;
    transform: scale(0.95);
  }

  .modal-subtitle-text {
    display: none;
  }

  .modal-body {
    padding: 14px 16px 36px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .status-pills-selector {
    flex-wrap: wrap;
    gap: 6px;
  }

  .status-pill-opt {
    flex: 1 1 calc(50% - 4px);
  }

  .status-pill-btn {
    height: 38px;
    font-size: 0.78rem;
    padding: 0 6px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }

  .modal-actions .right-actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
    margin-left: 0;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* CALENDAR PLANNING MODAL ON MOBILE */
  .calendar-modal-card {
    height: 94vh;
    max-height: 94vh;
  }

  .calendar-modal-body {
    padding: 10px 12px;
    gap: 10px;
  }

  .calendar-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .calendar-month-nav {
    justify-content: space-between;
  }

  .calendar-current-month {
    font-size: 0.95rem;
    min-width: auto;
  }

  .calendar-filter-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .cal-filter-pill {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 4px 8px;
  }

  .calendar-split-container {
    flex-direction: column;
    min-height: auto;
    gap: 10px;
  }

  .calendar-grid-wrapper {
    flex: none;
    padding: 8px 4px;
  }

  .cal-day-cell {
    min-height: 38px;
    padding: 2px;
  }

  .cal-day-num {
    font-size: 0.75rem;
  }

  .calendar-agenda-wrapper {
    flex: none;
    min-height: 200px;
    padding: 8px;
  }

  .calendar-legend {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.72rem;
  }

  /* CONTACT DETAIL MODAL ASSIGN ROW */
  .assign-inputs-row {
    flex-direction: column;
    gap: 8px;
  }

  .assign-inputs-row .btn {
    width: 100%;
    justify-content: center;
  }
}

/* SPECIFIC ULTRA-COMPACT LAYOUT FOR MOBILE LANDSCAPE (e.g. phone held horizontally) */
@media (max-height: 550px) {
  .top-navbar {
    height: 46px;
    padding: 4px 10px;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .brand-text h1 {
    font-size: 0.95rem;
  }

  .view-nav-tabs {
    order: unset;
    width: auto;
    margin-top: 0;
    padding: 2px;
  }

  .nav-tab {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .search-container {
    order: unset;
    width: 160px;
    margin-top: 0;
  }

  .search-container input {
    height: 30px;
    font-size: 0.75rem;
  }

  .main-content {
    height: calc(100vh - 46px);
    min-height: auto;
  }

  .contacts-view {
    height: calc(100vh - 46px);
  }

  .map-legend {
    display: none; /* Hide legend in landscape to maximize map visibility */
  }

  .alerts-dropdown {
    top: 48px;
    max-height: 85vh;
  }

  .alerts-list {
    max-height: calc(85vh - 70px);
  }

  .modal-overlay {
    align-items: center;
    padding: 6px;
  }

  .modal-card {
    max-height: 96vh;
    border-radius: var(--radius-lg);
  }
}

