/* ═══════════════════════════════════════════════════
   RESET + BASE
═══════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(247,215,145,0.12); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(247,215,145,0.22); }

/* ═══════════════════════════════════════════════════
   ANIMATED BACKGROUND
═══════════════════════════════════════════════════ */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
  background:
    linear-gradient(var(--canvas-overlay), var(--canvas-overlay)),
    url('../assets/bg_amplamente_2.png') center/cover no-repeat;
}
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(80px);
  animation: blobFloat 18s ease-in-out infinite alternate;
}
.blob-1 { width: 600px; height: 600px; background: #2d5a5e; opacity: 0.22; top: -200px; left: -200px; animation-duration: 22s; }
.blob-2 { width: 400px; height: 400px; background: #c49a24; opacity: 0.12; bottom: -100px; right: 200px; animation-duration: 18s; animation-delay: -6s; }
.blob-3 { width: 300px; height: 300px; background: #22474a; opacity: 0.18; top: 40%; left: 30%; animation-duration: 26s; animation-delay: -12s; }
.sym {
  position: absolute;
  background: url('../assets/simbolo-ampla.png') center/contain no-repeat;
  pointer-events: none;
  filter: sepia(1) saturate(3) hue-rotate(5deg) brightness(0.9);
}
.sym-1 { width: 520px; height: 520px; opacity: 0.04; top: -80px; right: -60px; transform: rotate(15deg); }
.sym-2 { width: 280px; height: 280px; opacity: 0.035; bottom: 60px; left: 80px; transform: rotate(-10deg); }
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(247,215,145,0.025) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(247,215,145,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
}
@keyframes blobFloat {
  0%   { transform: translate(0,0) scale(1); }
  33%  { transform: translate(30px,-20px) scale(1.05); }
  66%  { transform: translate(-20px,30px) scale(0.95); }
  100% { transform: translate(10px,-10px) scale(1.02); }
}

/* ═══════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════ */
.sidebar {
  position: fixed; left: 0; top: 0;
  width: var(--sidebar-w); height: 100vh;
  background: rgba(22,38,36,0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  box-shadow: inset 0 0 0 9999px var(--palette-tint, transparent);
  display: flex; flex-direction: column;
  z-index: 200; transition: width var(--t), transform var(--t);
}
.sidebar.collapsed { width: 60px; }
.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(247,215,145,0.06);
  display: flex; align-items: center; gap: 12px;
  overflow: hidden; cursor: pointer;
}
.sidebar-logo img { height: 56px; object-fit: contain; max-width: 180px; flex-shrink: 0; }
.nav { flex: 1; padding: 12px 8px; overflow-y: auto; overflow-x: hidden; }
.nav-section-label {
  display: block; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 2.5px; color: var(--text-dim); font-weight: 600;
  padding: 14px 10px 6px; white-space: nowrap; overflow: hidden;
  transition: opacity var(--t);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }
.nav-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 10px 12px;
  border-radius: var(--r-sm); color: var(--text-muted); cursor: pointer;
  transition: var(--t); font-size: 13px; font-weight: 500;
  position: relative; text-decoration: none; border: none;
  background: none; width: 100%; font-family: inherit; white-space: nowrap;
  overflow: hidden; text-align: left;
}
.nav-item:hover { background: rgba(247,215,145,0.06); color: var(--text); }
.nav-item.active { background: rgba(247,215,145,0.1); color: var(--gold); }
.nav-item.active::after {
  content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--gold); border-radius: 4px 0 0 4px;
  box-shadow: 0 0 8px rgba(247,215,145,0.4);
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-label { flex: 1; transition: opacity var(--t); text-align: left; }
.sidebar.collapsed .nav-label { opacity: 0; pointer-events: none; }
.nav-badge {
  margin-left: auto; background: rgba(247,215,145,0.15); color: var(--gold);
  font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 10px;
  flex-shrink: 0; transition: opacity var(--t);
}
.sidebar.collapsed .nav-badge { opacity: 0; }
.sidebar-bottom {
  padding: 12px; border-top: 1px solid rgba(247,215,145,0.06);
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: var(--t); overflow: hidden;
}
.user-pill:hover { background: rgba(247,215,145,0.06); }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--teal);
  position: relative;
}
.online {
  position: absolute; bottom: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg2);
}
.user-info-col { flex: 1; min-width: 0; transition: opacity var(--t); }
.sidebar.collapsed .user-info-col { opacity: 0; }
.u-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-role { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }

