/* ============================================================================
   CARTERA DE COBRANZAS — ESTILOS
   ----------------------------------------------------------------------------
   PARA CAMBIAR LOS COLORES DE TODO EL SISTEMA, EDITÁ SOLO ESTE BLOQUE ↓↓↓
   Cada variable está comentada. No hace falta tocar nada más abajo.
   ============================================================================ */
:root {
  /* --- Fondos --- */
  --bg:          #f7f1b6;   /* Fondo general de la página (gris claro) */
  --surface:     #FFFFFF;   /* Tarjetas, tablas y formularios */
  --surface-2:   #F4F5F6;   /* Fondos suaves: inputs, filas alternas */

  /* --- Barra lateral --- */
  --sidebar:     #112B3C;   /* Barra lateral (azul muy oscuro / navy) */
  --sidebar-2:   #0B1E2A;   /* Detalle más oscuro del sidebar */
  --sidebar-tx:  #C4D2DC;   /* Texto del sidebar */

  /* --- Marca / acento (naranja) --- */
  --brand:       #F66B0E;   /* Color principal: botones, ítem activo, foco */
  --brand-ink:   #D4560A;   /* Marca más oscura (hover) */
  --brand-soft:  #FCE7D5;   /* Fondo suave de la marca */

  /* --- Secundario (azul) --- */
  --info:        #205375;   /* Azul secundario: cartera, barras, progreso */
  --info-soft:   #E0EAF1;   /* Fondo suave del azul */

  /* --- Texto y bordes --- */
  --text:        #142331;   /* Texto principal */
  --text-soft:   #5B6B78;   /* Texto secundario */
  --border:      #E1E4E6;   /* Bordes finos */

  /* --- Estados de cobro --- */
  --paid:    #1B7A4B;  --paid-bg:    #E4F3EA;  --paid-bd:    #BFE3CD;
  --sent:    #A96A00;  --sent-bg:    #FBEFD8;  --sent-bd:    #F0DBAE;
  --overdue: #C0392B;  --overdue-bg: #FBE7E3;  --overdue-bd: #F2C9C2;
  --pending: #5E7375;  --pending-bg: #EDF1F2;  --pending-bd: #DDE5E6;

  /* --- Forma --- */
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(17,43,60,.05), 0 12px 28px -16px rgba(17,43,60,.24);
  --shadow-sm: 0 1px 2px rgba(17,43,60,.06);
}
/* ====================== FIN DEL BLOQUE DE COLORES ========================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-soft); }
.strong { font-weight: 600; }
.ta-r { text-align: right; }

/* ============================= LAYOUT ====================================== */
.app { display: flex; min-height: 100vh; }

