/* =========================================
   1. VARIABLES
   ========================================= */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #0d9488;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-family: "Inter", sans-serif;
  --transition: all 0.2s ease-in-out;
  --sidebar-width: 260px;
  --sidebar-mobile-width: min(86vw, 320px);
}

/* =========================================
   2. RESET
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  scroll-behavior: smooth;
}

body.sidebar-open {
  overflow: hidden;
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  color: var(--text-main);
}

button,
input,
select,
textarea {
  font: inherit;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

.view-section {
  display: none;
  min-height: 100vh;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* =========================================
   3. GLOBALES
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  max-width: 100%;
  min-height: 42px;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #fff;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-body);
  border-color: var(--text-muted);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  color: var(--text-muted);
}

.btn-icon:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  min-width: 0;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  background: var(--bg-surface);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}
.badge-teal {
  background: rgba(13, 148, 136, 0.1);
  color: var(--secondary);
}
.badge-orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}
.badge-red {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}
.badge-gray {
  background: var(--bg-body);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* NUEVO: helpers responsive seguros */
.responsive-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
}

.responsive-grid-2-equal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.actions-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.section-separator {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
}

.section-title {
  margin-bottom: 16px;
}

/* =========================================
   4. LANDING
   ========================================= */
.landing-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.landing-nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  padding: 16px 0;
}

.landing-nav .landing-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
}

.landing-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.landing-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.landing-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex: 1;
  min-width: 0;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
  min-width: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--primary);
}

.landing-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-hero {
  padding: 160px 0 100px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.landing-hero h1 {
  font-size: 3.5rem;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
  color: #020617;
}

.landing-hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 40px;
}

.hero-image-mockup {
  margin-top: 60px;
  width: 100%;
  max-width: 900px;
  height: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
  position: relative;
}

.hero-image-mockup::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border-color);
}

.hero-image-mockup::after {
  content: "•••";
  position: absolute;
  top: 10px;
  left: 16px;
  color: var(--text-muted);
  font-size: 20px;
  letter-spacing: 2px;
}

.landing-section {
  padding: 100px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.section-header p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
}

.feature-card {
  padding: 32px;
  border: none;
  box-shadow: none;
  background: transparent;
  text-align: center;
}

.feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.05);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 24px;
  transition: var(--transition);
}

.feature-card:hover .feature-icon {
  transform: scale(1.1);
  background: var(--primary);
  color: #fff;
}

.feature-card h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.feature-card p {
  color: var(--text-muted);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
  max-width: 900px;
  margin: 0 auto;
}

.pricing-card {
  display: flex;
  flex-direction: column;
  padding: 40px;
  transition: var(--transition);
  position: relative;
}

.pricing-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.pricing-card.popular {
  border: 2px solid var(--primary);
}

.popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pricing-price {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 24px 0 8px;
}

.pricing-price span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.pricing-features {
  margin: 32px 0;
  list-style: none;
  flex-grow: 1;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.pricing-features i {
  color: var(--secondary);
  font-size: 1.2rem;
}

.landing-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 60px 0 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h4 {
  font-size: 1rem;
  margin-bottom: 20px;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col ul a {
  color: var(--text-muted);
}

.footer-col ul a:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* =========================================
   5. AUTH
   ========================================= */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 500px;
}

.auth-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.plan-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.plan-option {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.plan-option.selected {
  border-color: var(--primary);
  background-color: rgba(37, 99, 235, 0.05);
  box-shadow: 0 0 0 1px var(--primary);
}

.plan-option input {
  display: none;
}

.plan-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 8px;
}

/* =========================================
   6. APP LAYOUT
   ========================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-body);
  position: relative;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1100;
  transition:
    width 0.25s ease,
    min-width 0.25s ease,
    transform 0.25s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-close-btn,
.topbar-toggle {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-close-btn:hover,
.topbar-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sidebar-close-btn {
  display: none;
}

.sidebar-nav {
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
}

.nav-item:hover,
.nav-item.active {
  background-color: var(--bg-body);
  color: var(--primary);
}

.nav-item i {
  font-size: 1.25rem;
  min-width: 22px;
}

.nav-item-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
}

.nav-spacer {
  flex: 1;
}

.sidebar-logout-form {
  margin-top: auto;
}

.main-wrapper {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
  overflow-x: hidden;
}

.topbar {
  min-height: 70px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-wrap: nowrap;
  overflow: hidden;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.topbar-copy {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.topbar-copy h1 {
  font-size: 1.35rem;
  line-height: 1.2;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-copy p {
  display: none;
}

.topbar-user-profile {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-weight: 500;
  flex: 0 0 auto;
  min-width: fit-content;
}

.topbar-bell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-bell {
  font-size: 1.25rem;
  color: var(--text-muted);
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.content {
  padding: 32px;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.page-inline-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.app-footer__inner {
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.app-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 1090;
}

/* colapsado desktop */
body.sidebar-collapsed .sidebar {
  width: 84px;
  min-width: 84px;
}

body.sidebar-collapsed .sidebar .logo-text,
body.sidebar-collapsed .sidebar .nav-label {
  opacity: 0;
  width: 0;
  visibility: hidden;
  pointer-events: none;
}

body.sidebar-collapsed .sidebar .nav-item,
body.sidebar-collapsed .sidebar .nav-item-button {
  justify-content: center;
}

/* =========================================
   7. DASHBOARD
   ========================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-info h4 {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-info p {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

/* =========================================
   8. AGENDA
   ========================================= */
.agenda-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
}