/* ═══════════════════════════════════════════════════
   MAIN + TOPBAR
═══════════════════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w));
  height: 100vh; display: flex; flex-direction: column;
  transition: margin-left var(--t), width var(--t);
  position: relative; z-index: 1;
}
.sidebar.collapsed ~ .main { margin-left: 60px; width: calc(100% - 60px); }
.topbar {
  height: var(--topbar-h); min-height: var(--topbar-h);
  background: rgba(22,38,36,0.75);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 0 0 9999px var(--palette-tint, transparent);
  padding: 0 24px; display: flex; align-items: center; gap: 12px;
  position: relative; z-index: 100; flex-shrink: 0;
}
.topbar-toggle {
  width: 36px; height: 36px; border-radius: var(--r-xs);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: var(--t);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.topbar-toggle:hover { color: var(--gold); border-color: var(--border-act); }
.page-info { flex: 1; }
.page-title { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 600; line-height: 1.2; }
.page-bread { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.page-bread span { color: var(--gold); }
.search-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 14px; width: 240px;
  cursor: pointer; transition: var(--t);
}
.search-pill:hover { border-color: var(--border-act); }
.search-pill i { color: var(--text-dim); font-size: 13px; }
.search-pill input { flex: 1; background: none; border: none; outline: none; font-size: 12.5px; color: var(--text-muted); cursor: pointer; font-family: inherit; }
.search-pill kbd { font-size: 10px; color: var(--text-dim); background: rgba(247,215,145,0.06); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.t-btn {
  width: 36px; height: 36px; border-radius: var(--r-xs);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: var(--t);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; position: relative;
}
.t-btn:hover { color: var(--gold); border-color: var(--border-act); }
.t-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg);
}
.clinic-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  background: rgba(247,215,145,0.07); border: 1px solid rgba(247,215,145,0.15);
  font-size: 12px; font-weight: 600; color: var(--gold);
}
.clinic-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 6px var(--success);
}

/* ═══════════════════════════════════════════════════
   CONTENT AREA
═══════════════════════════════════════════════════ */
.screens {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 24px; position: relative;
}
.screen { display: none; }
.screen.active { display: block; }

/* ═══════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════ */
.ani { animation: fadeUp 0.5s var(--ease) both; }
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.1s; }
.d3 { animation-delay: 0.15s; }
.d4 { animation-delay: 0.2s; }
.d5 { animation-delay: 0.25s; }
.d6 { animation-delay: 0.3s; }
.d7 { animation-delay: 0.35s; }
.d8 { animation-delay: 0.4s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════════════
   GRID HELPERS
═══════════════════════════════════════════════════ */
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.g24 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.g13 { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; }
.mb16 { margin-bottom: 16px; }
.mb20 { margin-bottom: 20px; }
.mb24 { margin-bottom: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-sb { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ═══════════════════════════════════════════════════
   SIDEBAR BACKDROP (mobile overlay)
═══════════════════════════════════════════════════ */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
.sidebar-backdrop.visible { display: block; animation: fadeIn 0.2s ease; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤768px)
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body { overflow: hidden; }

  /* Sidebar becomes off-canvas overlay */
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    z-index: 300;
    transition: transform var(--t);
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.5);
  }
  /* Remove desktop collapsed behavior on mobile */
  .sidebar.collapsed { width: var(--sidebar-w) !important; transform: translateX(-100%); }
  .sidebar.collapsed.mobile-open { transform: translateX(0); }
  .sidebar.collapsed .nav-label { opacity: 1; pointer-events: auto; }
  .sidebar.collapsed .nav-section-label { opacity: 1; }
  .sidebar.collapsed .nav-badge { opacity: 1; }
  .sidebar.collapsed .user-info-col { opacity: 1; }

  /* Main takes full width */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .sidebar.collapsed ~ .main { margin-left: 0 !important; width: 100% !important; }

  /* Topbar */
  .topbar { padding: 0 12px; gap: 8px; }
  .search-pill { display: none; }
  .page-title { font-size: 15px; }
  .page-bread { font-size: 10px; }
  .clinic-chip span:not(.clinic-dot) { display: none; }
  .clinic-chip { padding: 6px 8px; }

  /* Content area */
  .screens { padding: 14px 12px; }

  /* Grids collapse to single column */
  .g4, .g3, .g2, .g24, .g13 { grid-template-columns: 1fr !important; gap: 12px; }

  /* Hero card stacks vertically */
  .hero-card { flex-direction: column; align-items: flex-start; padding: 20px; gap: 16px; }
  .hero-visual { width: 100%; align-items: flex-start; flex-direction: row; gap: 12px; flex-wrap: wrap; }
  .hero-text h1 { font-size: 22px; }

  /* Day pills: scrollable row instead of 7-column grid */
  .day-pills { grid-template-columns: repeat(7,60px); overflow-x: auto; padding-bottom: 4px; }
}