/* --- Sidebar (mobile-first: fuera de pantalla) --- */
.sidebar {
  position: fixed; z-index: 60; top: 0; left: 0; bottom: 0;
  width: 264px; padding: 20px 16px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: var(--sidebar-tx);
  display: flex; flex-direction: column; gap: 8px;
  transform: translateX(-100%); transition: transform .25s ease;
  overflow-y: auto;
}
.sidebar.open { transform: none; }
.scrim {
  position: fixed; inset: 0; z-index: 55; background: rgba(6,22,22,.45);
  opacity: 0; visibility: hidden; transition: opacity .2s;
}
.scrim.show { opacity: 1; visibility: visible; }

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 14px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { max-height: 40px; max-width: 170px; object-fit: contain; border-radius: 8px; background: #fff; padding: 4px; }
.brand-mark {
  width: 42px; height: 42px; flex: none; border-radius: 11px;
  display: grid; place-items: center; font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 20px; color: #fff;
  background: var(--brand); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: 'Space Grotesk', sans-serif; font-size: 17px; color: #fff; letter-spacing: .2px; }
.brand-text small { font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; color: rgba(207,224,223,.7); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-section-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: rgba(207,224,223,.5); padding: 14px 12px 4px;
}
.nav-section-label:first-child { padding-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: 11px; color: rgba(207,224,223,.85); font-weight: 500; position: relative;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 20px; height: 20px; flex: none; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.is-active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.nav-badge {
  margin-left: auto; background: var(--overdue); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot small { font-size: 11.5px; color: rgba(207,224,223,.65); }
.sidebar-account { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logout-form { margin: 0; }
.logout-btn {
  display: flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer;
  color: rgba(207,224,223,.65); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 8px;
  border-radius: 8px; transition: background .15s, color .15s;
}
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.logout-btn .ico { width: 15px; height: 15px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* --- Topbar --- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.icon-btn {
  width: 42px; height: 42px; flex: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--text); position: relative;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.brand--mobile { padding: 0; border: 0; margin: 0; }
.brand--mobile .brand-text strong { color: var(--text); font-size: 16px; }
.brand--mobile .brand-text small { color: var(--text-soft); }
.brand--mobile .brand-mark { width: 38px; height: 38px; font-size: 18px; }
.brand--mobile .brand-logo { max-height: 36px; background: transparent; padding: 0; }

.search { flex: 1; max-width: 420px; margin-left: auto; position: relative; display: flex; align-items: center; }
.search__ico { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--text-soft); pointer-events: none; }
.search input {
  width: 100%; padding: 11px 14px 11px 40px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); font: inherit; color: var(--text);
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search--inline { max-width: 260px; margin: 0; }
.search--inline input { padding-left: 14px; }
.bell-badge { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--overdue); border: 2px solid var(--surface); }

/* --- Contenido --- */
.content { padding: 22px 18px calc(78px + env(safe-area-inset-bottom)); }
.page-head { margin-bottom: 20px; }
.page-title { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.page-sub { margin: 3px 0 0; color: var(--text-soft); font-size: 14px; }

/* ============================= KPIs ======================================= */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.kpi--green::before  { background: var(--paid); }
.kpi--amber::before  { background: var(--sent); }
.kpi--red::before    { background: var(--overdue); }
.kpi--blue::before   { background: var(--info); }
.kpi__label { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--text-soft); }
.kpi__value { display: block; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 30px; line-height: 1.1; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi__hint { font-size: 12.5px; color: var(--text-soft); }

/* ============================= GRID / CARDS =============================== */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 6px 6px 8px;
}
.card__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; flex-wrap: wrap; }
.card__title { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 600; margin: 0; }
.card__title .count, .count { font-size: 12px; font-weight: 700; color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 8px; border-radius: 20px; margin-left: 6px; }

/* Segmented (filtros) */
.segmented { margin-left: auto; display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented a { padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-soft); }
.segmented a.is-active { background: var(--sidebar); color: #fff; }

/* ============================= TABLAS ===================================== */
.table-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-soft); padding: 8px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tabla td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: var(--surface-2); }
.cell-cliente { display: flex; flex-direction: column; }
.cell-cliente a { font-weight: 600; }
.cell-cliente a:hover { color: var(--brand); }
.cell-cliente small { font-size: 12px; color: var(--text-soft); }
.link:hover { color: var(--brand); }
.empty { text-align: center; color: var(--text-soft); padding: 26px 16px; }

.tag { display: inline-block; font-size: 12px; font-weight: 500; color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 7px; }
.pill { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; font-size: 13px; }

/* Badge de estado (el "sello") */
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 8px; border: 1px solid transparent;
}
.badge--pagado   { color: var(--paid);    background: var(--paid-bg);    border-color: var(--paid-bd); }
.badge--enviado  { color: var(--sent);    background: var(--sent-bg);    border-color: var(--sent-bd); }
.badge--vencido  { color: var(--overdue); background: var(--overdue-bg); border-color: var(--overdue-bd); }
.badge--pendiente{ color: var(--pending); background: var(--pending-bg); border-color: var(--pending-bd); }

/* Acciones (botones de icono) */
.actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.ibtn {
  width: 34px; height: 34px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--text-soft);
  transition: all .15s;
}
.ibtn svg { width: 17px; height: 17px; }
.ibtn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.ibtn--ok:hover { border-color: var(--paid); color: var(--paid); background: var(--paid-bg); }
.ibtn.is-done { border-color: var(--paid); color: var(--paid); background: var(--paid-bg); }
.ibtn.is-attached { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ============================= ALERTAS ==================================== */
.alert-list { list-style: none; margin: 0; padding: 4px 6px 8px; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; }
.alert-item:hover { background: var(--surface-2); }
.alert-body { display: flex; flex-direction: column; min-width: 0; }
.alert-body strong { font-weight: 600; font-size: 14px; }
.alert-body small { color: var(--text-soft); font-size: 12.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot--red { background: var(--overdue); }
.dot--amber { background: var(--sent); }
.dot--soft { background: var(--brand); }
.alert-when { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text-soft); }
.alert-when--red { color: var(--overdue); }
.alert-when--amber { color: var(--sent); }

/* Filas de alerta (página Alertas) */
.alert-rows { list-style: none; margin: 0; padding: 4px 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.alert-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 12px; flex-wrap: wrap; }
.alert-row:hover { background: var(--surface-2); }
.alert-row__main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.alert-row__main small { display: block; color: var(--text-soft); font-size: 12.5px; }
.alert-row__side { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* ============================= FORMULARIOS =============================== */
.form { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); font: inherit; color: var(--text);
}
textarea.input { resize: vertical; font-size: 13.5px; line-height: 1.55; }
.input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-divider { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); border-top: 1px solid var(--border); padding-top: 14px; margin: 4px 0 -2px; }
.hint { font-size: 12.5px; color: var(--text-soft); padding: 0 16px; }
.hint code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 11.5px; }
.switches { display: flex; flex-direction: column; gap: 10px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-ink); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--danger-ghost { background: var(--surface); border-color: var(--overdue-bd); color: var(--overdue); }
.btn--danger-ghost:hover { background: var(--overdue-bg); }
.back { color: var(--text-soft); font-weight: 500; }
.back:hover { color: var(--brand); }

