:root {
  color-scheme: dark;
  /* Brand red (Hercules) */
  --brick: #c8102e;
  --brick-dark: #8b0f1a;
  /* Backgrounds (legacy names repurposed for dark theme) */
  --cream: #0a0a0a;        /* base body bg */
  --paper: #161616;         /* card/surface bg */
  --charcoal: #1c1c1c;      /* deeper surface */
  /* New named bg tokens for clarity in new code */
  --bg: #0a0a0a;
  --surface: #161616;
  --surface-2: #1c1c1c;
  --sidebar-bg: #0e0e0e;
  /* Text */
  --ink: #f5f5f5;           /* primary text on dark */
  --text: #f5f5f5;
  --text-muted: #9ca3af;
  --muted: #6e6e6e;
  /* Borders */
  --line: #2a2a2a;
  --border: #2a2a2a;
  /* Status */
  --danger: #c8102e;
  --ok: #3ab472;
  --warn: #e09030;
  /* Accents (new) */
  --accent: #c8102e;
  --accent-dim: #8b0f1a;
  /* Typography */
  --font-display: "Oswald", Impact, "Arial Narrow", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
}

button,
input {
  font: inherit;
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

button,
.button-link {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--brick);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

button:hover,
.button-link:hover {
  background: var(--brick-dark);
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

.login-body {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: #090909;
}

.login-body::before {
  content: "";
  position: fixed;
  inset: -22px;
  z-index: -2;
  background: url("/assets/login-gym-bg.webp") center / cover no-repeat;
  filter: blur(10px);
  transform: scale(1.04);
}

.login-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(9, 9, 9, 0.88), rgba(9, 9, 9, 0.42)),
    radial-gradient(circle at 76% 18%, rgba(157, 29, 24, 0.42), transparent 30%);
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 28px);
  position: relative;
}

.login-credit {
  position: fixed;
  right: 22px;
  bottom: 16px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.login-panel {
  width: 100%;
  min-height: calc(100vh - 48px);
  min-height: calc(100dvh - 48px);
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  justify-items: center;
  gap: clamp(26px, 6vh, 72px);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: clamp(18px, 3vw, 32px) clamp(24px, 5vw, 54px);
  box-shadow: none;
}

.login-logo {
  display: block;
  position: relative;
  top: auto;
  left: auto;
  width: clamp(340px, 34vw, 620px);
  height: auto;
  transform: none;
  margin: 0;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.2));
}

.access-form {
  width: min(540px, calc(100% - 28px));
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  margin: 0;
}

.brand,
.admin-header,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  justify-content: flex-start;
  margin-bottom: 36px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-size: 24px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
}

h2 {
  font-size: 22px;
}

p,
span,
small {
  color: var(--muted);
}

.access-form label {
  display: block;
  margin-bottom: 12px;
  color: #fff;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.76);
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dni-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.12));
  backdrop-filter: blur(18px);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.dni-row input {
  min-height: clamp(58px, 8vh, 76px);
  border: 0;
  border-radius: 13px;
  font-size: clamp(22px, 3.2vw, 32px);
  text-align: center;
  font-weight: 800;
  letter-spacing: 0;
  color: #111827;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.1);
  outline: none;
}

.dni-row input:focus {
  box-shadow:
    inset 0 1px 3px rgba(15, 23, 42, 0.12),
    0 0 0 3px rgba(157, 29, 24, 0.22);
}

.dni-row input::placeholder {
  color: #9ca3af;
  font-size: clamp(14px, 1.45vw, 18px);
  font-weight: 700;
}

.dni-row button {
  min-height: clamp(58px, 8vh, 76px);
  border-radius: 13px;
  padding-inline: 24px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  box-shadow: 0 14px 30px rgba(113, 17, 15, 0.32);
}

.dni-row button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(113, 17, 15, 0.38);
}

.dni-row .login-icon-button {
  width: clamp(76px, 10vw, 96px);
  padding-inline: 0;
}

.dni-row .login-icon-button svg {
  display: block;
}

.result {
  position: static;
  width: 100%;
  margin: 18px 0 0;
  border-radius: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
}

.result strong,
.result span {
  display: block;
}

.result strong {
  color: #fff;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  margin-bottom: 0;
}

.result.granted {
  border-color: rgba(21, 128, 61, 0.35);
  background: #edf8ef;
}

.result.granted strong {
  color: var(--ok);
}

.result.denied {
  border-color: rgba(185, 28, 28, 0.35);
  background: #fff1ef;
}

.result.denied strong {
  color: var(--danger);
}

.access-dialog {
  width: min(760px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.access-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog-content {
  position: relative;
  padding: 28px 44px 30px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: var(--cream);
  text-align: center;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.46);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  font-size: 34px;
  line-height: 1;
}

.dialog-close:hover {
  color: #fff;
  background: var(--brick);
}

.dialog-status-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 6px auto 18px;
  border-radius: 999px;
  color: var(--ok);
  background: #dcfce7;
  box-shadow: 0 18px 38px rgba(21, 128, 61, 0.16);
}

.dialog-content.denied .dialog-status-icon {
  color: var(--danger);
  background: #fee2e2;
  box-shadow: 0 18px 38px rgba(185, 28, 28, 0.16);
}

.dialog-eyebrow {
  margin-bottom: 8px;
  color: var(--ok);
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
}

.dialog-content h2 {
  margin-bottom: 10px;
  font-size: clamp(36px, 5vw, 54px);
  line-height: 1.05;
}

.dialog-content p {
  font-size: 19px;
  line-height: 1.35;
}

.dialog-eyebrow {
  margin-top: 0;
}

.dialog-content.denied .dialog-eyebrow {
  color: var(--danger);
}

.dialog-content.denied .dialog-warning {
  border-color: rgba(185, 28, 28, 0.34);
  color: #7f1d1d;
  background: #fef2f2;
}

.dialog-content.denied button:last-child {
  background: var(--danger);
}

.dialog-content.denied button:last-child:hover {
  background: #7f1d1d;
}

.dialog-warning {
  border: 1px solid rgba(180, 83, 9, 0.32);
  border-radius: 8px;
  padding: 12px;
  color: #7c2d12;
  background: #fff7ed;
  font-weight: 800;
}

.dialog-warning[hidden] {
  display: none;
}

.dialog-content button:last-child {
  min-width: 190px;
  margin-top: 8px;
}

.admin-link {
  display: inline-block;
  margin-top: 22px;
  color: var(--brick-dark);
  font-weight: 700;
}

.admin-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.admin-app-body {
  background: #f5f2ec;
  color: var(--ink);
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(248, 236, 233, 0.72)),
    #f5f2ec;
}

.admin-login[hidden] {
  display: none;
}

.admin-login-card {
  width: min(430px, 100%);
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 22px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.16);
}

.admin-login-card img {
  display: block;
  width: 240px;
  max-width: 100%;
  margin: 0 auto;
}

.admin-login-brand {
  border: 1px solid #f1d6d1;
  border-radius: 16px;
  padding: 18px;
  background: #fff8f6;
}

.admin-login-heading {
  margin: 18px 0 14px;
  text-align: center;
}

.admin-login-card h1 {
  margin: 0;
  color: #111827;
  font-size: 30px;
  line-height: 1.05;
  text-align: center;
}

.admin-login-heading p {
  min-height: 0;
  margin: 8px auto 0;
  color: #667085;
  font-size: 14px;
  line-height: 1.45;
}

.admin-login-fields {
  display: grid;
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  background: #f9fafb;
}

.admin-login-card label {
  display: grid;
  gap: 7px;
  margin-top: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.admin-login-card input {
  min-height: 44px;
  margin-top: 0;
  border-color: #e5e7eb;
  border-radius: 11px;
  color: #111827;
  background: #fff;
}

.admin-login-card button {
  width: 100%;
  min-height: 46px;
  margin-top: 16px;
  border-radius: 12px;
  font-weight: 900;
}

.admin-login-card .admin-login-message {
  min-height: 0;
  margin: 12px 0 0;
  color: #b91c1c;
  font-weight: 800;
  text-align: center;
}

.admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: #f5f2ec;
}

.admin-app[hidden] {
  display: none;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fffdf8;
  box-shadow: 18px 0 40px rgba(24, 24, 24, 0.06);
}

