/* ============================================================
   PriveTime — Design System & Global Stylesheet
   Pure CSS3 Custom Properties · No frameworks
   ============================================================ */

/* ── 1. Design Tokens ──────────────────────────────────────── */
:root {
  /* Brand palette */
  --pt-accent:          #6C63FF;
  --pt-accent-light:    #8B84FF;
  --pt-accent-dark:     #4B44CC;
  --pt-accent-glow:     rgba(108, 99, 255, 0.25);
  --pt-danger:          #FF5C72;
  --pt-success:         #2DD4A0;
  --pt-warning:         #F5A623;
  --pt-info:            #38BDF8;

  /* Light mode surfaces */
  --bg-base:            #F4F5FB;
  --bg-surface:         #FFFFFF;
  --bg-surface-2:       #ECEEF8;
  --bg-glass:           rgba(255, 255, 255, 0.72);
  --bg-glass-border:    rgba(108, 99, 255, 0.12);
  --bg-overlay:         rgba(20, 18, 50, 0.45);

  /* Light mode text */
  --text-primary:       #12102E;
  --text-secondary:     #5B5880;
  --text-muted:         #9896B8;
  --text-inverse:       #FFFFFF;

  /* Borders & shadows */
  --border-subtle:      rgba(108, 99, 255, 0.10);
  --border-default:     rgba(108, 99, 255, 0.20);
  --shadow-sm:          0 1px 4px rgba(12, 10, 40, 0.06);
  --shadow-md:          0 4px 20px rgba(12, 10, 40, 0.10);
  --shadow-lg:          0 12px 40px rgba(12, 10, 40, 0.14);
  --shadow-glow:        0 0 24px rgba(108, 99, 255, 0.30);

  /* Typography */
  --font-sans:          'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:          'JetBrains Mono', 'Fira Code', monospace;
  --text-xs:            0.72rem;
  --text-sm:            0.85rem;
  --text-base:          1rem;
  --text-lg:            1.125rem;
  --text-xl:            1.25rem;
  --text-2xl:           1.5rem;
  --text-3xl:           1.875rem;
  --text-4xl:           2.25rem;
  --text-5xl:           3rem;

  /* Spacing */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-5: 1.25rem;  --sp-6: 1.5rem;   --sp-8: 2rem;     --sp-10: 2.5rem;
  --sp-12: 3rem;    --sp-16: 4rem;    --sp-20: 5rem;    --sp-24: 6rem;

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

  /* Transitions */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:    150ms;
  --dur-base:    250ms;
  --dur-slow:    400ms;

  /* Sidebar */
  --sidebar-w:   240px;
  --topbar-h:    64px;
}

/* ── Dark Mode Tokens ──────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:            #0E0C24;
  --bg-surface:         #16132E;
  --bg-surface-2:       #1E1A3A;
  --bg-glass:           rgba(22, 19, 46, 0.80);
  --bg-glass-border:    rgba(108, 99, 255, 0.20);
  --bg-overlay:         rgba(0, 0, 0, 0.60);

  --text-primary:       #EDEAFF;
  --text-secondary:     #9896C8;
  --text-muted:         #5E5C88;
  --text-inverse:       #12102E;

  --border-subtle:      rgba(108, 99, 255, 0.12);
  --border-default:     rgba(108, 99, 255, 0.25);
  --shadow-sm:          0 1px 4px rgba(0, 0, 0, 0.30);
  --shadow-md:          0 4px 20px rgba(0, 0, 0, 0.40);
  --shadow-lg:          0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-glow:        0 0 32px rgba(108, 99, 255, 0.40);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--dur-slow) var(--ease-out),
              color var(--dur-slow) var(--ease-out);
  min-height: 100vh;
}

a { color: var(--pt-accent); text-decoration: none; transition: color var(--dur-fast); }
a:hover { color: var(--pt-accent-light); }

img, svg { display: block; max-width: 100%; }

ul, ol { list-style: none; }

button { cursor: pointer; font-family: inherit; }

input, select, textarea {
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
}

/* ── 3. Typography ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p { color: var(--text-secondary); }

.text-accent  { color: var(--pt-accent); }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--pt-success); }
.text-danger  { color: var(--pt-danger); }
.text-warning { color: var(--pt-warning); }

/* ── 4. Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  outline: none;
  transition: all var(--dur-base) var(--ease-out);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--pt-accent), var(--pt-accent-dark));
  color: #fff;
  box-shadow: 0 4px 16px var(--pt-accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(108, 99, 255, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover {
  border-color: var(--pt-accent);
  color: var(--pt-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-ghost:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, var(--pt-danger), #CC3A4E);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 92, 114, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, var(--pt-success), #1FAA7A);
  color: #fff;
  box-shadow: 0 4px 16px rgba(45, 212, 160, 0.25);
}

.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: var(--text-base); }
.btn-icon {
  padding: var(--sp-2);
  width: 36px;
  height: 36px;
  justify-content: center;
  border-radius: var(--radius-md);
}

/* ── 5. Cards & Glass ──────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ── 6. Form Elements ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--pt-accent);
  box-shadow: 0 0 0 3px var(--pt-accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239896B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: var(--sp-3); }
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  transition: background var(--dur-base), border-color var(--dur-base);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--dur-base) var(--ease-spring), background var(--dur-base);
}
.toggle input:checked + .toggle-slider { background: var(--pt-accent); border-color: var(--pt-accent); }
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px) translateY(-50%);
  background: #fff;
}

/* Color picker swatch */
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-default);
  cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.color-swatch:hover { border-color: var(--pt-accent); transform: scale(1.1); }

