/* ============================================================
   Presto — dashboard financiero (estilo SaaS). Tema claro por
   defecto, con botón para pasar a oscuro (se recuerda en este
   dispositivo). Sidebar en desktop, barra de navegación inferior
   en móvil.
   ============================================================ */

:root {
  /* Tema claro (por defecto) */
  --bg: #f4f5f8;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #eef1f7;
  --border: #e2e6ee;
  --text: #1a2233;
  --text-soft: #5b6478;
  --text-faint: #94a0b4;
  --blue: #3b76e0;
  --blue-soft: rgba(59, 118, 224, 0.12);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.12);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --field-bg: #ffffff;
  --border-input: #aab4c6;
  --shadow-float: 0 8px 20px rgba(0, 0, 0, 0.35);
  --tap-target: 44px;
  color-scheme: light;
}

/* Tema oscuro: sólo con el botón de tema (id=btn-tema), nunca automático. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-panel: #141a24;
  --bg-card: #1a2233;
  --bg-card-hover: #212b3f;
  --border: #2a3348;
  --text: #e7ebf3;
  --text-soft: #8b95a8;
  --text-faint: #5b6478;
  --field-bg: #0a0e15;
  --border-input: #4a5876;
  --blue: #4f8ef7;
  --blue-soft: rgba(79, 142, 247, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --amber: #f5a623;
  --amber-soft: rgba(245, 166, 35, 0.14);
}

* {
  box-sizing: border-box;
}

/* Sólo en body, nunca en html: si ambos declaran overflow-x, se crean dos
   contenedores de scroll anidados y position:sticky dentro del sidebar
   deja de funcionar (queda "pegado" al que nunca se mueve, en vez del real). */
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

button, input, select {
  font-family: inherit;
}

svg { display: block; }

/* ---------- Layout general ---------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell[hidden] { display: none; }

.sidebar {
  width: 100%;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
}

.sidebar__mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar__title {
  font-size: 16px;
  font-weight: 700;
}

.sidebar__subtitle {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar__user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 20px 16px;
  font-size: 12px;
  color: var(--text-soft);
}

.sidebar__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar__who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }

.sidebar__avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
}

.sidebar__name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__role { font-size: 11.5px; color: var(--text-soft); }
.sidebar__login { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__login:empty { display: none; }

.sidebar__actions { display: flex; align-items: center; gap: 8px; }
.sidebar__theme { display: inline-flex; align-items: center; justify-content: center; }

main {
  flex: 1;
  min-width: 0;
  padding: 20px 16px 88px;
}

@media (min-width: 900px) {
  .shell { display: block; min-height: 100vh; }

  /* Fijo a la pantalla: no se mueve al bajar. Marca arriba, navegación al medio (con su propio scroll) y usuario abajo. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 30;
    border-bottom: none;
    border-right: 1px solid var(--border);
    justify-content: space-between;
    overflow: hidden;
  }
  .sidebar > div:first-child { flex: 1; min-height: 0; overflow-y: auto; }
  .sidebar__brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
  .sidebar__user {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
  }
  .sidebar__buy { width: 100%; text-align: center; }
  .sidebar__logout { flex: 1; }

  main { margin-left: 240px; padding: 32px 40px; }
  .trial-bar { margin-left: 240px; }
}
}

.view[hidden] { display: none; }

.view-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.view-heading h2 {
  font-size: 22px;
}

.view-heading__meta {
  font-size: 12.5px;
  color: var(--text-soft);
  text-transform: capitalize;
}

/* ---------- Navegación (sidebar / barra inferior) ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
}

.tab {
  appearance: none;
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.tab__badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

@media (max-width: 899px) {
  .tab__badge { top: 2px; right: 18%; }
}

.tab:hover { background: var(--bg-card); color: var(--text); }

.tab { transition: background 0.15s ease, color 0.15s ease; }

.tab[aria-selected="true"] {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

@media (min-width: 900px) {
  .tab { padding: 10px 12px; gap: 12px; }
  .tab[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--blue); }
}

.tab__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tab__label {
  white-space: nowrap;
}

.tab:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (min-width: 900px) {
  .tabs { flex-direction: column; padding: 8px 12px; gap: 2px; }
}

.tab[hidden] { display: none; }
.tab--more { display: none; }

/* En celular se ven las pestañas principales + "Más"; el resto se abre desde ahí (lo maneja la clase has-more, para cualquier rol). */
@media (max-width: 899px) {
  .has-more .tab[data-more] { display: none; }
  .has-more .tab--more { display: flex; }
}

.mas-menu {
  position: fixed;
  z-index: 45;
  min-width: 190px;
  padding: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(10, 15, 30, 0.25);
}
.mas-menu { overflow-y: auto; }
.mas-menu[hidden] { display: none; }
.mas-menu__item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.mas-menu__item:hover { background: var(--bg-card-hover); }
.mas-menu--new { width: 260px; }
.mas-menu--new .mas-menu__item { align-items: flex-start; }
.mas-menu__chev { margin-left: auto; color: var(--text-soft); transition: transform 0.15s ease; }
.mas-menu__item[aria-expanded="true"] .mas-menu__chev { transform: rotate(180deg); }
.mas-menu__sub { margin: 0 0 4px 22px; padding-left: 10px; border-left: 2px solid var(--border); }
.mas-menu__sub[hidden] { display: none; }
.mas-menu__subitem { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-soft); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.mas-menu__subitem[aria-pressed="true"] { color: var(--blue); font-weight: 600; }

/* Sub-menú de Reportes en la barra lateral (escritorio). */
.tab-sub { display: none; }
@media (min-width: 900px) {
  .tab-sub:not([hidden]) { display: flex; flex-direction: column; margin: 0 0 4px 30px; padding-left: 10px; border-left: 2px solid var(--border); }
}
.tab-sub__item { padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-soft); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.tab-sub__item:hover { background: var(--bg-card-hover); }
.tab-sub__item[aria-pressed="true"] { color: var(--blue); font-weight: 600; }
.mas-menu__item .tab__icon { width: 20px; height: 20px; color: var(--blue); }

@media (max-width: 899px) {
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tab {
    flex-direction: column;
    gap: 3px;
    text-align: center;
    font-size: 10.5px;
    padding: 6px 4px;
  }
  .tab__label { white-space: normal; line-height: 1.15; }
}

/* ---------- Tarjetas de estadística ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

#view-ruta .stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 480px) {
  #view-ruta .stat-grid { grid-template-columns: repeat(2, minmax(0, 260px)); }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
}

.stat-card__label {
  font-size: 12px;
  color: var(--text-soft);
}

.stat-card__value {
  font-size: clamp(15px, 4.4vw, 24px);
  font-weight: 700;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.stat-card__value--red { color: var(--red); }
.stat-card__value--green { color: var(--green); }

.stat-card__sub {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 4px;
}

/* ---------- Layouts de dos columnas ---------- */

.panel-columns,
.loan-form-grid {
  display: block;
}
/* En el celular las dos mitades se apilan con aire entre ellas y sin salirse de la pantalla. */
.loan-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.loan-form-grid > * { min-width: 0; }

@media (min-width: 860px) {
  .panel-columns { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
  .loan-form-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---------- Icono de ayuda (i) con tooltip ---------- */

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card-hover);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
}

.info-tip:hover,
.info-tip:focus-visible {
  background: var(--blue-soft);
  color: var(--blue);
  outline: none;
}

.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 220px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg-card);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 50;
}

.info-tip:hover::after,
.info-tip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

/* El globo ancho se apoya en el encabezado de la pantalla (no en el icono) para no salirse por la derecha en el celular. */
.view-heading { position: relative; }
.info-tip--wide { position: static; }
.info-tip--wide::after { top: calc(100% + 4px); bottom: auto; left: 0; right: 0; transform: none; width: auto; max-width: none; }

/* ---------- Botones de una sola pulsación (en lugar de listas con pocas opciones) ---------- */

select[data-seg] { display: none !important; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg__btn {
  flex: 1 1 0;
  min-width: 64px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
input + select[data-seg] + .seg { flex: 0 0 auto; flex-wrap: nowrap; }
input + select[data-seg] + .seg .seg__btn { flex: 0 0 auto; min-width: 48px; }
.type-cards { display: grid; gap: 8px; margin-top: 6px; }
.type-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.type-card__text { font-size: 12.5px; color: var(--text-soft); line-height: 1.4; }
.type-card[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); }
.type-card__change { font-size: 12px; font-weight: 600; color: var(--blue); }
.type-card[disabled] { opacity: 0.55; cursor: not-allowed; }
.moneda-vista + .seg { flex: 0 0 auto; flex-wrap: nowrap; }
.moneda-vista + .seg .seg__btn { flex: 0 0 auto; min-width: 52px; padding: 6px 10px; }
.seg__btn[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }

/* ---------- Badges de estado ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.badge--red { background: var(--red-soft); color: var(--red); }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- Filtro de pills (Todos/Pendientes/Pagados) ---------- */

.filter-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-pill[aria-selected="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #071022;
}

/* ---------- Ticket de cliente (ruta de cobro) ---------- */

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.client-card__row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.client-card__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.client-card--collected .client-card__avatar {
  background: var(--green-soft);
  color: var(--green);
}

.client-card__body {
  flex: 1;
  min-width: 0;
}

.client-card__name {
  font-weight: 600;
  font-size: 14.5px;
}

.client-card__meta {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 1px;
}

.client-card__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.client-card__amount {
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.amount-input {
  flex: 1 1 90px;
  min-width: 0;
  max-width: 120px;
  font-family: inherit;
  font-size: 13.5px;
  padding: 7px 9px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  color: var(--text);
}

.link-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

/* ---------- Botones ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #071022;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn:hover { filter: brightness(1.08); }
a.btn { text-decoration: none; display: inline-block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-soft);
}
.btn--ghost:hover { background: var(--bg-card-hover); color: var(--text); }

.btn--green { background: var(--green); border-color: var(--green); }
.btn--danger { color: var(--red); border-color: var(--red-soft); }
.btn--danger:hover { background: var(--red-soft); color: var(--red); }
.btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.btn--small { padding: 6px 12px; font-size: 12px; }

/* Área táctil mínima recomendada (44px) para botones y pills en mobile;
   .btn--small queda afuera a propósito, se usa en filas densas (editar,
   ver, borrar) donde agrandarlo rompería el layout. */
@media (max-width: 899px) {
  .btn:not(.btn--small) {
    min-height: var(--tap-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .filter-pill {
    min-height: var(--tap-target);
    display: inline-flex;
    align-items: center;
  }
}

/* Los display de .btn / a.btn pisan el atributo hidden: sin esto un botón "oculto" (ej. Comprar) seguía visible. */
.btn[hidden] { display: none; }

.client-card__notes-textarea {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--border-input);
  background: var(--field-bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  resize: vertical;
}

.payment-method-select {
  border: 1.5px solid var(--border-input);
  background: var(--field-bg);
  color: var(--text);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

/* ---------- Formularios ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  min-width: 0;
}

.field[hidden] { display: none; }

.field label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-soft);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--border-input);
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  outline: none;
}

.field input::placeholder { color: var(--text-faint); }

/* iOS/Android hacen zoom automático al enfocar un input con font-size
   menor a 16px; eso es el "zoom" que se nota al abrir la app y tocar el
   primer campo (usuario/contraseña). Se sube a 16px sólo en mobile para
   no perder la densidad del layout de escritorio. */
@media (max-width: 899px) {
  .field input,
  .field select,
  .field textarea,
  .amount-input,
  .payment-method-select {
    font-size: 16px;
  }
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 420px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row--3 { grid-template-columns: 1fr 1fr; }
}
#mapa-cobrador, #mapa-ver, #mapa-orden { font-size: 13px; padding-left: 8px; padding-right: 22px; text-overflow: ellipsis; }
/* Dos campos cortos que van siempre lado a lado, también en el celular. */
.field-row--pair { grid-template-columns: 1fr 1fr; }
@media (min-width: 560px) {
  .field-row--3 { grid-template-columns: repeat(3, 1fr); }
}

.hint { font-size: 12px; color: var(--text-soft); margin-top: -8px; margin-bottom: 14px; }
.hint--error { color: var(--red); font-weight: 500; }
.ruta-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; }
.ruta-tools[hidden], .ruta-tools:empty { display: none; }
.geo-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-soft); cursor: pointer; }
.queued-badge { font-size: 11px; font-weight: 600; color: var(--amber); }
.hint--warn { color: var(--amber); background: var(--amber-soft); border-radius: var(--radius-sm); padding: 8px 12px; font-weight: 500; margin-bottom: 12px; }
.loan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hint--info {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  line-height: 1.5;
}

.info-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid var(--text-faint);
  background: transparent;
  color: var(--text-faint);
  font-size: 10px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.info-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Campo de contraseña con "ver" ---------- */

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  background: none;
  border: none;
  color: var(--text-soft);
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
}
.password-toggle::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: auto;
  background: currentColor;
  -webkit-mask: var(--eye) center / contain no-repeat;
  mask: var(--eye) center / contain no-repeat;
  --eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}
