/*
 * MedixoApp — main stylesheet
 * Compiled by Sprockets. Do NOT add @import rules here.

 */

/* ── MedixoApp Design System ── */
:root {
  --mx-primary:     #14b8a6;
  --mx-primary-dk:  #0d9488;
  --mx-primary-lt:  #2dd4bf;
  --mx-accent:      #22c55e;
  --mx-dark:        #0f172a;
  --mx-sidebar-bg1: #071c18;
  --mx-sidebar-bg2: #0f172a;
  --mx-muted:       #64748b;
  --mx-border:      #e2e8f0;
  --mx-bg:          #f4f7fb;
  --mx-card-bg:     #ffffff;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--mx-bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--mx-dark);
  overflow-x: hidden;
}

body.sidebar-open { overflow: hidden; }

/* ── App shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Brand mark ── */
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--mx-primary-dk) 0%, var(--mx-primary) 100%);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.30);
  flex-shrink: 0;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--mx-sidebar-bg1) 0%, var(--mx-sidebar-bg2) 100%);
  padding: 28px 18px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2rem;
  text-decoration: none;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.sidebar-brand-name {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.sidebar-brand-sub {
  color: var(--mx-primary-lt);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-clinic-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 0 0 16px;
}

.sidebar-clinic-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.4rem;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  min-width: 0;
}

