:root,
html[data-theme="violet"] {
  --ink: #1E293B;
  --brand: #6958F5;
  --brand-soft: #8B7CFF;
  --brand-dark: #5A49EA;
  --brand-hover: #5A49EA;
  --brand-tint: #F1EFFF;
  --brand-tint-2: #E8E5FF;
  --bg: #F7F8FC;
  --bg-soft: #EEF0F7;
  --muted: #64748B;
  --line: #E5E7EB;
  --card: #ffffff;
  --ok: #6958F5;
  --ok-bg: #F1EFFF;
  --warn: #b45309;
  --bad: #e11d48;
  --nav: #16244E;
  --nav-2: #16244E;
  --nav-mid: #16244E;
  --nav-text: #C7D0E8;
  --nav-sub: #8B97B8;
  --nav-active-sub: rgba(255,255,255,0.82);
  --table-line: #E5E7EB;
  --table-hover: #F8F9FD;
  --input-border: #E5E7EB;
  --tabs-bg: #EEF0F7;
  --tabs-hover: #E5E7EB;
  --glow: transparent;
  --glow-2: transparent;
  --glow-strong: transparent;
  --nav-hover: rgba(105, 88, 245, 0.16);
  --nav-active-a: #6958F5;
  --nav-active-b: #6958F5;
  --nav-active-ring: transparent;
  --btn-top: #6958F5;
  --btn-bottom: #6958F5;
  --btn-shadow: rgba(105, 88, 245, 0.18);
  --btn-shadow-hover: rgba(105, 88, 245, 0.22);
  --focus-ring: rgba(105, 88, 245, 0.18);
  --menu-hover-border: #D4D7E5;
  --tooth-border: #C4BDF8;
  --shadow: 0 8px 24px rgba(22, 36, 78, 0.06);
  --shadow-soft: 0 2px 8px rgba(22, 36, 78, 0.04);
  --radius: 14px;
  --radius-sm: 12px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --text: 15px;
  --text-sm: 13px;
  --ease: 200ms ease-in-out;
}

html[data-theme="green"] {
  /* Paleta verde / teal clara (como la foto del consultorio) */
  --ink: #0B3D36;
  --brand: #14B8A6;
  --brand-soft: #2DD4BF;
  --brand-dark: #0F766E;
  --brand-hover: #0D9488;
  --brand-tint: #E6FAF7;
  --brand-tint-2: #CCFBF1;
  --bg: #F3F7F6;
  --bg-soft: #E8F2EF;
  --muted: #5F746F;
  --line: #D7E5E1;
  --card: #ffffff;
  --ok: #14B8A6;
  --ok-bg: #E6FAF7;
  --warn: #b45309;
  --bad: #c0265e;
  --nav: #F7FBFA;
  --nav-2: #EEF6F4;
  --nav-mid: #F7FBFA;
  --nav-text: #0B3D36;
  --nav-sub: #6B857F;
  --nav-active-sub: rgba(255, 255, 255, 0.88);
  --table-line: #E2EDEA;
  --table-hover: #F4FAF8;
  --input-border: #C9DCD6;
  --tabs-bg: #E8F2EF;
  --tabs-hover: #D7E8E2;
  --glow: rgba(20, 184, 166, 0.12);
  --glow-2: rgba(45, 212, 191, 0.1);
  --glow-strong: rgba(20, 184, 166, 0.22);
  --nav-hover: rgba(20, 184, 166, 0.12);
  --nav-active-a: #14B8A6;
  --nav-active-b: #0D9488;
  --nav-active-ring: rgba(20, 184, 166, 0.28);
  --btn-top: #2DD4BF;
  --btn-bottom: #14B8A6;
  --btn-shadow: rgba(20, 184, 166, 0.28);
  --btn-shadow-hover: rgba(13, 148, 136, 0.34);
  --focus-ring: rgba(20, 184, 166, 0.2);
  --menu-hover-border: #99D5CB;
  --tooth-border: #7DD3C4;
  --shadow: 0 10px 28px rgba(11, 61, 54, 0.07);
  --shadow-soft: 0 4px 14px rgba(11, 61, 54, 0.05);
}

html[data-night="1"],
html.night {
  color-scheme: dark;
  --ink: #F4F4F5;
  --bg: #09090B;
  --bg-soft: #111113;
  --muted: #A1A1AA;
  --line: #27272A;
  --card: #141416;
  --table-line: #27272A;
  --table-hover: #1C1C1F;
  --input-border: #3F3F46;
  --tabs-bg: #111113;
  --tabs-hover: #1C1C1F;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.4);
  --nav: #050506;
  --nav-2: #050506;
  --nav-mid: #050506;
  --nav-text: #E4E4E7;
  --nav-sub: #A1A1AA;
  --brand-tint: #1C1C1F;
  --brand-tint-2: #222226;
  --ok-bg: #1C1C1F;
  --menu-hover-border: #3F3F46;
}
html[data-night="1"][data-theme="violet"],
html.night[data-theme="violet"] {
  --brand-tint: #1A1826;
  --brand-tint-2: #201D2E;
  --ok-bg: #1A1826;
}
html[data-night="1"][data-theme="green"],
html.night[data-theme="green"] {
  --brand-tint: #14201D;
  --brand-tint-2: #182824;
  --ok-bg: #14201D;
}

html[data-night="1"][data-theme="green"] .brand,
html.night[data-theme="green"] .brand,
html[data-night="1"][data-theme="green"] .brand-sub,
html.night[data-theme="green"] .brand-sub {
  color: #fff;
  opacity: 1;
}
html[data-night="1"][data-theme="green"] .brand-sub,
html.night[data-theme="green"] .brand-sub { color: rgba(255,255,255,0.5); }
html[data-night="1"][data-theme="green"] .sidebar .brand-logo-img,
html.night[data-theme="green"] .sidebar .brand-logo-img {
  filter: brightness(0) invert(1);
}
html[data-night="1"][data-theme="green"] .nav-item:hover,
html.night[data-theme="green"] .nav-item:hover,
html[data-night="1"][data-theme="green"] .nav-item.active,
html.night[data-theme="green"] .nav-item.active {
  color: #fff;
}
html[data-night="1"][data-theme="green"] .sidebar-footer-label,
html.night[data-theme="green"] .sidebar-footer-label,
html[data-night="1"][data-theme="green"] .nav-admin-entry .nav-sub,
html.night[data-theme="green"] .nav-admin-entry .nav-sub {
  color: rgba(255,255,255,0.42);
}
html[data-night="1"][data-theme="green"] .nav-admin-entry:hover,
html.night[data-theme="green"] .nav-admin-entry:hover { color: #fff; }
html[data-night="1"][data-theme="green"] .nav-logout,
html.night[data-theme="green"] .nav-logout { color: #d4d4d8; }
html[data-night="1"][data-theme="green"] .sidebar,
html.night[data-theme="green"] .sidebar {
  background: #050506 !important;
  border-right-color: #27272A;
}

html[data-night="1"] .login-page,
html.night .login-page,
html[data-night="1"][data-theme="green"] .login-page,
html[data-night="1"][data-theme="violet"] .login-page {
  background: #09090B;
}
html[data-night="1"] .login-card {
  background: var(--card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
html[data-night="1"] .mail-smtp,
html[data-night="1"] .patients-board,
html[data-night="1"] .agenda-cal-panel,
html[data-night="1"] .bq-table-wrap,
html[data-night="1"] .stat-card,
html[data-night="1"] .patient-card {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}
html[data-night="1"] .app-top-agenda {
  background: var(--card) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--text);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: #eef0ff;
  padding: 1.5rem 1rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 0;
  display: flex;
  flex-direction: column;
}

.brand-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 0 .25rem 1.75rem;
  padding: .35rem .4rem;
  border-radius: 14px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.brand-link:hover { text-decoration: none; opacity: .92; }
.brand-logo-img {
  width: 44px;
  height: auto;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
}
/* En paleta verde, recolorea la muelita original (violeta → teal) sin cambiar el dibujo */
.sidebar .brand-logo-img {
  filter: brightness(0) invert(1);
  width: 36px;
}
html[data-theme="green"] .sidebar .brand-logo-img {
  /* Muelita en teal sobre sidebar clara */
  filter: invert(48%) sepia(52%) saturate(550%) hue-rotate(130deg) brightness(95%) contrast(92%);
}
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0;
  color: #fff;
  line-height: 1.05;
  text-transform: uppercase;
}
html[data-theme="green"] .brand {
  color: var(--brand);
}
.brand-sub {
  font-family: var(--font);
  color: rgba(255,255,255,0.55);
  font-size: .62rem;
  margin: .28rem 0 0;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.3;
  font-weight: 500;
}
html[data-theme="green"] .brand-sub {
  color: var(--brand);
  opacity: .85;
}

.nav { display: flex; flex-direction: column; gap: .45rem; flex: 1 1 auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  color: var(--nav-text);
  padding: .85rem .9rem;
  border-radius: 14px;
  text-decoration: none;
  transition: background var(--ease), color var(--ease);
}
.nav-item:hover {
  background: var(--nav-hover);
  color: #fff;
  text-decoration: none;
}
html[data-theme="green"] .nav-item:hover {
  color: var(--brand-dark);
}
.nav-item.active {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}
html[data-theme="green"] .nav-item.active {
  background: linear-gradient(135deg, var(--nav-active-a), var(--nav-active-b));
  color: #fff;
  box-shadow: 0 8px 18px var(--btn-shadow);
}
.nav-icon {
  width: 22px;
  height: 22px;
  color: currentColor;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  opacity: .92;
}
.nav-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.nav-icon svg * {
  stroke: currentColor !important;
}
.nav-icon svg [fill]:not([fill="none"]) {
  fill: currentColor !important;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon,
.nav-logout:hover .nav-icon {
  color: #fff;
}
.nav-text { min-width: 0; line-height: 1.15; }
.nav-label {
  display: block;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.nav-sub {
  display: block;
  margin-top: .2rem;
  font-size: 12px;
  color: var(--nav-sub);
  font-weight: 450;
}
.nav-item.active .nav-sub { color: var(--nav-active-sub); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sidebar-footer-group {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-bottom: .15rem;
}
.sidebar-footer-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
  padding: 0 .65rem .15rem;
}
html[data-theme="green"] .sidebar-footer-label {
  color: #6B857F;
}
.nav-admin-entry {
  background: rgba(105, 88, 245, 0.18);
  border: 1px solid rgba(105, 88, 245, 0.35);
}
html[data-theme="green"] .nav-admin-entry {
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.35);
}
.nav-admin-entry:hover {
  background: rgba(105, 88, 245, 0.28);
  color: #fff;
}
html[data-theme="green"] .nav-admin-entry:hover {
  background: rgba(20, 184, 166, 0.2);
  color: var(--brand-dark);
}
.nav-admin-entry .nav-sub {
  color: rgba(255,255,255,0.55);
}
html[data-theme="green"] .nav-admin-entry .nav-sub {
  color: #6B857F;
}
html[data-theme="green"] .nav-logout:hover {
  background: rgba(192, 38, 94, 0.1);
  color: #be123c;
}
html[data-theme="green"] .sidebar {
  border-right: 1px solid var(--line);
}

/* Acentos verdes (reemplazan violetas hardcodeados) */
html[data-theme="green"] .page-title,
html[data-theme="green"] h1,
html[data-theme="green"] .bq-code,
html[data-theme="green"] .cob-amount,
html[data-theme="green"] .patient-card-name {
  color: var(--ink);
}
html[data-theme="green"] .stat-card-icon.is-violet {
  background: var(--brand-tint);
  color: var(--brand-dark);
}
html[data-theme="green"] .stat-card-icon.is-sky {
  background: #E0F7F4;
  color: #0F766E;
}
html[data-theme="green"] .stat-card-icon.is-green {
  background: var(--brand-tint);
  color: var(--brand-dark);
}
html[data-theme="green"] .bq-badge.tone-violet {
  background: var(--brand-tint);
  color: var(--brand-dark);
}
html[data-theme="green"] .agenda-block.is-confirmado {
  background: var(--brand-tint);
  border-color: #99D5CB;
  color: var(--brand-dark);
}
html[data-theme="green"] .agenda-check.is-confirmado i,
html[data-theme="green"] .agenda-legend-item.is-confirmado i,
html[data-theme="green"] .agenda-month-items li.is-confirmado {
  background: var(--brand);
}
html[data-theme="green"] .agenda-mini-day.is-inrange {
  background: var(--brand-tint);
  color: var(--brand-dark);
}
html[data-theme="green"] .user-avatar {
  background: linear-gradient(145deg, var(--brand-soft), var(--brand));
}
html[data-theme="green"] .flash.ok {
  background: var(--ok-bg);
  color: var(--brand-dark);
  border-color: #99D5CB;
}

.nav-logout { color: #d7dcf0; }
.nav-logout:hover {
  background: rgba(192, 38, 94, 0.16);
  color: #fff;
}
.nav-logout:hover .nav-icon { color: #ffffff; }
html[data-theme="green"] .nav-logout {
  color: var(--nav-text);
}

.nav-icon-muela {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.nav-icon-muela img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}
.perms { display: grid; gap: .35rem; }
label.check {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--ink);
  margin: 0;
  font-size: .95rem;
}
label.check input { width: auto; }

.main { padding: 1.5rem 2rem 2.5rem; }

.app-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .65rem;
  margin: 0 0 1.1rem;
  min-height: 44px;
}

a.country-flag-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card) !important;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft) !important;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--brand);
  padding: 0 !important;
  text-decoration: none !important;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, transform .15s ease;
}
a.country-flag-btn:hover {
  border-color: var(--menu-hover-border);
  box-shadow: var(--shadow) !important;
  transform: translateY(-1px);
  filter: none !important;
  background: var(--card) !important;
  text-decoration: none !important;
}
.app-top-themes,
.login-theme-wrap {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: none;
}
.theme-toggle,
button.theme-toggle {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  border: 0;
  background: transparent !important;
  box-shadow: none !important;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  padding: 0 !important;
  text-decoration: none !important;
  transition: background .15s ease, color .15s ease;
}
.theme-toggle:hover,
button.theme-toggle:hover {
  color: var(--ink);
  background: transparent !important;
  box-shadow: none !important;
  transform: none;
  filter: none !important;
  text-decoration: none !important;
}
.country-flag-emoji {
  font-size: 1.25rem;
  line-height: 1;
  display: block;
}
.ui-icon-btn .country-flag-emoji {
  font-size: 1.2rem;
}
.phone-prefix .country-flag-emoji,
.country-mini .country-flag-emoji {
  font-size: 1.05rem;
  display: inline-block;
}
.country-flag-img,
.country-mini-img,
.phone-prefix-flag {
  display: block;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(11, 34, 81, 0.08);
}
.country-flag-img {
  width: 26px;
  height: 18px;
}
.ui-icon-btn.country-flag-btn {
  overflow: hidden;
}
.ui-icon-btn .country-flag-img {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 1px rgba(22, 36, 78, 0.08);
}
.country-mini-img,
.phone-prefix-flag {
  width: 18px;
  height: 13px;
}
.theme-toggle svg {
  width: 14px;
  height: 14px;
  display: block;
  stroke-width: 1.85;
}
.theme-toggle.is-on,
button.theme-toggle.is-on {
  border: 0 !important;
  color: var(--brand) !important;
  background: var(--brand-tint) !important;
  box-shadow: none !important;
}

.login-theme-wrap {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
}

.user-menu { position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: .3rem .8rem .3rem .3rem;
  box-shadow: var(--shadow-soft);
  user-select: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.user-menu-trigger:hover {
  border-color: var(--menu-hover-border);
  box-shadow: var(--shadow);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand-soft), var(--brand));
  color: #fff;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: 0 6px 14px var(--btn-shadow);
}

.user-menu-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.user-menu-name {
  font-weight: 700;
  font-size: .92rem;
  color: var(--ink);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-user {
  font-size: .75rem;
  color: var(--muted);
}
.user-menu-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #8b90b0;
  margin-left: .15rem;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: .4rem;
  z-index: 40;
}
.user-menu-panel a {
  display: block;
  padding: .65rem .75rem;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
}
.user-menu-panel a:hover {
  background: var(--brand-tint);
  text-decoration: none;
}
.user-menu-panel a.danger { color: var(--bad); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.inline-form { display: inline; margin: 0; }
.topbar h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  letter-spacing: -0.035em;
  color: var(--ink);
  font-weight: 700;
}
.topbar p { margin: .35rem 0 0; color: var(--muted); font-weight: 450; font-size: 15px; }

.country-pill {
  display: none;
}
.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.country-mini {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .28rem .6rem;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: .82rem;
}
.country-mini-flag { font-size: 1.05rem; line-height: 1; }
.country-mini img { flex: 0 0 auto; }