/* Day toggle pills */
.day-pills { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.day-pill {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast);
  user-select: none;
}
.day-pill.active {
  background: var(--pt-accent);
  border-color: var(--pt-accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--pt-accent-glow);
}

/* Medium chips */
.medium-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.medium-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.medium-chip.active {
  background: rgba(108, 99, 255, 0.12);
  border-color: var(--pt-accent);
  color: var(--pt-accent);
}

/* ── 7. Badges & Tags ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-accent  { background: rgba(108,99,255,0.12); color: var(--pt-accent); }
.badge-success { background: rgba(45,212,160,0.12); color: var(--pt-success); }
.badge-danger  { background: rgba(255,92,114,0.12); color: var(--pt-danger); }
.badge-warning { background: rgba(245,166,35,0.12); color: var(--pt-warning); }
.badge-info    { background: rgba(56,189,248,0.12); color: var(--pt-info); }
.badge-muted   { background: var(--bg-surface-2); color: var(--text-muted); }

/* Status dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--pt-success); box-shadow: 0 0 6px var(--pt-success); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.warning { background: var(--pt-warning); box-shadow: 0 0 6px var(--pt-warning); }

/* ── 8. Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr {
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
}
.data-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--dur-fast); }
.data-table tbody tr:hover { background: var(--bg-surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── 9. Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--dur-slow) var(--ease-spring);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.modal-title { font-size: var(--text-xl); font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-lg);
  padding: var(--sp-2);
  border-radius: var(--radius-md);
  transition: all var(--dur-fast);
}
.modal-close:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.modal-footer {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-6);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-subtle);
}

/* ── 10. Toasts ────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  animation: toastIn var(--dur-slow) var(--ease-spring) forwards;
  max-width: 360px;
}
.toast.removing { animation: toastOut var(--dur-base) var(--ease-out) forwards; }
.toast-icon { font-size: var(--text-lg); flex-shrink: 0; }
.toast.success .toast-icon { color: var(--pt-success); }
.toast.error   .toast-icon { color: var(--pt-danger); }
.toast.info    .toast-icon { color: var(--pt-info); }
.toast.warning .toast-icon { color: var(--pt-warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

/* ── 11. Skeleton Loaders ──────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-surface-2) 25%,
    var(--border-subtle) 50%,
    var(--bg-surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 12. Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--pt-accent); }

/* ── 13. Utility Classes ───────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }
.gap-6  { gap: var(--sp-6); }
.gap-8  { gap: var(--sp-8); }
.w-full { width: 100%; }
.mt-4   { margin-top: var(--sp-4); }
.mt-6   { margin-top: var(--sp-6); }
.mt-8   { margin-top: var(--sp-8); }
.mb-4   { margin-bottom: var(--sp-4); }
.mb-6   { margin-bottom: var(--sp-6); }
.p-4    { padding: var(--sp-4); }
.p-6    { padding: var(--sp-6); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── 14. Divider ───────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-6) 0;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── 15. Avatar ────────────────────────────────────────────── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pt-accent), var(--pt-accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-lg { width: 52px; height: 52px; font-size: var(--text-lg); }

/* ── 16. Empty State ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-16);
  text-align: center;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; opacity: 0.4; }
.empty-state h4 { color: var(--text-secondary); font-size: var(--text-lg); }
.empty-state p  { font-size: var(--text-sm); max-width: 320px; }

/* ── 17. Section Header ────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.section-title { font-size: var(--text-xl); font-weight: 700; }
.section-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }

/* ── 18. Stat Card ─────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  transition: box-shadow var(--dur-base), transform var(--dur-base);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  flex-shrink: 0;
}
.stat-icon.accent  { background: rgba(108,99,255,0.12); color: var(--pt-accent); }
.stat-icon.success { background: rgba(45,212,160,0.12); color: var(--pt-success); }
.stat-icon.warning { background: rgba(245,166,35,0.12); color: var(--pt-warning); }
.stat-icon.info    { background: rgba(56,189,248,0.12); color: var(--pt-info); }
.stat-value { font-size: var(--text-3xl); font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }
.stat-delta { font-size: var(--text-xs); font-weight: 600; margin-top: var(--sp-1); }
.stat-delta.up   { color: var(--pt-success); }
.stat-delta.down { color: var(--pt-danger); }

/* ── 19. Rule Preview Banner ───────────────────────────────── */
.rule-preview {
  background: rgba(108, 99, 255, 0.06);
  border: 1px solid rgba(108, 99, 255, 0.18);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--pt-accent);
  font-style: italic;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  min-height: 44px;
}