/* Datos (ficha) */
.datos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 4px 16px 8px; margin: 0; }
.datos dt { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); font-weight: 600; }
.datos dd { margin: 3px 0 0; font-weight: 500; }

/* Agregar póliza (ficha del cliente) */
.add-poliza { margin: 6px 16px 12px; border-top: 1px solid var(--border); }
.add-poliza > summary {
  list-style: none; cursor: pointer; padding: 12px 2px 4px; font-weight: 600; font-size: 13.5px;
  color: var(--brand); user-select: none;
}
.add-poliza > summary::-webkit-details-marker { display: none; }
.add-poliza[open] > summary { color: var(--text-soft); }
.add-poliza .form { padding-left: 0; padding-right: 0; }

/* Ajustes por secciones */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 1000px; }
.settings-form { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card--full { grid-column: 1 / -1; }
.settings-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.settings-note { padding: 0; }
.field-row--stack2 { grid-template-columns: 1fr; }
@media (min-width: 1000px) {
  .settings-form { grid-template-columns: 1fr 1fr; align-items: start; }
  .field-row--stack2 { grid-template-columns: 1fr 1fr; }
}

/* Logo (ajustes) */
.logo-box { display: flex; align-items: center; gap: 18px; padding: 6px 16px 10px; flex-wrap: wrap; }
.logo-prev { width: 84px; height: 84px; flex: none; border-radius: 16px; border: 1px dashed var(--border); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }
.logo-fallback { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 34px; color: var(--brand); }
.logo-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.logo-form { display: flex; gap: 10px; align-items: center; }
.file-input { font: inherit; font-size: 13.5px; }
.file-input::file-selector-button {
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 10px; margin-right: 10px;
}
.file-input::file-selector-button:hover { border-color: var(--brand); color: var(--brand); }

/* ============================= NAV INFERIOR (móvil) ====================== */
.bottomnav {
  display: flex; position: fixed; z-index: 45; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--text-soft); font-size: 10.5px; font-weight: 500; position: relative; }
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.is-active { color: var(--brand); }
.bn-badge { position: absolute; top: 3px; right: calc(50% - 16px); width: 7px; height: 7px; border-radius: 50%; background: var(--overdue); }

