:root {
    --teal: #2ABFBF;
    --teal-dark: #1a9494;
    --teal-light: #e0f7f7;
    --gold: #C9A96E;
    --dark: #0f1f1f;
    --mid: #1e3535;
    --text: #2c2c2c;
    --muted: #7a8a8a;
    --bg: #f5fafa;
    --white: #ffffff;
    --danger: #e05252;
    --success: #3dba7f;
    --warning: #f0a830;
    --sidebar-w: 240px;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); }
  html, body {
  height: 100%;
}
a{
  text-decoration: none;
}
.sched-appt.confirm {
  background: #d4edda;
}

.sched-appt.pending {
  background: #fff3cd;
}

.sched-appt.empty {
  background: #f8d7da;
}

  /* ===================== NAV TABS ===================== */
  .view-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: var(--dark);
    display: flex; gap: 4px; padding: 10px 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .view-nav::-webkit-scrollbar { display: none; }
  .view-btn {
    padding: 7px 16px; border: none; border-radius: 20px;
    font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500;
    cursor: pointer; white-space: nowrap; transition: all .2s;
    background: rgba(255,255,255,.08); color: rgba(255,255,255,.6);
  }
  .view-btn:hover { background: rgba(42,191,191,.2); color: var(--teal); }
  .view-btn.active { background: var(--teal); color: var(--dark); font-weight: 600; }

  /* ===================== VIEWS ===================== */
  .view { display: none; min-height: 100vh; padding-top: 54px; }
  .view.active { display: block; }

  /* ===================== 1. LOGIN ===================== */
  #v-login {
    background: linear-gradient(135deg, var(--dark) 0%, var(--mid) 60%, #0d2e2e 100%);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
  }
  #v-login.active { display: flex; }
  .login-bg-circle {
    position: absolute; border-radius: 50%;
    background: radial-gradient(circle, rgba(42,191,191,.15), transparent 70%);
  }
  .login-bg-circle:nth-child(1) { width: 600px; height: 600px; top: -200px; right: -100px; }
  .login-bg-circle:nth-child(2) { width: 400px; height: 400px; bottom: -150px; left: -100px; }
  .login-card {
    position: relative; z-index: 1;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(42,191,191,.2);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 52px 48px;
    width: 420px;
    box-shadow: 0 40px 80px rgba(0,0,0,.4);
  }
  .login-logo {
    text-align: center; margin-bottom: 36px;
  }
  .login-logo .brand {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px; font-weight: 300; color: var(--white);
    letter-spacing: 3px;
  }
  .login-logo .brand span { color: var(--teal); font-weight: 600; }
  .login-logo .sub {
    font-size: 11px; letter-spacing: 4px; color: var(--muted);
    text-transform: uppercase; margin-top: 4px;
  }
  .login-divider {
    width: 40px; height: 2px;
    background: linear-gradient(90deg, var(--teal), var(--gold));
    margin: 16px auto;
    border-radius: 2px;
  }
  .role-tabs {
    display: flex; gap: 8px; margin-bottom: 28px;
    background: rgba(255,255,255,.05);
    border-radius: 12px; padding: 4px;
  }
  .role-tab {
    flex: 1; padding: 9px; text-align: center;
    border-radius: 9px; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all .2s;
    color: rgba(255,255,255,.4);
  }
  .role-tab.active { background: var(--teal); color: var(--dark); font-weight: 600; }
  .field { margin-bottom: 18px; }
  .field label {
    display: block; font-size: 11px; font-weight: 600;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: rgba(255,255,255,.4); margin-bottom: 8px;
  }
  .field input {
    width: 100%; padding: 13px 16px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    color: var(--white); font-family: 'DM Sans', sans-serif; font-size: 14px;
    outline: none; transition: border-color .2s;
  }
  .field input:focus { border-color: var(--teal); background: rgba(42,191,191,.05); }
  .field input::placeholder { color: rgba(255,255,255,.2); }
  .btn-login {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    border: none; border-radius: 12px;
    color: var(--dark); font-family: 'DM Sans', sans-serif;
    font-size: 14px; font-weight: 700; letter-spacing: 1px;
    cursor: pointer; margin-top: 8px;
    transition: transform .15s, box-shadow .2s;
    box-shadow: 0 8px 24px rgba(42,191,191,.3);
  }
  .btn-login:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(42,191,191,.4); }
  .login-footer {
    text-align: center; margin-top: 20px;
    font-size: 12px; color: rgba(255,255,255,.25);
  }

  /* ===================== 2. AGENDAMIENTO PÚBLICO ===================== */
  #v-agendar {
    background: var(--bg);
  }
  .pub-header {
    background: linear-gradient(135deg, var(--dark), var(--mid));
    padding: 28px 40px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .pub-brand {
    font-family: 'Cormorant Garamond', serif;
    font-size: 24px; color: var(--white); font-weight: 300; letter-spacing: 2px;
  }
  .pub-brand span { color: var(--teal); font-weight: 600; }
  .pub-nav a {
    color: rgba(255,255,255,.5); text-decoration: none;
    font-size: 13px; margin-left: 24px;
    transition: color .2s;
  }
  .pub-nav a:hover { color: var(--teal); }
  .agendar-hero {
    background: linear-gradient(135deg, var(--teal) 0%, #1a9494 100%);
    padding: 60px 40px;
    text-align: center; color: var(--white);
  }
  .agendar-hero h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 48px; font-weight: 300; letter-spacing: 2px;
    margin-bottom: 12px;
  }
  .agendar-hero p { font-size: 16px; opacity: .8; }
  .steps-bar {
    display: flex; justify-content: center; gap: 0;
    padding: 32px 40px 0;
    max-width: 700px; margin: 0 auto;
  }
  .step-item {
    flex: 1; text-align: center; position: relative;
  }
  .step-item:not(:last-child)::after {
    content: '';
    position: absolute; top: 18px; left: 60%; right: -40%;
    height: 2px; background: #dde8e8;
  }
  .step-item.done:not(:last-child)::after { background: var(--teal); }
  .step-circle {
    width: 36px; height: 36px; border-radius: 50%;
    background: #dde8e8; color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    margin: 0 auto 8px; position: relative; z-index: 1;
    transition: all .3s;
  }
  .step-item.done .step-circle { background: var(--teal); color: var(--white); }
  .step-item.active .step-circle { background: var(--dark); color: var(--white); }
  .step-label { font-size: 11px; color: var(--muted); font-weight: 500; }
  .step-item.active .step-label { color: var(--dark); font-weight: 600; }

  .form-card {
    max-width: 700px; margin: 32px auto 60px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 4px 40px rgba(0,0,0,.07);
    padding: 40px;
  }
  .form-card h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px; font-weight: 400; margin-bottom: 6px;
    color: var(--dark);
  }
  .form-card .subtitle { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .form-grid .full { grid-column: 1 / -1; }
  .inp-group { display: flex; flex-direction: column; gap: 6px; }
  .inp-group label { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
  .inp-group input, .inp-group select, .inp-group textarea {
    padding: 12px 14px;
    border: 1.5px solid #e0eaea;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif; font-size: 14px;
    outline: none; transition: border-color .2s; background: #fafefe;
    color: var(--text);
  }
  .inp-group input:focus, .inp-group select:focus, .inp-group textarea:focus {
    border-color: var(--teal); background: var(--teal-light);
  }
  .inp-group textarea { resize: vertical; min-height: 80px; }
  .servicios-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    margin-top: 4px;
  }
  .servicio-chip {
    padding: 10px 12px;
    border: 1.5px solid #e0eaea;
    border-radius: 10px;
    font-size: 12px; font-weight: 500; text-align: center;
    cursor: pointer; transition: all .2s;
    background: #fafefe;
  }
  .servicio-chip:hover { border-color: var(--teal); color: var(--teal); }
  .servicio-chip.selected { border-color: var(--teal); background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
  .cal-mini {
    border: 1.5px solid #e0eaea; border-radius: 12px; overflow: hidden;
  }
  .cal-head {
    background: var(--dark); color: var(--white);
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; font-size: 13px; font-weight: 600;
  }
  .cal-head button {
    background: none; border: none; color: rgba(255,255,255,.5);
    font-size: 16px; cursor: pointer; padding: 0 4px;
  }
  .cal-days-head {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: #f0f8f8;
  }
  .cal-dh { text-align: center; padding: 8px 0; font-size: 11px; font-weight: 600; color: var(--muted); }
  .cal-days {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--white);
  }
  .cal-days a{
    color: black;
    text-decoration: none;
  }
  .cal-day {
    text-align: center; padding: 9px 0; font-size: 13px;
    cursor: pointer; transition: all .15s;
  }
  .cal-day:hover { background: var(--teal-light); color: var(--teal); }
  .cal-day.selected { background: var(--teal); color: var(--white); border-radius: 50%; font-weight: 700; }
  .cal-day.disabled { color: #ccc; cursor: default; }
  .cal-day.today { font-weight: 700; color: var(--teal); }
  .horarios {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
  }
  .horario-btn {
    padding: 8px 14px; border: 1.5px solid #e0eaea;
    border-radius: 8px; font-size: 12px; font-weight: 500;
    cursor: pointer; transition: all .2s;
  }
  .horario-btn:hover { border-color: var(--teal); color: var(--teal); }
  .horario-btn.selected { background: var(--teal); border-color: var(--teal); color: var(--white); }
  .horario-btn.ocupado { background: #f5f5f5; color: #ccc; cursor: not-allowed; text-decoration: line-through; }
  .form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 32px; }
  .btn-sec {
    padding: 12px 24px; border: 1.5px solid #dde8e8;
    border-radius: 10px; background: none;
    font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
    cursor: pointer; color: var(--muted); transition: all .2s;
  }
  .btn-sec:hover { border-color: var(--teal); color: var(--teal); }
  .btn-pri {
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    border: none; border-radius: 10px;
    color: var(--white); font-family: 'DM Sans', sans-serif;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 16px rgba(42,191,191,.3);
  }
  .btn-pri:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(42,191,191,.4); }

  /* ===================== ADMIN LAYOUT ===================== */
  .admin-layout {
    display: flex; height: 100%; overflow: hidden;
  }
  .sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--dark);
    display: flex; flex-direction: column;
    height: 100%;
    overflow-y: auto;
  }
  .sidebar-brand {
    padding: 28px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .sidebar-brand .name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 20px; color: var(--white); font-weight: 300; letter-spacing: 2px;
  }
  .sidebar-brand .name span { color: var(--teal); font-weight: 600; }
  .sidebar-brand .role {
    font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--muted); margin-top: 4px;
  }
  .sidebar-nav { padding: 16px 0; flex: 1; display: flex;
    flex-direction: column;
    justify-content: space-around; }
  .nav-section {
    padding: 8px 16px 4px;
    font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
    color: rgba(255,255,255,.2); font-weight: 600;
  }
  .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    font-size: 1rem; color: rgba(255,255,255,.5);
    cursor: pointer; transition: all .2s;
    border-left: 3px solid transparent;
    font-weight: 400;
    display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  }
  .nav-item:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.04); }
  .nav-item.active {
    color: var(--teal); border-left-color: var(--teal);
    background: rgba(42,191,191,.08); font-weight: 600;
  }
  .nav-icon { font-size: 16px; width: 20px; text-align: center; }
  .nav-badge {
    margin-left: auto; background: var(--teal);
    color: var(--dark); font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 10px;
  }
  .sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; gap: 10px;
  }
  .user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--gold));
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: var(--white);
    flex-shrink: 0;
  }
  .user-info .uname { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.8); }
  .user-info .urole { font-size: 10px; color: var(--muted); }
  .admin-main { flex: 1; overflow-y: auto; min-width: 0; }
  .admin-topbar {
    background: var(--white); border-bottom: 1px solid #e8f0f0;
    padding: 14px 28px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
  }
  .topbar-title { font-size: 18px; font-weight: 600; color: var(--dark); }
  .topbar-actions { display: flex; align-items: center; gap: 12px; }
  .topbar-search {
    padding: 8px 14px 8px 36px; border: 1.5px solid #e0eaea;
    border-radius: 20px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    outline: none; background: #f5fafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%237a8a8a' viewBox='0 0 24 24'%3E%3Cpath d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z' stroke='%237a8a8a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 12px center;
    width: 220px; color: var(--text);
    transition: border-color .2s;
  }
  .topbar-search:focus { border-color: var(--teal); background-color: var(--teal-light); }
  .notif-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg); border: none; cursor: pointer;
    font-size: 16px; position: relative;
    display: flex; align-items: center; justify-content: center;
  }
  .notif-dot {
    position: absolute; top: 6px; right: 7px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger); border: 2px solid var(--white);
  }
  .admin-content { padding: 28px; }

  /* ===================== 3. DASHBOARD ===================== */
  .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
  .stat-card {
    background: var(--white); border-radius: 16px;
    padding: 22px; border: 1px solid #eaf0f0;
    position: relative; overflow: hidden;
    transition: box-shadow .2s;
  }
  .stat-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.08); }
  .stat-card::before {
    content: ''; position: absolute;
    top: 0; right: 0; width: 80px; height: 80px;
    border-radius: 0 16px 0 80px;
  }
  .stat-card:nth-child(1)::before { background: rgba(42,191,191,.1); }
  .stat-card:nth-child(2)::before { background: rgba(201,169,110,.1); }
  .stat-card:nth-child(3)::before { background: rgba(61,186,127,.1); }
  .stat-card:nth-child(4)::before { background: rgba(240,168,48,.1); }
  .stat-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 14px;
  }
  .stat-num { font-size: 32px; font-weight: 700; color: var(--dark); line-height: 1; }
  .stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }
  .stat-delta {
    font-size: 11px; font-weight: 600; margin-top: 8px;
    display: flex; align-items: center; gap: 3px;
  }
  .delta-up { color: var(--success); }
  .delta-dn { color: var(--danger); }

  .dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
  .panel {
    background: var(--white); border-radius: 16px;
    border: 1px solid #eaf0f0; overflow: hidden;
  }
  .panel-head {
    padding: 18px 22px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #eaf0f0;
  }
  .panel-title { font-size: 14px; font-weight: 700; color: var(--dark); }
  .panel-link { font-size: 12px; color: var(--teal); font-weight: 600; cursor: pointer; }
  .panel-body { padding: 0; }

  .agenda-table { width: 100%; border-collapse: collapse; }
  .agenda-table th {
    padding: 10px 20px; text-align: left;
    font-size: 10px; letter-spacing: 1px; font-weight: 700;
    text-transform: uppercase; color: var(--muted);
    background: #f8fcfc; border-bottom: 1px solid #eaf0f0;
  }
  .agenda-table td {
    padding: 13px 20px; font-size: 13px;
    border-bottom: 1px solid #f0f7f7; vertical-align: middle;
  }
  .agenda-table tr:last-child td { border-bottom: none; }
  .agenda-table tr:hover td { background: #f8fcfc; }
  .badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
  }
  .badge-pending { background: #fff3e0; color: #f07020; }
  .badge-confirm { background: #e0f7f0; color: #1a9470; }
  .badge-done { background: #f0f0f0; color: #888; }
  .badge-cancel { background: #fde8e8; color: var(--danger); }
  .patient-cell { display: flex; align-items: center; gap: 10px; }
  .pt-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--teal-light), var(--teal));
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: var(--teal-dark);
    flex-shrink: 0;
  }
  .pt-name { font-weight: 600; font-size: 13px; }
  .pt-doc { font-size: 11px; color: var(--muted); }
  .action-btn {
    padding: 5px 12px; border-radius: 7px; font-size: 11px; font-weight: 600;
    cursor: pointer; border: none; transition: all .15s;
  }
  .ab-view { background: var(--teal-light); color: var(--teal-dark); }
  .ab-view:hover { background: var(--teal); color: var(--white); }
  .ab-cancel { background: #fde8e8; color: var(--danger); }
  .ab-cancel:hover { background: var(--danger); color: var(--white); }

  /* Right panel */
  .quick-times { padding: 16px 20px; }
  .today-label {
    font-size: 11px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: var(--muted); margin-bottom: 12px;
  }
  .time-slot {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid #f0f7f7;
  }
  .time-slot:last-child { border-bottom: none; }
  .ts-time { font-size: 12px; font-weight: 700; color: var(--teal); width: 52px; }
  .ts-info { flex: 1; }
  .ts-patient { font-size: 13px; font-weight: 600; color: var(--dark); }
  .ts-service { font-size: 11px; color: var(--muted); }
  .ts-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  }
  .ts-dot.confirm { background: var(--success); }
  .ts-dot.pending { background: var(--warning); }

  /* ===================== 4. CLIENTES ===================== */
  .page-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
  }
  .toolbar-search {
    padding: 10px 14px 10px 38px; border: 1.5px solid #e0eaea;
    border-radius: 10px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    outline: none; width: 280px; background: var(--white);
    transition: border-color .2s; color: var(--text);
  }
  .toolbar-search:focus { border-color: var(--teal); }
  .search-wrap { position: relative; }
  .search-wrap::before {
    content: '🔍'; position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%); font-size: 13px;
  }
  .filter-group { display: flex; gap: 8px; }
  .filter-chip {
    padding: 8px 16px; border: 1.5px solid #e0eaea;
    border-radius: 20px; font-size: 12px; font-weight: 500;
    cursor: pointer; background: var(--white); color: var(--muted);
    transition: all .2s;
  }
  .filter-chip:hover { border-color: var(--teal); color: var(--teal); }
  .filter-chip.active { background: var(--teal); border-color: var(--teal); color: var(--white); }

  .clients-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .client-card {
    background: var(--white); border-radius: 16px;
    border: 1px solid #eaf0f0; padding: 22px;
    transition: all .2s; cursor: pointer;
  }
  .client-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.08); transform: translateY(-2px); }
  .cc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
  .cc-avatar {
    width: 46px; height: 46px; border-radius: 14px;
    background: linear-gradient(135deg, var(--teal-light), var(--teal));
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: var(--teal-dark);
  }
  .cc-name { font-size: 15px; font-weight: 700; color: var(--dark); }
  .cc-id { font-size: 11px; color: var(--muted); }
  .cc-stats {
    display: flex; gap: 0;
    background: #f8fcfc; border-radius: 10px; overflow: hidden;
    margin-bottom: 14px;
  }
  .cc-stat {
    flex: 1; text-align: center; padding: 10px 6px;
    border-right: 1px solid #eaf0f0;
  }
  .cc-stat:last-child { border-right: none; }
  .cc-stat-num { font-size: 18px; font-weight: 700; color: var(--dark); }
  .cc-stat-lbl { font-size: 10px; color: var(--muted); font-weight: 500; }
  .cc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .cc-tag {
    padding: 3px 10px; border-radius: 20px; font-size: 10px; font-weight: 600;
    background: var(--teal-light); color: var(--teal-dark);
  }
  .cc-action {
    margin-top: 14px; padding: 9px;
    width: 100%; background: none; border: 1.5px solid #e0eaea;
    border-radius: 9px; font-family: 'DM Sans', sans-serif;
    font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted);
    transition: all .2s;
  }
  .cc-action:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-light); }

  /* ===================== 5. AGENDAMIENTO ADMIN ===================== */
  .agenda-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
  .cal-panel {
    background: var(--white); border-radius: 16px;
    border: 1px solid #eaf0f0; overflow: hidden;
    align-self: start; position: sticky; top: 110px;
  }
  .cal-panel .cal-head { background: var(--teal); }
  .cal-panel .cal-days-head { background: rgba(42,191,191,.08); }
  .cal-legend { padding: 16px 16px 20px; }
  .legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
  .legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .schedule-panel { background: var(--white); border-radius: 16px; border: 1px solid #eaf0f0; overflow: hidden; }
  .schedule-day-head {
    padding: 18px 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #eaf0f0;
    background: #f8fcfc;
  }
  .sched-date { font-family: 'Cormorant Garamond', serif; font-size: 22px; color: var(--dark); }
  .sched-slots { padding: 0 24px; }
  .sched-row {
    display: flex; align-items: stretch; gap: 0;
    border-bottom: 1px solid #f0f7f7; min-height: 60px;
  }
  .sched-row:last-child { border-bottom: none; }
  .sched-time {
    width: 72px; flex-shrink: 0;
    padding: 16px 0; font-size: 12px; font-weight: 700;
    color: var(--muted); border-right: 2px solid #f0f7f7;
    align-self: stretch; display: flex; align-items: flex-start; padding-top: 18px;
  }
  .sched-cell { flex: 1; padding: 8px 16px; display: flex; align-items: center; flex-direction:column; gap: 10px; }
  .sched-cell a{
    display: block;
    width: 100%;
  }
  .sched-appt {
    width: 100%; padding: 10px 14px; display: block;
    border-radius: 10px; display: flex; align-items: center; gap: 12px;
  }
  .sched-appt.confirm { background: #e0f7f0; border-left: 4px solid var(--success); }
  .sched-appt.pending { background: #fff8e8; border-left: 4px solid var(--warning); }
  .sched-appt.empty { background: transparent; border: 2px dashed #e0eaea; }
  .sched-appt.empty:hover { border-color: var(--teal); background: var(--teal-light); cursor: pointer; }
  .sa-icon { font-size: 20px; }
  .sa-info { flex: 1; }
  .sa-patient { font-size: 13px; font-weight: 700; color: var(--dark); }
  .sa-service { font-size: 11px; color: var(--muted); }
  .sa-empty-txt { font-size: 12px; color: #ccc; font-weight: 500; }
  .add-appt-btn {
    padding: 8px 16px; background: var(--teal); color: var(--white);
    border: none; border-radius: 8px; font-family: 'DM Sans', sans-serif;
    font-size: 13px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: all .2s;
    box-shadow: 0 4px 12px rgba(42,191,191,.3);
  }
  .add-appt-btn:hover { background: var(--teal-dark); transform: translateY(-1px); }

  /* ===================== 6. INFORMES ===================== */
  .reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
  .report-card {
    background: var(--white); border-radius: 16px;
    border: 1px solid #eaf0f0; padding: 24px;
    transition: all .2s;
  }
  .report-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.08); }
  .rc-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin-bottom: 14px;
  }
  .rc-title { font-size: 14px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
  .rc-desc { font-size: 12px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
  .rc-btn {
    padding: 8px 16px; background: var(--bg);
    border: 1.5px solid #e0eaea; border-radius: 8px;
    font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600;
    cursor: pointer; color: var(--muted); transition: all .2s;
  }
  .rc-btn:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-light); }

  .chart-panel { background: var(--white); border-radius: 16px; border: 1px solid #eaf0f0; overflow: hidden; margin-bottom: 20px; }
  .chart-area {
    padding: 24px;
    display: flex; align-items: flex-end; gap: 12px;
    height: 200px;
  }
  .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .bar {
    width: 100%; background: linear-gradient(180deg, var(--teal), var(--teal-dark));
    border-radius: 6px 6px 0 0; transition: all .3s;
    position: relative;
  }
  .bar:hover { filter: brightness(1.1); }
  .bar-label { font-size: 10px; color: var(--muted); font-weight: 500; }
  .bar-val {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    font-size: 10px; font-weight: 700; color: var(--teal-dark); white-space: nowrap;
  }
  .alerts-section { background: var(--white); border-radius: 16px; border: 1px solid #eaf0f0; overflow: hidden; }
  .alert-row {
    padding: 14px 22px; border-bottom: 1px solid #f0f7f7;
    display: flex; align-items: center; gap: 14px;
    font-size: 13px;
  }
  .alert-row:last-child { border-bottom: none; }
  .alert-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
  }
  .alert-ai-email { background: #e8f4ff; }
  .alert-ai-whatsapp { background: #e8ffe8; }
  .alert-ai-sms { background: #fff3e0; }
  .alert-info { flex: 1; }
  .alert-title { font-weight: 600; color: var(--dark); }
  .alert-sub { font-size: 11px; color: var(--muted); }
  .alert-time { font-size: 11px; color: var(--muted); }
  .alert-status { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
  .as-sent { background: #e0f7f0; color: #1a9470; }
  .as-pending { background: #fff3e0; color: #c07020; }
  .as-failed { background: #fde8e8; color: var(--danger); }

  /* ===================== RESPONSIVE ===================== */
/*  @media (max-width: 900px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .clients-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .servicios-grid { grid-template-columns: 1fr 1fr; }
    .reports-grid { grid-template-columns: 1fr 1fr; }
    .agenda-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
  }*/

  .hc-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; }
 
  /* Patient profile card */
  .hc-profile {
    background: var(--white); border-radius: 16px;
    border: 1px solid #eaf0f0; overflow: hidden;
    align-self: start; position: sticky; top: 110px;
  }
  .hc-profile-banner {
    height: 72px;
    background: linear-gradient(135deg, var(--dark) 0%, var(--mid) 60%, #0d3030 100%);
    position: relative;
  }
  .hc-profile-banner::after {
    content: '';
    position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--teal), var(--gold));
  }
  .hc-avatar-wrap {
    display: flex; justify-content: center;
    margin-top: -28px; position: relative; z-index: 1;
  }
  .hc-avatar {
    width: 56px; height: 56px; border-radius: 16px;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: var(--white);
    border: 3px solid var(--white);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
  }
  .hc-profile-info {
    padding: 12px 22px 20px; text-align: center;
  }
  .hc-profile-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px; font-weight: 400; color: var(--dark);
    letter-spacing: .5px; margin-bottom: 2px;
  }
  .hc-profile-doc { font-size: 12px; color: var(--muted); }
  .hc-status-row {
    display: flex; justify-content: center; gap: 8px; margin: 10px 0 16px;
  }
  .hc-chip {
    padding: 3px 10px; border-radius: 20px;
    font-size: 10px; font-weight: 700; letter-spacing: .5px;
  }
  .hc-chip-active { background: #e0f7f0; color: #1a9470; }
  .hc-chip-risk { background: #fff3e0; color: #c07020; }
  .hc-divider { height: 1px; background: #eaf0f0; margin: 0 22px; }
  .hc-data { padding: 16px 22px; }
  .hc-data-row {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 9px 0; border-bottom: 1px solid #f5fafa;
    font-size: 12px;
  }
  .hc-data-row:last-child { border-bottom: none; }
  .hc-data-label { color: var(--muted); font-weight: 500; flex-shrink: 0; }
  .hc-data-val { color: var(--dark); font-weight: 600; text-align: right; max-width: 170px; }
  .hc-actions { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 8px; }
  .hc-btn-pri {
    width: 100%; padding: 10px;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    border: none; border-radius: 10px; color: var(--white);
    font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600;
    cursor: pointer; box-shadow: 0 4px 14px rgba(42,191,191,.3);
    transition: all .2s;
  }
  .hc-btn-pri:hover { transform: translateY(-1px); }
  .hc-btn-sec {
    width: 100%; padding: 9px;
    background: none; border: 1.5px solid #e0eaea; border-radius: 10px;
    color: var(--muted); font-family: 'DM Sans', sans-serif;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: all .2s;
  }
  .hc-btn-sec:hover { border-color: var(--teal); color: var(--teal); }
 
  /* Alert badges inside profile */
  .hc-alerts { padding: 0 22px 18px; display: flex; flex-direction: column; gap: 8px; }
  .hc-alert-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 10px; font-size: 12px;
  }
  .hc-alert-item.allergy { background: #fde8e8; color: #c03030; }
  .hc-alert-item.condition { background: #fff8e8; color: #a07020; }
  .hc-alert-item.note { background: #e8f4ff; color: #2060a0; }
  .hc-alert-icon { font-size: 14px; flex-shrink: 0; }
  .hc-alert-text { font-weight: 500; line-height: 1.35; }
 
  /* Main content area */
  .hc-main { display: flex; flex-direction: column; gap: 20px; }
 
  /* Summary stats row */
  .hc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .hc-stat-card {
    background: var(--white); border-radius: 14px;
    border: 1px solid #eaf0f0; padding: 18px 20px;
  }
  .hc-stat-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; margin-bottom: 12px;
  }
  .hc-stat-num { font-size: 26px; font-weight: 700; color: var(--dark); line-height: 1; }
  .hc-stat-lbl { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 3px; }
 
  /* Citas section */
  .hc-section {
    background: var(--white); border-radius: 16px;
    border: 1px solid #eaf0f0; overflow: hidden;
  }
  .hc-section-head {
    padding: 16px 22px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #eaf0f0; background: #f8fcfc;
  }
  .hc-section-title {
    font-size: 14px; font-weight: 700; color: var(--dark);
    display: flex; align-items: center; gap: 8px;
  }
  .hc-section-count {
    background: var(--teal-light); color: var(--teal-dark);
    font-size: 10px; font-weight: 700; padding: 2px 8px;
    border-radius: 10px;
  }
  .hc-filters { display: flex; gap: 6px; }
  .hc-filter {
    padding: 5px 12px; border: 1px solid #e0eaea;
    border-radius: 16px; font-size: 11px; font-weight: 500;
    cursor: pointer; background: var(--white); color: var(--muted);
    transition: all .2s;
  }
  .hc-filter:hover { border-color: var(--teal); color: var(--teal); }
  .hc-filter.active { background: var(--teal); border-color: var(--teal); color: var(--white); }
 
  /* Citas timeline */
  .hc-cita-list { padding: 4px 0; }
  .hc-cita-row {
    display: flex; align-items: stretch; gap: 0;
    border-bottom: 1px solid #f5fafa;
    transition: background .15s;
  }
  .hc-cita-row:last-child { border-bottom: none; }
  .hc-cita-row:hover { background: #f8fcfc; }
 
  .hc-cita-aside {
    width: 90px; flex-shrink: 0;
    padding: 18px 0 18px 22px;
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 3px;
  }
  .hc-cita-date { font-size: 11px; font-weight: 700; color: var(--dark); }
  .hc-cita-time { font-size: 11px; color: var(--muted); }
 
  .hc-cita-line {
    width: 2px; flex-shrink: 0; margin: 18px 16px;
    position: relative; background: #eaf0f0;
    border-radius: 2px;
  }
  .hc-cita-dot {
    width: 10px; height: 10px; border-radius: 50%;
    position: absolute; top: 6px; left: 50%;
    transform: translateX(-50%);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px currentColor;
  }
  .hc-cita-dot.done { background: var(--success); color: var(--success); }
  .hc-cita-dot.pending { background: var(--warning); color: var(--warning); }
  .hc-cita-dot.cancel { background: var(--danger); color: var(--danger); }
 
  .hc-cita-body { flex: 1; padding: 16px 22px 16px 0; }
  .hc-cita-top {
    display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
  }
  .hc-cita-service { font-size: 13px; font-weight: 700; color: var(--dark); }
  .hc-cita-dr { font-size: 11px; color: var(--muted); }
  .hc-cita-notes {
    font-size: 12px; color: var(--text); line-height: 1.5;
    background: #f8fcfc; border-radius: 8px;
    padding: 8px 12px; margin-top: 8px;
    border-left: 3px solid var(--teal-light);
  }
  .hc-cita-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .hc-tag {
    padding: 2px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 600;
    background: var(--teal-light); color: var(--teal-dark);
  }
  .hc-tag-gold { background: #fdf3e0; color: #a07020; }
  .hc-cita-expand {
    display: flex; align-items: flex-start; padding: 16px 22px 16px 0;
  }
  .hc-expand-btn {
    padding: 5px 10px; background: none;
    border: 1px solid #e0eaea; border-radius: 7px;
    font-size: 11px; color: var(--muted); cursor: pointer;
    font-family: 'DM Sans', sans-serif; transition: all .2s;
  }
  .hc-expand-btn:hover { border-color: var(--teal); color: var(--teal); }
 
  /* Planes de tratamiento */
  .hc-plan-list { padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
  .hc-plan-card {
    border: 1.5px solid #eaf0f0; border-radius: 14px;
    overflow: hidden; transition: all .2s;
  }
  .hc-plan-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.06); }
  .hc-plan-head {
    padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
    background: #f8fcfc;
    border-bottom: 1px solid #eaf0f0;
  }
  .hc-plan-title-block { display: flex; flex-direction: column; gap: 3px; }
  .hc-plan-name { font-size: 14px; font-weight: 700; color: var(--dark); }
  .hc-plan-meta { font-size: 11px; color: var(--muted); }
  .hc-plan-right { display: flex; align-items: center; gap: 10px; }
  .hc-plan-price {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px; color: var(--dark); font-weight: 400;
  }
  .hc-plan-price span { font-size: 12px; color: var(--muted); font-family: 'DM Sans', sans-serif; font-weight: 500; }
  .hc-plan-body { padding: 14px 18px; }
  .hc-plan-progress { margin-bottom: 14px; }
  .hc-progress-top {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--muted); margin-bottom: 6px;
  }
  .hc-progress-bar {
    height: 6px; background: #eaf0f0; border-radius: 3px; overflow: hidden;
  }
  .hc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--teal-dark));
    border-radius: 3px; transition: width .4s;
  }
  .hc-progress-fill.done { background: linear-gradient(90deg, var(--success), #2a9060); }
  .hc-progress-fill.partial { background: linear-gradient(90deg, var(--warning), #d09010); }
  .hc-plan-steps { display: flex; flex-direction: column; gap: 8px; }
  .hc-step {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; padding: 7px 0;
    border-bottom: 1px solid #f5fafa;
  }
  .hc-step:last-child { border-bottom: none; }
  .hc-step-check {
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; flex-shrink: 0;
  }
  .hc-step-check.done { background: var(--success); color: var(--white); }
  .hc-step-check.pending { background: #f0f0f0; color: #bbb; border: 1.5px solid #ddd; }
  .hc-step-check.active { background: var(--teal); color: var(--white); }
  .hc-step-name { flex: 1; color: var(--text); }
  .hc-step-name.done-txt { color: var(--muted); text-decoration: line-through; }
  .hc-step-date { font-size: 10px; color: var(--muted); }
 
  /* ===================== HISTORIAL: RESPONSIVE ===================== */
  @media (max-width: 900px) {
    .hc-layout { grid-template-columns: 1fr; }
    .hc-stats { grid-template-columns: 1fr 1fr; }
    .hc-profile { position: static; }
  }


  .menu-toggle{
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

@media (max-width: 768px){
  .menu-toggle{
    display: block;
  }
}

/* =========================
   📱 SIDEBAR MOBILE
========================= */

@media (max-width: 768px){

  /* Sidebar oculto fuera de pantalla */
  .sidebar{
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100%;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  /* Cuando está abierto */
  .sidebar.open{
    left: 0;
  }

  /* Overlay oscuro */
  .sidebar-overlay{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    display: none;
  }

  .sidebar-overlay.active{
    display: block;
  }

}

@media (max-width: 768px){

  .stats-row{
    grid-template-columns: 1fr;
  }

  .dashboard-grid{
    grid-template-columns: 1fr;
  }

}

@media (max-width: 768px){

  .table-wrap{
    overflow-x: auto;
  }

  .agenda-table{
    min-width: 600px;
  }

}

@media (max-width: 768px){

  .agenda-layout{
    grid-template-columns: 1fr;
  }

}

@media (max-width: 768px){

  .sched-cell{
    padding: 6px;
  }

  .sched-appt{
    flex-direction: column;
    align-items: flex-start;
  }

  .badge{
    align-self: flex-start;
    margin-top: 6px;
  }

}

@media (max-width: 768px){
  .form-grid{
    grid-template-columns: 1fr;
  }
}
/* Tablet */
@media (max-width: 1024px){
  .clients-grid{
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px){
  .clients-grid{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px){

  .page-toolbar{
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  /* 🔍 Buscador ocupa todo */
  .search-wrap{
    width: 100%;
  }

  .toolbar-search{
    width: 100%;
  }

  /* 🎯 Filtros en scroll horizontal */
  .filter-group{
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  /* Oculta scrollbar feo */
  .filter-group::-webkit-scrollbar{
    display: none;
  }

}

.disp-row{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.disp-day{
  width: 160px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.disp-hours{
  display: flex;
  gap: 10px;
}
@media (max-width: 768px){

  .disp-row{
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 10px;
  }

  .disp-day{
    width: 100%;
  }

  .disp-hours{
    width: 100%;
    display: flex;
    gap: 10px;
  }

  .disp-hours input{
    flex: 1;
  }

}