.password-toggle.is-shown::before {
  --eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.9 17.9A10.9 10.9 0 0 1 12 19C5.6 19 2 12 2 12a18.5 18.5 0 0 1 5.1-5.9M9.9 4.2A10 10 0 0 1 12 4c6.4 0 10 7 10 7a18.6 18.6 0 0 1-2.2 3.2M14.1 14.1a3 3 0 1 1-4.2-4.2'/%3E%3Cpath d='M1 1l22 22'/%3E%3C/svg%3E");
}
.password-toggle:hover { color: var(--text); }

/* Lista de reglas de la contraseña nueva: el círculo se llena de verde al cumplirse */
.pw-rules { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; color: var(--text-soft); }
.pw-rules li { display: flex; align-items: center; gap: 8px; }
.pw-rules li::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1.5px solid var(--border); box-sizing: border-box; }
.pw-rules li.ok { color: var(--green); }
.pw-rules li.ok::before { border-color: var(--green); background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8.5l3 3 5-6'/%3E%3C/svg%3E") center / 10px no-repeat; }

/* ---------- Donut de cartera ---------- */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.donut-legend { flex: 1; min-width: 180px; }

.donut-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 12.5px;
}

.donut-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  flex-shrink: 0;
}

.donut-legend-label { color: var(--text-soft); display: flex; align-items: center; }
.donut-legend-value { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Alertas ---------- */

.alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.alert-row:last-child { border-bottom: none; }
.alert-row__name { font-weight: 500; }
.alert-row__amount { color: var(--red); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Nuevo préstamo: búsqueda de cliente ---------- */

.client-search { position: relative; }

.client-results {
  position: absolute;
  z-index: 5;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow-float);
}

.client-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.client-results button:last-child { border-bottom: none; }
.client-results button:hover { background: var(--bg-card-hover); }

.selected-client {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--bg-card);
}

.selected-client__name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
/* Ficha del cliente: arriba foto y nombre; los botones debajo, en filas que se acomodan al ancho del teléfono. */
.client-head { display: flex; flex-direction: column; gap: 10px; }
.client-head__who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.client-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Las fechas del iPhone traen un ancho propio: se igualan al de los demás campos para que no se salgan de la tarjeta. */
input[type="date"] { display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; -webkit-appearance: none; appearance: none; text-align: left; }
.contract-grid > *, .field-row > * { min-width: 0; }

.history-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.history-chip {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  color: var(--text-soft);
  background: none;
  font-family: inherit;
}

button.history-chip {
  cursor: pointer;
}
button.history-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--blue);
}

/* ---------- Resumen simulado ---------- */

.summary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg-card);
}

.summary-card__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.summary-card__line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
}

.summary-card__line--total {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}

.summary-card__schedule {
  margin-top: 14px;
  max-height: 180px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.summary-card__schedule-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 5px 0;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.summary-card__schedule-row:last-child { border-bottom: none; }

/* ---------- Usuarios ---------- */

.user-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; }
.user-row > div:first-child { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.user-row__name { font-weight: 600; }
.user-row__meta { font-size: 11.5px; color: var(--text-soft); }
.user-row--disabled .user-row__name,
.user-row--disabled .user-row__meta { color: var(--text-faint); }

.user-row__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- Clientes y detalle de préstamo ---------- */

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: 8px;
  cursor: pointer;
}
.list-row:hover { background: var(--bg-card-hover); }
.list-row__name { font-weight: 600; }
.list-row__meta { font-size: 12px; color: var(--text-soft); }

.installment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.installment-row:last-child { border-bottom: none; }
.installment-row__advance { font-size: 11px; color: var(--blue); margin-top: 2px; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  color: var(--text-soft);
  font-size: 13px;
}