.sidebar-clinic-name {
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-clinic-subtitle {
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 500;
  margin-top: 1px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
  background: white;
  padding: 2px;
  flex-shrink: 0;
}

.sidebar a {
  color: #cbd5e1;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 4px;
  font-size: 0.97rem;
  font-weight: 500;
  transition: 0.22s ease;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar a:hover,
.sidebar a.active {
  background: linear-gradient(135deg, var(--mx-primary-dk) 0%, var(--mx-primary) 100%);
  color: white;
  box-shadow: 0 5px 14px rgba(20, 184, 166, 0.20);
}

/* ── Mobile sidebar controls ── */
.sidebar-toggle,
.sidebar-close,
.sidebar-backdrop {
  display: none;
}

.sidebar-toggle,
.sidebar-close {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: white;
  color: var(--mx-dark);
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  cursor: pointer;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

/* ── Topbar ── */
.topbar {
  background: rgba(255,255,255,0.97);
  border-bottom: 1px solid var(--mx-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  flex-wrap: wrap;
}

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

.topbar-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--mx-dark);
  white-space: nowrap;
}

.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--mx-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.topbar-user-email {
  font-weight: 600;
  font-size: 0.88rem;
  color: #334155;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Locale links ── */
.locale-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: white;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.18s ease;
}

.locale-link.active {
  background: var(--mx-primary);
  border-color: var(--mx-primary);
  color: white;
}

.clinic-navbar-logo {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 9px;
  border: 2px solid var(--mx-border);
  background: white;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

/* ── Page shell ── */
.page-shell {
  padding: 28px 28px 40px;
}

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

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

.page-title {
  font-size: 1.9rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.6px;
  color: var(--mx-dark);
}

.page-subtitle {
  color: var(--mx-muted);
  margin-top: 5px;
  font-size: 0.95rem;
}

/* ── Cards ── */
.stat-card,
.content-card,
.form-card {
  border: none;
  border-radius: 20px;
  background: var(--mx-card-bg);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
  padding: 24px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.stat-card:hover,
.content-card:hover,
.form-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.10);
}

.stat-label {
  color: var(--mx-muted);
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--mx-dark);
  letter-spacing: -1px;
}

.stat-card-teal  { border-left: 4px solid var(--mx-primary); }
.stat-card-green { border-left: 4px solid var(--mx-accent); }
.stat-card-amber { border-left: 4px solid #f59e0b; }
.stat-card-rose  { border-left: 4px solid #f43f5e; }

/* ── Tables ── */
.table-clean {
  margin-bottom: 0;
  width: 100%;
}

.table-clean thead th {
  border-bottom: 1px solid var(--mx-border);
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 14px 14px;
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.table-clean tbody td {
  padding: 14px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--mx-dark);
  vertical-align: middle;
  font-size: 0.94rem;
}

.table-clean tbody tr:last-child td {
  border-bottom: none;
}

.table-responsive-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Status badges ── */
.badge-soft {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge-confirmed  { background: #dcfce7; color: #166534; }
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-completed  { background: #ccfbf1; color: #0d9488; }
.badge-cancelled  { background: #fee2e2; color: #b91c1c; }

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--mx-primary-dk) 0%, var(--mx-primary) 100%);
  border: none;
  border-radius: 14px;
  min-height: 48px;
  font-weight: 700;
  padding: 0 22px;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 6px;
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.26);
  transition: all 0.22s ease;
  white-space: nowrap;
}

.btn-primary:hover,
.btn-primary:focus {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(20, 184, 166, 0.36);
  color: white;
}

.btn-outline-primary {
  border-radius: 14px;
  min-height: 48px;
  font-weight: 700;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 6px;
  transition: all 0.22s ease;
  border-color: var(--mx-primary);
  color: var(--mx-primary);
  white-space: nowrap;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--mx-primary);
  border-color: var(--mx-primary);
  color: white;
  transform: translateY(-2px);
}

.btn-outline-secondary {
  border-radius: 10px;
  font-weight: 600;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

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

.btn-danger,
.btn-warning,
.btn-success {
  border-radius: 10px;
  font-weight: 600;
}

.btn-sm {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

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

.action-btn { min-width: 150px; }

.action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.action-group .button_to { margin: 0; }

/* ── Forms ── */
.form-label {
  font-weight: 700;
  color: #334155;
  margin-bottom: 7px;
  font-size: 0.9rem;
}

.form-control,
.form-select {
  height: 50px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  box-shadow: none !important;
  padding-left: 14px;
  font-size: 0.96rem;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--mx-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.10) !important;
}

textarea.form-control {
  min-height: 120px;
  height: auto;
  padding-top: 12px;
}

.form-errors { margin-bottom: 18px; }

/* ── Section title ── */
.section-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 18px;
  letter-spacing: -0.3px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--mx-muted);
}

/* ── Clinic setup ── */
.setup-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

.setup-card {
  border: none;
  border-radius: 20px;
  background: var(--mx-card-bg);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  padding: 26px;
}

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

.settings-grid .full { grid-column: 1 / -1; }

/* ── Search ── */
.search-box { width: 100%; max-width: 320px; }

.search-input {
  height: 46px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  padding: 0 14px;
  width: 100%;
  outline: none;
  transition: all 0.2s ease;
  font-size: 15px;
}

.search-input:focus {
  border-color: var(--mx-primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.10);
}

/* ── Auth layout ── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.10), transparent 28%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.08), transparent 30%),
    #f5f7fb;
}

.auth-brand-side {
  background: linear-gradient(145deg, #051a16 0%, #0f172a 50%, #14b8a6 130%);
  color: white;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-brand-side::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20,184,166,0.12), transparent 70%);
  pointer-events: none;
}

.auth-brand-side::after {
  content: "";
  position: absolute;
  bottom: -80px;
  left: -40px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,197,94,0.09), transparent 70%);
  pointer-events: none;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.brand-logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--mx-primary-dk), var(--mx-primary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.35);
  flex-shrink: 0;
}

.brand-badge {
  display: inline-block;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.25);
  color: #5eead4;
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 0.88rem;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.brand-title {
  font-size: 2.2rem;
  line-height: 1.12;
  font-weight: 800;
  max-width: 520px;
  margin-bottom: 14px;
  letter-spacing: -0.7px;
  position: relative;
  z-index: 1;
}

.brand-text {
  color: rgba(255,255,255,0.80);
  font-size: 0.97rem;
  line-height: 1.8;
  max-width: 520px;
  margin-bottom: 26px;
  position: relative;
  z-index: 1;
}

.brand-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 560px;
  position: relative;
  z-index: 1;
}

.feature-box {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px;
  padding: 16px;
}

.feature-box-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(20, 184, 166, 0.20);
  color: var(--mx-primary-lt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  margin-bottom: 9px;
}

.feature-box h6 {
  margin-bottom: 5px;
  font-size: 0.93rem;
  font-weight: 700;
}

.feature-box p {
  margin: 0;
  color: rgba(255,255,255,0.70);
  font-size: 0.87rem;
  line-height: 1.55;
}

.brand-footer {
  color: rgba(255,255,255,0.50);
  font-size: 0.86rem;
  margin-top: 28px;
  position: relative;
  z-index: 1;
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
}

.auth-panel {
  width: 100%;
  max-width: 460px;
  padding: 34px;
  border-radius: 22px;
  background: white;
  box-shadow: 0 10px 38px rgba(15, 23, 42, 0.08);
}

.auth-logo {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--mx-dark);
  margin-bottom: 5px;
}

.auth-subtitle {
  color: var(--mx-muted);
  margin-bottom: 22px;
  line-height: 1.7;
  font-size: 0.94rem;
}

.auth-links a {
  color: var(--mx-primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-links a:hover { color: var(--mx-primary-dk); text-decoration: underline; }

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 20px;
  color: #475569;
}

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

.input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  font-size: 0.95rem;
}

.input-with-icon { padding-left: 40px !important; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.mini-note { color: #94a3b8; font-size: 0.9rem; }

/* ── Devise form classes ── */
.auth-form__group { margin-bottom: 1rem; }

.auth-form__label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--mx-dark);
  font-size: 0.92rem;
}

