/* ============================================================
   Faturno Design System v2
   Inspirado en: Airbnb, Uber, Linear
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Oculta elementos Alpine.js hasta que el framework inicialice */
[x-cloak] { display: none !important; }

:root {
  /* Brand */
  --brand:        #6C47FF;
  --brand-hover:  #5836E0;
  --brand-light:  #F4F1FF;
  --brand-mid:    #EDE9FF;
  --brand-border: #C4B5FD;

  /* Neutrals */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Semantic */
  --color-brand:       #6C47FF;
  --color-brand-light: var(--brand-light);
  --color-brand-dark:  var(--brand-hover);
  --color-text:        var(--gray-900);
  --color-muted:       var(--gray-500);
  --color-border:      var(--gray-200);
  --color-bg:          #FFFFFF;
  --color-surface:     var(--gray-50);
  --color-card:        #FFFFFF;
  --color-success:     #10B981;
  --color-warning:     #F59E0B;
  --color-error:       #EF4444;

  /* Sidebar tokens — dark, like Linear/Vercel */
  --sidebar-w:           240px;
  --sidebar-bg:          #0F0F14;
  --sidebar-border:      rgba(255,255,255,.06);
  --sidebar-text:        rgba(255,255,255,.55);
  --sidebar-active-bg:   rgba(108,71,255,.25);
  --sidebar-active-text: #fff;
  --sidebar-hover-bg:    rgba(255,255,255,.06);

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius:    var(--radius-md);

  /* Shadows — clean layered */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 140ms cubic-bezier(.4,0,.2,1);

  /* Compat aliases para JSPs legacy */
  --color-card:   #FFFFFF;
  --radius:       var(--radius-md);
}