/* ---------- Acceso (login) ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth-screen[hidden] { display: none; }

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  text-align: center;
}

.auth-card__mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border-radius: 10px;
  overflow: hidden;
}

.auth-card__title { font-size: 20px; margin-bottom: 4px; }

.auth-card__subtitle {
  font-size: 12px;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.auth-card .field { text-align: left; }

/* Panel de marca a la izquierda del acceso: solo en pantallas anchas; en el celular queda solo la tarjeta. */
/* Celular: cabecera chica con la marca y una línea, y el formulario en una hoja blanca que sube sobre ella. */
.auth-hero {
  display: flex;
  flex-direction: column;
  color: #cfe3dc;
  padding: 26px 24px 52px;
  background:
    radial-gradient(90% 90% at 100% 0%, rgba(31, 181, 122, 0.3) 0%, transparent 60%),
    linear-gradient(160deg, #115245 0%, #0c3a33 50%, #07231f 100%);
}
.auth-screen { flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 0; background: var(--bg-panel); }
.auth-screen .auth-card { width: 100%; max-width: none; flex: 1; margin: -26px 0 0; border: 0; border-radius: 28px 28px 0 0; padding: 30px 24px 28px; }
.auth-screen .auth-card__mark, .auth-screen .auth-card__title { display: none; }
.auth-screen .auth-card__subtitle { font-size: 22px; font-weight: 700; color: var(--text); text-align: left; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 0; }
.auth-hero__top { display: block; }
.auth-hero__brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.auth-hero__brand svg { width: 34px; height: 34px; }
.auth-hero__pill, .auth-hero__main > p, .auth-demo, .auth-hero__features { display: none; }
.auth-hero h2 { font-size: 17px; line-height: 1.35; font-weight: 500; color: #b4cfc6; margin: 0; }
.auth-hero h2 br { display: none; }
.auth-hero h2 em { font-style: normal; color: #bff0d8; font-weight: 600; }
@media (min-width: 900px) {
  .auth-screen { flex-direction: row; background: var(--bg); }
  .auth-screen .auth-card { width: 100%; max-width: 400px; margin: 32px 24px; align-self: center; justify-self: center; flex: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 28px 28px; }
  .auth-screen .auth-card__mark { display: block; }
  .auth-screen .auth-card__title { display: block; }
  .auth-screen .auth-card__subtitle { font-size: 12px; font-weight: 400; color: var(--text-soft); text-align: center; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
  .auth-hero__top { display: flex; }
  .auth-hero__brand { margin-bottom: 0; }
  .auth-hero__brand svg { width: 40px; height: 40px; }
  .auth-hero h2 br { display: inline; }
  .auth-hero__pill { display: inline-block; }
  .auth-hero__main > p { display: block; }
  .auth-hero__features { display: grid; }
  .auth-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 0; align-items: stretch; }
  .auth-screen[hidden] { display: none; }
  .auth-card { align-self: center; justify-self: center; max-width: 400px; margin: 32px 24px; }
  .auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 36px;
    padding: 48px 56px;
    color: #cfe3dc;
    background:
      radial-gradient(90% 60% at 100% 0%, rgba(31, 181, 122, 0.28) 0%, transparent 60%),
      radial-gradient(80% 50% at 0% 100%, rgba(91, 157, 255, 0.16) 0%, transparent 60%),
      linear-gradient(160deg, #115245 0%, #0c3a33 45%, #07231f 100%);
  }
  .auth-hero__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .auth-hero__brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; color: #fff; }
  .auth-hero__pill { font-size: 12.5px; font-weight: 600; color: #bff0d8; border: 1px solid rgba(191, 240, 216, 0.35); background: rgba(191, 240, 216, 0.08); border-radius: 999px; padding: 6px 14px; }
  .auth-hero__main { max-width: 520px; }
  .auth-hero h2 { font-size: 46px; line-height: 1.08; font-weight: 800; letter-spacing: -0.02em; color: #fff; margin-bottom: 18px; }
  .auth-hero h2 em { font-style: normal; color: #1fb57a; }
  .auth-hero__main > p { font-size: 17px; line-height: 1.55; color: #b4cfc6; margin-bottom: 28px; }
  .auth-demo { display: block; background: #f6f3ec; color: #14302b; border-radius: 16px; padding: 16px 18px; box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.55); max-width: 400px; transform: rotate(-1.5deg); }
  .auth-demo__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; }
  .auth-demo__head span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #5a6e69; background: #ede7da; border-radius: 999px; padding: 3px 9px; }
  .auth-demo__row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid rgba(7, 35, 31, 0.1); font-size: 14px; }
  .auth-demo__row b { margin-left: auto; font-size: 12.5px; }
  .auth-demo__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
  .auth-demo__dot--ok { background: #1fb57a; }
  .auth-demo__dot--late { background: #ef6a5b; }
  .auth-demo__dot--due { background: #f2b24a; }
  .auth-hero__features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .auth-hero__features li { display: grid; gap: 3px; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(191, 240, 216, 0.14); }
  .auth-hero__features strong { color: #fff; font-size: 14px; }
  .auth-hero__features span { font-size: 12.5px; line-height: 1.4; color: #a9c4ba; }
}
@media (min-width: 900px) and (max-height: 760px) {
  .auth-hero { padding: 32px 48px; gap: 20px; }
  .auth-hero h2 { font-size: 36px; }
  .auth-hero__main > p { margin-bottom: 18px; }
}
@media (min-width: 900px) and (max-height: 700px) {
  .auth-hero { padding: 24px 40px; gap: 16px; }
  .auth-hero h2 { font-size: 32px; margin-bottom: 12px; }
  .auth-hero__main > p { font-size: 15px; margin-bottom: 0; }
  .auth-demo { display: none; }
  .auth-hero__features li { padding: 10px 12px; }
}

/* ---------- Modal genérico ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

/* Ventana ancha (elegir plan): tarjetas lado a lado en escritorio. */
.modal--wide { max-width: 900px; }

.modal__title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal__preview {
  font-size: 13px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 16px;
}
.modal__preview--exact { border-color: var(--green); color: var(--green); }
.modal__preview--short { border-color: var(--amber); color: var(--amber); }
.modal__preview--advance { border-color: var(--blue); color: var(--blue); }

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Ventana de video: sólo el video (9:16) y un botón de cerrar. */
.modal--video {
  position: relative;
  width: auto;
  max-width: none;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}
.ayuda-video {
  display: block;
  width: min(calc(100vw - 40px), calc((100vh - 90px) * 9 / 16));
  aspect-ratio: 9 / 16;
  border: 0;
  border-radius: var(--radius);
  background: #000;
}
.ayuda-cerrar {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(14, 16, 20, 0.92);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float);
  z-index: 50;
}
.toast[hidden] { display: none; }
.toast--error { border-color: var(--red); color: var(--red); }
.toast--success { border-color: var(--green); color: var(--green); }

@media (max-width: 899px) {
  .toast { bottom: 76px; }
}

/* ---------- Gráfico de ingresos mensuales ---------- */

.income-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 160px;
  padding-top: 10px;
}

.income-chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
}

.income-chart__bars {
  width: 100%;
  max-width: 46px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}

.income-chart__bar-capital { background: var(--green); }
.income-chart__bar-interes { background: var(--blue); }

.income-chart__mes {
  font-size: 11px;
  color: var(--text-soft);
  white-space: nowrap;
}

.income-chart__total {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Recibo imprimible ---------- */

.receipt-print { display: none; }

@media print {
  body * { visibility: hidden; }
  #receipt-print, #receipt-print * { visibility: visible; }
  #receipt-print {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px;
    color: #000;
    background: #fff;
    font-family: Arial, sans-serif;
  }
  #receipt-print h2 { margin: 0 0 4px; }
  #receipt-print .receipt__line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed #999;
  }
  #receipt-print .receipt__total {
    font-weight: 700;
    font-size: 16px;
    border-bottom: none;
    border-top: 2px solid #000;
    margin-top: 8px;
    padding-top: 8px;
  }
}

/* ---------- Franja de prueba y registro con Google ---------- */

.trial-bar {
  padding: 7px 14px;
  background: var(--blue);
  color: #071022;
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
  line-height: 1.35;
}
.trial-bar[hidden] { display: none; }
.trial-bar a { color: inherit; font-weight: 700; text-decoration: underline; }
.trial-bar--expired { background: var(--red); color: #fff; }

.su-progreso { height: 4px; border-radius: 2px; background: var(--border, #e2e8f0); overflow: hidden; }
.su-progreso span { display: block; height: 100%; width: 50%; background: var(--green, #059669); transition: width 0.25s; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--text-faint);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  text-decoration: none;
  color: var(--text);
}
.auth-trial-hint { margin: 10px 0 0; text-align: center; }

/* ---------- Ruta agrupada por cliente ---------- */

.loan-block { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.loan-block:first-of-type { border-top: none; margin-top: 4px; }
.loan-block__title { font-size: 11.5px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 6px; }

.auth-switch { margin: 14px 0 0; text-align: center; }
.auth-card .auth-switch .link-btn { font-size: 12.5px; font-weight: 600; }

/* ---------- Novedades (versiones) ---------- */

.changelog__version { border-bottom: 1px solid var(--border); padding: 10px 0; }
.changelog__version:last-child { border-bottom: none; }
.changelog__version summary { cursor: pointer; font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.changelog__tag { color: var(--blue); font-variant-numeric: tabular-nums; }
.changelog__version ul { margin: 8px 0 2px; padding-left: 20px; color: var(--text-soft); font-size: 13px; line-height: 1.55; }

/* Etiqueta "Próximamente" junto a funciones que todavía no están. */
.soon-tag { font-size: 11px; color: var(--text-faint); white-space: nowrap; }

/* Ventana "Mejorar plan": tarjetas de plan lado a lado (una debajo de otra en celular). */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.plan-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.msg-bubble { background: #dcf8c6; color: #111; border-radius: 12px 12px 12px 2px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; line-height: 1.45; max-width: 100%; word-break: break-word; margin-bottom: 8px; }
:root[data-theme="dark"] .msg-bubble { background: #1f3b2a; color: #e9f5ec; }
.contract-preview { background: #fff; color: #111; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; max-height: 260px; overflow: auto; font-family: Georgia, "Times New Roman", serif; font-size: 13px; line-height: 1.5; }
.contract-preview p { margin: 0 0 8px; }
:root[data-theme="dark"] .contract-preview { background: #f4f1ea; }
.plan-card--chosen { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft, rgba(22, 163, 74, 0.25)); }
.plan-card__name { font-size: 13px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.plan-card__price { font-size: 24px; font-weight: 700; color: var(--text); }
.plan-card__price small { font-size: 12px; font-weight: 500; color: var(--text-soft); }
.plan-card__usd { font-size: 12px; color: var(--text-soft); }
.plan-card__save { font-size: 12px; font-weight: 600; color: var(--green); }
.plan-card__list { flex: 1; margin: 4px 0 6px; padding-left: 16px; font-size: 13px; color: var(--text-soft); }
.plan-card .btn { width: 100%; }
.plan-fx-note { margin-top: 12px; font-size: 12px; color: var(--text-soft); }
.price-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.price-table th, .price-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.price-table input { width: 100%; min-width: 70px; }

.trial-bar--warn { background: var(--amber); color: #1a1205; }
.combo { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 220px; overflow-y: auto; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); margin-top: 2px; }
.combo[hidden] { display: none; }
.combo__item { display: block; width: 100%; text-align: left; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid var(--border); font: inherit; color: inherit; cursor: pointer; }
.combo__item:last-child { border-bottom: 0; }
.combo__item:hover, .combo__item:focus { background: var(--blue-soft, #eef4ff); }
[data-rsec-off],
[data-usec-off] { display: none !important; }
.is-collapsed { display: none; }
.toolbar-row { display: flex; gap: 8px; margin: 0 0 12px; }
/* Lo que se esconde por permiso se esconde de verdad, aunque su clase le dé un display propio (grid, flex). */
[data-perm][hidden] { display: none !important; }
#plan-notice-bar button + button { margin-left: 14px; }
.trial-bar--warn button { appearance: none; background: none; border: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

.recovery-code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 14px 8px;
  margin: 14px 0;
  border: 1.5px dashed var(--border-input);
  border-radius: var(--radius);
  user-select: all;
  overflow-wrap: anywhere;
}

/* En el celular el formulario de gasto va arriba de la lista: se carga más seguido de lo que se revisa. */
@media (max-width: 859px) {
  #view-gastos .loan-form-grid { display: flex; flex-direction: column-reverse; gap: 16px; }
}

.cc-line{display:flex;justify-content:space-between;gap:16px;padding:4px 0}
.cc-line span:last-child{font-weight:600;white-space:nowrap}

.imp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.imp-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.imp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.imp-table th, .imp-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.imp-table th { position: sticky; top: 0; background: var(--surface, #fff); font-weight: 600; }
.imp-table select { max-width: 100%; }
.imp-sample { color: var(--text-muted, #5b6478); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 12px 0; }
.imp-bar > div { height: 100%; background: var(--green, #16a34a); width: 0; transition: width .2s; }

.sig-pad { display: block; width: 100%; max-width: 320px; height: 110px; border: 1px dashed var(--border-strong, #b6bfce); border-radius: var(--radius-sm); background: #fff; touch-action: none; cursor: crosshair; }
.sig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 8px 0; }
.contract-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }

/* Catálogo y ventas */
.product-card { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface, #fff); margin-bottom: 10px; cursor: pointer; }
.product-card:hover { border-color: var(--blue); }
.product-card__img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--blue-soft); flex: none; display: flex; align-items: center; justify-content: center; color: var(--blue); font-weight: 700; }
.product-card__body { flex: 1; min-width: 0; }
.product-card__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card__meta { font-size: 12px; color: var(--text-soft); }
.product-card__side { text-align: right; flex: none; }
.sale-line { display: grid; grid-template-columns: 1fr 70px 90px 28px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.sale-line input { width: 100%; }
#modal-content { overflow-anchor: none; }
.sale-sim { min-height: 96px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--blue-soft, #eef4ff); margin: 10px 0; }
.sale-sim__big { font-size: 22px; font-weight: 700; }
.pick-list { max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 4px; }
.pick-list button { display: block; width: 100%; text-align: left; padding: 8px 10px; background: none; border: 0; border-bottom: 1px solid var(--border); cursor: pointer; font: inherit; color: inherit; }
.pick-list button:hover { background: var(--blue-soft); }

.contract-grid[hidden], .sig-row[hidden], .pick-list[hidden] { display: none; }

/* Score interno del cliente: una guía para el dueño */
.score-card { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.score-card summary { cursor: pointer; color: var(--text-soft); font-size: 12px; margin-top: 2px; }
.score-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin: 6px 0 2px; }
.score-bar > div { height: 100%; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: 12px; }

/* Pago con USDT: la advertencia de red va grande y en rojo a propósito (enviar por otra red pierde el dinero). */
.usdt-warning { background: var(--red-soft, #fdecec); color: var(--red); border: 2px solid var(--red); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; line-height: 1.45; margin-bottom: 12px; }
.usdt-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.usdt-box__label { font-size: 12px; color: var(--text-soft); }
.usdt-box__value { font-size: 22px; font-weight: 700; margin: 2px 0 6px; }
.usdt-box__value--addr { font-size: 14px; word-break: break-all; font-family: ui-monospace, monospace; }
.usdt-deadline { font-size: 14px; margin: 6px 0; }

/* ---------- Mapa del día ---------- */

.map-canvas { height: 56vh; min-height: 320px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-card-hover); }
.map-pin { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); color: #fff; font-size: 12px; font-weight: 700; }
.map-pin > span { transform: rotate(45deg); }
.map-pin--late { background: var(--red); }
.map-pin--today { background: #e29a00; }
.map-pin--done { background: var(--green); }
.map-popup strong { display: block; }
.map-popup a { margin-right: 10px; }

/* ---------- Botón para subir arriba ---------- */

.to-top {
  position: fixed;
  right: 16px;
  bottom: 92px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--blue);
  box-shadow: 0 4px 14px rgba(10, 15, 30, 0.18);
  cursor: pointer;
}
.to-top[hidden] { display: none; }
@media (min-width: 900px) { .to-top { bottom: 24px; } }


/* ---------- Clientes: lista y ficha ---------- */

.filter-pills--slide { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.filter-pills--slide::-webkit-scrollbar { display: none; }
.filter-pills--slide .filter-pill { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }

.client-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 0 0 12px; }
.client-kpi { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); }
.client-kpi__label { font-size: 11px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.client-kpi__value { font-size: 15px; font-weight: 700; margin-top: 2px; white-space: nowrap; }
#clientes-resumen { grid-template-columns: 1fr 1fr 1.7fr; }
.client-kpi__value--red { color: var(--red); }
.client-kpi__value--green { color: var(--green); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--bg-card-hover); color: var(--text-soft); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip--blue { background: var(--blue-soft); color: var(--blue); }
.chip--red { background: var(--red-soft, #fde8e8); color: var(--red); }
.chip--green { background: var(--green-soft); color: var(--green); }
.chip--amber { background: #fdf0d5; color: #9a6700; }

.client-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); cursor: pointer; }
.client-row:hover { background: var(--bg-card-hover); }
.client-row__body { flex: 1; min-width: 0; }
.client-row__name { font-weight: 700; overflow-wrap: anywhere; }
.client-row__meta { font-size: 12.5px; color: var(--text-soft); margin-top: 1px; overflow-wrap: anywhere; }
.client-row__side { text-align: right; flex-shrink: 0; }
.client-row__amount { font-weight: 700; }
.client-row__amount--zero { color: var(--text-faint); font-weight: 600; }
.client-row__chev { color: var(--text-faint); }

.avatar--xl { width: 72px; height: 72px; font-size: 24px; }
.client-profile__top { display: flex; align-items: center; gap: 14px; }
.client-profile__id { min-width: 0; }
.client-profile__actions { margin-top: 12px; }
.more-actions { margin-top: 8px; }
.more-actions > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--blue); padding: 6px 0; }
.more-actions .client-head__actions { margin-top: 6px; }
.client-profile .client-kpis { margin-top: 14px; }

.loan-card { padding: 14px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); cursor: pointer; }
.loan-card:hover { background: var(--bg-card-hover); }
.loan-card--closed { opacity: 0.75; }
.loan-card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.loan-card__amount { font-size: 22px; font-weight: 800; }
.loan-card__bar { height: 7px; border-radius: 4px; background: var(--border); margin: 10px 0 6px; overflow: hidden; }
.loan-card__bar > span { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.loan-card__paid { font-size: 12.5px; color: var(--text-soft); }
.loan-card__balance { font-size: 13.5px; font-weight: 700; color: var(--blue); margin: 2px 0 10px; }
.loan-card__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.loan-card__grid div span { display: block; font-size: 11px; color: var(--text-soft); }
.loan-card__grid div strong { font-size: 14px; }
.loan-card__foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--text-soft); }

/* Botón flotante: siempre a mano, sobre la barra de abajo. */
.fab { position: sticky; bottom: 76px; display: block; margin: 14px auto 0; padding: 12px 22px; border: 0; border-radius: 999px; background: var(--green); color: #fff; font: inherit; font-weight: 700; box-shadow: 0 6px 18px rgba(10, 15, 30, 0.28); cursor: pointer; z-index: 20; }
.fab[hidden] { display: none; }
@media (min-width: 900px) { .fab { bottom: 24px; } }


/* ---------- Encabezado: el usuario junto a la marca (celular) ---------- */

/* El administrador tiene Seguridad dentro de Usuarios y Salir al final del menú; los demás roles los conservan arriba. */
.role-admin #btn-seguridad, .role-admin #btn-logout { display: none; }
.tab--logout { display: none; }
@media (min-width: 900px) { .role-admin .tab--logout { display: flex; } }
@media (max-width: 899px) {
  .sidebar { position: relative; }
  .sidebar__brand { padding-right: 16px; }
  .sidebar__subtitle { font-size: 10px; white-space: normal; line-height: 1.2; }
  .sidebar__user {
    position: absolute;
    top: 10px;
    right: 12px;
    padding: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 4px 6px;
    max-width: 190px;
  }
  .sidebar__who { flex: 1 1 100%; justify-content: flex-end; }
  .sidebar__login, .sidebar__avatar + .sidebar__who-text .sidebar__role { display: none; }
  .sidebar__who { gap: 8px; }
  .sidebar__name { max-width: 100px; }
  .sidebar__actions { gap: 6px; }
  .sidebar__buy { padding: 4px 8px; font-size: 12px; }
}


/* Segunda ronda de ajustes: pares en las ventas, botones flotantes más chicos, tarjetas del resumen sin recortes. */
.contract-grid--pair { grid-template-columns: 1fr 1fr; }
.fab { padding: 8px 16px; font-size: 14px; bottom: 74px; }
.client-kpi { min-width: 0; }
.client-kpi__value { font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
#clientes-resumen { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.client-profile .client-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }


/* Ruta de hoy: Mapa y Cerrar caja arriba a la derecha; cada tarjeta se ve mínima con «Ver más». */
.ruta-head-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
#view-ruta .view-heading { align-items: flex-start; }
#view-ruta .view-heading__meta { display: block; margin-top: 2px; }
.client-card__peek { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.client-card__more[hidden] { display: none; }

/* Al abrir «Más», el resto de la pantalla se opaca un poco (la barra de abajo queda por encima). */
.mas-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(10, 15, 30, 0.4); }
.mas-backdrop[hidden] { display: none; }


/* ---------- Panel general: tarjeta de dinero afuera e indicadores con franja de color ---------- */

.money-hero { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; margin-bottom: 14px; padding: 18px; border-radius: 22px 22px 22px 6px; color: #fff; background: radial-gradient(120% 140% at 0% 0%, #1fb58a 0%, #1a8f9e 45%, #1f5fae 100%); box-shadow: 0 10px 26px rgba(26, 143, 158, 0.32); }
.money-hero[hidden] { display: none; }
.money-hero__ring { position: relative; width: 104px; height: 104px; display: flex; align-items: center; justify-content: center; }
.money-hero__ring svg { position: absolute; inset: 0; }
.money-hero__ring span { font-size: 18px; font-weight: 800; }
.money-hero__title { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.money-hero__value { font-size: 23px; white-space: nowrap; font-weight: 800; margin-top: 2px; overflow-wrap: anywhere; }
.money-hero__hint { font-size: 12px; opacity: 0.8; margin-top: 2px; }
.money-hero__subs { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.money-hero__subs > div { padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.16); min-width: 0; }
.money-hero__subs small { display: block; font-size: 11px; opacity: 0.85; }
.money-hero__subs strong { font-size: 14px; overflow-wrap: anywhere; }

.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat-chip { --accent: var(--blue); position: relative; display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; padding: 12px 12px 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); overflow: visible; }
.stat-chip::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.stat-chip__icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.stat-chip__body { display: contents; }
.stat-chip__label { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-soft); }
.stat-chip__value { grid-column: 1 / -1; font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; }
.stat-chip__sub { grid-column: 1 / -1; margin-top: -2px; font-size: 11.5px; color: var(--text-soft); }
.stat-chip--blue { --accent: #2f6fe0; }
.stat-chip--green { --accent: #1f9d55; }
.stat-chip--amber { --accent: #d68a00; }
.stat-chip--violet { --accent: #8a4fd6; }
.stat-chip--teal { --accent: #12a39a; }
.stat-chip--red { --accent: #d63b3b; }
.stat-chip--slate { --accent: #5d6b82; }
.stat-chip--mint { --accent: #2fb27a; }
.stat-chip--indigo { --accent: #5a63e0; }
/* El globo de cada indicador se apoya en la ficha (no en el icono) para no salirse de la pantalla. */
.info-tip--tile { position: static; }
.info-tip--tile::after { top: calc(100% + 6px); bottom: auto; left: 0; right: 0; transform: none; width: auto; max-width: none; z-index: 60; }


/* Filtros y etiquetas de selección: siempre en una sola fila que se desliza con el dedo, en todas las pantallas. */
.filter-pills, #panel-tipo, #ventas-filtros { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filter-pills::-webkit-scrollbar, #panel-tipo::-webkit-scrollbar, #ventas-filtros::-webkit-scrollbar { display: none; }
.filter-pills > *, #panel-tipo > *, #ventas-filtros > * { flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start; }
/* La ficha de un cliente (o de uno de sus préstamos) ocupa la pantalla: sin el título de la lista ni el botón de importar. */
#view-clientes:has(#clientes-panel-lista[hidden]) > .view-heading { display: none; }


/* ============================================================
   SISTEMA DE DISEÑO v2 (rediseño visual)
   Tipografía Inter con números tabulares; contenido sin azul
   (la navegación, el logo y el avatar del encabezado conservan
   el azul de la app); verde como color principal; tarjetas de
   22px; botones de al menos 44px; montos y fechas sin partir.
   ============================================================ */

:root {
  --green: #1f9d55;
  --green-dark: #17803f;
  --green-soft: rgba(31, 157, 85, 0.12);
  --teal: #12a39a;
  --red: #d63b3b;
  --red-ink: #b02424;
  --amber: #d68a00;
  --violet: #8a4fd6;
  --slate: #5d6b82;
  --orange: #e8781a;
  --ink: #1a2233;
  --ink-soft: #5b6478;
  --line: #e6e9f0;
  --surface-2: #e9edf4;
  --mora-0: #1f9d55;
  --mora-1: #f2c230;
  --mora-2: #ec8a1c;
  --mora-3: #d63b3b;
  --mora-4: #7a1f2b;
  --radius-card: 22px;
  --shadow-card: 0 1px 2px rgba(20, 30, 50, 0.04), 0 8px 20px rgba(20, 30, 50, 0.05);
}
:root[data-theme="dark"] {
  --ink: #e7ebf3;
  --ink-soft: #8b95a8;
  --line: #2a3348;
  --surface-2: #232c3f;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.25);
}

body { font-feature-settings: "tnum" 1; }
h1, h2, h3 { font-weight: 700; }

/* Título de pantalla y etiquetas de sección */
.view-heading h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.section-title, .summary-card__title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.view-heading__meta { color: var(--ink-soft); font-size: 13.5px; }

/* Tarjeta estándar */
.card, .summary-card, .stat-card, .client-row, .loan-card, .stat-chip, .client-kpi, .selected-client {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card, .summary-card, .selected-client { padding: 18px 20px; }
.client-kpi { border-radius: 16px; }

/* Montos y fechas nunca se parten en dos líneas */
.stat-card__value, .stat-chip__value, .client-kpi__value, .client-card__amount, .loan-card__amount, .client-row__amount,
.money-hero__value, .badge, .chip, .installment-row > span, .summary-card__line > span:last-child, .summary-card__line > strong { white-space: nowrap; }

/* Botones: 44px mínimo, radio 14px, texto 14.5px / 700 */
.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 700;
  background: var(--green);
  border: 1px solid var(--green);
  color: #fff;
  text-decoration: none;
}
.btn:hover { filter: none; background: var(--green-dark); border-color: var(--green-dark); }
.btn--green { background: var(--green); border-color: var(--green); color: #fff; }
.btn--ghost { background: var(--bg-card); border: 1px solid #dfe3ec; color: var(--ink); }
:root[data-theme="dark"] .btn--ghost { border-color: var(--line); }
.btn--ghost:hover { background: var(--bg-card-hover); color: var(--ink); border-color: #cfd5e2; }
.btn--soft { background: #eaf7ef; border: 1px solid #bfe3cd; color: var(--green-dark); }
.btn--soft:hover { background: #dff2e7; color: var(--green-dark); border-color: #bfe3cd; }
.btn--danger { background: var(--bg-card); border: 1px solid #f1c4c4; color: #a82424; }
.btn--danger:hover { background: #fdecec; color: #a82424; border-color: #f1c4c4; }
.btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.btn--small { min-height: 44px; padding: 8px 16px; font-size: 14px; }
.btn--lg { min-height: 52px; font-size: 15.5px; }
.btn--block { width: 100%; }
.btn:disabled { background: #cfd5e0; border-color: #cfd5e0; color: #fff; opacity: 1; }
.btn--ghost:disabled, .btn--danger:disabled { background: var(--bg-card); color: var(--ink-soft); }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; }
@media (min-width: 900px) { .btn:not(.btn--small) { min-height: 44px; } }

/* Enlaces y textos de apoyo: sin azul en el contenido */
.link-btn { color: var(--green-dark); font-weight: 600; font-size: 13px; }
.installment-row__advance { color: var(--ink-soft); }
.info-tip:hover, .info-tip:focus-visible, .info-btn:hover { background: var(--green-soft); color: var(--green-dark); border-color: var(--green-dark); }
.changelog__tag { color: var(--green-dark); }
.product-card:hover { border-color: var(--green); }
.pick-list button:hover, .combo__item:hover, .combo__item:focus { background: var(--green-soft); }
.modal__preview--advance { border-color: var(--green); color: var(--green-dark); }
.income-chart__bar-interes { background: var(--teal); }
.more-actions > summary, .type-card__change { color: var(--green-dark); }
.loan-card__balance { color: var(--ink); }
.client-profile .client-kpis { margin-top: 14px; }
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline-color: var(--green); }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* Pills de estado: 26px, 12px / 700 */
.badge { height: 26px; padding: 0 11px; font-size: 12px; font-weight: 700; border-radius: 999px; background: #eceff5; color: #4a566b; }
.badge--green, .badge--blue { background: #e5f6ec; color: var(--green-dark); }
.badge--amber { background: #fff1d6; color: #8a5200; }
.badge--red { background: #fde2e2; color: #a82424; }
.badge--violet { background: #efe6fb; color: #6a35b8; }
:root[data-theme="dark"] .badge { background: #2a3348; color: #aab4c3; }
:root[data-theme="dark"] .badge--green, :root[data-theme="dark"] .badge--blue { background: #173626; color: #7ad9a0; }
:root[data-theme="dark"] .badge--amber { background: #3a2c10; color: #f0b95c; }
:root[data-theme="dark"] .badge--red { background: #3d1a1a; color: #f08a8a; }
.chip--blue { background: #e5f6ec; color: var(--green-dark); }

/* Filtros: 42px, activo oscuro */
.filter-pill { min-height: 42px; padding: 0 18px; font-size: 14px; font-weight: 600; border: 1px solid #dfe3ec; background: var(--bg-card); color: var(--ink-soft); display: inline-flex; align-items: center; }
.filter-pill[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg-card); }
:root[data-theme="dark"] .filter-pill { border-color: var(--line); }

/* Opciones en botones (moneda, descuento…) y segmentado Cuotas / Pagos / Historial */
.seg__btn { border-radius: 14px; min-height: 44px; font-weight: 700; border-color: #dfe3ec; }
.seg__btn[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.detail-tabs { background: var(--surface-2); border-radius: 16px; padding: 4px; gap: 4px; flex-wrap: nowrap; }
.detail-tabs .seg__btn { border: 0; background: transparent; color: var(--ink-soft); border-radius: 12px; min-height: 40px; }
.detail-tabs .seg__btn[aria-pressed="true"] { background: var(--bg-card); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 30, 50, 0.12); }
.type-card[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }

/* Avatares de clientes: tono teal (el del encabezado se queda azul) */
.avatar, .client-card__avatar { background: rgba(18, 163, 154, 0.13); color: #0e8f7a; }
.client-card--collected .client-card__avatar { background: var(--green-soft); color: var(--green-dark); }
.sidebar__avatar { background: var(--blue-soft); color: var(--blue); }

/* Barras de progreso: 10–12px */
.progress { height: 11px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 8px; background: var(--green); }
.progress--grad > span { background: linear-gradient(90deg, #1fb58a, #1f9d55); }
.loan-card__bar { height: 10px; border-radius: 8px; background: var(--surface-2); }
.loan-card__bar > span { background: var(--green); }

/* Botón flotante: ya no flota (va dentro del flujo, al final del contenido) */
.fab { position: static; display: flex; width: 100%; max-width: 420px; margin: 18px auto 0; min-height: 50px; padding: 12px 22px; border-radius: 14px; font-size: 15px; box-shadow: none; z-index: auto; }

/* Botón de volver arriba: pequeño y fuera de los montos */
.to-top { right: 12px; bottom: 96px; width: 40px; height: 40px; opacity: 0.85; }

/* ---------- Panel general (rediseño) ---------- */

.panel-top { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.panel-top .money-hero { margin-bottom: 0; }
.today-card { padding: 20px; border-radius: var(--radius-card); background: var(--bg-card); border: 1px solid var(--line); box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 8px; }
.today-card[hidden] { display: none; }
.today-card__label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.today-card__count { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.today-card__amount { font-size: 30px; font-weight: 800; color: var(--green); white-space: nowrap; letter-spacing: -0.02em; }
.today-card__of { font-size: 13px; color: var(--ink-soft); margin-top: -6px; }
.today-card__missing { font-size: 14px; color: var(--ink-soft); }
.today-card__missing strong { color: var(--ink); white-space: nowrap; }
.today-card .btn { margin-top: 6px; }
@media (max-width: 899px) { .today-card--desktop { display: none !important; } }
@media (min-width: 900px) { .panel-top { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: stretch; } }

.tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .tile-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }

/* Tarjeta indicador: barrita 30×4 arriba a la izquierda + icono en cuadrito del mismo color al ~13 % */
.stat-chip { --accent: var(--green); position: relative; display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 20px 16px 16px; min-width: 0; }
.stat-chip::before { content: ""; position: absolute; left: 16px; top: 0; width: 30px; height: 4px; bottom: auto; border-radius: 0 0 4px 4px; background: var(--accent); }
.stat-chip__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stat-chip__icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.stat-chip__label { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; min-width: 0; }
.stat-chip__value { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.stat-chip__value--green { color: var(--green); }
.stat-chip__value--red { color: var(--red-ink); }
.stat-chip__sub { font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.stat-chip--green { --accent: #1f9d55; }
.stat-chip--teal { --accent: #12a39a; }
.stat-chip--amber { --accent: #d68a00; }
.stat-chip--violet { --accent: #8a4fd6; }
.stat-chip--red { --accent: #d63b3b; }
.stat-chip--orange { --accent: #e8781a; }
.stat-chip--slate { --accent: #5d6b82; }
.stat-chip--alert { background: #fff7f7; border-color: #f6d3d3; }
:root[data-theme="dark"] .stat-chip--alert { background: #2a1a1d; border-color: #5a2a2d; }
.info-tip--tile { position: static; }

/* Bloque «Invertido» (de Inversiones) */
.invest-block { display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 14px; padding: 18px 20px; text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.invest-block[hidden] { display: none; }
.invest-block__icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; color: var(--violet); background: color-mix(in srgb, var(--violet) 13%, transparent); }
.invest-block__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.invest-block__label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.invest-block__value { font-size: 24px; font-weight: 800; color: var(--ink); white-space: nowrap; letter-spacing: -0.01em; }
.invest-block__sub { font-size: 12px; color: var(--ink-soft); }
.invest-block__arrow, .other-currency__arrow { font-size: 26px; color: var(--ink-soft); line-height: 1; }

/* «También en dólares» */
.other-currency { margin-bottom: 14px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); }
.other-currency > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 52px; cursor: pointer; }
.other-currency > summary::-webkit-details-marker { display: none; }
.other-currency__chip { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 30px; padding: 0 8px; border-radius: 10px; font-size: 13px; font-weight: 800; color: var(--green-dark); background: #e5f6ec; }
.other-currency__text { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.other-currency[open] .other-currency__arrow { transform: rotate(90deg); }
.other-currency__body { padding: 0 16px 14px; }

/* Estado de la cartera sin dona */
.cartera-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 10px 0 12px; }
.cartera-head__amount { font-size: 26px; font-weight: 800; color: var(--red-ink); white-space: nowrap; letter-spacing: -0.02em; }
.stack-bar { display: flex; height: 12px; border-radius: 8px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.stack-bar > span { display: block; height: 100%; min-width: 4px; }
.cartera-rows { margin-top: 12px; display: flex; flex-direction: column; }
.cartera-row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cartera-row:last-child { border-bottom: 0; }
.cartera-row__dot { width: 12px; height: 12px; border-radius: 4px; }
.cartera-row__count { color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; }
.cartera-row__amount { white-space: nowrap; }
.cartera-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }

/* Alertas de riesgo */
.alert-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-row__avatar { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; font-size: 13px; font-weight: 700; color: #a82424; background: #fde2e2; }
.alert-row__who { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.alert-row__name { font-weight: 700; overflow-wrap: anywhere; }
.alert-row__days { font-size: 12.5px; color: var(--ink-soft); }
.alert-row__amount { font-weight: 800; white-space: nowrap; color: var(--red-ink); }
.panel-columns { gap: 14px; }
.panel-columns .card { margin-bottom: 14px; }

/* Los botones del encabezado (día/noche, Mejorar plan, Seguridad, Salir) se quedan compactos: son controles de la barra, no de la pantalla. */
.sidebar .btn--small, .sidebar .btn { min-height: 34px; padding: 4px 12px; font-size: 13px; border-radius: 12px; }
.sidebar #btn-comprar { min-height: 34px; }
.stat-chip__icon { width: 32px; height: 32px; }
.stat-chip__head { gap: 8px; }

/* ---------- Ruta de cobro (rediseño) ---------- */

.today-card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#ruta-hoy.today-card { margin-bottom: 14px; }
.today-card__boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.today-box { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.today-box small { display: block; font-size: 12px; color: var(--ink-soft); }
.today-box strong { font-size: 16px; font-weight: 800; white-space: nowrap; }
.today-box--late { background: #fff1f1; }
.today-box--late strong { color: var(--red-ink); }
:root[data-theme="dark"] .today-box--late { background: #3a1d20; }
.ruta-tools--quiet { margin: 2px 0 12px; opacity: 0.9; }
.ruta-tools--quiet .geo-toggle { font-size: 13px; color: var(--ink-soft); }
.route-section { margin: 18px 2px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }

.client-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 16px; margin-bottom: 12px; }
.client-card__row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.client-card__name { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.client-card__meta { font-size: 13px; color: var(--ink-soft); }
.client-card__amountrow { margin: 12px 0 12px; }
.client-card__amount { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.client-card__actions { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 8px; }
.client-card__actions .btn { padding: 8px 6px; font-size: 14px; gap: 6px; min-width: 0; }
.client-card__more { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.client-card__contact { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.client-card--open { border-color: #bfe3cd; }
.pay-box { margin-top: 12px; padding: 14px; border-radius: 18px; background: var(--surface-2); }
.pay-box__label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.method-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.method-chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid #dfe3ec; background: var(--bg-card); color: var(--ink-soft); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.method-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg-card); }
.pay-box__amount { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--line); margin-bottom: 10px; }
.pay-box__amount span { font-size: 13px; color: var(--ink-soft); }
.pay-box__amount strong { font-size: 20px; font-weight: 800; white-space: nowrap; }
.pay-box__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.pay-box__row:has(> :only-child) { grid-template-columns: 1fr; }
.pay-box__soon { margin-top: 8px; font-size: 12px; text-align: center; color: var(--ink-soft); }
.loan-block { margin-top: 12px; }
.loan-block:first-of-type { margin-top: 0; }
#ruta-fecha { text-transform: none; }
#view-ruta .view-heading { flex-wrap: nowrap; gap: 10px; }
#view-ruta .view-heading > div:first-child { min-width: 0; }
#view-ruta .view-heading h2 { font-size: 24px; white-space: nowrap; }
#view-ruta .ruta-head-actions { gap: 6px; }
#view-ruta .ruta-head-actions .btn { white-space: nowrap; }
#view-ruta .ruta-head-actions .btn { min-height: 40px; padding: 0 12px; font-size: 13.5px; }


/* ---------- Ficha del cliente (rediseño) ---------- */

.back-btn { border-radius: 999px; padding: 0 18px; margin-bottom: 4px; }
.avatar--xl { width: 64px; height: 64px; font-size: 22px; }
.selected-client__name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.action-grid__btn { flex-direction: column; gap: 4px; min-height: 64px; padding: 8px 4px; font-size: 13px; }
.action-grid__btn[hidden] { display: none; }
.debe-block { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0; padding: 18px 20px; border-radius: var(--radius-card); border: 1px solid #bfe3cd; background: linear-gradient(135deg, #eaf9f1 0%, #e1f4f1 100%); }
:root[data-theme="dark"] .debe-block { background: linear-gradient(135deg, #14301f, #12302e); border-color: #1f5a3b; }
.debe-block__main, .debe-block__next { display: flex; flex-direction: column; min-width: 0; }
.debe-block__next { text-align: right; align-items: flex-end; }
.debe-block__label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.debe-block__amount { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--green-dark); white-space: nowrap; }
.debe-block__next strong { font-size: 16px; white-space: nowrap; }
.debe-block__late { color: var(--red-ink); }
.mini-counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.mini-counter { padding: 10px 6px; text-align: center; border-radius: 16px; background: var(--bg-card); border: 1px solid var(--line); }
.mini-counter strong { display: block; font-size: 20px; font-weight: 800; }
.mini-counter span { font-size: 11.5px; color: var(--ink-soft); }
.score-card { border: 0; background: var(--surface-2); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.loan-card { padding: 16px; margin-bottom: 12px; }
.loan-card__balance { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; margin: 6px 0 10px; border-radius: 14px; background: var(--surface-2); }
.loan-card__balance span { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.loan-card__balance strong { font-size: 16px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.loan-card__amount { font-size: 24px; letter-spacing: -0.02em; }
.loan-card__grid div strong { white-space: nowrap; }


/* ---------- Ficha del crédito (rediseño) ---------- */

.loan-hero { padding: 18px; border-radius: 22px 22px 22px 6px; color: #fff; background: radial-gradient(120% 140% at 0% 0%, #1fb58a 0%, #1a8f9e 45%, #1f5fae 100%); box-shadow: 0 10px 26px rgba(26, 143, 158, 0.32); }
.loan-hero__kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; opacity: 0.85; }
.loan-hero__label { margin-top: 12px; font-size: 13px; opacity: 0.85; }
.loan-hero__amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.loan-hero__bar { height: 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.25); margin: 12px 0 10px; overflow: hidden; }
.loan-hero__bar > span { display: block; height: 100%; border-radius: 8px; background: #fff; }
.loan-hero__foot { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.loan-hero__foot span { white-space: nowrap; }

.loan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.loan-actions[hidden] { display: none; }
.loan-actions .btn { width: 100%; padding: 8px 10px; font-size: 14px; min-width: 0; }
.action-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.action-row3 .btn { padding: 8px 6px; font-size: 14px; }
.action-row3 .btn[hidden] { display: none; }

.cuota-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--line); }
.cuota-num { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; font-weight: 800; background: var(--surface-2); color: var(--ink-soft); }
.cuota-num--paid { background: #e5f6ec; color: var(--green-dark); }
.cuota-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cuota-main strong { font-size: 16px; font-weight: 800; white-space: nowrap; }
.cuota-main span { font-size: 12.5px; color: var(--ink-soft); }
.cuota-main span:not(.cuota-main__extra) { white-space: nowrap; }
.cuota-main__extra { font-size: 11.5px !important; }
.cuota-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }


/* ---------- Gastos (rediseño) ---------- */

.btn-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-bottom: 14px; }
.btn-row .btn { width: 100%; }
.period-select { position: relative; display: inline-flex; margin: 0; }
.period-select select { appearance: none; -webkit-appearance: none; min-height: 44px; padding: 0 38px 0 16px; border-radius: 14px; border: 1px solid #dfe3ec; background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6478' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center; color: var(--ink); font: inherit; font-weight: 700; font-size: 14.5px; }
.total-card { margin-bottom: 14px; }
.total-card__label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.total-card__amount { margin: 6px 0 12px; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: var(--red-ink); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; color: var(--ink-soft); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__item strong { color: var(--ink); }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; }
.empty-soft { padding: 6px 0 2px; color: var(--ink-soft); font-weight: 600; }
.expense-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--line); }
.expense-row__icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; }
.expense-row__main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.expense-row__main strong { font-weight: 700; overflow-wrap: anywhere; }
.expense-row__main span { font-size: 12.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.expense-row__side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.expense-row__amount { font-weight: 800; color: var(--red-ink); white-space: nowrap; }
#gastos-lista:empty + * { margin-top: 0; }


/* ---------- Ventas a crédito y ficha de venta (rediseño) ---------- */

.section-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.sale-card { cursor: pointer; }
.sale-card__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sale-card__pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.loan-hero__pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero-pill { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: rgba(255, 255, 255, 0.22); color: #fff; }
.product-line { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--line); }
.product-line__icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: var(--teal); background: color-mix(in srgb, var(--teal) 13%, transparent); }
.product-line__main { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; min-width: 0; }
.product-line__main strong { overflow-wrap: anywhere; }
.product-line__serial { font-size: 12.5px; font-weight: 600; color: var(--teal); overflow-wrap: anywhere; }
.product-line__price { white-space: nowrap; font-weight: 800; }
.cc-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.cc-line strong { white-space: nowrap; font-weight: 700; }
.cc-line--highlight { margin: 6px -8px; padding: 10px 8px; border-radius: 12px; background: #e5f6ec; color: var(--green-dark); }
.cc-line--highlight strong { font-weight: 800; }
.sale-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.sale-actions__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sale-actions__row:empty { display: none; }
.sale-actions__row:has(> :only-child) { grid-template-columns: 1fr; }
.sale-actions__link { justify-content: space-between; }


/* ---------- Inversiones (rediseño) ---------- */

.invest-card { padding: 16px; margin-bottom: 12px; border-radius: var(--radius-card); background: var(--bg-card); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.invest-card__top { display: flex; align-items: center; gap: 12px; }
.invest-card__icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: var(--violet); background: color-mix(in srgb, var(--violet) 13%, transparent); }
.invest-card__main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.invest-card__main strong { overflow-wrap: anywhere; }
.invest-card__main span { font-size: 12.5px; color: var(--ink-soft); }
.invest-card__amount { margin: 12px 0 6px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.invest-card__sold { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.text-green { color: var(--green-dark); }
.text-red { color: var(--red-ink); }
.invest-card__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.toolbar-row { margin-bottom: 14px; }

/* ---------- Escritorio: contenido centrado y bloques en dos columnas que colapsan ---------- */
@media (min-width: 900px) {
  .view { max-width: 1100px; margin-left: auto; margin-right: auto; }
  .btn-row { max-width: 520px; }
  .tile-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  #ventas-kpis, #view-gastos .tile-grid, #view-inversiones .tile-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (min-width: 1000px) {
  #clientes-panel-detalle { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); column-gap: 24px; align-items: start; }
  #clientes-panel-detalle > .back-btn { grid-column: 1 / -1; justify-self: start; margin-bottom: 12px; }
  #clientes-panel-detalle > .selected-client, #clientes-panel-detalle > .debe-block, #clientes-panel-detalle > .mini-counters, #clientes-panel-detalle > #cd-score,
  #clientes-panel-detalle > #cd-contacto, #clientes-panel-detalle > #cd-referido, #clientes-panel-detalle > #cd-referidos { grid-column: 1; }
  #clientes-panel-detalle > #cd-prestamos { grid-column: 2; grid-row: 2 / span 10; }
  #clientes-panel-detalle > #btn-nuevo-credito { grid-column: 2; grid-row: 12; }
  #clientes-panel-detalle[hidden] { display: none; } /* el display:grid de arriba pisaba el atributo hidden y la ficha seguía a la vista al volver */
}
a.btn { display: inline-flex; }

/* ============ Ronda de ajustes (26-oct) ============ */

/* Todos los botones de agregar son flotantes y se ven igual (Agregar cliente, crédito, Nueva venta, Nuevo producto, gasto, inversión) */
.fab { position: fixed; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); left: auto; z-index: 30; display: inline-flex; width: auto; max-width: calc(100vw - 32px); min-height: 48px; margin: 0; padding: 0 20px; border-radius: 999px; font-size: 14.5px; box-shadow: 0 8px 22px rgba(20, 30, 50, 0.3); }
.fab[hidden] { display: none !important; }
@media (min-width: 900px) { .fab { right: 40px; bottom: 28px; } }
.view:has(.fab:not([hidden])) { padding-bottom: 72px; }
.btn-row--single { grid-template-columns: 1fr; }
.btn-row--single .btn { width: auto; justify-self: start; }

/* Ficha del cliente: «Más opciones» en dos columnas */
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.more-grid .btn { width: 100%; min-width: 0; padding: 8px 10px; font-size: 14px; }
.more-grid .btn[hidden] { display: none; }

/* Panel: «Capital recuperado» con su (i) dentro de la tarjeta verde */
.money-hero__subs > div { position: relative; }
.money-hero .info-tip { background: rgba(255, 255, 255, 0.25); color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.money-hero__subs small { display: flex; align-items: center; gap: 4px; }

/* Nuevo préstamo: comparar cuotas es un enlace discreto dentro del formulario */
.compare-link { margin: -6px 0 10px; font-size: 13px; }

/* Recordatorios: monto e iconos en una sola línea */
.rec-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.icon-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-actions .icon-btn { width: 46px; height: 46px; border-radius: 14px; }

/* Clientes: título e importar en una sola fila; los montos de las tarjetas caben */
#view-clientes > .view-heading { flex-wrap: nowrap; gap: 8px; }
#view-clientes > .view-heading h2 { font-size: 26px; white-space: nowrap; }
#view-clientes > .view-heading .btn { min-height: 40px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
#clientes-resumen { grid-template-columns: 0.8fr 0.9fr 1.5fr; gap: 6px; }
#clientes-resumen .client-kpi { padding: 10px 8px; }
#clientes-resumen .client-kpi__value { font-size: 13.5px; }
#clientes-resumen .client-kpi__label { font-size: 10.5px; letter-spacing: 0.02em; }

/* Catálogo: la ficha del producto ocupa la pantalla; sin el título de la lista mientras se ve */
#view-catalogo:has(#catalogo-panel-lista[hidden]) > .view-heading { display: none; }
.product-photo { display: block; width: 100%; max-height: 260px; object-fit: cover; margin-top: 12px; border-radius: var(--radius-card); }

/* Encabezado (celular): solo el icono y el saludo; el botón día/noche debajo, a la derecha */
.sidebar__greeting { display: none; }
@media (max-width: 899px) {
  .sidebar { min-height: 0; }
  .sidebar__title, .sidebar__subtitle { display: none; }
  .sidebar__brand { padding: 12px 16px 6px; padding-right: 16px; }
  .sidebar__user { position: static; max-width: none; width: 100%; padding: 0 16px 10px; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
  .sidebar__who { display: none; }
  .sidebar__greeting { position: absolute; top: 18px; left: 62px; right: 16px; display: block; font-size: 16px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Reportes, Mis divisas y Mapa con el mismo estilo del resto */
.btn-row--pair { grid-template-columns: 1fr 1fr; }
.btn-row--pair .btn { width: 100%; padding: 8px 6px; font-size: 14px; }
.moneda-vista + .seg { margin: 0 0 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { padding: 16px 18px; }
.stat-card__label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.stat-card__value { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.stat-card__sub { font-size: 12px; color: var(--ink-soft); }
#fx-saldos { grid-template-columns: 1fr; }
#fx-lista .installment-row, #caja-lista .installment-row, #comisiones-lista .installment-row, #recaudo-lista .installment-row, #cxc-lista .installment-row, #au-lista .installment-row, #changelog .installment-row {
  padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-card);
}
#mapa-lienzo { border-radius: var(--radius-card); border-color: var(--line); box-shadow: var(--shadow-card); }
#view-mapa .field select, #view-divisas .field select { border-radius: 14px; min-height: 44px; }
.map-popup a { color: var(--green-dark); font-weight: 600; }
.fx-parts { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.fx-parts span { white-space: nowrap; }
.fx-parts strong { color: var(--ink); }
@media (max-width: 599px) { .stat-grid { grid-template-columns: 1fr; } }

.client-card { cursor: pointer; }
.client-card__actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.client-card__actions .icon-btn { flex: 0 0 auto; width: 46px; padding: 0; }
.client-card__actions .client-card__amount { flex: 1; min-width: 0; text-align: right; font-size: 17px; padding-right: 4px; }
.client-card__actions [data-action="abrir"] { flex: 0 0 auto; padding: 8px 16px; }
.client-card__more { cursor: default; }

/* Botones de agregar: centrados abajo y con el texto al medio del globo */
.fab { left: 50%; right: auto; transform: translateX(-50%); justify-content: center; align-items: center; text-align: center; line-height: 1; white-space: nowrap; }
@media (min-width: 900px) { .fab { left: calc(50% + 120px); right: auto; } }

/* Inversiones: vender, editar y borrar en una sola fila */
.invest-card__actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.invest-card__actions .btn { padding: 8px 4px; font-size: 14px; min-width: 0; }

/* Encabezado (celular) en dos columnas: saludo a la izquierda, botones a la derecha */
@media (max-width: 899px) {
  .sidebar { min-height: 78px; }
  .sidebar__user { display: contents; }
  .sidebar__buy, .sidebar__actions { position: absolute; right: 16px; }
  .sidebar__buy { top: 10px; }
  .sidebar__actions { top: 50px; }
  .sidebar__buy[hidden] + .sidebar__actions { top: 12px; }
  .sidebar__greeting { top: 14px; left: 62px; right: 150px; font-size: 15px; line-height: 1.25; white-space: normal; overflow: visible; }
}

/* El texto de ayuda de "Capital recuperado" queda por encima de "Cobrado hoy" */
.money-hero__subs > div:hover, .money-hero__subs > div:focus-within { z-index: 20; }

/* Reportes · Caja: ingresos, egresos y neto todo junto en una sola tarjeta */
.stat-grid[data-rsec="caja"] { display: block; padding: 2px 18px; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.stat-grid[data-rsec="caja"] .stat-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border: 0; border-radius: 0; box-shadow: none; background: none; }
.stat-grid[data-rsec="caja"] .stat-card + .stat-card { border-top: 1px solid var(--line); }
.money-hero { position: relative; }
.money-hero:hover, .money-hero:focus-within { z-index: 40; }

/* Lista de clientes: foto, nombre, teléfono y departamento, en una tarjeta baja */
.client-row { padding: 10px 14px; }
.client-row__chev { font-size: 22px; line-height: 1; }

/* Ruta de cobro: nombre y estado arriba; monto, iconos y Cobrar en una fila */
.client-card { padding: 16px; }
.client-card__actions { flex-direction: row; }
.client-card__actions .client-card__amount { order: -1; flex: 0 0 auto; text-align: left; font-size: 22px; margin-right: auto; padding: 0; }
.client-card__actions [data-action="abrir"] { flex: 0 0 auto; }
.client-card__actions { gap: 6px; }
.client-card__actions .client-card__amount { font-size: 19px; }
.client-card__actions .icon-btn { width: 42px; }
.client-card__actions [data-action="abrir"] { padding: 8px 14px; }

.heading-tools { display: flex; align-items: center; gap: 8px; }
.heading-tools .btn { min-height: 44px; padding: 0 14px; font-size: 14.5px; }
/* El encabezado se ajusta a su contenido: sin franja vacía debajo del saludo */
@media (max-width: 899px) {
  .sidebar { min-height: 0; }
  .sidebar:has(.sidebar__buy:not([hidden])) { min-height: 96px; }
}

.page-title { margin: 8px 0 14px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.form-actions .btn { flex: 1; }
.loan-hero--photo { display: flex; align-items: center; gap: 14px; }
.loan-hero__text { flex: 1; min-width: 0; }
.loan-hero__photo { flex: 0 0 auto; width: 96px; height: 96px; object-fit: cover; border-radius: 18px; border: 2px solid rgba(255, 255, 255, 0.5); }

.map-live { position: relative; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #2f6fe0; color: #fff; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(47, 111, 224, 0.28), 0 4px 10px rgba(20, 30, 50, 0.35); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
input[type="file"] { width: 100%; font-size: 13px; }
.field input[type="file"] { min-width: 0; max-width: 100%; overflow: hidden; }
#view-gastos .view-heading { flex-wrap: nowrap; gap: 8px; }
#view-gastos .view-heading h2 { font-size: 26px; }
.heading-tools { gap: 6px; flex-shrink: 0; }
.heading-tools .btn { padding: 0 12px; font-size: 14px; }
.heading-tools .period-select select { padding: 0 30px 0 12px; font-size: 14px; background-position: right 10px center; }

.sidebar__greeting { font-size: 13px !important; font-weight: 400 !important; }
#mapa-cobrador-resumen .mini-counters { grid-template-columns: 0.8fr 0.9fr 1.5fr !important; }
#mapa-cobrador-resumen .mini-counter { padding: 10px 4px; }
#mapa-cobrador-resumen .mini-counter strong { font-size: 15px; white-space: nowrap; }

/* Ruta · tarjeta de Pagados: cada cobro con su monto, detalle y acciones en iconos */
.client-card--collected, .client-card--collected .client-card__row { cursor: default; }
.paid-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--surface-2); }
.paid-row__main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.paid-row__main strong { font-size: 18px; font-weight: 800; color: var(--green-dark); white-space: nowrap; }
.paid-row__main span { font-size: 12.5px; color: var(--ink-soft); }
.paid-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.paid-row__actions .icon-btn { width: 42px; padding: 0; }
.paid-row__undo { color: var(--red-ink); }

.schedule-table { margin: 6px 0 4px; }
.schedule-table__row { display: grid; grid-template-columns: 28px 1fr 1fr 1.2fr; gap: 6px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.schedule-table__row--head { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.schedule-table__row.is-paid { color: var(--ink-soft); text-decoration: line-through; }

.bill-counter { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 10px; }
.bill-counter__row { display: grid; grid-template-columns: 1fr 14px 56px; align-items: center; gap: 6px; font-size: 14px; }
.bill-counter__row input { min-height: 40px; padding: 0 8px; text-align: center; }
.loan-card__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }

/* Editor de foto: marco circular (cliente) o cuadrado (producto) sobre la foto */
.cropper { position: relative; margin: 6px auto 12px; overflow: hidden; touch-action: none; cursor: grab; background: #1a2233; border-radius: 14px; max-width: 100%; }
.cropper canvas { display: block; width: 100%; height: 100%; }
.cropper::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.cropper--circle::after { background: radial-gradient(circle closest-side at center, transparent calc(100% - 2px), rgba(255, 255, 255, 0.95) calc(100% - 2px), rgba(255, 255, 255, 0.95) 100%, rgba(10, 15, 30, 0.55) 100%); }
.cropper--square::after { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95); border-radius: 14px; }
#pc-zoom { width: 100%; }

.client-card__avatar { overflow: hidden; }
.client-card__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.undo-list { display: grid; gap: 8px; }

/* Ayuda: buscador y filas de video más finas */
.help-search { width: 100%; min-height: 44px; margin: 0 0 12px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-card); font: inherit; }
.help-list { padding: 4px 14px; }
.help-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.help-row:last-child { border-bottom: 0; }
.help-row .btn { min-height: 32px; padding: 0 12px; font-size: 13px; }

/* Cifras largas dentro de su tarjeta (Reportes y demás): se achican en vez de salirse */
.stat-card__value, .stat-chip__value, .client-kpi__value, .loan-card__amount { font-size: clamp(15px, 5.4vw, 22px); max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.stat-chip__value { font-size: clamp(15px, 5.2vw, 22px); }
.stat-card, .stat-chip, .stat-grid > *, .tile-grid > * { min-width: 0; }

.paste-row { display: flex; gap: 8px; }
.paste-row input { flex: 1; min-width: 0; }
.paste-row .btn { flex: 0 0 auto; padding: 0 16px; }

/* Encabezado en celular para quien no es administrador: el saludo arriba y los botones (tema, Seguridad, Salir) debajo, sin apretarse */
@media (max-width: 899px) {
  body:not(.role-admin) .sidebar { min-height: 100px; }
  body:not(.role-admin) .sidebar__actions { top: 56px !important; left: 16px; right: 16px; justify-content: flex-end; }
  body:not(.role-admin) .sidebar__greeting { right: 16px; }
}

/* Bloques que se deslizan de lado (Panel: cartera / recaudo; Ruta: cobranza / recaudo) */
.swipe { min-width: 0; }
.swipe__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.swipe__track::-webkit-scrollbar { display: none; }
.swipe__slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.swipe__dots { display: flex; justify-content: center; gap: 8px; padding: 4px 0 12px; }
.swipe__dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: width .2s, background .2s; }
.swipe__dot[aria-selected="true"] { width: 22px; background: var(--green); }
.today-card--swipe, .card--swipe { padding: 0; overflow: hidden; }
.today-card--swipe .swipe__slide, .card--swipe .swipe__slide { padding: 20px 20px 4px; }
.card--swipe .swipe__slide .section-title { margin-top: 0; }

.recaudo-rows { display: flex; flex-direction: column; margin-top: 4px; }
.recaudo-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.recaudo-row__avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--ink-soft); font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.recaudo-row__who { min-width: 0; display: flex; flex-direction: column; }
.recaudo-row__who strong { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recaudo-row__who small { font-size: 12px; color: var(--ink-soft); }
.recaudo-row__amount { font-size: 15px; font-weight: 800; white-space: nowrap; }

/* Filas de listas de Reportes (recaudo, cuentas por cobrar): el monto se achica antes de salirse de su tarjeta */
.list-row__main { min-width: 0; flex: 1 1 0; }
.list-row__main .list-row__name, .list-row__main .list-row__meta { overflow-wrap: anywhere; }
.list-row__side { flex: 0 1 auto; max-width: 52%; text-align: right; min-width: 0; }
.list-row__amount { font-size: clamp(15px, 4.6vw, 20px); font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }

/* Reportes: las monedas junto al título */
#view-reportes > .view-heading { flex-wrap: wrap; align-items: center; gap: 8px; }
#view-reportes > .view-heading h2 { font-size: 26px; margin-right: auto; }
#view-reportes > .view-heading .seg { flex: 0 0 auto; margin: 0; }
#view-reportes > .view-heading .seg .seg__btn { min-width: 46px; padding: 6px 9px; }
#view-reportes > .view-heading .period-select { flex: 1 0 100%; }
#view-reportes > .view-heading .period-select select { width: 100%; }

/* Cliente, préstamo y pagos: mismas tarjetas, mismos botones */
.client-info { margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.client-info:not(:has(> *:not([hidden]):not(:empty))) { display: none; }
.client-info .field { margin: 0; }
#cd-prestamos { padding-bottom: 84px; }
.loan-actions .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
.compare-link { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); font-weight: 700; }
.pay-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; margin-bottom: 8px; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--line); }
.pay-row__icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: #e5f6ec; color: var(--green-dark); }
.pay-row__main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pay-row__main strong { font-size: 16px; font-weight: 800; color: var(--green-dark); white-space: nowrap; }
.pay-row__main span { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-row__actions { display: flex; gap: 6px; flex: 0 0 auto; }
.pay-row__actions .icon-btn { width: 40px; height: 40px; min-height: 40px; }
.pay-row__del { color: var(--red-ink); }

/* Reportes: título, monedas y período en una sola fila */
#view-reportes > .view-heading { flex-wrap: nowrap; gap: 6px; }
#view-reportes > .view-heading h2 { font-size: 22px; margin-right: auto; white-space: nowrap; }
#view-reportes > .view-heading .seg .seg__btn { min-width: 40px; min-height: 40px; padding: 4px 8px; font-size: 14px; }
#view-reportes > .view-heading .period-select { flex: 0 1 auto; min-width: 0; }
#view-reportes > .view-heading .period-select select { width: auto; min-height: 40px; padding: 0 26px 0 10px; font-size: 14px; background-position: right 8px center; }

/* Bloques deslizables más bajos */
.today-card--swipe .swipe__slide, .card--swipe .swipe__slide { padding: 16px 18px 0; gap: 6px; }
.swipe__dots { padding: 6px 0 10px; }
.recaudo-row { padding: 6px 0; }
.recaudo-row__avatar { width: 30px; height: 30px; font-size: 11px; }
.recaudo-row { grid-template-columns: 30px minmax(0, 1fr) auto; }
.swipe__slide > .link-btn { align-self: flex-start; font-size: 13px; }
.meta-paid { display: block; color: var(--green-dark); font-weight: 700; }

/* Recibo: vista previa acotada y botones en orden */
.rc-preview { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: center; }
.rc-preview img { width: 100%; max-width: 340px; display: block; margin: 0 auto; }
.rc-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.rc-actions__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.rc-actions__row--two { grid-template-columns: 1fr 1fr; }
.rc-actions .btn, .rc-actions select { min-height: 44px; width: 100%; font-size: 14px; }
.rc-actions select { padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); color: var(--ink); font-weight: 600; }

/* Ruta: filtros más compactos */
#ruta-filtros .filter-pill { min-height: 34px; padding: 0 12px; font-size: 13px; }

/* Encabezado del administrador en celular: Comprar y el botón día/noche en la misma fila (sin hueco debajo del saludo) */
@media (max-width: 899px) {
  body.role-admin .sidebar, body.role-admin .sidebar:has(.sidebar__buy:not([hidden])) { min-height: 62px; }
  body.role-admin .sidebar__actions { top: 10px; right: 16px; }
  body.role-admin .sidebar__buy { top: 10px; right: 88px; }
  body.role-admin .sidebar__buy[hidden] + .sidebar__actions { top: 10px; }
  body.role-admin .sidebar__greeting { right: 205px; }
}

/* Cifras largas en una sola línea; app.js las achica si no caben (fitAmounts) */
.stat-card__value, .stat-chip__value, .client-kpi__value, .loan-card__amount { white-space: nowrap; overflow-wrap: normal; overflow: hidden; }

/* Opciones (radio / casilla) con su texto al lado, en las ventanas */
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: 14px; line-height: 1.35; cursor: pointer; }
.check-row input { flex: 0 0 auto; width: 18px; height: 18px; min-height: 0; margin: 1px 0 0; padding: 0; }

/* Usuarios: el plan va en la misma línea del título */
.heading-plan { font-size: 15px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

/* ---- Ventana de Seguridad ---- */
.modal--sec { max-width: 560px; }
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sec-head__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); flex: none; }
.sec-head__sub { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.sec-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.sec-card--danger { border-color: var(--red); background: var(--red-soft); }
.sec-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sec-card__title { font-size: 15px; font-weight: 700; color: var(--text); }
.sec-card__text { font-size: 13.5px; line-height: 1.5; color: var(--text-soft); margin: 6px 0 12px; }
.sec-pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); white-space: nowrap; }
.sec-pill--on { background: var(--green-soft); color: var(--green); }
.sec-session { padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.sec-card__title + .sec-session { margin-top: 8px; }
.sec-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 18px; }
.sec-step { display: flex; gap: 12px; align-items: flex-start; }
.sec-step__n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.sec-step__body { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; color: var(--text); }
.sec-apps { display: grid; gap: 8px; margin-top: 10px; }
.sec-app { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); }
.sec-app__name { font-weight: 600; font-size: 14px; }
.sec-app__links { display: flex; gap: 6px; }
.sec-store { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 600; text-decoration: none; }
.sec-store:hover { background: var(--blue); color: #fff; }
.sec-qr { width: 208px; max-width: 100%; margin: 12px auto; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 16px; }
.sec-qr svg { display: block; width: 100%; height: auto; }
.sec-key-label { font-size: 12.5px; color: var(--text-soft); margin: 4px 0 6px; }
.sec-key { font-family: ui-monospace, monospace; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; word-break: break-all; padding: 10px 12px; border-radius: 10px; background: var(--bg-panel); border: 1px dashed var(--border-input); }
.sec-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
#sg-codigo { font-size: 22px; letter-spacing: 0.3em; text-align: center; font-weight: 700; }

/* ---- Bloque «Respaldo en tu GitHub» ---- */
#github-estado:has(.gh-box) { background: none; padding: 0; border: 0; }
.gh-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.gh-box__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.gh-box__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); flex: none; }
.gh-box__title { font-size: 15px; font-weight: 700; color: var(--text); }
.gh-box__sub { font-size: 13px; color: var(--text-soft); margin-top: 1px; }
.gh-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.gh-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); }
.gh-step__body { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gh-step__text { flex: 1 1 220px; font-size: 13.5px; line-height: 1.5; color: var(--text-soft); }
.gh-step__text strong { color: var(--text); }
.gh-step__text code { font-size: 12.5px; }

/* Un valor larguísimo en un campo no debe ensanchar la página (en el celular se «achicaba» la pantalla). */
#view-nuevo .field input, #view-nuevo .field select { min-width: 0; max-width: 100%; box-sizing: border-box; }

/* Ayuda: recorrido guiado e informe de problemas */
.help-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }

/* Recorrido guiado: una luz sobre el elemento y una tarjeta con la explicación */
#tour-layer { position: fixed; inset: 0; z-index: 10000; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(10, 14, 24, 0.62); transition: all 0.25s ease; pointer-events: none; }
.tour-pop { position: fixed; max-width: calc(100vw - 24px); padding: 14px 16px; border-radius: 16px; background: var(--bg-panel); color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
.tour-pop__count { font-size: 12px; color: var(--text-soft); font-weight: 700; margin-bottom: 4px; }
.tour-pop__title { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.tour-pop__text { font-size: 14px; line-height: 1.45; color: var(--text-soft); }
.tour-pop__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.tour-pop__actions .link-btn { margin-right: auto; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }

/* ============================================================
   Barra lateral oscura (solo escritorio), candados y tarjetas
   de Primeros pasos, Mercado Pago, WhatsApp, categorías y permisos
   ============================================================ */

/* Barra lateral: el verde oscuro de la landing, igual en tema claro y oscuro. En el celular la barra de abajo no cambia. */
@media (min-width: 900px) {
  .sidebar { background: #07231f; border-right-color: #0c3a33; }
  .sidebar__brand { border-bottom-color: rgba(255, 255, 255, 0.08); }
  .sidebar__title { color: #fff; }
  .sidebar__subtitle { color: #7fa89a; }
  .sidebar .tab { color: #b9d3c9; }
  .sidebar .tab:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
  .sidebar .tab[aria-selected="true"] { background: rgba(31, 181, 122, 0.2); color: #fff; box-shadow: inset 3px 0 0 #1fb57a; }
  .sidebar .tab-sub:not([hidden]) { border-left-color: rgba(255, 255, 255, 0.14); }
  .sidebar .tab-sub__item { color: #9fbfb3; }
  .sidebar .tab-sub__item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
  .sidebar .tab-sub__item[aria-pressed="true"] { color: #bff0d8; }
  .sidebar__user { background: #0c3a33; border-top-color: rgba(255, 255, 255, 0.08); }
  .sidebar__name { color: #fff; }
  .sidebar__role { color: #a9c9bd; }
  .sidebar__login { color: #7fa89a; }
  .sidebar__avatar { background: rgba(31, 181, 122, 0.22); color: #bff0d8; }
  .sidebar .btn--ghost, :root[data-theme="dark"] .sidebar .btn--ghost { background: transparent; border-color: rgba(255, 255, 255, 0.2); color: #e4f1ec; }
  .sidebar .btn--ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
  .sidebar .tab:focus-visible, .sidebar button:focus-visible { outline-color: #bff0d8; }
}
/* El botón de tema muestra un solo icono (la regla general «svg { display: block }» pisaba el atributo hidden y salían el sol y la luna juntos). */
.sidebar__theme svg[hidden] { display: none; }

/* Candado: lo que este usuario o este plan no incluye se ve en gris; al tocarlo se explica por qué (ver setLocked en app.js). */
:root { --lock-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E"); }
.is-locked { opacity: 0.55; filter: grayscale(1); cursor: not-allowed; }
.btn.is-locked::after, .tab.is-locked::after, .mas-menu__item.is-locked::after {
  content: "";
  flex: none;
  width: 13px;
  height: 13px;
  background: currentColor;
  -webkit-mask: var(--lock-icon) center / contain no-repeat;
  mask: var(--lock-icon) center / contain no-repeat;
}
.tab.is-locked::after, .mas-menu__item.is-locked::after { margin-left: auto; }
.tab.is-locked:hover, .sidebar .tab.is-locked:hover, .mas-menu__item.is-locked:hover { background: transparent; }
/* En el celular lo que el usuario no puede abrir se oculta (en escritorio queda en gris con candado). */
@media (max-width: 899px) {
  .tab.is-locked { display: none; }
}
.stat-card--locked { opacity: 0.6; }
.stat-card--locked .stat-card__value { color: var(--ink-soft); }

/* Interruptor (permisos) */
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 999px; background: #cfd5e0; cursor: pointer; transition: background 0.15s ease; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease; }
.switch:checked { background: var(--green); }
.switch:checked::before { transform: translateX(18px); }
:root[data-theme="dark"] .switch:not(:checked) { background: #3a4560; }
.perm-group { margin-top: 12px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-card); }
.perm-group__title { padding: 10px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.perm-group__title + .perm-row { border-top: 0; }
.perm-row__text { flex: 1; min-width: 0; }
.perm-row__text strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.perm-row__text small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; line-height: 1.4; color: var(--ink-soft); }
.perm-row--limit { cursor: default; }
.perm-row--limit input { flex: none; width: 120px; }

/* Primeros pasos */
.onboarding-slot { background: linear-gradient(135deg, #eefaf3, var(--bg-card) 65%); border-color: #cfe9db; }
:root[data-theme="dark"] .onboarding-slot { background: var(--bg-card); border-color: var(--line); }
.ob-head { display: flex; align-items: center; gap: 12px; }
.ob-head__icon, .mp-head__icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; }
.ob-head__icon { background: var(--green); color: #fff; }
.ob-head__text, .mp-head__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ob-head__text strong, .mp-head__text strong { font-size: 16px; font-weight: 800; color: var(--ink); }
.ob-head__text span, .mp-head__text span { font-size: 13px; color: var(--ink-soft); }
.ob-close { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft); font-size: 22px; line-height: 1; cursor: pointer; }
.ob-close:hover { background: var(--bg-card-hover); color: var(--ink); }
.ob-progress { height: 6px; margin: 12px 0; }
.ob-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 700px) { .ob-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ob-step { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); }
.ob-step__main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 10px 12px; border: 0; border-radius: 14px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ob-step__main:hover:not(:disabled) { background: var(--green-soft); }
.ob-step__main:disabled { cursor: default; }
.ob-step__check { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--border-input); border-radius: 50%; font-size: 13px; font-weight: 800; color: #fff; }
.ob-step.is-done .ob-step__check { background: var(--green); border-color: var(--green); }
.ob-step__body { flex: 1; min-width: 0; }
.ob-step__body strong { font-size: 14px; font-weight: 600; }
.ob-step.is-done .ob-step__body strong { font-weight: 500; text-decoration: line-through; color: var(--ink-soft); }
.ob-step__go { flex: none; font-size: 16px; color: var(--ink-soft); }
.ob-step__skip { flex: none; margin-right: 12px; white-space: nowrap; }

/* Mercado Pago y WhatsApp (Usuarios → Cobros y formas de pago) */
.mp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mp-head__icon { background: var(--green-soft); color: var(--green-dark); }
.mp-text { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.mp-text strong { color: var(--ink); }
.mp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-steps { margin: 12px 0; padding-left: 20px; font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); }
#cb-form[hidden] { display: none; }
.wa-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 18px; margin: 4px 0 12px; }
@media (min-width: 700px) { .wa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wa-item { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 3px solid var(--green-soft); }
.wa-item strong { font-size: 14px; }
.wa-item span { font-size: 13px; line-height: 1.45; color: var(--ink-soft); }
.wa-soon { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: var(--amber-soft); font-size: 13.5px; }

/* Documentación del cliente (ficha) */
.client-docs { margin-top: 12px; }
.client-docs__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.client-docs__count { font-size: 12.5px; color: var(--ink-soft); }
.client-docs__form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.client-docs__form .field { flex: 1 1 180px; margin: 0; }
.client-docs__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.client-docs__grid:empty { display: none; }
.doc-tile { display: flex; flex-direction: column; gap: 4px; margin: 0; min-width: 0; }
.doc-tile__thumb { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.doc-tile__thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-tile figcaption { display: flex; flex-direction: column; min-width: 0; }
.doc-tile figcaption strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tile figcaption small { font-size: 12px; color: var(--ink-soft); }
.doc-tile .link-btn { align-self: flex-start; padding: 0; }
.doc-view { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto 12px; border-radius: 12px; }

/* Días de trabajo y feriados */
.cal-dias { flex-wrap: nowrap; }
.cal-dias .seg__btn { min-width: 0; padding: 0 4px; }
.cal-count { font-weight: 600; letter-spacing: 0; text-transform: none; }
.cal-feriados { max-height: 240px; overflow: auto; margin-bottom: 10px; }
.cal-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-card); }
.cal-row--past { opacity: 0.55; }
.cal-row__date { flex: none; width: 86px; font-weight: 700; font-size: 13.5px; }
.cal-row__name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.cal-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-add .field { margin: 0; flex: 1 1 130px; }

/* Ventana de categorías */
.cat-add { display: flex; flex-direction: row; gap: 8px; margin: 0 0 8px; }
.cat-add input, .cat-row__edit input { flex: 1; min-width: 0; width: auto; }
.cat-add .btn, .cat-row__edit .btn { flex: none; width: auto; }
.cat-list { max-height: 48vh; overflow: auto; margin-top: 6px; }
.cat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); }
.cat-row--off { opacity: 0.6; }
.cat-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cat-row__name { font-weight: 600; overflow-wrap: anywhere; }
.cat-row__uses { font-size: 12.5px; color: var(--ink-soft); }
.cat-row__edit { flex: 1; min-width: 0; display: flex; flex-direction: row; gap: 8px; margin: 0; }
.cat-row__actions { flex: none; display: flex; gap: 12px; }
.cat-row__main[hidden], .cat-row__edit[hidden], .cat-row__actions[hidden] { display: none; }