/* ============================= RESPONSIVE ================================= */
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .content { padding: 26px 26px calc(78px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1000px) {
  .sidebar { position: sticky; height: 100vh; transform: none; }
  .scrim { display: none; }
  .hamb, .brand--mobile { display: none; }
  .bottomnav { display: none; }
  .content { padding: 28px 32px 40px; max-width: 1400px; }
  .grid-2 { grid-template-columns: minmax(0, 1.9fr) minmax(300px, 1fr); }
  .grid-2--wide { grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr); }
  .page-title { font-size: 30px; }
}

/* Accesibilidad */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ============================= DASHBOARD (métricas) ====================== */
.metric-card { padding-bottom: 14px; }
.pct-big { margin-left: auto; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; color: var(--brand); }
.progress { height: 12px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin: 6px 16px 8px; }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--info), var(--brand)); border-radius: 20px; transition: width .4s ease; }
.breakdown { list-style: none; margin: 0; padding: 8px 16px 10px; display: flex; flex-direction: column; gap: 12px; }
.breakdown li { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 12px; }
.bd-label { display: flex; }
.bd-track { height: 10px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.bd-fill { display: block; height: 100%; border-radius: 8px; background: var(--pending); transition: width .4s ease; }
.bd-fill--pagado { background: var(--paid); }
.bd-fill--enviado { background: var(--sent); }
.bd-fill--pendiente { background: var(--pending); }
.bd-fill--vencido { background: var(--overdue); }
.bd-fill--brand { background: var(--info); }
.bd-val { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 600; color: var(--text-soft); white-space: nowrap; }

/* ============================= CUOTAS (ficha cliente) =================== */
.cuotas { list-style: none; margin: 0; padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.cuota { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 12px; flex-wrap: wrap; }
.cuota:hover { background: var(--surface-2); }
.cuota__info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cuota__info small { display: block; color: var(--text-soft); font-size: 12.5px; }
.cuota__side { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.mini-ico { width: 15px; height: 15px; vertical-align: -2px; color: var(--brand); }

/* ============================= AJUSTES (layout) ========================= */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 1040px; }
.settings-form { display: grid; grid-template-columns: 1fr; gap: 16px; }
.settings-form .card--full { grid-column: 1 / -1; }
.settings-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.settings-note { margin-top: 2px; padding: 0; }
.field-row--stack2 { grid-template-columns: 1fr; }

@media (min-width: 900px) {
  .settings-form { grid-template-columns: 1fr 1fr; }
  .field-row--stack2 { grid-template-columns: 1fr 1fr; }
}

/* ============================= MEDIOS DE PAGO ============================ */
.mbtns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.mbtn {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--c); background: transparent; color: var(--c);
  font-weight: 700; font-size: 13px; font-family: 'Space Grotesk', sans-serif;
  display: grid; place-items: center; transition: all .15s;
}
.mbtn:hover { background: color-mix(in srgb, var(--c) 14%, #fff); }
.mbtn.is-on { background: var(--c); color: #fff; box-shadow: 0 2px 8px -2px var(--c); }

/* Lista de medios en Ajustes */
.metodos-list { list-style: none; margin: 0; padding: 6px 16px 10px; display: flex; flex-direction: column; gap: 6px; }
.metodos-list li { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.metodos-list li:last-child { border-bottom: 0; }
.metodo-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.metodo-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 1px solid rgba(0,0,0,.08); }
.link-danger { border: 0; background: none; color: var(--overdue); cursor: pointer; font-size: 15px; padding: 4px 8px; border-radius: 8px; }
.link-danger:hover { background: var(--overdue-bg); }
.metodo-add { display: flex; gap: 10px; align-items: center; padding: 6px 16px 14px; flex-wrap: wrap; }
.metodo-add .input { flex: 1; min-width: 160px; }
.color-input { width: 52px; height: 42px; padding: 4px; flex: none; cursor: pointer; }

/* ============================= MODAL (preview cupón) ==================== */
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(6,22,22,.55); }
.modal.show { display: flex; }
.modal__card { background: var(--surface); border-radius: var(--radius); width: min(760px, 96vw); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal__actions { display: flex; align-items: center; gap: 8px; }
.modal__actions .btn { padding: 8px 12px; }
.modal__body { flex: 1; overflow: auto; background: var(--surface-2); display: grid; place-items: center; }
.modal__body iframe { width: 100%; height: 74vh; border: 0; }
.modal__body img { max-width: 100%; max-height: 74vh; object-fit: contain; }

/* ============================= LISTA DE PAGOS =========================== */
.pagos-list { list-style: none; margin: 0; padding: 4px 16px 12px; display: flex; flex-direction: column; }
.pagos-list li { display: grid; grid-template-columns: 92px 1fr auto auto; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.pagos-list li:last-child { border-bottom: 0; }
.pago-fecha { font-size: 13.5px; font-weight: 600; }
.pago-medio { font-weight: 600; font-size: 14px; }
.pago-monto { font-size: 14px; }
.pago-periodo { font-size: 12.5px; text-align: right; }
.pagos-list .empty { grid-template-columns: 1fr; text-align: left; padding: 16px 0; }
@media (max-width: 560px) {
  .pagos-list li { grid-template-columns: 1fr auto; row-gap: 2px; }
  .pago-periodo { display: none; }
}

/* ============================= BUSCADOR EN VIVO ========================== */
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; display: none; max-height: 340px; overflow-y: auto;
}
.search-results.show { display: block; }
.search-results a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--surface-2); }
.sr-name { font-weight: 600; font-size: 14px; }
.sr-cuil { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-soft); }
.sr-empty { padding: 12px 14px; color: var(--text-soft); font-size: 13.5px; }

/* ============================= CHIPS (filtro compañías) ================= */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13.5px; color: var(--text); }
.chip:hover { border-color: var(--brand); }
.chip.is-active { background: var(--sidebar); color: #fff; border-color: var(--sidebar); }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--info)); }
.chip.is-active .chip-dot { box-shadow: 0 0 0 2px rgba(255,255,255,.3); }

/* ============================= TARJETA DE COMPAÑÍA ====================== */
.comp-card { margin-bottom: 16px; }
.comp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.comp-title { display: flex; align-items: center; gap: 10px; }
.comp-title h2 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; margin: 0; }
.comp-swatch { width: 14px; height: 14px; border-radius: 5px; }
.comp-venc { display: flex; align-items: center; gap: 12px; }
.comp-ventana { font-size: 12.5px; color: var(--text-soft); }
.comp-tag { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 8px; }
.comp-tag--ok { color: var(--info); background: var(--info-soft); }
.comp-tag--venc { color: var(--overdue); background: var(--overdue-bg); border: 1px solid var(--overdue-bd); }