.sidebar-logo {
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.sidebar-logo img {
  display: block;
  width: 236px;
  max-width: 100%;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 14px 8px;
}

.sidebar-nav .tab-button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sidebar-nav .tab-button::before {
  content: attr(data-icon);
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  margin-right: 10px;
  border-radius: 6px;
  color: var(--brick);
  background: transparent;
  font-size: 19px;
}

.sidebar-nav .dashboard-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/alineacion-de-graficos.svg") center / 24px 24px no-repeat;
  mask: url("/assets/alineacion-de-graficos.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .clients-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/circulo-de-usuario.svg") center / 24px 24px no-repeat;
  mask: url("/assets/circulo-de-usuario.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .plans-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/etiquetas.svg") center / 24px 24px no-repeat;
  mask: url("/assets/etiquetas.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .events-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/calendario-lineas-boligrafo.svg") center / 24px 24px no-repeat;
  mask: url("/assets/calendario-lineas-boligrafo.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .expiring-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/calendario-reloj.svg") center / 24px 24px no-repeat;
  mask: url("/assets/calendario-reloj.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .alerts-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/alarma-exclamacion.svg") center / 24px 24px no-repeat;
  mask: url("/assets/alarma-exclamacion.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .cash-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/money-cheque-editar.svg") center / 24px 24px no-repeat;
  mask: url("/assets/money-cheque-editar.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .staff-nav::before {
  content: "";
  background: var(--brick);
  -webkit-mask: url("/assets/equipo-de-usuario.svg") center / 24px 24px no-repeat;
  mask: url("/assets/equipo-de-usuario.svg") center / 24px 24px no-repeat;
}

.sidebar-nav .tab-button:hover,
.sidebar-nav .tab-button.active {
  color: var(--ink);
  background: #f5e5df;
  box-shadow: inset 4px 0 0 var(--brick);
}

.logout-button {
  margin: auto 12px 18px;
  color: #ffb4a8;
  background: transparent;
}

.logout-button:hover {
  color: #fff;
  background: var(--brick);
}

.admin-content {
  min-width: 0;
  padding: 0 22px 28px;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 242, 236, 0.92);
  backdrop-filter: blur(10px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-actions span {
  color: var(--muted);
  font-weight: 800;
}

.topbar-actions button {
  min-height: 38px;
  background: var(--brick);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}

.topbar-actions button:hover {
  background: var(--brick-dark);
}

.admin-topbar strong,
.page-title h1,
.tab-panel h2,
.tab-panel h3 {
  color: var(--ink);
}

.page-title {
  margin: 20px 0;
}

.page-title.centered {
  text-align: center;
}

.admin-app .tab-panel {
  border-color: var(--line);
  background: #fffdf8;
  box-shadow: 0 16px 40px rgba(24, 24, 24, 0.06);
}

.admin-app .client-form {
  color: var(--ink);
}

.admin-app input,
.admin-app select {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.admin-app .form-grid label,
.admin-app p,
.admin-app span,
.admin-app small,
.admin-app th {
  color: var(--muted);
}

.admin-app table {
  color: var(--ink);
}

.admin-app th,
.admin-app td {
  border-bottom-color: var(--line);
}

.admin-app .report-cards article,
.admin-app .chart-card,
.admin-app .top-clients article,
.admin-app .event {
  border-color: var(--line);
  background: #fff;
}

.admin-app .report-cards strong,
.admin-app .event strong,
.admin-app .top-clients strong {
  color: var(--ink);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 14px 0;
  align-items: end;
}

.filter-bar label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-bar input,
.filter-bar select {
  margin-top: 6px;
}

.search-bar {
  margin: 12px 0 16px;
}

.search-bar input {
  max-width: 520px;
  border-color: rgba(157, 29, 24, 0.24);
  background: #fff;
  box-shadow: 0 12px 26px rgba(113, 17, 15, 0.06);
}

.action-cell,
.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-cell button,
.inline-actions .button-link {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 17px;
}

.inline-actions .button-link {
  width: auto;
  padding: 0 12px;
  font-size: 14px;
}

.icon-close-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  background: transparent;
  color: var(--brick);
  border: 1px solid var(--line);
}

.icon-close-button:hover {
  color: #fff;
  background: var(--brick);
}

.danger-button {
  background: #7f1d1d;
}

.danger-button:hover {
  background: #991b1b;
}

.client-file-dialog {
  width: min(920px, calc(100% - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

.client-file-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.client-file-content {
  position: relative;
  max-height: 86vh;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 24px;
  color: #111827;
  background: #f9fafb;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36);
}

.client-file-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.client-file-header h2 {
  margin: 2px 0 4px;
  color: #111827;
  font-size: 28px;
  line-height: 1.05;
}

.client-file-header p {
  margin: 0;
  color: #667085;
  font-size: 13px;
}

.client-file-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.client-file-grid article {
  position: relative;
  min-height: 94px;
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px 14px 18px 62px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

.client-file-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--brick);
  background: #f8ece9;
}

.client-file-icon svg {
  width: 19px;
  height: 19px;
  display: block;
  margin: auto;
}

.client-file-grid strong {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.client-file-grid span {
  display: block;
  color: #111827;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.client-file-section {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.client-file-section .section-title {
  margin-bottom: 10px;
}

.client-file-section h3 {
  margin: 0;
  color: #111827;
  font-size: 17px;
}

.client-file-access-list {
  display: grid;
  gap: 10px;
}

.client-file-access-list article {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 11px 12px;
  background: #f9fafb;
}

.client-file-access-list strong,
.client-file-access-list span {
  display: block;
}

.client-file-access-list strong {
  color: #111827;
  font-size: 13px;
}

.client-file-access-list span {
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
}

.admin-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--brick);
  font-weight: 800;
  text-transform: uppercase;
}

.tab-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.client-form {
  background: transparent;
  border: 0;
  padding: 0;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0 14px;
  overflow-x: auto;
}

.tab-button {
  min-height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
}

.tab-button:hover,
.tab-button.active {
  color: #fff;
  border-color: var(--brick);
  background: var(--brick);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.form-grid input {
  margin-top: 6px;
}

.checkbox-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.client-form button[type="submit"] {
  width: 100%;
  margin-top: 18px;
}

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  font-weight: 700;
}

.form-message.success {
  color: var(--ok);
}

.form-message.error {
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

td span {
  font-size: 13px;
}

.status-pill {
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink);
  background: #f5e5df;
}

.status-pill.warning {
  color: #fff;
  background: var(--danger);
}

.admin-dialog {
  width: min(440px, calc(100% - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

.admin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

.admin-dialog-content {
  border-radius: 8px;
  padding: 24px;
  background: var(--paper);
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.admin-dialog-content h2 {
  margin-bottom: 10px;
}

.confirm-action-detail {
  margin-top: 12px;
  border: 1px solid rgba(157, 29, 24, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  color: #7f1d1d;
  background: #fff7f6;
  font-weight: 800;
}

.events-title {
  margin-top: 28px;
}

.events {
  display: grid;
  gap: 10px;
}

.access-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(480px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.pagination button {
  min-height: 34px;
  padding: 0 12px;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.event {
  border-left: 5px solid var(--warn);
  border-radius: 6px;
  padding: 12px;
  background: #f8fafc;
}

.event.granted {
  border-left-color: var(--ok);
}

.event.denied {
  border-left-color: var(--danger);
}

.event strong,
.event span,
.event small {
  display: block;
}

.days-warning {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  font-weight: 800;
}

.days-warning.expiring {
  color: #78350f;
  background: #fde68a;
}

.days-warning.overdue {
  color: #fff;
  background: var(--danger);
}

.days-warning.grace-active {
  color: #064e3b;
  background: #bbf7d0;
}

.grace-cell {
  display: inline-flex;
  max-width: 220px;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.grace-cell small {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--muted);
  background: #fffdf8;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0 18px;
}

.dashboard-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.report-cards article,
.chart-card,
.top-clients article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-cards article {
  padding: 16px;
}

.report-cards .metric-card {
  position: relative;
  min-height: 126px;
  border-top: 4px solid var(--brick);
  background: linear-gradient(180deg, #fffdf8, #f5e5df);
  box-shadow: 0 18px 38px rgba(113, 17, 15, 0.12);
}

.report-cards .overdue-card {
  padding-bottom: 62px;
}

.report-cards .metric-action {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: inline-flex;
  min-height: 34px;
  min-width: 128px;
  padding: 0 34px 0 14px;
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
}

.report-cards .metric-action span {
  display: block;
  width: 100%;
  color: inherit;
  text-align: center;
}

.report-cards .metric-action::after {
  content: "";
  position: absolute;
  right: 10px;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("/assets/flecha-circulo-derecha.svg") center / contain no-repeat;
  mask: url("/assets/flecha-circulo-derecha.svg") center / contain no-repeat;
}

.report-cards .metric-card.green {
  border-top-color: var(--brick);
}

.report-cards .metric-card.blue {
  border-top-color: var(--brick-dark);
}

.report-cards .metric-card.yellow {
  border-top-color: #d9b6ae;
}

.report-cards .metric-card.orange {
  border-top-color: var(--warn);
}

.admin-app .report-cards .metric-card strong {
  color: var(--brick);
  font-size: 36px;
}

.admin-app .report-cards .metric-card > span {
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 3px;
}

.admin-app .report-cards .metric-card small {
  color: var(--muted);
}

.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.finance-cards {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.finance-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.finance-charts .wide-chart {
  grid-column: 1 / -1;
}

.plan-heatmap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.plan-heatmap article {
  min-height: 82px;
  border-radius: 8px;
  padding: 14px;
  color: #fff;
}

.plan-heatmap strong,
.plan-heatmap span {
  display: block;
  color: #fff;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.admin-dialog-content label {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.plan-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brick);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(180deg, #fffdf8, #f5e5df);
  box-shadow: 0 18px 38px rgba(113, 17, 15, 0.12);
}

.plan-card strong {
  display: block;
  margin-bottom: 18px;
  color: var(--brick);
  font-size: 28px;
  letter-spacing: 2px;
}

.plan-card strong span {
  color: inherit;
  letter-spacing: 0;
}

.plan-card label {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.plan-card input {
  margin-top: 6px;
}

.plan-card button {
  width: 100%;
  margin-top: 14px;
}

.inline-actions .button-link[href*="wa.me"] {
  background: #128c7e;
  color: #fff;
}

.inline-actions .button-link[href*="wa.me"]:hover {
  background: #075e54;
}

.report-cards strong {
  display: block;
  margin-bottom: 4px;
  font-size: 34px;
  line-height: 1;
}

.report-cards span {
  font-weight: 700;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.chart-card {
  padding: 16px;
}

.chart-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.chart-card canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
}

#chart-access-status-admin {
  max-width: none;
  width: 100%;
}

.top-clients {
  display: grid;
  gap: 10px;
}

.top-clients article {
  padding: 12px;
}

.top-clients strong,
.top-clients span {
  display: block;
}

@media (max-width: 860px) {
  .form-grid,
  .dni-row {
    grid-template-columns: 1fr;
  }

  .report-cards,
  .dashboard-charts,
  .access-layout,
  .reports-grid,
  .client-file-grid {
    grid-template-columns: 1fr;
  }

  .admin-app {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .dni-row button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .login-shell {
    padding: 14px;
  }

  .login-panel {
    padding: 22px;
  }

  .dni-row button {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .login-body::after {
    background:
      linear-gradient(180deg, rgba(9, 9, 9, 0.78), rgba(9, 9, 9, 0.52)),
      radial-gradient(circle at 50% 12%, rgba(157, 29, 24, 0.38), transparent 34%);
  }

  .login-panel {
    min-height: calc(100dvh - 28px);
    gap: clamp(14px, 3vh, 28px);
    padding: 18px;
  }

  .login-logo {
    width: min(560px, 86vw);
  }

  .access-form {
    width: min(620px, 100%);
  }

  .access-form label {
    font-size: clamp(17px, 3vw, 24px);
  }

  .dni-row {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 12px;
    padding: 10px;
  }

  .dni-row input {
    min-height: 72px;
    font-size: clamp(26px, 6vw, 42px);
  }

  .dni-row .login-icon-button {
    width: 92px;
    min-height: 72px;
  }

  .result strong {
    font-size: clamp(34px, 7vw, 56px);
  }
}

@media (max-width: 680px) {
  .login-shell {
    padding: 12px;
  }

  .login-panel {
    min-height: calc(100dvh - 24px);
    grid-template-rows: auto auto 1fr;
    justify-content: stretch;
    padding: 14px;
  }

  .login-logo {
    width: min(420px, 92vw);
  }

  .access-form {
    width: 100%;
  }

  .dni-row {
    grid-template-columns: 1fr;
    border-radius: 16px;
  }

  .dni-row input {
    min-height: 66px;
  }

  .dni-row .login-icon-button {
    width: 100%;
    min-height: 60px;
  }

  .login-credit {
    right: 12px;
    bottom: 10px;
    max-width: calc(100% - 24px);
    text-align: right;
  }

  .access-dialog {
    width: min(94vw, 520px);
  }

  .dialog-content {
    padding: 24px 18px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .login-panel {
    min-height: calc(100dvh - 20px);
    grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1fr);
    grid-template-rows: 1fr;
    gap: 22px;
    padding: 10px 18px;
  }

  .login-logo {
    width: min(42vw, 440px);
  }

  .access-form {
    width: min(52vw, 620px);
  }

  .dni-row input,
  .dni-row .login-icon-button {
    min-height: 62px;
  }

  .result {
    margin-top: 12px;
  }
}

/* Modern SaaS admin refresh */
.modern-admin-app {
  background: #f3f4f6;
  grid-template-columns: 264px 1fr;
}

.modern-admin-app .admin-sidebar {
  top: 14px;
  height: calc(100vh - 28px);
  border-right: 1px solid #e5e7eb;
  border-radius: 0 16px 16px 0;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 18px 0 44px rgba(15, 23, 42, 0.05);
}

.modern-admin-app .sidebar-logo {
  padding: 18px 16px 20px;
}

.modern-admin-app .sidebar-logo img {
  width: 242px;
}

.modern-sidebar-nav {
  gap: 6px;
  padding: 16px 12px;
}

.modern-sidebar-nav .tab-button {
  min-height: 46px;
  border-radius: 10px;
  padding: 0 12px;
  color: #667085;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.modern-sidebar-nav .tab-button::before {
  display: none;
}

.modern-sidebar-nav .tab-button:hover,
.modern-sidebar-nav .tab-button.active {
  color: #111827;
  background: #f8ece9;
  box-shadow: inset 3px 0 0 var(--brick);
}

.modern-sidebar-nav .tab-button.backup-nav {
  color: #475467;
  background: transparent;
  box-shadow: none;
}

.modern-sidebar-nav .tab-button.backup-nav .nav-icon {
  color: var(--brick);
  background: #fff;
}

.modern-sidebar-nav .tab-button.backup-nav:hover,
.modern-sidebar-nav .tab-button.backup-nav.active {
  color: var(--brick);
  background: #f8ece9;
  box-shadow: inset 3px 0 0 var(--brick);
}

.modern-sidebar-nav .tab-button.backup-nav:hover .nav-icon,
.modern-sidebar-nav .tab-button.backup-nav.active .nav-icon {
  color: #fff;
  background: var(--brick);
}

.modern-sidebar-nav .nav-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  margin-right: 10px;
  border-radius: 9px;
  color: var(--brick);
  background: #fff;
  border: 1px solid #f1d6d1;
}

.modern-logout {
  gap: 8px;
  justify-content: flex-start;
  margin: auto 14px 8px;
  border-radius: 10px;
  color: #9d1d18;
  font-weight: 800;
}

.mobile-menu-toggle {
  display: none;
}

.sidebar-credit {
  margin: 0 18px 16px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.modern-admin-app .admin-content {
  padding: 0 28px 32px;
}

.modern-admin-app .admin-topbar {
  min-height: 66px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(243, 244, 246, 0.86);
}

.modern-admin-app .topbar-actions button {
  min-height: 42px;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(157, 29, 24, 0.18);
}

.modern-admin-app .topbar-actions .topbar-icon-action {
  gap: 8px;
  width: 44px;
  min-height: 44px;
  border-radius: 12px;
  padding: 0;
  color: var(--brick);
  background: #fff;
  border: 1px solid #f1d6d1;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.modern-admin-app .topbar-actions .topbar-icon-action span {
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.modern-admin-app .topbar-actions .topbar-icon-action:hover {
  color: #fff;
  background: var(--brick-dark);
  border-color: var(--brick-dark);
  transform: translateY(-1px);
}

.topbar-icon-action svg {
  display: block;
}

.modern-page {
  border: 0;
  border-radius: 18px;
  padding: 24px;
  background: transparent;
  box-shadow: none;
}

.modern-page .page-title {
  margin: 4px 0 22px;
}

.modern-page .page-title h1 {
  color: #111827;
  font-size: clamp(30px, 3vw, 42px);
  letter-spacing: 0;
}

.modern-page .page-title p {
  color: #667085;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.compact-stats {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.stat-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -26px -36px auto;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(157, 29, 24, 0.08);
}

.stat-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: var(--brick);
  background: #f8ece9;
}

.stat-title {
  color: #667085;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.6px;
}

.stat-card strong {
  display: block;
  color: #111827;
  font-size: 32px;
  line-height: 1.05;
}

.stat-card small {
  display: block;
  margin-top: 8px;
  color: #667085;
}

.method-breakdown {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}

.method-breakdown span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.method-breakdown b {
  color: #667085;
}

.method-breakdown em {
  color: #111827;
  font-style: normal;
}

.plan-breakdown {
  display: grid;
  gap: 8px;
  max-height: 142px;
  margin-top: 12px;
  padding-top: 12px;
  overflow-y: auto;
  border-top: 1px solid #eef2f7;
}

.plan-breakdown span {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  color: #475467;
  font-size: 12px;
}

.plan-breakdown b {
  color: #111827;
}

.plan-breakdown em {
  color: #111827;
  font-style: normal;
  font-weight: 900;
}

.plan-breakdown small {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 11px;
}

.chart-tooltip-detail {
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
}

.chart-tooltip-detail strong,
.chart-tooltip-detail em {
  display: block;
  color: #111827;
}

.chart-tooltip-detail em {
  margin-top: 4px;
  color: #667085;
  font-style: normal;
  font-weight: 800;
}

.chart-tooltip-detail ul {
  display: grid;
  gap: 5px;
  max-height: 160px;
  margin: 8px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.chart-tooltip-detail li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #475467;
  font-size: 12px;
}

.chart-tooltip-detail li b {
  color: #111827;
  font-weight: 800;
}

.chart-tooltip-detail li span {
  color: #111827;
  font-weight: 900;
  white-space: nowrap;
}

.finance-method-card,
.finance-plan-card {
  min-height: 226px;
}

.stat-card.success .stat-icon {
  color: #15803d;
  background: #dcfce7;
}

.stat-card.danger {
  border-color: #fecaca;
}

.stat-card.danger .stat-icon {
  color: #b91c1c;
  background: #fee2e2;
}

.stat-card.warning .stat-icon {
  color: #b45309;
  background: #ffedd5;
}

.stat-action {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  min-width: 126px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--brick);
  background: #fff;
  font-size: 12px;
  box-shadow: none;
}

.stat-action span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-weight: 900;
}

.stat-card.danger .stat-action:hover,
.stat-action:hover {
  color: #fff;
  background: var(--brick);
  border-color: var(--brick);
}

.stat-action svg {
  display: block;
}

.modern-dashboard-charts,
.finance-charts {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(420px, 1.35fr) minmax(260px, 0.85fr);
  gap: 16px;
  margin: 18px 0;
}

.finance-charts {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
}

.finance-charts .wide-chart {
  grid-column: 1 / -1;
}

.modern-chart-card,
.plan-map-card,
.modern-panel {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.modern-chart-card {
  padding: 18px 18px 8px;
}

.chart-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.chart-heading h3 {
  margin: 0;
  color: #111827;
  font-size: 17px;
}

.chart-heading p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 13px;
}

.apex-chart {
  min-height: 260px;
}

.plan-map-card {
  padding: 18px;
}

.plan-map-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.plan-map-row {
  position: relative;
  min-height: 76px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

.plan-map-row::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--plan-share);
  height: 3px;
  background: var(--brick);
}

.plan-map-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: var(--brick);
  background: #f8ece9;
}

.plan-map-copy {
  display: grid;
  gap: 3px;
}

.plan-map-row strong {
  color: #111827;
  font-size: 14px;
}

.plan-map-row span {
  color: #667085;
  font-size: 12px;
}

.plan-map-total {
  min-width: 34px;
  text-align: right;
  color: var(--brick);
  font-size: 24px;
  font-weight: 950;
}

.plan-map-summary {
  background: #f9fafb;
}

.plan-map-summary .plan-map-icon {
  color: #111827;
  background: #eef2f7;
}

.modern-panel {
  margin-top: 18px;
  padding: 18px;
}

.modern-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.05);
}

.modern-table {
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.modern-table th {
  padding: 14px 16px;
  color: #667085;
  background: #f9fafb;
  font-size: 12px;
  letter-spacing: 0.8px;
}

.modern-table td {
  padding: 16px;
  border-bottom: 1px solid #edf0f3;
  color: #344054;
  vertical-align: middle;
}

.modern-table tbody tr:hover {
  background: #fff8f6;
}

.modern-table td strong {
  color: #111827;
}

.leads-table {
  min-width: 980px;
}

.lead-message-cell {
  max-width: 260px;
  white-space: normal;
}

.lead-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.converted-lead-row {
  background: #f3f4f6;
  opacity: 0.72;
}

.converted-lead-row:hover {
  background: #eef0f3;
}

.lead-detail-dialog::backdrop {
  background: rgba(17, 24, 39, 0.58);
  backdrop-filter: blur(4px);
}

.lead-detail-dialog {
  width: min(1040px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  overflow: hidden;
}

.lead-detail-card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  display: grid;
  gap: 12px;
  border: 1px solid #efe4dc;
  padding: 22px 24px;
  background:
    linear-gradient(180deg, rgba(255, 248, 246, 0.82), rgba(255, 255, 255, 0.98) 34%),
    #fff;
  text-align: left;
  overflow: hidden;
}

.lead-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
}

.lead-modal-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.lead-modal-header h2 {
  margin: 4px 0 0;
  color: #111827;
  font-size: 24px;
  line-height: 1.1;
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 2px;
}

.lead-detail-grid article,
.lead-message-box {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(249, 250, 251, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.lead-detail-grid span,
.lead-message-box span {
  display: block;
  margin-bottom: 5px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.lead-detail-grid strong {
  color: #111827;
  font-size: 14px;
}

.lead-message-box p {
  margin: 0;
  color: #344054;
  line-height: 1.45;
}

.lead-workspace {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(320px, 1.3fr);
  gap: 12px;
  align-items: stretch;
}

.lead-workspace.converted {
  grid-template-columns: 1fr;
}

.lead-detail-card label {
  display: grid;
  gap: 8px;
  color: #667085;
  font-size: 13px;
  font-weight: 900;
}

.lead-detail-card select {
  min-height: 42px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 0 12px;
  color: #111827;
  background: #fff;
  font: inherit;
  font-weight: 800;
}

.lead-detail-card textarea {
  width: 100%;
  min-height: 102px;
  resize: vertical;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: #111827;
  background: #fff;
}

.lead-response-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #efe4dc;
  border-radius: 14px;
  background: #fff8f6;
}

.lead-response-button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 0 14px;
  font-weight: 900;
  text-decoration: none;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.lead-response-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.lead-response-button:disabled,
.lead-response-button.disabled-link {
  pointer-events: none;
  color: #98a2b3;
  border-color: #e5e7eb;
  background: #f3f4f6;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.lead-response-button img {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  object-fit: contain;
}

.lead-response-whatsapp {
  color: #15803d;
  border-color: #bbf7d0;
}

.lead-response-email {
  color: var(--brick);
  border-color: #f2c4bd;
}

.lead-response-convert {
  color: #111827;
  border-color: #cbd5e1;
}

.lead-edit-panel {
  display: grid;
  gap: 12px;
}

.lead-edit-panel select:disabled,
.lead-edit-panel textarea:disabled {
  color: #667085;
  background: #f3f4f6;
  cursor: not-allowed;
}

.lead-modal-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.lead-modal-actions button {
  min-width: 128px;
  min-height: 40px;
  border-radius: 12px;
  font-weight: 900;
}

.status-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.success {
  color: #067647;
  background: #dcfce7;
}

.status-badge.warning {
  color: #92400e;
  background: #fef3c7;
}

.status-badge.danger {
  color: #991b1b;
  background: #fee2e2;
}

.status-badge.info {
  color: #075985;
  background: #e0f2fe;
}

.status-badge.neutral,
.muted-chip {
  color: #475467;
  background: #f2f4f7;
}

.muted-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.modern-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-action,
.soft-action,
.danger-icon-button {
  min-height: 36px;
  border-radius: 9px;
  gap: 7px;
  padding: 0 11px;
}

.ghost-action {
  color: #475467;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.ghost-action:hover {
  color: var(--brick);
  background: #fff;
}

.soft-action {
  color: var(--brick);
  background: #f8ece9;
}

.soft-action:hover {
  color: #fff;
  background: var(--brick);
}

.danger-icon-button {
  color: #b91c1c;
  background: #fee2e2;
}

.danger-icon-button:hover {
  color: #fff;
  background: #b91c1c;
}

.search-bar input {
  max-width: 620px;
  min-height: 46px;
  border-radius: 12px;
  border-color: #e5e7eb;
}

.modern-plan-card {
  position: relative;
  min-height: 168px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.modern-plan-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -42px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(157, 29, 24, 0.08);
}

.modern-plan-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.modern-plan-card .modern-plan-head strong {
  margin: 0;
  color: #667085;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.modern-plan-card .modern-plan-head small {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
}

.modern-plan-icon {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: var(--brick);
  background: #f8ece9;
}

.modern-plan-price {
  position: relative;
  z-index: 1;
  margin: 0 0 14px;
  color: #111827;
  font-size: 32px;
  font-weight: 950;
  line-height: 1;
}

.modern-plan-meta {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  margin-top: auto;
}

.modern-plan-meta span {
  color: #98a2b3;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.modern-plan-meta strong {
  margin: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.modern-plan-actions {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0;
  color: var(--brick);
  background: #fff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.icon-button:hover {
  color: #fff;
  background: var(--brick);
}

.icon-button.danger {
  color: #b91c1c;
}

.icon-button.danger:hover {
  color: #fff;
  background: #b91c1c;
}

.plans-grid-balanced {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  align-items: stretch;
  max-width: 860px;
}

.plans-grid-balanced .modern-plan-card {
  display: flex;
  flex-direction: column;
}

.embedded-search {
  width: min(360px, 100%);
}

.embedded-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0 13px;
  color: #111827;
  background: #fff;
}

.finance-payments-panel,
.cash-movements-panel,
.cash-history-panel {
  padding: 18px;
  margin-top: 18px;
}

.finance-payments-panel .section-title,
.cash-movements-panel .section-title,
.cash-history-panel .section-title {
  align-items: center;
  margin-bottom: 12px;
}

.cash-history-table {
  min-width: 1180px;
}

.date-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr)) auto;
  gap: 10px;
  width: min(430px, 100%);
  align-items: end;
}

.date-filter label {
  display: grid;
  gap: 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.date-filter input {
  min-height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 10px;
  color: #111827;
  background: #fff;
}

.date-filter button {
  min-height: 40px;
  border-radius: 10px;
  padding: 0 13px;
  color: #fff;
  background: var(--brick);
}

.topbar-date-card {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 0 14px;
  color: var(--brick);
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.topbar-date-card div {
  display: grid;
  min-width: 136px;
  justify-items: center;
  text-align: center;
}

.topbar-time-card div {
  min-width: 92px;
}

.cash-status-grid {
  grid-template-columns: minmax(260px, 1fr);
}

.cash-status-card {
  min-height: 132px;
}

.cash-status-card .cash-state-pill {
  position: absolute;
  right: 18px;
  top: 18px;
}

.cash-balance {
  color: #15803d;
}

.cash-balance.negative {
  color: #b91c1c;
}

.primary-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 0 15px;
  color: #fff;
  background: var(--brick);
}

.primary-action:hover {
  background: var(--brick-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-action,
.danger-soft-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 0 14px;
  font-weight: 900;
}

.secondary-action {
  color: var(--brick);
  background: #fff;
  border: 1px solid #f1d6d1;
}

.secondary-action:hover {
  color: #fff;
  background: var(--brick);
}

.danger-soft-action {
  color: #b91c1c;
  background: #fff;
  border: 1px solid #fecaca;
}

.danger-soft-action:hover {
  color: #fff;
  background: #b91c1c;
}

.backup-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
}

.backup-panel > div:first-child {
  display: flex;
  align-items: center;
  gap: 13px;
}

.backup-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  color: var(--brick);
  background: #f8ece9;
}

.backup-panel h3 {
  margin: 0;
  color: #111827;
  font-size: 17px;
}

.backup-panel p {
  max-width: 620px;
  margin: 4px 0 0;
  color: #667085;
  font-size: 13px;
}

.backup-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hidden-file-input {
  display: none;
}

.topbar-date-card div {
  display: grid;
  gap: 1px;
}

.topbar-date-card small {
  color: #98a2b3;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.topbar-date-card strong {
  color: #344054;
  font-size: 14px;
  line-height: 1.1;
}

.modern-admin-app .topbar-actions .topbar-alert-button {
  position: relative;
  width: 44px;
  min-height: 44px;
  border: 1px solid #f1d6d1;
  border-radius: 14px;
  padding: 0;
  color: var(--brick);
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.modern-admin-app .topbar-actions .topbar-alert-button span {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--brick);
  font-size: 11px;
  font-weight: 900;
}

.topbar-alert-button.active-alert svg {
  animation: alert-bell 1.2s ease-in-out infinite;
}

@keyframes alert-bell {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-7deg); }
  80% { transform: rotate(5deg); }
}

.field-error {
  display: block;
  margin-top: 7px;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 900;
}

.form-grid input.error-input {
  border-color: #ef4444;
  background: #fff5f5;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.client-form-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.inline-actions .whatsapp-action-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0 14px 0 8px;
  font-size: 13px;
  font-weight: 900;
  background: #25d366;
  color: #fff;
  border: 1px solid #25d366;
  box-shadow: 0 10px 22px rgba(37, 211, 102, 0.14);
}

.inline-actions .whatsapp-action-link span {
  color: #fff;
}

.inline-actions .whatsapp-action-link img {
  width: 26px;
  height: 26px;
  display: block;
}

.inline-actions .whatsapp-action-link:hover {
  color: #fff;
  background: #128c7e;
  border-color: #128c7e;
}

.initial-payment-box {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 0.8fr) minmax(180px, 0.8fr);
  gap: 14px;
  align-items: end;
  margin-top: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  background: #fff8f6;
}

.initial-payment-box h3 {
  margin: 0;
  color: #111827;
  font-size: 18px;
}

.initial-payment-box p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 13px;
}

.initial-payment-box label {
  display: grid;
  gap: 7px;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.initial-payment-box input,
.initial-payment-box select {
  min-height: 42px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 12px;
  color: #111827;
  background: #fff;
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.client-form-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  margin-top: 18px;
}

.client-form .client-form-actions button {
  width: 100%;
  min-height: 46px;
  margin-top: 0;
  border-radius: 12px;
}

.client-form-actions .secondary-submit {
  color: var(--brick);
  background: #fff;
  border: 1px solid #f1d6d1;
}

.client-form-actions .primary-submit {
  color: #fff;
  background: var(--brick);
  box-shadow: 0 14px 26px rgba(157, 29, 24, 0.2);
}

.client-form-actions .primary-submit:hover {
  background: var(--brick-dark);
}

.client-create-action {
  display: inline-flex;
  width: auto;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #f1d6d1;
  border-radius: 12px;
  padding: 0 14px;
  color: var(--brick);
  background: #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.07);
  font-weight: 900;
}

.client-create-action:hover {
  color: #fff;
  background: var(--brick);
  border-color: var(--brick);
  transform: translateY(-1px);
}

.cash-box-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin: 0 0 18px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #fff 0%, #fff8f6 100%);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.cash-box-name {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--brick);
  background: #f8ece9;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.cash-box-summary strong {
  display: block;
  margin-top: 12px;
  color: #15803d;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1;
}

.cash-box-summary p {
  margin: 10px 0 0;
  color: #667085;
}

.cash-state-pill {
  display: inline-flex;
  min-width: 104px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.cash-state-pill.open {
  color: #067647;
  background: #dcfce7;
}

.cash-actions-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.6fr) minmax(260px, 0.8fr);
  gap: 16px;
  margin-bottom: 18px;
}

.cash-form-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.05);
}

