/* ── Reset & Variables ──────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy:      #0D2137;
  --navy-dk:   #091729;
  --navy-hover:#1A3A5C;
  --navy-muted:#3D6494;
  --red:       #E8283A;
  --red-lt:    #fde8ea;
  --red-dk:    #C0202F;
  --oficial:   #2563EB;
  --oficial-lt:#EFF6FF;
  --oficial-bd:#BFDBFE;
  --taller:    #D97706;
  --taller-lt: #FFFBEB;
  --taller-bd: #FCD34D;
  --green:     #059669;
  --green-lt:  #D1FAE5;
  --purple:    #7C3AED;
  --purple-lt: #EDE9FE;
  --gray:      #9CA3AF;
  --gray-lt:   #F3F4F6;
  --bg:        #EFF3F8;
  --surface:   #FFFFFF;
  --border:    #DDE4EE;
  --border-dk: #C8D3E0;
  --text:      #111827;
  --muted:     #6B7280;
  --muted-lt:  #94A3B8;
  --sidebar-w: 240px;
  --topbar-h:  64px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 20px rgba(0,0,0,.18);
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sb-logo-icon {
  width: 38px; height: 38px;
  background: var(--red);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.sb-logo-text strong { display: block; color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.sb-logo-text span   { color: rgba(255,255,255,.4); font-size: 11px; }

.sb-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active svg { color: var(--red); }

.sb-bottom {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px;
  background: none; border: none; border-radius: 8px;
  color: rgba(255,255,255,.35); font-size: 13px; font-family: inherit;
  cursor: pointer; transition: background .15s, color .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.7); }

/* ── Main wrap ──────────────────────────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; }
.view-title  { font-size: 19px; font-weight: 700; color: var(--navy); }
.view-date   { font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.btn-notif {
  position: relative;
  width: 38px; height: 38px;
  border: 1.5px solid var(--border); border-radius: 9px;
  background: var(--surface); cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
}
.btn-notif:hover { border-color: var(--navy); color: var(--navy); }
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.btn-primary {
  display: flex; align-items: center; gap: 7px;
  background: var(--red); color: #fff;
  border: none; border-radius: 9px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-primary:hover  { background: var(--red-dk); box-shadow: 0 4px 14px rgba(232,40,58,.35); }
.btn-primary:active { transform: scale(.97); }

/* ── Notification panel ─────────────────────────────────────────────────────── */
.notif-panel {
  position: fixed; top: var(--topbar-h); right: 0;
  width: 340px; max-height: calc(100vh - var(--topbar-h));
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 12px;
  box-shadow: -4px 4px 24px rgba(0,0,0,.1);
  z-index: 90;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600;
}
.notif-panel-header button {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 16px; padding: 2px 6px; border-radius: 5px;
}
.notif-panel-header button:hover { background: var(--gray-lt); }
.notif-list { flex: 1; overflow-y: auto; padding: 8px; }
.notif-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 16px; }
.notif-entry {
  display: flex; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  margin-bottom: 4px; cursor: pointer;
  transition: background .12s;
}
.notif-entry:hover { background: var(--bg); }
.notif-entry.unread { background: #EFF6FF; }
.notif-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.notif-icon.whatsapp { background: #D1FAE5; }
.notif-icon.manual   { background: var(--navy); color: #fff; }
.notif-body strong  { display: block; font-size: 13px; font-weight: 600; }
.notif-body span    { font-size: 12px; color: var(--muted); }

/* ── Content area ───────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ── Loading ────────────────────────────────────────────────────────────────── */
.loading-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; gap: 14px; color: var(--muted);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stats row ──────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.blue::before   { background: var(--oficial); }
.stat-card.green::before  { background: var(--green); }
.stat-card.amber::before  { background: var(--taller); }
.stat-card.red::before    { background: var(--red); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); margin: 4px 0 0; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Section header ─────────────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 15px; font-weight: 600; color: var(--navy); }

/* ── Grid 2 cols ────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--navy);
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 0; }

/* ── Appointment row ────────────────────────────────────────────────────────── */
.appt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.appt-row:last-child { border-bottom: none; }
.appt-row:hover { background: var(--bg); }

.appt-time {
  font-size: 13px; font-weight: 700;
  color: var(--navy); width: 44px; flex-shrink: 0;
  text-align: center;
}
.appt-type-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.appt-type-dot.oficial { background: var(--oficial); }
.appt-type-dot.taller  { background: var(--taller); }

.appt-info { flex: 1; min-width: 0; }
.appt-name   { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-detail { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.appt-status { flex-shrink: 0; }

/* ── Status badge ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}
.badge.pending     { background: #FEF3C7; color: #92400E; }
.badge.confirmed   { background: var(--green-lt); color: #065F46; }
.badge.in_progress { background: var(--purple-lt); color: #5B21B6; }
.badge.done        { background: var(--gray-lt); color: #4B5563; }
.badge.cancelled   { background: var(--red-lt); color: #9B1C1C; }

/* ── Type badge ─────────────────────────────────────────────────────────────── */
.type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
}
.type-badge.oficial { background: var(--oficial-lt); color: #1D4ED8; border: 1px solid var(--oficial-bd); }
.type-badge.taller  { background: var(--taller-lt);  color: #92400E; border: 1px solid var(--taller-bd); }

/* ── Calendar ───────────────────────────────────────────────────────────────── */
.cal-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.cal-toolbar .date-label {
  font-size: 18px; font-weight: 700; color: var(--navy);
  min-width: 200px;
}
.cal-mode-tabs {
  display: flex; gap: 2px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}
.cal-mode-tab {
  padding: 5px 14px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; color: var(--muted); background: none;
  transition: background .15s, color .15s;
}
.cal-mode-tab.active { background: var(--surface); color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.btn-nav {
  width: 34px; height: 34px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; font-size: 16px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
}
.btn-nav:hover { border-color: var(--navy); color: var(--navy); }
.btn-today {
  padding: 5px 13px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: inherit; color: var(--muted);
  transition: border-color .15s, color .15s;
}
.btn-today:hover { border-color: var(--navy); color: var(--navy); }

/* ── Day view ───────────────────────────────────────────────────────────────── */
.day-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.day-view-inner {
  display: flex;
  overflow-x: auto;
}
.day-time-col {
  width: 56px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  position: sticky; left: 0; background: var(--surface); z-index: 2;
}
.day-time-header {
  height: 48px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.day-time-label {
  height: 60px;
  display: flex; align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.day-resource-col {
  flex: 1; min-width: 160px;
  border-right: 1px solid var(--border);
  position: relative;
}
.day-resource-col:last-child { border-right: none; }
.day-resource-header {
  height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--navy);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 1;
}
.day-slots {
  position: relative;
}
.day-slot {
  height: 60px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.day-slot:last-child { border-bottom: none; }
.day-slot:hover { background: rgba(37,99,235,.04); }
.day-slot.half-hour { border-bottom-style: dashed; border-bottom-color: rgba(0,0,0,.06); }

/* Appointment block in calendar */
.cal-appt {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  overflow: hidden;
  z-index: 1;
  transition: filter .12s, transform .12s;
  border-left: 3px solid;
}
.cal-appt:hover { filter: brightness(.95); transform: scale(1.01); z-index: 2; }
.cal-appt.oficial {
  background: var(--oficial-lt);
  border-color: var(--oficial);
  color: #1e40af;
}
.cal-appt.taller {
  background: var(--taller-lt);
  border-color: var(--taller);
  color: #78350f;
}
.cal-appt.cancelled { opacity: .45; }
.cal-appt-time { font-size: 10px; font-weight: 700; opacity: .7; }
.cal-appt-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt-svc  { font-size: 11px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Week view ──────────────────────────────────────────────────────────────── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.week-day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.week-day-card:hover { border-color: var(--navy); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.week-day-card.today { border-color: var(--red); }
.week-day-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.week-day-name  { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.week-day-num   { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.week-day-card.today .week-day-num { color: var(--red); }
.week-day-body  { padding: 8px; min-height: 80px; }
.week-appt-chip {
  font-size: 11px; padding: 3px 7px; border-radius: 4px;
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
}
.week-appt-chip.oficial { background: var(--oficial-lt); color: #1e40af; }
.week-appt-chip.taller  { background: var(--taller-lt);  color: #78350f; }
.week-more { font-size: 11px; color: var(--muted); padding: 2px 7px; }

/* ── Appointments list view ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--navy); }
.filter-bar input { flex: 1; min-width: 180px; }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  padding: 12px 16px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px; font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); cursor: pointer; }
.td-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
tr:hover .td-actions { opacity: 1; }

/* ── Clients view ───────────────────────────────────────────────────────────── */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.client-card:hover { border-color: var(--navy-muted); box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.client-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--navy);
  color: #fff; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.client-name  { font-size: 15px; font-weight: 600; }
.client-phone { font-size: 13px; color: var(--muted); margin-top: 2px; }
.client-meta  { display: flex; gap: 8px; margin-top: 10px; }
.client-chip  {
  font-size: 11px; font-weight: 500; padding: 3px 9px;
  border-radius: 20px; background: var(--bg); color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Config ─────────────────────────────────────────────────────────────────── */
.config-sections { display: flex; flex-direction: column; gap: 24px; }
.config-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.config-section-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--navy);
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 20px; color: var(--muted); text-align: center;
}
.empty-state svg  { width: 48px; height: 48px; opacity: .3; margin-bottom: 12px; }
.empty-state p    { font-size: 14px; }
.empty-state small { font-size: 12px; opacity: .7; margin-top: 4px; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(9,23,41,.55);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--surface);
  border-radius: 16px;
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  transform: translateY(16px) scale(.98);
  transition: transform .2s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 0;
}
.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--navy); }
.modal-close {
  width: 30px; height: 30px; border-radius: 7px;
  border: none; background: var(--bg); cursor: pointer;
  color: var(--muted); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 18px 22px; }
.modal-footer {
  padding: 14px 22px 20px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
label.lbl {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px;
}
.form-control {
  width: 100%; border: 1.5px solid var(--border); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(13,33,55,.07); }
.form-control:disabled { background: var(--bg); color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 70px; }

/* Type toggle */
.type-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 16px;
}
.type-toggle-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit;
  transition: all .15s; color: var(--muted);
}
.type-toggle-btn:hover { border-color: var(--border-dk); color: var(--text); }
.type-toggle-btn.selected.oficial { border-color: var(--oficial); background: var(--oficial-lt); color: #1e40af; }
.type-toggle-btn.selected.taller  { border-color: var(--taller);  background: var(--taller-lt);  color: #78350f; }

/* Availability slots */
.avail-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 8px;
}
.slot-btn {
  padding: 8px 4px; text-align: center;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit; color: var(--navy);
  transition: all .15s;
}
.slot-btn:hover  { border-color: var(--navy); background: var(--bg); }
.slot-btn.selected { border-color: var(--oficial); background: var(--oficial-lt); color: #1e40af; }
.slot-loading { font-size: 13px; color: var(--muted); text-align: center; padding: 12px; }

/* Client inline search */
.client-search-wrap { position: relative; }
.client-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 9px; z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 200px; overflow-y: auto;
}
.client-option {
  padding: 9px 12px; cursor: pointer; font-size: 14px;
  transition: background .1s; display: flex; align-items: center; gap: 8px;
}
.client-option:hover { background: var(--bg); }
.client-option small { font-size: 12px; color: var(--muted); }
.client-option.create-new { color: var(--oficial); font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all .15s;
}
.btn-red    { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dk); }
.btn-navy   { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-hover); }
.btn-ghost  { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--gray-lt); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon {
  width: 30px; height: 30px; padding: 0; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--navy); color: #fff;
  border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toast-in .25s cubic-bezier(.4,0,.2,1);
  max-width: 320px;
}
.toast.success { background: #065F46; }
.toast.error   { background: #9B1C1C; }
.toast.warning { background: #78350F; }
.toast.new-appt { background: var(--navy); border-left: 4px solid var(--red); }
@keyframes toast-in { from { opacity:0; transform: translateY(12px); } }

/* ── Detail panel ───────────────────────────────────────────────────────────── */
.detail-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
}
.detail-row { display: flex; gap: 6px; align-items: flex-start; }
.detail-label { font-size: 12px; font-weight: 600; color: var(--muted); min-width: 100px; text-transform: uppercase; letter-spacing: .3px; margin-top: 2px; }
.detail-value { font-size: 14px; color: var(--text); }

/* ── Plate badge ────────────────────────────────────────────────────────────── */
.plate {
  display: inline-block; background: var(--navy); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 5px;
}

/* ── API token box ──────────────────────────────────────────────────────────── */
.token-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
  font-family: 'Courier New', monospace; font-size: 13px;
}
.token-box span { flex: 1; word-break: break-all; color: var(--navy); }

/* ── Service search (modal) ──────────────────────────────────────────────────── */
.service-search-wrap { position: relative; }
.service-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 9px; z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 220px; overflow-y: auto;
}
.service-option {
  padding: 10px 14px; cursor: pointer; font-size: 14px;
  transition: background .1s; border-bottom: 1px solid var(--border);
}
.service-option:last-child { border-bottom: none; }
.service-option:hover { background: var(--bg); }
.service-option.create-svc { color: var(--oficial); font-weight: 600; }

/* ── Location tabs (calendar toolbar) ───────────────────────────────────────── */
.loc-tabs-bar {
  display: flex; gap: 2px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}
.loc-tab {
  padding: 5px 14px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; color: var(--muted); background: none;
  transition: background .15s, color .15s; white-space: nowrap;
}
.loc-tab.active { background: var(--navy); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.loc-tab:hover:not(.active) { color: var(--navy); }

/* ── Location day view ───────────────────────────────────────────────────────── */
.loc-day-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.loc-day-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.loc-day-name { font-size: 16px; font-weight: 700; color: var(--navy); }
.loc-day-date { font-size: 13px; color: var(--muted); }

.loc-slots { display: flex; flex-direction: column; }

.loc-slot-row {
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--border);
  min-height: 110px;
}
.loc-slot-row:last-child { border-bottom: none; }
.loc-slot-row.full .loc-slot-label { background: #FEF2F2; }

.loc-slot-label {
  width: 80px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  background: var(--bg); gap: 4px;
}
.loc-slot-time { font-size: 17px; font-weight: 700; color: var(--navy); }
.loc-slot-cap  { font-size: 11px; color: var(--muted); font-weight: 500; }
.loc-slot-row.full .loc-slot-time { color: var(--red); }

.loc-slot-cards {
  flex: 1;
  display: flex; gap: 12px;
  padding: 12px 16px;
  align-items: stretch;
}

/* ── Appointment card inside slot ────────────────────────────────────────────── */
.slot-card {
  flex: 1; min-width: 0;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 5px;
  transition: filter .12s, transform .12s;
  border-left: 3px solid transparent;
}
.slot-card:not(.empty):hover { filter: brightness(.95); transform: scale(1.01); }
.slot-card.oficial { background: var(--oficial-lt); border-color: var(--oficial); color: #1e40af; }
.slot-card.taller  { background: var(--taller-lt);  border-color: var(--taller);  color: #78350f; }
.slot-card.empty {
  background: var(--bg);
  border: 2px dashed var(--border); border-left: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px;
  color: var(--muted); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.slot-card.empty:hover { border-color: var(--navy); color: var(--navy); background: var(--oficial-lt); }
.slot-card-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-card-svc  { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-card-plus { font-size: 26px; font-weight: 200; line-height: 1; }
.slot-card-new  { font-size: 12px; font-weight: 500; }

/* ── Location selector in appointment modal ──────────────────────────────────── */
.loc-selector {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
}
.loc-btn {
  flex: 1; min-width: 90px;
  padding: 9px 12px; border-radius: 9px;
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
  transition: all .15s; color: var(--muted); text-align: center;
}
.loc-btn:hover  { border-color: var(--navy); color: var(--navy); }
.loc-btn.selected { border-color: var(--navy); background: var(--navy); color: #fff; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .sidebar { width: 56px; }
  .sb-logo-text, .nav-item span, .sb-bottom .btn-logout span { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .main-wrap { margin-left: 56px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