.phone-with-prefix {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.phone-with-prefix:focus-within {
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.phone-prefix {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: 0 .85rem;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: .9rem;
  white-space: nowrap;
  border-right: 1px solid var(--line);
}
.phone-with-prefix input {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 1.25rem 1.35rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 1rem;
}
.grid-2.is-split { grid-template-columns: 1fr 1fr; }
.mail-smtp {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .65rem .85rem .85rem;
  background: #FAFBFC;
}
.mail-smtp summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}
.mail-smtp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.mail-need-tag,
.mail-auto-tag {
  display: none;
  margin-left: .35rem;
  padding: .08rem .42rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .01em;
  vertical-align: middle;
}
.is-need .mail-need-tag {
  display: inline-flex;
  background: #fff4e8;
  color: #9a3412;
}
.is-auto .mail-auto-tag {
  display: inline-flex;
  background: #e8f7ef;
  color: #0f7a4c;
}
.is-need .mail-auto-tag { display: none; }
.is-need > label { color: #9a3412; }
.is-need input,
.is-need select {
  border-color: #f0b27a;
  background: #fff8f1;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.10);
}
.is-auto input,
.is-auto select {
  background: #f4f6f8;
  color: var(--muted);
}
.mail-linked-chip {
  display: inline-flex;
  align-items: center;
  margin-left: .45rem;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: #e8f7ef;
  color: #0f7a4c;
  font-size: .72rem;
  font-weight: 800;
  vertical-align: middle;
}
.mail-app-help {
  padding: .85rem 1rem;
  border-radius: 12px;
  background: #fff8f1;
  border: 1px solid #f0c9a0;
  color: #9a3412;
  font-size: .88rem;
  line-height: 1.45;
}
.mail-app-help p { margin: 0 0 .45rem; }
.mail-app-help p:last-child { margin: 0; }
.mail-app-help a {
  color: #9a3412;
  font-weight: 800;
}
.mail-pass-note {
  margin: .4rem 0 0;
  color: var(--muted);
  font-size: .8rem;
}
html[data-night="1"] .mail-app-help,
html.night .mail-app-help {
  background: rgba(154, 52, 18, 0.22);
  border-color: rgba(240, 178, 122, 0.35);
  color: #fdba74;
}
html[data-night="1"] .mail-app-help a,
html.night .mail-app-help a { color: #fdba74; }
html[data-night="1"] .mail-linked-chip,
html.night .mail-linked-chip {
  background: rgba(15, 122, 76, 0.22);
  color: #86efac;
}
.mail-provider-hint {
  padding: .7rem .9rem;
  border-radius: 12px;
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.4;
}
.mail-provider-hint.is-known {
  background: #e8f7ef;
  color: #0f7a4c;
  border: 1px solid #b7e4c7;
}
.mail-provider-hint.is-other {
  background: #fff4e8;
  color: #9a3412;
  border: 1px solid #f0c9a0;
}
html[data-night="1"] .is-need input,
html.night .is-need input,
html[data-night="1"] .is-need select,
html.night .is-need select {
  background: #3a2a18;
  border-color: #c2782a;
  color: var(--ink);
}
html[data-night="1"] .is-auto input,
html.night .is-auto input,
html[data-night="1"] .is-auto select,
html.night .is-auto select {
  background: var(--bg-soft);
}
html[data-night="1"] .mail-provider-hint.is-known,
html.night .mail-provider-hint.is-known {
  background: rgba(15, 122, 76, 0.18);
  border-color: rgba(15, 122, 76, 0.35);
  color: #86efac;
}
html[data-night="1"] .mail-provider-hint.is-other,
html.night .mail-provider-hint.is-other {
  background: rgba(154, 52, 18, 0.22);
  border-color: rgba(240, 178, 122, 0.35);
  color: #fdba74;
}

/* Buzón del consultorio (IMAP al vuelo) */
.mbx-head { align-items: flex-end; }
.mbx-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.mbx-head-actions .btn,
.mbx-compose button,
.mbx-read-top .btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.mbx {
  display: grid;
  grid-template-columns: minmax(260px, 34%) 1fr;
  gap: 0;
  min-height: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.mbx-side {
  border-right: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mbx-tabs {
  display: flex;
  gap: .35rem;
  padding: .75rem .8rem;
  border-bottom: 1px solid var(--line);
}
.mbx-tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: .86rem;
  padding: .42rem .5rem;
  border-radius: 999px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
}
.mbx-tabs a.is-on {
  background: linear-gradient(180deg, var(--btn-top), var(--btn-bottom));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 14px var(--btn-shadow);
}
.mbx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  max-height: calc(70vh - 40px);
}
.mbx-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "who date" "sub sub";
  gap: .1rem .65rem;
  padding: .75rem .9rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
}
.mbx-item:hover { background: var(--card); text-decoration: none; }
.mbx-item.is-on { background: var(--card); box-shadow: inset 3px 0 0 var(--brand-soft); }
.mbx-item.is-unread .mbx-item-who,
.mbx-item.is-unread .mbx-item-sub { font-weight: 800; }
.mbx-item-who {
  grid-area: who;
  font-weight: 650;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mbx-item-sub {
  grid-area: sub;
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mbx-item-date {
  grid-area: date;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 650;
  white-space: nowrap;
}
.mbx-none, .mbx-warn {
  margin: 1rem .9rem;
  color: var(--muted);
  font-size: .9rem;
}
.mbx-warn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem .95rem;
}
.mbx-warn strong { display: block; color: var(--ink); margin-bottom: .3rem; }
.mbx-warn p { margin: 0 0 .55rem; }
.mbx-warn .mbx-conn { font-size: .78rem; color: var(--muted); }
.mbx-main {
  min-width: 0;
  background: var(--card);
  display: flex;
  flex-direction: column;
}
.mbx-placeholder,
.mbx-empty {
  display: grid;
  place-items: center;
  text-align: center;
  gap: .65rem;
  padding: 2.5rem 1.25rem;
  color: var(--muted);
}
.mbx-empty { min-height: 280px; }
.mbx-empty h2 { margin: 0; color: var(--ink); font-size: 1.2rem; }
.mbx-empty p { margin: 0; max-width: 36ch; }
.mbx-empty-ico { color: var(--brand-soft); }
.mbx-read, .mbx-compose { padding: 1.1rem 1.25rem 1.4rem; }
.mbx-read-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}
.mbx-read h2, .mbx-compose h2 {
  margin: 0 0 .45rem;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}
.mbx-back {
  display: none;
  align-items: center;
  gap: .2rem;
  font-weight: 700;
  font-size: .88rem;
  text-decoration: none;
}
.mbx-meta {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .88rem;
}
.mbx-meta strong { color: var(--ink); margin-right: .25rem; }
.mbx-meta-em { margin-left: .25rem; }
.mbx-meta-date { display: block; margin-top: .25rem; font-size: .8rem; }
.mbx-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.55;
  color: var(--ink);
}
.mbx-html {
  display: block;
  width: 100%;
  height: 560px;
  margin: 0;
  border: 0;
  border-radius: 16px;
  background: #f4f6fb;
}
.mbx-no-attach {
  margin: .85rem 0 0;
  font-size: .8rem;
}
@media (max-width: 900px) {
  .mbx {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .mbx-list { max-height: none; }
  .mbx.is-open .mbx-side { display: none; }
  .mbx:not(.is-open) .mbx-main { display: none; }
  .mbx-back { display: inline-flex; }
  .mbx-head { flex-direction: column; align-items: stretch; }
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.stat .label { color: var(--muted); font-size: .86rem; font-weight: 650; }
.stat .value {
  font-size: 1.7rem;
  font-weight: 800;
  margin-top: .25rem;
  letter-spacing: -0.035em;
  color: var(--ink);
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: .72rem .5rem;
  border-bottom: 1px solid var(--table-line);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 700; font-size: .84rem; }
tr:hover td { background: var(--table-hover); }

.btn, button:not(.theme-toggle):not(.patients-open-btn):not(.ui-icon-btn):not(.secondary):not(.bq-pill):not(.pager-btn):not(.danger-outline):not(.lab-dir-item):not(.login-eye):not(.login-link-btn), .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  padding: .7rem 1.15rem;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
}
.btn:hover, button:not(.theme-toggle):not(.patients-open-btn):not(.ui-icon-btn):not(.secondary):not(.bq-pill):not(.pager-btn):not(.danger-outline):not(.lab-dir-item):not(.login-eye):not(.login-link-btn):hover {
  background: var(--brand-hover);
  color: #fff;
  text-decoration: none;
  filter: none;
  transform: none;
  box-shadow: none;
}
.btn.secondary, button.secondary, a.btn.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border-radius: 12px;
  padding: .7rem 1.15rem;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.secondary:hover, button.secondary:hover, a.btn.secondary:hover {
  filter: none;
  background: var(--card);
  border-color: var(--menu-hover-border);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}
.btn.danger, button.danger { background: var(--bad); box-shadow: none; color: #fff; }
.btn.danger-outline, button.danger-outline,
.secondary.danger-outline {
  background: #ffe4ec;
  color: #9f1239;
  box-shadow: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
label {
  display: block;
  font-size: .86rem;
  color: var(--muted);
  margin-bottom: .3rem;
  font-weight: 650;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: .62rem .78rem;
  font: inherit;
  background: var(--card);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
textarea { min-height: 90px; resize: vertical; }

.flash {
  padding: .85rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  font-weight: 650;
}
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: #ffe4ec; color: #9f1239; }

.badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .76rem;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-weight: 700;
}
.badge.pendiente { background: #ffedd5; color: #9a3412; }
.badge.confirmado, .badge.completado { background: var(--ok-bg); color: var(--ok); }
.badge.cancelado { background: #ffe4ec; color: #9f1239; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(160deg, #F7FBFF 0%, #F3F7FC 45%, #EEF4FA 100%);
}
html[data-theme="green"] .login-page {
  background: linear-gradient(160deg, #F4FBFA 0%, #EAF7F4 42%, #E7F4F8 100%);
}
html[data-theme="violet"] .login-page,
html:not([data-theme]) .login-page {
  background: linear-gradient(160deg, #F7F6FF 0%, #F3F1FC 42%, #EEF2FB 100%);
}
.login-decor {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.login-decor-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .55;
}
.login-decor-blob-a {
  width: 520px;
  height: 520px;
  left: -180px;
  top: -160px;
  background: radial-gradient(circle at 40% 40%, rgba(105, 88, 245, 0.28) 0%, rgba(105, 88, 245, 0.08) 42%, transparent 70%);
}
html[data-theme="green"] .login-decor-blob-a {
  background: radial-gradient(circle at 40% 40%, rgba(45, 212, 191, 0.28) 0%, rgba(45, 212, 191, 0.08) 42%, transparent 70%);
}
.login-decor-blob-b {
  width: 640px;
  height: 480px;
  right: -220px;
  bottom: -180px;
  background: radial-gradient(circle at 55% 45%, rgba(139, 124, 255, 0.22) 0%, rgba(105, 88, 245, 0.12) 40%, transparent 72%);
}
html[data-theme="green"] .login-decor-blob-b {
  background: radial-gradient(circle at 55% 45%, rgba(56, 189, 248, 0.18) 0%, rgba(20, 184, 166, 0.12) 40%, transparent 72%);
}
.login-decor-blob-c {
  width: 380px;
  height: 380px;
  left: 18%;
  bottom: 8%;
  background: radial-gradient(circle at 50% 50%, rgba(105, 88, 245, 0.16) 0%, transparent 68%);
  opacity: .4;
}
html[data-theme="green"] .login-decor-blob-c {
  background: radial-gradient(circle at 50% 50%, rgba(125, 211, 196, 0.22) 0%, transparent 68%);
}
.login-decor-dots {
  position: absolute;
  width: 110px;
  height: 110px;
  background-image: radial-gradient(rgba(105, 88, 245, 0.30) 1.4px, transparent 1.5px);
  background-size: 14px 14px;
  opacity: .55;
}
html[data-theme="green"] .login-decor-dots {
  background-image: radial-gradient(rgba(20, 184, 166, 0.28) 1.4px, transparent 1.5px);
}
.login-decor-dots-tr { top: 7%; right: 8%; }
.login-decor-dots-bl { bottom: 8%; left: 6%; }

.login-simple { width: min(440px, 100%); position: relative; z-index: 1; }
.login-simple.login-wide { width: min(560px, 100%); }
.login-card {
  width: 100%;
  background: var(--card);
  border: 0;
  border-radius: 28px;
  box-shadow:
    0 24px 60px rgba(22, 36, 78, 0.10),
    0 2px 8px rgba(22, 36, 78, 0.04);
  padding: 1.75rem 1.85rem 1.35rem;
}
html[data-theme="green"] .login-card {
  box-shadow:
    0 24px 60px rgba(15, 70, 64, 0.10),
    0 2px 8px rgba(15, 70, 64, 0.04);
}

.login-simple-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  margin-bottom: .7rem;
}
.login-brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--brand);
}
.login-brand-tooth-img {
  width: 46px;
  height: auto;
  display: block;
  object-fit: contain;
}
.login-brand-tooth-green { display: none; }
html[data-theme="green"] .login-brand-tooth-violet { display: none; }
html[data-theme="green"] .login-brand-tooth-green { display: block; }
.login-brand-rule {
  width: 1px;
  align-self: stretch;
  min-height: 46px;
  background: var(--line);
  flex: 0 0 auto;
}
.login-brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.login-brand-name {
  font-family: "Montserrat", var(--font);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--ink);
  text-transform: uppercase;
}
.login-brand-tag {
  margin-top: .38rem;
  font-family: "Montserrat", var(--font);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-transform: uppercase;
  color: var(--brand);
  max-width: 15rem;
}
.login-brand-line {
  width: 42px;
  height: 2px;
  margin: 0 auto .85rem;
  border-radius: 999px;
  background: var(--brand);
}

.login-form { margin: 0; }
.login-field {
  position: relative;
  display: block;
}
.login-field-ico {
  display: inline-grid;
  place-items: center;
  position: absolute;
  left: .95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  pointer-events: none;
  z-index: 1;
}
.login-field-ico svg { display: block; }
.login-actions { margin: .7rem 0 0; }
.login-submit {
  width: 100%;
  min-height: 3.15rem;
  font-size: 1.02rem;
  font-weight: 700;
  padding: .9rem 1.1rem;
  gap: .55rem;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--brand) 100%) !important;
  box-shadow: 0 10px 22px var(--btn-shadow);
}
.login-submit:hover {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-hover) 100%) !important;
  box-shadow: 0 12px 26px var(--btn-shadow-hover);
}
.login-submit-ico {
  display: inline-grid;
  place-items: center;
  line-height: 0;
}
.login-submit-ico svg { display: block; }
.login-label-gap { margin-top: .85rem; display: block; }
.login-step-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  letter-spacing: -0.02em;
}
.login-step-hint {
  margin: .28rem 0 .9rem;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
}
.login-card label {
  font-size: .92rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .45rem;
  display: block;
}
.login-card .login-field input {
  font-size: 1.02rem;
  padding: .85rem 1rem .85rem 2.75rem;
  min-height: 3rem;
  width: 100%;
  border: 1.5px solid var(--input-border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  box-shadow: none;
}
.login-card .login-field input::placeholder { color: #A7B3BF; }
.login-card .login-field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.login-card .login-field input.login-readonly {
  background: var(--brand-tint);
  color: #5F6B7A;
  opacity: 1;
}
.login-password-wrap input { padding-right: 2.75rem; }
.login-eye {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: .35rem;
  line-height: 1;
  opacity: .7;
}
.login-link-btn {
  display: inline;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login-forgot {
  margin: .75rem 0 0;
  text-align: center;
}
.login-forgot a {
  color: var(--brand);
  font-weight: 600;
  font-size: .86rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login-forgot a:hover {
  color: var(--brand-dark);
}
.login-back-form {
  margin-top: .9rem;
  text-align: center;
}
.login-backup-toggle {
  margin: .65rem 0 0;
  text-align: right;
}
.login-or {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: .45rem 0;
  color: #9AA6B2;
  font-size: .78rem;
  font-weight: 600;
}
.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #E3E8EE;
}
.login-or-dot {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  border: 1px solid #E3E8EE;
  display: inline-grid;
  place-items: center;
  background: #fff;
  line-height: 1;
  font-size: .72rem;
}
html[data-night="1"] .login-or-dot,
html.night .login-or-dot {
  background: var(--card);
  border-color: var(--line);
  color: var(--muted);
}
html[data-night="1"] .login-or::before,
html.night .login-or::before,
html[data-night="1"] .login-or::after,
html.night .login-or::after {
  background: var(--line);
}
.login-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  width: 100%;
  min-height: 2.55rem;
  padding: .55rem 1rem;
  border-radius: 14px;
  border: 1.5px solid #D7DEE7;
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
  box-sizing: border-box;
  transition: background var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.login-help-btn:hover {
  background: var(--brand-tint);
  border-color: var(--brand-soft);
  color: var(--brand-dark);
  text-decoration: none;
}
.login-signup-btn {
  min-height: 2.85rem;
  border: 0;
  color: #fff !important;
  font-weight: 700;
  background: linear-gradient(180deg, #2DD4BF 0%, #14B8A6 100%) !important;
  box-shadow: 0 8px 18px rgba(20, 184, 166, 0.28);
}
.login-signup-btn .login-help-ico { color: #fff; }
.login-signup-btn:hover {
  color: #fff !important;
  background: linear-gradient(180deg, #14B8A6 0%, #0D9488 100%) !important;
  box-shadow: 0 10px 20px rgba(13, 148, 136, 0.34);
}
html[data-theme="green"] .login-signup-btn {
  background: linear-gradient(180deg, #8B7CFF 0%, #6958F5 100%) !important;
  box-shadow: 0 8px 18px rgba(105, 88, 245, 0.22);
}
html[data-theme="green"] .login-signup-btn:hover {
  background: linear-gradient(180deg, #6958F5 0%, #5A49EA 100%) !important;
  box-shadow: 0 10px 20px rgba(90, 73, 234, 0.28);
}
.login-help-ico { display: inline-grid; place-items: center; line-height: 0; color: var(--brand); }
.login-help-ico svg { display: block; }
.login-help-link { display: none; }
.login-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  margin-top: .85rem;
  padding-top: .8rem;
  border-top: 1px solid #E8EEF3;
}
.login-foot:has(> :only-child) {
  grid-template-columns: 1fr;
}
.login-foot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: .4rem .7rem;
  border-radius: 12px;
  font-size: .84rem;
  font-weight: 700;
  text-decoration: none;
  box-sizing: border-box;
  line-height: 1.2;
  transition: background var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.login-foot-btn.is-signup {
  color: #fff !important;
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--brand-dark) 100%);
  border: 0;
  box-shadow: 0 6px 14px var(--btn-shadow);
}
.login-foot-btn.is-signup:hover {
  color: #fff !important;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-hover) 100%);
  text-decoration: none;
}
.login-foot-btn.is-help {
  color: var(--brand);
  background: #fff;
  border: 1.5px solid #D7DEE7;
}
.login-foot-btn.is-help:hover {
  color: var(--brand-dark);
  background: var(--brand-tint);
  border-color: var(--brand-soft);
  text-decoration: none;
}
html[data-night="1"] .login-foot,
html.night .login-foot {
  border-top-color: var(--line);
}
html[data-night="1"] .login-foot-btn.is-help,
html.night .login-foot-btn.is-help {
  background: var(--card);
  border-color: var(--line);
  color: var(--brand);
}
.login-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
.login-register-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .75rem;
}
.login-grid-full { grid-column: 1 / -1; }
.login-register-page {
  padding: .45rem .7rem;
  min-height: 100dvh;
}
.login-register-page .login-wide { width: min(640px, 100%); }
.login-register-page .login-card {
  padding: 1.25rem 1.25rem 1rem;
  border-radius: 22px;
}
.login-register-page .login-simple-brand {
  margin-bottom: .75rem;
  gap: .95rem;
}
.login-register-page .login-brand-tooth-img { width: 58px; height: auto; }
.login-register-page .login-brand-rule { min-height: 58px; }
.login-register-page .login-brand-name {
  font-size: 1.85rem;
  letter-spacing: .06em;
}
.login-register-page .login-brand-tag {
  margin-top: .28rem;
  font-size: .62rem;
  letter-spacing: .08em;
  max-width: 16.5rem;
}
.login-register-page .login-brand-line {
  display: block;
  width: 52px;
  height: 3px;
  margin: 0 auto 1rem;
}
.reg-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: .15rem 0 .7rem;
  flex-wrap: wrap;
}
.reg-badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: .28rem .7rem;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--brand) 100%);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1;
}
.reg-invite {
  display: grid;
  gap: .15rem;
  margin: 0 0 .75rem;
  padding: .65rem .8rem;
  border-radius: 12px;
  background: #F1EFFF;
  color: #4C1D95;
  font-size: .8rem;
}
.reg-invite strong { font-size: .78rem; }
.reg-invite-field { grid-column: 1 / -1; }
.myplan-leave {
  margin: 0 0 1.25rem;
}
.login-register-page .login-step-hint {
  margin: 0;
  text-align: left;
  font-size: .78rem;
  flex: 1 1 12rem;
}
.reg-fields {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: .5rem .75rem;
}
.reg-fields > div { min-width: 0; }
.login-register-page .login-card label {
  font-size: .75rem;
  margin-bottom: .14rem;
}
.login-register-page .login-card .login-field input {
  min-height: 2.2rem;
  padding: .35rem .65rem;
  font-size: .9rem;
  border-radius: 10px;
}
.login-register-page .login-submit {
  min-height: 2.45rem;
  padding: .45rem 1rem;
  font-size: .95rem;
}
.login-register-page .login-actions { margin: .55rem 0 0; }
.login-register-page .login-foot {
  grid-template-columns: 1fr;
  margin-top: .65rem;
  padding-top: .65rem;
}
.login-optin {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin: .65rem 0 0;
  font-size: .74rem !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  line-height: 1.35;
  cursor: pointer;
}
.login-optin input {
  width: 1rem !important;
  height: 1rem !important;
  min-height: 0 !important;
  margin: .12rem 0 0;
  flex: 0 0 auto;
  accent-color: var(--brand);
  box-shadow: none !important;
}
.login-register-page .flash { margin-bottom: .55rem; padding: .55rem .75rem; font-size: .85rem; }
@media (max-width: 480px) {
  .reg-fields { grid-template-columns: 1fr 1fr; }
  .login-register-page .login-wide { width: 100%; }
}
.login-hp,
.login-hp label,
.login-hp input {
  display: none !important;
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.login-register-note {
  margin: .95rem 0 0;
  color: #7A8794;
  font-size: .82rem;
  line-height: 1.45;
}
.login-register-support {
  margin: .85rem 0 0;
  text-align: center;
  color: #9AA6B2;
  font-size: .8rem;
}
.login-submit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
  color: #fff !important;
}
.login-submit-link:hover { text-decoration: none; color: inherit; }
.login-creds {
  margin: 0 0 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f8fb;
}
.login-creds p {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  font-size: .92rem;
}
.login-creds p + p { margin-top: .45rem; }
.login-creds span { color: #7A8794; }
.login-creds strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ctl-client-profile {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.4;
}
@media (max-width: 560px) {
  .login-grid-2 { grid-template-columns: 1fr; }
}
.login-totp-setup {
  display: grid;
  justify-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.login-totp-qr {
  padding: .75rem;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  min-height: 180px;
  min-width: 180px;
}
.login-totp-manual {
  margin: 0;
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
}
.login-totp-secret {
  display: inline-block;
  margin-top: .35rem;
  padding: .35rem .55rem;
  border-radius: 8px;
  background: var(--tabs-bg);
  color: var(--ink);
  font-size: .85rem;
  letter-spacing: .04em;
  word-break: break-all;
}
.backup-codes-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .8rem;
  padding-left: 1.1rem;
  margin: .8rem 0 1rem;
}
.backup-codes-list code {
  font-size: .95rem;
  letter-spacing: .04em;
}
.lab-created-actions {
  margin-bottom: 1.2rem;
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand-tint);
}
.lab-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.lab-row-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: .35rem;
  align-items: stretch;
}
.lab-row-actions .btn {
  padding: .4rem .7rem;
  font-size: .82rem;
  box-shadow: none;
  text-align: center;
}
.lab-row-actions form {
  align-self: center;
}
.labs-stack {
  display: grid;
  gap: 1.2rem;
}
/* —— Pacientes premium (mockup) —— */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.25rem;
}
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  flex-shrink: 0;
}
.page-title {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1.1;
}
.page-subtitle {
  margin: .45rem 0 0;
  font-size: 16px;
  color: var(--muted);
  font-weight: 400;
}
.app-top-left {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
}
.app-top-plan {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 40px;
  padding: .35rem .75rem .35rem .55rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  line-height: 1.1;
  white-space: nowrap;
  max-width: 100%;
}
.app-top-plan:hover {
  border-color: var(--brand-soft);
  background: var(--brand-tint);
  color: var(--ink);
  text-decoration: none;
}
.app-top-plan-k {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .15rem .35rem;
  border-radius: 6px;
  background: var(--brand-tint);
}
.app-top-plan strong {
  font-size: 13px;
  font-weight: 750;
}
.app-top-plan em {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  padding: .12rem .4rem;
}
.app-top-plan em.is-comped {
  background: #7c3aed;
}
.app-top-plan em.is-pending {
  background: #c2410c;
}
.app-plan-banner {
  margin: 0 1.1rem .35rem;
  padding: .55rem .85rem;
  border-radius: 12px;
  background: #FFF4E8;
  color: #9A3412;
  font-size: 13px;
  font-weight: 650;
}
.app-plan-banner a {
  color: #9A3412;
  font-weight: 800;
}
.app-top-plan-until {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.myplan-head { margin-bottom: 1rem; }
.myplan-trial-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  padding: .12rem .45rem;
  vertical-align: middle;
}
.myplan-hint {
  margin: .45rem 0 0;
  color: var(--muted);
  font-size: .9rem;
  max-width: 640px;
}
.myplan-card { display: flex; flex-direction: column; }
.myplan-card.is-current {
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 2px var(--focus-ring);
}
.ctl-plan-card.is-recommended {
  border-color: #7DD3FC;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, .16);
}
.ctl-plan-card.is-recommended.is-current {
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 2px var(--focus-ring);
}
.plan-card-badges {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  justify-content: flex-end;
  align-items: center;
}
.plan-rec-badge {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: #0284C7;
  border-radius: 999px;
  padding: .15rem .45rem;
}
.plan-rec-mini {
  display: block;
  margin-top: .2rem;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #0284C7;
}
.ctl-matrix th.is-rec-col { color: #0369A1; }
.myplan-current {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--brand-tint);
  border-radius: 999px;
  padding: .15rem .4rem;
}
.myplan-keep {
  margin: .85rem 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.myplan-pick { margin: .85rem 0 0; }
.myplan-pick .btn { width: 100%; }
.ctl-matrix th.is-current-col { color: var(--brand-dark); }
@media (max-width: 720px) {
  .app-top-plan-k { display: none; }
  .app-top-plan { padding: .35rem .65rem; }
}
.app-top-right {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-left: auto;
}
.app-top-agenda {
  padding: .55rem .9rem !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  gap: .4rem;
}
.ui-icon-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  padding: 0 !important;
  border-radius: 12px !important;
  border: 1px solid var(--line) !important;
  background: var(--card) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
  display: inline-grid !important;
  place-items: center !important;
  cursor: pointer;
  text-decoration: none !important;
  transition: background var(--ease), border-color var(--ease) !important;
}
.ui-icon-btn:hover {
  background: var(--card) !important;
  border-color: var(--menu-hover-border) !important;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}