.cash-form-card h3 {
  margin: 0 0 16px;
  color: #111827;
  font-size: 18px;
}

.cash-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.cash-form-card label {
  display: grid;
  gap: 7px;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.cash-form-card input,
.cash-form-card select {
  min-height: 42px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 12px;
  color: #111827;
  background: #fff;
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.cash-form-card button {
  margin-top: 16px;
  min-height: 42px;
  border-radius: 10px;
  padding: 0 16px;
  color: #fff;
  background: var(--brick);
  box-shadow: 0 12px 24px rgba(157, 29, 24, 0.18);
}

.cash-form-card button:hover {
  background: var(--brick-dark);
  transform: translateY(-1px);
}

.cash-notes {
  grid-column: span 2;
}

.close-cash-card {
  align-self: start;
}

.cash-movements-table {
  margin-top: 18px;
}

.cash-movements-table .modern-table {
  min-width: 760px;
}

@media (max-width: 1100px) {
  .stat-grid,
  .modern-dashboard-charts,
  .finance-charts,
  .cash-actions-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 900px) {
  .modern-admin-app {
    grid-template-columns: 1fr;
  }

  .modern-admin-app .admin-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-radius: 0;
  }

  .modern-admin-app .sidebar-logo {
    padding: 12px 14px;
  }

  .modern-admin-app .sidebar-logo img {
    width: 190px;
  }

  .modern-sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px 12px;
    scrollbar-width: thin;
  }

  .modern-sidebar-nav .tab-button {
    width: auto;
    min-width: max-content;
    min-height: 42px;
    padding: 0 12px;
  }

  .modern-sidebar-nav .nav-icon {
    width: 28px;
    height: 28px;
    margin-right: 7px;
  }

  .modern-logout {
    margin: 0 12px 10px;
  }

  .sidebar-credit {
    margin-bottom: 12px;
  }

  .modern-admin-app .admin-topbar {
    min-height: auto;
    padding: 10px 0;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topbar-date-card {
    flex: 0 0 auto;
  }

  .stat-grid,
  .modern-dashboard-charts,
  .finance-charts,
  .compact-stats,
  .cash-actions-grid,
  .cash-form-grid,
  .initial-payment-box,
  .client-form-actions {
    grid-template-columns: 1fr;
  }

  .cash-box-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .cash-notes {
    grid-column: auto;
  }

  .modern-admin-app .admin-content {
    padding: 0 14px 24px;
  }

  .section-title,
  .finance-payments-panel .section-title,
  .cash-movements-panel .section-title,
  .cash-history-panel .section-title {
    align-items: stretch;
  }

  .header-actions,
  .backup-actions,
  .date-filter {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .backup-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .plans-grid-balanced {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 901px) and (min-height: 700px) {
  .login-shell {
    min-height: 100vh;
    padding: 0;
  }

  .login-panel {
    position: relative;
    display: block;
    width: 100%;
    min-height: 100vh;
    padding: 0;
  }

  .login-logo {
    position: absolute;
    top: 27%;
    left: 50%;
    width: clamp(590px, 43vw, 860px);
    transform: translate(-50%, -50%);
  }

  .access-form {
    position: absolute;
    top: 55%;
    left: 50%;
    width: min(540px, 36vw);
    transform: translate(-50%, -50%);
  }

  .dni-row {
    grid-template-columns: 1fr 96px;
  }

  .dni-row input,
  .dni-row .login-icon-button {
    min-height: 72px;
  }

  .login-credit {
    right: 24px;
    bottom: 18px;
  }
}

/* Admin responsive hardening */
@media (max-width: 1280px) {
  .modern-admin-app {
    grid-template-columns: 232px 1fr;
  }

  .modern-admin-app .sidebar-logo img {
    width: 208px;
  }

  .modern-sidebar-nav .tab-button {
    min-height: 44px;
    padding: 0 10px;
    font-size: 13px;
  }

  .modern-sidebar-nav .nav-icon {
    width: 30px;
    height: 30px;
    margin-right: 8px;
  }

  .modern-admin-app .admin-content {
    padding: 0 20px 28px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .modern-dashboard-charts,
  .finance-charts {
    grid-template-columns: 1fr 1fr;
  }

  .modern-dashboard-charts .plan-map-card,
  .finance-charts .wide-chart {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .modern-admin-app {
    display: block;
    min-height: 100vh;
  }

  .modern-admin-app .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  }

  .modern-admin-app .sidebar-logo {
    display: flex;
    justify-content: center;
    border-bottom: 0;
    padding: 10px 14px 6px;
  }

  .modern-admin-app .sidebar-logo img {
    width: min(210px, 52vw);
  }

  .modern-sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 8px 12px 12px;
    scrollbar-width: thin;
  }

  .modern-sidebar-nav .tab-button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    min-height: 42px;
    border-radius: 11px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .modern-sidebar-nav .nav-icon {
    width: 28px;
    height: 28px;
    margin-right: 7px;
  }

  .modern-logout {
    width: calc(100% - 24px);
    min-height: 40px;
    justify-content: center;
    margin: 0 12px 8px;
  }

  .sidebar-credit {
    margin: 0 12px 10px;
    font-size: 10px;
  }

  .modern-admin-app .admin-content {
    padding: 0 16px 24px;
  }

  .modern-admin-app .admin-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: auto;
    padding: 10px 0;
    background: rgba(243, 244, 246, 0.94);
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topbar-date-card {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 12px;
  }

  .topbar-date-card div {
    min-width: 112px;
  }

  .topbar-time-card div {
    min-width: 76px;
  }

  .modern-page {
    padding: 18px 0;
  }

  .modern-page .page-title h1 {
    font-size: clamp(26px, 6vw, 36px);
  }

  .section-title {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 12px;
  }

  .section-title > h2,
  .section-title > div {
    min-width: 0;
  }

  .header-actions,
  .backup-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .backup-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .date-filter {
    width: 100%;
    grid-template-columns: repeat(2, minmax(120px, 1fr)) auto;
  }

  .client-file-dialog,
  .admin-dialog {
    width: min(94vw, 720px);
  }

  .lead-detail-dialog {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
  }

  .lead-detail-card {
    padding: 18px;
  }

  .lead-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-workspace {
    grid-template-columns: 1fr;
  }

  .client-file-content {
    padding: 18px;
  }

  .client-file-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 720px) {
  .modern-admin-app .admin-content {
    padding: 0 12px 22px;
  }

  .modern-admin-app .sidebar-logo img {
    width: min(184px, 58vw);
  }

  .modern-sidebar-nav {
    padding-inline: 10px;
  }

  .modern-sidebar-nav .tab-button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .modern-sidebar-nav .nav-icon {
    width: 26px;
    height: 26px;
  }

  .stat-grid,
  .compact-stats,
  .modern-dashboard-charts,
  .finance-charts,
  .plans-grid,
  .plans-grid-balanced,
  .cash-actions-grid,
  .cash-form-grid,
  .form-grid,
  .initial-payment-box,
  .client-form-actions,
  .date-filter {
    grid-template-columns: 1fr;
  }

  .stat-card,
  .modern-plan-card,
  .cash-status-card {
    min-height: 132px;
    border-radius: 14px;
    padding: 16px;
  }

  .stat-card strong,
  .modern-plan-price {
    font-size: 28px;
  }

  .modern-panel,
  .finance-payments-panel,
  .cash-movements-panel,
  .cash-history-panel {
    border-radius: 14px;
    padding: 14px;
  }

  .modern-table {
    min-width: 720px;
  }

  .modern-table th {
    padding: 12px;
    font-size: 11px;
  }

  .modern-table td {
    padding: 12px;
  }

  .modern-actions {
    gap: 6px;
  }

  .ghost-action,
  .soft-action,
  .danger-icon-button {
    min-height: 34px;
    padding: 0 9px;
  }

  .client-create-action,
  .secondary-action,
  .danger-soft-action,
  .primary-action,
  .backup-actions button,
  .date-filter button {
    width: 100%;
  }

  .client-file-header {
    align-items: stretch;
    flex-direction: column;
  }

  .client-file-header h2 {
    font-size: 24px;
  }

  .client-file-grid {
    grid-template-columns: 1fr;
  }

  .lead-detail-grid {
    grid-template-columns: 1fr;
  }

  .lead-workspace {
    grid-template-columns: 1fr;
  }

  .client-file-access-list article {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .admin-dialog-content {
    border-radius: 14px;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .modern-admin-app .admin-content {
    padding: 0 10px 18px;
  }

  .modern-page {
    padding-top: 14px;
  }

  .modern-page .page-title {
    margin-bottom: 16px;
  }

  .modern-page .page-title h1 {
    font-size: 28px;
  }

  .topbar-date-card {
    padding: 0 10px;
  }

  .topbar-date-card div {
    min-width: 96px;
  }

  .topbar-date-card strong {
    font-size: 12px;
  }

  .stat-grid {
    gap: 12px;
  }

  .stat-card-header {
    margin-bottom: 12px;
  }

  .stat-icon,
  .modern-plan-icon {
    width: 36px;
    height: 36px;
  }

  .modern-table {
    min-width: 640px;
  }

  .cash-history-table {
    min-width: 1040px;
  }

  .client-file-dialog,
  .admin-dialog {
    width: calc(100vw - 18px);
  }

  .lead-detail-dialog {
    width: calc(100vw - 18px);
    max-width: calc(100vw - 18px);
  }

  .lead-detail-card {
    gap: 10px;
    padding: 14px;
  }

  .lead-modal-header {
    gap: 8px;
  }

  .lead-modal-header h2 {
    font-size: 21px;
  }

  .lead-detail-grid {
    gap: 8px;
  }

  .lead-detail-grid article,
  .lead-message-box {
    padding: 9px;
  }

  .lead-detail-card textarea {
    min-height: 86px;
  }

  .client-file-content {
    max-height: 90vh;
    padding: 14px;
  }
}

/* Final responsive pass for the admin sidebar */
@media (max-width: 1180px) {
  .modern-admin-app {
    display: block;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .modern-admin-app .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
    padding: 8px 10px;
    background: #fffdf8;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  }

  .modern-admin-app .sidebar-logo {
    min-width: 0;
    border-bottom: 0;
    padding: 0;
  }

  .modern-admin-app .sidebar-logo img {
    width: clamp(132px, 18vw, 196px);
    max-height: 58px;
    object-fit: contain;
  }

  .modern-sidebar-nav {
    min-width: 0;
    display: flex;
    gap: 8px;
    padding: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .modern-sidebar-nav .tab-button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    min-height: 42px;
    border-radius: 10px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .modern-sidebar-nav .tab-button:hover,
  .modern-sidebar-nav .tab-button.active {
    box-shadow: inset 0 -3px 0 var(--brick);
  }

  .modern-sidebar-nav .nav-icon {
    width: 28px;
    height: 28px;
    margin-right: 7px;
  }

  .modern-logout {
    width: auto;
    min-height: 42px;
    justify-content: center;
    margin: 0;
    padding: 0 14px;
    white-space: nowrap;
  }

  .sidebar-credit {
    display: none;
  }

  .modern-admin-app .admin-content {
    width: 100%;
    padding: 0 16px 26px;
  }

  .modern-admin-app .admin-topbar {
    position: sticky;
    top: 59px;
    min-height: auto;
    padding: 10px 0;
  }
}

@media (max-width: 900px) {
  .modern-admin-app .admin-sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "logo menu"
      "nav nav"
      "logout logout";
    row-gap: 8px;
    padding: 8px 10px;
  }

  .modern-admin-app .sidebar-logo {
    grid-area: logo;
  }

  .modern-admin-app .sidebar-logo img {
    width: clamp(150px, 48vw, 196px);
    max-height: 54px;
  }

  .mobile-menu-toggle {
    grid-area: menu;
    width: 44px;
    min-height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    padding: 0;
    color: #fff;
    background: var(--brick);
  }

  .mobile-menu-toggle:hover {
    background: var(--brick-dark);
  }

  .modern-sidebar-nav {
    grid-area: nav;
    width: 100%;
    display: none;
    grid-template-columns: 1fr;
    gap: 6px;
    max-height: calc(100dvh - 168px);
    overflow-y: auto;
    padding: 8px 0 2px;
    border-top: 1px solid #efe4dc;
  }

  .mobile-menu-open .modern-sidebar-nav {
    display: grid;
  }

  .modern-sidebar-nav .tab-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: flex-start;
    padding: 0 12px;
    font-size: 13px;
  }

  .modern-sidebar-nav .tab-button:hover,
  .modern-sidebar-nav .tab-button.active {
    box-shadow: inset 4px 0 0 var(--brick);
  }

  .modern-logout {
    grid-area: logout;
    width: 100%;
    min-height: 42px;
    display: none;
    gap: 8px;
    padding: 0 12px;
    color: var(--brick);
    font-size: 13px;
  }

  .mobile-menu-open .modern-logout {
    display: inline-flex;
  }

  .modern-logout span {
    display: inline;
  }

  .modern-logout svg {
    margin-right: 0;
  }

  .modern-admin-app .admin-topbar {
    top: 61px;
  }
}

/* ============================================================ */
/* Phase 2: Dark theme - Sidebar redesign                       */
/* ============================================================ */

.admin-app-body {
  background: var(--bg);
  color: var(--text);
}

.modern-admin-app {
  background: var(--bg);
}

.modern-admin-app .admin-sidebar,
.admin-sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--sidebar-bg);
  box-shadow: none;
  color: var(--text);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.32);
}

.sidebar-brand-text {
  display: grid;
  gap: 2px;
  line-height: 1;
  min-width: 0;
}

.sidebar-brand-text strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--text);
}