.auth-form__hint {
  margin: -0.1rem 0 0.5rem;
  font-size: 0.88rem;
  color: var(--mx-muted);
}

.auth-form__input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #dbe3f0;
  border-radius: 12px;
  background: #fff;
  font-size: 0.97rem;
  box-sizing: border-box;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.auth-form__input:focus {
  outline: none;
  border-color: var(--mx-primary);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.auth-form__actions { margin-top: 1rem; }

.auth-form__submit {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--mx-primary-dk), var(--mx-primary));
  color: white;
  font-weight: 700;
  font-size: 0.97rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.26);
  transition: all 0.22s ease;
}

.auth-form__submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(20, 184, 166, 0.36);
}

.auth-card__links { margin-top: 1rem; }

.auth-card__links a {
  color: var(--mx-primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-card__links a:hover { text-decoration: underline; }

/* ── Calendar ── */
#appointments-calendar {
  background: white;
  border-radius: 16px;
  padding: 18px;
}

.fc-toolbar.fc-header-toolbar { margin-bottom: 18px; }

.fc-toolbar-chunk {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fc .fc-button-group { display: flex; gap: 6px; }
.fc .fc-button-group > .fc-button { margin: 0 !important; }

.fc .fc-toolbar-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--mx-dark);
}

.fc .fc-button {
  background: linear-gradient(135deg, var(--mx-primary-dk) 0%, var(--mx-primary) 100%) !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 7px 14px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 12px rgba(20,184,166,0.22);
  transition: all 0.18s ease;
}

.fc .fc-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(20,184,166,0.32);
}

