:root {
  --color--peppermint: #53ff9b;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d7dce5;
  --accent: #2762c7;
  --accent-2: #184aa6;
  --sidebar: #0f1a2b;
  --sidebar-text: #dbe7ff;
  --shadow: 0 12px 35px rgba(24, 44, 84, 0.12);
  --ring: color-mix(in srgb, var(--accent) 28%, transparent);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #000000;
  --surface: #101010;
  --surface-2: #181818;
  --text: #f1f1f1;
  --muted: #b8b8b8;
  --line: #2a2a2a;
  --accent: var(--color--peppermint);
  --accent-2: var(--color--peppermint);
  --sidebar: #050505;
  --sidebar-text: #f0dce6;
  --shadow: 0 16px 35px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

[data-theme="dark"] .page-bg {
  background: radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.04), transparent 35%),
    radial-gradient(circle at 90% 80%, rgba(83, 255, 155, 0.12), transparent 42%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.page-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 15% 10%, rgba(30, 85, 172, 0.16), transparent 35%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.12), transparent 42%);
  pointer-events: none;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.without-sidebar {
  grid-template-columns: 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar), color-mix(in srgb, var(--sidebar), #04070f 45%));
  color: var(--sidebar-text);
  padding: 22px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 0 4px;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  padding: 6px;
}

.brand h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.sidebar nav a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background-color 0.15s ease-out;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar nav a.active {
  font-weight: 600;
}

.theme-toggle {
  margin-top: 18px;
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--sidebar-text);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.content {
  padding: 32px 40px 56px;
  min-width: 0;
}

.backend-status {
  margin-bottom: 12px;
}

.app-shell.without-sidebar .content {
  display: grid;
  place-items: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 26px;
  max-width: 1040px;
  width: 100%;
}

.content > .card {
  margin-left: auto;
  margin-right: auto;
}

.login-card {
  width: min(520px, 100%);
}

.login-logo {
  display: block;
  height: 100px;
  width: auto;
  margin: 0 auto 12px;
}