.sidebar-brand-text small {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-section-label {
  margin: 18px 18px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

.admin-sidebar .modern-sidebar-nav {
  flex: 0 0 auto;
  gap: 2px;
  padding: 0 10px;
}

.admin-sidebar .modern-sidebar-nav .tab-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px 0 14px;
  border: 0;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-sidebar .modern-sidebar-nav .nav-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
}

.admin-sidebar .modern-sidebar-nav .nav-label {
  flex: 1;
  color: inherit;
  text-align: left;
}

.admin-sidebar .modern-sidebar-nav .tab-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.admin-sidebar .modern-sidebar-nav .tab-button.active {
  color: var(--text);
  background: rgba(200, 16, 46, 0.12);
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-sidebar .modern-sidebar-nav .tab-button.backup-nav {
  color: var(--text-muted);
  background: transparent;
  box-shadow: none;
}

.admin-sidebar .modern-sidebar-nav .tab-button.backup-nav .nav-icon {
  color: inherit;
  background: transparent;
  border: 0;
}

.admin-sidebar .modern-sidebar-nav .tab-button.backup-nav:hover,
.admin-sidebar .modern-sidebar-nav .tab-button.backup-nav.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-badge {
  min-width: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.sidebar-user {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  margin: auto 12px 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.sidebar-user-info {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.sidebar-user-info strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: capitalize;
}

.sidebar-user-info small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.sidebar-user-logout {
  width: 32px;
  height: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.sidebar-user-logout:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}


/* ============================================================ */
/* Phase 3a: Dark theme - Panel + componentes compartidos       */
/* ============================================================ */

/* Topbar */
.modern-admin-app .admin-topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.86);
  backdrop-filter: blur(10px);
}

.modern-admin-app .topbar-actions span {
  color: var(--text);
}

.modern-admin-app .topbar-actions strong {
  color: var(--text);
}

.modern-admin-app .topbar-actions small {
  color: var(--muted);
}

.topbar-date-card,
.topbar-actions > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 12px;
  color: var(--text);
}

.modern-admin-app .topbar-actions button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.modern-admin-app .topbar-actions button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.modern-admin-app .topbar-actions .topbar-icon-action {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.topbar-alert-button {
  position: relative;
}

/* Content area */
.modern-admin-app .admin-content {
  background: var(--bg);
}

/* Tab panels: ditch the white card wrapper */
.admin-app .tab-panel,
.modern-page {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 18px 0;
}

/* Section title eyebrow + heavy title */
.admin-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.modern-page .page-title h1,
.page-title h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text);
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  margin-top: 6px;
}

.modern-page .page-title p,
.page-title p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
}

/* Section sub-titles inside tab content */
.section-title h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text);
  text-transform: uppercase;
  font-size: 22px;
}

.section-title p {
  color: var(--muted);
  font-size: 13px;
}

/* KPI / Stat cards */
.stat-card {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  color: var(--text);
}

.stat-card::after {
  background: rgba(200, 16, 46, 0.08);
}

.stat-card strong {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  letter-spacing: 0.5px;
  line-height: 1.05;
}

.stat-title {
  color: var(--muted);
}

.stat-card small {
  color: var(--muted);
}

.stat-icon {
  background: rgba(200, 16, 46, 0.12);
  color: var(--accent);
}

.stat-card.success .stat-icon {
  color: #3ab472;
  background: rgba(58, 180, 114, 0.16);
}

.stat-card.danger .stat-icon {
  color: var(--accent);
  background: rgba(200, 16, 46, 0.18);
}

.stat-card.warning .stat-icon {
  color: var(--warn);
  background: rgba(224, 144, 48, 0.16);
}

.stat-action {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--accent);
  box-shadow: none;
}

.stat-action span {
  color: inherit;
}

.stat-action:hover,
.stat-card.danger .stat-action:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Chart cards + dashboard panels */
.modern-chart-card,
.plan-map-card,
.modern-panel,
.dashboard-panel {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  color: var(--text);
}

.chart-heading h3 {
  color: var(--text);
}

.chart-heading p {
  color: var(--muted);
}

/* Plan map rows */
.plan-map-row {
  border-color: var(--border);
  background: var(--surface-2);
  box-shadow: none;
}

.plan-map-icon {
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
}

.plan-map-row strong {
  color: var(--text);
}

.plan-map-row span {
  color: var(--muted);
}

.plan-map-total {
  color: var(--accent);
}

.plan-map-summary {
  background: rgba(255, 255, 255, 0.02);
}