.fc .fc-button-active { background: #0f766e !important; }

.fc .fc-prev-button,
.fc .fc-next-button {
  width: 38px;
  height: 38px;
  padding: 0 !important;
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
  color: var(--mx-dark);
  text-decoration: none;
  font-weight: 600;
}

.fc-daygrid-day { transition: background 0.15s ease; }
.fc-daygrid-day:hover { background: #f0fdfa; cursor: pointer; }
.fc .fc-day-today { background: #f0fdfa !important; }

.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--mx-primary);
  color: white !important;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 5px;
}

.fc .fc-event {
  border: none;
  border-radius: 8px;
  padding: 2px 5px;
  font-weight: 600;
  color: white !important;
}

.fc-event.confirmed  { background: #22c55e !important; }
.fc-event.pending    { background: #f59e0b !important; }
.fc-event.completed  { background: #14b8a6 !important; }
.fc-event.cancelled  { background: #ef4444 !important; }

.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid { border-color: #e5e7eb; }

/* ── Floating chatbot ── */
.floating-chatbot-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1060;
}

.floating-chatbot-btn {
  position: relative;
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mx-primary-dk) 0%, var(--mx-primary) 100%);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(20, 184, 166, 0.36);
  cursor: pointer;
  transition: all 0.22s ease;
}

.floating-chatbot-btn:hover {
  transform: translateY(-4px) scale(1.04);
  color: white;
  box-shadow: 0 20px 40px rgba(20, 184, 166, 0.44);
}

.floating-chatbot-btn i { font-size: 1.4rem; }

.floating-chatbot-btn::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 8px solid rgba(20, 184, 166, 0.18);
  animation: chatbotPulse 2s infinite;
}

@keyframes chatbotPulse {
  0%   { transform: scale(0.92); opacity: 0.9; }
  70%  { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}

.chatbot-ai-badge {
  position: absolute;
  top: -5px;
  right: -3px;
  background: var(--mx-dark);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 3px 6px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.20);
}

.chatbot-tooltip {
  position: absolute;
  right: 72px;
  bottom: 50%;
  transform: translateY(50%);
  background: var(--mx-dark);
  color: white;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.20);
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s ease;
}

.chatbot-tooltip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  width: 12px;
  height: 12px;
  background: var(--mx-dark);
  transform: translateY(-50%) rotate(45deg);
}

.floating-chatbot-wrap:hover .chatbot-tooltip {
  opacity: 1;
  transform: translateY(50%) translateX(-4px);
}

.chatbot-popup {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 375px;
  max-width: calc(100vw - 24px);
  height: 560px;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.20);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.98);
  transition: all 0.22s ease;
  border: 1px solid var(--mx-border);
}

.chatbot-popup.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.chatbot-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--mx-dark) 0%, #0d9488 100%);
  color: white;
}

.chatbot-popup-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-popup-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255,255,255,0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.chatbot-popup-title {
  font-weight: 800;
  font-size: 0.94rem;
  margin: 0;
}

.chatbot-popup-subtitle {
  font-size: 0.78rem;
  opacity: 0.80;
  margin: 2px 0 0;
}

.chatbot-popup-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-popup-action-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: rgba(255,255,255,0.14);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.18s ease;
}

.chatbot-popup-action-btn:hover {
  background: rgba(255,255,255,0.24);
  color: white;
  transform: translateY(-1px);
}

.chatbot-popup-frame {
  width: 100%;
  height: calc(100% - 70px);
  border: 0;
  background: white;
}

/* ── Alert ── */
.alert { border-radius: 14px !important; }

/* ── Misc ── */
.responsive-table { width: 100%; }

/* ══════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════ */

/* ── Tablet (≤ 991px) ── */
@media (max-width: 991px) {
  .app-shell { display: block; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    border: none;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1030;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 300px);
    min-height: 100%;
    z-index: 1040;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.30);
  }

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

  .sidebar-close,
  .sidebar-toggle { display: inline-flex; }

  .sidebar-close {
    margin-left: auto;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    color: white;
  }

  .topbar { position: sticky; top: 0; z-index: 100; }

  .page-shell { padding: 20px 16px 32px; }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions { width: 100%; }
  .page-actions .btn,
  .page-actions .btn-outline-primary,
  .page-actions .btn-primary,
  .page-actions .btn-warning { flex: 1 1 auto; }

  .action-btn,
  .search-box { max-width: none; width: 100%; }

  .stat-card, .content-card, .form-card,
  .setup-card, .auth-panel {
    padding: 20px;
    border-radius: 18px;
  }

  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-side { display: none; }
  .settings-grid { grid-template-columns: 1fr; }

  #appointments-calendar { padding: 12px; }

  .fc .fc-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .fc-toolbar-chunk { justify-content: center; flex-wrap: wrap; }
}