/* Cuando el JSP sobreescribe --color-brand, sincronizar --brand */
:root { --brand: var(--color-brand, #6C47FF); }

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ─── Typography ─────────────────────────────────────────── */
.text-xs    { font-size: .75rem;   line-height: 1rem; }
.text-sm    { font-size: .875rem;  line-height: 1.25rem; }
.text-base  { font-size: 1rem;     line-height: 1.5rem; }
.text-lg    { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl    { font-size: 1.25rem;  line-height: 1.75rem; }
.text-2xl   { font-size: 1.5rem;   line-height: 2rem; }
.text-3xl   { font-size: 1.875rem; line-height: 2.25rem; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold{ font-weight: 800; }
.text-muted    { color: var(--color-muted); }
.text-center   { text-align: center; }

/* ─── Layout ─────────────────────────────────────────────── */
.container          { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 1rem; }
.container--wide    { max-width: 1280px; }
.container--dashboard { max-width: 1120px; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.01em;
}

.btn--primary {
  background: linear-gradient(135deg, var(--brand) 0%, #8B5CF6 100%);
  color: #fff;
  box-shadow: 0 1px 3px rgba(108,71,255,.3), 0 4px 12px rgba(108,71,255,.2);
}
.btn--primary:hover { background: linear-gradient(135deg, var(--brand-hover) 0%, #7C3AED 100%); box-shadow: 0 4px 16px rgba(108,71,255,.4); text-decoration: none; transform: translateY(-1px); }

.btn--outline {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--gray-300);
}
.btn--outline:hover { background: var(--gray-50); border-color: var(--gray-400); text-decoration: none; }

.btn--ghost {
  background: transparent;
  color: var(--color-muted);
}
.btn--ghost:hover { background: var(--gray-100); color: var(--color-text); text-decoration: none; }

.btn--danger  { background: var(--color-error); color: #fff; }
.btn--danger:hover { background: #DC2626; text-decoration: none; }

.btn--success { background: var(--color-success); color: #fff; }
.btn--success:hover { background: #059669; text-decoration: none; }

.btn--full { width: 100%; }
.btn--sm   { padding: .4rem .875rem; font-size: .8125rem; }
.btn--lg   { padding: .875rem 1.75rem; font-size: .9375rem; }

.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ─── Icon button ────────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  background: var(--color-bg);
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
}
.icon-btn:hover { border-color: var(--gray-300); background: var(--gray-50); color: var(--gray-700); }

/* ─── Kebab / 3-dot trigger ──────────────────────────────── */
.kebab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--gray-200);
  background: var(--color-bg);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.125rem;
  flex-shrink: 0;
  line-height: 1;
}
.kebab-btn:hover { border-color: var(--gray-400); background: var(--gray-50); color: var(--gray-900); }

/* ─── Dropdown menu ──────────────────────────────────────── */
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  min-width: 168px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  overflow: hidden;
}
.dropdown-menu__item {
  display: block;
  width: 100%;
  padding: .5625rem 1rem;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--color-text);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
  font-family: var(--font-sans);
}
.dropdown-menu__item:hover { background: var(--gray-50); }
.dropdown-menu__item--danger { color: var(--color-error); }
.dropdown-menu__item--danger:hover { background: #FFF1F1; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--color-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.card--elevated { box-shadow: var(--shadow-md); border-color: transparent; }
.card--brand    { background: var(--brand); color: #fff; border: none; }
.card--surface  { background: var(--gray-50); }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group   { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1.125rem; }
.form-label   { font-size: .8125rem; font-weight: 600; color: var(--gray-700); letter-spacing: .01em; }
.form-hint    { font-size: .8125rem; color: var(--gray-400); line-height: 1.4; }
.form-error   { font-size: .8125rem; color: var(--color-error); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .6875rem .875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
.form-input:hover, .form-select:hover { border-color: var(--gray-300); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(108,71,255,.10);
}
.form-input::placeholder { color: var(--gray-400); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .875rem center;
  padding-right: 2.25rem;
}

/* ─── Badges / Status ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .625rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .01em;
}

.badge--confirmed { background: #D1FAE5; color: #065F46; }
.badge--pending   { background: #FEF3C7; color: #92400E; }
.badge--cancelled { background: #FEE2E2; color: #991B1B; }
.badge--no_show   { background: var(--gray-100); color: var(--gray-600); }
.badge--completed { background: #DBEAFE; color: #1E40AF; }
.badge--brand     { background: var(--brand-light); color: var(--brand); }
.badge--success   { background: #D1FAE5; color: #065F46; }
.badge--muted     { background: var(--gray-100); color: var(--gray-500); }

/* ─── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.45;
}
.alert--error   { background: #FEE2E2; border: 1px solid #FECACA; color: #991B1B; }
.alert--warning { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; }
.alert--success { background: #D1FAE5; border: 1px solid #A7F3D0; color: #065F46; }
.alert--info    { background: #DBEAFE; border: 1px solid #BFDBFE; color: #1E40AF; }

/* ─── Stat cards ─────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.375rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--brand) 0%, #9B6BFF 100%);
  border-radius: 3px 0 0 3px;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card__label { font-size: .8125rem; font-weight: 500; color: var(--gray-500); }
.stat-card__value { font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -.04em; color: var(--gray-900); }
.stat-card__delta { font-size: .8125rem; color: var(--color-success); font-weight: 600; }
.stat-card__icon  {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-light); font-size: 1.125rem; margin-bottom: .5rem;
}

/* ─── Dashboard Layout ───────────────────────────────────── */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background: #F7F7FB;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 40;
  /* Subtle gradient depth */
  background: linear-gradient(160deg, #13111C 0%, #0D0B14 100%);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: 1.25rem 1.125rem .875rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: .375rem;
}

.sidebar__brand-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--brand) 0%, #9B6BFF 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(108,71,255,.4);
}

.sidebar__brand-name {
  font-size: .9375rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}

.sidebar__nav { flex: 1; padding: .375rem .625rem; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  margin-bottom: 1px;
}

.sidebar__link:hover {
  color: rgba(255,255,255,.9);
  background: var(--sidebar-hover-bg);
  text-decoration: none;
}

.sidebar__link--active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(108,71,255,.3);
}

.sidebar__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: .6;
}
.sidebar__link--active .sidebar__icon { opacity: 1; }
.sidebar__link:hover .sidebar__icon { opacity: .85; }

.sidebar__footer {
  padding: 1rem 1.125rem;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: auto;
}

.sidebar__tenant-name {
  font-size: .8125rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: .1rem;
}

.sidebar__tenant-url {
  font-size: .75rem;
  color: rgba(255,255,255,.3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: .75rem;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .4rem .625rem;
  border-radius: var(--radius-xs);
  background: none;
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.35);
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.sidebar__logout:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.2); }

/* ─── Main content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;       /* prevents flex child from expanding past viewport */
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Page header ────────────────────────────────────────── */
.page-header {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: .875rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 60px;
}

.page-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -.02em;
}

.page-body {
  padding: 2rem;
  flex: 1;
}

/* ─── Stats grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* ─── Section title (dentro del page-body) ───────────────── */
.section-heading {
  font-size: .875rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 1rem;
}

/* ─── Settings cards ─────────────────────────────────────── */
.s-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: visible;
  transition: box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-xs);
}
.s-card:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); }

.s-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}

.s-card__head-left {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
}

.s-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-mid) 100%);
  box-shadow: 0 1px 3px rgba(108,71,255,.12);
}