.plan-map-summary .plan-map-icon {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* Method breakdown / plan breakdown inside KPI cards */
.method-breakdown,
.plan-breakdown {
  border-top: 1px solid var(--border);
}

.method-breakdown span,
.plan-breakdown span {
  color: var(--text-muted);
}

.method-breakdown b,
.plan-breakdown b {
  color: var(--text-muted);
}

.method-breakdown em,
.plan-breakdown em,
.plan-breakdown b {
  color: var(--text);
}

.plan-breakdown small {
  color: var(--muted);
}

/* Modern-table base styling for dark */
.modern-table-wrap {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
}

.modern-table th {
  background: var(--surface-2);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.modern-table td {
  border-bottom-color: var(--border);
  color: var(--text);
}

.modern-table td strong {
  color: var(--text);
}

.modern-table tbody tr:hover {
  background: rgba(200, 16, 46, 0.06);
}

/* Search bar inside dark tabs */
.search-bar input {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.search-bar input::placeholder {
  color: var(--muted);
}

/* Pagination buttons */
.pagination button {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.pagination button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination button:disabled {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
  opacity: 0.4;
}

/* Old-style report-cards (in case any panel still uses them) */
.admin-app .report-cards article,
.admin-app .chart-card,
.admin-app .top-clients article,
.admin-app .event {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.admin-app .report-cards strong,
.admin-app .event strong,
.admin-app .top-clients strong {
  color: var(--text);
}


/* ============================================================ */
/* Phase 3a tightening: densidad + KPIs compactos               */
/* ============================================================ */

/* Page title: menos espacio vertical */
.modern-page .page-title {
  margin: 2px 0 14px;
}

.modern-page .page-title h1,
.page-title h1 {
  font-size: clamp(28px, 3vw, 40px);
  margin-top: 4px;
}

.modern-page .page-title p,
.page-title p {
  margin-top: 4px;
}

/* Wrapper de tab panel: menos padding vertical */
.modern-page {
  padding: 12px 0;
}

/* Stat grid: gaps mas chicos */
.stat-grid {
  gap: 12px;
  margin: 12px 0;
}

/* Stat cards compactas */
.stat-card {
  min-height: 108px;
  padding: 14px 16px;
}

.stat-card::after {
  display: none;
}

.stat-card-header {
  margin-bottom: 8px;
  gap: 8px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.stat-icon svg {
  width: 16px;
  height: 16px;
}

.stat-title {
  font-size: 11px;
  letter-spacing: 1.4px;
}

.stat-card strong {
  font-size: 32px;
}

.stat-card small {
  margin-top: 4px;
  font-size: 11px;
}

.stat-action {
  min-height: 28px;
  min-width: 108px;
  right: 14px;
  bottom: 14px;
  font-size: 11px;
}

/* Dashboard charts: gaps mas chicos + cards menos altas */
.modern-dashboard-charts,
.finance-charts {
  gap: 12px;
  margin: 12px 0;
}

.modern-chart-card {
  padding: 14px 14px 6px;
}

.apex-chart {
  min-height: 200px;
}

.chart-heading {
  margin-bottom: 6px;
}

.chart-heading h3 {
  font-size: 15px;
}

.chart-heading p {
  font-size: 12px;
}

/* Plan map card mas compacto */
.plan-map-card {
  padding: 14px;
}

.plan-map-list {
  margin-top: 10px;
}

.plan-map-row {
  min-height: 56px;
  padding: 10px;
  grid-template-columns: 36px 1fr auto;
}

.plan-map-icon {
  width: 36px;
  height: 36px;
}

.plan-map-icon svg {
  width: 16px;
  height: 16px;
}

.plan-map-total {
  font-size: 20px;
}

/* Modern panel (Proximos vencimientos) tighter */
.modern-panel {
  padding: 14px;
  margin-top: 12px;
}


/* ============================================================ */
/* Phase 3b: Clientes - form, buttons, dialogs (dark)          */
/* ============================================================ */

/* Form inputs/select/textarea scoped al admin (no toca el kiosko) */
.admin-app input,
.admin-app select,
.admin-app textarea {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.admin-app input::placeholder,
.admin-app textarea::placeholder {
  color: var(--muted);
}

.admin-app input:focus,
.admin-app select:focus,
.admin-app textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.18);
}

/* Date inputs picker icon (Chrome dark) */
.admin-app input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* Form grid labels */
.admin-app .form-grid label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.admin-app .form-grid input,
.admin-app .form-grid select {
  margin-top: 6px;
  text-transform: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

/* Checkbox row */
.admin-app .checkbox-row {
  color: var(--text);
  text-transform: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.admin-app .checkbox-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  min-height: 16px;
  height: 16px;
}

/* Error states */
.admin-app .form-grid label.has-error {
  color: var(--accent);
}

.admin-app .form-grid input.error-input {
  border-color: var(--accent);
  background: rgba(200, 16, 46, 0.06);
}

.field-error {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}

/* Initial payment box (inside add-client form) */
.initial-payment-box {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.initial-payment-box h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: 1px;
  font-size: 15px;
  text-transform: uppercase;
}

.initial-payment-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.initial-payment-box label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Form action buttons */
.client-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.client-form-actions button {
  flex: 1;
  min-height: 46px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 13px;
}

.primary-submit {
  background: var(--accent);
  color: #fff;
  border: 0;
  box-shadow: 0 8px 22px rgba(200, 16, 46, 0.32);
}

.primary-submit:hover:not(:disabled) {
  background: var(--accent-dim);
}

.primary-submit:disabled {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-submit {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-submit:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.secondary-submit:disabled {
  color: var(--muted);
  border-color: var(--border);
  cursor: not-allowed;
}

/* Form message */
.admin-app .form-message {
  color: var(--text);
}

.admin-app .form-message.success {
  color: #3ab472;
}

.admin-app .form-message.error {
  color: var(--accent);
}

/* Header actions row (Clientes tab top) */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.secondary-action:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.client-create-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.3);
}

.client-create-action:hover {
  background: var(--accent-dim);
}

/* Table row actions */
.modern-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.admin-app .ghost-action,
.admin-app .danger-icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
}

.admin-app .ghost-action:hover,
.admin-app .danger-icon-button:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.admin-app .soft-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.24);
}

.admin-app .soft-action:hover {
  background: var(--accent-dim);
}

/* StatusBadge / status-pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.status-pill.warning {
  background: rgba(224, 144, 48, 0.18);
  color: var(--warn);
}

.status-pill.danger,
.status-pill.expired {
  background: rgba(200, 16, 46, 0.18);
  color: var(--accent);
}

.status-pill.success {
  background: rgba(58, 180, 114, 0.18);
  color: var(--ok);
}

.status-pill.neutral,
.status-pill.inactive {
  background: var(--surface-2);
  color: var(--muted);
}

/* days-warning pills */
.days-warning {
  color: var(--muted);
  background: var(--surface-2);
}

.days-warning.expiring {
  background: rgba(224, 144, 48, 0.18);
  color: var(--warn);
}

.days-warning.overdue {
  background: rgba(200, 16, 46, 0.22);
  color: #fff;
}

.days-warning.grace-active {
  background: rgba(58, 180, 114, 0.16);
  color: var(--ok);
}

/* Icon close button (formularios y dialogs) */
.icon-close-button {
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
}

.icon-close-button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Admin dialog (charge/grace/confirm modals) */
.admin-dialog-content {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

.admin-dialog-content h2 {
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.admin-dialog-content label {
  color: var(--muted);
}

.admin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.confirm-action-detail {
  border-color: rgba(200, 16, 46, 0.35);
  background: rgba(200, 16, 46, 0.1);
  color: #fff;
}

/* Client file dialog (ficha completa modal) */
.client-file-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.client-file-content {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.client-file-header {
  border-color: var(--border);
  background: var(--surface-2);
}

.client-file-header h2 {
  color: var(--text);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.client-file-header p {
  color: var(--muted);
}

.client-file-grid article {
  border-color: var(--border);
  background: var(--surface-2);
}

.client-file-grid strong {
  color: var(--muted);
}

.client-file-grid span {
  color: var(--text);
}

.client-file-icon {
  background: rgba(200, 16, 46, 0.15);
  color: var(--accent);
}

.client-file-section {
  border-color: var(--border);
  background: var(--surface-2);
}

.client-file-section h3 {
  color: var(--text);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.client-file-access-list article {
  border-color: var(--border);
  background: var(--surface);
}

.client-file-access-list strong {
  color: var(--text);
}

.client-file-access-list span {
  color: var(--muted);
}

/* Danger button */
.admin-app .danger-button {
  background: var(--accent-dim);
  color: #fff;
}

.admin-app .danger-button:hover {
  background: var(--accent);
}

/* Grace cell small (dialog content) */
.grace-cell small {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

/* ============================================================ */
/* Focusing-level polish refinement                              */
/* (fonts, radius, status dots, pill buttons, mono numbers,      */
/*  kicker pattern, softer shadows)                              */
/* ============================================================ */

/* ---------- A: Fonts (Plus Jakarta + JetBrains Mono) ---------- */
:root {
  --font-body: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

body,
.admin-app,
.admin-app-body {
  font-family: var(--font-body);
  letter-spacing: -0.005em;
}

/* ---------- B: Refined radius across cards ---------- */
.stat-card,
.modern-chart-card,
.plan-map-card,
.modern-panel,
.dashboard-panel,
.client-file-content,
.client-file-header,
.client-file-grid article,
.client-file-section,
.client-file-access-list article,
.modern-table-wrap,
.initial-payment-box,
.admin-dialog-content {
  border-radius: 16px;
}

.admin-app input,
.admin-app select,
.admin-app textarea {
  border-radius: 10px;
}

/* ---------- D: Refined buttons (pills, tighter type) ---------- */
.primary-submit,
.client-create-action,
.admin-app .soft-action,
.secondary-submit,
.secondary-action {
  border-radius: 999px;
  letter-spacing: 0.2px;
  font-weight: 700;
}

.admin-app .ghost-action,
.admin-app .danger-icon-button {
  border-radius: 9px;
  transition: all 0.18s ease;
}

.admin-app .topbar-actions button,
.modern-admin-app .topbar-actions .topbar-icon-action {
  border-radius: 999px;
}

/* ---------- C: Status as dot + mono label ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: auto;
  height: auto;
  padding: 0;
  background: transparent !important;
  color: var(--text-muted) !important;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 0;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 8px;
}

.status-pill.warning {
  color: var(--warn) !important;
}

.status-pill.danger,
.status-pill.expired {
  color: var(--accent) !important;
}

.status-pill.success {
  color: #3ab472 !important;
}

.status-pill.neutral,
.status-pill.inactive {
  color: var(--muted) !important;
}

/* ---------- F: Softer shadows + breathing room ---------- */
.stat-card,
.modern-chart-card,
.plan-map-card,
.modern-panel,
.dashboard-panel,
.modern-table-wrap {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.32);
}

.stat-card {
  padding: 16px 18px;
}

.modern-chart-card,
.plan-map-card,
.modern-panel,
.dashboard-panel {
  padding: 18px;
}

/* Subtle accent border on hover (no movement) */
.stat-card,
.modern-chart-card {
  transition: border-color 0.18s ease;
}

.stat-card:hover,
.modern-chart-card:hover {
  border-color: rgba(200, 16, 46, 0.32);
}

/* ---------- Kicker pattern (eyebrow + title + body) ---------- */
.admin-kicker,
.section-kicker {
  display: inline-block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Big H1 titles: tight letter-spacing instead of wide */
.modern-page .page-title h1,
.page-title h1 {
  letter-spacing: -0.01em;
}

/* Section titles (h2 inside .section-title) tighter */
.section-title h2 {
  letter-spacing: 0.4px;
}

/* ---------- E: Mono for numbers (DNI, codes, tabular data) ---------- */
.font-mono,
.mono {
  font-family: var(--font-mono);
  letter-spacing: 0;
}

/* Table secondary spans (DNI/code lines under names): mono small */
.modern-table td strong + br + span,
.modern-table td > span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--muted);
}

/* Table headers: mono micro-caps */
.modern-table th {
  font-family: var(--font-mono);
  letter-spacing: 1.2px;
  font-size: 10.5px;
  text-transform: uppercase;
  padding: 14px 16px;
}

/* Table cells slightly tighter */
.modern-table td {
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Stat title in mono (acts as kicker) */
.stat-title {
  font-family: var(--font-mono);
  letter-spacing: 1.4px;
  font-size: 10.5px;
}

/* Stat big number: keep Oswald, tighter spacing */
.stat-card strong {
  letter-spacing: -0.02em;
}

/* Plan map total in Oswald (already is) - keep */

/* Search bar refined */
.search-bar input {
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
}

/* ---------- Sidebar refinements ---------- */

.sidebar-brand-text strong {
  letter-spacing: 3px;
  font-weight: 700;
}

.sidebar-brand-text small {
  font-family: var(--font-mono);
  letter-spacing: 1.8px;
  font-size: 8.5px;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.8px;
}

.nav-badge {
  font-family: var(--font-mono);
  letter-spacing: 0;
  min-width: 20px;
  height: 18px;
  font-size: 10px;
  border-radius: 999px;
  font-weight: 700;
}

.sidebar-user-avatar {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-user-info strong {
  letter-spacing: 0;
}

.sidebar-user-info small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

/* ---------- Topbar widgets refinement ---------- */

.topbar-date-card,
.topbar-actions > div {
  border-radius: 14px;
  padding: 8px 14px;
}

.topbar-date-card small,
.topbar-actions small {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.topbar-date-card strong,
.topbar-actions strong {
  letter-spacing: -0.005em;
}

/* ---------- Plan map row refinement ---------- */

.plan-map-total {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.plan-map-row span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3px;
}

/* ---------- Form refinement ---------- */

.admin-app .form-grid label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
}

.admin-app .form-grid input,
.admin-app .form-grid select {
  font-family: var(--font-body);
  font-weight: 500;
}

.initial-payment-box h3 {
  letter-spacing: 0.4px;
}

.initial-payment-box p {
  font-family: var(--font-body);
}

.initial-payment-box label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
}

/* Action buttons tighter typography */
.client-form-actions button {
  letter-spacing: 0.4px;
  font-size: 12px;
}

/* Secondary buttons typography */
.secondary-action,
.client-create-action {
  font-size: 12px;
  letter-spacing: 0.3px;
}

/* ---------- Soft tinted hover for table rows ---------- */
.modern-table tbody tr {
  transition: background 0.15s ease;
}

.modern-table tbody tr:hover {
  background: rgba(200, 16, 46, 0.04);
}

/* ---------- Stat-action button refinement ---------- */
.stat-action {
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
}

/* ---------- Form messages refined ---------- */
.admin-app .form-message {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
}

/* ---------- Chart heading refinement ---------- */
.chart-heading h3 {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 15px;
}

.chart-heading p {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

/* ============================================================ */
/* Phase 3c: Vencimientos - 4 buckets agrupados                  */
/* ============================================================ */

.expiring-sections {
  display: grid;
  gap: 22px;
  margin-top: 8px;
}

.expiring-bucket {
  display: grid;
  gap: 12px;
}

.bucket-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.bucket-header > div {
  display: grid;
  gap: 2px;
}

.bucket-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.bucket-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text);
}

.bucket-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

/* Bucket-specific accents on kicker color */
.bucket-overdue .bucket-kicker {
  color: var(--accent);
}

.bucket-overdue .bucket-count {
  background: rgba(200, 16, 46, 0.18);
  color: var(--accent);
}

.bucket-overdue .bucket-header {
  border-bottom-color: rgba(200, 16, 46, 0.22);
}

.bucket-soon .bucket-kicker {
  color: var(--warn);
}

.bucket-soon .bucket-count {
  background: rgba(224, 144, 48, 0.18);
  color: var(--warn);
}

.bucket-soon .bucket-header {
  border-bottom-color: rgba(224, 144, 48, 0.22);
}

.bucket-week .bucket-kicker {
  color: #f5f5f5;
}

.bucket-fortnight .bucket-kicker {
  color: var(--muted);
}

/* Empty state */
.empty-bucket {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.empty-bucket p {
  margin: 0;
  font-size: 13px;
}

/* Accesos sub-panel (existing inside vencimientos tab) */
.access-in-expiring-panel {
  margin-top: 24px;
}

.access-in-expiring-panel .filter-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: end;
  margin: 8px 0 16px;
}

.events {
  display: grid;
  gap: 10px;
}

.event {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: 12px;
  background: var(--surface-2);
}

.event.granted {
  border-left-color: var(--ok);
}

.event.denied {
  border-left-color: var(--accent);
}

.event strong {
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.event span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.event small {
  color: var(--muted);
  font-size: 11px;
}

/* ============================================================ */
/* Fixes: ghost-action labeled, dialog inputs, h2 tipo aliviar  */
/* ============================================================ */

/* Fix 1: ghost-action labeled (el de "Prorroga" en tabla) */
/* La rule de Phase 3b forzaba 32x32. Cuando tiene .labeled,    */
/* debe ser auto-width con padding para que entre el texto.    */
.admin-app .ghost-action.labeled {
  width: auto;
  min-width: auto;
  padding: 0 12px;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.admin-app .ghost-action.labeled:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* Fix 2: dialog inputs (graceDialog y otros) viven fuera de .admin-app */
/* asi que el selector .admin-app input no los pega. Apuntamos a dialog */
/* directamente. */
dialog input,
dialog select,
dialog textarea,
.admin-dialog input,
.admin-dialog select,
.admin-dialog textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
}

dialog input::placeholder,
dialog textarea::placeholder,
.admin-dialog input::placeholder,
.admin-dialog textarea::placeholder {
  color: var(--muted);
}

dialog input:focus,
dialog select:focus,
dialog textarea:focus,
.admin-dialog input:focus,
.admin-dialog select:focus,
.admin-dialog textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.18);
}

dialog input[type="date"]::-webkit-calendar-picker-indicator,
.admin-dialog input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* Buttons inside dialogs */
.admin-dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.admin-dialog .dialog-actions button {
  min-height: 40px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 13px;
}

.admin-dialog .dialog-actions button[type="button"] {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.admin-dialog .dialog-actions button[type="button"]:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.admin-dialog .dialog-actions button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: 0;
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.3);
}

.admin-dialog .dialog-actions button[type="submit"]:hover {
  background: var(--accent-dim);
}

/* Fix 3: h2 menos pesados (no Oswald uppercase) */
/* h1 page-title se queda Oswald uppercase como ya esta. */
/* Solo aligeramos los h2 de bucket-header, section-title y dialogs.    */
.bucket-header h2,
.section-title h2,
.admin-dialog-content h2 {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
  line-height: 1.2;
}

/* Para hierarchy: secciones internas (h2 dentro de modal panel o card) */
.modern-panel .section-title h2,
.access-in-expiring-panel .section-title h2 {
  font-size: 17px;
}

/* Sub-section h3 inside modals (Cobro inicial, etc) tambien Plus Jakarta */
.initial-payment-box h3,
.client-file-section h3 {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: -0.005em;
  text-transform: none;
  font-size: 14px;
}

/* Client-file dialog h2 (ficha de cliente) */
.client-file-header h2 {
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: -0.015em;
  text-transform: none;
  font-size: 22px;
}

/* ============================================================ */
/* Fixes-2: prorroga icon, h1 lighter, global stroke-width icons */
/* ============================================================ */

/* Fix Prorroga button (estaba gridded → texto + icono apilados) */
.admin-app .ghost-action.labeled {
  width: auto;
  min-width: auto;
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.admin-app .ghost-action.labeled:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* Aplica tambien a otras botones labeled si quedaran rotos */
.admin-app .danger-icon-button.labeled {
  width: auto;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  white-space: nowrap;
}

/* ============================================================ */
/* H1 + big numbers: Plus Jakarta Sans (no Oswald uppercase)    */
/* Solo el brand "HERCULES" del sidebar se queda Oswald          */
/* ============================================================ */

.modern-page .page-title h1,
.page-title h1 {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.022em;
  text-transform: none;
  line-height: 1.05;
}

/* Stat card big numbers: Plus Jakarta 800 (no mas Oswald) */
.stat-card strong {
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: -0.025em;
  font-size: 32px;
}

/* Plan-map-total: tambien Plus Jakarta */
.plan-map-total {
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Section title eyebrow (admin-kicker) ya esta en mono uppercase, se queda */

/* ============================================================ */
/* Icons: stroke-width fino globalmente (estilo Focusing)        */
/* ============================================================ */

.admin-app svg,
.admin-sidebar svg,
.admin-dialog svg {
  stroke-width: 1.5;
}

/* Excepciones donde el grueso es intencional: */
.sidebar-brand-mark svg {
  stroke-width: 2.4;
}

/* Iconos de status (granted/denied check icons) pueden quedar mas gruesos */
.dialog-status-icon svg {
  stroke-width: 2;
}

/* ============================================================ */
/* Fixes-3: icon containers neutrales + fuente explícita botones */
/* ============================================================ */

/* Forzar Plus Jakarta en todos los elementos interactivos */
.admin-app button,
.admin-app .button-link,
.admin-app input,
.admin-app select,
.admin-app textarea,
.admin-dialog button,
.admin-dialog input,
.admin-dialog select,
.admin-dialog textarea {
  font-family: var(--font-body);
}

/* También aplica a botones fuera del .admin-app (dialogs etc) */
dialog button,
dialog input,
dialog select,
dialog textarea {
  font-family: var(--font-body);
}

/* Excepción: botones que intencionalmente usan mono (stat-action) */
.stat-action {
  font-family: var(--font-mono);
}

/* ============================================================ */
/* Icon containers NEUTRALES (estilo Focusing)                  */
/* Solo .stat-icon mantiene color semántico por variant         */
/* ============================================================ */

/* Ficha de cliente: iconos en gris muy sutil con border */
.client-file-icon {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Mapa de planes: iconos también neutros */
.plan-map-icon {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Excepción: la fila "summary" del Mapa de planes (Plan principal) */
.plan-map-summary .plan-map-icon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Brand mark del sidebar mantiene rojo (es THE brand) */
.sidebar-brand-mark {
  background: var(--accent);
  color: #fff;
  border: 0;
}

/* Avatar del usuario también rojo (identidad) */
.sidebar-user-avatar {
  background: var(--accent);
  color: #fff;
  border: 0;
}

/* Stat-icon mantiene su color por variant (success/danger/warning) */
/* Ya esta definido en Phase 3a, no se toca */

/* ============================================================ */
/* Close button (X) más pulido en client-file dialog            */
/* ============================================================ */

.icon-close-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  padding: 0;
  font-family: var(--font-body);
}

.icon-close-button:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ============================================================ */
/* Refinamiento extra: ensure cards no tengan border heredado     */
/* y tipografía coherente                                         */
/* ============================================================ */

.client-file-grid article,
.client-file-section,
.client-file-access-list article {
  border: 1px solid var(--border);
}

/* "FICHA DIGITAL" kicker más Focusing-style */
.client-file-header {
  position: relative;
}

/* Status pill del header de ficha "PAGADA" - mantiene estilo dot+label */
.client-file-header .status-pill {
  margin-left: auto;
}

/* ============================================================ */
/* Fixes-4: ficha de cliente sin iconos genericos + X button    */
/* ============================================================ */

/* Ocultar los iconos genericos en la ficha (estilo data card    */
/* Focusing: solo kicker + value, sin icon containers)            */
.client-file-grid .client-file-icon {
  display: none;
}

/* Restructurar las cards de la ficha: padding uniforme, sin     */
/* espacio reservado para icono que ya no existe                  */
.client-file-grid article {
  position: relative;
  min-height: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: none;
  display: grid;
  gap: 0;
}

/* Kicker (label "PLAN", "CUOTA PAGA HASTA", etc.) en mono caps */
.client-file-grid article > div > strong,
.client-file-grid article strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

/* Value (la data en si) en body font bold */
.client-file-grid article > div > span,
.client-file-grid article span {
  display: block;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

/* X close button del client-file-dialog (.dialog-close)         */
/* Estaba con estilos viejos casi invisible                       */
.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  font-family: var(--font-body);
  cursor: pointer;
}

.dialog-close:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* Tambien el contenedor de client-file: mas respiro + posicion  */
/* relativa para que la X quede bien posicionada                  */
.client-file-content {
  position: relative;
  padding: 28px;
}

/* Header de la ficha: arreglar gap y alineacion del status pill */
.client-file-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
}

.client-file-header > div:first-child {
  display: grid;
  gap: 4px;
}

/* "FICHA DIGITAL" kicker dentro del header */
.client-file-header .admin-kicker {
  display: block;
  margin-bottom: 6px;
}

/* H2 nombre del cliente */
.client-file-header h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--text);
}

/* DNI subline */
.client-file-header p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--muted);
}

/* Mas density en el access list (ultimas asistencias) */
.client-file-access-list article {
  padding: 10px 12px;
  border-radius: 10px;
}

/* ============================================================ */
/* Fixes-5: X z-index, status-badge styling, generic button font*/
/* ============================================================ */

/* X close: z-index alto para que no quede atras del status pill   */
/* del header, y un toquecito mas afuera para no chocar visualmente*/
.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 100;
}

/* StatusBadge component renderiza .status-badge (con guion), NO  */
/* .status-pill. Aplicamos el mismo patron dot+label.              */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 0;
  border-radius: 0;
  min-height: auto;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 8px;
}

.status-badge.success {
  color: #3ab472;
}

.status-badge.warning {
  color: var(--warn);
}

.status-badge.danger,
.status-badge.expired {
  color: var(--accent);
}

.status-badge.info {
  color: #4a9eff;
}

.status-badge.neutral,
.status-badge.inactive {
  color: var(--muted);
}

/* ============================================================ */
/* Force Plus Jakarta en TODOS los buttons (con !important)      */
/* El "Filtrar" plano y otros buttons sin clase no estaban       */
/* recibiendo Plus Jakarta por jerarquia de specificity.          */
/* ============================================================ */

button,
input,
select,
textarea,
.button-link {
  font-family: var(--font-body) !important;
}

/* Conservar mono solo donde es intencional */
.stat-action,
.nav-badge,
.bucket-count,
.sidebar-user-avatar {
  font-family: var(--font-mono) !important;
}

/* ============================================================ */
/* Botones genericos (sin clase) - estilo refinado               */
/* El <button type="submit"> del filter-bar Filtrar, etc.        */
/* ============================================================ */

.filter-bar button {
  min-height: 40px;
  border-radius: 999px;
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.28);
  cursor: pointer;
}

.filter-bar button:hover {
  background: var(--accent-dim);
}

/* ============================================================ */
/* Fixes-6: status pills filled + ficha mas Hercules + X roja   */
/* ============================================================ */

/* Status badges/pills: pills FILLED con bg semantico y texto bco */
/* Reemplazan el patron dot+label (que se veia poco visible)       */

.status-badge,
.status-pill {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 4px 12px !important;
  border-radius: 999px !important;
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 0 !important;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  min-height: auto;
}

/* Sin dot pseudo-element (vuelvo a pill simple) */
.status-badge::before,
.status-pill::before {
  display: none !important;
  content: none !important;
}

.status-badge.success,
.status-pill.success {
  background: rgba(58, 180, 114, 0.22) !important;
  color: #5fd393 !important;
}

.status-badge.warning,
.status-pill.warning {
  background: rgba(224, 144, 48, 0.22) !important;
  color: #f0a955 !important;
}

.status-badge.danger,
.status-badge.expired,
.status-pill.danger,
.status-pill.expired {
  background: rgba(200, 16, 46, 0.22) !important;
  color: #f55a72 !important;
}

.status-badge.info,
.status-pill.info {
  background: rgba(74, 158, 255, 0.22) !important;
  color: #7ab8ff !important;
}

.status-badge.neutral,
.status-badge.inactive,
.status-pill.neutral,
.status-pill.inactive {
  background: var(--surface-2) !important;
  color: var(--muted) !important;
}

/* ============================================================ */
/* X close button: roja, llena, al frente                        */
/* ============================================================ */

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.32);
}

.dialog-close:hover {
  background: var(--accent-dim);
}

/* Tambien aplicamos al .icon-close-button por consistencia */
.icon-close-button {
  background: var(--accent);
  color: #fff;
  border: 0;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.32);
}

.icon-close-button:hover {
  background: var(--accent-dim);
  color: #fff;
}

/* ============================================================ */
/* Ficha de cliente: reactivar iconos con tint rojo Hercules     */
/* ============================================================ */

.client-file-grid .client-file-icon {
  display: inline-grid !important;
  width: 36px;
  height: 36px;
  place-items: center;
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
  border-radius: 10px;
}

/* Restructurar la card de la ficha para acomodar el icono   */
.client-file-grid article {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  min-height: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: none;
}

.client-file-grid article > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