.ui-icon-btn.has-dot {
  position: relative;
}
.ui-icon-btn.has-dot::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  border: 1.5px solid #fff;
}
.user-avatar {
  background: var(--brand) !important;
  color: #fff !important;
}
.patients-hub {
  display: grid;
  gap: 1rem;
  max-width: 1180px;
  width: 100%;
}
.page-patients .page-head.d-desktop,
.page-patients .patients-hub,
.page-patients .patients-sheet {
  max-width: 1180px;
  width: 100%;
}

.patients-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}
.stat-card {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: 1rem 1.05rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.stat-card-icon.is-violet { background: #F1EFFF; color: #6958F5; }
.stat-card-icon.is-sky { background: #E8F4FF; color: #0284C7; }
.stat-card-icon.is-green { background: #E8F8F0; color: #059669; }
.stat-card-icon.is-orange { background: #FFF4E8; color: #EA580C; }
.stat-card-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .25rem;
}
.stat-card-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.15;
}
.stat-card-hint {
  display: inline-block;
  margin-top: .3rem;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}
.stat-card-hint.is-ok { color: #059669; }
.stat-card-hint.is-warn { color: #EA580C; }
.stat-card-hint.is-link { color: #0284C7; }
.stat-card-hint.is-link:hover { text-decoration: underline; }

.patients-board {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.patients-toolbar {
  display: flex;
  gap: .65rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.patients-searchbox {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex: 1;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.patients-searchbox:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.patients-searchbox svg { color: var(--muted); flex: 0 0 auto; }
.patients-searchbox input {
  flex: 1;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;
  padding: 0 !important;
  font-size: 15px;
  background: transparent !important;
  color: var(--ink);
}
.patients-searchbox input::placeholder { color: #94A3B8; }
.patients-filter-btn {
  padding: .7rem 1rem !important;
  font-size: 14px !important;
  white-space: nowrap;
}
.patients-filter-btn.is-on {
  border-color: var(--brand) !important;
  color: var(--brand) !important;
  background: var(--brand-tint) !important;
}

.patients-card-list { padding: .25rem 0 .35rem; }
.patients-card-head {
  display: grid;
  grid-template-columns: minmax(220px, 1.45fr) minmax(150px, 1fr) 140px 140px 110px 150px;
  gap: 1rem;
  padding: .7rem 1.4rem;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.patient-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.45fr) minmax(150px, 1fr) 140px 140px 110px 150px;
  gap: 1rem;
  align-items: center;
  margin: 0 .85rem .45rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: background var(--ease), border-color var(--ease);
  position: relative;
}
.patient-card[hidden],
.m-patient-row[hidden] {
  display: none !important;
}
.patient-card:hover { border-color: #D8DCE8; }
.patient-card.is-selected {
  background: #F8F7FF;
  border-color: #DDD7FF;
}
.patient-card.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
}
.patient-card-person {
  display: flex;
  align-items: center;
  gap: .85rem;
  min-width: 0;
}
.patient-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: 0 0 auto;
}
.patient-card-avatar.tone-violet { background: #6958F5; }
.patient-card-avatar.tone-indigo { background: #4F46E5; }
.patient-card-avatar.tone-teal { background: #0D9488; }
.patient-card-avatar.tone-rose { background: #E11D48; }
.patient-card-avatar.tone-amber { background: #D97706; }
.patient-card-avatar.tone-sky { background: #0284C7; }
.patient-card-id { min-width: 0; display: grid; gap: .18rem; }
.patient-card-id strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patient-card-id span {
  font-size: 13px;
  color: var(--muted);
}
.patient-card-contact { display: grid; gap: .3rem; min-width: 0; }
.patient-card-contact span {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patient-card-contact svg { color: var(--muted); flex: 0 0 auto; }
.is-muted { color: var(--muted) !important; font-weight: 450 !important; }

.patient-card-visit,
.patient-card-next {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  min-width: 0;
}
.patient-card-visit > div,
.patient-card-next > div {
  display: grid;
  gap: .12rem;
}
.patient-card-visit strong,
.patient-card-next strong {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}
.patient-card-visit span,
.patient-card-next span:not(.next-ico) {
  font-size: 12px;
  color: var(--muted);
}
.visit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: .35rem;
  flex: 0 0 auto;
  background: #CBD5E1;
}
.patient-card-visit.tone-ok .visit-dot { background: #10B981; }
.patient-card-visit.tone-warn .visit-dot { background: #F59E0B; }
.next-ico {
  color: var(--muted);
  margin-top: .15rem;
  display: inline-flex;
}

.patient-card-balance {
  display: grid;
  gap: .3rem;
  justify-items: start;
}
.patient-card-balance strong {
  font-size: 14px;
  font-weight: 700;
}
.patient-card-balance.is-ok strong { color: #059669; }
.patient-card-balance.has-debt strong { color: #E11D48; }
.balance-pill {
  display: inline-flex;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
}
.patient-card-balance.is-ok .balance-pill {
  background: #ECFDF5;
  color: #059669;
}
.patient-card-balance.has-debt .balance-pill {
  background: #FEF2F2;
  color: #E11D48;
}

.patient-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
}
.patient-card-actions form { margin: 0; }
button.patient-open-btn,
a.patient-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff !important;
  color: var(--brand) !important;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, #fff) !important;
  border-radius: 10px !important;
  padding: .5rem .75rem !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
}
button.patient-open-btn:hover,
a.patient-open-btn:hover {
  background: var(--brand-tint) !important;
  border-color: var(--brand) !important;
  color: var(--brand-dark) !important;
  transform: none !important;
  filter: none !important;
}
.patient-more { position: relative; }
.patient-more > summary {
  list-style: none;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  border-radius: 10px !important;
}
.patient-more > summary::-webkit-details-marker { display: none; }
.patient-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: .35rem;
  z-index: 5;
}
.patient-more-panel a {
  display: block;
  padding: .55rem .7rem;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
}
.patient-more-panel a:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.patient-more-panel form { margin: 0; }
.patient-more-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: .55rem .7rem !important;
  border-radius: 8px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 550 !important;
  box-shadow: none !important;
  cursor: pointer;
}
.patient-more-panel button:hover {
  background: var(--bg-soft) !important;
}

.patients-board-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .9rem 1.25rem 1.05rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.patients-pager {
  display: flex;
  gap: .3rem;
  align-items: center;
}
button.pager-btn {
  min-width: 34px !important;
  height: 34px !important;
  padding: 0 .55rem !important;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  background: #fff !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}
button.pager-btn:hover:not(:disabled) {
  border-color: #D1D5DB !important;
  background: #fff !important;
  transform: none !important;
}
button.pager-btn.is-active {
  background: var(--brand-tint) !important;
  border-color: #D8D2FF !important;
  color: var(--brand) !important;
}
button.pager-btn:disabled {
  opacity: .45;
  cursor: default;
}
.patients-empty-card {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--muted);
}
.patients-empty-card p { margin: 0 0 .85rem; }

.patients-sheet {
  padding: 1.35rem 1.45rem 1.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.patients-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.patients-sheet-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.patients-sheet-head p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: 14px;
}
.patients-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.patients-fields-full { grid-column: 1 / -1; }
.patients-form label {
  font-size: 13px;
  margin-bottom: .25rem;
  color: var(--muted);
}
.patients-form input,
.patients-form textarea {
  padding: .7rem .85rem;
  border-radius: 12px;
  border-color: var(--line);
}
.patients-form textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}
.patients-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.patients-form-extra {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.patients-import {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.pim-panel h2 {
  margin: 0 0 .2rem;
  font-size: 1.15rem;
}
.pim-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: .75rem;
}
.pim-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 .75rem;
}
.pim-stats .ms-badge { font-size: .78rem; padding: .28rem .55rem; }
.pim-table-wrap {
  max-height: min(52vh, 460px);
  margin: .4rem 0 .85rem;
}
.pim-confirm {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: .75rem 1rem;
  align-items: end;
  margin-top: .35rem;
}
.pim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.pim-cancel { margin-top: .65rem; }
.pim-help {
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.pim-help h3 {
  margin: 0 0 .45rem;
  font-size: 1rem;
}
.pim-help p { margin: 0 0 .65rem; }
.pim-cols {
  margin: 0 0 .75rem;
  padding-left: 1.1rem;
  color: var(--muted);
}
.pim-cols code {
  font-size: .86em;
}
@media (max-width: 900px) {
  .pim-confirm { grid-template-columns: 1fr; }
}
.patients-section-divider {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin: .35rem 0 .15rem;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.patients-section-divider span { white-space: nowrap; }
.patients-section-divider::before,
.patients-section-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}
.patients-search {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
  align-items: center;
}
.patients-search input,
.patients-search select {
  flex: 1 1 180px;
  min-width: 0;
  padding: .7rem .9rem;
  border-radius: 12px;
}
.patients-topbar {
  align-items: center;
  margin-bottom: 1rem;
}
.patients-topbar h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
  font-weight: 700;
}
@media (max-width: 1100px) {
  .patients-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patients-card-head { display: none; }
  .patient-card {
    grid-template-columns: 1fr;
    gap: .75rem;
  }
  .patient-card-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .page-title { font-size: 28px; }
  .page-subtitle { font-size: 15px; }
  .patients-stats { grid-template-columns: 1fr; }
  .patients-fields { grid-template-columns: 1fr; }
  .patients-toolbar { flex-direction: column; align-items: stretch; }
}


.patient-locked-field {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  align-items: center;
  padding: .65rem .8rem;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--brand-tint);
}
.patient-locked-field a {
  font-weight: 700;
  font-size: .88rem;
}
.patient-need-select {
  margin: 0;
  padding: .65rem .8rem;
  border-radius: 12px;
  background: #fff4e8;
  color: #9a3412;
  font-size: .9rem;
}

.fees-stack {
  display: grid;
  gap: .85rem;
}
.fees-budget-panel {
  padding: .9rem 1rem 1rem;
}
.fees-budget-panel h2 {
  font-size: 1.05rem;
  margin-bottom: .55rem;
}
.fees-budget-table-wrap {
  max-height: min(22vh, 200px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: .55rem;
}
.fees-budget-table-wrap table { margin: 0; }
.fees-budget-table-wrap th,
.fees-budget-table-wrap td {
  padding: .42rem .55rem;
  font-size: .9rem;
}
.fees-budget-total {
  font-weight: 800;
  margin: .35rem 0 .75rem;
  font-size: 1.05rem;
}
.fees-budget-form {
  grid-template-columns: 1.2fr 1.2fr 1fr;
  gap: .65rem 1rem;
  align-items: end;
}
.fees-budget-form .fees-budget-actions {
  grid-column: 1 / -1;
}
.fees-budget-actions label {
  visibility: hidden;
  display: none;
}
.fees-nomen-panel {
  padding: .9rem 1rem 1rem;
}
.fees-custom {
  margin-bottom: 1rem;
  border: 1px solid #E8ECF3;
  border-radius: 14px;
  background: #FBFBFD;
  overflow: hidden;
}
.fees-custom > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .85rem 1rem;
  font-weight: 700;
  font-size: 14px;
  color: #0F172A;
}
.fees-custom > summary::-webkit-details-marker { display: none; }
.fees-custom > summary span {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #6958F5;
}
html[data-theme="green"] .fees-custom > summary span { color: var(--brand); }
.fees-custom > summary small {
  font-weight: 500;
  font-size: 12px;
  color: #94A3B8;
}
.fees-custom[open] > summary {
  border-bottom: 1px solid #E8ECF3;
  background: #fff;
}
.fees-custom-form { padding: 1rem; }
.fees-custom-grid {
  display: grid;
  grid-template-columns: 110px 1.6fr 1fr 70px 120px;
  gap: .65rem;
  align-items: end;
}
.fees-custom-grid label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #64748B;
  margin-bottom: .25rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.fees-custom-grid input {
  width: 100%;
  margin: 0;
}
.fees-custom-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .85rem;
}
@media (max-width: 900px) {
  .fees-custom-grid {
    grid-template-columns: 1fr 1fr;
  }
  .fees-custom-name { grid-column: 1 / -1; }
}
.fees-nomen-table-wrap {
  max-height: min(48vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.fees-nomen-table-wrap table { margin: 0; }
.fees-nomen-table-wrap thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.fees-nomen-table-wrap th,
.fees-nomen-table-wrap td {
  padding: .42rem .55rem;
  font-size: .9rem;
}
@media (max-width: 820px) {
  .fees-budget-form {
    grid-template-columns: 1fr;
  }
  .fees-budget-actions label { display: none; }
}
.login-help-link {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: .88rem;
}
.login-help-link a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login-help-link a:hover { color: var(--brand); }

.odontogram { display: grid; gap: .75rem; }
.odontogram-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: center;
}
.tooth {
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: .78rem;
  background: var(--card);
  color: var(--ink);
}
.tooth.has-status {
  background: var(--brand-tint);
  border-color: var(--tooth-border);
  color: var(--brand-dark);
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tabs a {
  padding: .5rem .9rem;
  border-radius: 999px;
  background: var(--tabs-bg);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: .9rem;
  transition: background .15s ease, color .15s ease;
}
.tabs a:hover { background: var(--tabs-hover); text-decoration: none; }
.tabs a.active {
  background: linear-gradient(180deg, var(--btn-top), var(--btn-bottom));
  color: #fff;
  box-shadow: 0 8px 18px var(--btn-shadow);
}

/* Desktop: ocultar UI móvil */
.m-only { display: none !important; }
.nav-toggle { display: none !important; }
.nav-backdrop { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }

  /* En celular: menú inferior; sidebar de PC oculto */
  .sidebar,
  .nav-toggle,
  .nav-backdrop,
  .d-desktop { display: none !important; }
  .m-only { display: block !important; }
  .mh-home.m-only,
  .mh-patient.m-only,
  .m-patients.m-only,
  .m-agenda-list.m-only,
  .m-mas-page { display: flex !important; flex-direction: column; }
  .mh-now.m-only,
  a.mh-now { display: block !important; }
  .m-tabbar.m-only { display: grid !important; }
  .mh-patient-quick.m-only,
  .mh-actions.m-only { display: grid !important; }
  .m-agenda-head.m-only { display: flex !important; flex-direction: column; gap: .65rem; }
  .m-cta.m-only { display: flex !important; }
  .m-fab.m-only { display: grid !important; }

  body,
  .main {
    background: #F0F4F7 !important;
  }
  .main {
    padding: .7rem .85rem calc(5.5rem + env(safe-area-inset-bottom, 0px));
    max-width: 100%;
  }
  .app-top { display: none !important; }
  .admin-breadcrumb { display: none; }
  .flash { border-radius: 14px; }

  .page-title { font-size: 1.3rem; }
  .page-subtitle { font-size: .88rem; }

  .tabs,
  .ph-tabs {
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 0 .75rem;
    padding-bottom: .1rem;
  }
  .tabs::-webkit-scrollbar,
  .ph-tabs::-webkit-scrollbar { display: none; }
  .tabs a,
  .ph-tabs a {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: .8rem;
    padding: .42rem .7rem;
  }

  .ph-list li {
    align-items: flex-start;
    flex-direction: column;
    gap: .55rem;
  }
  .ph-pay-list li,
  .ph-work-head,
  .ph-budget-card > .ph-budget-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .ph-hero-kpis { width: 100%; }
  .ph-kpi { flex: 1; min-width: 0; }
  .ph-lab-card-top {
    align-items: flex-start;
    flex-direction: column;
  }
  .ph-lab-actions {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    justify-content: stretch;
  }
  .ph-lab-actions .btn,
  .ph-lab-actions button {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Agenda: priorizar el día */
  .agenda-side { display: none !important; }
  .agenda-layout { grid-template-columns: 1fr !important; }
  .agenda-slot-hint { display: none; }
}

/* Bandera país (el sol/luna van más chicos, arriba) */
a.country-flag-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  border: 1px solid var(--line) !important;
  background: var(--card) !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--brand) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  line-height: 1 !important;
  font-size: 1.25rem !important;
  font-weight: 400 !important;
  transform: none !important;
  filter: none !important;
  text-decoration: none !important;
}
a.country-flag-btn:hover {
  border-color: var(--menu-hover-border) !important;
  box-shadow: var(--shadow) !important;
  background: var(--card) !important;
  filter: none !important;
  transform: none !important;
  text-decoration: none !important;
}
a.country-flag-btn .country-flag-img {
  width: 26px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
}
.manual-page {
  max-width: 1080px;
}
.manual-hero {
  max-width: 38rem;
  margin: 0 0 2.4rem;
  padding: 0 0 2rem;
  border-bottom: 1px solid var(--line);
}
.manual-kicker {
  margin: 0 0 .5rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brand);
}
.manual-hero h1 {
  margin: 0;
  font-size: clamp(1.85rem, 3.2vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.12;
  color: var(--ink);
}
.manual-hero-lead {
  margin: .9rem 0 0;
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--muted);
  font-weight: 400;
}
.manual-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 0;
}
.manual-hero-skip {
  color: var(--brand);
  font-weight: 650;
  font-size: 15px;
  text-decoration: none;
}
.manual-hero-skip:hover { text-decoration: underline; }
.manual-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.manual-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
.manual-toc {
  position: sticky;
  top: 1rem;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.manual-toc-label {
  margin: 0 0 .7rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.manual-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .15rem;
}
.manual-toc ol a {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  gap: .55rem;
  align-items: start;
  padding: .45rem .35rem .45rem 0;
  border-radius: 0;
  color: var(--ink);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: .55rem;
  margin-left: -.55rem;
}
.manual-toc-n {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  padding-top: .12rem;
  font-variant-numeric: tabular-nums;
}
.manual-toc-t {
  min-width: 0;
  display: grid;
  gap: .08rem;
}
.manual-toc-t strong {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--ink);
}
.manual-toc-t em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.manual-toc ol a:hover .manual-toc-t strong,
.manual-toc ol a.is-active .manual-toc-t strong {
  color: var(--brand);
}
.manual-toc ol a.is-active {
  border-left-color: var(--brand);
}
.manual-toc ol a.is-active .manual-toc-n {
  color: var(--brand);
}
.manual-toc-foot {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: .35rem;
}
.manual-toc-foot a,
.manual-toc-foot button {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.manual-toc-foot a:hover,
.manual-toc-foot button:hover {
  color: var(--brand);
}
.manual-sections {
  display: grid;
  gap: 0;
  min-width: 0;
}
.manual-section {
  padding: 0 0 2.6rem !important;
  margin: 0 0 2.6rem;
  scroll-margin-top: 1.2rem;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.manual-section:last-child {
  margin-bottom: 0;
  border-bottom: 0 !important;
}
.manual-section-head {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  margin-bottom: 1.6rem;
  max-width: 40rem;
}
.manual-section-num {
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  color: var(--brand);
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  padding-top: .35rem;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.manual-section-head h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.2;
}
.manual-nav-sub {
  margin: 0 0 .35rem !important;
  font-size: .72rem !important;
  font-weight: 700;
  color: var(--brand) !important;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.manual-lead,
.manual-section-head p.manual-lead {
  margin: .65rem 0 0;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.55;
  font-weight: 400;
}
.manual-group {
  margin: 1.6rem 0 .15rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.manual-group:first-child { margin-top: 0; }

.manual-actions { display: grid; gap: 2rem; }
.manual-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
  gap: 1.75rem;
  align-items: start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.manual-action-copy {
  max-width: 38rem;
}
.manual-action-copy h3 {
  margin: 0 0 .55rem;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.manual-example {
  margin: 0 0 1.05rem;
  padding: 0 0 0 .85rem;
  border-left: 2px solid var(--brand);
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  font-style: italic;
}
.manual-steps {
  margin: 0 0 .9rem;
  padding: 0 0 0 1.15rem;
  display: grid;
  gap: .55rem;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
.manual-steps code,
.manual-example code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  font-style: normal;
  background: var(--bg-soft);
  padding: .05em .32em;
  border-radius: 4px;
}
.manual-go {
  display: inline-block;
  font-size: 14px;
  font-weight: 650;
  color: var(--brand);
  text-decoration: none;
}
.manual-go:hover { text-decoration: underline; }
.manual-action-screen {
  pointer-events: none;
  user-select: none;
}
.manual-action-screen .mscreen {
  box-shadow: none;
  border-color: var(--line);
  transform: none;
  font-size: 11px;
}
.manual-tips {
  margin-top: 1.6rem;
  max-width: 40rem;
  padding: 1rem 0 0;
  border-radius: 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
}
.manual-tips strong {
  display: block;
  margin-bottom: .4rem;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.manual-tips ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  display: grid;
  gap: .35rem;
}
.manual-links {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1.1rem;
  margin-top: 1.15rem;
}
.manual-links a {
  font-size: 14px;
  font-weight: 650;
  color: var(--brand);
  text-decoration: none;
}
.manual-links a:hover { text-decoration: underline; }
.ad-action {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .5rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
  transition: border-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.ad-action:hover {
  border-color: #6958F5;
  color: #6958F5;
  text-decoration: none;
}
html[data-theme="green"] .ad-action:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Mock screens */
.mscreen {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .08);
  font-size: 12px;
  color: var(--ink);
  line-height: 1.35;
}
.mscreen-bar {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem .8rem;
  background: linear-gradient(180deg, #1A2744 0%, #121A2E 100%);
  color: #E8EEF7;
  font-size: 11px;
  font-weight: 650;
}
.mscreen-bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748B;
  display: block;
}
.mscreen-bar i:nth-child(1) { background: #F87171; }
.mscreen-bar i:nth-child(2) { background: #FBBF24; }
.mscreen-bar i:nth-child(3) { background: #34D399; }
.mscreen-bar span { margin-left: .35rem; opacity: .9; }
.mscreen-body { padding: .85rem; background: var(--bg-soft); min-height: 140px; }
.ms-brand { font-weight: 800; letter-spacing: .08em; color: var(--brand); margin-bottom: .55rem; }
.ms-login label, .ms-form label, .ms-card label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #64748B;
  margin: .35rem 0 .15rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.ms-field {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .55rem;
  font-weight: 600;
}
.ms-otp { letter-spacing: .2em; text-align: center; }
.ms-btn {
  margin-top: .55rem;
  background: var(--brand);
  color: #fff;
  border-radius: 9px;
  padding: .45rem .7rem;
  font-weight: 700;
  text-align: center;
  display: inline-block;
}
.ms-btn-sm { font-size: 11px; padding: .35rem .6rem; margin-top: .4rem; }
.ms-btn-ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.ms-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.ms-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .65rem;
}
.ms-card strong { display: block; margin-bottom: .4rem; font-size: 12px; }
.ms-row { display: flex; align-items: center; gap: .4rem; font-weight: 650; }
.ms-pill {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .45rem;
  border-radius: 8px;
  background: var(--bg-soft);
  margin-bottom: .25rem;
  font-weight: 650;
}
.ms-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ms-dot.violet { background: #6958F5; }
.ms-dot.sky { background: #3B82F6; }
.ms-toolbar { display: flex; gap: .4rem; margin-bottom: .5rem; }
.ms-search {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .55rem;
  color: var(--muted);
}
.ms-table { display: grid; gap: 2px; }
.ms-tr {
  display: grid;
  grid-template-columns: 1.4fr 1fr .7fr .9fr;
  gap: .35rem;
  align-items: center;
  background: var(--card);
  border-radius: 8px;
  padding: .4rem .5rem;
}
.ms-tr.ms-th { background: transparent; color: #94A3B8; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.ms-tr.is-hit { outline: 2px solid var(--brand); }
.ms-tr b { display: block; font-size: 12px; }
.ms-tr small { color: #94A3B8; font-size: 10px; }
.ms-bad { color: #DC2626; font-weight: 750; }
.ms-ok { color: #059669; font-weight: 750; }
.ms-link { color: var(--brand); font-weight: 700; font-size: 11px; }
.ms-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.ms-form .ms-actions { justify-content: flex-end; }
.ms-mail { background: var(--brand-tint); border-radius: 12px; padding: .75rem; }
.ms-mail-bubble {
  background: #fff;
  border-radius: 12px 12px 12px 4px;
  padding: .65rem .75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.ms-mail-meta { margin-top: .5rem; color: var(--brand-dark); font-size: 11px; font-weight: 650; }
.ms-textarea {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .65rem;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  min-height: 72px;
}
.ms-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: .55rem;
}
.ms-tabs span {
  padding: .3rem .5rem;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}
.ms-tabs span.is-on { background: var(--brand); color: #fff; border-color: var(--brand); }
.ms-odo .ms-teeth {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin: .4rem 0 .55rem;
}
.ms-teeth i {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  display: block;
}
.ms-teeth i:nth-child(4) { background: #6958F5; border-color: #6958F5; }
.ms-odo-sel { font-size: 12px; font-weight: 600; }
.ms-list { display: grid; gap: .35rem; margin-bottom: .5rem; }
.ms-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .45rem .55rem;
}
.ms-item.row, .ms-item.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.ms-item b { display: block; font-size: 12px; }
.ms-item small { color: #94A3B8; font-size: 10px; }
.ms-item em { float: right; font-style: normal; color: #6958F5; font-weight: 700; }
.ms-item.is-hit { outline: 2px solid #6958F5; }
.ms-inline { display: flex; gap: .35rem; align-items: center; }
.ms-inline .grow { flex: 1; }
.ms-agenda-head {
  display: flex;
  gap: .35rem;
  align-items: center;
  margin-bottom: .45rem;
  font-size: 11px;
  color: #64748B;
}
.ms-agenda-head b { color: #0F172A; margin-right: .25rem; }
.ms-slot {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: .35rem;
  margin-bottom: .3rem;
  align-items: stretch;
}
.ms-slot em { font-style: normal; font-size: 10px; color: #94A3B8; padding-top: .35rem; }
.ms-appt, .ms-free {
  border-radius: 8px;
  padding: .4rem .5rem;
  font-size: 11px;
  font-weight: 650;
}
.ms-free { background: #fff; border: 1px dashed #CBD5E1; color: #94A3B8; }
.ms-appt.conf { background: #DBEAFE; color: #1E40AF; }
.ms-appt.pend { background: #EDE9FE; color: #5B21B6; }
.ms-appt-big {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #DBEAFE;
  color: #1E40AF;
  border-radius: 10px;
  padding: .65rem .7rem;
  font-weight: 650;
}
.ms-appt-big small { display: block; opacity: .85; font-size: 10px; margin-top: 2px; }
.ms-x { font-weight: 800; opacity: .7; }
.ms-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .55rem;
}
.ms-status-row span {
  padding: .28rem .45rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #E2E8F0;
  font-size: 10px;
  font-weight: 700;
  color: #64748B;
}
.ms-status-row span.is-on { background: #6958F5; color: #fff; border-color: #6958F5; }
.ms-fees { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.ms-total { margin: .4rem 0; font-size: 12px; }
.ms-pills { display: flex; gap: .3rem; margin-bottom: .45rem; flex-wrap: wrap; }
.ms-pills span {
  padding: .28rem .5rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #E2E8F0;
  font-size: 10px;
  font-weight: 700;
  color: #64748B;
}
.ms-pills span.is-on { background: #0B1F3A; color: #fff; border-color: #0B1F3A; }
.ms-badge {
  font-size: 10px;
  font-weight: 750;
  padding: .15rem .4rem;
  border-radius: 999px;
}
.ms-badge.sky { background: #E0F2FE; color: #0369A1; }
.ms-badge.violet { background: #EDE9FE; color: #6D28D9; }
.ms-badge.amber { background: #FEF3C7; color: #B45309; }
.ms-badge.red { background: #FEE2E2; color: #B91C1C; }
.ms-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin-bottom: .45rem;
}
.ms-kpis > div {
  background: #fff;
  border-radius: 10px;
  padding: .45rem .55rem;
  border: 1px solid #E8ECF3;
}
.ms-kpis small { display: block; color: #94A3B8; font-size: 10px; }
.ms-kpis b { font-size: 14px; }
.ms-sum {
  background: #F1EFFF;
  color: #4338CA;
  border-radius: 8px;
  padding: .45rem .55rem;
  font-weight: 700;
  margin-bottom: .35rem;
}
.ms-qr { display: grid; grid-template-columns: 1.1fr .9fr; gap: .5rem; align-items: center; }
.ms-qr-code {
  aspect-ratio: 1;
  background:
    repeating-linear-gradient(0deg, #0F172A 0 4px, transparent 4px 8px),
    repeating-linear-gradient(90deg, #0F172A 0 4px, transparent 4px 8px);
  background-color: #fff;
  background-blend-mode: multiply;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  opacity: .85;
}
.ms-hr { border: 0; border-top: 1px solid #E8ECF3; margin: .75rem 0; }
.ms-codes {
  margin-top: .35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: .04em;
  background: #fff;
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
  padding: .45rem;
}
.ms-chat { display: grid; gap: .45rem; }
.ms-chat-user {
  justify-self: end;
  background: #6958F5;
  color: #fff;
  border-radius: 12px 12px 4px 12px;
  padding: .5rem .65rem;
  max-width: 90%;
  font-weight: 600;
}
.ms-chat-bot {
  justify-self: start;
  background: #fff;
  border: 1px solid #E8ECF3;
  border-radius: 12px 12px 12px 4px;
  padding: .5rem .65rem;
  max-width: 95%;
}
.ms-empty { text-align: center; color: #94A3B8; padding: 2rem .5rem; }

@media (max-width: 980px) {
  .manual-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .manual-toc {
    position: static;
  }
  .manual-toc ol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .15rem .75rem;
  }
  .manual-toc-t em { display: none; }
  .manual-toc-foot {
    display: flex;
    gap: 1rem;
  }
  .manual-action { grid-template-columns: 1fr; }
  .manual-action-screen { display: none; }
}
@media print {
  .sidebar, .app-top, .manual-head-actions, .manual-toc, .manual-hero-actions, .flash { display: none !important; }
  .app { grid-template-columns: 1fr !important; }
  .manual-layout { grid-template-columns: 1fr !important; }
  .manual-action { break-inside: avoid; grid-template-columns: 1fr; }
  .manual-action-screen { display: none !important; }
  .manual-section { break-inside: avoid; box-shadow: none !important; }
  .manual-hero { border: 0; padding-bottom: 1rem; }
}

/* Agenda — día / semana / mes */
.agenda-page-head { align-items: flex-start; }
.agenda-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}
.agenda-view-tabs {
  display: inline-flex;
  padding: .2rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.agenda-view-tabs a {
  padding: .45rem .9rem;
  border-radius: 10px;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
}
.agenda-view-tabs a:hover { color: var(--ink); }
.agenda-view-tabs a.is-active {
  background: var(--brand);
  color: #fff;
}
.agenda-new-panel { margin-bottom: 1rem; }
.agenda-new-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.agenda-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.agenda-side {
  padding: 1rem !important;
  background: #fff;
}
.agenda-mini-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  margin-bottom: .65rem;
}
.agenda-mini-nav strong { font-size: 14px; font-weight: 750; }
.agenda-mini-cal { margin-bottom: 1rem; }
.agenda-mini-head,
.agenda-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .2rem;
  text-align: center;
}
.agenda-mini-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: .25rem;
}
.agenda-mini-day {
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
  text-decoration: none !important;
}
.agenda-mini-day.is-empty { visibility: hidden; }
.agenda-mini-day.is-inrange { background: #F1EFFF; color: var(--brand); }
.agenda-mini-day.is-today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.agenda-mini-day.is-selected { background: var(--brand); color: #fff; }
.agenda-filters h3 { margin: 0 0 .55rem; font-size: 13px; font-weight: 750; }
.agenda-filters > label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  margin: .55rem 0 .25rem;
}
.agenda-filters select { width: 100%; }
.agenda-status-checks {
  display: grid;
  gap: .4rem;
  margin: .35rem 0 .85rem;
}
.agenda-check {
  display: grid !important;
  grid-template-columns: 18px 10px minmax(0, 1fr);
  align-items: center;
  column-gap: .55rem;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  cursor: pointer;
  line-height: 1.2;
}
.agenda-check input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: var(--brand);
  flex: none;
  justify-self: start;
}
.agenda-check i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
  justify-self: center;
}
.agenda-check span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agenda-check.is-confirmado i { background: #6958F5; }
.agenda-check.is-pendiente i { background: #F59E0B; }
.agenda-check.is-espera i { background: #0284C7; }
.agenda-check.is-cancelado i { background: #E11D48; }
.agenda-check.is-ausente i { background: #94A3B8; }
.agenda-main { min-width: 0; }
.agenda-main-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .65rem;
}
.agenda-nav-inline { display: inline-flex; align-items: center; gap: .45rem; }
.agenda-nav-inline strong { font-size: 14px; font-weight: 750; }
.agenda-slot-hint { font-size: 12px; color: var(--muted); font-weight: 550; }
.agenda-cal-panel {
  padding: .85rem .9rem 1rem;
  overflow-x: auto;
  overflow-y: visible;
  background: #fff;
}
.agenda-timegrid {
  --slot-h: 24px;
  --cols: 7;
  min-width: 720px;
}
.agenda-timegrid-head,
.agenda-timegrid-body {
  display: grid;
  grid-template-columns: 3.6rem repeat(var(--cols), minmax(0, 1fr));
}
.agenda-timegrid-head {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.agenda-time-gutter { position: relative; }
.agenda-day-head { text-align: center; padding: .55rem .35rem .65rem; }
.agenda-day-head a {
  text-decoration: none !important;
  color: inherit;
  display: inline-flex;
  flex-direction: column;
  gap: .12rem;
}
.agenda-day-name {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .06em;
  color: var(--muted);
}
.agenda-day-num { font-size: 15px; font-weight: 750; color: var(--ink); }
.agenda-day-head.is-today .agenda-day-num {
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}
.agenda-time-label {
  height: var(--slot-h);
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  line-height: 1;
  transform: translateY(-.35rem);
  text-align: right;
  padding-right: .4rem;
}
.agenda-time-label.is-hour { color: #475569; font-weight: 750; }
.agenda-time-label.is-half { color: #94A3B8; font-size: 10px; }
.agenda-time-label.is-quarter { color: #CBD5E1; font-size: 9px; }
.agenda-day-col {
  position: relative;
  border-left: 1px solid var(--line);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--slot-h) - 1px),
    #EEF0F5 calc(var(--slot-h) - 1px),
    #EEF0F5 var(--slot-h)
  );
}
.agenda-slot-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none !important;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}
.agenda-slot-free {
  display: none;
  align-items: center;
  gap: .25rem;
  font-size: 9px;
  font-weight: 650;
  color: var(--brand);
  border: 1px dashed #DDD7FF;
  background: #FBFAFF;
  border-radius: 6px;
  padding: 0 .35rem;
  margin: 1px 4px;
  width: calc(100% - 8px);
  max-height: calc(var(--slot-h) - 4px);
  overflow: hidden;
  justify-content: center;
}
.agenda-slot-bg:hover:not(.is-busy) {
  background: color-mix(in srgb, var(--brand) 6%, transparent);
}
.agenda-slot-bg:hover:not(.is-busy) .agenda-slot-free { display: inline-flex; }
.agenda-slot-bg.is-busy { pointer-events: none; }
.agenda-block {
  position: absolute;
  left: 4px;
  right: 4px;
  z-index: 2;
  border-radius: 10px;
  padding: .35rem .45rem .3rem;
  overflow: hidden;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-height: calc(var(--slot-h) - 6px);
  color: var(--ink);
}
.agenda-block.is-confirmado { background: #F1EFFF; border-color: #DDD7FF; color: #4338CA; }
.agenda-block.is-pendiente { background: #FFF7E8; border-color: #FDE68A; color: #B45309; }
.agenda-block.is-espera { background: #E8F4FF; border-color: #BAE6FD; color: #0369A1; }
.agenda-block.is-completado { background: #F1F5F9; border-color: #E2E8F0; color: #475569; }
.agenda-block.is-cancelado { background: #FEF2F2; border-color: #FECACA; color: #BE123C; }
.agenda-block.is-ausente { background: #F8FAFC; border-color: #E2E8F0; color: #64748B; }
.agenda-block-main { min-width: 0; display: grid; gap: .05rem; padding-right: 1rem; }
.agenda-block-time { font-size: 10px !important; font-weight: 750 !important; }
.agenda-block-main strong {
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}
.agenda-block-main span {
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .85;
}
.agenda-block-status {
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: grid;
  place-items: center;
  opacity: .8;
}
.agenda-block-del {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 4;
  margin: 0;
}
.agenda-block-del button {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  padding: 0 !important;
  border-radius: 7px !important;
  border: 1px solid rgba(22, 36, 78, 0.12) !important;
  background: #fff !important;
  color: #64748B !important;
  display: grid !important;
  place-items: center !important;
  box-shadow: none !important;
  cursor: pointer;
}
.agenda-block-del button:hover {
  background: #FEF2F2 !important;
  border-color: #FECACA !important;
  color: #E11D48 !important;
}
.agenda-block-main {
  padding-right: 1.4rem;
}
.agenda-block-tools {
  display: none;
  gap: .25rem;
  align-items: center;
  margin-top: .15rem;
}
.agenda-block:hover .agenda-block-tools,
.agenda-block:focus-within .agenda-block-tools { display: flex; }
.agenda-block-tools form { margin: 0; }
.agenda-block-tools select {
  font-size: .68rem;
  padding: .15rem .25rem;
  max-width: 110px;
  border-radius: 6px;
  width: auto !important;
}
.agenda-block-tools button {
  padding: .15rem .35rem !important;
  min-height: auto !important;
  font-size: .7rem !important;
}
.agenda-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}
.agenda-legend { display: flex; flex-wrap: wrap; gap: .65rem 1rem; }
.agenda-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.agenda-legend-item i { width: 8px; height: 8px; border-radius: 50%; }
.agenda-legend-item.is-confirmado i { background: #6958F5; }
.agenda-legend-item.is-pendiente i { background: #F59E0B; }
.agenda-legend-item.is-espera i { background: #0284C7; }
.agenda-legend-item.is-cancelado i { background: #E11D48; }
.agenda-legend-item.is-ausente i { background: #94A3B8; }

/* Mes */
.agenda-month-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .35rem;
  margin-bottom: .35rem;
  text-align: center;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.agenda-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .35rem;
}
.agenda-month-cell {
  min-height: 6.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .45rem .5rem;
  background: #fff;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
a.agenda-month-cell:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
  text-decoration: none;
}
.agenda-month-cell.is-empty { background: var(--bg); border-color: transparent; }
.agenda-month-cell.is-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.agenda-month-num { font-size: .9rem; font-weight: 800; color: var(--ink); }
.agenda-month-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .18rem;
}
.agenda-month-items li {
  font-size: .68rem;
  font-weight: 700;
  padding: .18rem .35rem;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.agenda-month-items li.is-pendiente { background: #F59E0B; }
.agenda-month-items li.is-confirmado { background: #6958F5; }
.agenda-month-items li.is-espera { background: #0284C7; }
.agenda-month-items li.is-completado { background: #7b849e; }
.agenda-month-items li.is-cancelado,
.agenda-month-items li.is-ausente { background: #E11D48; }
.agenda-month-more { background: transparent !important; color: var(--muted) !important; }

@media (max-width: 1100px) {
  .agenda-layout { grid-template-columns: 1fr; }
  .agenda-side { position: static; }
}
@media (max-width: 900px) {
  .agenda-month-cell { min-height: 5.2rem; }
}
@media (max-width: 720px) {
  .agenda-top-actions { width: 100%; }
  .agenda-view-tabs { flex: 1 1 auto; justify-content: space-between; }
  .agenda-view-tabs a { flex: 1; text-align: center; }
}

/* —— Presupuestos premium (mockup) —— */
.bq-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin: 0 0 1.1rem;
  max-width: 560px;
}
.bq-tabs-3 {
  grid-template-columns: 1fr 1fr 1fr;
  max-width: 840px;
}
.bq-tab {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-decoration: none !important;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  position: relative;
  transition: border-color var(--ease), background var(--ease);
}
.bq-tab strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}
.bq-tab small {
  display: block;
  margin-top: .1rem;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.bq-tab-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #F1EFFF;
  color: var(--brand);
  flex: 0 0 auto;
}
.bq-tab:not(.is-active) .bq-tab-ico {
  background: #F3F4F6;
  color: #6B7280;
}
.bq-tab.is-active {
  border-color: #DDD7FF;
  background: #FBFAFF;
}
.bq-tab.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}

.bq-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .95fr);
  gap: 1rem;
  align-items: start;
}
.bq-list.panel,
.bq-detail.panel {
  padding: 0;
  overflow: hidden;
}
.bq-toolbar {
  display: flex;
  gap: .65rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.bq-filter-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: .15rem;
}
.bq-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.bq-status-pills.is-emphasis {
  background: #FAFAFF;
}
.bq-pill {
  display: inline-flex !important;
  align-items: center;
  gap: .45rem;
  border: 1px solid #E5E7EB !important;
  background: #fff !important;
  color: #16244E !important;
  border-radius: 999px !important;
  padding: .4rem .45rem .4rem .85rem !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  cursor: pointer;
  box-shadow: none !important;
  transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.bq-pill-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1.5px solid #CBD5E1;
  background: #fff;
  color: #16244E;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.bq-pill[data-status="pendiente"] .bq-pill-count {
  border-color: #F59E0B;
  color: #D97706;
}
.bq-pill[data-status="aprobado"] .bq-pill-count {
  border-color: #10B981;
  color: #059669;
}
.bq-pill[data-status="rechazado"] .bq-pill-count {
  border-color: #F87171;
  color: #E11D48;
}
.bq-pill[data-status="borrador"] .bq-pill-count {
  border-color: #CBD5E1;
  color: #64748B;
}
.bq-pill[data-status="todos"] .bq-pill-count {
  border-color: #DDD7FF;
  color: var(--brand);
}

/* Seleccionado: se pinta de color */
.bq-pill.is-active {
  color: #fff !important;
  border-color: transparent !important;
}
.bq-pill.is-active .bq-pill-count {
  background: #fff;
  border-color: #fff;
}
.bq-pill[data-status="todos"].is-active {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}
.bq-pill[data-status="todos"].is-active .bq-pill-count {
  color: #16244E;
}
.bq-pill[data-status="pendiente"].is-active {
  background: #EA580C !important;
  border-color: #EA580C !important;
}
.bq-pill[data-status="pendiente"].is-active .bq-pill-count {
  color: #C2410C;
}
.bq-pill[data-status="aprobado"].is-active {
  background: #059669 !important;
  border-color: #059669 !important;
}
.bq-pill[data-status="aprobado"].is-active .bq-pill-count {
  color: #047857;
}
.bq-pill[data-status="rechazado"].is-active {
  background: #E11D48 !important;
  border-color: #E11D48 !important;
}
.bq-pill[data-status="rechazado"].is-active .bq-pill-count {
  color: #BE123C;
}
.bq-pill[data-status="borrador"].is-active {
  background: #64748B !important;
  border-color: #64748B !important;
}
.bq-pill[data-status="borrador"].is-active .bq-pill-count {
  color: #475569;
}

.bq-detail-actions .btn.secondary,
.bq-detail-footer .btn.secondary {
  background: #fff;
  color: #16244E;
  border: 1px solid #E5E7EB;
  font-weight: 600;
}
.bq-detail-actions .btn.secondary:hover,
.bq-detail-footer .btn.secondary:hover {
  border-color: #D1D5DB;
  background: #fff;
  color: #16244E;
}

.bq-table-wrap { padding: .25rem 0 .4rem; }
.bq-table-head,
.bq-row {
  display: grid;
  grid-template-columns: 88px minmax(160px, 1.4fr) 100px 110px 110px 100px 44px;
  gap: .65rem;
  align-items: center;
}
.bq-table-head {
  padding: .55rem 1.15rem;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.bq-row {
  margin: 0 .75rem .4rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none !important;
  color: inherit;
  background: #fff;
  position: relative;
  transition: border-color var(--ease), background var(--ease);
}
.bq-row:hover { border-color: #D8DCE8; }
.bq-row.is-selected {
  background: #F8F7FF;
  border-color: #DDD7FF;
}
.bq-row.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
}
.bq-code {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.bq-patient {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.bq-patient .patient-card-avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
}
.bq-patient-text {
  display: grid;
  gap: .1rem;
  min-width: 0;
}
.bq-patient-text strong {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bq-patient-text small {
  font-size: 12px;
  color: var(--muted);
}
.bq-treat {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.bq-amount {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.bq-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .22rem .55rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}
.bq-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.bq-badge.tone-orange { background: #FFF4E8; color: #C2410C; }
.bq-badge.tone-green { background: #ECFDF5; color: #047857; }
.bq-badge.tone-red { background: #FEF2F2; color: #BE123C; }
.bq-badge.tone-gray { background: #F1F5F9; color: #475569; }
.bq-badge.tone-sky { background: #E8F4FF; color: #0284C7; }
.bq-badge.tone-violet { background: #F1EFFF; color: #6958F5; }
.bq-badge.tone-amber { background: #FFFBEB; color: #D97706; }

a.bq-pill {
  text-decoration: none !important;
}
a.bq-pill:hover { filter: brightness(1.02); }
.bq-date {
  display: grid;
  gap: .1rem;
}
.bq-date strong { font-size: 13px; font-weight: 650; }
.bq-date small { font-size: 12px; color: var(--muted); }
.bq-row-actions { display: flex; justify-content: flex-end; }
.bq-row-actions .ui-icon-btn {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  border-radius: 10px !important;
  pointer-events: none;
}
.bq-empty {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
}
.bq-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .85rem 1.15rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.bq-detail { padding: 1.15rem 1.2rem 1.25rem !important; }
.bq-doc-brand {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 0 0 .9rem;
  margin-bottom: .85rem;
  border-bottom: 1px solid var(--line);
}
.bq-doc-logo {
  display: block;
  width: auto;
  max-width: 150px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
}
.bq-doc-brand-copy {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.bq-doc-brand-copy strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: .01em;
}
.bq-doc-brand-copy span {
  font-size: .8rem;
  color: var(--muted);
}
.bq-pro-block {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin: .85rem 0 0;
  padding: .7rem .85rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 8%, var(--panel, #fff));
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
}
.bq-pro-label {
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.bq-pro-block strong {
  font-size: .98rem;
  font-weight: 700;
  color: var(--ink);
}
.bq-sign {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
}
.bq-sign strong {
  display: block;
  margin-top: .35rem;
  color: var(--ink);
}
.bq-detail-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.bq-detail-code {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.bq-detail-code strong {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.bq-detail-meta {
  margin: .35rem 0 0;
  font-size: 13px;
  color: var(--muted);
}
.bq-detail-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.btn-sm {
  padding: .45rem .7rem !important;
  font-size: 13px !important;
  gap: .35rem;
}
.bq-patient-block {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.bq-patient-block strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
}
.bq-patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .85rem;
  margin-top: .3rem;
  font-size: 13px;
  color: var(--muted);
}
.bq-link {
  color: var(--brand);
  font-weight: 650;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.bq-link:hover { text-decoration: underline; }

.bq-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .55rem;
  margin: 1rem 0;
}
.bq-mini {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .7rem .75rem;
  background: #FAFBFF;
}
.bq-mini strong {
  display: block;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.bq-mini span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.bq-lines { margin: .25rem 0 1rem; }
.bq-lines-head,
.bq-line {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 52px 90px 90px 36px;
  gap: .5rem;
  align-items: start;
}
.bq-lines-head {
  padding: .35rem 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.bq-line {
  padding: .7rem 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13px;
}
.bq-line strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
}
.bq-line small {
  display: block;
  margin-top: .15rem;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.bq-line > span {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.bq-line-del {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  margin: 0;
}
.bq-line-del button {
  padding: .2rem .35rem;
}

.cur-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}
.cur-field-label {
  font-size: 13px;
  font-weight: 650;
}
.cur-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #F8FAFC;
}
.cur-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cur-toggle label {
  margin: 0;
  padding: .45rem .7rem;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
}
.cur-toggle input:checked + label {
  background: var(--brand);
  color: #fff;
}
.cur-draft,
.bq-cur-form,
.ph-budget-cur {
  margin: .35rem 0 .75rem;
}
.ph-budget-cur .cur-toggle {
  max-width: 180px;
}
html.night .cur-toggle,
[data-night="1"] .cur-toggle {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
}

.bq-notes {
  margin: 0 0 1rem;
  font-size: 13px;
}
.bq-notes > summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 650;
  list-style: none;
}
.bq-notes > summary::-webkit-details-marker { display: none; }
.bq-notes-form {
  margin-top: .55rem;
  display: grid;
  gap: .5rem;
}
.bq-notes-form textarea {
  width: 100%;
  min-height: 72px;
}

.bq-totals {
  border-top: 1px solid var(--line);
  padding-top: .85rem;
  display: grid;
  gap: .55rem;
}
.bq-tot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  font-size: 14px;
}
.bq-discount-controls {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.bq-discount-controls select {
  width: 58px !important;
  padding: .35rem .4rem !important;
}
.bq-discount-controls input[type="number"] {
  width: 72px !important;
  padding: .35rem .45rem !important;
}
.bq-discount-controls em {
  font-style: normal;
  color: #E11D48;
  font-weight: 650;
  font-size: 13px;
}
.bq-grand {
  margin-top: .25rem;
  padding-top: .65rem;
  border-top: 1px dashed var(--line);
}
.bq-grand span {
  font-weight: 750;
  letter-spacing: .04em;
  font-size: 13px;
}
.bq-grand strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.03em;
}

.bq-detail-footer {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: .55rem;
  margin-top: 1.15rem;
  align-items: center;
}
.bq-approve-form { display: contents; }
.bq-approve-form .btn,
.bq-detail-footer > .btn:last-child {
  width: 100%;
  justify-content: center;
}
.bq-detail-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}
.bq-detail-empty .btn { margin-top: .75rem; }

.only-print { display: none !important; }

@media (max-width: 1100px) {
  .bq-layout { grid-template-columns: 1fr; }
  .bq-table-head { display: none; }
  .bq-row {
    grid-template-columns: 1fr 1fr;
    gap: .55rem .75rem;
  }
  .bq-code { grid-column: 1 / -1; }
  .bq-patient { grid-column: 1 / -1; }
  .bq-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .bq-tabs { grid-template-columns: 1fr; max-width: none; }
  .bq-detail-footer { grid-template-columns: 1fr 1fr; }
  .bq-approve-form .btn { grid-column: 1 / -1; }
  .bq-lines-head,
  .bq-line { grid-template-columns: 1fr auto; }
  .bq-lines-head span:nth-child(n+2),
  .bq-line > span { display: none; }
  .bq-line > span:nth-child(4) { display: block; text-align: left; margin-top: .25rem; }
  .bq-line-del { grid-column: 2; grid-row: 1; }
}

@media print {
  .sidebar, .app-top, .page-head, .bq-tabs, .bq-list, .no-print, .flash {
    display: none !important;
  }
  .main, .content, .bq-layout, .bq-detail {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  .only-print { display: block !important; }
  .bq-detail { padding: 0 !important; }
  .bq-lines-head,
  .bq-line { grid-template-columns: minmax(0, 1.6fr) 52px 90px 90px !important; }
}

/* —— Laboratorios premium (mockup) —— */
.lab-breadcrumb {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 .65rem;
}
.lab-breadcrumb a {
  color: var(--muted);
  font-weight: 550;
}
.lab-breadcrumb a:hover { color: var(--brand); }
.lab-new-head { margin-bottom: 1rem; }
.lab-new-actions {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
}
.lab-new-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr);
  gap: 1rem;
  align-items: start;
}
.lab-new-main { display: grid; gap: 1rem; }
.lab-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 1.15rem 1.25rem 1.25rem;
}
.lab-card-head {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 0 0 1rem;
}
.lab-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.lab-step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 13px;
  font-weight: 750;
}
.lab-patient-row {
  display: flex;
  gap: .9rem;
  align-items: center;
}
.lab-patient-info {
  display: grid;
  gap: .2rem;
  min-width: 0;
}
.lab-patient-info strong {
  font-size: 16px;
  font-weight: 750;
}
.lab-patient-info > span {
  font-size: 13px;
  color: var(--muted);
}
.lab-patient-links {
  display: flex;
  gap: .9rem;
  margin-top: .25rem;
  font-size: 13px;
  font-weight: 650;
}
.lab-patient-empty {
  text-align: center;
  padding: 1rem 0 .25rem;
  color: var(--muted);
}
.lab-patient-empty .btn { margin-top: .65rem; }

.lab-lab-grid {
  display: grid;
  grid-template-columns: minmax(240px, .9fr) minmax(0, 1.2fr);
  gap: 1rem;
}
.lab-lab-search { margin-bottom: .65rem; }
.lab-dir-list {
  display: grid;
  gap: .4rem;
  max-height: 320px;
  overflow: auto;
  padding-right: .15rem;
}
.lab-dir-item {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  padding: .75rem .8rem !important;
  border-radius: 12px !important;
  border: 1px solid #E5E7EB !important;
  background: #fff !important;
  color: #16244E !important;
  box-shadow: none !important;
  cursor: pointer;
  font-weight: 500 !important;
}
.lab-dir-item .lab-dir-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #E5E7EB;
  display: grid;
  place-items: center;
  color: transparent;
  flex: 0 0 auto;
  margin-top: 1px;
}
.lab-dir-item.is-selected {
  background: #F8F7FF !important;
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 1px var(--brand) !important;
}
.lab-dir-item.is-selected .lab-dir-check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.lab-dir-body {
  display: grid;
  gap: .15rem;
  min-width: 0;
}
.lab-dir-body strong {
  font-size: 13px;
  font-weight: 700;
}
.lab-dir-body small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.lab-dir-empty {
  margin: 0;
  padding: .85rem .9rem;
  border: 1px dashed #E5E7EB;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.lab-custom-lab {
  margin-top: .65rem;
  font-size: 13px;
}
.lab-custom-lab > summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 650;
}
.lab-custom-fields {
  display: grid;
  gap: .45rem;
  margin-top: .55rem;
}

.lab-fields { display: grid; gap: .75rem; }
.lab-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.lab-shade-field {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.lab-shade-field select { flex: 1; }
.lab-shade-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #D1D5DB;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
  flex: 0 0 auto;
}
.lab-shade-swatch.sm {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: .25rem;
}

.lab-dropzone {
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding: 1.25rem 1rem;
  border: 1.5px dashed #D1D5DB;
  border-radius: 14px;
  background: #FAFBFF;
  color: var(--muted);
  text-align: center;
}
.lab-dropzone.is-drag {
  border-color: var(--brand);
  background: var(--brand-tint);
}
.lab-dropzone strong {
  color: var(--ink);
  font-size: 14px;
}
.lab-dropzone span { font-size: 12px; }
.lab-dropzone svg { color: var(--brand); }
.lab-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .55rem;
}
.lab-file-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
}
.lab-file-chip img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
}
.lab-file-hint {
  margin: .45rem 0 0;
  font-size: 12px;
  color: var(--muted);
}

.lab-summary {
  padding: 1.15rem 1.2rem 1.25rem !important;
  position: sticky;
  top: 1rem;
}
.lab-summary h2 {
  margin: 0 0 1rem;
  font-size: 16px;
  font-weight: 750;
}
.lab-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .85rem;
}
.lab-summary-list li {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
}
.lab-sum-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-tint);
  color: var(--brand);
  flex: 0 0 auto;
}
.lab-summary-list small {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: .03em;
  text-transform: uppercase;
  margin-bottom: .15rem;
}
.lab-summary-list strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.lab-tag {
  display: inline-block;
  margin-top: .25rem;
  padding: .12rem .45rem;
  border-radius: 999px;
  background: #ECFDF5;
  color: #047857;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
}
.lab-summary-notes,
.lab-summary-files {
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}
.lab-summary-notes small,
.lab-summary-files small {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .35rem;
}
.lab-summary-notes p {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
}
.lab-summary-thumbs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.lab-summary-thumbs img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.lab-summary-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.lab-board { margin-top: .25rem; }
.lab-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto;
  gap: .85rem;
  align-items: center;
  margin: 0 .85rem .45rem;
  padding: .95rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.lab-order-main {
  display: grid;
  gap: .15rem;
  min-width: 0;
}
.lab-order-main strong { font-size: 14px; font-weight: 750; }
.lab-order-main span { font-size: 13px; color: var(--ink); }
.lab-order-main small { font-size: 12px; color: var(--muted); }
.lab-order-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 1100px) {
  .lab-new-layout { grid-template-columns: 1fr; }
  .lab-summary { position: static; }
  .lab-lab-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .lab-field-row { grid-template-columns: 1fr; }
  .lab-order-row { grid-template-columns: 1fr; }
  .lab-new-actions { width: 100%; }
  .lab-new-actions .btn { flex: 1; }
}

/* —— Gestión de cobros premium (mockup) —— */
.cob-stats { margin-bottom: 1rem; }
.cob-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .9fr);
  gap: 1rem;
  align-items: start;
}
.cob-board { overflow: hidden; }
.cob-toolbar {
  flex-wrap: wrap;
}
.cob-select,
.cob-dates input[type="date"] {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 .75rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
}
.cob-dates {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--muted);
  font-size: 13px;
}
.cob-tabs {
  display: flex;
  gap: 1.25rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--line);
}
.cob-tab {
  position: relative;
  padding: .9rem 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none !important;
}
.cob-tab.is-active { color: var(--brand); }
.cob-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}

.cob-table-head,
.cob-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(120px, 1.1fr) 78px 88px 88px 88px 90px 100px 90px;
  gap: .55rem;
  align-items: center;
}
.cob-table-head {
  padding: .55rem 1.15rem;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.cob-row,
.cob-pay-row {
  margin: 0 .85rem .45rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-decoration: none !important;
  color: inherit;
  position: relative;
  transition: border-color var(--ease), background var(--ease);
}
.cob-row:hover,
.cob-pay-row:hover { border-color: #D8DCE8; }
.cob-row.is-selected {
  background: #F8F7FF;
  border-color: #DDD7FF;
}
.cob-row.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
}
.cob-patient {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.cob-patient .patient-card-avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
}
.cob-patient strong,
.cob-concept strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cob-patient small,
.cob-concept small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.cob-date,
.cob-due {
  font-size: 13px;
  font-weight: 550;
}
.cob-due.is-overdue,
.cob-due-label.is-overdue,
.cob-amount.is-debt,
.cob-dl dd.is-debt {
  color: #E11D48;
  font-weight: 700;
}
.cob-amount {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cob-amount.is-ok,
.cob-dl dd.is-ok { color: #059669; }
.cob-row-actions {
  display: flex;
  justify-content: flex-end;
}
.cob-collect-btn {
  pointer-events: none;
  color: var(--brand) !important;
  border-color: #DDD7FF !important;
  background: #F8F7FF !important;
}

.cob-pay-list { padding: .35rem 0; }
.cob-pay-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) minmax(120px, 1fr) 90px 110px 70px;
  gap: .65rem;
  align-items: center;
}

.cob-detail {
  padding: 1.15rem 1.2rem 1.25rem !important;
  position: sticky;
  top: 1rem;
}
.cob-detail-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: .75rem;
}
.cob-detail-status {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  margin-bottom: 1rem;
}
.cob-due-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 550;
}
.cob-detail-box {
  border-top: 1px solid var(--line);
  padding-top: .9rem;
  margin-top: .9rem;
}
.cob-detail-box h3 {
  margin: 0 0 .7rem;
  font-size: 14px;
  font-weight: 750;
}
.cob-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .75rem;
  margin: 0;
}
.cob-dl .is-full { grid-column: 1 / -1; }
.cob-dl dt {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .15rem;
}
.cob-dl dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.cob-empty-pays {
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding: 1.1rem .5rem;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.cob-empty-pays svg { color: var(--brand); opacity: .7; }
.cob-empty-pays p { margin: 0; }
.cob-pay-mini {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .45rem;
}
.cob-pay-mini li {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: flex-start;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FAFBFF;
}
.cob-pay-mini strong { display: block; font-size: 14px; }
.cob-pay-mini small { display: block; font-size: 12px; color: var(--muted); margin-top: .1rem; }
.cob-pay-form {
  display: grid;
  gap: .65rem;
}
.cob-pay-form label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: .25rem;
}
.cob-submit {
  width: 100%;
  margin-top: .25rem;
}
.cob-detail-empty {
  display: grid;
  justify-items: center;
  gap: .65rem;
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}
.cob-detail-empty svg { color: var(--brand); opacity: .65; }
.cob-detail-empty p { margin: 0; font-size: 14px; max-width: 220px; }

@media (max-width: 1200px) {
  .cob-layout { grid-template-columns: 1fr; }
  .cob-detail { position: static; }
  .cob-table-head { display: none; }
  .cob-row {
    grid-template-columns: 1fr 1fr;
    gap: .45rem .75rem;
  }
  .cob-patient,
  .cob-concept { grid-column: 1 / -1; }
  .cob-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .cob-toolbar .cob-dates { width: 100%; }
  .cob-tabs { gap: .75rem; overflow-x: auto; }
  .cob-pay-row { grid-template-columns: 1fr 1fr; }
}




/* —— Panel de control (admin / planes) —— */
.ctl-tabs { max-width: 720px; grid-template-columns: repeat(3, 1fr); }
.ctl-stats { margin-bottom: 1rem; }
.ctl-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .95fr);
  gap: 1rem;
  align-items: start;
}
.ctl-board { overflow: hidden; }
.ctl-client-head,
.ctl-client-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) 110px minmax(120px, 1fr) 100px 100px;
  gap: .65rem;
  align-items: center;
}
.ctl-client-head {
  padding: .55rem 1.15rem;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.ctl-client-row {
  margin: 0 .85rem .45rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-decoration: none !important;
  color: inherit;
  position: relative;
}
.ctl-client-row:hover { border-color: #D8DCE8; }
.ctl-client-row.is-selected {
  background: #F8F7FF;
  border-color: #DDD7FF;
}
.ctl-client-row.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
}
.ctl-plan-pill {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.ctl-plan-pill.tone-green { background: #ECFDF5; color: #047857; }
.ctl-plan-pill.tone-sky { background: #E8F4FF; color: #0369A1; }
.ctl-plan-pill.tone-violet { background: #F1EFFF; color: #5A49EA; }
.ctl-plan-pill.tone-ink { background: #F1F5F9; color: #0F172A; }
.ctl-addon-count {
  display: block;
  margin-top: .2rem;
  font-size: 11px;
  color: var(--muted);
}
.ctl-usage strong { display: block; font-size: 13px; }
.ctl-usage small { font-size: 12px; color: var(--muted); }

.ctl-detail { padding: 1.15rem 1.2rem !important; position: sticky; top: 1rem; }
.ctl-detail-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.ctl-detail-head h2 { margin: 0; font-size: 18px; font-weight: 750; }
.ctl-detail-head p { margin: .25rem 0 0; font-size: 13px; color: var(--muted); }
.ctl-meters { display: grid; gap: .65rem; margin-bottom: 1rem; }
.ctl-meter-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: .25rem;
}
.ctl-meter-top span { color: var(--muted); font-weight: 650; }
.ctl-meter-bar {
  height: 8px;
  border-radius: 999px;
  background: #F1F5F9;
  overflow: hidden;
}
.ctl-meter-bar i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}
.ctl-usage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  margin-bottom: 1.1rem;
}
.ctl-usage-grid > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .65rem .7rem;
  background: #FAFBFF;
}
.ctl-usage-grid small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: .15rem;
}
.ctl-usage-grid strong { font-size: 15px; }
.ctl-usage-grid .is-brand { color: var(--brand); }

.ctl-delete-client {
  display: grid;
  gap: .45rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.ctl-delete-client h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
  color: #b42318;
}
.ctl-btn-danger {
  color: #b42318;
  border-color: #f0b4ae;
}
.ctl-btn-danger:hover {
  background: #fff4f3;
  border-color: #b42318;
}
.ctl-plan-form { display: grid; gap: .55rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.ctl-plan-form label {
  margin: .25rem 0 0;
  font-size: 12px;
}
.ctl-addons-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem .8rem;
  margin: .35rem 0;
}
.ctl-addons-fieldset legend {
  padding: 0 .35rem;
  font-size: 12px;
  font-weight: 750;
}
.ctl-hint {
  margin: 0 0 .55rem;
  font-size: 12px;
  color: var(--muted);
}
.ctl-comp-period {
  display: grid;
  gap: .45rem;
  padding: .7rem .8rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f8f6ff;
}
.ctl-comp-period[hidden] { display: none; }
.ctl-date-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}
.ctl-comp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.ctl-comp-presets .btn { font-size: 12px; }
.ctl-addon-row {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: .55rem;
  align-items: start;
  margin: 0 0 .55rem !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer;
}
.ctl-addon-row input {
  width: 16px !important;
  height: 16px !important;
  margin-top: 2px !important;
  accent-color: var(--brand);
}
.ctl-addon-row strong { display: block; font-size: 13px; }
.ctl-addon-row small { display: block; color: var(--muted); font-size: 11px; margin-top: .1rem; }
.ctl-addon-row em {
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.ctl-matrix-panel,
.ctl-addons-panel { padding: 1.2rem 1.25rem !important; }
.ctl-matrix-intro h2 { margin: 0 0 .35rem; font-size: 20px; }
.ctl-matrix-intro p { margin: 0 0 1.1rem; color: var(--muted); font-size: 14px; max-width: 720px; }
.ctl-plan-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.ctl-plan-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
}
.ctl-plan-card header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .35rem;
}
.ctl-plan-card header strong { font-size: 16px; }
.ctl-plan-tag {
  margin: 0 0 .45rem;
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}
.ctl-plan-price-block { margin: 0 0 .65rem; }
.ctl-plan-price {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
}
.ctl-plan-price-iva {
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
}
.ctl-plan-pay {
  margin: .2rem 0 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ink);
}
.ctl-plan-pay-alt {
  margin: .12rem 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.ctl-plan-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 13px;
}
.ctl-matrix-wrap { overflow: auto; }
.ctl-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ctl-matrix th,
.ctl-matrix td {
  padding: .78rem .7rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}
.ctl-matrix tbody tr:last-child td { border-bottom: 0; }
.ctl-matrix th:first-child,
.ctl-matrix td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--ink);
  position: sticky;
  left: 0;
  background: var(--card);
  padding-left: .15rem;
  min-width: 180px;
  z-index: 1;
}
.ctl-matrix thead th {
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  padding-bottom: .95rem;
}
.ctl-matrix thead th:first-child { background: var(--card); }
.ctl-matrix th.is-current-col,
.ctl-matrix td.is-current-col {
  background: var(--brand-tint);
}
.ctl-matrix td.is-current-col:first-child { background: var(--card); }
.plan-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.plan-check {
  color: var(--brand-soft);
  display: block;
}
.plan-check.is-soon { color: #C5CDD6; }
html[data-theme="green"] .plan-check.is-soon { color: #B7C9C4; }
.plan-cell-val {
  display: inline-block;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}
.ctl-addon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .75rem;
}
.ctl-addon-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  background: #fff;
}
.ctl-addon-card header {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .45rem;
}
.ctl-addon-card header strong { font-size: 15px; }
.ctl-addon-card header span {
  font-size: 13px;
  font-weight: 750;
  color: var(--brand);
  white-space: nowrap;
}
.ctl-addon-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 1100px) {
  .ctl-layout { grid-template-columns: 1fr; }
  .ctl-detail { position: static; }
  .ctl-plan-cards { grid-template-columns: 1fr 1fr; }
  .ctl-tabs { grid-template-columns: 1fr; max-width: none; }
  .ctl-client-head { display: none; }
  .ctl-client-row {
    grid-template-columns: 1fr 1fr;
    gap: .45rem .75rem;
  }
}
@media (max-width: 640px) {
  .ctl-plan-cards { grid-template-columns: 1fr; }
}

/* —— Mi Consultorio (mismo lenguaje visual que Pacientes) —— */
.mc-page { display: flex; flex-direction: column; gap: 1rem; }
.mc-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}
.mc-search-board { margin: 0; }
.mc-board-label {
  padding: .85rem 1.15rem 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.mc-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.mc-board-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.mc-board-link {
  font-size: 13px;
  font-weight: 650;
  color: var(--brand);
  text-decoration: none;
}
.mc-board-link:hover { text-decoration: underline; }
.mc-next-board .patient-card.is-selected {
  background: color-mix(in srgb, var(--brand-tint) 55%, #fff);
}
.mc-row-card {
  grid-template-columns: auto minmax(0, 1.6fr) auto auto !important;
  align-items: center;
}
.mc-workbench .mc-row-card {
  grid-template-columns: 4rem minmax(0, 1fr) auto auto !important;
}
.mc-task-card,
.mc-workbench .mc-task-card {
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center;
}
.mc-task-card .patient-card-id {
  min-width: 0;
}
.mc-task-card .patient-card-id strong,
.mc-task-card .patient-card-id span {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: break-word;
}
.mc-search-board .mc-row-card {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto !important;
}
.mc-time-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .05rem;
  min-width: 3.25rem;
}
.mc-time-col strong {
  font-size: 1.05rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
}
.mc-time-col span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.mc-status-col { justify-self: start; }
.mc-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .9fr);
  gap: 1rem;
  align-items: start;
}
.mc-activity-board { margin: 0; }
.mc-activity-row {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1.1fr) minmax(0, 1fr);
  gap: .75rem;
  align-items: center;
  padding: .7rem 1.25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  font-size: 13.5px;
}
.mc-activity-row:last-child { border-bottom: 0; }
.mc-activity-row:hover { background: var(--brand-tint); }
.mc-activity-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
}
.mc-activity-text {
  font-weight: 650;
  color: var(--ink);
  white-space: normal;
  overflow: visible;
}
.mc-activity-person {
  color: var(--muted);
  white-space: normal;
  overflow: visible;
  text-align: right;
}
.mc-activity-row.is-unread .mc-activity-text,
.mc-activity-row.is-unread .mc-activity-person { font-weight: 800; color: var(--ink); }
.mc-mail-board .mc-activity-time { font-size: 11px; }

@media (max-width: 1100px) {
  .mc-workbench { grid-template-columns: 1fr; }
  .mc-row-card,
  .mc-workbench .mc-row-card,
  .mc-search-board .mc-row-card {
    grid-template-columns: 1fr !important;
    gap: .55rem !important;
  }
  .mc-activity-row {
    grid-template-columns: 3rem 1fr;
  }
  .mc-activity-person {
    grid-column: 2;
    text-align: left;
  }
}

/* —— Administración (centro de configuración · layout tipo mock) —— */
.rep-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.rep-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
}
.rep-period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.rep-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.1rem;
  padding: .3rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: .84rem;
  font-weight: 700;
  text-decoration: none;
}
.rep-pill.is-on {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
}
.rep-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .5rem;
}
.rep-custom label {
  display: grid;
  gap: .2rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
}
.rep-custom input[type="date"] {
  min-height: 2.2rem;
  padding: .3rem .55rem;
}
.rep-kpis {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.rep-slash {
  font-size: .62em;
  font-weight: 650;
  color: var(--muted);
}
.rep-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.rep-table {
  width: 100%;
  border-collapse: collapse;
}
.rep-table th,
.rep-table td {
  text-align: left;
  padding: .45rem .35rem;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.rep-table tfoot th {
  border-bottom: 0;
  padding-top: .65rem;
}
.rep-bar-cell { width: 28%; }
.rep-bar {
  display: block;
  height: 7px;
  border-radius: 99px;
  background: var(--bg-soft);
  overflow: hidden;
}
.rep-bar i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
}
.rep-status {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .45rem;
}
.rep-status li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .6rem;
  align-items: center;
  padding: .35rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.rep-treat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .7rem;
}
.rep-treat li div {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .28rem;
  font-size: .9rem;
}
@media (max-width: 900px) {
  .rep-grid { grid-template-columns: 1fr; }
}
@media print {
  .rep-filters, .rep-head-actions, .nav-toggle, .sidebar, .app-top { display: none !important; }
}
.ad-page {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.ad-page-head {
  align-items: flex-end;
  margin-bottom: .15rem;
}
.ad-head-search {
  width: min(340px, 100%);
  flex: 0 0 auto;
  padding: .7rem 1rem;
  border-radius: 999px;
}
.ad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  align-items: start;
}
.ad-panel {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card) 92%, #fff) 0%, var(--card) 42%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ad-panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
}
.ad-panel.is-wide {
  grid-column: 1 / -1;
}
.ad-panel-head {
  display: flex;
  align-items: flex-start;
  gap: .95rem;
  padding: 1.25rem 1.3rem 1.1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--brand-tint) 42%, transparent);
}
.ad-panel-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--brand);
  box-shadow: 0 8px 18px var(--btn-shadow);
}
.ad-panel-head h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.ad-panel-head p {
  margin: .3rem 0 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}
.ad-panel-links {
  display: flex;
  flex-direction: column;
  padding: .45rem .45rem .55rem;
}
a.ad-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .8rem .85rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 0;
  border-radius: 14px;
  transition: background .15s ease, transform .15s ease;
}
a.ad-link:last-child { border-bottom: 0; }
a.ad-link:hover {
  background: color-mix(in srgb, var(--brand-tint) 70%, var(--card));
  text-decoration: none;
}
a.ad-link:hover .ad-link-chevron { color: var(--brand); transform: translateX(3px); }
.ad-link-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-tint);
}
.ad-link-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .14rem;
}
.ad-link-copy strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.ad-link-copy span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.ad-link-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform .18s ease, color .18s ease;
}
.ad-empty-search {
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.ad-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.3rem;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--brand) 26%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-tint) 88%, var(--card)) 0%, var(--brand-tint) 100%);
}
.ad-help-copy {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}
.ad-help-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--brand-dark);
}
.ad-help-copy p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.ad-help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.ad-support {
  padding: 1.15rem 1.3rem 1.25rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.ad-support-head {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  margin-bottom: .95rem;
}
.ad-support-head h2 {
  margin: 0 0 .15rem;
  font-size: 1.05rem;
}
.ad-support-head p {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.ad-support-grid {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: .75rem 1rem;
}
.ad-support-grid label {
  margin: 0;
}
.ad-support-grid label > span {
  display: block;
  margin-bottom: .3rem;
}
.ad-support-meta {
  margin: .7rem 0 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.ad-support-actions {
  margin-top: .9rem;
}
@media (max-width: 720px) {
  .ad-support-grid { grid-template-columns: 1fr; }
}
.btn.btn-whatsapp,
a.btn.btn-whatsapp {
  background: #25D366 !important;
  background-image: none !important;
  border-color: #1EBE57 !important;
  color: #fff !important;
  box-shadow: none !important;
}
.btn.btn-whatsapp:hover,
a.btn.btn-whatsapp:hover {
  background: #1EBE57 !important;
  color: #fff !important;
}
.btn.btn-whatsapp svg {
  fill: currentColor;
}
.ad-empty { margin: 0; color: var(--muted); }

@media (max-width: 960px) {
  .ad-grid { grid-template-columns: 1fr; }
  .ad-page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .ad-head-search { width: 100%; }
  .ad-help { align-items: flex-start; }
}

/* —— Ficha del paciente (hub) —— */
.ph-page { display: flex; flex-direction: column; gap: .75rem; }
.page-patient .ph-page {
  max-width: 1360px;
  width: 100%;
}
.ph-hero {
  margin: 0;
  padding: 1rem 1.15rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.ph-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}
.ph-hero-main {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  min-width: 0;
  flex: 1;
}
.ph-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
  flex: 0 0 auto;
  color: #fff;
}
.ph-avatar.tone-violet { background: #6958F5; }
.ph-avatar.tone-indigo { background: #4F46E5; }
.ph-avatar.tone-teal { background: #0D9488; }
.ph-avatar.tone-rose { background: #E11D48; }
.ph-avatar.tone-amber { background: #D97706; }
.ph-avatar.tone-sky { background: #0284C7; }
.ph-hero-copy { min-width: 0; }
.ph-hero-copy h1 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.ph-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .55rem;
  margin-top: .4rem;
  font-size: 13.5px;
  color: var(--muted);
}
.ph-meta-item {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: inherit;
  text-decoration: none;
}
.ph-meta-item svg { flex: 0 0 auto; opacity: .8; }
.ph-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .55;
}
.ph-hero-pro {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .55rem;
  font-size: 13.5px;
  color: var(--ink);
}
.ph-pro-label { color: var(--muted); font-weight: 600; }
.ph-hero-kpis {
  display: flex;
  gap: .65rem;
  flex: 0 0 auto;
}
.ph-kpi {
  min-width: 168px;
  padding: .7rem .85rem .75rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
a.ph-kpi:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.ph-kpi-label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.ph-kpi strong {
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.ph-kpi.is-warn { background: #FFF4E8; border-color: #FDBA74; }
.ph-kpi.is-ok { background: #ECFDF5; border-color: #6EE7B7; }
.ph-kpi.is-next { background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.ph-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .65rem;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-size: 12.5px;
  font-weight: 700;
}
.ph-chip.is-warn { background: #FFF4E8; color: #C2410C; }
.ph-chip.is-ok { background: #ECFDF5; color: #047857; }
.ph-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  justify-content: flex-end;
}
.ph-tabs { margin-bottom: 0; }
.ph-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}
.ph-summary-card {
  margin: 0;
  padding: .85rem .95rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-height: 96px;
}
a.ph-summary-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.ph-summary-card:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}
.ph-summary-label {
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ph-summary-card strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.ph-summary-card strong.is-warn { color: #C2410C; }
.ph-summary-card span {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}
.ph-alerts { margin: 0; }
.ph-alerts h2 {
  margin: 0 0 .55rem;
  font-size: 1rem;
}
.ph-alerts ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink);
  font-size: 14px;
}
.ph-alerts li { margin: .25rem 0; }
.ph-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.ph-section-head h2 {
  margin: 0;
  font-size: 1.1rem;
}
.ph-muted { color: var(--muted); font-size: 14px; margin: 0; }
.ph-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ph-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--line);
}
.ph-list li:last-child { border-bottom: 0; }
.ph-list li > div {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.ph-list li strong {
  font-size: 14px;
  color: var(--ink);
}
.ph-list li span {
  font-size: 12.5px;
  color: var(--muted);
}
.ph-tx-list li.ph-tx-line > div:first-child {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem .75rem;
  flex: 1;
  min-width: 0;
}
.ph-tx-list li.ph-tx-line > div:first-child strong {
  white-space: nowrap;
}
.ph-tx-list li.ph-tx-line > div:first-child span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ph-lab-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: .4rem;
  flex: 0 0 auto;
}
.ph-lab-actions .inline-form { margin: 0; }
.ph-lab-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.ph-lab-card {
  padding: .7rem .85rem .8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 4%, transparent);
}
.ph-lab-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem .85rem;
  flex-wrap: wrap;
}
.ph-lab-card-id {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .3rem .55rem;
  min-width: 0;
  flex: 1;
}
.ph-lab-card-id strong {
  font-size: 14px;
  color: var(--ink);
}
.ph-cuenta-totals {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .85rem;
  font-size: 12.5px;
  color: var(--muted);
}
.ph-cuenta-totals .is-debt { color: #C2410C; }
.ph-cuenta-totals .is-ok { color: #047857; }
.ph-lab-card-ops {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem .7rem;
  margin-top: .55rem;
  padding-top: .5rem;
  border-top: 1px dashed var(--line);
}
.ph-lab-cost-form,
.ph-lab-pay-form {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}
.ph-lab-cost-form label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 650;
  margin: 0;
}
.ph-lab-cost-form input,
.ph-lab-pay-form input[type="number"],
.ph-lab-pay-form select {
  width: 7rem;
  height: 34px;
  padding: .3rem .55rem;
  font-size: 13px;
  box-sizing: border-box;
  margin: 0;
}
.ph-lab-pay-form select { width: 9.5rem; }
.ph-lab-cost-form .btn,
.ph-lab-pay-form .btn {
  height: 34px;
  padding: .3rem .75rem !important;
  font-size: 13px !important;
  white-space: nowrap;
  box-sizing: border-box;
}
.ph-lab-pays {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
}
.ph-lab-pays li {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: 12.5px;
}
.ph-lab-pay-del {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
}
.ph-inline-select select {
  font-size: 12.5px;
  padding: .35rem .5rem;
}
.ph-budget-row {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
}
.ph-budget-card {
  padding: .35rem 0 .9rem;
  border-bottom: 1px solid var(--line);
}
.ph-budget-card:last-child { border-bottom: 0; }
.ph-budget-card > .ph-budget-row {
  padding-top: .55rem;
  border-bottom: 0;
}
.ph-work-accounts h2 {
  margin: 0 0 .75rem;
  font-size: 1.05rem;
}
.ph-work-block {
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.ph-work-block:last-child { border-bottom: 0; }
.ph-work-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .35rem;
}
.ph-work-head > div {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.ph-work-items {
  list-style: none;
  margin: 0 0 .45rem;
  padding: .35rem 0 0;
}
.ph-work-items li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  font-size: 13px;
  color: var(--ink);
  padding: .18rem 0;
}
.ph-work-items li span { color: var(--muted); flex: 1; min-width: 0; }
.ph-pay-title {
  margin: .45rem 0 .2rem;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ph-quick-charge h3 {
  margin: 0 0 .25rem;
  font-size: 1.05rem;
}
.ph-quick-charge > .ph-muted {
  margin: 0 0 .85rem;
}
.ph-quick-charge-opts {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1.1rem;
}
.ph-quick-charge-opts label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-weight: 500;
}
.ph-pay-list {
  list-style: none;
  margin: 0 0 .45rem;
  padding: 0;
}
.ph-pay-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  padding: .4rem 0;
}
.ph-pay-list li > div {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.ph-pay-list li strong { font-size: 14px; }
.ph-pay-list li span { font-size: 12.5px; color: var(--muted); }
.ph-pay-empty { margin: .25rem 0 .4rem; }
.ph-budget-row:last-child { border-bottom: 0; }
.ph-budget-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 0 0 auto;
}
.ph-budget-actions .inline-form { margin: 0; }
.ph-sent-flag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .6rem;
  border-radius: 999px;
  background: #ECFDF5;
  color: #047857;
  font-size: 12.5px;
  font-weight: 700;
}
.fees-from-patient {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0;
  padding: .85rem 1rem;
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: color-mix(in srgb, var(--brand) 8%, var(--panel, #fff));
}
.fee-osde-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding: .9rem 1.05rem;
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
}
.fee-osde-banner strong { display: block; }
.fee-osde-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .35rem 0 .2rem;
}
.fee-osde-actions form { margin: 0; }
.fee-osde-import {
  margin: 0 0 1.15rem;
  padding: .9rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
}
.fee-osde-import strong { display: block; margin-bottom: .25rem; }
.fee-osde-import-row {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1rem;
  align-items: flex-end;
  margin-top: .55rem;
}
.fee-osde-import-row label {
  display: grid;
  gap: .3rem;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.fee-osde-import-row input[type="text"],
.fee-osde-import-row input:not([type="file"]) {
  min-width: 120px;
}
.fee-osde-import-row input[type="file"] {
  max-width: 280px;
}
.fees-from-patient strong { display: block; }
.fees-from-patient .ph-muted { color: var(--muted); font-size: .88rem; }
.ph-file-quota {
  margin: 0 0 .65rem;
  padding: .85rem 1rem;
}
.ph-file-quota-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  font-size: .82rem;
}
.ph-file-quota-top span { color: var(--muted); font-weight: 650; }
.ph-file-quota-bar {
  height: 8px;
  margin: .45rem 0 .4rem;
  border-radius: 999px;
  background: #F1F5F9;
  overflow: hidden;
}
.ph-file-quota-bar i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}
.ph-file-quota.is-warn .ph-file-quota-bar i { background: #C2410C; }
.ph-file-quota .ph-muted { margin: 0; font-size: .8rem; }
.ph-files {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}
.ph-file-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-height: 100%;
}
.ph-file-card h3 {
  margin: 0 0 .2rem;
  font-size: 1rem;
}
.ph-file-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}
.ph-file-card-head .ph-muted { margin: 0; }
.ph-file-count {
  flex: 0 0 auto;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  font-size: .75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ph-file-empty { margin: 0; }
.ph-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
}
.ph-file-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel, #fff) 92%, var(--bg, #f6f7fb));
}
.ph-file-icon {
  flex: 0 0 auto;
  color: var(--muted);
  display: inline-flex;
}
.ph-file-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.ph-file-name {
  color: var(--ink);
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ph-file-name:hover { color: var(--brand); }
.ph-file-sub {
  color: var(--muted);
  font-size: .75rem;
}
.ph-file-actions {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 0 0 auto;
}
.ph-file-actions form { margin: 0; }
.ph-file-actions .btn-sm {
  padding: .28rem .4rem;
  min-width: 0;
}
.ph-file-del { color: #b42318; }
.ph-file-upload {
  margin-top: auto;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.ph-file-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  font-size: .78rem;
  color: var(--muted);
}
.ph-file-pick input[type="file"] {
  width: 100%;
  font-size: .8rem;
}

@media (max-width: 1100px) {
  .ph-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ph-files { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .ph-summary,
  .ph-files { grid-template-columns: 1fr; }
  .ph-hero-actions { width: 100%; }
  .ph-hero-actions .btn,
  .ph-hero-actions button { flex: 1; justify-content: center; }
}

/* —— Breadcrumb Administración —— */
.admin-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 .65rem;
  padding: 0 .15rem;
  font-size: 13px;
  color: var(--muted);
}
.admin-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.admin-breadcrumb a:hover { color: var(--brand); }
.admin-breadcrumb-sep { opacity: .55; }
.admin-breadcrumb > span:last-child {
  color: var(--ink);
  font-weight: 600;
}

/* —— App móvil (mockup): solo < 900px —— */
.m-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .06);
}
.m-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  min-height: 52px;
  padding: .25rem .2rem;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 650;
}
.m-tab-ico {
  display: inline-flex;
  color: inherit;
}
.m-tab.is-active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}
.m-tab:hover { text-decoration: none; color: var(--brand); }

.mh-home {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.mh-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mh-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.mh-brand img,
.mh-brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}
.mh-brand strong {
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: #0F2744;
  line-height: 1;
}
.mh-bell { color: #0F2744; display: inline-flex; position: relative; text-decoration: none; }
.mh-bell.has-dot::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #12B5A8;
  border: 1.5px solid #fff;
}
.mh-mail-list { display: grid; gap: .55rem; margin: 0 0 1rem; }
.mh-mail-list .mh-card.is-unread strong { font-weight: 800; }
.mh-hello { margin-top: .15rem; }
.mh-hello h1 {
  margin: 0;
  font-size: 1.65rem;
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: #0F2744;
  font-weight: 800;
}
.mh-hello p {
  margin: .3rem 0 0;
  color: #8A93A3;
  font-size: .92rem;
}

/* Rectángulo azul Paciente actual — siempre el 1º de Inicio */
.mh-now {
  display: block;
  padding: 1.05rem 1.1rem 1rem;
  border-radius: 18px;
  background: #1296A8;
  background-image: linear-gradient(100deg, #0E7C8B 0%, #1296A8 48%, #14A3B5 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(18, 150, 168, .32);
  min-height: 118px;
}
.mh-now:hover,
.mh-now:visited,
.mh-now:active {
  color: #fff;
  text-decoration: none;
}
.mh-now-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.mh-now-top > span {
  font-size: .86rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .95);
}
.mh-now-pill {
  margin: 0;
  padding: .22rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-style: normal;
  font-weight: 750;
  background: #7DDEA8;
  color: #fff;
  white-space: nowrap;
}
.mh-now-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .55rem;
}
.mh-now-name strong {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.15;
}
.mh-now-chev {
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
}
.mh-now-chev svg { color: #fff; }
.mh-now > p {
  margin: .35rem 0 0;
  font-size: .92rem;
  color: rgba(255, 255, 255, .92);
}
.mh-now.is-empty {
  opacity: 1;
}

.mh-card {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .95rem 1rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .08);
  text-decoration: none;
  color: inherit;
  position: relative;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}
.mh-card:hover { text-decoration: none; }
.mh-card-kicker {
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8A93A3;
}
.mh-card strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: #0F2744;
}
.mh-card span { font-size: .88rem; color: #8A93A3; }
.mh-card-next {
  background: #fff;
}
.mh-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.mh-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .7rem .55rem;
  text-align: center;
}
.mh-stat strong {
  display: block;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}
.mh-stat span {
  display: block;
  margin-top: .15rem;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 650;
}
.mh-stat.is-sky strong { color: #028BB9; }
.mh-stat.is-ok strong { color: #047857; }
.mh-stat.is-warn strong { color: #B45309; }
.mh-section-title {
  margin: .25rem 0 0;
  font-size: .95rem;
}
.mh-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}
.mh-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: .45rem;
  padding: .9rem .85rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .06);
  color: var(--ink);
  text-decoration: none;
  font-size: .86rem;
  font-weight: 700;
  min-height: 88px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
}
.mh-action:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.mh-action svg { color: var(--brand); }
.mh-search {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem .8rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}
.mh-search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font: inherit;
  color: var(--ink);
}
.mh-search-results {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.mh-search-row {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .7rem .85rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.mh-search-row:hover { text-decoration: none; }
.mh-search-row span { color: var(--muted); font-size: .82rem; }
.mh-muted { color: var(--muted); margin: 0; font-size: .9rem; }

.mh-patient {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-bottom: .25rem;
}
.mh-patient-top {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
}
.mh-patient-top strong {
  text-align: center;
  font-size: .95rem;
}
.mh-back {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
}
.mh-patient-id {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .25rem;
}
.mh-patient-id .ph-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 1.1rem;
  margin-bottom: .25rem;
}
.mh-patient-id h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.mh-patient-id p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}
.mh-patient-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: .45rem;
}
.mh-quick-form { margin: 0; }
.mh-quick {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .7rem .4rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
}
.mh-quick:disabled { opacity: .45; }
.mh-quick svg { color: var(--brand); }

.m-mas-page { display: flex; flex-direction: column; gap: .85rem; }
.m-mas-head h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}
.m-mas-head p {
  margin: .25rem 0 0;
  color: var(--muted);
}
.m-mas-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.m-mas-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem .9rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.m-mas-item:hover { text-decoration: none; }
.m-mas-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  flex: 0 0 auto;
}
.m-mas-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.m-mas-copy strong { font-size: .95rem; }
.m-mas-copy small { color: var(--muted); font-size: .78rem; }
.m-mas-chev { color: var(--muted); display: inline-flex; }
.m-mas-item.is-danger .m-mas-ico {
  background: #FEF2F2;
  color: #B91C1C;
}
.m-mas-brand {
  margin: 1rem 0 .5rem;
  text-align: center;
  color: var(--muted);
}
.m-mas-brand img {
  display: inline-block;
  height: 52px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}
.m-mas-brand p {
  margin: .4rem 0 0;
  font-size: .85rem;
}

@media (min-width: 901px) {
  .m-only,
  .m-tabbar,
  .mh-home,
  .mh-patient,
  .mh-now,
  .m-patients,
  .m-agenda-list,
  .m-agenda-head,
  .m-mas-page,
  .m-fab { display: none !important; }
  .d-desktop { display: revert !important; }
}

/* —— Paleta móvil del mockup (teal) · no afecta PC —— */
@media (max-width: 900px) {
  .main,
  .m-tabbar {
    --brand: #028BB9;
    --brand-dark: #02739A;
    --brand-tint: #E6F6FB;
    --btn-top: #03A0CC;
    --btn-bottom: #02739A;
    --btn-shadow: rgba(2, 139, 185, .28);
    --ink: #0F2744;
  }

  span.m-only { display: inline !important; }
  .mh-notes.m-only { display: block !important; }

  .ph-summary {
    grid-template-columns: 1fr !important;
    gap: .55rem;
  }
  .ph-summary-card {
    border-radius: 16px;
    min-height: auto;
    border: 1px solid rgba(15, 23, 42, .06);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
  }
  .ph-tabs.m-only {
    background: transparent;
    border: 0;
    gap: .15rem;
    padding: 0;
    margin: .2rem 0 .85rem;
    border-bottom: 1px solid #E2E8F0;
  }
  .ph-tabs.m-only a {
    flex: 0 0 auto;
    text-align: center;
    border-radius: 0;
    background: transparent !important;
    color: var(--muted);
    box-shadow: none !important;
    padding: .7rem .4rem;
    font-weight: 700;
    border-bottom: 2px solid transparent;
  }
  .ph-tabs.m-only a.active {
    color: #028BB9 !important;
    background: transparent !important;
    border-bottom-color: #028BB9;
    box-shadow: none !important;
  }
  .btn:not(.secondary):not(.danger-outline) {
    background: linear-gradient(180deg, #03A0CC, #02739A) !important;
    border-color: transparent !important;
    box-shadow: 0 8px 18px rgba(2, 139, 185, .25) !important;
  }
  .mh-now {
    background: #1296A8 !important;
    background-image: linear-gradient(100deg, #0E7C8B 0%, #1296A8 48%, #14A3B5 100%) !important;
    color: #fff !important;
  }
  .mh-action svg,
  .mh-quick svg,
  .m-mas-ico,
  .m-tab.is-active { color: #028BB9 !important; }
  .m-tab.is-active {
    background: #E6F6FB !important;
  }
  .m-mas-ico {
    background: #E6F6FB !important;
  }
  .mh-quick {
    border-radius: 999px !important;
    aspect-ratio: 1;
    justify-content: center;
    min-height: 72px;
    border: 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
  }
  .mh-patient-quick { gap: .65rem; }
  .mh-back.is-ghost {
    border: 0;
    background: transparent;
  }
  .mh-notes {
    background: #EAF6F8 !important;
    border: 0 !important;
    border-radius: 16px !important;
  }
  .mh-notes h2 {
    margin: 0 0 .35rem;
    font-size: .95rem;
  }
  .mh-notes p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.45;
  }
  .m-cta {
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 50px;
    border-radius: 14px;
    background: linear-gradient(180deg, #03A0CC, #02739A);
    color: #fff !important;
    font-weight: 750;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(2, 139, 185, .28);
    margin-top: .35rem;
  }
  .m-cta:hover { text-decoration: none; color: #fff; }

  .m-agenda-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .m-agenda-head h1 {
    margin: 0;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
  }
  .m-agenda-cal-btn {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .06);
    color: #028BB9;
    text-decoration: none;
  }
  .m-agenda-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem;
    padding: .25rem;
    border-radius: 14px;
    background: #E8EEF2;
  }
  .m-agenda-tabs a {
    text-align: center;
    padding: .55rem .4rem;
    border-radius: 11px;
    font-weight: 750;
    font-size: .9rem;
    color: var(--muted);
    text-decoration: none;
  }
  .m-agenda-tabs a.is-active {
    background: #028BB9;
    color: #fff;
  }
  .m-agenda-date {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 650;
  }
  .m-agenda-list {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    margin-top: .35rem;
    padding-bottom: 4.5rem;
  }
  .m-agenda-row {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: .65rem;
    align-items: center;
    padding: .85rem .9rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .06);
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
  }
  .m-agenda-row:hover { text-decoration: none; }
  .m-agenda-row.is-now {
    background: #E6F6FB;
    border-color: rgba(2, 139, 185, .25);
  }
  .m-agenda-time {
    font-size: .95rem;
    letter-spacing: -0.02em;
    color: #028BB9;
  }
  .m-agenda-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
  }
  .m-agenda-body strong {
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .m-agenda-body small {
    color: var(--muted);
    font-size: .78rem;
  }
  .m-agenda-status {
    font-style: normal;
    font-size: .7rem;
    font-weight: 750;
    padding: .28rem .5rem;
    border-radius: 999px;
    white-space: nowrap;
  }
  .m-agenda-status.is-confirmado { background: #ECFDF5; color: #047857; }
  .m-agenda-status.is-pendiente { background: #FFFBEB; color: #B45309; }
  .m-agenda-status.is-espera { background: #D1FAE5; color: #047857; }
  .m-agenda-status.is-completado { background: #EEF2FF; color: #3730A3; }
  .m-agenda-status.is-cancelado,
  .m-agenda-status.is-ausente { background: #FEF2F2; color: #B91C1C; }

  .m-fab {
    position: fixed;
    right: 1rem;
    bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    place-items: center;
    background: linear-gradient(180deg, #03A0CC, #02739A);
    color: #fff;
    box-shadow: 0 12px 28px rgba(2, 139, 185, .35);
    text-decoration: none;
  }
  .m-fab:hover { color: #fff; text-decoration: none; }

  .m-patients { gap: .75rem; }
  .m-patients-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .m-patients-head h1 {
    margin: 0;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
  }
  .m-fab-inline {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(180deg, #03A0CC, #02739A);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(2, 139, 185, .28);
  }
  .m-patients-list {
    display: flex;
    flex-direction: column;
    gap: .45rem;
  }
  .m-patient-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: .7rem;
    align-items: center;
    padding: .75rem .85rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .06);
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
  }
  .m-patient-row:hover { text-decoration: none; }
  .m-patient-row .ph-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: .85rem;
  }
  .m-patient-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
  }
  .m-patient-copy strong {
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .m-patient-copy small {
    color: var(--muted);
    font-size: .78rem;
  }

  .m-mas-copy small { display: none; }
  .m-mas-logout {
    display: inline-block;
    margin-top: .75rem;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 650;
  }
  .badge.confirmado,
  .bq-badge.tone-green { background: #ECFDF5 !important; color: #047857 !important; }
  .badge.pendiente,
  .bq-badge.tone-orange { background: #FFFBEB !important; color: #B45309 !important; }
}

/* Modo nocturno: gana sobre fondos blancos hardcodeados */
html[data-night="1"],
html.night {
  color-scheme: dark;
}
html[data-night="1"] body,
html.night body,
html[data-night="1"] .app,
html.night .app,
html[data-night="1"] .main,
html.night .main,
html[data-night="1"] .mc-page,
html.night .mc-page,
html[data-night="1"] .login-page,
html.night .login-page {
  background: var(--bg) !important;
  color: var(--ink) !important;
}
html[data-night="1"] .panel,
html.night .panel,
html[data-night="1"] .patients-board,
html.night .patients-board,
html[data-night="1"] .patients-sheet,
html.night .patients-sheet,
html[data-night="1"] .patients-searchbox,
html.night .patients-searchbox,
html[data-night="1"] .stat-card,
html.night .stat-card,
html[data-night="1"] .patient-card,
html.night .patient-card,
html[data-night="1"] .login-card,
html.night .login-card,
html[data-night="1"] .login-creds,
html.night .login-creds,
html[data-night="1"] .user-menu-trigger,
html.night .user-menu-trigger,
html[data-night="1"] .user-menu-panel,
html.night .user-menu-panel,
html[data-night="1"] .agenda-cal-panel,
html.night .agenda-cal-panel,
html[data-night="1"] .agenda-timegrid,
html.night .agenda-timegrid,
html[data-night="1"] .ph-kpi.is-warn,
html.night .ph-kpi.is-warn { background: color-mix(in srgb, #C2410C 16%, var(--card)); }
html[data-night="1"] .ph-kpi.is-ok,
html.night .ph-kpi.is-ok { background: color-mix(in srgb, #047857 16%, var(--card)); }
html[data-night="1"] .ph-kpi.is-next,
html.night .ph-kpi.is-next { background: color-mix(in srgb, var(--brand) 16%, var(--card)); }
html[data-night="1"] .ph-hero,
html.night .ph-hero,
html[data-night="1"] .bq-detail,
html.night .bq-detail,
html[data-night="1"] .bq-table-wrap,
html.night .bq-table-wrap,
html[data-night="1"] .ad-card,
html.night .ad-card,
html[data-night="1"] .manual-toc-card,
html.night .manual-toc-card,
html[data-night="1"] .mail-smtp,
html.night .mail-smtp,
html[data-night="1"] input,
html.night input,
html[data-night="1"] select,
html.night select,
html[data-night="1"] textarea,
html.night textarea,
html[data-night="1"] .btn.secondary,
html.night .btn.secondary,
html[data-night="1"] button.secondary,
html.night button.secondary,
html[data-night="1"] a.btn.secondary,
html.night a.btn.secondary,
html[data-night="1"] .ui-icon-btn,
html.night .ui-icon-btn,
html[data-night="1"] .app-top-themes,
html.night .app-top-themes,
html[data-night="1"] .login-theme-wrap,
html.night .login-theme-wrap,
html[data-night="1"] .app-top-plan,
html.night .app-top-plan,
html[data-night="1"] .app-top-agenda,
html.night .app-top-agenda {
  background: var(--card) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html[data-night="1"] .app-plan-banner,
html.night .app-plan-banner {
  background: #3b2414;
  color: #fdba74;
}
html[data-night="1"] .app-plan-banner a,
html.night .app-plan-banner a {
  color: #fdba74;
}
html[data-night="1"] h1,
html.night h1,
html[data-night="1"] h2,
html.night h2,
html[data-night="1"] h3,
html.night h3,
html[data-night="1"] .page-title,
html.night .page-title,
html[data-night="1"] .page-subtitle,
html.night .page-subtitle,
html[data-night="1"] label,
html.night label,
html[data-night="1"] th,
html.night th,
html[data-night="1"] td,
html.night td,
html[data-night="1"] p,
html.night p,
html[data-night="1"] .user-menu-name,
html.night .user-menu-name {
  color: var(--ink) !important;
}
html[data-night="1"] .page-subtitle,
html.night .page-subtitle,
html[data-night="1"] .user-menu-user,
html.night .user-menu-user,
html[data-night="1"] .muted,
html.night .muted {
  color: var(--muted) !important;
}
html[data-night="1"] .sidebar,
html.night .sidebar {
  background: var(--nav) !important;
}
html[data-night="1"] button.theme-toggle,
html.night button.theme-toggle {
  background: transparent !important;
  color: var(--muted) !important;
  border: 0 !important;
  box-shadow: none !important;
}
html[data-night="1"] button.theme-toggle.is-on,
html.night button.theme-toggle.is-on {
  background: #1C1C1F !important;
  color: var(--brand) !important;
  border: 0 !important;
}

html[data-night="1"] .ad-panel,
html.night .ad-panel {
  background: #141416 !important;
  border-color: #27272A !important;
  color: var(--ink) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .45);
}
html[data-night="1"] .ad-panel-head,
html.night .ad-panel-head {
  background: #1A1A1D !important;
  border-color: #27272A !important;
}
html[data-night="1"] .ad-panel-icon,
html.night .ad-panel-icon,
html[data-night="1"] .ad-help-icon,
html.night .ad-help-icon,
html[data-night="1"] .ad-head-search,
html.night .ad-head-search,
html[data-night="1"] .ad-action,
html.night .ad-action,
html[data-night="1"] .ms-card,
html.night .ms-card,
html[data-night="1"] .ms-field,
html.night .ms-field,
html[data-night="1"] .ms-search,
html.night .ms-search,
html[data-night="1"] .ms-tr,
html.night .ms-tr,
html[data-night="1"] .ms-free,
html.night .ms-free {
  background: var(--card) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html[data-night="1"] .ad-panel-head h2,
html.night .ad-panel-head h2,
html[data-night="1"] .ad-link-copy strong,
html.night .ad-link-copy strong,
html[data-night="1"] .manual-section-head h2,
html.night .manual-section-head h2,
html[data-night="1"] .manual-action-copy h3,
html.night .manual-action-copy h3,
html[data-night="1"] .manual-steps,
html.night .manual-steps,
html[data-night="1"] .manual-hero h1,
html.night .manual-hero h1 {
  color: var(--ink) !important;
}
html[data-night="1"] .ad-panel-head p,
html.night .ad-panel-head p,
html[data-night="1"] .ad-link-copy span,
html.night .ad-link-copy span,
html[data-night="1"] .manual-toc-t em,
html.night .manual-toc-t em,
html[data-night="1"] .manual-hero-lead,
html.night .manual-hero-lead,
html[data-night="1"] .manual-example,
html.night .manual-example {
  color: var(--muted) !important;
}
html[data-night="1"] .ad-help,
html.night .ad-help,
html[data-night="1"] .ad-support,
html.night .ad-support {
  background: #1A1A1D !important;
  color: var(--ink) !important;
  border-color: #27272A !important;
}
html[data-night="1"] .mscreen,
html.night .mscreen {
  background: #141416 !important;
  border-color: #27272A !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .5);
}
html[data-night="1"] .mscreen-body,
html.night .mscreen-body {
  background: #111113 !important;
}
html[data-night="1"] .manual-tips,
html.night .manual-tips {
  background: transparent !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}
html[data-night="1"] .manual-tips strong,
html.night .manual-tips strong {
  color: var(--muted) !important;
}
html[data-night="1"] .manual-tips ul,
html.night .manual-tips ul {
  color: var(--ink) !important;
}
html[data-night="1"] a.ad-link:hover,
html.night a.ad-link:hover {
  background: #1C1C1F !important;
}
html[data-night="1"] .mbx,
html.night .mbx,
html[data-night="1"] .mbx-main,
html.night .mbx-main,
html[data-night="1"] .mbx-warn,
html.night .mbx-warn,
html[data-night="1"] .mbx-tabs a,
html.night .mbx-tabs a {
  background: var(--card) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html[data-night="1"] .mbx-side,
html.night .mbx-side {
  background: #09090B !important;
}
html[data-night="1"] .mbx-item:hover,
html.night .mbx-item:hover,
html[data-night="1"] .mbx-item.is-on,
html.night .mbx-item.is-on {
  background: #141416 !important;
}
html[data-night="1"] .tooth,
html.night .tooth {
  background: #1A1A1D !important;
  color: #F4F4F5 !important;
  border-color: #3F3F46 !important;
}
html[data-night="1"] .tooth.has-status,
html.night .tooth.has-status {
  background: var(--brand-tint) !important;
  color: #F4F4F5 !important;
  border-color: var(--tooth-border) !important;
}
html[data-night="1"] .tooth small,
html.night .tooth small {
  color: var(--muted) !important;
}