.mini-calendar {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.875rem;
}

.mini-calendar th {
  color: var(--text-muted);
  font-weight: 500;
  padding: 8px;
}

.mini-calendar td {
  padding: 8px;
  color: var(--text-main);
  cursor: pointer;
  border-radius: var(--radius);
}

.mini-calendar td:hover {
  background: var(--bg-body);
}

.mini-calendar td.active-day {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.mini-calendar td.muted {
  color: var(--border-color);
}

.waiting-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.waiting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-body);
}

.waiting-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.waiting-info h5 {
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.waiting-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.daily-timeline {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.time-slot {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 16px;
  min-height: 80px;
  position: relative;
}

.time-slot::after {
  content: "";
  position: absolute;
  left: 76px;
  right: 0;
  top: 12px;
  height: 1px;
  background: var(--border-color);
  z-index: 1;
}

.time-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 4px;
  text-align: right;
}

.appointment-card {
  position: relative;
  z-index: 2;
  margin-top: 4px;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  transition: var(--transition);
  cursor: pointer;
  min-width: 0;
}

.appointment-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.apt-checkup {
  border-left-color: var(--primary);
}
.apt-first {
  border-left-color: var(--secondary);
  background: rgba(13, 148, 136, 0.02);
}
.apt-urgent {
  border-left-color: var(--warning);
  background: rgba(245, 158, 11, 0.02);
}

.apt-info {
  min-width: 0;
}

.apt-info h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  word-break: break-word;
}

.apt-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.apt-actions {
  display: flex;
  gap: 8px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.apt-actions i:hover {
  color: var(--primary);
}

.current-time-line {
  position: absolute;
  left: 76px;
  right: 0;
  top: 45%;
  height: 2px;
  background: var(--danger);
  z-index: 3;
}

.current-time-line::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

/* =========================================
   9. FACTURACIÓN / TABLAS
   ========================================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: top;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}
.amount {
  font-family: "Inter", monospace;
  font-weight: 500;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0 12px;
  width: min(100%, 340px);
}

.search-box input {
  border: none;
  background: transparent;
  padding: 10px;
  width: 100%;
  min-width: 0;
  outline: none;
  font-size: 0.9rem;
}

/* =========================================
   10. PACIENTE
   ========================================= */
.patient-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  min-width: 0;
}

.patient-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.patient-info h2 {
  margin-bottom: 4px;
}

.patient-meta {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.875rem;
  align-items: center;
  flex-wrap: wrap;
}

.patient-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 24px;
}

.vital-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.vital-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  background: var(--bg-body);
}

.vital-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.vital-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.timeline {
  border-left: 2px solid var(--border-color);
  padding-left: 20px;
  margin-left: 10px;
  margin-top: 16px;
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--primary);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.timeline-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =========================================
   11. PLUGINS
   ========================================= */
input,
select,
textarea,
button {
  max-width: 100%;
}

.form-control,
.select2-container,
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
  width: 100% !important;
  max-width: 100%;
}

.select2-container .select2-selection--single {
  height: 42px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
}