/* Kicker dentro del article */
.client-file-grid article strong {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

/* Value dentro del article */
.client-file-grid article span:not(.client-file-icon) {
  display: block;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

/* Header de la ficha tambien con tint rojo en bg */
.client-file-header {
  background: rgba(200, 16, 46, 0.06);
  border: 1px solid rgba(200, 16, 46, 0.18);
  border-radius: 14px;
}

/* Tambien el plan-map-icon: tint rojo (vuelta a Hercules) */
.plan-map-icon {
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.22);
}

.plan-map-summary .plan-map-icon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ============================================================ */
/* Fixes-7: iconos de la ficha a la DERECHA, no superpuestos    */
/* ============================================================ */

/* Reset del position absolute heredado del CSS original.        */
/* Mando los iconos a la derecha de la card con order: 2.        */
.client-file-grid .client-file-icon {
  display: inline-grid !important;
  position: static !important;
  transform: none !important;
  left: auto !important;
  top: auto !important;
  order: 2;
  width: 36px;
  height: 36px;
  place-items: center;
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
  border-radius: 10px;
  flex: 0 0 36px;
}

/* La card sin position relative (ya no necesita) y con grid:   */
/* data a la izquierda, icono a la derecha                       */
.client-file-grid article {
  position: static;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: none;
  min-height: 0;
}

.client-file-grid article > div {
  order: 1;
  min-width: 0;
}

/* ============================================================ */
/* Fixes-8: stat-icon estilo ficha + kicker FICHA DIGITAL rojo  */
/* ============================================================ */

/* Stat-icon (KPI cards) con mismo treatment que client-file-icon: */
/* 36x36, border-radius 10, border 1px tint matching color         */

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
  display: inline-grid;
  place-items: center;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

/* Variant: success (verde - INGRESOS) */
.stat-card.success .stat-icon {
  color: #3ab472;
  background: rgba(58, 180, 114, 0.16);
  border-color: rgba(58, 180, 114, 0.28);
}

/* Variant: danger (rojo - VENCIDAS) */
.stat-card.danger .stat-icon {
  color: var(--accent);
  background: rgba(200, 16, 46, 0.18);
  border-color: rgba(200, 16, 46, 0.32);
}

/* Variant: warning (naranja - PRORROGAS) */
.stat-card.warning .stat-icon {
  color: var(--warn);
  background: rgba(224, 144, 48, 0.16);
  border-color: rgba(224, 144, 48, 0.30);
}

/* Default sin variant (ej. ALUMNOS): mantiene el tint rojo de   */
/* arriba, neutro pero con paleta brand                           */

/* ============================================================ */
/* "FICHA DIGITAL" kicker en rojo (override solo para ese)       */
/* ============================================================ */

.client-file-header .admin-kicker {
  color: var(--accent);
}

/* ============================================================ */
/* Fixes-9: stat-icons todos en tint rojo (igual que ficha)     */
/* Sin variantes semanticas de color en los iconos              */
/* ============================================================ */

/* Override de las variantes: todos iguales en tint rojo */
.stat-card .stat-icon,
.stat-card.success .stat-icon,
.stat-card.danger .stat-icon,
.stat-card.warning .stat-icon {
  color: var(--accent);
  background: rgba(200, 16, 46, 0.14);
  border-color: rgba(200, 16, 46, 0.24);
}

/* ============================================================ */
/* Fixes-10: plan-map summary icon red, date-filter button pill */
/* ============================================================ */

/* Override del summary card del mapa de planes: ahora tambien   */
/* en tint rojo (estaba como neutro gris)                        */
.plan-map-summary .plan-map-icon {
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
}

/* Date-filter button (form de Registro de pagos en Caja)        */
/* Aplicar el mismo pill style que .filter-bar button            */
.date-filter button {
  min-height: 40px;
  border-radius: 999px;
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.28);
  cursor: pointer;
}

.date-filter button:hover {
  background: var(--accent-dim);
}

/* Tambien el form en si tenga buen layout */
.date-filter {
  display: flex;
  align-items: end;
  gap: 10px;
}

.date-filter label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================ */
/* Fixes-11: plan-map-icon = stat-icon (mismo treatment)         */
/* ============================================================ */

.plan-map-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
  display: inline-grid;
  place-items: center;
}

.plan-map-icon svg {
  width: 18px;
  height: 18px;
}

/* Summary card del mapa de planes igual */
.plan-map-summary .plan-map-icon {
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
}

/* ============================================================ */
/* Fixes-12: plan-map-row mas respiro, icono mismo feel que KPI */
/* ============================================================ */

.plan-map-row {
  min-height: 72px !important;
  padding: 14px 16px !important;
  grid-template-columns: 40px 1fr auto !important;
  gap: 14px;
}

.plan-map-icon {
  width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
  background: rgba(200, 16, 46, 0.14) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(200, 16, 46, 0.24) !important;
  display: inline-grid !important;
  place-items: center !important;
}

.plan-map-icon svg {
  width: 19px !important;
  height: 19px !important;
}

/* Summary también */
.plan-map-summary .plan-map-icon {
  background: rgba(200, 16, 46, 0.14) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(200, 16, 46, 0.24) !important;
}

/* ============================================================ */
/* Fixes-13: topbar estilo Hercules (date/hora cards + buttons) */
/* ============================================================ */

/* Override de los colores LIGHT-THEME viejos                    */
.topbar-date-card small,
.topbar-actions small {
  color: var(--muted) !important;
  font-family: var(--font-mono);
  font-size: 9.5px !important;
  font-weight: 600 !important;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.topbar-date-card strong,
.topbar-actions strong {
  color: var(--text) !important;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

/* Container de las cards date/time: dark surface */
.topbar-date-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  padding: 8px 14px !important;
  color: var(--text);
}

.topbar-date-card svg {
  color: var(--accent);
  stroke-width: 2;
}

/* Botones de notificacion (clipboard + bell): dark themed       */
.modern-admin-app .topbar-actions .topbar-alert-button,
.topbar-alert-button {
  position: relative;
  width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  color: var(--accent) !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: all 0.18s ease;
}

.modern-admin-app .topbar-actions .topbar-alert-button:hover,
.topbar-alert-button:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.modern-admin-app .topbar-actions .topbar-alert-button svg,
.topbar-alert-button svg {
  color: inherit;
  stroke-width: 2;
}

/* Badge contador del button (counts de leads/alerts) */
.modern-admin-app .topbar-actions .topbar-alert-button span,
.topbar-alert-button span {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  border: 2px solid var(--bg);
}

/* Cuando hay alertas, el icono palpita (animacion existente) */
.topbar-alert-button.active-alert {
  border-color: var(--accent) !important;
}

/* ============================================================ */
/* Fixes-14: alinear alturas sidebar/topbar + HERCULES tighter  */
/* ============================================================ */

/* HERCULES brand: letter-spacing mas tight (estaba en 3px      */
/* haciendolo demasiado ancho)                                   */
.sidebar-brand-text strong {
  letter-spacing: 1.2px !important;
  font-size: 20px;
}

.sidebar-brand-text small {
  letter-spacing: 1.4px;
  font-size: 8px;
}

/* Alinear altura del sidebar-brand con el topbar               */
.sidebar-brand {
  padding: 14px 16px !important;
  min-height: 66px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-mark {
  width: 38px !important;
  height: 38px !important;
}

.modern-admin-app .admin-topbar {
  min-height: 66px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================ */
/* Fixes-15: topbar opaco + altura exacta sidebar+topbar + brand */
/* ============================================================ */

/* HERCULES: Oswald weight 500 (no 700), tighter letter-spacing */
.sidebar-brand-text strong {
  font-family: var(--font-display);
  font-weight: 500 !important;
  font-size: 19px !important;
  letter-spacing: 0.8px !important;
  color: var(--text);
}

.sidebar-brand-text small {
  font-family: var(--font-mono);
  font-size: 8px !important;
  letter-spacing: 1.6px !important;
  color: var(--muted);
}

/* Altura EXACTA matching: sidebar-brand y topbar ambos 76px    */
.sidebar-brand {
  height: 76px !important;
  min-height: 76px !important;
  display: flex;
  align-items: center;
  padding: 0 18px !important;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.sidebar-brand-mark {
  width: 40px !important;
  height: 40px !important;
}

.modern-admin-app .admin-topbar {
  height: 76px !important;
  min-height: 76px !important;
  padding: 0 18px !important;
  border-bottom: 1px solid var(--border);
  background: var(--bg) !important;
  backdrop-filter: none !important;
  z-index: 50;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

/* Asegurar que el sidebar tambien tenga z-index para no quedar */
/* atras del contenido scroll                                    */
.admin-sidebar {
  z-index: 30;
}

/* Topbar actions: alinear correctamente al centro vertical */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: flex-end;
}

/* Date/Hora cards: altura limitada para no estirar el topbar    */
.topbar-date-card {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  align-items: center !important;
}

/* ============================================================ */
/* Fixes-16: sidebar top: 0 (alinear con topbar) + brand limpio */
/* ============================================================ */

/* El CSS original tenia .modern-admin-app .admin-sidebar { top: 14px } */
/* causando 14px de offset entre sidebar y topbar. Sobreescribo.        */
.modern-admin-app .admin-sidebar,
.admin-sidebar {
  top: 0 !important;
  height: 100vh !important;
  border-radius: 0 !important;
}

/* HERCULES brand: Plus Jakarta Sans 800 uppercase tight        */
/* (drop Oswald aqui — mas moderno y menos pesado)               */
.sidebar-brand-text strong {
  font-family: var(--font-body) !important;
  font-weight: 800 !important;
  font-size: 18px !important;
  letter-spacing: -0.01em !important;
  text-transform: uppercase;
  color: var(--text);
}

.sidebar-brand-text small {
  font-family: var(--font-mono) !important;
  font-size: 8px !important;
  font-weight: 600;
  letter-spacing: 1.6px !important;
  color: var(--muted);
  text-transform: uppercase;
}

/* ============================================================ */
/* Fixes-17: silueta Hercules con mask-image + hover rojo       */
/* ============================================================ */

/* Override total del .sidebar-brand-mark: deja de ser un       */
/* cuadradito rojo con icono adentro, pasa a ser la silueta    */
/* directamente via mask-image (toma el alpha de la PNG).      */
/* El "color" lo da el background-color del div.               */
.sidebar-brand-mark {
  width: 44px !important;
  height: 44px !important;
  background: var(--text) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  -webkit-mask: url("/assets/hercules-figure.png") center / contain no-repeat;
  mask: url("/assets/hercules-figure.png") center / contain no-repeat;
  transition: background 0.25s ease;
  display: block;
  flex: 0 0 44px;
}

/* Hover en TODO el brand cambia el color de la silueta a rojo */
.sidebar-brand:hover .sidebar-brand-mark {
  background: var(--accent) !important;
}

/* Que el brand sea hoverable visualmente como un boton */
.sidebar-brand {
  cursor: default;
}

/* ============================================================ */
/* Phase 3d: Planes - dark theme + Focusing-style cards         */
/* ============================================================ */

/* Header del tab Planes: kicker + h1 + p a la izquierda,        */
/* boton "Agregar plan" a la derecha                              */
.plans-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 2px 0 22px;
}

.plans-header > div {
  display: grid;
  gap: 4px;
}

.plans-header h1 {
  margin: 4px 0 0;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.022em;
  line-height: 1.05;
  color: var(--text);
}

.plans-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.plans-header .primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.3);
  flex-shrink: 0;
}

.plans-header .primary-action:hover {
  background: var(--accent-dim);
}

/* Grid de plans: cards en columnas */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.plans-grid-balanced {
  /* override del legacy si lo necesita */
}

/* Plan card individual: estilo dark + Focusing                  */
.modern-plan-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.32);
  transition: border-color 0.18s ease, transform 0.15s ease;
  min-height: 170px;
}

.modern-plan-card:hover {
  border-color: rgba(200, 16, 46, 0.32);
}

/* Header del card: icon + nombre + sub */
.modern-plan-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modern-plan-icon {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
  flex: 0 0 40px;
}

.modern-plan-icon svg {
  width: 19px;
  height: 19px;
}

.modern-plan-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.modern-plan-head strong {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text);
}

.modern-plan-head small {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* Precio grande */
.modern-plan-price {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--text);
}