/* ── Mobile (≤ 767px) ── */
@media (max-width: 767px) {
  .page-title { font-size: 1.55rem; }
  .page-subtitle,
  .auth-subtitle,
  .brand-text { font-size: 0.93rem; }
  .section-title { font-size: 1.25rem; }

  /* Topbar compact */
  .topbar-inner { padding: 10px 14px; gap: 8px; }
  .topbar-title { font-size: 0.93rem; }
  .topbar-subtitle { display: none; }
  .topbar-user-email { max-width: 120px; font-size: 0.82rem; }

  /* Locale links smaller on mobile */
  .locale-link { min-width: 34px; padding: 5px 8px; font-size: 0.75rem; }

  /* Tables → card list on mobile */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .responsive-table thead { display: none; }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td { display: block; width: 100%; }

  .responsive-table tbody { display: grid; gap: 12px; }

  .responsive-table tr {
    padding: 16px;
    border: 1px solid var(--mx-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  }

  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border: none !important;
    padding: 9px 0 !important;
    text-align: right;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: #475569;
    font-weight: 700;
    text-align: left;
    flex: 0 0 40%;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .responsive-table td.actions-cell {
    display: block;
    text-align: left;
    padding-top: 12px !important;
  }

  .responsive-table td.actions-cell::before { display: block; margin-bottom: 8px; }

  .responsive-table .action-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .responsive-table .action-group > * { min-width: 0; }

  .responsive-table .action-group .btn,
  .responsive-table .action-group .button_to,
  .responsive-table .action-group .button_to .btn { width: 100%; }

  .responsive-table .badge-soft { margin-left: auto; }

  /* Buttons full-width in forms on mobile */
  .form-card .btn-primary,
  .setup-card .btn-primary,
  .auth-panel .btn-primary,
  .form-card .btn-outline-primary { width: 100%; }

  .auth-form-side { padding: 20px 12px; }
  .setup-shell { padding: 14px 10px 30px; }
  .remember-row { align-items: flex-start; }

  .chatbot-popup {
    position: fixed;
    right: 10px;
    left: 10px;
    bottom: 80px;
    width: auto;
    max-width: none;
    height: 70vh;
    border-radius: 20px;
  }

  .chatbot-tooltip { display: none; }
  .floating-chatbot-wrap { right: 14px; bottom: 14px; }
  .floating-chatbot-btn { width: 56px; height: 56px; }
}

/* ── Small mobile (≤ 575px) ── */
@media (max-width: 575px) {
  .page-shell { padding: 16px 12px 28px; }
  .stat-value { font-size: 1.85rem; }

  .fc .fc-button-group,
  .fc-toolbar-chunk { width: 100%; }

  .fc .fc-button-group { justify-content: center; flex-wrap: wrap; }
  .fc .fc-button { flex: 1 1 auto; }

  .responsive-table .action-group { grid-template-columns: 1fr; }
  .page-actions { gap: 8px; }

  .btn-primary,
  .btn-outline-primary { min-height: 44px; font-size: 0.93rem; }

  .auth-panel { padding: 24px 18px; border-radius: 18px; }
  .topbar-inner { flex-wrap: nowrap; }

  /* Hide email on very small screens to avoid overflow */
  .topbar-user-email { display: none; }
}

/* ═══════════════════════════════════════════════════════
   PLAN GATING — sidebar badge
   ═══════════════════════════════════════════════════════ */
.sidebar-plan-badge {
  margin-left: auto;
  background: rgba(20, 184, 166, 0.22);
  color: var(--mx-primary-lt);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(20, 184, 166, 0.30);
  text-transform: uppercase;
  flex-shrink: 0;
}

.sidebar-notif-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ═══════════════════════════════════════════════════════
   PLAN TIER BADGE — dashboard + analytics
   ═══════════════════════════════════════════════════════ */
.plan-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.analytics-plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════
   USAGE METERS — dashboard plan card
   ═══════════════════════════════════════════════════════ */
.usage-meter-wrap {
  background: #f8fafc;
  border: 1px solid var(--mx-border);
  border-radius: 16px;
  padding: 14px 16px;
}

.usage-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 10px;
}