h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.muted {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.error {
  color: #d33f3f;
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.search-form-stack {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.search-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-top: 6px;
  padding-bottom: 0;
}

.btn-primary.search-tab {
  border: 1px solid color-mix(in srgb, var(--accent), #ffffff 45%);
  border-bottom-color: transparent;
  border-radius: 8px 8px 0 0;
  background: color-mix(in srgb, var(--accent), #ffffff 88%);
  color: color-mix(in srgb, var(--accent-2), #111111 18%);
  min-height: 38px;
  padding: 8px 14px;
  font-weight: 500;
  margin-bottom: -1px;
}

.btn-primary.search-tab.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  border-bottom-color: var(--surface);
  font-weight: 700;
}

[data-theme="dark"] .btn-primary.search-tab {
  border-color: color-mix(in srgb, var(--color--peppermint), #000000 45%);
  background: color-mix(in srgb, var(--color--peppermint), #ffffff 70%);
  color: #173525;
}

[data-theme="dark"] .btn-primary.search-tab.is-active {
  background: var(--color--peppermint);
  color: #031008;
  border-color: var(--color--peppermint);
}

.search-panel {
  display: grid;
  gap: 12px;
  max-width: 760px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface);
  border-radius: 0 0 10px 10px;
}

.search-panel.two-cols {
  max-width: 760px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-form-stack .search-submit {
  justify-self: start;
  width: min(360px, 50%);
}

.form-grid.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-grid label input,
.form-grid label select {
  font-weight: 400;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  min-height: 40px;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  caret-color: var(--accent);
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

input:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
}

input[type="date"] {
  font-variant-numeric: tabular-nums;
}

.full {
  grid-column: 1 / -1;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, transform 0.1s ease-out;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:focus-visible,
.theme-toggle:focus-visible,
.sidebar nav a:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.form-grid > .btn-primary {
  justify-self: start;
  min-width: 190px;
  padding-inline: 22px;
}

.btn-inline {
  justify-self: start;
  width: auto;
}

.btn-full {
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-2);
}

[data-theme="dark"] .btn-primary {
  color: #000;
}

.company-box {
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px 12px;
}

.company-box > summary {
  cursor: pointer;
  font-weight: 600;
}

.table-card {
  margin-top: 16px;
}

.table-wrap {
  overflow: auto;
  max-height: 72vh;
  scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent;
}

.table-wrap a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

.table-wrap a:hover {
  color: var(--accent-2);
}

[data-theme="dark"] .table-wrap a {
  color: var(--color--peppermint);
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  font-size: 0.9rem;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

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

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-2);
}

.kpi-card {
  display: grid;
  gap: 4px;
}

.kpi-card h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.kpi-card p {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.resumen-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 14px 16px;
  max-width: 860px;
}

.resumen-row {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line);
  align-items: start;
}

.resumen-row:last-child {
  border-bottom: 0;
}

.resumen-label {
  font-weight: 700;
  line-height: 1.3;
}

.resumen-value {
  word-break: break-word;
  line-height: 1.4;
}

.resumen-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  justify-content: flex-end;
}

.impuesto-readonly {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  min-height: 40px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

#montos-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.montos-night {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.logout {
  margin-top: 10px;
  border-color: rgba(255, 132, 132, 0.5);
  color: #ffd9d9;
}

.idle-logout-countdown {
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--sidebar-text), #ffffff 22%);
}

.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(10, 16, 28, 0.5);
  padding: 16px;
}

.app-confirm-modal {
  width: min(598px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.app-confirm-modal h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.app-confirm-modal p {
  margin: 0;
  color: var(--text);
}

.app-confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.app-confirm-actions .btn-primary {
  width: auto;
  min-width: 72px;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .content {
    padding: 16px;
  }

  .form-grid.two-cols {
    grid-template-columns: 1fr;
  }

  .search-panel.two-cols {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .resumen-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .resumen-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  #montos-fields {
    grid-template-columns: 1fr;
  }
}

/* fork-b: graficos de KPIs (SVG propio, sin librerias) */
.kpi-charts { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.kpi-chart-block h2 { margin-top: 0; }
.kpi-svg { width: 100%; height: auto; display: block; }
.kpi-pie-svg { max-width: 260px; margin: 0 auto; transform: none; }
.kpi-pie-track { stroke: color-mix(in srgb, var(--line), transparent 30%); }
.kpi-grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.kpi-axis { fill: var(--muted, #6b7280); font-size: 11px; }
.kpi-area-fill { fill: rgba(78, 115, 223, 0.08); }
.kpi-area-line { fill: none; stroke: #4e73df; stroke-width: 2; }
.kpi-area-dot { fill: #4e73df; stroke: #ffffff; stroke-width: 2; }
.kpi-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin: 12px 0 0; padding: 0; font-size: 0.85rem; }
.kpi-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
@media (max-width: 860px) { .kpi-charts { grid-template-columns: 1fr; } }

/* ---- Refinamiento visual ---------------------------------------------- */

html {
  scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent;
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

.card + .card {
  margin-top: 20px;
}

.field-static {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.card > h2 + *:not(.muted) {
  margin-top: 16px;
}

/* tarjeta que solo lleva un mensaje de estado: compacta, sin hueco vacio */
.card:has(> .muted:only-child) {
  padding: 12px 20px;
}

.card:has(> .muted:only-child) .muted {
  margin: 0;
}

.sidebar-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-panel #theme-toggle {
  margin-top: auto;
}

.sidebar-panel .logout {
  margin-top: 8px;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 9px 14px;
  min-height: 44px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--sidebar-text);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  cursor: pointer;
}

.nav-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* acciones por fila: compactas, en linea y sin separadores */
.cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

td .btn-primary {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 0.82rem;
}

.btn-quiet,
.usuario-toggle,
.usuario-pass,
.cliente-use {
  background: transparent;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.btn-quiet:hover,
.usuario-toggle:hover,
.usuario-pass:hover,
.cliente-use:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

[data-theme="dark"] .btn-quiet,
[data-theme="dark"] .usuario-toggle,
[data-theme="dark"] .usuario-pass,
[data-theme="dark"] .cliente-use {
  color: var(--color--peppermint);
}

/* selector de modo (costos individuales / comunes) */
.choice-group {
  display: inline-flex;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.form-grid .choice {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice:has(input:checked) {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .choice:has(input:checked) {
  color: #000;
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar .brand {
    margin: 0;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0 12px;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: 0;
  }

  .sidebar-panel {
    display: none;
    grid-column: 1 / -1;
    margin-top: 12px;
    overflow: visible;
  }

  .sidebar.nav-open .sidebar-panel {
    display: flex;
  }

  .sidebar-panel #theme-toggle {
    margin-top: 16px;
  }

  .content {
    padding: 16px 16px 40px;
  }

  .card {
    padding: 18px;
  }

  input,
  select,
  textarea,
  .btn-primary {
    min-height: 44px;
  }

  td .btn-primary {
    min-height: 36px;
  }

  .form-grid > .btn-primary {
    justify-self: stretch;
  }

  .choice-group {
    width: 100%;
  }

  .form-grid .choice {
    flex: 1;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.search-panel label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.search-panel label input,
.search-panel label select {
  font-weight: 400;
}

.btn-primary.search-tab:hover:not(.is-active) {
  background: color-mix(in srgb, var(--accent) 18%, #ffffff);
}

/* las celdas de datos ceden ancho a la columna de acciones en lugar de cortarla */
.table-wrap td {
  overflow-wrap: break-word;
}

.table-wrap td:has(> .cell-actions) {
  min-width: 190px;
}

/* Mientras no se sabe si el usuario puede ver esta pantalla (menu del backend) no se pinta el contenido */
html.guard-pending .content {
  visibility: hidden;
}

/* ---- QA visual: pantallas de formulario, avisos y tablas ------------------ */

.form-grid > .btn-primary {
  align-self: end;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.form-actions > .btn-primary {
  min-width: 190px;
  padding-inline: 22px;
}

.card > form + .muted {
  margin: 14px 0 0;
}

/* aviso de caja con anulaciones pendientes */
#caja-pendientes:not([hidden]) {
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, #d97706 40%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, #d97706 10%, var(--surface));
  color: var(--text);
  line-height: 1.45;
}

/* mensajes de error legibles tambien en oscuro */
[data-theme="dark"] .error {
  color: #ff8f8f;
}

/* enlaces dentro del resumen (anular factura) */
.resumen-row a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.resumen-row a:hover {
  color: var(--accent-2);
}

[data-theme="dark"] .resumen-row a {
  color: var(--color--peppermint);
}

/* tablas: sombra lateral cuando hay mas contenido a izquierda o derecha */
.table-wrap {
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) 0 0 / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) 100% 0 / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.16), transparent) 0 0 / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.16), transparent) 100% 0 / 12px 100% no-repeat scroll;
}

/* tabla sin filas todavia */
.table-wrap:has(tbody:empty)::after {
  content: "Sin resultados todavia.";
  display: block;
  padding: 18px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap + .btn-primary,
.table-wrap + a.btn-primary {
  margin-top: 18px;
}

.card.table-card > .muted {
  margin-bottom: 14px;
}

@media (max-width: 960px) {
  .form-actions {
    display: grid;
  }

  .form-actions > .btn-primary {
    width: 100%;
  }
}

/* ---- QA visual: ajustes tras la tanda de confirmacion ------------------- */

/* tablas anchas: menos relleno lateral y acciones sin partirse */
.table-wrap th,
.table-wrap td {
  padding-inline: 8px;
}

.cell-actions a {
  white-space: nowrap;
}

/* listado de anulaciones: una solicitud por bloque, facturas en dos columnas */
.anular-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 28px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.anular-item:first-of-type {
  padding-top: 6px;
}

.anular-item:last-of-type {
  border-bottom: 0;
}

.anular-item p {
  margin: 0;
}

.anular-item > p:nth-of-type(3),
.anular-item > .btn-primary {
  grid-column: 1 / -1;
}

.anular-item > .btn-primary {
  justify-self: start;
  margin-top: 6px;
}

.anular-item u {
  text-decoration: none;
  font-weight: 700;
}

.anular-item details {
  margin-top: 4px;
}

.anular-item summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}

[data-theme="dark"] .anular-item summary {
  color: var(--color--peppermint);
}

.anular-item ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

@media (max-width: 960px) {
  /* sin esto el menu movil reparte la altura sobrante y deja un hueco bajo la cabecera */
  .app-shell {
    align-content: start;
  }

  .anular-item {
    grid-template-columns: 1fr;
  }
}

/* password reset */
.reset-state {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 4px;
}

.reset-state h3 {
  margin: 0;
  font-size: 1.1rem;
}

.reset-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.reset-state:focus {
  outline: none;
}

#reset-form .error {
  margin: 0;
}

.cell-note {
  align-self: center;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

/* password reset: requisitos de contrasena, mostrar/ocultar y temporizador */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pw-toggle {
  justify-self: start;
  min-height: 32px;
  padding: 4px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 8px;
  cursor: pointer;
}

.pw-toggle:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[data-theme="dark"] .pw-toggle {
  color: var(--color--peppermint);
}

.pw-checklist {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 12px 14px;
  list-style: none;
  font-size: 0.86rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.pw-req {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.pw-req svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pw-req[data-ok="true"] {
  color: #1b6b3a;
  font-weight: 600;
}

[data-theme="dark"] .pw-req[data-ok="true"] {
  color: var(--color--peppermint);
}

.pw-summary {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

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

.pw-note {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.reset-server-reqs {
  margin: 0;
  padding: 10px 14px 10px 30px;
  font-size: 0.86rem;
  color: #8a1c1c;
  background: #fde8e8;
  border: 1px solid #d33f3f;
  border-radius: 10px;
}

[data-theme="dark"] .reset-server-reqs {
  color: #ff9b9b;
  background: #3b1111;
  border-color: #a33;
}

.reset-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 14px;
  padding: 10px 14px;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.reset-timer-flag {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reset-timer[data-state="warn"] {
  color: #5a3b00;
  background: #fff4d6;
  border-color: #c98a00;
}

.reset-timer[data-state="urgent"] {
  color: #8a1c1c;
  background: #fde8e8;
  border-color: #d33f3f;
}

[data-theme="dark"] .reset-timer[data-state="warn"] {
  color: #ffd666;
  background: #3a2d00;
  border-color: #a07000;
}

[data-theme="dark"] .reset-timer[data-state="urgent"] {
  color: #ff9b9b;
  background: #3b1111;
  border-color: #a33;
}

.reset-expired {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin: 0;
  padding: 14px 16px;
  color: #8a1c1c;
  background: #fde8e8;
  border: 1px solid #d33f3f;
  border-radius: 10px;
}

.reset-expired p {
  margin: 0;
  font-weight: 700;
}

.reset-expired a {
  font-size: 0.88rem;
  font-weight: 600;
  color: inherit;
}

[data-theme="dark"] .reset-expired {
  color: #ff9b9b;
  background: #3b1111;
  border-color: #a33;
}

/* mostrar/ocultar dentro del propio campo */
.form-grid label:has(> .pw-toggle) {
  position: relative;
}

.form-grid label:has(> .pw-toggle) input {
  padding-right: 88px;
}

.form-grid label > .pw-toggle {
  position: absolute;
  right: 5px;
  bottom: 4px;
  min-height: 32px;
}