/* ── 20. Calendar Widget ───────────────────────────────────── */
.calendar-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.cal-title { font-weight: 700; font-size: var(--text-base); }
.cal-nav { background: none; border: none; color: var(--text-secondary); padding: var(--sp-2); border-radius: var(--radius-md); transition: all var(--dur-fast); }
.cal-nav:hover { background: var(--bg-surface); color: var(--pt-accent); }
.cal-grid { padding: var(--sp-4); }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: var(--sp-2);
}
.cal-weekday { text-align: center; font-size: var(--text-xs); font-weight: 700; color: var(--text-muted); padding: var(--sp-1); text-transform: uppercase; letter-spacing: 0.05em; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast);
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.cal-day:hover:not(.disabled):not(.empty) { background: var(--bg-surface-2); border-color: var(--border-default); }
.cal-day.today { border-color: var(--pt-accent); color: var(--pt-accent); font-weight: 700; }
.cal-day.selected { background: var(--pt-accent); color: #fff; border-color: var(--pt-accent); box-shadow: 0 2px 8px var(--pt-accent-glow); }
.cal-day.disabled { color: var(--text-muted); opacity: 0.4; cursor: not-allowed; }
.cal-day.empty { cursor: default; }
.cal-day.has-booking { position: relative; }
.cal-day.has-booking::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--pt-accent); }