.usage-meter-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mx-dark);
}

.usage-meter-bar {
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.usage-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
  min-width: 4px;
}

.usage-ok     { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }
.usage-warn   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.usage-danger { background: linear-gradient(90deg, #ef4444, #f87171); }

.usage-analytics-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--mx-primary);
  text-decoration: none;
}

.usage-analytics-link:hover { text-decoration: underline; }

.usage-analytics-link--locked {
  color: #f59e0b;
}

/* ═══════════════════════════════════════════════════════
   ANALYTICS PAGE
   ═══════════════════════════════════════════════════════ */
.analytics-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.analytics-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--mx-dark);
  margin-bottom: 3px;
}

.analytics-card-subtitle {
  font-size: 0.83rem;
  color: var(--mx-muted);
}

.analytics-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.analytics-chart-wrap {
  position: relative;
  height: 240px;
}

.analytics-chart-wrap--donut {
  height: 210px;
}

.analytics-donut-layout {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.analytics-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 130px;
}

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

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

.donut-legend-label {
  flex: 1;
  font-weight: 600;
  color: #334155;
}

.donut-legend-count {
  font-weight: 800;
  color: var(--mx-dark);
  font-size: 0.9rem;
}

/* Trend badges on stat cards */
.analytics-trend { margin-top: 10px; }

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
}

.trend-up      { background: #dcfce7; color: #166534; }
.trend-down    { background: #fee2e2; color: #b91c1c; }
.trend-neutral { background: #f1f5f9; color: #475569; }

/* ═══════════════════════════════════════════════════════
   PRICING PAGE
   ═══════════════════════════════════════════════════════ */
.pricing-eyebrow {
  display: inline-block;
  background: rgba(20, 184, 166, 0.10);
  color: var(--mx-primary-dk);
  border: 1px solid rgba(20, 184, 166, 0.20);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 16px;
}

.pricing-current-plan-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 184, 166, 0.08);
  border: 1px solid rgba(20, 184, 166, 0.18);
  color: var(--mx-primary-dk);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 32px;
  font-size: 0.93rem;
  font-weight: 600;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 32px 0;
  align-items: start;
}

.pricing-card {
  background: var(--mx-card-bg);
  border: 2px solid var(--mx-border);
  border-radius: 26px;
  padding: 32px 28px;
  position: relative;
  transition: all 0.25s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.09);
}

.pricing-card--featured {
  border-color: var(--mx-primary);
  box-shadow: 0 12px 40px rgba(20, 184, 166, 0.18);
  transform: translateY(-8px);
}

.pricing-card--featured:hover {
  transform: translateY(-12px);
  box-shadow: 0 24px 56px rgba(20, 184, 166, 0.26);
}

.pricing-card--enterprise {
  border-color: #0f172a;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
  color: white;
}

.pricing-card--enterprise .pricing-plan-name,
.pricing-card--enterprise .pricing-plan-tagline,
.pricing-card--enterprise .pricing-price,
.pricing-card--enterprise .feature-yes,
.pricing-card--enterprise .feature-no { color: rgba(255,255,255,0.9); }

.pricing-card--enterprise .feature-no { color: rgba(255,255,255,0.35); }