/* Meta: actualizado + fecha */
.modern-plan-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.modern-plan-meta span {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.modern-plan-meta strong {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Acciones (edit + delete) del card */
.modern-plan-actions {
  display: flex;
  gap: 6px;
  position: absolute;
  top: 18px;
  right: 18px;
}

.modern-plan-card .icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.modern-plan-card .icon-button:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.modern-plan-card .icon-button.danger:hover {
  color: #fff;
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

/* Responsive: stack en mobile */
@media (max-width: 720px) {
  .plans-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================ */
/* Fixes-18: plan cards sin icono, titulo rojo, 4 en una fila  */
/* ============================================================ */

/* Quitar el "redondito" (icon container) de las plan cards */
.modern-plan-icon {
  display: none !important;
}

/* Head del card: sin icono, simple bloque de texto */
.modern-plan-head {
  display: block;
}

.modern-plan-head > div {
  display: block;
}

/* TITULO del card (nombre del plan) en ROJO Hercules */
.modern-plan-head strong {
  color: var(--accent) !important;
  font-size: 18px;
  letter-spacing: 0.5px;
}

/* "Precio vigente" subtitle en BLANCO (era muted antes) */
.modern-plan-head small {
  color: var(--text) !important;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Precio big: BLANCO */
.modern-plan-price {
  color: var(--text);
}

/* Meta footer: BLANCO en label + valor */
.modern-plan-meta span,
.modern-plan-meta strong {
  color: var(--text) !important;
}

/* Grid: 4 columnas FIJAS (sin wrap) */
.plans-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px;
}

/* Responsive solo a viewport muy chico */
@media (max-width: 920px) {
  .plans-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 540px) {
  .plans-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================ */
/* Fixes-19: quitar circulo rojo de fondo + iconos al lado del   */
/* precio                                                         */
/* ============================================================ */

/* Quitar el pseudo-element ::after que dibuja el circulo rojo  */
/* en la esquina inferior del card                                */
.modern-plan-card::after {
  display: none !important;
  content: none !important;
}

/* Reorganizar el card con grid-template-areas:                 */
/*   head ocupa el row 1 (full width)                            */
/*   price + actions ocupan el row 2 (price izquierda, actions  */
/*     derecha)                                                   */
/*   meta ocupa el row 3 (full width)                            */
.modern-plan-card {
  display: grid !important;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "head head"
    "price actions"
    "meta meta";
  gap: 14px;
  align-items: center;
  position: relative;
}

.modern-plan-head { grid-area: head; }
.modern-plan-price { grid-area: price; margin: 0; }
.modern-plan-meta { grid-area: meta; }

/* Actions: ya no absolute, queda inline con el precio */
.modern-plan-actions {
  position: static !important;
  top: auto !important;
  right: auto !important;
  grid-area: actions;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ============================================================ */
/* Fixes-20: plan cards bien acomodadas                          */
/* ============================================================ */

/* Precio: nunca wrapear, font un poco mas chico para entrar en  */
/* el ancho disponible junto a los iconos                         */
.modern-plan-price {
  font-size: 26px !important;
  white-space: nowrap !important;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Action buttons mas compactos y alineados al baseline del precio*/
.modern-plan-actions {
  display: flex !important;
  gap: 4px;
  align-items: center;
  justify-self: end;
}

.modern-plan-card .icon-button {
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
}

.modern-plan-card .icon-button svg {
  width: 14px;
  height: 14px;
}

/* Meta footer: no wrappear el datetime              */
.modern-plan-meta {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.modern-plan-meta strong {
  white-space: nowrap;
  font-size: 10px !important;
}

.modern-plan-meta span {
  white-space: nowrap;
  font-size: 9px !important;
}

/* Card padding un toque menos para mas espacio interno */
.modern-plan-card {
  padding: 16px !important;
  gap: 12px !important;
}

/* ============================================================ */
/* Fixes-21: plan cards mas grandes y alargadas                  */
/* ============================================================ */

.modern-plan-card {
  min-height: 240px !important;
  padding: 22px !important;
  gap: 18px !important;
}

/* Precio mas grande aprovechando el espacio extra */
.modern-plan-price {
  font-size: 34px !important;
  font-weight: 800;
  letter-spacing: -0.025em;
}

/* Nombre del plan tambien un poco mas grande */
.modern-plan-head strong {
  font-size: 20px !important;
}

/* Subtitle del head con un poco mas de espacio */
.modern-plan-head small {
  font-size: 10px !important;
  letter-spacing: 1.5px;
}

/* Actions un poquito mas visibles */
.modern-plan-card .icon-button {
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
}

.modern-plan-card .icon-button svg {
  width: 15px;
  height: 15px;
}

/* Meta footer con un toque mas de respiro */
.modern-plan-meta {
  padding-top: 14px !important;
}

.modern-plan-meta strong {
  font-size: 11px !important;
}

.modern-plan-meta span {
  font-size: 9.5px !important;
}

/* ============================================================ */
/* Fixes-22: plan cards bien proporcionadas (overflow fix)      */
/* ============================================================ */

/* min-width: 0 en todos los grid items (sin esto, el price con */
/* nowrap fuerza la columna a crecer y empuja las acciones fuera*/
.modern-plan-card {
  min-height: 210px !important;
  padding: 20px !important;
  gap: 14px !important;
  overflow: hidden;
}

.modern-plan-head,
.modern-plan-price,
.modern-plan-meta,
.modern-plan-actions {
  min-width: 0;
}

/* Precio: tamaño moderado que entra cómodo con los iconos */
.modern-plan-price {
  font-size: 28px !important;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: visible;
}

/* Nombre del plan */
.modern-plan-head strong {
  font-size: 17px !important;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modern-plan-head small {
  font-size: 9px !important;
  letter-spacing: 1.3px;
}

/* Action buttons: borderless, muy compactos para no robar ancho*/
.modern-plan-card .icon-button {
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text-muted);
}

.modern-plan-card .icon-button:hover {
  color: var(--accent) !important;
  background: rgba(200, 16, 46, 0.12) !important;
  border-radius: 8px;
}

.modern-plan-card .icon-button.danger:hover {
  color: var(--accent) !important;
  background: rgba(200, 16, 46, 0.18) !important;
}

.modern-plan-card .icon-button svg {
  width: 15px;
  height: 15px;
}

/* Actions container: pegadito al precio */
.modern-plan-actions {
  gap: 2px;
}

/* Meta footer: fonts compactos para que entre el datetime */
.modern-plan-meta {
  padding-top: 12px !important;
  gap: 6px;
}

.modern-plan-meta strong {
  font-size: 10px !important;
  white-space: nowrap;
}

.modern-plan-meta span {
  font-size: 9px !important;
  white-space: nowrap;
}

/* ============================================================ */
/* Fixes-23: titulo del plan NO se corta + cards mas alargadas  */
/* ============================================================ */

/* Quitar el ellipsis + overflow:hidden del titulo */
.modern-plan-head strong {
  font-size: 16px !important;
  letter-spacing: 0.3px !important;
  white-space: nowrap;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Tambien quitar overflow:hidden del card */
.modern-plan-card {
  overflow: visible !important;
  min-height: 230px !important;
  padding: 22px 20px !important;
}

/* El head ocupa el ancho completo y permite que el titulo se */
/* lea sin recortes                                              */
.modern-plan-head {
  display: block;
  overflow: visible;
}

/* Reducir el padding lateral interno para dar mas espacio al   */
/* texto del titulo                                              */
.modern-plan-card {
  padding-left: 18px !important;
  padding-right: 18px !important;
}

/* ============================================================ */
/* Fixes-24: icons del plan card a la esquina superior derecha   */
/* (posicion simetrica en los 4 cards, no choca con precio)      */
/* ============================================================ */

/* Card: vuelve a tener position relative + grid de 1 columna   */
.modern-plan-card {
  position: relative !important;
  grid-template-columns: 1fr !important;
  grid-template-areas:
    "head"
    "price"
    "meta" !important;
}

/* Head, price y meta ocupan ancho completo */
.modern-plan-head {
  grid-area: head;
  padding-right: 60px; /* espacio reservado para los iconos absolutos */
}

.modern-plan-price {
  grid-area: price;
}

.modern-plan-meta {
  grid-area: meta;
}

/* Actions absolute en top-right - misma posicion en TODOS los  */
/* cards. Iconos en pill outline sutil, hover rojo               */
.modern-plan-actions {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  display: flex !important;
  gap: 4px;
  z-index: 2;
}

.modern-plan-card .icon-button {
  width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  border: 1px solid var(--border) !important;
  background: transparent !important;
  color: var(--text-muted);
  border-radius: 8px;
  transition: all 0.15s ease;
}

.modern-plan-card .icon-button:hover {
  color: #fff !important;
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

.modern-plan-card .icon-button.danger:hover {
  color: #fff !important;
  background: var(--accent-dim) !important;
  border-color: var(--accent-dim) !important;
}

.modern-plan-card .icon-button svg {
  width: 14px;
  height: 14px;
}

/* ============================================================ */
/* Fixes-25: dropdown menu de 3 puntos en plan cards            */
/* ============================================================ */

/* Padding-right del head ya no es necesario tan grande */
.modern-plan-head {
  padding-right: 36px;
}

/* Trigger: 3 puntos verticales en top-right del card */
.card-menu-trigger {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 30px;
  height: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-menu-trigger:hover {
  background: var(--surface-2);
  color: var(--text);
}

.card-menu-trigger.open {
  background: var(--surface-2);
  color: var(--accent);
}

/* Backdrop fullscreen para capturar clicks fuera del menu */
.card-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: default;
  width: 100vw;
  height: 100vh;
}

/* Dropdown menu */
.card-menu-dropdown {
  position: absolute;
  top: 50px;
  right: 14px;
  z-index: 51;
  min-width: 140px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 2px;
  animation: dropdown-open 0.15s ease-out;
}

@keyframes dropdown-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-menu-dropdown button {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px;
  width: 100%;
  padding: 8px 12px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--text) !important;
  font-family: var(--font-body) !important;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  min-height: auto !important;
  text-align: left !important;
}

.card-menu-dropdown button:hover {
  background: var(--surface) !important;
}

.card-menu-dropdown button.danger {
  color: var(--accent) !important;
}

.card-menu-dropdown button.danger:hover {
  background: rgba(200, 16, 46, 0.14) !important;
}

.card-menu-dropdown button svg {
  flex: 0 0 14px;
}

/* ============================================================ */
/* Fixes-26: 3 puntos en CSS puro (no depende de icon lib)      */
/* ============================================================ */

/* Reemplaza el trigger anterior con un button que renderiza 3   */
/* dots verticales en CSS                                         */
.card-menu-trigger {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 3;
  width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  cursor: pointer;
  transition: background 0.15s ease;
  box-shadow: none !important;
}

.card-menu-trigger .dot {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
  flex: 0 0 4px;
  transition: background 0.15s ease;
}

.card-menu-trigger:hover {
  background: var(--surface-2) !important;
}

.card-menu-trigger:hover .dot {
  background: var(--text);
}

.card-menu-trigger.open {
  background: var(--surface-2) !important;
}

.card-menu-trigger.open .dot {
  background: var(--accent);
}

/* ============================================================ */
/* Fixes-27: revert - iconos al lado del precio (sin dropdown)  */
/* ============================================================ */

/* Quitar el padding-right del head que estaba reservado para   */
/* el botoncito de 3 puntos                                       */
.modern-plan-head {
  padding-right: 0 !important;
}

/* Card vuelve a grid con price y actions en misma row */
.modern-plan-card {
  position: relative !important;
  grid-template-columns: 1fr auto !important;
  grid-template-areas:
    "head head"
    "price actions"
    "meta meta" !important;
  align-items: center;
}

.modern-plan-head { grid-area: head; }
.modern-plan-price { grid-area: price; }
.modern-plan-meta { grid-area: meta; }
.modern-plan-actions {
  grid-area: actions;
  position: static !important;
  top: auto !important;
  right: auto !important;
  display: flex !important;
  gap: 4px;
  align-items: center;
  justify-self: end;
}

/* Icon buttons compactos para que no roben mucho ancho */
.modern-plan-card .icon-button {
  width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  border: 1px solid var(--border) !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  border-radius: 8px !important;
  display: inline-grid !important;
  place-items: center !important;
}

.modern-plan-card .icon-button:hover {
  color: #fff !important;
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

.modern-plan-card .icon-button.danger:hover {
  color: #fff !important;
  background: var(--accent-dim) !important;
  border-color: var(--accent-dim) !important;
}

.modern-plan-card .icon-button svg {
  width: 14px;
  height: 14px;
}

/* Esconder cualquier residuo del intento de dropdown */
.card-menu-trigger,
.card-menu-backdrop,
.card-menu-dropdown {
  display: none !important;
}

/* ============================================================ */
/* Fixes-28: precio + iconos sin overlap                         */
/* ============================================================ */

/* Card grid con gap explicito entre las columnas para que el  */
/* precio nunca se monte sobre los iconos                        */
.modern-plan-card {
  column-gap: 12px !important;
}

/* Precio: font ligeramente mas chico, fits comodo en su columna*/
.modern-plan-price {
  font-size: 24px !important;
  line-height: 1;
  overflow: hidden;
  text-overflow: clip;
}

/* Icons mas compactos para reservar menos ancho */
.modern-plan-card .icon-button {
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
}

.modern-plan-card .icon-button svg {
  width: 13px;
  height: 13px;
}

/* Actions sin gap interno gigante */
.modern-plan-actions {
  gap: 4px !important;
}

/* ============================================================ */
/* Fixes-29: precio nunca clipeado + iconos mas chicos          */
/* ============================================================ */

/* Quito overflow:hidden del precio (estaba clipeando los       */
/* últimos digitos) y bajo font para que ENTRE comodo          */
.modern-plan-price {
  font-size: 22px !important;
  font-weight: 800;
  letter-spacing: -0.025em;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap;
}

/* Iconos a 26x26, gap chico entre ellos */
.modern-plan-card .icon-button {
  width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
}

.modern-plan-card .icon-button svg {
  width: 12px;
  height: 12px;
}

.modern-plan-actions {
  gap: 3px !important;
}

/* Column-gap entre price y actions un poco mas chico */
.modern-plan-card {
  column-gap: 8px !important;
}

/* ============================================================ */
/* Phase 5 - BackUp: estilo Hercules                             */
/* ============================================================ */

/* Panel principal: surface dark con border, padding generoso */
.backup-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 24px !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  background: var(--surface) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.32) !important;
}

/* Info de la izquierda: icono + texto */
.backup-info {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

/* Backup icon: red tint Hercules style */
.backup-icon {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(200, 16, 46, 0.14);
  color: var(--accent);
  border: 1px solid rgba(200, 16, 46, 0.24);
  flex: 0 0 48px;
}

.backup-icon svg {
  width: 22px;
  height: 22px;
}

/* Texto del info */
.backup-info > div {
  min-width: 0;
}

.backup-info h3 {
  margin: 0 0 6px;
  color: var(--text) !important;
  font-family: var(--font-body) !important;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
}

.backup-info p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Acciones: flex row con buttons pill */
.backup-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.backup-actions .secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--border) !important;
  border-radius: 999px !important;
  background: var(--surface-2) !important;
  color: var(--text) !important;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.backup-actions .secondary-action:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.backup-actions .primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 0 !important;
  border-radius: 999px !important;
  background: var(--accent) !important;
  color: #fff !important;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.3);
  transition: all 0.15s ease;
}

.backup-actions .primary-action:hover {
  background: var(--accent-dim) !important;
}

/* Tambien la legacy class por si queda algun residuo */
.backup-actions .danger-soft-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

.backup-actions .danger-soft-action:hover {
  background: var(--accent-dim);
}

.hidden-file-input {
  display: none;
}

/* Responsive: stack en mobile */
@media (max-width: 720px) {
  .backup-panel {
    grid-template-columns: 1fr;
  }

  .backup-actions {
    flex-wrap: wrap;
  }
}

/* ============================================================ */
/* Fixes-30: BackUp page-title - h1 rojo + p blanco              */
/* ============================================================ */

.backup-page-title h1 {
  color: var(--accent) !important;
}

.backup-page-title p {
  color: var(--text) !important;
}

/* ============================================================ */
/* Phase 4 - Kiosko de DNI para tablet 10" landscape (1280x800) */
/* ============================================================ */

/* Override del body class .login-body viejo: sin foto del gym, */
/* sin overlay, full dark Hercules                              */
.login-body {
  background: var(--bg) !important;
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  font-family: var(--font-body);
}

.login-body::before,
.login-body::after {
  display: none !important;
  content: none !important;
}

#login-root {
  height: 100vh;
  height: 100dvh;
}

/* ============================================================ */
/* Layout principal: 2 columnas - brand izq / keypad der        */
/* ============================================================ */

.kiosk-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background: var(--bg);
  color: var(--text);
}

/* ============================================================ */
/* Brand (panel izquierdo)                                       */
/* ============================================================ */

.kiosk-brand {
  display: flex;
  flex-direction: column;
  padding: 56px 64px;
  background: linear-gradient(135deg, rgba(200, 16, 46, 0.08) 0%, transparent 60%), var(--bg);
  border-right: 1px solid var(--border);
  position: relative;
}

.kiosk-brand::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, var(--accent) 30%, var(--accent) 70%, transparent 100%);
  opacity: 0.4;
}

.kiosk-brand-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.kiosk-figure {
  width: 56px;
  height: 56px;
  background: var(--accent);
  -webkit-mask: url("/assets/hercules-figure.png") center / contain no-repeat;
  mask: url("/assets/hercules-figure.png") center / contain no-repeat;
  flex: 0 0 56px;
}

.kiosk-brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1;
}

.kiosk-brand-text strong {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--text);
}

.kiosk-brand-text small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

/* Reloj prominente */
.kiosk-clock {
  margin-top: 64px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.kiosk-clock-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.kiosk-clock-time {
  display: block;
  font-family: var(--font-body);
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Tagline + CTA */
.kiosk-tagline {
  margin-top: auto;
}

.kiosk-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.kiosk-tagline h1 {
  margin: 0 0 16px;
  font-family: var(--font-body);
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text);
}

.kiosk-tagline p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 420px;
}

.kiosk-credit {
  margin: 32px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
}

/* ============================================================ */
/* Keypad section (panel derecho)                               */
/* ============================================================ */

.kiosk-keypad-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.kiosk-form {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kiosk-display-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.kiosk-display {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.kiosk-display input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent !important;
  border: 0 !important;
  color: var(--text) !important;
  font-family: var(--font-body) !important;
  font-size: 48px !important;
  font-weight: 800 !important;
  letter-spacing: 6px !important;
  text-align: center;
  outline: none;
  caret-color: var(--accent);
  font-variant-numeric: tabular-nums;
  padding: 0 !important;
}

.kiosk-display-placeholder {
  font-family: var(--font-body);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--muted);
  opacity: 0.4;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* Keypad grid 3 columnas x 4 filas */
.kiosk-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.kiosk-key {
  height: 76px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.kiosk-key:hover,
.kiosk-key:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.kiosk-key:active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(0.96);
}

.kiosk-key-clear {
  color: var(--muted);
  font-size: 22px;
}

.kiosk-key-clear:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.kiosk-key-back {
  color: var(--muted);
}

.kiosk-key-back:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Boton de ingresar */
.kiosk-submit {
  margin-top: 4px;
  height: 64px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(200, 16, 46, 0.35);
  transition: all 0.18s ease;
}

.kiosk-submit:hover:not(:disabled) {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.kiosk-submit:active:not(:disabled) {
  transform: translateY(0);
}

.kiosk-submit:disabled {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* ============================================================ */
/* Dialog post-validacion                                       */
/* ============================================================ */

.kiosk-dialog {
  width: min(640px, 90vw);
  border: 0;
  border-radius: 24px;
  padding: 0;
  background: transparent;
}

.kiosk-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
}

.kiosk-dialog-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 48px 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
}

.kiosk-dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}

.kiosk-dialog-icon {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin-bottom: 20px;
}

.kiosk-dialog.granted .kiosk-dialog-icon {
  color: #3ab472;
  background: rgba(58, 180, 114, 0.16);
  border: 1px solid rgba(58, 180, 114, 0.3);
}

.kiosk-dialog.denied .kiosk-dialog-icon {
  color: var(--accent);
  background: rgba(200, 16, 46, 0.18);
  border: 1px solid rgba(200, 16, 46, 0.35);
}

.kiosk-dialog-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.kiosk-dialog.granted .kiosk-dialog-eyebrow {
  color: #3ab472;
}

.kiosk-dialog.denied .kiosk-dialog-eyebrow {
  color: var(--accent);
}

.kiosk-dialog-content h2 {
  margin: 0 0 16px;
  font-family: var(--font-body);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  text-transform: none;
}

.kiosk-dialog-detail {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  max-width: 460px;
}

.kiosk-dialog-warning {
  margin: 8px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(224, 144, 48, 0.12);
  border: 1px solid rgba(224, 144, 48, 0.28);
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  max-width: 460px;
}

.kiosk-dialog.denied .kiosk-dialog-warning {
  background: rgba(200, 16, 46, 0.1);
  border-color: rgba(200, 16, 46, 0.3);
  color: var(--accent);
}

/* ============================================================ */
/* Responsive: portrait fallback en tablets verticales/mobiles  */
/* ============================================================ */

@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .kiosk-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow-y: auto;
  }

  .kiosk-brand {
    padding: 28px 32px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .kiosk-brand::before {
    display: none;
  }

  .kiosk-clock {
    margin-top: 24px;
    padding: 16px 0;
  }

  .kiosk-clock-time {
    font-size: 44px;
  }

  .kiosk-tagline h1 {
    font-size: 32px;
  }

  .kiosk-credit {
    display: none;
  }

  .kiosk-keypad-section {
    padding: 24px;
  }
}

/* ============================================================ */
/* Phase 4 fix1: BIENVENIDO DE VUELTA + bullets + header DNI    */
/* ============================================================ */

/* Logo a color */
.kiosk-logo-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  flex: 0 0 64px;
}

/* Tagline: nuevo layout con big title + bullets */
.kiosk-tagline {
  margin-top: auto;
  padding-top: 32px;
}

.kiosk-tagline h1 {
  margin: 12px 0 28px;
  font-family: var(--font-body);
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 0.95;
  color: var(--text);
  text-transform: uppercase;
}

.kiosk-tagline h1 .accent {
  color: var(--accent);
}

.kiosk-tagline h1 .accent-dot {
  color: var(--accent);
}

/* Lista de bullets con dots rojos */
.kiosk-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kiosk-bullets li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.kiosk-bullets li::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* Header del DNI display: kicker + h2 */
.kiosk-display-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 8px;
  gap: 8px;
}

.kiosk-display-header .kiosk-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2.4px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

.kiosk-display-header h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}

/* El kicker de la tagline en rojo (era muted) */
.kiosk-tagline .kiosk-kicker {
  color: var(--accent) !important;
  letter-spacing: 2.8px;
  font-size: 11px;
  font-weight: 700;
}

/* ============================================================ */
/* Fixes-31: kiosko display sin <input> (sin teclado virtual)   */
/* ============================================================ */

/* El display ahora es un div puro, sin input. Estilizamos el     */
/* span del valor con la misma cosa que tenia el input antes      */
.kiosk-display-value {
  font-family: var(--font-body);
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  user-select: none;
}

/* El display container ya no tiene input absolute, queda mas    */
/* simple                                                          */
.kiosk-display {
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
}

/* ============================================================ */
/* Fixes-32: kiosk-dialog-close mismo estilo que admin dialogs  */
/* ============================================================ */

.kiosk-dialog-close {
  position: absolute !important;
  top: 18px !important;
  right: 18px !important;
  width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--accent) !important;
  color: #fff !important;
  font-family: var(--font-body) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.32);
  text-transform: none !important;
}

.kiosk-dialog-close:hover {
  background: var(--accent-dim) !important;
}

/* Phase 5 - Consultas (leads): list polish */
.leads-table .lead-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.leads-table .lead-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

.leads-table .lead-message-cell {
  max-width: 280px;
  color: var(--text-soft, var(--text));
  line-height: 1.45;
}

.leads-table .lead-message-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leads-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
  gap: 12px;
}

.leads-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(200, 16, 46, 0.08);
  color: var(--accent);
  margin-bottom: 4px;
}

.leads-empty h3 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.leads-empty p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 340px;
}

