:root {
  --sidebar-width: 250px;
  --brand: #0d6efd;
  --brand-dark: #0a58ca;
  --bg-soft: #f4f6f9;
}

* { box-sizing: border-box; }

body {
  background: var(--bg-soft);
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 0.92rem;
}

.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0b1e39, #133a63);
  color: #fff;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .25s ease;
}

.sidebar-brand {
  padding: 1.1rem 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
}
.sidebar-brand i { color: #6ea8fe; margin-right: 6px; }

.sidebar-nav { padding: 0.75rem 0; }
.sidebar-nav a {
  display: block;
  padding: 0.65rem 1.25rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}
.sidebar-nav a i { width: 22px; text-align: center; margin-right: 8px; color: #6ea8fe; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: #6ea8fe; font-weight: 600; }

.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; width: calc(100% - var(--sidebar-width)); }

.topbar {
  background: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  position: sticky; top: 0; z-index: 1020;
}
.topbar-right { display: flex; align-items: center; }
.user-menu { text-decoration: none; color: #333; }

.page-content { padding: 1.5rem; flex: 1; }
.page-footer { padding: 1rem 1.5rem; text-align: center; color: #888; font-size: .8rem; }

.card { border: none; border-radius: .6rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f2; font-weight: 600; }

.stat-card { border-radius: .7rem; color: #fff; padding: 1.1rem 1.3rem; position: relative; overflow: hidden; }
.stat-card .stat-icon { position: absolute; right: 12px; top: 12px; font-size: 2.2rem; opacity: .35; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; }
.stat-card .stat-label { font-size: .82rem; opacity: .9; }
.bg-grad-blue { background: linear-gradient(135deg,#0d6efd,#3b82f6); }
.bg-grad-green { background: linear-gradient(135deg,#198754,#2fbf71); }
.bg-grad-orange { background: linear-gradient(135deg,#fd7e14,#ffab40); }
.bg-grad-red { background: linear-gradient(135deg,#dc3545,#ef5563); }
.bg-grad-purple { background: linear-gradient(135deg,#6f42c1,#9163e0); }
.bg-grad-teal { background: linear-gradient(135deg,#20c997,#3ee2b0); }

.table thead th { font-size: .78rem; text-transform: uppercase; color: #6c757d; border-bottom-width: 1px; }
.table td, .table th { vertical-align: middle; }

.tooth-chart { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tooth-quadrant { display: flex; gap: 4px; }
.tooth {
  width: 42px; height: 42px; border: 2px solid #ccc; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: .7rem; font-weight: 600; background: #fff; flex-direction: column;
}
.tooth:hover { border-color: var(--brand); }
.tooth.healthy { border-color: #ccc; }
.tooth.caries { background: #f8d7da; border-color: #dc3545; }
.tooth.filling { background: #cfe2ff; border-color: #0d6efd; }
.tooth.missing { background: #e9ecef; border-color: #6c757d; text-decoration: line-through; }
.tooth.crown { background: #fff3cd; border-color: #ffc107; }
.tooth.root_canal { background: #e2d9f3; border-color: #6f42c1; }
.tooth.extraction { background: #d3d3d3; border-color: #343a40; }
.tooth.implant { background: #d1e7dd; border-color: #198754; }
.tooth.other { background: #f0f0f0; border-color: #adb5bd; }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#0b1e39,#133a63); }
.login-card { width: 400px; border-radius: 1rem; overflow: hidden; }
.login-card .card-header { background: #0d6efd; color: #fff; text-align: center; padding: 2rem 1rem 1.2rem; }

.fc-event { cursor: pointer; }
.slot-btn.selected { background: var(--brand) !important; color: #fff !important; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }
}

@media print {
  .sidebar, .topbar, .page-footer, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; width: 100% !important; }
  .page-content { padding: 0 !important; }
}
