:root {
  --bg: #f3f5f8;
  --sidebar: #0b1220;
  --sidebar-2: #111827;
  --accent: #0d9488;
  --accent-2: #14b8a6;
  --text: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --line: #e2e8f0;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --info: #2563eb;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-areas: "sidebar main";
  min-height: 100vh;
  min-height: 100dvh;
  align-items: stretch;
}

.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #e2e8f0;
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 28px;
}

.sidebar-close,
.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--line);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.sidebar-close {
  margin-left: auto;
  color: white;
  font-size: 1.8rem;
  line-height: 1;
}

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

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
}

.main {
  grid-area: main;
  padding: 28px 32px 48px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
}

.brand h1 {
  font-size: 1.05rem;
  margin: 0;
  color: white;
}

.brand p {
  margin: 0;
  font-size: 0.75rem;
  color: #94a3b8;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(20, 184, 166, 0.16);
  color: white;
}

.sidebar nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title h2 {
  margin: 0;
  font-size: 1.55rem;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  margin-top: 8px;
}

.table {
  margin-bottom: 0;
}

.table thead th,
.table td {
  white-space: nowrap;
  padding: 12px 16px;
  vertical-align: middle;
}

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

.fc {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
}

.calendar-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table thead th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom-color: var(--line);
}

.badge-status {
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 0.75rem;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #e2e8f0; color: #475569; }

.btn-accent {
  background: var(--accent);
  border: 0;
  color: white;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
}

.btn-accent:hover { background: #0f766e; color: white; }

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.slot-btn {
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 10px 8px;
  font-weight: 700;
}

.slot-btn.active,
.slot-btn:hover {
  border-color: var(--accent);
  background: #f0fdfa;
  color: #0f766e;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.auth-hero {
  background: radial-gradient(circle at top left, #134e4a, #0b1220 55%);
  color: white;
  padding: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: #f8fafc;
}

.auth-card {
  width: min(440px, 100%);
  background: white;
  border-radius: 24px;
  padding: 36px;
  box-shadow: var(--shadow);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

@media (min-width: 768px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 992px) {
  .app-shell {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .menu-toggle { display: flex; }
  .sidebar-close { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    height: auto;
    max-height: none;
    overflow: hidden;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }
  .main { padding: 20px 16px 40px; }
  .topbar { flex-wrap: wrap; align-items: flex-start; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

@media (max-width: 768px) {
  .table {
    min-width: 640px;
  }
  .table thead th,
  .table td {
    padding: 14px 18px;
  }
  .calendar-scroll .fc {
    min-width: 720px;
  }
  .fc .fc-toolbar {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .fc .fc-toolbar-title {
    font-size: 1.05rem;
  }
  .page-title h2 { font-size: 1.25rem; }
}