.s-card__title { font-size: .9375rem; font-weight: 700; margin: 0 0 .2rem; color: var(--gray-900); }
.s-card__sub   { font-size: .8125rem; color: var(--gray-500); margin: 0; line-height: 1.5; }
.s-card__body  { padding: 1.5rem; }

/* ─── Products modal overlay ────────────────────────────── */
.products-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ─── Catalog item (products modal) ─────────────────────── */
.catalog-item {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  padding: .5rem .875rem; background: none; border: none; cursor: pointer;
  text-align: left; border-bottom: 1px solid var(--gray-200);
  transition: background var(--transition); font-family: var(--font-sans); color: inherit;
}
.catalog-item:last-child { border-bottom: none; }
.catalog-item:hover { background: var(--gray-50); }
.catalog-item--selected,
.catalog-item--selected:hover { background: var(--brand-light); }

/* ─── Product list items (settings → products) ───────────── */
.product-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.product-item:last-child { border-bottom: none; }
.product-item:hover { background: var(--gray-50); }
.product-item__name  { flex: 1; font-weight: 600; font-size: .9375rem; }
.product-item__price { font-size: .875rem; font-weight: 700; color: var(--color-text); white-space: nowrap; }

/* ─── Tip box ────────────────────────────────────────────── */
.tip {
  display: flex;
  gap: .75rem;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  margin-bottom: 1.5rem;
  font-size: .8125rem;
  color: #1E3A8A;
  line-height: 1.5;
}
.tip__icon  { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }
.tip__body  { flex: 1; }
.tip__title { font-weight: 700; margin-bottom: .25rem; }
.tip--green  { background: #F0FDF4; border-color: #BBF7D0; color: #14532D; }
.tip--amber  { background: #FFFBEB; border-color: #FDE68A; color: #78350F; }
.tip--purple { background: var(--brand-light); border-color: var(--brand-border); color: #4C1D95; }

/* ─── Toggle row ─────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: .625rem;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-row:hover { background: var(--gray-100); }
.toggle-row label { font-size: .9375rem; font-weight: 500; cursor: pointer; }
.toggle-row small { display: block; font-size: .8125rem; color: var(--gray-400); margin-top: .125rem; }

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }

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

th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--gray-50);
}

td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ─── Clean table ────────────────────────────────────────── */
.clean-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.clean-table th {
  font-size: .75rem; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .05em;
  padding: .625rem 1rem; border-bottom: 1px solid var(--gray-200); text-align: left;
  background: var(--gray-50);
}
.clean-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.clean-table tr:last-child td { border-bottom: none; }
.clean-table tr:hover td { background: var(--gray-50); }

/* ─── Appointment item ───────────────────────────────────── */
.appt-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  margin-bottom: .5rem;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  box-shadow: var(--shadow-xs);
  position: relative;
}
.appt-item:hover { box-shadow: var(--shadow-sm); border-color: var(--brand-border); transform: translateX(2px); }
.appt-item__time { min-width: 52px; text-align: center; }
.appt-item__hour { font-size: 1.125rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.appt-item__ampm { font-size: .6875rem; color: var(--gray-400); }
.appt-item__body { flex: 1; min-width: 0; }
.appt-item__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-item__service { font-size: .8125rem; color: var(--gray-500); }
.appt-item__price { font-weight: 700; color: var(--brand); white-space: nowrap; font-size: .9375rem; }

/* ─── Empty state ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state__icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .6; }
.empty-state__text { font-size: .9375rem; }

/* ─── Staff dot ──────────────────────────────────────────── */
.staff-dot {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8125rem; color: #fff;
}

/* ─── Assoc / mod tags ───────────────────────────────────── */
.assoc-tag { display: inline-block; font-size: .7rem; padding: .125rem .4rem;
              border-radius: 99px; background: var(--gray-100);
              border: 1px solid var(--gray-200); margin: .1rem; color: var(--gray-600); }

.mod-badge { display: inline-block; font-size: .7rem; font-weight: 600;
              padding: .175rem .5rem; border-radius: 99px; }
.mod-badge--presencial { background: #DCFCE7; color: #166534; }
.mod-badge--online     { background: #DBEAFE; color: #1D4ED8; }
.mod-badge--both       { background: #FEF3C7; color: #92400E; }
.mod-badge--none       { background: var(--gray-100); color: var(--gray-500); }

/* ─── Schedule row ───────────────────────────────────────── */
.schedule-row {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  background: var(--gray-50); border: 1px solid var(--gray-100);
  margin-bottom: .375rem; transition: background var(--transition);
}
.schedule-row:hover { background: var(--gray-100); }
.schedule-row__day { width: 80px; font-weight: 600; font-size: .875rem; flex-shrink: 0; }

/* ─── Add form ───────────────────────────────────────────── */
.add-form {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--gray-200);
}
.add-form__title { font-weight: 700; font-size: .9375rem; margin-bottom: 1rem; color: var(--gray-800); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .875rem; }
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ─── Settings nav ───────────────────────────────────────── */
.settings-nav {
  display: flex; gap: .25rem; flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: .3125rem;
  margin-bottom: 2rem;
  position: sticky; top: 61px; z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
.settings-nav a {
  padding: .4rem .875rem;
  border-radius: var(--radius-xs);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--gray-500);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex; align-items: center; gap: .375rem;
}
.settings-nav a:hover { background: var(--gray-100); color: var(--gray-800); text-decoration: none; }
.settings-nav a.active {
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-mid) 100%);
  color: var(--brand);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(108,71,255,.15);
}

/* ─── Web config tabs ────────────────────────────────────── */
.wc-tab {
  padding: .5rem 1rem; font-size: .875rem; font-weight: 500;
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; color: var(--gray-500);
  margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.wc-tab:hover { color: var(--gray-800); }
.wc-tab.wc-active { border-bottom-color: var(--brand); color: var(--brand); font-weight: 600; }
.wc-section { display: none; }
.wc-section.wc-visible { display: block; }

.style-opt  { position: absolute; opacity: 0; pointer-events: none; }
.style-card {
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  padding: .625rem .5rem; text-align: center; font-size: .8125rem;
  font-weight: 500; cursor: pointer; transition: all .2s;
}
.style-opt:checked + .style-card {
  border-color: var(--brand);
  background: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(108,71,255,.12);
}
.style-preview { height: 48px; border-radius: .25rem; margin-bottom: .375rem; overflow: hidden; }

.font-opt  { position: absolute; opacity: 0; pointer-events: none; }
.font-card {
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  padding: .5rem .625rem; text-align: center; cursor: pointer;
  transition: all .2s; line-height: 1.3;
}
.font-opt:checked + .font-card {
  border-color: var(--brand);
  background: var(--brand-light);
}

/* ─── Use-case cards ─────────────────────────────────────── */
.uc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: .625rem; margin-top: .625rem; }
.uc { background: var(--color-bg); border: 1px solid #BFDBFE; border-radius: var(--radius-sm); padding: .75rem; }
.uc__tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #1D4ED8; margin-bottom: .25rem; }
.uc__text { font-size: .8125rem; color: var(--gray-600); }

input[type=range] { width: 100%; accent-color: var(--brand); }

/* ─── Booking page ───────────────────────────────────────── */
.booking-page      { min-height: 100vh; background: var(--gray-50); }
.booking-header    { padding: 2rem 1rem 1.5rem; text-align: center; }
.booking-header__logo {
  width: 72px; height: 72px; border-radius: var(--radius-xl);
  margin: 0 auto 1rem; display: block;
  object-fit: cover; box-shadow: var(--shadow-md);
}
.booking-header__logo-placeholder {
  width: 72px; height: 72px; border-radius: var(--radius-xl);
  margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: #fff; background: var(--brand);
  box-shadow: var(--shadow-md);
}
.booking-header__name { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.booking-header__sub  { color: var(--gray-500); font-size: .9375rem; margin-top: .25rem; }

.booking-steps { display: flex; justify-content: center; gap: .375rem; padding: 1rem; margin-bottom: .5rem; }
.booking-step {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gray-200); transition: all var(--transition);
}
.booking-step--active { background: var(--brand); width: 24px; border-radius: 4px; }
.booking-step--done   { background: var(--brand); opacity: .4; }

.service-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; background: var(--color-bg);
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition); margin-bottom: .625rem;
}
.service-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.service-card--selected { border-color: var(--brand); background: var(--brand-light); box-shadow: 0 0 0 3px rgba(108,71,255,.08); }
.service-card__name  { font-weight: 600; font-size: .9375rem; }
.service-card__meta  { font-size: .8125rem; color: var(--gray-400); margin-top: .125rem; }
.service-card__price { font-weight: 700; font-size: 1rem; color: var(--brand); }

.date-row { display: flex; align-items: center; gap: .5rem; }
.date-nav-arrow {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--gray-200); background: var(--color-bg);
  cursor: pointer; font-size: 1.15rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text); transition: all var(--transition); line-height: 1;
}
.date-nav-arrow:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.date-nav-arrow:disabled { opacity: .28; cursor: default; }
.date-scroller { display: flex; gap: .375rem; overflow: hidden; flex: 1; }
.date-chip {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: .625rem .25rem; border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-200); background: var(--color-bg);
  cursor: pointer; transition: all var(--transition); text-align: center;
}
.date-chip:hover { border-color: var(--brand); }
.date-chip--selected { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: var(--shadow-sm); }
.date-chip--disabled { opacity: .35; cursor: not-allowed; }
.date-chip__day { font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.date-chip__num { font-size: 1.125rem; font-weight: 700; line-height: 1.2; }
.date-chip__month { font-size: .6rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }

.slots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .625rem; margin-top: 1rem; }
.slot-btn {
  padding: .75rem .5rem; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm); background: var(--color-bg);
  font-size: .9375rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); text-align: center;
}
.slot-btn:hover { border-color: var(--brand); color: var(--brand); }
.slot-btn--selected { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: var(--shadow-sm); }

