/* =============================================================================
   CSS Variables & Reset
   ============================================================================= */

:root {
  --primary: #3B82F6;
  --primary-dark: #1E40AF;
  --primary-light: #60A5FA;

  /* Gold accents */
  --gold: #D4A843;
  --gold-dark: #B8922F;
  --gold-light: #F5E6C0;
  --gold-bg: rgba(212, 168, 67, 0.08);
  --secondary: #64748B;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --purple: #8B5CF6;
  --purple-light: #EDE9FE;

  --bg-body: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F172A;
  --bg-hover: #F1F5F9;

  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-white: #FFFFFF;

  --border: #E2E8F0;
  --border-light: #F1F5F9;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);

  --sidebar-width: 260px;
  --header-height: 70px;

  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* =============================================================================
   Layout
   ============================================================================= */

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
}

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

.logo-icon {
  flex-shrink: 0;
}

.logo-icon svg {
  width: 48px;
  height: 48px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 0 16px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-white);
}

.nav-item.active {
  background: var(--primary);
  color: var(--text-white);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.system-status {
  margin-bottom: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--success);
}

.status-dot.offline {
  background: var(--danger);
}

.status-text {
  color: var(--text-muted);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-brand > span {
  font-size: 11px;
  color: var(--text-muted);
}

.brand-logos {
  display: flex;
  gap: 8px;
}

.brand-item {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px 32px;
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.header-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-icon svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar span {
  color: white;
  font-size: 14px;
  font-weight: 600;
}

/* =============================================================================
   Sections
   ============================================================================= */

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* =============================================================================
   Stats Cards
   ============================================================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.stat-icon.green {
  background: var(--success-light);
  color: var(--success);
}

.stat-icon.orange {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-icon.purple {
  background: var(--purple-light);
  color: var(--purple);
}

.stat-body {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Stats grid de hoy (fila secundaria) --- */
.stats-grid-today {
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  margin-top: -12px;
}

.stat-card-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.stat-card-clickable:active {
  transform: translateY(0);
}

.stat-card-sm {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.stat-card-sm .stat-body {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.stat-card-sm .stat-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.stat-card-sm .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 0;
  white-space: nowrap;
}

/* Colores de stats */
.stat-value.amber { color: #f59e0b; }
.stat-value.green { color: #22c55e; }
.stat-value.red { color: #ef4444; }
.stat-value.gold { color: #D4A843; }

/* =============================================================================
   Cards
   ============================================================================= */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

.card-body.no-padding {
  padding: 0;
}

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--success-light);
  color: var(--success);
}

.status-badge.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.link-btn {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

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

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

/* Services List */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-body);
  border-radius: var(--radius);
}

.service-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-status.ok {
  background: var(--success);
}

.service-status.error {
  background: var(--danger);
}

.service-name {
  font-size: 14px;
  font-weight: 500;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  background: var(--bg-body);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.quick-action:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.04);
}

.quick-action-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-action-icon svg {
  width: 24px;
  height: 24px;
}

.quick-action-icon.blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.quick-action-icon.green {
  background: var(--success-light);
  color: var(--success);
}

.quick-action-icon.purple {
  background: var(--purple-light);
  color: var(--purple);
}

.quick-action span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* =============================================================================
   Tables
   ============================================================================= */

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 20px;
  text-align: left;
}

.data-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: var(--transition);
}

.data-table th.sortable:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sort-indicator {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

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

.data-table td {
  font-size: 14px;
}

.data-table code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
  background: var(--bg-body);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.empty-state {
  padding: 60px 20px !important;
  text-align: center;
}

.empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-content svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.empty-content p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.badge-secondary {
  background: var(--bg-body);
  color: var(--text-secondary);
}

/* =============================================================================
   Forms
   ============================================================================= */

.form-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.input-with-icon .form-input {
  padding-left: 44px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

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

.select-small {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  color: var(--text-primary);
}

.input-small {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  max-width: 150px;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-body);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #DC2626);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-1px);
}

/* Spinner inline para botones */
.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

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

.btn-full {
  width: 100%;
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-small svg {
  width: 16px;
  height: 16px;
}

/* =============================================================================
   Active Call Panel
   ============================================================================= */

.card-active {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-light);
}

.call-status-live {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--success-light);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.active-call-display {
  text-align: center;
  padding: 20px 0 30px;
}

.call-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.call-avatar-large svg {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
}

.active-call-display h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.call-phone {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.call-timer {
  font-size: 32px;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

/* =============================================================================
   Chat
   ============================================================================= */

.chat-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  max-height: 700px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-avatar {
  width: 48px;
  height: 48px;
}

.chat-avatar svg {
  width: 100%;
  height: 100%;
}

.chat-header-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-online {
  font-size: 13px;
  color: var(--success);
}

.chat-offline {
  font-size: 13px;
  color: var(--danger, #ef4444);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.chat-welcome {
  text-align: center;
  padding: 60px 20px;
}

.chat-welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.chat-welcome-icon svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.chat-welcome h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.chat-welcome p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

.chat-message {
  margin-bottom: 16px;
  max-width: 80%;
}

.chat-message.user {
  margin-left: auto;
}

.message-content {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
  background: var(--bg-body);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-message.system .message-content {
  background: rgba(245, 158, 11, 0.08);
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
  border-left: 3px solid #f59e0b;
  max-width: 100%;
}

.chat-message.system {
  max-width: 100%;
}

/* Typing indicator */
.message-content.typing {
  display: flex;
  gap: 6px;
  padding: 14px 20px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.message-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chat-message.user .message-meta {
  text-align: right;
}

.chat-input-area {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-body);
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

.btn-send {
  padding: 12px 16px;
}

/* Voice Recording & TTS Buttons */
.btn-voice,
.btn-tts {
  padding: 10px 12px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-voice:hover,
.btn-tts:hover {
  background: var(--bg-card);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-voice.recording {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.btn-voice svg {
  width: 18px;
  height: 18px;
}

.btn-tts {
  font-size: 16px;
  min-width: 40px;
}

.btn-tts.active {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.btn-tts.inactive {
  opacity: 0.5;
}

/* Chat message with audio */
.chat-message-audio {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-message-audio audio {
  height: 32px;
  max-width: 200px;
}

.chat-message-audio .play-audio-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.chat-message-audio .play-audio-btn:hover {
  background: var(--primary-dark);
}

/* Inline play button in chat message */
.btn-play-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 4px 8px;
  background: rgba(59, 130, 246, 0.1);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  vertical-align: middle;
}

.btn-play-audio:hover {
  background: rgba(59, 130, 246, 0.2);
}

.chat-footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px 20px;
  background: var(--bg-body);
  font-size: 12px;
  color: var(--text-muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.chat-footer code {
  font-family: 'SF Mono', Monaco, monospace;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
}

/* =============================================================================
   Toasts
   ============================================================================= */

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  animation: slideIn 0.3s ease;
}

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

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--primary); }

.toast-icon { font-size: 20px; }
.toast-title { font-weight: 600; font-size: 14px; }
.toast-message { font-size: 13px; color: var(--text-secondary); }

/* =============================================================================
   Modal
   ============================================================================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  cursor: pointer;
}

.modal-dialog {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
}
.checkbox-grid input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* =============================================================================
   Modal Large (for transcriptions, detailed views)
   ============================================================================= */

.modal-lg .modal-dialog {
  max-width: 720px;
}

/* =============================================================================
   Section Toolbar
   ============================================================================= */

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.section-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* =============================================================================
   Search Box
   ============================================================================= */

.search-box {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: var(--transition);
  color: var(--text-primary);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =============================================================================
   Calendar - Professional Layout
   ============================================================================= */

.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

/* Calendar Main Panel */
.calendar-main {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Calendar Toolbar */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.cal-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cal-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 200px;
  text-align: center;
  letter-spacing: -0.01em;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.cal-nav-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.cal-nav-btn svg {
  width: 18px;
  height: 18px;
}

/* Weekday Headers */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-body);
  border-bottom: 1px solid var(--border-light);
}

.cal-weekdays span {
  padding: 14px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cal-weekdays span.weekend {
  color: var(--danger);
  opacity: 0.7;
}

/* Days Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  position: relative;
  min-height: 90px;
  padding: 8px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  background: var(--bg-card);
}

.cal-day:nth-child(7n) {
  border-right: none;
}

.cal-day:hover {
  background: #F0F7FF;
  z-index: 1;
}

.cal-day.empty {
  background: var(--bg-body);
  cursor: default;
  opacity: 0.4;
}

.cal-day .cal-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: 50%;
  margin-bottom: 4px;
  transition: var(--transition);
}

.cal-day.today .cal-day-number {
  background: var(--primary);
  color: var(--text-white);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.cal-day.selected {
  background: rgba(59, 130, 246, 0.06);
  box-shadow: inset 0 0 0 2px var(--primary);
  z-index: 2;
}

.cal-day.selected .cal-day-number {
  color: var(--primary);
  font-weight: 700;
}

.cal-day.today.selected .cal-day-number {
  color: var(--text-white);
}

/* Booking Badge in Calendar */
.cal-day .cal-day-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-white);
  border-radius: 12px;
  margin-top: 2px;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.25);
}

.cal-day.has-bookings {
  background: rgba(59, 130, 246, 0.02);
}

/* Weekend columns */
.cal-day:nth-child(7n-1),
.cal-day:nth-child(7n) {
  background: rgba(248, 250, 252, 0.5);
}

.cal-day:nth-child(7n-1):hover,
.cal-day:nth-child(7n):hover {
  background: #F0F7FF;
}

.cal-day:nth-child(7n-1).selected,
.cal-day:nth-child(7n).selected {
  background: rgba(59, 130, 246, 0.06);
}

/* Detail Panel */
.cal-detail-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.cal-detail-header {
  padding: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-white);
}

.cal-detail-date {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cal-detail-day-num {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  opacity: 0.95;
}

.cal-detail-day-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-detail-day-name {
  font-size: 16px;
  font-weight: 600;
  opacity: 0.95;
}

.cal-detail-day-count {
  font-size: 13px;
  opacity: 0.7;
}

.cal-detail-body {
  padding: 16px 20px;
  max-height: 520px;
  overflow-y: auto;
}

.cal-detail-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.cal-detail-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.cal-detail-empty p {
  font-size: 14px;
  line-height: 1.5;
}

/* Calendar Booking Items */
.cal-booking-item {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-body);
  border-radius: var(--radius);
  margin-bottom: 10px;
  border-left: 4px solid var(--primary);
  transition: var(--transition);
  position: relative;
}

.cal-booking-item:last-child {
  margin-bottom: 0;
}

.cal-booking-item:hover {
  box-shadow: var(--shadow);
  transform: translateX(2px);
}

.cal-booking-item .cal-booking-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  min-width: 48px;
  padding-top: 1px;
}

.cal-booking-item .cal-booking-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-booking-item .cal-booking-info strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.cal-booking-item .cal-booking-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

.cal-booking-item .cal-booking-status {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
}

.cal-booking-item.confirmed {
  border-left-color: var(--success);
}

.cal-booking-item.confirmed .cal-booking-time {
  color: var(--success);
}

.cal-booking-item.pending {
  border-left-color: var(--warning);
}

.cal-booking-item.pending .cal-booking-time {
  color: var(--warning);
}

.cal-booking-item.cancelled {
  border-left-color: var(--danger);
  opacity: 0.6;
}

.cal-booking-item.cancelled .cal-booking-time {
  color: var(--danger);
}

/* =============================================================================
   Calendar Sync Bar & Google Calendar Integration
   ============================================================================= */

.cal-sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.cal-sync-bar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.cal-sync-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sync indicator */
.cal-sync-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.cal-sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.cal-sync-indicator.connected .cal-sync-dot {
  background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
  animation: sync-pulse 2s infinite;
}

.cal-sync-indicator.disconnected .cal-sync-dot {
  background: var(--danger);
  opacity: 0.7;
}

.cal-sync-indicator.syncing .cal-sync-dot {
  background: var(--warning);
  animation: sync-pulse 0.8s infinite;
}

@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Legend */
.cal-sync-legend {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cal-legend-dot.local {
  background: var(--primary);
}

.cal-legend-dot.google {
  background: #EA4335;
}

.cal-legend-dot.synced {
  background: linear-gradient(135deg, var(--primary), #34A853);
}

/* Sync button */
.cal-sync-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.cal-sync-btn:hover {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.cal-sync-btn.syncing svg {
  animation: spin 1s linear infinite;
}

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

/* Source indicators on calendar days */
.cal-day-sources {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  justify-content: center;
}

.cal-src-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

.cal-src-dot.local {
  background: var(--primary);
}

.cal-src-dot.google {
  background: #EA4335;
}

.cal-src-dot.synced {
  background: #34A853;
}

/* Google events on calendar days */
.cal-day.has-google {
  background: rgba(234, 67, 53, 0.03);
}

.cal-day.has-google .cal-day-badge {
  background: linear-gradient(135deg, var(--primary), #EA4335);
}

.cal-day.has-synced .cal-day-badge {
  background: linear-gradient(135deg, var(--primary), #34A853);
}

/* Filter buttons in detail panel */
.cal-detail-filter {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}

.cal-filter-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-filter-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
}

.cal-filter-btn.active {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Booking items - Source differentiation */
.cal-booking-item.source-google {
  border-left-color: #EA4335;
  background: rgba(234, 67, 53, 0.03);
}

.cal-booking-item.source-google .cal-booking-time {
  color: #EA4335;
}

.cal-booking-item.synced {
  border-left-color: #34A853;
}

.cal-booking-item.synced .cal-booking-time {
  color: #34A853;
}

/* Booking time column */
.cal-booking-time-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 48px;
}

/* Source icon in booking items */
.cal-booking-source {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-booking-source.local {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}

.cal-booking-source.google {
  color: #EA4335;
  background: rgba(234, 67, 53, 0.08);
}

.cal-booking-source.synced {
  color: #34A853;
  background: rgba(52, 168, 83, 0.08);
}

/* Booking actions */
.cal-booking-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Google Calendar external link */
.cal-gcal-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: var(--transition);
  text-decoration: none;
}

.cal-gcal-link:hover {
  background: rgba(234, 67, 53, 0.1);
  color: #EA4335;
}

/* =============================================================================
   Stats Overview (Statistics Page)
   ============================================================================= */

.stats-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

/* =============================================================================
   Stat Card Large
   ============================================================================= */

.stat-card-lg {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  text-align: center;
}

.stat-card-lg .stat-icon {
  margin: 0 auto 16px;
}

.stat-card-lg .stat-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-card-lg .stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.stat-card-lg .stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.stat-card-lg .stat-change.positive {
  background: var(--success-light);
  color: var(--success);
}

.stat-card-lg .stat-change.negative {
  background: var(--danger-light);
  color: var(--danger);
}

/* =============================================================================
   Chart Donut (CSS-only)
   ============================================================================= */

.chart-donut-container {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 8px 0;
}

.donut-chart {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  flex-shrink: 0;
  /* conic-gradient applied inline via JS or data attributes */
  background: conic-gradient(
    var(--primary) 0% 40%,
    var(--success) 40% 65%,
    var(--warning) 65% 80%,
    var(--danger) 80% 90%,
    var(--border) 90% 100%
  );
}

.donut-chart::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-card);
}

.donut-chart .donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  text-align: center;
}

.donut-chart .donut-center .donut-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.donut-chart .donut-center .donut-label {
  font-size: 11px;
  color: var(--text-muted);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.donut-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.donut-legend .legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend .legend-label {
  flex: 1;
  color: var(--text-secondary);
}

.donut-legend .legend-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* =============================================================================
   Stats Bars (Horizontal Bar Chart)
   ============================================================================= */

.stats-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-item .bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bar-item .bar-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.bar-item .bar-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bar-item .bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-body);
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s ease;
}

.bar-fill.green {
  background: linear-gradient(90deg, var(--success), #34D399);
}

.bar-fill.orange {
  background: linear-gradient(90deg, var(--warning), #FBBF24);
}

.bar-fill.purple {
  background: linear-gradient(90deg, var(--purple), #A78BFA);
}

.bar-fill.red {
  background: linear-gradient(90deg, var(--danger), #F87171);
}

/* =============================================================================
   Settings Grid
   ============================================================================= */

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

/* =============================================================================
   Settings List (Key-Value Pairs)
   ============================================================================= */

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.settings-item .settings-key {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.settings-item .settings-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.settings-item .settings-value code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
  background: var(--bg-body);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.settings-item .settings-value .badge {
  margin-left: 4px;
}

/* =============================================================================
   Schedule List (Day / Hours Display)
   ============================================================================= */

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.schedule-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.schedule-day:last-child {
  border-bottom: none;
}

.schedule-day .day-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 100px;
}

.schedule-day .day-hours {
  font-size: 14px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.schedule-day .day-hours.closed {
  color: var(--text-muted);
  font-style: italic;
}

.schedule-day .day-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.schedule-day .day-status.closed {
  background: var(--text-muted);
}

/* =============================================================================
   Card Footer (Pagination, Actions)
   ============================================================================= */

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-body);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.card-footer .footer-info {
  font-size: 13px;
  color: var(--text-muted);
}

.card-footer .pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-footer .pagination button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.card-footer .pagination button:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.card-footer .pagination button.active {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
}

.card-footer .pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card-footer .pagination button:disabled:hover {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-secondary);
}

.card-footer .pagination button svg {
  width: 16px;
  height: 16px;
}

/* =============================================================================
   Utilities
   ============================================================================= */

.hidden { display: none !important; }

/* =============================================================================
   Accessibility
   ============================================================================= */

/* Focus visible for keyboard users */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .section.active {
    animation: none;
  }

  .sidebar {
    transition: none;
  }
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================================
   Hamburger Button (hidden on desktop)
   ============================================================================= */

.hamburger-btn {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.hamburger-btn svg {
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* =============================================================================
   Responsive — TABLET (max-width: 1200px)
   ============================================================================= */

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

  .stats-grid-today {
    grid-template-columns: repeat(5, 1fr);
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .cal-detail-panel {
    position: static;
  }

  .cal-sync-bar {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .cal-sync-legend {
    flex-wrap: wrap;
    gap: 8px;
  }

  .main-content {
    padding: 20px 24px;
  }
}

/* =============================================================================
   Responsive — MOBILE (max-width: 768px)
   ============================================================================= */

@media (max-width: 768px) {
  /* --- Sidebar: off-canvas overlay --- */
  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 150;
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  /* --- Main content: full width --- */
  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  /* --- Header --- */
  .header {
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .header-left h1 {
    font-size: 20px;
  }

  .header-subtitle {
    font-size: 12px;
  }

  .header-right {
    gap: 10px;
  }

  .last-update-text {
    display: none;
  }

  /* --- Stats Grid --- */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .stats-grid-today {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: -8px;
    margin-bottom: 12px;
  }

  .stat-card-sm {
    padding: 10px 12px;
  }

  .stat-card-sm .stat-value {
    font-size: 18px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stat-icon svg {
    width: 18px;
    height: 18px;
  }

  .stat-header {
    margin-bottom: 10px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 11px;
  }

  /* --- Stats Overview (Estadisticas) --- */
  .stats-overview {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card-lg {
    padding: 16px 12px;
  }

  .stat-card-lg .stat-value {
    font-size: 24px;
  }

  .stat-card-lg .stat-label {
    font-size: 12px;
  }

  /* --- Content Grid --- */
  .content-grid {
    gap: 16px;
    margin-bottom: 16px;
  }

  /* --- Quick Actions --- */
  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .quick-action {
    padding: 14px 8px;
    gap: 8px;
  }

  .quick-action-icon {
    width: 40px;
    height: 40px;
  }

  .quick-action-icon svg {
    width: 20px;
    height: 20px;
  }

  .quick-action span {
    font-size: 11px;
  }

  /* --- Cards --- */
  .card {
    margin-bottom: 16px;
  }

  .card-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-header h2 {
    font-size: 14px;
  }

  .card-body {
    padding: 16px;
  }

  /* --- Tables --- */
  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 12px;
  }

  .data-table th {
    font-size: 10px;
  }

  .empty-state {
    padding: 32px 16px !important;
  }

  /* --- Section Toolbar --- */
  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }

  .section-toolbar .toolbar-left {
    flex-direction: column;
    gap: 8px;
  }

  .section-toolbar .toolbar-right {
    justify-content: flex-end;
  }

  .search-box {
    max-width: 100%;
  }

  /* --- Calls header with filters --- */
  .card-header div[style*="display: flex"] {
    flex-wrap: wrap;
    gap: 6px !important;
  }

  .input-small {
    max-width: 130px;
  }

  /* --- Tablas de llamadas responsive --- */
  /* Ocultar columnas ID y Nombre */
  #calls-table th:nth-child(2),
  #calls-table td:nth-child(2),
  #calls-table th:nth-child(4),
  #calls-table td:nth-child(4) {
    display: none;
  }
  #calls-table .th-checkbox {
    width: 28px;
    padding: 6px !important;
  }

  /* Forzar tabla scrollable si no cabe */
  .table-wrapper .data-table {
    min-width: 480px;
  }

  /* Agent calls table: ocultar columna ID */
  #ag-calls-table th:nth-child(2),
  #ag-calls-table td:nth-child(2) {
    display: none;
  }

  /* --- Pagination responsive --- */
  .pagination {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .pagination .btn {
    padding: 7px 12px;
    font-size: 12px;
    min-width: auto;
  }

  /* Ocultar botones primera/ultima en tablet y movil */
  .pagination .btn[title="Primera"],
  .pagination .btn[title="Ultima"] {
    display: none;
  }

  .pagination-info {
    font-size: 12px;
    order: -1;
    width: 100%;
    text-align: center;
    margin-bottom: 2px;
  }

  /* --- Inline pagination responsive --- */
  .calls-pagination,
  .bookings-pagination {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px 10px;
  }

  .calls-pagination .btn,
  .bookings-pagination .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .calls-pagination .btn[title="Primera"],
  .calls-pagination .btn[title="Ultima"],
  .bookings-pagination .btn[title="Primera"],
  .bookings-pagination .btn[title="Ultima"] {
    display: none;
  }

  .calls-pagination .pagination-info,
  .bookings-pagination .pagination-info {
    font-size: 12px;
    order: -1;
    width: 100%;
    text-align: center;
    margin-bottom: 2px;
  }

  /* --- Reservas Stats Bar --- */
  .reservas-stats-bar {
    flex-direction: column;
    gap: 6px;
  }

  /* --- Charts --- */
  .chart-donut-container {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .donut-legend {
    width: 100%;
  }

  /* --- Calendar --- */
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .cal-toolbar {
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }

  .cal-title {
    font-size: 17px;
    min-width: auto;
  }

  .cal-day {
    min-height: 56px;
    padding: 4px;
  }

  .cal-day .cal-day-number {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .cal-detail-day-num {
    font-size: 32px;
  }

  .cal-detail-header {
    padding: 16px;
  }

  .cal-sync-bar {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    padding: 10px 14px;
  }

  .cal-sync-bar-left {
    flex-direction: column;
    gap: 8px;
  }

  .cal-sync-legend {
    gap: 6px;
    flex-wrap: wrap;
  }

  .cal-day-sources {
    display: none;
  }

  .cal-detail-filter {
    gap: 3px;
  }

  .cal-filter-btn {
    font-size: 10px;
    padding: 3px 8px;
  }

  /* --- Chat --- */
  .chat-container {
    height: calc(100vh - 120px);
    max-height: none;
    border-radius: var(--radius);
  }

  .chat-header {
    padding: 12px 14px;
  }

  .chat-avatar {
    width: 36px;
    height: 36px;
  }

  .chat-header-info h3 {
    font-size: 14px;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-message {
    max-width: 90%;
  }

  .chat-input-area {
    padding: 10px 12px;
    gap: 8px;
  }

  .chat-footer {
    padding: 8px 12px;
    gap: 12px;
    font-size: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .chat-welcome {
    padding: 30px 16px;
  }

  .chat-welcome h3 {
    font-size: 16px;
  }

  .chat-welcome p {
    font-size: 13px;
  }

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

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

  /* --- Modals --- */
  .modal-dialog {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
    max-height: calc(90vh - 70px);
  }

  .modal-lg .modal-dialog {
    max-width: 95%;
  }

  .modal-sm .modal-dialog {
    max-width: 95%;
  }

  /* --- Card Footer / Pagination --- */
  .card-footer {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 12px 16px;
  }

  #calls-pagination,
  #bookings-pagination {
    flex-direction: row;
    padding: 0;
  }

  /* --- User Menu --- */
  .user-dropdown {
    right: -10px;
    min-width: 200px;
  }

  /* --- Notification Dropdown --- */
  .notification-dropdown {
    right: -40px;
    min-width: 300px;
    max-width: calc(100vw - 32px);
  }

  /* --- Agente Tabs --- */
  .agente-tabs {
    gap: 0;
  }

  .agente-tab {
    padding: 10px 12px;
    font-size: 11px;
  }

  /* --- Settings --- */
  .settings-grid {
    grid-template-columns: 1fr;
  }

  /* --- Buttons --- */
  .btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .btn-full {
    width: 100%;
  }

  /* --- Toasts --- */
  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* --- Brand footer in sidebar --- */
  .brand-muninfor {
    display: none;
  }
}

/* =============================================================================
   Responsive — SMALL MOBILE (max-width: 480px)
   ============================================================================= */

@media (max-width: 480px) {
  .main-content {
    padding: 12px;
  }

  .header-left h1 {
    font-size: 18px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-header {
    margin-bottom: 8px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
  }

  .stat-icon svg {
    width: 16px;
    height: 16px;
  }

  .stats-overview {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card-lg {
    padding: 12px 8px;
  }

  .stat-card-lg .stat-value {
    font-size: 20px;
  }

  .stat-card-lg .stat-label {
    font-size: 10px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .quick-action {
    padding: 10px 4px;
    gap: 6px;
  }

  .quick-action-icon {
    width: 36px;
    height: 36px;
  }

  .quick-action span {
    font-size: 10px;
  }

  /* Calendar minimal */
  .cal-weekdays span {
    font-size: 10px;
    padding: 8px 2px;
  }

  .cal-day {
    min-height: 44px;
    padding: 3px;
  }

  .cal-day .cal-day-number {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .cal-day .cal-day-badge {
    font-size: 8px;
    padding: 1px 5px;
  }

  .cal-sync-legend {
    display: none;
  }

  .cal-sync-btn span {
    display: none;
  }

  /* Tables */
  .data-table th,
  .data-table td {
    padding: 8px 8px;
    font-size: 11px;
  }

  .data-table code {
    font-size: 10px;
    padding: 2px 4px;
  }

  .badge {
    padding: 2px 6px;
    font-size: 10px;
  }

  /* Input date smaller */
  .input-small {
    max-width: 110px;
    padding: 5px 6px;
    font-size: 11px;
  }

  .select-small {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Calls table 480: ocultar Tipo tambien */
  #calls-table th:nth-child(5),
  #calls-table td:nth-child(5) {
    display: none;
  }

  /* Pagination ultra compact */
  .pagination .btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .calls-pagination .btn,
  .bookings-pagination .btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Chat */
  .chat-container {
    height: calc(100vh - 100px);
  }

  .chat-footer {
    display: none;
  }

  /* Notification dropdown full width on small mobile */
  .notification-dropdown {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    min-width: auto;
    max-width: none;
  }
}

/* =============================================================================
   Gold Theme - Reservas Stats Bar
   ============================================================================= */

.reservas-stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.res-stat-item {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-sidebar);
  border-radius: var(--radius);
  border: 1px solid rgba(212, 168, 67, 0.2);
}

.res-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.res-stat-icon.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.res-stat-icon.confirmed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.res-stat-icon.rejected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.res-stat-icon.cancelled {
  background: rgba(100, 116, 139, 0.15);
  color: var(--secondary);
}

.res-stat-icon.capacity {
  background: rgba(212, 168, 67, 0.15);
  color: var(--gold);
}

.res-stat-info {
  display: flex;
  flex-direction: column;
}

.res-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.res-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* =============================================================================
   User Menu & Dropdown
   ============================================================================= */

.user-menu {
  position: relative;
  cursor: pointer;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 200;
  overflow: hidden;
}

.user-dropdown.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.user-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-dropdown-header span:first-child {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.user-dropdown-role {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-dropdown-actions {
  padding: 6px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  transition: var(--transition);
}

.user-dropdown-item:hover {
  background: var(--bg-hover);
}

.user-dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.user-dropdown-item.logout {
  color: var(--danger);
}

.user-dropdown-item.logout:hover {
  background: var(--danger-light);
}

.user-dropdown-item.logout svg {
  color: var(--danger);
}

.last-update-text {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* =============================================================================
   Notification Bell & Dropdown
   ============================================================================= */

.notification-menu {
  position: relative;
}

.notification-bell {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  animation: badgePulse 0.3s ease;
}

@keyframes badgePulse {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.notification-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 360px;
  max-width: 420px;
  z-index: 200;
  overflow: hidden;
}

.notification-dropdown.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.notification-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-dropdown-header > span {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.notification-mark-read {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.notification-mark-read:hover {
  background: rgba(59, 130, 246, 0.1);
}

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}

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

.notification-item:hover {
  background: var(--bg-hover);
}

.notification-item.unread {
  background: rgba(59, 130, 246, 0.04);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.notification-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.notification-icon.nueva { background: var(--success-light); }
.notification-icon.confirmada { background: rgba(59, 130, 246, 0.1); }
.notification-icon.modificada { background: var(--warning-light); }
.notification-icon.rechazada { background: var(--danger-light); }
.notification-icon.cancelada { background: var(--bg-body); }

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.notification-text strong {
  font-weight: 600;
}

.notification-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.notification-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* =============================================================================
   Brand Footer (Muninfor)
   ============================================================================= */

.brand-muninfor {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0 0;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

/* =============================================================================
   Badge Purple
   ============================================================================= */

.badge-purple {
  background: var(--purple-light);
  color: var(--purple);
}

/* =============================================================================
   Action Buttons in Tables
   ============================================================================= */

.action-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-sm.btn-success {
  background: var(--success);
  color: white;
}

.btn-sm.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-sm.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm.btn-danger:hover {
  background: #DC2626;
  transform: translateY(-1px);
}

.btn-sm.btn-secondary {
  background: var(--bg-body);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-sm.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-sm.btn-outline:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.config-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* =============================================================================
   Pagination (standalone)
   ============================================================================= */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Inline pagination (llamadas, reservas, etc.) --- */
.calls-pagination,
.bookings-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  flex-wrap: nowrap;
}

.calls-pagination .btn,
.bookings-pagination .btn {
  white-space: nowrap;
  width: auto;
  height: auto;
  padding: 6px 14px;
  font-size: 13px;
}

.calls-pagination .pagination-info,
.bookings-pagination .pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

/* =============================================================================
   VAPI Section Styles
   ============================================================================= */

.vapi-prompt-editor {
  width: 100%;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #1E293B;
  color: #E2E8F0;
  resize: vertical;
}

.vapi-prompt-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.config-inject-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 12px 14px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.config-inject-info svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}
.config-inject-info strong {
  color: var(--text-primary);
}
.btn-xs {
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================================================
   Schedule Extended — Closed Days, Special Hours, Mini Calendars, Closures
   ============================================================================= */

/* Section titles within cards */
.form-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 24px 0 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -4px 0 12px 0;
}

/* Closed Days Checkboxes Grid */
.closed-days-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.day-checkbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: var(--transition);
  min-width: 48px;
  text-align: center;
  user-select: none;
}

.day-checkbox:hover {
  border-color: var(--primary-light, #60a5fa);
  background: rgba(59, 130, 246, 0.04);
}

.day-checkbox input[type="checkbox"] {
  display: none;
}

.day-checkbox input[type="checkbox"]:checked + span {
  color: #ef4444;
  font-weight: 700;
}

.day-checkbox:has(input:checked) {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.day-checkbox span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: none;
}

/* Special Hours Panel */
.special-hours-panel {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg-body, #f8fafc);
}

.special-hours-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.special-hours-day {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input-sm {
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
}

/* Mini Calendar Component */
.schedule-calendar-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.schedule-mini-calendar {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-body, #f8fafc);
  border-bottom: 1px solid var(--border-light);
}

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

.mini-cal-nav {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.mini-cal-nav:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.mini-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border-light);
}

.mini-cal-weekdays span {
  text-align: center;
  padding: 6px 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 4px;
}

.mini-cal-cell {
  text-align: center;
  padding: 6px 2px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition);
  color: var(--text-primary);
}

.mini-cal-cell.empty {
  cursor: default;
}

.mini-cal-cell:not(.empty):hover {
  background: rgba(59, 130, 246, 0.1);
}

.mini-cal-cell.today {
  font-weight: 700;
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.mini-cal-cell.selected {
  background: #22c55e;
  color: white;
  font-weight: 700;
  border-radius: 50%;
}

.mini-cal-cell.closed-day {
  color: var(--text-muted);
  background: rgba(239, 68, 68, 0.05);
}

.mini-cal-cell.in-range {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-weight: 600;
}

.mini-cal-cell.past {
  opacity: 0.4;
}

/* Calendar disabled state (when not editing) */
.cal-disabled .mini-cal-cell:not(.empty) {
  cursor: default;
  pointer-events: none;
}
.cal-disabled .mini-cal-nav {
  pointer-events: auto; /* nav still works */
}

/* Date list next to calendar */
.schedule-date-list {
  max-height: 260px;
  overflow-y: auto;
}

.special-date-item,
.closure-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8rem;
}

.special-date-item:last-child,
.closure-item:last-child {
  border-bottom: none;
}

.special-date-date,
.closure-dates {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.special-date-note,
.closure-reason {
  flex: 1;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon-sm {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-icon-sm:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Closures section */
.closures-section {
  margin-top: 8px;
}

.closure-form {
  margin-bottom: 16px;
}

.closure-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-top: 12px;
}

.closure-add-btn {
  margin-bottom: 2px;
  white-space: nowrap;
}

.closures-list {
  margin-bottom: 12px;
}

.no-data-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 0;
}

/* Responsive for schedule extended */
@media (max-width: 768px) {
  .schedule-calendar-container {
    grid-template-columns: 1fr;
  }
  .special-hours-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .special-hours-day {
    padding-top: 8px;
  }
  .closed-days-grid {
    gap: 4px;
  }
  .day-checkbox {
    padding: 8px 10px;
    min-width: 40px;
  }
  .closure-form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .closure-add-btn {
    align-self: flex-start;
  }
}

/* Checkbox columns in tables */
.th-checkbox,
.td-checkbox {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  text-align: center;
  padding: 8px 4px !important;
}
.th-checkbox input[type="checkbox"],
.td-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Delete button inline SVG alignment */
#calls-delete-btn svg,
#ag-calls-delete-btn svg {
  vertical-align: -2px;
  margin-right: 2px;
}

.vapi-tool-item {
  padding: 12px 16px;
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
}

.vapi-tool-item:last-child {
  margin-bottom: 0;
}

.vapi-tool-item strong {
  font-size: 14px;
  color: var(--text-primary);
}

.vapi-tool-item p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =============================================================================
   Agente Section - Tabs
   ============================================================================= */

.agente-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  overflow-x: auto;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
}

.agente-tab {
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.agente-tab:hover {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.04);
}

.agente-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.agente-panel {
  display: none;
}

.agente-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Agente - Call Detail Transcript */
.call-transcript {
  margin-top: 16px;
}

.call-transcript h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.transcript-line {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
}

.transcript-line.bot {
  background: var(--bg-body);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.transcript-line.user {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

/* Agente responsive */
@media (max-width: 768px) {
  .agente-tabs {
    gap: 0;
  }

  .agente-tab {
    padding: 10px 14px;
    font-size: 12px;
  }
}

/* =============================================================================
   Settings Editable
   ============================================================================= */

.settings-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.settings-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* =============================================================================
   Text Utilities
   ============================================================================= */

.text-muted {
  color: var(--text-muted) !important;
}

.text-success {
  color: var(--success) !important;
}

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

/* =============================================================================
   Modal SM (for reject modal, smaller)
   ============================================================================= */

.modal-sm .modal-dialog {
  max-width: 400px;
}

/* =============================================================================
   Superadmin-only visibility
   ============================================================================= */

.superadmin-only {
  /* Controlled via JS */
}

/* =============================================================================
   Availability Check
   ============================================================================= */

.availability-check {
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 13px;
}

.availability-check.available {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.availability-check.unavailable {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* =============================================================================
   Reservas status items
   ============================================================================= */

.cal-booking-item.confirmada {
  border-left-color: var(--success);
}

.cal-booking-item.confirmada .cal-booking-time {
  color: var(--success);
}

.cal-booking-item.pendiente {
  border-left-color: var(--warning);
}

.cal-booking-item.pendiente .cal-booking-time {
  color: var(--warning);
}

.cal-booking-item.rechazada {
  border-left-color: var(--danger);
  opacity: 0.65;
}

.cal-booking-item.rechazada .cal-booking-time {
  color: var(--danger);
}

.cal-booking-item.cancelada {
  border-left-color: var(--secondary);
  opacity: 0.5;
}

.cal-booking-item.cancelada .cal-booking-time {
  color: var(--secondary);
}

/* =============================================================================
   Toolbar Filters
   ============================================================================= */

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* =============================================================================
   Responsive Adjustments for Reservas Stats & Actions
   ============================================================================= */

@media (max-width: 1200px) {
  .reservas-stats-bar {
    gap: 8px;
  }

  .res-stat-item {
    min-width: 120px;
    padding: 10px 14px;
  }

  .res-stat-value {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  /* Stats bar: 2 columns on mobile */
  .reservas-stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .res-stat-item {
    min-width: unset;
    padding: 12px 14px;
  }

  .res-stat-item:last-child {
    grid-column: 1 / -1;
  }

  /* Toolbar: stack on mobile */
  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .section-toolbar .toolbar-left {
    flex-direction: column;
    gap: 8px;
  }

  .search-box {
    max-width: 100%;
  }

  .toolbar-filters {
    width: 100%;
  }

  .toolbar-filters .select-small {
    flex: 1;
    min-width: 0;
  }

  .toolbar-right {
    justify-content: stretch;
  }

  .toolbar-right .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  /* Table → Card layout on mobile */
  #bookings-table thead {
    display: none;
  }

  #bookings-table tbody tr {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin: 0 12px 12px;
    padding: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
  }

  #bookings-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: none;
    font-size: 13px;
  }

  #bookings-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    margin-right: 12px;
  }

  #bookings-table td:last-child {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border-light);
    justify-content: flex-end;
  }

  #bookings-table td:last-child::before {
    display: none;
  }

  .action-buttons {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  /* Pagination mobile */
  .bookings-pagination {
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }
}

/* =============================================================================
   Section Loading Overlay & Spinner
   ============================================================================= */

.section-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 50;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(2px);
}

.section-loading-overlay span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

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

/* =============================================================================
   DB Browser
   ============================================================================= */

#db-data-wrapper {
  max-height: 65vh;
  overflow: auto;
}

.db-cell {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.db-cell-truncated {
  cursor: help;
}

.db-cell-truncated:hover {
  white-space: normal;
  word-break: break-all;
  max-width: 400px;
}

.db-null {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
}

.db-sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.db-sortable-th:hover {
  color: var(--primary);
}

.badge-pk {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  line-height: 1.4;
}

.badge-null {
  display: inline-block;
  background: var(--warning-light);
  color: var(--warning);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
}

.db-type-code {
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--text-secondary);
}

.db-actions-cell {
  white-space: nowrap;
  text-align: center;
}

.btn-icon-sm {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm:hover {
  background: var(--bg-hover);
}

.db-edit-btn:hover {
  color: var(--primary);
}

.db-delete-btn:hover {
  color: var(--danger);
}

/* DB Browser card footer pagination */
#section-dbbrowser .card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

#db-data-pagination .btn {
  min-width: 32px;
  padding: 4px 8px;
  font-size: 12px;
}

/* DB Browser section toolbar */
#section-dbbrowser .section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

#section-dbbrowser .toolbar-left {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

#section-dbbrowser .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* DB Browser bulk toolbar */
.db-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

/* Checkbox columns (DB Browser & Calls) */
.th-checkbox, .td-checkbox {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  text-align: center;
  padding: 4px 8px !important;
}

.db-row-selected {
  background: rgba(59, 130, 246, 0.06);
}

.db-row-selected:hover {
  background: rgba(59, 130, 246, 0.10);
}

/* Sync button spin animation */
@keyframes sync-spin {
  to { transform: rotate(360deg); }
}
.spin {
  animation: sync-spin 1s linear infinite;
}

/* =============================================================================
   MEJORAS v2 — Skeleton Screens, Toasts, Accesibilidad, PWA
   ============================================================================= */

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, #e2e8f0 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-stat {
  height: 42px;
  width: 60px;
}

.skeleton-card {
  height: 120px;
  width: 100%;
}

/* --- Improved Toasts --- */
.toast {
  position: relative;
  overflow: hidden;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255,255,255,0.3);
  animation: toast-countdown 5s linear forwards;
  border-radius: 0 0 var(--radius) var(--radius);
}

.toast.error .toast-progress {
  animation: none;
  width: 100%;
  background: rgba(255,255,255,0.2);
}

@keyframes toast-countdown {
  from { width: 100%; }
  to { width: 0%; }
}

.toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(255,255,255,0.15);
}

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

.nav-item:focus-visible {
  outline-color: var(--primary-light);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- Skip to Content (Accesibilidad) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  z-index: 9999;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* --- Table wrapper scroll hint --- */
.table-wrapper {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll-hint {
  display: none;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.05));
  pointer-events: none;
  z-index: 2;
}

/* --- PWA Install Banner --- */
.pwa-install-banner {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-sidebar);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 9000;
  align-items: center;
  gap: 16px;
  max-width: 400px;
  width: calc(100% - 40px);
  animation: slideUp 0.3s ease;
}

.pwa-install-banner.visible {
  display: flex;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.pwa-install-banner span {
  flex: 1;
  font-size: 14px;
}

.pwa-install-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.pwa-install-btn:hover {
  background: var(--primary-dark);
}

.pwa-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
}

/* --- Offline indicator --- */
.offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: var(--text-primary);
  text-align: center;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10000;
}

.offline-banner.visible {
  display: block;
}

/* --- Sidebar mobile close button --- */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 10;
}

.sidebar-close-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* --- Stats grid today responsive fix --- */
@media (max-width: 768px) {
  .stats-grid-today {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .sidebar-close-btn {
    display: flex;
  }

  /* Better table scroll on mobile */
  .table-wrapper {
    margin: 0 -16px;
    padding: 0 16px;
  }

  /* Toolbar filters wrap */
  .toolbar-filters {
    flex-wrap: wrap;
    gap: 6px;
  }

  .toolbar-filters select {
    flex: 1;
    min-width: 100px;
  }

  /* DB Browser mobile */
  .db-bulk-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
  }

  .db-bulk-toolbar .btn {
    font-size: 11px;
    padding: 6px 10px;
  }

  #db-selected-info {
    width: 100%;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .stats-grid-today {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .stats-grid-today .stat-card-sm:last-child {
    grid-column: 1 / -1;
  }

  /* Modal footer buttons stack */
  .modal-footer {
    flex-direction: column;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* --- Scroll to top button --- */
.scroll-top-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: var(--transition);
}

.scroll-top-btn.visible {
  display: flex;
}

.scroll-top-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.scroll-top-btn svg {
  width: 20px;
  height: 20px;
}

/* --- Empty state improvements --- */
.empty-content {
  text-align: center;
  padding: 32px 16px;
}

.empty-content svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-content p {
  color: var(--text-muted);
  font-size: 14px;
}

/* =============================================================================
   WhatsApp Bot Status
   ============================================================================= */

.wa-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.wa-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-secondary);
  flex-shrink: 0;
}

.wa-status-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.wa-status-dot.disconnected {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

/* =============================================================================
   Settings Section - Tabs
   ============================================================================= */

.settings-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  overflow-x: auto;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.settings-tab:hover {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.04);
}

.settings-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* =============================================================================
   Color Picker Inputs (Theme section)
   ============================================================================= */

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-color {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-card);
  transition: var(--transition);
  flex-shrink: 0;
}

.form-color:hover {
  border-color: var(--primary);
}

.form-color:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-color-text {
  width: 100px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  text-transform: uppercase;
  transition: var(--transition);
}

.form-color-text:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Color preview swatch next to text */
.color-preview {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Theme color grid */
.theme-colors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.theme-dimensions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* =============================================================================
   Settings Tabs Responsive
   ============================================================================= */

@media (max-width: 1200px) {
  .theme-colors-grid {
    grid-template-columns: 1fr 1fr;
  }

  .theme-dimensions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .settings-tabs {
    gap: 0;
    margin-bottom: 16px;
  }

  .settings-tab {
    padding: 10px 14px;
    font-size: 12px;
  }

  .theme-colors-grid {
    grid-template-columns: 1fr;
  }

  .theme-dimensions-grid {
    grid-template-columns: 1fr 1fr;
  }

  .color-input-wrap {
    gap: 8px;
  }

  .form-color {
    width: 38px;
    height: 38px;
  }

  .form-color-text {
    width: 85px;
    padding: 8px 10px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .theme-dimensions-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   Extra Responsive Fixes — Small Mobile (≤480px)
   ============================================================================= */

@media (max-width: 480px) {
  /* Stat card small labels: allow wrapping on tiny screens */
  .stat-card-sm .stat-label {
    white-space: normal;
    font-size: 11px;
    line-height: 1.3;
  }

  .stat-card-sm .stat-body {
    gap: 6px;
  }

  .stat-card-sm .stat-value {
    font-size: 16px;
  }

  /* Stat card labels: smaller font */
  .stat-label {
    font-size: 10px;
  }

  .stat-value {
    font-size: 20px;
  }

  /* Stats grid: tighter gap */
  .stats-grid {
    gap: 8px;
  }

  /* Header: tighter on very small screens */
  .header-left h1 {
    font-size: 18px;
  }

  .header-right .btn-icon {
    width: 34px;
    height: 34px;
  }

  /* Settings tab even more compact */
  .settings-tab {
    padding: 8px 10px;
    font-size: 11px;
  }

  .agente-tab {
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* =============================================================================
   Responsive Fix: Prevent horizontal overflow globally
   ============================================================================= */

.main-content {
  overflow-x: hidden;
}

/* Ensure long words in cards don't cause overflow */
.card-body {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Config card header: actions don't shrink */
@media (max-width: 768px) {
  .config-actions {
    flex-shrink: 0;
  }
}