/* Phase 5 - Consultas (leads): table contrast fixes for dark theme */
/* Override legacy light .converted-lead-row */
.converted-lead-row,
.modern-table tbody tr.converted-lead-row {
  background: rgba(58, 180, 114, 0.06) !important;
  opacity: 1 !important;
}

.modern-table tbody tr.converted-lead-row:hover {
  background: rgba(58, 180, 114, 0.1) !important;
}

.modern-table tbody tr.converted-lead-row td,
.modern-table tbody tr.converted-lead-row td strong,
.modern-table tbody tr.converted-lead-row td span {
  color: var(--muted);
}

/* Row separators a touch more visible in dark theme */
.leads-table tbody td,
.modern-table.leads-table tbody td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

/* Empty/null cells get a soft muted dash via padding alignment */
.leads-table tbody td:empty::before {
  content: "-";
  color: var(--muted);
  opacity: 0.5;
}

/* Phase 5 - Consultas (leads): modal detalle dark theme overrides */
.lead-detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

.lead-detail-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  gap: 16px;
  padding: 28px 28px 24px;
}

.lead-modal-header {
  padding-right: 56px;
}

.lead-modal-header h1 {
  margin: 4px 0 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

/* Cards del grid: surface-2 sobre surface, border subtle, sin inset blanco */
.lead-detail-card .lead-detail-grid article,
.lead-detail-card .lead-message-box {
  background: var(--surface-2, #1c1c1c);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: none;
  padding: 12px 14px;
}

.lead-detail-card .lead-detail-grid span,
.lead-detail-card .lead-message-box span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.lead-detail-card .lead-detail-grid strong {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
}

.lead-detail-card .lead-message-box p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

/* Panel de botones de respuesta */
.lead-detail-card .lead-response-actions {
  background: var(--surface-2, #1c1c1c);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.lead-detail-card .lead-response-button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

.lead-detail-card .lead-response-button:hover {
  background: var(--surface-2, #1c1c1c);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.lead-detail-card .lead-response-whatsapp {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
}

.lead-detail-card .lead-response-whatsapp:hover {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.5);
}

.lead-detail-card .lead-response-email {
  color: var(--accent);
  border-color: rgba(200, 16, 46, 0.4);
}

.lead-detail-card .lead-response-email:hover {
  background: rgba(200, 16, 46, 0.08);
  border-color: rgba(200, 16, 46, 0.55);
}

.lead-detail-card .lead-response-convert {
  color: var(--text);
  border-color: var(--border);
}

.lead-detail-card .lead-response-button:disabled,
.lead-detail-card .lead-response-button.disabled-link {
  background: var(--surface-2, #1c1c1c);
  border-color: var(--border);
  color: var(--muted);
}

/* Labels y form controls del panel de edicion */
.lead-detail-card label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  gap: 8px;
}

.lead-detail-card select,
.lead-detail-card textarea {
  background: var(--surface-2, #1c1c1c);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body, "Plus Jakarta Sans", sans-serif);
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}

.lead-detail-card select:focus,
.lead-detail-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}

.lead-detail-card .lead-edit-panel select:disabled,
.lead-detail-card .lead-edit-panel textarea:disabled {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
  opacity: 0.7;
}

/* Botones del footer Cancelar / Actualizar */
.lead-detail-card .lead-modal-actions {
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.lead-detail-card .lead-modal-actions button {
  background: var(--surface-2, #1c1c1c);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

.lead-detail-card .lead-modal-actions button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.lead-detail-card .lead-modal-actions button[type="submit"]:hover {
  background: var(--accent-dim, #8b0f1a);
  border-color: var(--accent-dim, #8b0f1a);
}

.lead-detail-card .lead-modal-actions button:not([type="submit"]):hover {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.18);
}

/* Phase 5 - Sidebar brand: logo a color (mismo que el kiosko) */
/* Override del mask-image existente para que el <img> renderice */
/* la imagen real en lugar de aplicar la silueta como mask. */
img.sidebar-brand-mark {
  -webkit-mask: none !important;
  mask: none !important;
  background: transparent !important;
  object-fit: contain;
  border-radius: 6px;
}

.sidebar-brand:hover img.sidebar-brand-mark {
  background: transparent !important;
}

/* ============================================================ */
/* Token additions: jerarquia texto, bordes, estados semanticos */
/* Extiende el sistema sin pisar tokens existentes (--ink,      */
/* --line, --ok ya en uso en cientos de selectores).            */
/* ============================================================ */
:root {
  /* Jerarquia de texto mas fina */
  --text-2: #b8b8b8;       /* secundario, mas claro que --muted */
  --text-3: #6e6e6e;       /* microcopy (alias semantico de --muted) */
  --text-dim: #4a4a4a;     /* placeholders, disabled */

  /* Nivel intermedio de surface */
  --surface-3: #222222;    /* pills, chips, tercer nivel */

  /* Escalera de bordes translucidos (complementa --border #2a2a2a) */
  --border-faint: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Acento secundario y fondo translucido del accent */
  --accent-2: #8a2a35;
  --accent-soft: rgba(200, 16, 46, 0.16);

  /* Estados semanticos completos */
  --good: #3ab472;         /* alias semantico de --ok */
  --bad: #e34a4a;          /* fallo critico distinto del accent rojo */
  --info: #4a8de3;         /* eventos informativos */

  /* Versiones soft (16% alpha) para badges/pills/fondos */
  --good-soft: rgba(58, 180, 114, 0.16);
  --warn-soft: rgba(224, 144, 48, 0.16);
  --bad-soft: rgba(227, 74, 74, 0.16);
  --info-soft: rgba(74, 141, 227, 0.16);
}

/* ============================================================ */
/* A11y: focus visible global con accent rojo                   */
/* :focus-visible solo aparece en navegacion por teclado, no    */
/* en clicks de mouse - no afecta UX de usuarios con mouse.     */
/* ============================================================ */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Inputs/selects/textareas: focus ring rojo translucido en vez */
/* del outline solido (mas elegante para form controls).        */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================================================ */
/* Admin login: dark theme overrides                            */
/* La pantalla de login al panel todavia estaba en theme light  */
/* (fondo blanco, gradiente crema). Aplicado mismo sistema dark */
/* que el resto del admin (surface, accent rojo).               */
/* ============================================================ */
.admin-login {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(200, 16, 46, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, #050505 100%);
}

.admin-login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  padding: 28px 28px 24px;
  gap: 16px;
  display: grid;
}

.admin-login-card img {
  width: 96px;
  border-radius: 8px;
}

.admin-login-brand {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: grid;
  place-items: center;
}

.admin-login-card h1 {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin-top: 6px;
}

.admin-login-heading .admin-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.admin-login-heading p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.admin-login-fields {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  gap: 14px;
}

.admin-login-card label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.admin-login-card input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}

.admin-login-card input::placeholder {
  color: var(--text-dim);
}

.admin-login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.admin-login-card button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.admin-login-card button:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.admin-login-card button:active {
  transform: translateY(1px);
}

.admin-login-card .admin-login-message {
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid rgba(227, 74, 74, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* ============================================================ */
/* Phase 5 - Alertas: cards ricas con avatar + chip urgencia    */
/* Layout: avatar (auto) + cuerpo (1fr) + acciones (auto).      */
/* Border-left semantico por urgencia (bad/warn/muted/accent).  */
/* ============================================================ */
.events .event {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 12px;
}

.event.event-tone-bad {
  border-left-color: var(--bad);
}

.event.event-tone-warn {
  border-left-color: var(--warn);
}

.event.event-tone-muted {
  border-left-color: var(--text-3);
}

.event.event-tone-accent {
  border-left-color: var(--accent);
}

.event-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  flex: 0 0 42px;
}

.event-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.event-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.events .event .event-head strong {
  display: inline;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
}

.event-urgency-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.event.event-tone-bad .event-urgency-chip {
  background: var(--bad-soft);
  color: var(--bad);
}

.event.event-tone-warn .event-urgency-chip {
  background: var(--warn-soft);
  color: var(--warn);
}

.event.event-tone-muted .event-urgency-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
}

.event.event-tone-accent .event-urgency-chip {
  background: var(--accent-soft);
  color: var(--accent);
}

.events .event .event-message {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.event-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.event-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12.5px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.event-action img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.event-action-whatsapp {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
}

.event-action-whatsapp:hover {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.5);
}

.event-action-email {
  color: var(--accent);
  border-color: rgba(200, 16, 46, 0.4);
}

.event-action-email:hover {
  background: var(--accent-soft);
  border-color: rgba(200, 16, 46, 0.55);
}

/* Empty state Alertas */
.alerts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
  gap: 12px;
}

.alerts-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 4px;
}

.alerts-empty h3 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.alerts-empty p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 360px;
}

/* Responsive: stack en pantallas chicas */
@media (max-width: 720px) {
  .events .event {
    grid-template-columns: auto 1fr;
  }

  .event-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
}

/* ============================================================ */
/* Phase 5 - Caja: dark polish (breakdowns, sub-header, filter, */
/* empty state, embedded-search).                                */
/* ============================================================ */

/* Sub-header del panel Registro de pagos                       */
.cash-section-title {
  gap: 16px;
  flex-wrap: wrap;
}

.cash-section-title h2 {
  margin: 4px 0 6px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-transform: none;
}

.cash-section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-kicker-sub {
  color: var(--muted) !important;
  font-size: 9.5px !important;
}

/* Polish de los breakdowns de stat-cards                       */
.method-breakdown {
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
}

.method-breakdown span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 12px;
}

.method-breakdown b {
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.method-breakdown em {
  color: var(--text);
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 600;
  font-size: 12.5px;
}

.plan-breakdown {
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
}

.plan-breakdown span {
  align-items: baseline;
}

.plan-breakdown b {
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
}

.plan-breakdown em {
  color: var(--text);
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
}

.plan-breakdown small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.3px;
  line-height: 1.5;
}

/* Date filter dark                                              */
.date-filter label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.date-filter input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
}

.date-filter input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.date-filter button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 0 16px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.date-filter button:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

/* Embedded search dark                                          */
.cash-movements-panel .embedded-search input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
}

.cash-movements-panel .embedded-search input::placeholder {
  color: var(--text-dim);
}

.cash-movements-panel .embedded-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Empty state de Caja                                           */
.cash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
  gap: 12px;
}

.cash-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 4px;
}

.cash-empty h3 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.cash-empty p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 380px;
}

/* Chart tooltip dark (Recaudacion diaria)                       */
.chart-tooltip-detail {
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px;
  color: var(--text);
}

.chart-tooltip-detail strong,
.chart-tooltip-detail em {
  color: var(--text);
}

.chart-tooltip-detail em {
  color: var(--muted);
}

.chart-tooltip-detail li {
  color: var(--text-2);
}

.chart-tooltip-detail li b {
  color: var(--text);
}

/* Cash table: fecha/hora/monto en mono para legibilidad numerica */
.cash-movements-panel .modern-table td:nth-child(1),
.cash-movements-panel .modern-table td:nth-child(2),
.cash-movements-panel .modern-table td:nth-child(6) {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.cash-movements-panel .modern-table td:nth-child(6) {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

/* ============================================================ */
/* Phase 5 - Usuarios (staff): avatar + role badge + perm chips */
/* ============================================================ */

/* Nombre + avatar inline en la primera columna */
.staff-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.staff-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  flex: 0 0 34px;
}

.staff-table .staff-name-cell strong {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

/* Badge sutil por rol */
.staff-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.staff-role-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(200, 16, 46, 0.3);
}

.staff-role-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(74, 141, 227, 0.3);
}

.staff-role-muted {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  border-color: var(--border);
}

/* Permisos: chips mono */
.staff-permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.staff-permission-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-3, #222);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: 1px solid var(--border);
}

.staff-permission-empty {
  color: var(--text-dim);
  font-style: italic;
  font-size: 12px;
}

/* Empty state */
.staff-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
  gap: 12px;
}

.staff-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 4px;
}

.staff-empty h3 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.staff-empty p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 340px;
}

/* ============================================================ */
/* Form Cliente: textarea Observaciones + Notas del cobro       */
/* + ajuste alineacion del monto en tabla Caja                  */
/* ============================================================ */

/* Textareas dentro del form de Cliente: mismo look que inputs   */
.client-form textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  min-height: 64px;
  text-transform: none;
  letter-spacing: normal;
}

.client-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.client-form textarea::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

/* Observaciones del cliente: full-width en el grid + layout    */
/* vertical (span arriba, textarea abajo, hint debajo)          */
.client-form-observations,
.initial-payment-notes,
.admin-dialog .charge-notes {
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
}

.client-form-observations > span,
.initial-payment-notes > span,
.admin-dialog .charge-notes > span {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

/* Modal Cobrar: misma estetica para el textarea de notas        */
.admin-dialog .charge-notes textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  min-height: 56px;
  text-transform: none;
  letter-spacing: normal;
}

.admin-dialog .charge-notes textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.admin-dialog .charge-notes textarea::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

/* Hint chiquito debajo de inputs/textareas                      */
.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: none;
}

/* Ficha cliente: observaciones full-width si las hay            */
.client-file-observations {
  grid-column: 1 / -1;
}

.client-file-observations div span {
  white-space: pre-wrap;
}

/* Caja: monto centrado (antes estaba right-aligned, quedaba    */
/* corrido para la derecha en columnas anchas)                  */
.cash-movements-panel .modern-table th:nth-child(6),
.cash-movements-panel .modern-table td:nth-child(6) {
  text-align: center;
}

/* Fix visual: columna Acciones en tablas.
   La causa raiz: el .modern-actions tiene display:flex pegado al
   <td>, lo cual REMUEVE el comportamiento de table-cell y desincroniza
   el border-bottom con el resto de la fila. Forzamos el td a volver
   a table-cell y usamos margin-left entre botones para el spacing
   (en lugar de gap de flex). */
.modern-table td,
.modern-table th {
  vertical-align: middle;
}

.modern-table td.modern-actions {
  display: table-cell !important;
  white-space: nowrap;
  vertical-align: middle !important;
}

.modern-table td.modern-actions > * {
  vertical-align: middle;
}

/* Los botones icon tenian display:grid por default que los hace
   block-level. Sin el flex container del td, se apilaban vertical.
   inline-flex los pone en linea y conserva el centrado del icon. */
.modern-table td.modern-actions > button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.modern-table td.modern-actions > button + button,
.modern-table td.modern-actions > * + button {
  margin-left: 8px;
}

/* ============================================================ */
/* Kiosko /login: layout responsive para tablet landscape       */
/* Target: Samsung Galaxy Tab A11 8.7" landscape (1340x800      */
/* nativo, ~893x533 CSS efectivo).                              */
/*                                                              */
/* Estrategia: usar min(px, vh) para que todos los elementos    */
/* del keypad se ajusten al alto disponible sin requerir        */
/* conocer la altura exacta. Asi entra en viewports de 400 a    */
/* 800px sin sobrarse ni quedarse corto.                        */
/* ============================================================ */
@media (orientation: landscape) and (max-height: 900px) {
  /* Brand panel (izq) - compacto */
  .kiosk-brand {
    padding: clamp(14px, 3vh, 28px) clamp(20px, 3vw, 36px);
    overflow: hidden;
  }

  .kiosk-figure {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
  }

  .kiosk-brand-text strong {
    font-size: 20px;
  }

  .kiosk-clock {
    margin-top: clamp(8px, 2vh, 18px);
    padding: clamp(8px, 1.5vh, 14px) 0;
  }

  .kiosk-clock-label {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .kiosk-clock-time {
    font-size: clamp(28px, 5.5vh, 44px);
  }

  .kiosk-kicker {
    font-size: 17px;
    letter-spacing: 3.2px;
    margin-bottom: 18px;
  }

  .kiosk-tagline h1 {
    font-size: clamp(44px, 9.5vh, 68px);
    margin: 0 0 22px;
    line-height: 1.02;
  }

  .kiosk-tagline p {
    font-size: 21px;
    max-width: 420px;
    line-height: 1.4;
  }

  .kiosk-bullets {
    gap: 12px;
    margin-top: 10px;
  }

  .kiosk-bullets li {
    font-size: 20px;
    line-height: 1.35;
  }

  .kiosk-bullets li::before {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
  }

  .kiosk-credit {
    margin-top: clamp(8px, 2vh, 18px);
    font-size: 9px;
  }

  /* Keypad section (der) - todo en clamp(px, vh) para         */
  /* autoajustarse al alto disponible.                          */
  .kiosk-keypad-section {
    padding: clamp(8px, 2vh, 20px);
  }

  .kiosk-form {
    gap: clamp(6px, 1.4vh, 14px);
    max-width: 420px;
    width: 100%;
  }

  .kiosk-display-label {
    font-size: 10px;
  }

  .kiosk-display {
    height: clamp(48px, 10vh, 76px);
    border-radius: 12px;
  }

  .kiosk-display input {
    font-size: clamp(28px, 6vh, 42px) !important;
    letter-spacing: 4px !important;
  }

  .kiosk-display-placeholder {
    font-size: clamp(22px, 5vh, 32px);
    letter-spacing: 4px;
  }

  .kiosk-keypad {
    gap: clamp(5px, 1.2vh, 10px);
  }

  /* Keypad keys: la altura mas critica para touch (~12mm =    */
  /* ~46px minimo). Cap en 64px para no exagerar.              */
  .kiosk-key {
    height: clamp(46px, 9.5vh, 64px);
    font-size: clamp(18px, 3.5vh, 26px);
    border-radius: 10px;
  }

  .kiosk-key-clear,
  .kiosk-key-back {
    font-size: clamp(15px, 3vh, 20px);
  }

  .kiosk-submit {
    height: clamp(40px, 8vh, 56px);
    font-size: clamp(13px, 2.6vh, 16px);
    margin-top: 0;
  }

  /* Debug viewport temporal (?debug=1) */
  .kiosk-debug-viewport {
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    background: rgba(200, 16, 46, 0.08);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(200, 16, 46, 0.3);
  }
}