.otp-container { display: flex; justify-content: center; gap: .5rem; margin: 1.5rem 0; }
.otp-input {
  width: 48px; height: 56px; text-align: center;
  font-size: 1.5rem; font-weight: 700;
  border: 2px solid var(--gray-200); border-radius: var(--radius-sm);
  outline: none; transition: border-color var(--transition);
}
.otp-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(108,71,255,.12); }

.success-screen { text-align: center; padding: 3rem 1.5rem; }
.success-icon {
  width: 80px; height: 80px; background: #D1FAE5;
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 2rem; margin: 0 auto 1.5rem;
}

/* ─── HTMX ───────────────────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator  { opacity: 1; }

/* ─── Utilities ──────────────────────────────────────────── */
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }   .gap-6 { gap: 1.5rem; }
.mt-1 { margin-top: .25rem; }  .mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }    .mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: .25rem; }.mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
.hidden    { display: none; }
.w-full    { width: 100%; }
.rounded-full { border-radius: 9999px; }
.divider   { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Mobile top bar ─────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 56px;
  background: #13111C;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 90;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.mobile-topbar__hamburger {
  display: flex; flex-direction: column; justify-content: center;
  gap: 5px; width: 40px; height: 40px;
  background: transparent; border: none; cursor: pointer;
  padding: 8px; border-radius: var(--radius-sm);
}
.mobile-topbar__hamburger span {
  display: block; height: 2px; background: rgba(255,255,255,.7); border-radius: 2px;
}
.mobile-topbar__hamburger:hover { background: rgba(255,255,255,.08); }