/* ── 21. Time Slots ────────────────────────────────────────── */
.time-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.time-slot {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur-fast);
  color: var(--text-secondary);
}
.time-slot:hover { border-color: var(--pt-accent); color: var(--pt-accent); background: rgba(108,99,255,0.06); }
.time-slot.selected { background: var(--pt-accent); border-color: var(--pt-accent); color: #fff; }
.time-slot.busy { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }

/* ── 22. Sidebar Navigation ────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--dur-slow) var(--ease-out),
              background var(--dur-slow) var(--ease-out);
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--pt-accent), var(--pt-accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--text-lg);
  box-shadow: 0 4px 12px var(--pt-accent-glow);
  flex-shrink: 0;
}
.logo-text { font-size: var(--text-base); font-weight: 800; letter-spacing: -0.03em; color: var(--text-primary); }
.logo-text span { color: var(--pt-accent); }

.sidebar-nav { flex: 1; padding: var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-1); }
.nav-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  margin-top: var(--sp-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.nav-item i { width: 18px; text-align: center; font-size: var(--text-base); flex-shrink: 0; }
.nav-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.nav-item.active { background: rgba(108,99,255,0.10); color: var(--pt-accent); font-weight: 600; }
.nav-item.active i { color: var(--pt-accent); }
.nav-badge { margin-left: auto; }

.sidebar-footer { padding: var(--sp-4) var(--sp-3); border-top: 1px solid var(--border-subtle); }
.user-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.user-card:hover { background: var(--bg-surface-2); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: var(--text-xs); color: var(--text-muted); }

/* ── 23. Topbar ────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  z-index: 100;
  transition: background var(--dur-slow), border-color var(--dur-slow);
}
.topbar-left { display: flex; align-items: center; gap: var(--sp-4); }
.topbar-right { display: flex; align-items: center; gap: var(--sp-3); }
.topbar-title { font-size: var(--text-lg); font-weight: 700; }
.topbar-subtitle { font-size: var(--text-xs); color: var(--text-muted); }

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: var(--sp-2) var(--sp-4);
  min-width: 220px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.search-bar:focus-within { border-color: var(--pt-accent); box-shadow: 0 0 0 3px var(--pt-accent-glow); }
.search-bar i { color: var(--text-muted); font-size: var(--text-sm); }
.search-bar input { background: none; border: none; outline: none; font-size: var(--text-sm); color: var(--text-primary); width: 100%; }

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast);
  font-size: var(--text-base);
}
.theme-toggle:hover { border-color: var(--pt-accent); color: var(--pt-accent); background: rgba(108,99,255,0.08); }

/* ── 24. Main Layout ───────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  flex: 1;
  min-width: 0;
}
.page-body {
  padding: var(--sp-8);
  max-width: 1400px;
}

/* ── 25. Tabs ──────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; background: var(--bg-surface-2); border-radius: var(--radius-lg); padding: 4px; border: 1px solid var(--border-subtle); }
.tab-btn {
  flex: 1;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  border: none;
  background: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
}
.tab-btn.active {
  background: var(--bg-surface);
  color: var(--pt-accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── 26. Booking Card ──────────────────────────────────────── */
.booking-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--dur-base);
}
.booking-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-default); }
.booking-time {
  text-align: center;
  min-width: 56px;
  flex-shrink: 0;
}
.booking-time .date-num { font-size: var(--text-2xl); font-weight: 800; color: var(--pt-accent); line-height: 1; }
.booking-time .date-mon { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
.booking-time .time-str { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }
.booking-divider { width: 1px; background: var(--border-subtle); align-self: stretch; flex-shrink: 0; }
.booking-details { flex: 1; min-width: 0; }
.booking-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.booking-meta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-2); }
.booking-meta-item { display: flex; align-items: center; gap: var(--sp-1); font-size: var(--text-xs); color: var(--text-muted); }
.booking-meta-item i { font-size: 11px; }
.booking-actions { display: flex; gap: var(--sp-2); align-items: flex-start; flex-shrink: 0; }

/* ── 27. Group Card ────────────────────────────────────────── */
.group-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--dur-base);
}
.group-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.group-card-header {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}
.group-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.group-card-name { font-size: var(--text-base); font-weight: 700; flex: 1; }
.group-card-body { padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.group-rule-item { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-xs); color: var(--text-secondary); }
.group-rule-item i { color: var(--text-muted); width: 14px; text-align: center; }
.group-card-footer { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; background: var(--bg-surface-2); }

/* ── 28. Member Row ────────────────────────────────────────── */
.member-row { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); transition: background var(--dur-fast); }
.member-row:hover { background: var(--bg-surface-2); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.member-email { font-size: var(--text-xs); color: var(--text-muted); }
.member-groups { display: flex; gap: var(--sp-1); flex-wrap: wrap; }

/* ── 29. Booking Steps ─────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--sp-8);
}
.step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  border: 2px solid var(--border-default);
  color: var(--text-muted);
  background: var(--bg-surface);
  flex-shrink: 0;
  transition: all var(--dur-base);
}
.step.active .step-num { border-color: var(--pt-accent); color: var(--pt-accent); background: rgba(108,99,255,0.10); }
.step.done .step-num { border-color: var(--pt-success); background: var(--pt-success); color: #fff; }
.step-label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.step.active .step-label { color: var(--pt-accent); }
.step.done .step-label { color: var(--pt-success); }
.step-line { flex: 1; height: 1px; background: var(--border-subtle); margin: 0 var(--sp-2); }
.step-line.done { background: var(--pt-success); }

/* ── 30. Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 100vw; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-body { padding: var(--sp-4); }
  .time-slots { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}

@media (max-width: 480px) {
  .booking-card { flex-wrap: wrap; }
  .topbar { padding: 0 var(--sp-4); }
}