.pricing-popular-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--mx-primary-dk), var(--mx-primary));
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 5px 16px;
  border-radius: 999px;
  white-space: nowrap;
}

.pricing-card-header { margin-bottom: 20px; }

.pricing-plan-icon {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 14px;
}

.pricing-plan-icon--starter    { background: #f1f5f9; color: #64748b; }
.pricing-plan-icon--pro        { background: rgba(20,184,166,0.12); color: var(--mx-primary); }
.pricing-plan-icon--enterprise { background: rgba(255,255,255,0.10); color: #5eead4; }

.pricing-plan-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--mx-dark);
  margin-bottom: 4px;
}

.pricing-plan-tagline {
  font-size: 0.88rem;
  color: var(--mx-muted);
}

.pricing-price {
  font-size: 3rem;
  font-weight: 900;
  color: var(--mx-dark);
  letter-spacing: -2px;
  margin: 20px 0;
  line-height: 1;
}

.pricing-price--featured { color: var(--mx-primary-dk); }

.pricing-currency {
  font-size: 1.4rem;
  font-weight: 700;
  vertical-align: super;
  margin-right: 2px;
}

.pricing-period {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--mx-muted);
  letter-spacing: 0;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.pricing-features li i {
  font-size: 1rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.feature-yes { color: #1e293b; }
.feature-yes i { color: #22c55e; }

.feature-no { color: #94a3b8 !important; }
.feature-no i { color: #cbd5e1 !important; }

.feature-highlight { font-weight: 700 !important; }
.feature-highlight i { color: var(--mx-primary) !important; }

.pricing-card--enterprise .feature-yes i { color: #4ade80; }
.pricing-card--enterprise .feature-no { color: rgba(255,255,255,0.30) !important; }
.pricing-card--enterprise .feature-highlight { color: #fff !important; }
.pricing-card--enterprise .feature-highlight i { color: #5eead4 !important; }

.pricing-cta { margin-top: auto; }

.pricing-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  transition: all 0.25s ease;
  cursor: pointer;
}

.pricing-btn--starter {
  background: #f1f5f9;
  color: #334155;
}

.pricing-btn--starter:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-2px);
}

.pricing-btn--pro {
  background: linear-gradient(135deg, var(--mx-primary-dk) 0%, var(--mx-primary) 100%);
  color: white;
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.32);
}

.pricing-btn--pro:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(20, 184, 166, 0.42);
  color: white;
}

.pricing-btn--enterprise {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  color: white;
}

.pricing-btn--enterprise:hover {
  background: rgba(255,255,255,0.20);
  color: white;
  transform: translateY(-2px);
}

.pricing-current-badge {
  text-align: center;
  padding: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--mx-muted);
  border: 2px dashed var(--mx-border);
  border-radius: 14px;
}

.pricing-current-badge--featured {
  border-color: rgba(20,184,166,0.40);
  color: var(--mx-primary-dk);
}

.pricing-trust-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 24px 0;
  border-top: 1px solid var(--mx-border);
  margin-top: 8px;
}

.pricing-trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--mx-muted);
  font-weight: 600;
}

.pricing-trust-item i { color: var(--mx-primary); font-size: 1rem; }

/* Pricing responsive */
@media (max-width: 991px) {
  .pricing-grid { grid-template-columns: 1fr; gap: 20px; max-width: 480px; margin-left: auto; margin-right: auto; }
  .pricing-card--featured { transform: none; }
  .pricing-card--featured:hover { transform: translateY(-4px); }
  .pricing-trust-bar { gap: 18px; }
}

@media (max-width: 767px) {
  .analytics-chart-wrap { height: 200px; }
  .analytics-chart-wrap--donut { height: 180px; }
  .analytics-donut-layout { flex-direction: column; }
  .analytics-donut-legend { flex-direction: row; flex-wrap: wrap; min-width: auto; }
}