.mobile-topbar__title {
  font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: -.02em;
}
.mobile-topbar__title strong { color: var(--brand); }

.mobile-topbar__logout {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; color: rgba(255,255,255,.5);
  font-size: 1.125rem; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.mobile-topbar__logout:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }

/* ─── Sidebar overlay ────────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 95; backdrop-filter: blur(2px); }
.sidebar-overlay--visible { display: block; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    z-index: 100;
  }
  .sidebar--open { transform: translateX(0); box-shadow: 6px 0 40px rgba(0,0,0,.5); }

  .main-content { margin-left: 0; padding-top: 56px; }

  .page-header { padding: .875rem 1rem; flex-wrap: wrap; gap: .5rem; }
  .page-body   { padding: 1rem; }

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

  .table-wrap              { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap > table      { min-width: 540px; }   /* only top-level tables scroll; nested tables adapt */

  .card        { padding: 1rem; }

  .page-header .btn--sm { padding: .35rem .75rem; font-size: .8125rem; }

  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns:repeat(3, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }

  .settings-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
                   padding-bottom: 2px; scrollbar-width: none; top: 57px; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav a { white-space: nowrap; flex-shrink: 0; }

  .appt-item { flex-wrap: wrap; gap: .5rem .75rem; }
  .appt-item__body { flex: 1 1 160px; }
  .appt-item__name { white-space: normal; }

  .form-input[type="search"] { width: 100% !important; }

  /* Finance header date filter */
  .page-header form.flex { flex-wrap: wrap; width: 100%; }
  .page-header form.flex .form-input { flex: 1 1 100px; min-width: 0; }

  /* Settings & promotions tables */
  .s-card .table-wrap, .card .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ─── Modal system ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 400;
  align-items: center; justify-content: center;
  padding: 1rem;
  animation: none;
}
.modal-overlay.modal--open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: modal-in .18s ease;
}
.modal-box--sm { max-width: 400px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; line-height: 1;
  color: var(--gray-400); display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex; gap: .75rem; justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--gray-100);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 600px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 88vh; max-width: 100%; }
}
