/* ═══════════════════════════════════════════════════════════════════════
   Callender Admin — flat SaaS design system
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ──────────────────────────────────────────────────── */
:root {
  --bg:          #f8f9fa;
  --surface:     #ffffff;
  --border:      #e5e7eb;
  --border-light:#f3f4f6;
  --text-base:   #374151;
  --text-strong: #111827;
  --text-muted:  #6b7280;
  --text-faint:  #9ca3af;
  --accent:      #0d9488;
  --accent-dark: #0f766e;
  --accent-bg:   #f0fdfa;
  --radius:      8px;
  --radius-lg:   10px;
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-base);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; }

/* ── Shell ──────────────────────────────────────────────────────────── */
.admin-shell { display: flex; height: 100%; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}
.sidebar.is-open { transform: translateX(0); }
@media (min-width: 1024px) {
  .sidebar { position: static; transform: none; transition: none; }
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 20;
}
.sidebar-overlay.is-open { display: block; }
@media (min-width: 1024px) { .sidebar-overlay { display: none !important; } }

/* Sidebar header */
.sidebar-header {
  display: flex; align-items: center; gap: 0.75rem;
  height: 60px; padding: 0 1.125rem;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius);
  background: var(--accent); color: #fff; flex-shrink: 0;
}
.sidebar-tenant-name {
  font-size: 0.9375rem; font-weight: 600; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Sidebar nav */
.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 0.75rem 0.625rem;
  display: flex; flex-direction: column; gap: 1px;
}
.nav-divider { height: 1px; background: var(--border-light); margin: 0.5rem 0; }
.nav-section-label {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 0.75rem 0.75rem 0.25rem;
  display: block;
}

.nav-link {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}
.nav-link:hover { background: var(--border-light); color: var(--text-strong); }
.nav-link.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; }
.nav-link.active .nav-icon,
.nav-link:hover  .nav-icon { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border-light);
  padding: 0.75rem 0.875rem;
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 0.625rem; }
.sidebar-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-dark);
  font-weight: 600; font-size: 0.75rem; flex-shrink: 0;
  border: 1px solid #99f6e4;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name  { font-size: 0.8125rem; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-email { font-size: 0.75rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main area ──────────────────────────────────────────────────────── */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.admin-content { flex: 1; overflow-y: auto; padding: 1.5rem 1rem; }