.select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 40px !important;
  padding-left: 12px !important;
}

.select2-container .select2-selection--single .select2-selection__arrow {
  height: 40px !important;
}

.dataTables_wrapper {
  width: 100%;
  overflow-x: auto;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--bg-surface);
  color: var(--text-main);
}

.swal2-popup {
  border-radius: 16px !important;
}

/* =========================================
   12. RESPONSIVE
   ========================================= */
@media (max-width: 1200px) {
  .content {
    padding: 24px;
  }

  .topbar {
    padding: 0 24px;
  }
}

@media (max-width: 1024px) {
  .agenda-grid {
    grid-template-columns: 1fr;
  }

  .patient-grid,
  .responsive-grid-2,
  .responsive-grid-2-equal {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-mobile-width);
    min-width: var(--sidebar-mobile-width);
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .app-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .app-layout {
    display: block;
  }

  .main-wrapper {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    padding: 12px 20px;
    min-height: 70px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .landing-toggle {
    display: inline-flex;
  }

  .landing-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 16px;
    right: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 16px;
  }

  .landing-menu.is-open {
    display: flex;
  }

  .nav-links {
    display: none;
  }

  .landing-menu.is-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .landing-actions {
    width: 100%;
    flex-direction: column;
  }

  .landing-hero {
    padding: 140px 0 72px;
  }

  .landing-hero h1 {
    font-size: 2.4rem;
  }

  .landing-hero p {
    font-size: 1rem;
  }

  .hero-image-mockup {
    height: 280px;
  }

  .content,
  .app-footer__inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .content {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .card {
    padding: 18px;
  }

  .stats-grid,
  .features-grid,
  .pricing-grid,
  .vital-grid,
  .auth-grid-2 {
    grid-template-columns: 1fr;
  }

  .time-slot {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .time-slot::after,
  .current-time-line {
    display: none;
  }

  .time-label {
    text-align: left;
    padding-top: 0;
  }

  .appointment-card {
    flex-direction: column;
    gap: 10px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
    padding: 10px 16px;
  }

  .topbar-left {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
  }

  .topbar-user-profile {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    width: 100%;
  }

  .actions-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-inline > .btn,
  .actions-inline > a.btn,
  .actions-inline > form,
  .actions-inline > form .btn {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .landing-container {
    padding: 0 16px;
  }

  .btn,
  .btn-lg {
    width: 100%;
  }

  .topbar-user-name {
    display: none;
  }

  .topbar-copy h1 {
    font-size: 1rem;
  }

  .topbar-copy p {
    display: none;
  }

  .section-header h2 {
    font-size: 2rem;
  }

  .pricing-price {
    font-size: 2.2rem;
  }

  .data-table th,
  .data-table td {
    padding: 12px 10px;
  }

  .page-inline-meta {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .content {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* =========================================
   SWEETALERT2 GLOBAL - ESTILO MODERNO
   ========================================= */
.medsaas-swal-popup {
  border-radius: 20px !important;
  padding: 1.5rem 1.5rem 1.25rem !important;
  font-family: inherit !important;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.16) !important;
}

.medsaas-swal-title {
  color: #334155 !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

.medsaas-swal-html {
  color: #64748b !important;
  line-height: 1.55 !important;
}

.medsaas-swal-actions {
  gap: 0.75rem !important;
  margin-top: 1.25rem !important;
}

.medsaas-swal-btn {
  min-width: 132px !important;
  justify-content: center !important;
}

.medsaas-swal-toast {
  border-radius: 16px !important;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14) !important;
  font-family: inherit !important;
  padding: 0.9rem 1rem !important;
}

.swal2-toast .swal2-title {
  font-size: 0.98rem !important;
  font-weight: 600 !important;
  color: #334155 !important;
}

.swal2-icon {
  border-width: 0.18em !important;
}

.swal2-popup .swal2-styled:focus {
  box-shadow: none !important;
}

@media (max-width: 768px) {
  .medsaas-swal-popup {
    width: calc(100% - 24px) !important;
    padding: 1.2rem 1rem 1rem !important;
    border-radius: 18px !important;
  }

  .medsaas-swal-actions {
    width: 100% !important;
    gap: 0.625rem !important;
  }

  .medsaas-swal-btn {
    flex: 1 1 auto !important;
    min-width: unset !important;
  }
}