.dia-input { width: 64px; flex: none; text-align: center; }

/* ============================= REPORTES ================================= */
.rep-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .rep-grid { grid-template-columns: repeat(3, 1fr); } }
.rep-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); transition: all .15s; }
.rep-card:hover { border-color: var(--brand); background: var(--surface); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.rep-card strong { font-size: 15px; }
.rep-card small { color: var(--text-soft); font-size: 12.5px; }
.rep-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; }
.rep-ico--red { background: var(--overdue-bg); color: var(--overdue); }
.rep-ico--amber { background: var(--sent-bg); color: var(--sent); }
.rep-ico--blue { background: var(--info-soft); color: var(--info); }
.rep-dl { margin-top: 4px; color: var(--brand); font-weight: 600; font-size: 13.5px; }

/* Nav inferior con 6 ítems: labels un poco más chicos */
.bottomnav a span { font-size: 9.5px; }

/* ============================= SELECTOR DE MES ========================== */
.toolbar-mes { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.mes-selector { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 7px 12px; box-shadow: var(--shadow-sm); }
.mes-selector svg { width: 18px; height: 18px; color: var(--text-soft); }
.mes-selector select { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.mes-selector select:focus { outline: none; }

/* ============================= CAMPAÑAS ================================= */
.camp-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.camp-count { color: var(--text-soft); font-size: 13px; margin-left: auto; }
.dest-list { list-style: none; margin: 0; padding: 4px 8px 10px; display: flex; flex-direction: column; max-height: 560px; overflow-y: auto; }
.dest-item { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; cursor: pointer; }
.dest-item:hover { background: var(--surface-2); }
.dest-item input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.dest-info { display: flex; flex-direction: column; min-width: 0; }
.dest-info small { font-size: 12.5px; }