@media (min-width: 640px)  { .admin-content { padding: 1.5rem; } }
@media (min-width: 1024px) { .admin-content { padding: 1.75rem 2rem; } }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  height: 60px; flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
}
@media (min-width: 640px) { .topbar { padding: 0 1.5rem; } }
.topbar-menu-btn {
  padding: 6px; border-radius: 6px; background: none; border: none;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
}
.topbar-menu-btn:hover { background: var(--border-light); }
@media (min-width: 1024px) { .topbar-menu-btn { display: none; } }
.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 0.9375rem; font-weight: 600; color: var(--text-strong); }
.topbar-breadcrumb { font-size: 0.75rem; color: var(--text-faint); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-dark);
  font-weight: 600; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid #99f6e4;
}
.logout-btn {
  background: none; border: none; color: var(--text-faint);
  padding: 4px; border-radius: 4px; display: flex; align-items: center;
}
.logout-btn:hover { color: var(--text-base); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.4375rem 0.875rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; line-height: 1.25;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--text-base); border-color: var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }
.btn-teal-soft,
.btn-teal { background: var(--accent-bg); color: var(--accent-dark); border-color: #99f6e4; }
.btn-teal-soft:hover,
.btn-teal:hover { background: #ccfbf1; }
.btn-warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.btn-warning:hover { background: #fef3c7; border-color: #fcd34d; }
.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.8125rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Page header ────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.page-header-title    { font-size: 1.25rem; font-weight: 700; color: var(--text-strong); margin: 0 0 0.125rem; line-height: 1.3; }
.page-header-subtitle { font-size: 0.875rem; color: var(--text-muted); margin: 0; }
.page-header-actions  { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header {
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 0.9375rem; font-weight: 600; color: var(--text-strong); }
.card-body   { padding: 1.125rem; }
.card-footer {
  padding: 0.75rem 1.125rem;
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  background: #fafafa;
}

/* ── Flash messages ─────────────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 8px;
  padding: 0.75rem 1rem; border-radius: var(--radius);
  font-size: 0.875rem; margin-bottom: 1.25rem; border: 1px solid;
}
.flash svg { width: 16px; height: 16px; flex-shrink: 0; }
.flash-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.flash-error   { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.flash-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--text-base); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  display: block; width: 100%; padding: 0.4375rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.875rem; color: var(--text-strong); background: var(--surface); line-height: 1.5;
  transition: border-color 0.1s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-input.is-error { border-color: #f87171; }
.form-error { font-size: 0.75rem; color: #dc2626; margin-top: 4px; }
.form-hint  { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1.125rem; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox], .form-check input[type=radio] {
  width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0;
}
.form-check-label { font-size: 0.875rem; color: var(--text-base); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table thead tr { background: #fafafa; }
.data-table th {
  padding: 0.6875rem 1rem; text-align: left;
  font-size: 0.6875rem; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table th.right, .data-table td.right { text-align: right; }
.data-table th.center, .data-table td.center { text-align: center; }
.data-table tbody tr { border-bottom: 1px solid var(--border-light); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #fafafa; }
.data-table td { padding: 0.75rem 1rem; color: var(--text-base); vertical-align: middle; }
.data-table tfoot td { padding: 0.75rem 1rem; background: #fafafa; border-top: 1px solid var(--border); }
.data-table tfoot tr:first-child td { font-weight: 600; color: var(--text-strong); }
.table-ref { font-family: ui-monospace, monospace; color: var(--accent); font-size: 0.8125rem; }
.table-link { color: var(--accent); font-weight: 500; }
.table-link:hover { color: var(--accent-dark); text-decoration: underline; }
.table-name-link { color: var(--text-strong); font-weight: 500; }
.table-name-link:hover { color: var(--accent); }
.empty-state { padding: 3rem 1.5rem; text-align: center; font-size: 0.875rem; color: var(--text-faint); }
.empty-state a { color: var(--accent); }
.empty-state a:hover { text-decoration: underline; }

/* ── Status Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 600;
  border: 1px solid; white-space: nowrap; letter-spacing: 0.01em;
}
.badge-confirmed, .badge-paid     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-pending,   .badge-unpaid   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-open                        { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-partial                     { background: #fefce8; color: #854d0e; border-color: #fef08a; }
.badge-cancelled, .badge-overdue  { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.badge-no_show                     { background: #f9fafb; color: #4b5563; border-color: var(--border); }
.badge-completed, .badge-draft    { background: #f9fafb; color: #4b5563; border-color: var(--border); }
.badge-sent, .badge-deposit_paid  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.status-dot-on  { background: var(--accent); }
.status-dot-off { background: var(--border); }

/* ── Stat cards ─────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; margin-bottom: 1.75rem; }
@media (min-width: 640px) { .stat-grid-4 { grid-template-columns: repeat(4,1fr); } }
@media (min-width: 640px) { .stat-grid-3 { grid-template-columns: repeat(3,1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.125rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius); flex-shrink: 0;
}
.stat-icon-teal   { background: var(--accent-bg); color: var(--accent); }
.stat-icon-green  { background: #f0fdf4; color: #16a34a; }
.stat-icon-purple { background: #faf5ff; color: #9333ea; }
.stat-icon-red    { background: #fef2f2; color: #ef4444; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-value { font-size: 1.625rem; font-weight: 700; color: var(--text-strong); line-height: 1.1; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.stat-simple {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.125rem;
}
.stat-simple .stat-label { margin-bottom: 4px; font-size: 0.75rem; color: var(--text-muted); }
.stat-simple .stat-value { font-size: 1.625rem; font-weight: 700; color: var(--text-strong); }

/* ── Section label ──────────────────────────────────────────────────── */
.section-label {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); margin-bottom: 0.625rem;
}

/* ── Filter bar ─────────────────────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-bottom: 1rem; align-items: center; }
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 0; }
.filter-input-sm { width: 12rem; }

/* ── Grid layouts ───────────────────────────────────────────────────── */
.detail-layout { display: grid; gap: 1.25rem; }
@media (min-width: 1024px) { .detail-layout { grid-template-columns: 1fr 1fr 1fr; } }
.detail-main { display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 1024px) { .detail-main { grid-column: span 2; } }
.detail-aside { display: flex; flex-direction: column; gap: 1.25rem; }

.two-col-layout { display: grid; gap: 1rem; }
@media (min-width: 640px) { .two-col-layout { grid-template-columns: 1fr 1fr; } }

/* ── DL definitions ─────────────────────────────────────────────────── */
.dl-stack { display: flex; flex-direction: column; gap: 0.75rem; font-size: 0.875rem; }
.dl-item dt { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 2px; }
.dl-item dd { color: var(--text-base); }

.dl-rows { display: flex; flex-direction: column; gap: 0.625rem; font-size: 0.875rem; }
.dl-row  { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.dl-row dt { color: var(--text-muted); flex-shrink: 0; }
.dl-row dd { font-weight: 600; color: var(--text-strong); }

/* Detail grid inside card */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; font-size: 0.875rem; padding: 1.125rem; }
.info-grid .item dt { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 2px; }
.info-grid .item dd { color: var(--text-base); }
.info-grid .item-full { grid-column: span 2; }

/* ── Timeline ────────────────────────────────────────────────────────── */
.timeline { list-style: none; padding: 0; }
.timeline-item { display: flex; gap: 0.75rem; padding-bottom: 1.125rem; position: relative; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 10px; top: 22px;
  width: 1px; height: calc(100% - 22px); background: var(--border-light);
}
.timeline-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-bg); border: 2px solid #99f6e4;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.timeline-dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: block; }
.timeline-msg  { font-size: 0.875rem; color: var(--text-base); }
.timeline-meta { font-size: 0.75rem; color: var(--text-faint); margin-top: 2px; display: flex; gap: 0.375rem; flex-wrap: wrap; }

/* ── Customer notes ──────────────────────────────────────────────────── */
.note-list { display: flex; flex-direction: column; }
.note-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0; border-top: 1px solid var(--border-light); }
.note-item:first-child { border-top: none; }
.note-text { font-size: 0.875rem; color: var(--text-base); }
.note-meta { font-size: 0.75rem; color: var(--text-faint); margin-top: 2px; }
.note-del { background: none; border: none; color: var(--border); padding: 2px; border-radius: 4px; display: flex; align-items: center; }
.note-del:hover { color: #ef4444; }

/* ── Pagination ──────────────────────────────────────────────────────── */
nav[role=navigation] { margin-top: 1rem; }
.pagination { display: flex; flex-wrap: wrap; gap: 3px; }
.pagination span, .pagination a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: var(--radius); font-size: 0.875rem;
  border: 1px solid var(--border); color: var(--text-base);
}
.pagination a:hover { background: var(--border-light); }
.pagination .bg-white { background: var(--surface); }
.pagination .border-indigo-500, .pagination [aria-current=page] span {
  background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important;
}
.pagination-wrapper { margin-top: 1rem; }

/* ── Back link ───────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.25rem;
  transition: color 0.1s;
}
.back-link:hover { color: var(--text-strong); }
.back-link svg { width: 15px; height: 15px; }

/* ── Spacing helpers ─────────────────────────────────────────────────── */
.mb-1  { margin-bottom: 0.25rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.mb-8  { margin-bottom: 2rem; }
.mt-1  { margin-top: 0.25rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-4  { margin-top: 1rem; }
.ml-2  { margin-left: 0.5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }

/* ── Flex helpers ────────────────────────────────────────────────────── */
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.justify-center  { justify-content: center; }
.flex-1          { flex: 1; }
.flex-wrap       { flex-wrap: wrap; }
.shrink-0        { flex-shrink: 0; }
.min-w-0         { min-width: 0; }
.gap-1-5         { gap: 0.375rem; }
.w-full          { width: 100%; }
.max-w-lg        { max-width: 32rem; }
.max-w-sm        { max-width: 24rem; }

/* ── Typography helpers ──────────────────────────────────────────────── */
.text-xs       { font-size: 0.75rem; }
.text-sm       { font-size: 0.875rem; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }
.font-mono     { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.uppercase     { text-transform: uppercase; }
.italic        { font-style: italic; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-gray-400 { color: var(--text-faint); }
.text-gray-500 { color: var(--text-faint); }
.text-gray-600 { color: var(--text-muted); }
.text-gray-700 { color: var(--text-base); }
.text-gray-900 { color: var(--text-strong); }
.text-teal-600   { color: var(--accent); }
.text-teal-700   { color: var(--accent-dark); }
.text-red-600    { color: #dc2626; }
.text-red-700    { color: #b91c1c; }
.text-green-600  { color: #16a34a; }
.text-amber-700  { color: #b45309; }
.text-white      { color: #fff; }

/* ── Login page ──────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg); }
.login-box  { width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: var(--radius-lg);
  background: var(--accent); color: #fff; margin-bottom: 1rem;
}
.login-logo-icon svg { width: 26px; height: 26px; }
.login-logo h1 { font-size: 1.25rem; font-weight: 700; color: var(--text-strong); }
.login-logo p  { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.75rem; color: var(--text-faint); }

/* ── Divider ─────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-light); margin: 0.5rem 0; }

/* ── Hidden ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
@media (min-width: 640px) { .sm-show { display: inline-flex !important; } }

/* ── Settings page ───────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 960px) {
  .settings-grid { grid-template-columns: 1fr 272px; }
  .settings-main    { grid-column: 1; }
  .settings-sidebar { grid-column: 2; }
}
.settings-integration-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.settings-integration-title { font-size: 0.875rem; font-weight: 600; color: var(--text-strong); margin: 0 0 0.125rem; }
.settings-integration-desc  { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }
.settings-section-divider { height: 1px; background: var(--border-light); margin: 1.125rem 0; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-flex; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 2.25rem; height: 1.25rem;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 1rem; height: 1rem;
  background: #fff; border-radius: 50%;
  transition: transform 0.15s;
}
.toggle-switch input:checked ~ .toggle-track { background: var(--accent); }
.toggle-switch input:checked ~ .toggle-track::after { transform: translateX(1rem); }

/* Form grid helpers */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.col-span-2  { grid-column: 1 / -1; }

/* File input */
.form-input-file { display: block; width: 100%; font-size: 0.875rem; color: var(--text-muted); }
.form-input-file::file-selector-button {
  margin-right: 0.75rem; padding: 0.3125rem 0.625rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-base);
  font-size: 0.8125rem; font-weight: 500; cursor: pointer;
}
.form-input-file::file-selector-button:hover { background: var(--border-light); }

/* Booking URL code block */
.booking-url-code {
  display: block; font-size: 0.8125rem; font-family: monospace;
  background: #fafafa; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem 0.75rem;
  word-break: break-all; color: var(--text-base); user-select: all;
}

/* ── Service checkbox rows ───────────────────────────────────────────── */
.service-check-row {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.5625rem 0.875rem;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
  font-size: 0.875rem;
}
.service-check-row:hover { border-color: var(--accent); background: var(--accent-bg); }
.service-check-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }
.service-check-name { flex: 1; font-weight: 500; color: var(--text-base); }
.service-check-meta { color: var(--text-muted); white-space: nowrap; }

/* ── Calendar ────────────────────────────────────────────────────────── */
.cal-nav { display: flex; align-items: center; gap: 0.5rem; }
.cal-nav-title {
  font-size: 1rem; font-weight: 700; color: var(--text-strong);
  min-width: 12rem; text-align: center;
}

.cal-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none; overflow: hidden;
}
.cal-header > div {
  padding: 0.5rem 0.5rem;
  font-size: 0.6875rem; font-weight: 600; color: var(--text-faint);
  text-align: center; text-transform: uppercase; letter-spacing: 0.04em;
  border-right: 1px solid var(--border-light);
}
.cal-header > div:last-child { border-right: none; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  gap: 1px; overflow: hidden;
}
.cal-cell {
  background: var(--surface);
  min-height: 7rem; padding: 0.5rem;
  display: flex; flex-direction: column; gap: 0.125rem;
}
.cal-cell-empty { background: #fafafa; }
.cal-cell-today { background: #fffdf0; }

.cal-day-num {
  font-size: 0.8125rem; font-weight: 500; color: var(--text-faint);
  margin-bottom: 0.25rem; line-height: 1;
  width: 1.5rem; text-align: center;
}
.cal-day-num-today {
  color: #fff; background: var(--accent);
  border-radius: 50%; width: 1.5rem; height: 1.5rem;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.cal-event {
  display: flex; align-items: baseline; gap: 0.25rem;
  padding: 0.1875rem 0.375rem;
  font-size: 0.75rem; line-height: 1.3;
  background: var(--accent-bg); color: var(--accent-dark);
  border-left: 2px solid var(--accent);
  overflow: hidden; text-decoration: none;
  transition: opacity 0.1s;
}
.cal-event:hover { opacity: 0.75; }
.cal-event-time { font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.cal-event-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }

.cal-event-pending   { background: #fffbeb; color: #b45309; border-left-color: #f59e0b; }
.cal-event-completed { background: #f9fafb; color: #4b5563; border-left-color: #9ca3af; }
.cal-event-no_show   { background: #fef2f2; color: #dc2626; border-left-color: #ef4444; }
.cal-event-confirmed { background: var(--accent-bg); color: var(--accent-dark); border-left-color: var(--accent); }

.cal-more { font-size: 0.6875rem; color: var(--accent); padding: 0 0.25rem; text-decoration: none; }
.cal-more:hover { text-decoration: underline; }

.cal-legend {
  display: flex; flex-wrap: wrap; gap: 0.625rem 1.125rem;
  font-size: 0.8125rem; color: var(--text-muted);
}
.cal-legend-item { display: flex; align-items: center; gap: 0.375rem; }
.cal-legend-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

@media (max-width: 640px) {
  .cal-cell { min-height: 4rem; padding: 0.25rem; }
  .cal-event-name { display: none; }
  .cal-header > div { padding: 0.375rem 0.1875rem; font-size: 0.625rem; }
  .cal-nav-title { min-width: 8rem; font-size: 0.9rem; }
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40; pointer-events: none;
}
.modal-overlay.is-open { display: block; pointer-events: auto; }

.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: transform 0.18s ease, opacity 0.18s ease, visibility 0s linear 0.18s;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; max-height: 90vh;
  overflow: hidden; display: flex; flex-direction: column;
  z-index: 50;
}
.modal.is-open {
  transform: translate(-50%, -50%);
  opacity: 1; pointer-events: auto; visibility: visible;
  transition: transform 0.18s ease, opacity 0.18s ease, visibility 0s linear 0s;
}
@media (max-width: 600px) {
  .modal {
    top: auto; left: 0; right: 0; bottom: 0;
    transform: translateY(100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 100%; max-height: 92vh;
  }
  .modal.is-open { transform: translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.modal-header h3 { font-size: 0.9375rem; font-weight: 700; color: var(--text-strong); }
.modal-close {
  background: none; border: none; color: var(--text-faint);
  padding: 4px; border-radius: 6px; display: flex; align-items: center; cursor: pointer;
}
.modal-close:hover { background: var(--border-light); color: var(--text-base); }
.modal-body {
  flex: 1; overflow-y: auto; padding: 1.125rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.625rem;
  padding: 0.75rem 1.125rem;
  border-top: 1px solid var(--border-light); flex-shrink: 0;
  background: #fafafa;
}

/* ── Business hours ──────────────────────────────────────────────────── */
.hours-table { display: flex; flex-direction: column; }
.hours-row {
  display: grid;
  grid-template-columns: 7rem 6rem 1fr auto;
  align-items: center; gap: 0.75rem;
  padding: 0.5625rem 0;
  border-bottom: 1px solid var(--border-light);
}
.hours-row:last-child { border-bottom: none; }
.hours-day           { font-size: 0.875rem; font-weight: 500; color: var(--text-base); }
.hours-toggle        { display: flex; align-items: center; gap: 0.5rem; }
.hours-toggle input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--accent); }
.hours-toggle-label  { font-size: 0.8125rem; color: var(--text-muted); }
.hours-times         { display: flex; align-items: center; gap: 0.5rem; }
.hours-time-input    { width: 6.5rem !important; }
.hours-sep           { font-size: 0.875rem; color: var(--text-faint); flex-shrink: 0; }
.hours-closed-label  { display: flex; align-items: center; }

@media (max-width: 600px) {
  .hours-row { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0.375rem; }
  .hours-times { grid-column: 1 / -1; }
  .hours-closed-label { grid-column: 1 / -1; }
}

/* ── Slots mini grid ─────────────────────────────────────────────────── */
.slots-mini-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0.375rem; margin-top: 0.5rem;
}
@media (max-width: 400px) { .slots-mini-grid { grid-template-columns: repeat(3, 1fr); } }

.slot-btn-mini {
  padding: 0.375rem 0.25rem;
  font-size: 0.8125rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-base);
  cursor: pointer; text-align: center;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.slot-btn-mini:hover   { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.slot-btn-mini.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Calendar closed cells ───────────────────────────────────────────── */
.cal-cell-closed {
  background: repeating-linear-gradient(
    -45deg, #fafafa, #fafafa 4px, #f3f4f6 4px, #f3f4f6 8px
  );
  cursor: default !important;
}
.cal-cell-closed .cal-day-num { color: var(--text-faint); }
.cal-closed-label {
  display: block; font-size: 0.6875rem; color: var(--text-faint);
  letter-spacing: 0.02em; margin-top: 2px;
}
.cal-cell-closed .cal-event { opacity: 0.6; }
.cal-cell-has-bookings { background: #f9fffe; }
.cal-legend-dot-closed {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  background: repeating-linear-gradient(
    -45deg, #f3f4f6, #f3f4f6 3px, #e5e7eb 3px, #e5e7eb 6px
  );
  border: 1px solid var(--border); flex-shrink: 0;
}

/* ── Language switcher ───────────────────────────────────────────────── */
.lang-switcher { display: flex; align-items: center; gap: 0.25rem; }
.lang-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: var(--radius);
  font-size: 0.9375rem; text-decoration: none;
  opacity: 0.45; transition: opacity 0.1s;
}
.lang-btn:hover   { opacity: 1; }
.lang-btn-active  { opacity: 1; cursor: default; }

/* ── Customer header ─────────────────────────────────────────────────── */
.customer-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.customer-header-identity { display: flex; align-items: center; gap: 0.875rem; }
.customer-avatar {
  flex-shrink: 0; width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-dark);
  border: 1px solid #99f6e4;
  font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.customer-header-name    { font-size: 1.25rem; font-weight: 700; color: var(--text-strong); margin: 0 0 0.125rem; }
.customer-header-meta    { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }
.customer-header-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ── Contact buttons ─────────────────────────────────────────────────── */
.contact-btn-group    { display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }
.contact-btn-whatsapp { color: #16a34a; border-color: #bbf7d0; }
.contact-btn-whatsapp:hover { background: #f0fdf4; }

/* ── Invoice edit helpers ─────────────────────────────────────────────── */
.form-input-sm { padding: 0.3125rem 0.5rem; font-size: 0.8125rem; }
.btn-icon-danger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px; border: none;
  background: transparent; color: #9ca3af; cursor: pointer; padding: 0;
}
.btn-icon-danger:hover { color: #dc2626; background: #fee2e2; }
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.875rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
