/* ==========================================================================
   DESIGN SYSTEM & CSS TOKENS
   Theme: Clean Health / Modern Pharmacy UI
   ========================================================================== */

:root {
  /* Color Palette */
  --primary: #0d7a5f;
  --primary-dark: #085542;
  --primary-light: #e6f6f1;
  --primary-border: #b3e6d5;
  
  --secondary: #0284c7;
  --secondary-light: #e0f2fe;

  --accent-green: #10b981;
  --accent-green-light: #d1fae5;
  --accent-green-dark: #065f46;

  --accent-orange: #d97706;
  --accent-orange-light: #fef3c7;

  --whatsapp: #25d366;
  --whatsapp-dark: #128c7e;
  --whatsapp-light: #dcf8c6;

  --bg-app: #f4f6f8;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-sticky: 0 -4px 16px rgba(0, 0, 0, 0.08);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   HEADER & TOPBAR
   ========================================================================== */

.app-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* View Switcher Tabs */
.view-switch-wrapper {
  background: #eef2f6;
  padding: 3px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.view-switcher {
  display: flex;
  gap: 3px;
}

.switch-btn {
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
}

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

.switch-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* User switcher placed on top-right */
.topbar-user-wrapper {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

/* ==========================================================================
   LAYOUT & SECTIONS
   ========================================================================== */

.main-layout {
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 100px 20px;
}

.orders-dashboard-wrapper.full-width {
  max-width: 100%;
  width: 100%;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* ==========================================================================
   VISTA PACIENTE (SENIOR-FRIENDLY / MOBILE-FIRST)
   ========================================================================== */

.patient-phone-frame {
  max-width: 680px;
  margin: 0 auto;
}

.patient-header {
  background: linear-gradient(135deg, #0d7a5f 0%, #085542 100%);
  color: white;
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.patient-header::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.patient-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.patient-name {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 16px;
}

.instructions-card {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
}

.inst-icon {
  font-size: 1.2rem;
  color: #a7f3d0;
  flex-shrink: 0;
  margin-top: 2px;
}

.inst-text strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.inst-text p {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.4;
}

/* Controls & Filter Tabs */
.patient-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

.bulk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-text-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.btn-text-action:hover {
  background: var(--primary-light);
}

/* ==========================================================================
   RECIPES & MEDICINE CARDS
   ========================================================================== */

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

.recipe-block {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.recipe-block-header {
  background: var(--bg-subtle);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.recipe-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-title i {
  color: var(--primary);
}

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

.btn-toggle-recipe {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.recipe-meds-list {
  display: flex;
  flex-direction: column;
}

/* Medicine Item Card */
.med-item {
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

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

.med-item:hover {
  background-color: #fafbfc;
}

.med-item.selected {
  background-color: #f0fdf9;
}

/* Big Custom Checkbox */
.med-checkbox-wrap {
  flex-shrink: 0;
  margin-top: 4px;
}

.med-checkbox {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-medium);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  transition: all 0.2s ease;
  color: transparent;
  font-size: 0.95rem;
}

.med-item.selected .med-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: scale(1.05);
}

/* Details */
.med-content {
  flex: 1;
  min-width: 0;
}

.med-header-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.med-name {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

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

.badge-coverage.free {
  background: var(--accent-green-light);
  color: var(--accent-green-dark);
  border: 1px solid #a7f3d0;
}

.badge-coverage.copay {
  background: var(--accent-orange-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-coverage.rejected {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  font-weight: 800;
}

.med-item.rejected-item {
  background-color: #fffafb;
  border-left: 4px solid #ef4444;
  opacity: 0.88;
}

.med-item.rejected-item:hover {
  background-color: #fef2f2;
}

.med-alert-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #b91c1c;
  margin-top: 6px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.med-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Price block */
.med-pricing {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-medium);
}

.med-item.selected .med-pricing {
  background: #e8f7f2;
  border-color: var(--primary-border);
}

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

.price-os strong {
  color: var(--primary);
}

.price-patient {
  text-align: right;
}

.price-patient-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.price-patient-amount {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.price-patient-amount.free-tag {
  color: var(--accent-green-dark);
}

.price-patient-amount.copay-tag {
  color: var(--accent-orange);
}

/* ==========================================================================
   STICKY BAR / FOOTER ACTION
   ========================================================================== */

.patient-sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sticky);
  padding: 14px 16px;
  z-index: 100;
}

.sticky-bar-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.summary-info {
  flex: 1;
}

.summary-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.selected-badge {
  font-size: 0.8rem;
  font-weight: 700;
  background: #e2e8f0;
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.savings-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.summary-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.summary-total .label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.summary-total .amount {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.btn-confirm-order {
  background: var(--whatsapp);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-confirm-order:hover {
  background: var(--whatsapp-dark);
  transform: translateY(-2px);
}

.btn-confirm-order i {
  font-size: 1.3rem;
}

/* ==========================================================================
   PANEL MOSTRADOR / FARMACIA
   ========================================================================== */

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

@media (max-width: 900px) {
  .pharmacy-grid {
    grid-template-columns: 1fr;
  }
}

.pharmacy-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

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

.card-icon.green {
  background: var(--whatsapp-light);
  color: var(--whatsapp-dark);
}

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-medium);
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.dropzone h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.dropzone p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.hidden-input {
  display: none;
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border-medium);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.quick-sample-box {
  background: #f1f5f9;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn-sample {
  background: var(--secondary);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-sample:hover {
  background: #0369a1;
}

/* Status Box */
.status-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--secondary-light);
  border: 1px solid #bae6fd;
  padding: 12px 16px;
  border-radius: var(--radius-md);
}

.status-spinner {
  font-size: 1.4rem;
  color: var(--secondary);
}

.status-msg strong {
  display: block;
  font-size: 0.9rem;
  color: #0369a1;
}

.status-msg p {
  font-size: 0.8rem;
  color: #0c4a6e;
}

/* Extracted Summary */
.extracted-summary {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.extracted-summary h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.s-item {
  display: flex;
  flex-direction: column;
}

.s-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.s-item strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

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

.text-green {
  color: var(--accent-green-dark) !important;
}

/* Form Groups & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-with-icon {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.input-prefix {
  padding: 10px 14px;
  background: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-with-icon input {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
}

.helper-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Share Link Box */
.share-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-box label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.copy-input-group {
  display: flex;
  gap: 8px;
}

.link-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  outline: none;
}

.btn-copy {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-copy:hover {
  background: white;
  color: var(--text-main);
}

/* Actions Group */
.action-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-whatsapp-primary {
  background: var(--whatsapp);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
  transition: all 0.2s ease;
  width: 100%;
}

.btn-whatsapp-primary:hover {
  background: var(--whatsapp-dark);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-medium);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

/* QR Code Section */
.qr-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.qr-info {
  flex: 1;
}

.qr-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.qr-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.qr-container {
  background: white;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qrcode-wrapper {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qrcode-wrapper img {
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   MODAL DIALOG
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
  opacity: 0;
}

.modal-dialog {
  background: var(--bg-surface);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  width: 44px;
  height: 44px;
  background: var(--whatsapp-light);
  color: var(--whatsapp-dark);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-close-modal {
  margin-left: auto;
  font-size: 1.2rem;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-full);
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-affiliate-tag {
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.modal-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

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

.modal-med-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
}

.modal-med-row .m-name {
  font-weight: 600;
  color: var(--text-main);
}

.modal-med-row .m-price {
  font-weight: 700;
  color: var(--text-main);
}

.modal-unselected-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.8rem;
  color: #92400e;
}

.modal-totals-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.modal-total-row.final {
  border-top: 1px dashed #86efac;
  padding-top: 8px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.modal-total-row.final .amount-big {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
}

.modal-footer button {
  flex: 1;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 20px);
}

.toast-icon {
  color: var(--accent-green);
  font-size: 1.1rem;
}

/* Tab Badge Counter */
.badge-tab-count {
  background: #ef4444;
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-left: 4px;
}

/* ==========================================================================
   CONTROL DE PEDIDOS DASHBOARD & KANBAN (OPTIMIZADO ALTA DENSIDAD)
   ========================================================================== */

.orders-dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Compact & Collapsible Metrics Ribbon */
.orders-metrics-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.orders-metrics-ribbon {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  transition: all 0.25s ease;
}

.orders-metrics-ribbon.hidden-kpis {
  display: none;
}

.metric-ribbon-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px;
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.metric-ribbon-item:last-child {
  border-right: none;
}

.metric-ribbon-item .m-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.m-icon.cyan { background: #cffafe; color: #0891b2; }
.m-icon.emerald, .m-icon.green { background: #dcfce7; color: #16a34a; }
.m-icon.amber { background: #fef3c7; color: #d97706; }
.m-icon.purple { background: #f3e8ff; color: #9333ea; }
.m-icon.blue { background: #e0f2fe; color: #0284c7; }
.m-icon.orange { background: #ffedd5; color: #ea580c; }

.metric-ribbon-item .m-content {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric-ribbon-item .m-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-ribbon-item .m-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.metric-ribbon-item .m-val.amount {
  color: #ea580c;
}

.metric-ribbon-item .m-flex-val {
  display: flex;
  align-items: center;
  gap: 6px;
}

.m-badge-rate {
  background: #dcfce7;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.btn-toggle-kpis {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.btn-toggle-kpis:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

/* Dense Toolbar & View Mode Toggle */
.orders-toolbar.dense {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.orders-toolbar.dense .search-box {
  flex: 1 1 200px;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

.orders-toolbar.dense .search-box input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-main);
  outline: none;
}

.orders-filter-pills {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.order-filter-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 4px 9px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
}

.order-filter-pill:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

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

.view-mode-toggle-group {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
}

.btn-mode-toggle {
  background: transparent;
  border: none;
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-mode-toggle.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-refresh {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* Kanban Board - 5 Columns Fluid */
.kanban-board.kanban-5-cols {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  gap: 8px;
  align-items: start;
  transition: all 0.2s ease;
}

@media (max-width: 1200px) {
  .kanban-board.kanban-5-cols {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 800px) {
  .kanban-board.kanban-5-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 550px) {
  .kanban-board.kanban-5-cols {
    grid-template-columns: 1fr;
  }
}

.kanban-column {
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  display: flex;
  flex-direction: column;
  min-height: 480px;
  transition: all 0.2s ease;
  overflow: hidden;
}

.kanban-col-header {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.kanban-col-header.cyan { background: #cffafe; color: #0e7490; border-color: #a5f3fc; }
.kanban-col-header.amber { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.kanban-col-header.purple { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.kanban-col-header.green { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.kanban-col-header.gray { background: #e2e8f0; color: #334155; border-color: #cbd5e1; }

.col-count {
  background: white;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 800;
}

/* Collapsible Column */
.btn-collapse-col {
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 0.75rem;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
  transition: all 0.15s;
}

.btn-collapse-col:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

.kanban-column.collapsed {
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  flex: 0 0 38px !important;
}

.kanban-column.collapsed .kanban-cards-list {
  display: none !important;
}

.kanban-column.collapsed .kanban-col-header {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 12px 6px;
  height: 100%;
  min-height: 420px;
  justify-content: space-between;
  align-items: center;
}

.kanban-column.collapsed .kanban-col-header .col-title {
  white-space: nowrap;
  font-size: 0.76rem;
}

.kanban-column.collapsed .btn-collapse-col i {
  transform: rotate(180deg);
}

.kanban-cards-list {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

/* ==========================================================================
   ORDER KANBAN CARD (ALTA DENSIDAD Y CONTRASTE)
   ========================================================================== */

.order-card {
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  padding: 8px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.order-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: #0284c7;
}

/* Bordes de contraste por columna según estado */
#cards-enviado .order-card { border-left: 4px solid #0891b2; }
#cards-pendiente .order-card { border-left: 4px solid #d97706; }
#cards-preparando .order-card { border-left: 4px solid #9333ea; }
#cards-listo .order-card { border-left: 4px solid #16a34a; }
#cards-entregado .order-card { border-left: 4px solid #64748b; }

.order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.order-card-code {
  font-size: 0.82rem;
  font-weight: 800;
  color: #0284c7;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.order-card-time {
  font-size: 0.72rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.order-card-patient {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  margin: 1px 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.order-card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 2px 0 3px 0;
}

/* Pastillas de metadatos con contraste y colores vivos */
.chip-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.69rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.2;
}

.chip-meta.pami {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.chip-meta.recipes {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.chip-meta.seller {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.chip-meta.delivery {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
}

.chip-meta.branch {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.chip-meta.payment {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* Previsualización densa de medicamentos */
.order-card-items-preview.dense {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 0.73rem;
  color: #475569;
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.order-card-items-preview.dense strong {
  color: #0f172a;
  font-weight: 700;
}

/* Pie de tarjeta */
.order-card-bottom.dense {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed #e2e8f0;
  padding-top: 5px;
  margin-top: 3px;
}

.card-copay-amount {
  font-size: 0.92rem;
  font-weight: 800;
  color: #ea580c;
}

.card-btn-action {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.73rem;
  font-weight: 700;
  color: #1e293b;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-btn-action:hover {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
}

/* Semáforo de Inactividad */
.traffic-light-badge {
  font-size: 0.76rem;
  font-weight: 700;
  margin-top: 4px;
}

.traffic-light-badge.green {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.traffic-light-badge.amber {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.traffic-light-badge.red {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 800;
}

/* Sent / Visto Card Special Styles */
.badge-seen {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-seen.visto {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.badge-seen.no-visto {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.order-card-sent-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.btn-card-reminder {
  background: var(--whatsapp-light);
  color: var(--whatsapp-dark);
  border: 1px solid #86efac;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  justify-content: center;
  transition: all 0.15s;
  cursor: pointer;
}

.btn-card-reminder:hover {
  background: var(--whatsapp);
  color: white;
}

.btn-card-discard-text {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  cursor: pointer;
}

.btn-card-discard-text:hover {
  background: #ef4444;
  color: white;
}

.btn-discard-action {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  cursor: pointer;
}

.btn-discard-action:hover {
  background: #ef4444;
  color: white;
}

.badge-status-pill.enviado { background: #cffafe; color: #0e7490; }
.badge-status-pill.visto { background: #e0e7ff; color: #3730a3; }

/* Dense Table View (Alternative for High-Volume) */
.orders-table-view-container {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-top: 6px;
}

.orders-dense-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.orders-dense-table th {
  background: #f8fafc;
  padding: 8px 10px;
  font-weight: 800;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-medium);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.orders-dense-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.orders-dense-table tbody tr:hover {
  background: #f0f9ff;
  cursor: pointer;
}

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

.badge-status-table.enviado { background: #cffafe; color: #0e7490; }
.badge-status-table.pendiente { background: #fef3c7; color: #92400e; }
.badge-status-table.preparando { background: #f3e8ff; color: #6b21a8; }
.badge-status-table.listo { background: #dcfce7; color: #166534; }
.badge-status-table.entregado { background: #e2e8f0; color: #334155; }
.badge-status-table.programado { background: #e0f2fe; color: #0369a1; }
.badge-status-table.listo_envio { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.badge-status-table.en_camino { background: #dbeafe; color: #1d4ed8; }
.badge-status-table.llegando { background: #fef3c7; color: #b45309; }

/* Botón Recordatorio circular "R" en Modo Tabla */
.btn-table-reminder {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: var(--whatsapp-light);
  color: var(--whatsapp-dark);
  border: 1px solid #86efac;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-table-reminder:hover {
  background: var(--whatsapp);
  color: white;
  border-color: #16a34a;
  transform: scale(1.12);
}

/* ==========================================================================
   MODAL DE PICKING Y PREPARACIÓN
   ========================================================================== */

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

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-status-pill {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-status-pill.pendiente { background: #fef3c7; color: #92400e; }
.badge-status-pill.preparando { background: #f3e8ff; color: #6b21a8; }
.badge-status-pill.listo { background: #dcfce7; color: #166534; }
.badge-status-pill.entregado { background: #e2e8f0; color: #334155; }

.order-patient-banner {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.patient-primary-info h4 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.patient-submeta {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-whatsapp-sm {
  background: var(--whatsapp-light);
  color: var(--whatsapp-dark);
  border: 1px solid #86efac;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

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

/* Stepper Buttons */
.workflow-stepper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stepper-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.stepper-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

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

.step-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  padding: 8px 6px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.step-btn:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.step-btn.active {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* Picking Checklist */
.picking-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.picking-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
}

.picking-header h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}

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

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

.picking-item-row {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.picking-item-row:hover {
  background: #f1f5f9;
}

.picking-item-row.picked {
  background: #f0fdf4;
  border-color: #86efac;
}

.picking-item-row.picked .p-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.picking-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-medium);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: transparent;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: all 0.15s;
}

.picking-item-row.picked .picking-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.picking-details {
  flex: 1;
}

.picking-details .p-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.picking-details .p-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}

.picking-price {
  text-align: right;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Financial summary */
.order-financial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fin-box {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.fin-box.highlight {
  background: #fffbeb;
  border-color: #fde68a;
}

.fin-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.fin-value {
  font-size: 1.25rem;
  font-weight: 800;
}

.order-notes-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-notes-wrap label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.order-notes-wrap input {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  outline: none;
}

/* Modal Footer Actions */
.modal-footer-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-left-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-whatsapp-action {
  background: var(--whatsapp);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-whatsapp-action:hover {
  background: var(--whatsapp-dark);
}

.btn-print-action {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-print-action:hover {
  background: white;
  border-color: var(--text-main);
}

.btn-primary-action {
  background: var(--primary);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

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

/* ==========================================================================
   THERMAL PRINTABLE TICKET STYLES
   ========================================================================== */

.printable-ticket-container {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  
  #printable-ticket, #printable-ticket * {
    visibility: visible;
  }

  #printable-ticket {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.3;
    color: black;
    padding: 6px;
  }

  .ticket-header {
    text-align: center;
  }

  .ticket-header h3 {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 2px;
  }

  .ticket-header h4 {
    font-size: 15px;
    margin-top: 4px;
  }

  .ticket-divider {
    text-align: center;
    margin: 4px 0;
    overflow: hidden;
  }

  .ticket-items-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    border-bottom: 1px dashed black;
    padding-bottom: 2px;
  }

  .ticket-item-row {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
  }

  .ticket-totals {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .ticket-row {
    display: flex;
    justify-content: space-between;
  }

  .ticket-total-big {
    font-size: 14px;
    font-weight: bold;
  }

  .ticket-footer {
    text-align: center;
    margin-top: 6px;
    font-size: 10px;
  }
}

/* ==========================================================================
   MULTI-USUARIO, ROLES Y CAMBIO RÁPIDO POR PIN
   ========================================================================== */

.topbar-user-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--border-medium);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  z-index: 1000;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: dropdownIn 0.15s ease-out;
}

.user-profile-dropdown.hidden {
  display: none !important;
}

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

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
}

.dropdown-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dropdown-user-info strong {
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-handle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 0;
}

.dropdown-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.dropdown-item-btn:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.dropdown-item-btn.logout {
  color: #dc2626;
}

.dropdown-item-btn.logout:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.btn-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-user-pill:hover {
  border-color: var(--primary);
  background: white;
  transform: translateY(-1px);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.user-avatar.big {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.user-text-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.user-role-badge.vendedor { background: #e0f2fe; color: #0369a1; }
.user-role-badge.supervisor { background: #fef3c7; color: #92400e; }
.user-role-badge.admin { background: #f3e8ff; color: #6b21a8; }

.user-caret {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Seller Badges in Cards */
.badge-seller {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.seller-filter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 4px 10px;
}

.seller-filter-wrap i {
  color: #0284c7;
  font-size: 0.85rem;
}

.seller-filter-select {
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

/* Reassign in Modal */
.order-seller-reassign-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 10px;
}

.seller-reassign-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-seller-current {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.seller-reassign-controls {
  display: flex;
  gap: 8px;
}

.seller-select-field {
  flex: 1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  font-size: 0.84rem;
}

.btn-reassign-action {
  background: #0284c7;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-reassign-action:hover {
  background: #0369a1;
}

/* ==========================================================================
   PRODUCTIVITY VIEW & RANKING
   ========================================================================== */

.productivity-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.productivity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.prod-header-text h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.prod-header-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.productivity-actions {
  display: flex;
  gap: 8px;
}

/* Personal Performance Card */
.my-performance-card {
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.05);
}

.my-perf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid #dcfce7;
  padding-bottom: 10px;
}

.my-perf-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.my-perf-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #166534;
  letter-spacing: 0.5px;
}

.my-perf-user h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.my-perf-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 800px) {
  .my-perf-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.perf-stat-box {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.text-emerald { color: #059669; }
.text-blue { color: #0284c7; }
.text-purple { color: #7c3aed; }
.text-amber { color: #d97706; }

/* Ranking Table */
.team-ranking-section {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ranking-header {
  margin-bottom: 14px;
}

.ranking-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.ranking-table-responsive {
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ranking-table th {
  background: #f8fafc;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-medium);
  font-size: 0.8rem;
}

.ranking-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.ranking-table tbody tr:hover {
  background: #f8fafc;
}

.ranking-table tfoot td {
  padding: 12px;
  background: #f1f5f9;
  font-weight: 800;
  border-top: 2px solid var(--border-medium);
}

.medal-pos {
  font-size: 1.1rem;
}

/* User Management Grid */
.user-management-section {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.user-mgmt-header {
  margin-bottom: 14px;
}

.user-mgmt-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-mgmt-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.user-mgmt-card {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.user-mgmt-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.user-mgmt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-mgmt-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-mgmt-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-mgmt-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-mgmt-handle {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
}

.user-mgmt-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.btn-card-action {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-card-action.edit:hover {
  color: #0284c7;
  border-color: #38bdf8;
  background: #f0f9ff;
}

.btn-card-action.danger {
  color: #dc2626;
}

.btn-card-action.danger:hover {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fef2f2;
}

.btn-card-action.activate {
  color: #16a34a;
}

.btn-card-action.activate:hover {
  color: #15803d;
  border-color: #86efac;
  background: #f0fdf4;
}

.status-badge-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-badge-pill.active {
  background: #dcfce7;
  color: #15803d;
}

.status-badge-pill.inactive {
  background: #fee2e2;
  color: #b91c1c;
}

/* ==========================================================================
   PANTALLA DE ACCESO AL PORTAL (LOGIN SCREEN)
   ========================================================================== */

.portal-login-screen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: radial-gradient(circle at top center, #0f3d32 0%, #081d17 60%, #030a08 100%);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: loginFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-login-screen.hidden {
  display: none !important;
}

body.portal-locked {
  overflow: hidden !important;
  height: 100vh !important;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.login-box-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.login-card-header {
  background: linear-gradient(135deg, #0d7a5f, #085542);
  color: white;
  padding: 32px 28px 24px;
  text-align: center;
  position: relative;
}

.login-logo-circle {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  color: white;
  margin: 0 auto 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.login-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  color: #ffffff;
}

.login-subtitle {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  margin-bottom: 12px;
}

.login-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #bbf7d0;
}

.login-card-body {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group-login {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-group-login label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group-login label i {
  color: #0d7a5f;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-wrap .input-icon-left {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 0.95rem;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  transition: all 0.2s ease;
}

.login-input:focus {
  outline: none;
  border-color: #0d7a5f;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(13, 122, 95, 0.12);
}

.btn-toggle-pass-visibility {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  border-radius: 6px;
  transition: color 0.15s;
}

.btn-toggle-pass-visibility:hover {
  color: #0d7a5f;
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #64748b;
}

.login-remember-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.login-remember-checkbox input[type="checkbox"] {
  accent-color: #0d7a5f;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.login-error-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  animation: shakeAlert 0.3s ease;
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-error-alert.hidden {
  display: none !important;
}

.btn-login-submit {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #0d7a5f, #0a634d);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(13, 122, 95, 0.3);
}

.btn-login-submit:hover {
  background: linear-gradient(135deg, #0f8e6e, #0d7a5f);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(13, 122, 95, 0.4);
}

.btn-login-submit:active {
  transform: translateY(0);
}

.login-footer-hint {
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 4px;
}

/* ==========================================================================
   PIN MODAL & NUMERIC KEYPAD
   ========================================================================== */

.pin-user-dropdown-wrap {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-user-styled-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.select-user-styled-wrap .select-icon {
  position: absolute;
  left: 14px;
  color: #0284c7;
  font-size: 1.1rem;
  pointer-events: none;
}

.user-select-dropdown {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  background: #f8fafc;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.user-select-dropdown:focus {
  border-color: #0284c7;
  background: white;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.user-select-dropdown option {
  padding: 8px;
  font-size: 0.95rem;
}

.pin-display-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
}

#pin-input-field {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: 12px;
  padding: 10px 14px 10px 24px; /* 24px left padding offsets the 12px letter-spacing to center dots */
  border-radius: var(--radius-md);
  border: 2px solid var(--border-medium);
  background: #f8fafc;
  font-weight: 800;
  outline: none;
  color: var(--text-main);
  transition: all 0.15s ease;
}

#pin-input-field:focus {
  border-color: #0284c7;
  background: white;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-pin-clear {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-pin-clear:hover {
  background: #ef4444;
  color: white;
}

.pin-error-msg {
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
}

.numeric-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.keypad-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  padding: 14px 0;
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}

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

.keypad-btn.secondary {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.keypad-btn.primary {
  background: #0284c7;
  color: white;
  border-color: #0369a1;
}

.keypad-btn.primary:hover {
  background: #0369a1;
}

.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-styled {
  padding: 10px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
}

.input-styled:focus {
  border-color: var(--primary);
}

/* ==========================================================================
   CONFIGURACIÓN DEL SISTEMA & EDITOR DE WHATSAPP (SOLO ADMIN)
   ========================================================================== */

.settings-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: white;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.settings-header-text h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.settings-header-text p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.badge-role-pill.admin {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Sub-Pestañas de Configuración */
.settings-subtabs-nav {
  display: flex;
  gap: 12px;
  margin: 18px 0 22px 0;
  border-bottom: 2px solid var(--border-medium);
  padding-bottom: 2px;
}

.settings-subtab-btn {
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-bottom: 3px solid transparent;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  margin-bottom: -2px;
}

.settings-subtab-btn:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.settings-subtab-btn.active {
  color: #0284c7;
  border-color: var(--border-medium);
  border-bottom-color: #0284c7;
  background: white;
  font-weight: 800;
}

.settings-subview {
  display: none;
}

.settings-subview.active {
  display: block;
}

.settings-system-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
}

.settings-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 400px);
  gap: 24px;
  align-items: start;
}

.settings-col-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: #f8fafc;
}

.settings-card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.settings-card-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.card-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.card-header-icon.blue {
  background: #e0f2fe;
  color: #0284c7;
}

.card-header-icon.green {
  background: #dcfce7;
  color: #16a34a;
}

.settings-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.domain-input-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input-with-icon {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.input-with-icon input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
}

.input-with-icon input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-secondary-action {
  background: #f1f5f9;
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  padding: 9px 15px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-secondary-action:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-primary-action {
  background: #0284c7;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.btn-primary-action:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.settings-help-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Template Selector Tabs */
.msg-template-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 6px 12px 0 12px;
  border-bottom: 1px solid var(--border-light);
  gap: 6px;
  overflow-x: auto;
}

.msg-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}

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

.msg-tab-btn.active {
  color: #16a34a;
  border-bottom-color: #16a34a;
  background: white;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-group-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 2px;
}

.tool-btn {
  width: 30px;
  height: 30px;
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-main);
  transition: all 0.1s;
}

.tool-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.tool-btn:active {
  transform: scale(0.92);
}

.emoji-group {
  flex-wrap: wrap;
  gap: 3px;
}

.emoji-btn {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  padding: 3px 6px;
  cursor: pointer;
  transition: all 0.1s;
}

.emoji-btn:hover {
  background: #f1f5f9;
  transform: scale(1.18);
}

/* Variable Insertion Chips */
.variables-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.variables-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: #0284c7;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
}

.variables-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.var-chip {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s;
}

.var-chip:hover {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
  transform: translateY(-1px);
}

.var-chip:active {
  transform: scale(0.95);
}

.editor-textarea-wrap {
  position: relative;
}

.settings-textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 180px;
  outline: none;
  transition: all 0.15s;
  color: var(--text-main);
  background: white;
}

.settings-textarea:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.editor-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

/* ==========================================================================
   WHATSAPP SMARTPHONE MOCKUP PREVIEW
   ========================================================================== */

.settings-col-preview {
  position: relative;
}

.wa-preview-sticky {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-header-title h4 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-header-title span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.wa-smartphone-mockup {
  background: #111827;
  border-radius: 36px;
  padding: 10px;
  box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.35), 0 0 0 2px #374151;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: 380px;
  margin: 0 auto;
}

.phone-notch {
  height: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: #111827;
}

.notch-speaker {
  width: 44px;
  height: 4px;
  background: #374151;
  border-radius: 4px;
}

.notch-camera {
  width: 6px;
  height: 6px;
  background: #1f2937;
  border-radius: 50%;
}

.wa-app-header {
  background: #075e54;
  color: white;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.wa-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.wa-header-meta {
  display: flex;
  flex-direction: column;
}

.wa-header-meta strong {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
}

.wa-status-text {
  font-size: 0.68rem;
  color: #a7f3d0;
}

.wa-header-icons {
  display: flex;
  gap: 12px;
  font-size: 0.88rem;
  color: #e2e8f0;
}

.wa-chat-canvas {
  background-color: #efeae2;
  background-image: radial-gradient(#d1d7db 1px, transparent 1px);
  background-size: 16px 16px;
  padding: 16px 10px;
  min-height: 300px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wa-chat-date-pill {
  align-self: center;
  background: rgba(255, 255, 255, 0.9);
  color: #54656f;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
}

.wa-bubble {
  max-width: 92%;
  padding: 8px 10px 4px 10px;
  border-radius: 8px;
  font-size: 0.83rem;
  line-height: 1.42;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  word-break: break-word;
}

.wa-bubble-sent {
  align-self: flex-end;
  background: #d9fdd3;
  color: #111b21;
  border-top-right-radius: 2px;
}

.wa-bubble-sent::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 10px solid #d9fdd3;
  border-right: 10px solid transparent;
}

.wa-bubble-content {
  white-space: pre-wrap;
}

.wa-bubble-content b,
.wa-bubble-content strong {
  font-weight: 800;
}

.wa-bubble-content i,
.wa-bubble-content em {
  font-style: italic;
}

.wa-bubble-content del,
.wa-bubble-content s {
  text-decoration: line-through;
}

.wa-bubble-content code {
  font-family: 'Courier New', Courier, monospace;
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.78rem;
}

.wa-bubble-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}

.wa-time {
  font-size: 0.65rem;
  color: #667781;
}

.wa-checks.double-blue {
  color: #53bdeb;
  font-size: 0.72rem;
}

.wa-chat-footer {
  background: #f0f2f5;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-input-fake {
  flex: 1;
  background: white;
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #8696a0;
}

.wa-input-fake i {
  color: #8696a0;
  font-size: 0.95rem;
}

.wa-mic-btn {
  width: 32px;
  height: 32px;
  background: #00a884;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.preview-context-note {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.76rem;
  color: #1e40af;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.preview-context-note code {
  background: #dbeafe;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 960px) {
  .settings-layout-grid {
    grid-template-columns: 1fr;
  }

  .wa-preview-sticky {
    position: static;
  }
}

@media (max-width: 600px) {
  .topbar-container {
    padding: 10px 14px;
  }

  .brand-title {
    font-size: 1rem;
  }

  .main-layout {
    padding: 14px 10px 110px 10px;
  }

  .patient-name {
    font-size: 1.35rem;
  }

  .med-item {
    padding: 14px;
    gap: 12px;
  }

  .med-name {
    font-size: 1rem;
  }

  .summary-total .amount {
    font-size: 1.25rem;
  }

  .btn-confirm-order {
    padding: 12px 14px;
    font-size: 0.92rem;
  }
}

/* ==========================================================================
   WHATSAPP RECEPTION LINES MANAGEMENT (SETTINGS)
   ========================================================================== */

.card-header-title-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.wa-lines-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wa-line-card {
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.15s ease;
}

.wa-line-card:hover {
  border-color: #0284c7;
  background: #f0fdf4;
}

.wa-line-card.default-line {
  border-color: #86efac;
  background: #f0fdf4;
}

.wa-line-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.wa-line-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-line-title-row strong {
  font-size: 0.95rem;
  color: var(--text-main);
}

.wa-line-badge-default {
  background: #dcfce7;
  color: #15803d;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid #bbf7d0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wa-line-num {
  font-size: 1rem;
  font-weight: 800;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wa-line-users-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.wa-users-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.wa-user-tag {
  background: #e2e8f0;
  color: #1e293b;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wa-user-tag.admin {
  background: #ede9fe;
  color: #6d28d9;
}

.wa-line-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-action {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: white;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.btn-icon-action:hover {
  background: #f1f5f9;
  color: #0284c7;
  border-color: #0284c7;
}

.btn-icon-action.danger:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-icon-action.star-default {
  color: #f59e0b;
}

.btn-icon-action.star-default:hover {
  background: #fef3c7;
}

.linea-users-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.user-checkbox-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}

.user-checkbox-card:hover {
  border-color: #0284c7;
  background: #f0f9ff;
}

.user-checkbox-card input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #0284c7;
}

.form-group-checkbox {
  margin: 12px 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #16a34a;
  cursor: pointer;
}

/* ==========================================================================
   PATIENT DELIVERY OPTIONS & SCHEDULING
   ========================================================================== */

.patient-delivery-options-box {
  margin: 16px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
}

.delivery-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 12px 0;
}

@media (max-width: 480px) {
  .delivery-type-selector {
    grid-template-columns: 1fr;
  }
}

.delivery-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
}

.delivery-option-btn input[type="radio"] {
  display: none;
}

.delivery-option-btn.active {
  border-color: #0284c7;
  background: #f0f9ff;
}

.option-btn-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.option-btn-content i {
  font-size: 1.3rem;
  color: #0284c7;
  flex-shrink: 0;
}

.option-text-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.option-text-wrap strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.option-text-wrap span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Selector de Sucursales en Vista Paciente */
.patient-pickup-branch-container {
  background: white;
  padding: 12px 14px;
  border: 1.5px solid #7dd3fc;
  border-radius: var(--radius-md);
  margin-top: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.branch-select-field {
  font-weight: 600;
  color: var(--text-main);
  background: #f8fafc;
  border: 1.5px solid #0284c7;
  cursor: pointer;
  width: 100%;
}

.pickup-branch-details-box {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f0f9ff;
  border-radius: var(--radius-sm);
  border: 1px dashed #7dd3fc;
  font-size: 0.8rem;
  color: #0369a1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pickup-branch-details-box strong {
  color: #0c4a6e;
}

.patient-delivery-extra-fields {
  background: white;
  padding: 12px 14px;
  border: 1.5px dashed #0284c7;
  border-radius: var(--radius-md);
  margin-top: 8px;
}

/* Fila de Fecha y Horario: Responsiva y sin desbordamiento */
.delivery-datetime-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 520px) {
  .delivery-datetime-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.delivery-datetime-row .form-group {
  margin-bottom: 0;
  min-width: 0;
}

.delivery-datetime-row label {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delivery-datetime-row .input-styled {
  width: 100%;
  min-width: 0;
  font-size: 0.82rem;
  padding: 7px 8px;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Card Sucursales en Configuración */
.sucursales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.sucursal-card {
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all 0.15s ease;
}

.sucursal-card:hover {
  border-color: #9333ea;
  background: white;
  box-shadow: var(--shadow-sm);
}

.sucursal-card.is-default {
  border-color: #a855f7;
  background: #faf5ff;
}

.sucursal-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sucursal-card-header h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sucursal-card-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sucursal-card-body span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sucursal-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-medium);
}

.btn-sucursal-action {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border-medium);
  background: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-sucursal-action:hover {
  background: #f1f5f9;
}

.btn-sucursal-action.delete {
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-sucursal-action.delete:hover {
  background: #fef2f2;
}

.btn-sucursal-action.set-default {
  color: #9333ea;
  border-color: #d8b4fe;
}

.btn-sucursal-action.set-default:hover {
  background: #faf5ff;
}

.sucursal-badge-default {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   ORDER DETAIL DELIVERY BANNER & STEPPER
   ========================================================================== */

.order-delivery-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f1f5f9;
  border: 1px solid var(--border-medium);
}

.order-delivery-banner.domicilio {
  background: #faf5ff;
  border-color: #d8b4fe;
}

.order-delivery-banner.mostrador {
  background: #f0fdf4;
  border-color: #86efac;
}

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

.delivery-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.delivery-banner-icon.domicilio {
  background: #9333ea;
  color: white;
}

.delivery-banner-icon.mostrador {
  background: #16a34a;
  color: white;
}

.delivery-banner-meta strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-main);
}

.delivery-banner-meta span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.btn-whatsapp-action.delivery {
  background: #9333ea;
  border-color: #7e22ce;
  color: white;
}

.btn-whatsapp-action.delivery:hover {
  background: #7e22ce;
}

/* ==========================================================================
   DISPATCH DASHBOARD & LOGISTICS BOARD (OPTIMIZADO)
   ========================================================================== */

.dispatch-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

.dispatch-title-wrap {
  display: flex;
  flex-direction: column;
}

.dispatch-title-wrap h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 2px 0;
}

.dispatch-title-wrap p {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0;
}

.dispatch-header-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dispatch-ribbon {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px 14px;
}

.dispatch-filters-bar.dense {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.dispatch-filters-bar.dense .search-box {
  flex: 1 1 200px;
  min-width: 180px;
  max-width: 280px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

.dispatch-filters-bar.dense .search-box input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-main);
  outline: none;
}

.dispatch-date-navigator {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
}

.btn-quick-date {
  background: transparent;
  border: none;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-quick-date.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dispatch-group-toggle {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
}

.filter-item {
  display: flex;
  align-items: center;
}

.dispatch-select-filter {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  background: #f8fafc;
  cursor: pointer;
}

.dispatch-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  align-items: start;
}

.dispatch-slot-column {
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dispatch-slot-header {
  padding: 8px 12px;
  background: #e2e8f0;
  border-bottom: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dispatch-slot-header h3 {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.slot-count-badge {
  background: white;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.dispatch-slot-cards-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

.dispatch-order-card {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
}

.dispatch-order-card:hover {
  border-color: #9333ea;
  box-shadow: var(--shadow-sm);
}

.dispatch-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
}

.dispatch-card-patient strong {
  font-size: 0.86rem;
  color: var(--text-main);
  display: block;
}

.dispatch-card-address {
  font-size: 0.76rem;
  color: #334155;
  background: #f1f5f9;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.25;
}

.dispatch-card-address i {
  color: #ef4444;
  margin-top: 2px;
  font-size: 0.75rem;
}

.dispatch-card-money {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  padding: 3px 0;
  border-top: 1px dashed var(--border-subtle);
  border-bottom: 1px dashed var(--border-subtle);
}

.dispatch-card-money .amount {
  font-weight: 800;
  color: #ea580c;
  font-size: 0.88rem;
}

.dispatch-card-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.cadete-select-sm {
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: white;
  flex: 1;
}

.cadete-status-btn {
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  cursor: pointer;
}

.cadete-status-btn.programado { background: #f1f5f9; color: #475569; }
.cadete-status-btn.listo_envio { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.cadete-status-btn.en_camino { background: #f3e8ff; color: #7e22ce; border-color: #e9d5ff; }
.cadete-status-btn.llegando { background: #fef3c7; color: #b45309; border-color: #fde68a; font-weight: 800; }
.cadete-status-btn.entregado { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }

/* ==========================================================================
   FORMAS DE PAGO: VISTA PACIENTE Y CONFIGURACIÓN ADMIN
   ========================================================================== */

/* 3-Action Footer en Modal Confirmar */
.modal-footer-three-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

@media (max-width: 600px) {
  .modal-footer-three-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.btn-payment-action {
  background: #f8fafc;
  border: 1.5px solid #0284c7;
  color: #0284c7;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-payment-action:hover {
  background: #e0f2fe;
  border-color: #0369a1;
  color: #0369a1;
}

.btn-payment-action.completed {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
}

.btn-payment-action.attention {
  background: #fff7ed;
  border-color: #ea580c;
  color: #c2410c;
  animation: bounceBorder 1s infinite alternate;
}

@keyframes bounceBorder {
  from { border-color: #ea580c; box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4); }
  to { border-color: #f97316; box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.15); }
}

.btn-whatsapp-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Alerta de modificación de importes en modal confirm */
.patient-payment-mismatch-alert {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
}

.patient-payment-mismatch-alert i {
  color: #d97706;
  font-size: 1.25rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.patient-payment-mismatch-alert strong {
  display: block;
  font-size: 0.9rem;
  color: #92400e;
}

.patient-payment-mismatch-alert p {
  margin-top: 3px;
  color: #78350f;
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Resumen de medios de pago en modal confirm */
.patient-payment-summary-box {
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 14px;
}

.payment-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.btn-link-edit {
  background: none;
  border: none;
  color: #0284c7;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

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

.payment-summary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payment-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  background: white;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* Modal de Formas de Pago del Paciente */
.modal-dialog-md {
  max-width: 580px;
}

.payment-balance-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: #f1f5f9;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

@media (max-width: 480px) {
  .payment-balance-card {
    grid-template-columns: 1fr;
  }
}

.balance-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: white;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.balance-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.balance-val {
  font-size: 1rem;
  font-weight: 800;
  margin-top: 2px;
}

.balance-val.total { color: var(--text-main); }
.balance-val.assigned { color: #16a34a; }
.balance-val.remaining { color: #dc2626; }
.balance-val.remaining.zero { color: #16a34a; }

.payment-add-card {
  background: #ffffff;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.payment-amount-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.payment-fast-btn-wrap {
  margin-bottom: 0;
}

.btn-fast-full {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-fast-full:hover {
  background: #dbeafe;
  border-color: #60a5fa;
}

.payment-items-section {
  margin-bottom: 14px;
}

.pay-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

.pay-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.pay-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pay-item-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pay-item-extra {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pay-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pay-item-amount {
  font-size: 0.95rem;
  font-weight: 800;
  color: #16a34a;
}

.btn-delete-pay-item {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.btn-delete-pay-item:hover {
  background: #fee2e2;
}

.pay-status-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
}

.pay-status-alert.info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.pay-status-alert.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.pay-status-alert.warning {
  background: #fffbeb;
  border: 1px solid #fef08a;
  color: #b45309;
}

/* Formas de Pago en Configuración */
.formas-pago-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.forma-pago-card {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s;
}

.forma-pago-card.inactive {
  opacity: 0.6;
  background: #f8fafc;
}

.forma-pago-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.forma-pago-card-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.forma-pago-card-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forma-pago-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: auto;
}

.badge-tipo-pago {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #475569;
}

/* Switch Toggle */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 20px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

.switch-toggle input:checked + .slider-round {
  background-color: #10b981;
}

.switch-toggle input:checked + .slider-round:before {
  transform: translateX(16px);
}

/* ==========================================================================
   CADETES MANAGEMENT & PHOTO UPLOAD (CONFIGURACIÓN)
   ========================================================================== */

.cadetes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.cadete-card {
  background: white;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.cadete-card:hover {
  border-color: #c084fc;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.08);
}

.cadete-card.inactive {
  opacity: 0.6;
  background: #f8fafc;
}

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

.cadete-avatar-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #e9d5ff;
  background: #f3e8ff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cadete-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.cadete-avatar-wrap .avatar-fallback {
  font-size: 1.35rem;
  color: #7e22ce;
}

.cadete-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  background: #10b981;
}

.cadete-card.inactive .cadete-status-dot {
  background: #94a3b8;
}

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

.cadete-card-info h4 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cadete-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge-vehiculo {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f3e8ff;
  color: #7e22ce;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-patente {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-family: monospace;
}

.cadete-card-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fafafa;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

.cadete-meta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cadete-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #25d366;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.cadete-wa-btn:hover {
  opacity: 0.9;
}

.cadete-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: auto;
}

/* Modal Photo Upload UI */
.cadete-photo-upload-group {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 14px;
}

.cadete-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #c084fc;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(147, 51, 234, 0.12);
}

.cadete-preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cadete-preview-placeholder {
  font-size: 1.8rem;
  color: #a855f7;
}

.cadete-photo-upload-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cadete-upload-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.cadete-upload-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cadete-upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

@media (max-width: 480px) {
  .form-row-2col {
    grid-template-columns: 1fr;
  }
}

/* ==================== CADETE PERSONAL ACCESS & QR MODAL ==================== */
.cadete-access-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cadete-access-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.cadete-token-chip {
  font-family: monospace;
  font-size: 0.75rem;
  background: #ede9fe;
  color: #7c3aed;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.cadete-access-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-cadete-access-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-cadete-access-btn.wa {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}
.btn-cadete-access-btn.wa:hover {
  background: #d1fae5;
  color: #047857;
}

.btn-cadete-access-btn.qr {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #7c3aed;
}
.btn-cadete-access-btn.qr:hover {
  background: #ede9fe;
  color: #6d28d9;
}

.btn-cadete-access-btn.copy {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
.btn-cadete-access-btn.copy:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-cadete-access-btn.regen {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}
.btn-cadete-access-btn.regen:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.cadete-qr-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.cadete-qr-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: #ede9fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  color: #7c3aed;
  border: 2px solid #ddd6fe;
}

.cadete-qr-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cadete-qr-box-inner {
  padding: 14px;
  background: #ffffff;
  border-radius: 16px;
  border: 2px dashed #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: inline-block;
}

.btn-link-danger {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 6px 10px;
  font-weight: 600;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-link-danger:hover {
  background: #fee2e2;
}

/* ==================== PRODUCTIVITY & LOGISTICS METRICS TABS ==================== */
.prod-subtabs-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
}

.prod-subtab-btn {
  background: white;
  border: 1px solid #cbd5e1;
  color: var(--text-muted);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.prod-subtab-btn:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #94a3b8;
}

.prod-subtab-btn.active {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
}

/* Commercial Funnel Card */
.commercial-funnel-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.funnel-card-header h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.funnel-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.funnel-steps-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.funnel-step-box {
  flex: 1;
  min-width: 160px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.funnel-step-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.funnel-step-icon.blue { background: #eff6ff; color: #2563eb; }
.funnel-step-icon.cyan { background: #ecfeff; color: #0891b2; }
.funnel-step-icon.emerald { background: #ecfdf5; color: #059669; }
.funnel-step-icon.purple { background: #f5f3ff; color: #7c3aed; }

.funnel-step-content {
  display: flex;
  flex-direction: column;
}

.funnel-step-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.funnel-step-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin: 2px 0;
}

.funnel-step-meta {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
}

.funnel-arrow {
  color: #94a3b8;
  font-size: 1.1rem;
}

/* Logistics KPIs */
.logistics-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.logistics-kpi-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.logistics-kpi-card.highlight-cash {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.kpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.kpi-icon-wrap.purple { background: #f5f3ff; color: #7c3aed; }
.kpi-icon-wrap.blue { background: #eff6ff; color: #2563eb; }
.kpi-icon-wrap.emerald { background: #ecfdf5; color: #059669; }
.kpi-icon-wrap.green { background: #dcfce7; color: #16a34a; }

.kpi-body {
  flex: 1;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
}

.kpi-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}

.kpi-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-tag-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}
.kpi-tag-badge.fast { background: #ecfdf5; color: #059669; }

.kpi-subtext {
  font-size: 0.72rem;
  color: #94a3b8;
  display: block;
}

/* Speed badge for cadete ranking */
.cadete-speed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.cadete-speed-badge.fast { background: #dcfce7; color: #15803d; }
.cadete-speed-badge.normal { background: #fef9c3; color: #854d0e; }
.cadete-speed-badge.slow { background: #fee2e2; color: #b91c1c; }

/* Lifecycle Funnel Card */
.lifecycle-funnel-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.cycle-total-badge {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.84rem;
}

.lifecycle-steps-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.lifecycle-step-box {
  flex: 1;
  min-width: 125px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.lifecycle-step-box .step-num {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.lifecycle-step-box .step-icon {
  font-size: 1.2rem;
  color: #6366f1;
  margin: 2px 0;
}

.lifecycle-step-box .step-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.step-delta-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: #e2e8f0;
  color: #475569;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
}
.step-delta-badge.delivered {
  background: #bbf7d0;
  color: #166534;
}

.lifecycle-connector {
  width: 16px;
  height: 2px;
  background: #cbd5e1;
  flex-shrink: 0;
}

/* Order Timeline in Modal */
.order-timeline-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 14px;
}

.timeline-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.timeline-total-badge {
  font-size: 0.78rem;
  font-weight: 700;
  background: #ede9fe;
  color: #7c3aed;
  padding: 2px 8px;
  border-radius: 4px;
}

.timeline-flow-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  padding-left: 8px;
}

.timeline-step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.timeline-step-row::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 18px;
  bottom: -12px;
  width: 2px;
  background: #e2e8f0;
}

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

.timeline-step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #64748b;
  flex-shrink: 0;
  z-index: 1;
}

.timeline-step-dot.active {
  background: #10b981;
  box-shadow: 0 0 0 2px #10b981;
  color: white;
}

.timeline-step-dot.current {
  background: #3b82f6;
  box-shadow: 0 0 0 2px #3b82f6;
  color: white;
}

.timeline-step-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.timeline-step-title {
  font-weight: 700;
  color: var(--text-main);
}

.timeline-step-time {
  font-family: monospace;
  font-size: 0.78rem;
  color: #64748b;
}

.timeline-step-diff {
  font-size: 0.72rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

/* ==========================================================================
   PERIOD FILTERS TOOLBAR & PRINT STYLES
   ========================================================================== */

.prod-filters-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

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

.prod-filter-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.prod-period-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.prod-period-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.prod-period-pill:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.prod-period-pill.active {
  background: var(--primary, #0284c7);
  border-color: var(--primary, #0284c7);
  color: white;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.prod-custom-range-box {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 4px 10px;
  margin-left: 6px;
}

.prod-custom-range-box.hidden {
  display: none;
}

.custom-range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #64748b;
}

.input-date-sm {
  padding: 3px 8px;
  font-size: 0.78rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.76rem;
  border-radius: 6px;
}

.prod-filters-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.prod-period-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #bae6fd;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-outline-print {
  background: white;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-outline-print:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Print Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt !important;
  }

  /* Hide navigation, toolbars, buttons and modals when printing */
  .top-navbar,
  .main-nav,
  .prod-subtabs-nav,
  .prod-filters-toolbar,
  .productivity-actions,
  .modal-backdrop,
  .toast,
  .admin-only,
  button {
    display: none !important;
  }

  .view-section {
    display: none !important;
  }

  #view-productivity {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .prod-subview {
    display: block !important;
    page-break-inside: avoid;
    margin-bottom: 25px;
  }

  .productivity-header {
    border-bottom: 2px solid #333;
    padding-bottom: 12px;
    margin-bottom: 18px;
  }

  .ranking-table-responsive {
    overflow: visible !important;
  }

  .ranking-table th, 
  .ranking-table td {
    border: 1px solid #ddd !important;
    padding: 6px 8px !important;
  }

  .commercial-funnel-card,
  .my-performance-card,
  .logistics-kpis-grid,
  .lifecycle-funnel-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   DATABASE & BACKUPS MANAGEMENT STYLES
   ========================================================================== */

.db-import-export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .db-import-export-grid {
    grid-template-columns: 1fr;
  }
}

.db-dropzone-container {
  display: flex;
  flex-direction: column;
}

.db-dropzone {
  border: 2px dashed #93c5fd;
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  background: #f0f9ff;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.db-dropzone:hover,
.db-dropzone.dragover {
  border-color: #0284c7;
  background: #e0f2fe;
}

.db-drop-icon {
  font-size: 2.5rem;
  color: #0284c7;
  margin-bottom: 12px;
}

.db-dropzone h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.db-dropzone p {
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 14px;
}

.db-maintenance-card {
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  background: #fffaf5;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.db-maintenance-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.maint-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #ffedd5;
  color: #ea580c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.db-maintenance-header h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #9a3412;
  margin: 0;
}

.db-maintenance-header p {
  font-size: 0.78rem;
  color: #c2410c;
  margin: 0;
}

.maint-checklist {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: #475569;
  background: rgba(255, 255, 255, 0.7);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #fed7aa;
}

.maint-checklist span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.backup-config-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 18px;
  align-items: center;
}

@media (max-width: 850px) {
  .backup-config-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.config-toggle-box {
  display: flex;
  align-items: center;
}

.toggle-switch-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch-label input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.toggle-switch-slider {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  background-color: #cbd5e1;
  border-radius: 26px;
  transition: .3s;
  flex-shrink: 0;
}

.toggle-switch-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch-label input:checked + .toggle-switch-slider {
  background-color: var(--primary);
}

.toggle-switch-label input:checked + .toggle-switch-slider:before {
  transform: translateX(22px);
}

.toggle-switch-text strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
}

.toggle-switch-text small {
  display: block;
  font-size: 0.77rem;
  color: var(--text-muted);
}

.badge-backup-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-backup-type.auto {
  background: #dcfce7;
  color: #15803d;
}

.badge-backup-type.manual {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-backup-type.pre_reset {
  background: #fef3c7;
  color: #b45309;
}

.badge-backup-type.pre_import {
  background: #f3e8ff;
  color: #7e22ce;
}

.badge-backup-type.pre_restore {
  background: #f1f5f9;
  color: #475569;
}

.btn-table-action-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.15s ease;
  border: 1px solid var(--border-medium);
  background: white;
  color: var(--text-secondary);
}

.btn-table-action-sm:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #94a3b8;
}

.btn-table-action-sm.primary {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-table-action-sm.primary:hover {
  background: var(--primary);
  color: white;
}

.btn-table-action-sm.restore {
  background: #f3e8ff;
  border-color: #d8b4fe;
  color: #7e22ce;
}

.btn-table-action-sm.restore:hover {
  background: #7e22ce;
  color: white;
}

.btn-table-action-sm.danger {
  color: #dc2626;
  border-color: #fecaca;
}

.btn-table-action-sm.danger:hover {
  background: #fee2e2;
  border-color: #f87171;
}
