/* ═══════════════════════════════════════════════════════════════
   AGRON v2 — styles.css
   Paleta: #E5B050 · #B88955 · #D7C3A0 · #AAC9C3 · #59AEC3
   Tipografía: Figtree (texto) · DM Mono (números)
   Íconos: Phosphor Icons
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');
@import url('https://unpkg.com/@phosphor-icons/web@2.0.3/src/regular/style.css');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --gold:        #E5B050;
  --gold-dark:   #c99a3a;
  --gold-light:  #fdf3e0;
  --brown:       #B88955;
  --sand:        #D7C3A0;
  --sand-light:  #f8f4ee;
  --sand-xlight: #fdfaf6;
  --sage:        #AAC9C3;
  --blue:        #59AEC3;
  --blue-dark:   #3d90a8;
  --blue-xdark:  #2c7a90;
  --text-dark:   #1a1a16;
  --text-mid:    #5a4f3a;
  --text-muted:  #9a8f78;
  --text-light:  #b8a888;
  --border:      #ede6d8;
  --border-mid:  #D7C3A0;
  --white:       #ffffff;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --shadow-sm:   0 1px 3px rgba(90,70,30,0.08);
  --shadow-md:   0 4px 12px rgba(90,70,30,0.1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

/* Checkboxes — radius 0 global */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0 !important;
  -webkit-border-radius: 0 !important;
  width: 14px;
  height: 14px;
  border: 1.5px solid #B88955;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
input[type="checkbox"]:checked {
  background: #E5B050;
  border-color: #E5B050;
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Layout principal ──────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  visibility: hidden;
}
.app.visible {
  visibility: visible;
}

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: 236px;
  min-width: 236px;
  background: var(--blue);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar-logo-img {
  width: 148px;
  display: block;
}


.nav-section {
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: 0;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
  user-select: none;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.nav-item.active {
  background: var(--gold);
  color: #fff;
  font-weight: 500;
}

.nav-item.active:hover { background: var(--gold-dark); }

.nav-item.standby {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.nav-item .ph {
  font-size: 17px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 9px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.55);
  padding: 2px 7px;
  border-radius: 0;
  font-weight: 500;
}

/* Contadores en sidebar */
.sidebar-counters {
  margin-top: auto;
  padding: 14px 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.counter-title {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.counter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
}

.counter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-red    { background: #f0a0a0; }
.dot-yellow { background: #f0d070; }
.dot-green  { background: #90d090; }

.counter-num {
  margin-left: auto;
  font-weight: 600;
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
}

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
}

/* ── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── BOTONES ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 0;
  border: 1px solid var(--border-mid);
  background: var(--white);
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.btn:hover { background: var(--sand-xlight); border-color: var(--sand); }

.btn .ph { font-size: 15px; }

.btn-primary {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); }

.btn-secondary {
  background: var(--sage);
  color: #1a4a44;
  border-color: var(--sage);
}
.btn-secondary:hover { background: #92b8b2; }

.btn-danger {
  background: #f5e8e8;
  color: #8a2020;
  border-color: #e8c0c0;
}
.btn-danger:hover { background: #f0d0d0; }

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  height: 26px;
}

/* ── FILTROS ───────────────────────────────────────────────── */
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--sand-xlight);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-select {
  padding: 5px 10px;
  border-radius: 0;
  border: 1px solid var(--border-mid);
  background: var(--white);
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  color: var(--text-mid);
  cursor: pointer;
}

/* ── TABLA ─────────────────────────────────────────────────── */
.table-wrap {
  flex: 1;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead tr { background: var(--sand-xlight); position: sticky; top: 0; z-index: 1; }

th {
  padding: 9px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--sand-light);
  color: var(--text-dark);
  white-space: nowrap;
  vertical-align: middle;
}

tr:hover td { background: var(--sand-xlight); }
tr.row-pending td { background: rgba(229,176,80,0.05); }
tr.row-pending:hover td { background: rgba(229,176,80,0.1); }
tr.row-revision td { background: rgba(89,174,195,0.04); }

.mono {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-mid);
}

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 0;
  font-size: 10px;
  font-weight: 600;
}

.badge .ph { font-size: 11px; }

.badge-pending  { background: var(--gold-light);   color: #7a4f10; }
.badge-revision { background: #e8f4f8;              color: #2d6e80; }
.badge-listo    { background: #e8f2e8;              color: #2a5a30; }
.badge-activo   { background: #e8f2e8;              color: #2a5a30; }
.badge-inactivo { background: var(--sand-light);    color: var(--text-muted); }

/* Badge CC (código de cuartel) */
.cc-badge {
  display: inline-block;
  background: var(--gold-light);
  border: 1px solid #e8d090;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--brown);
  font-family: 'DM Mono', monospace;
}

/* ── PAGINACIÓN ────────────────────────────────────────────── */

.page-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: var(--white);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-mid);
}
.page-btn:hover { background: var(--sand-xlight); }
.page-btn.active { background: var(--gold); color: #fff; border-color: var(--gold); }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 14px;
  padding: 60px 40px;
  text-align: center;
}

.empty-state .ph {
  font-size: 52px;
  color: var(--sand);
  line-height: 1;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.7;
}

/* ── MÓDULOS ───────────────────────────────────────────────── */
.view { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.view.active { display: flex; }

/* ── ARCHIVOS — columnas ───────────────────────────────────── */
.files-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  flex: 1;
  overflow: hidden;
}

.file-col {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.file-col:last-child { border-right: none; }

.file-col-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--sand-xlight);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.file-col-vaciar {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  opacity: .45;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  transition: opacity .15s, color .15s;
}
.file-col-vaciar:hover { opacity: 1; color: #c0392b; }

.procesados-footer-info {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue);
  font-size: 11px;
  font-family: 'Figtree', sans-serif;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.link-btn:hover { text-decoration: underline; }

.procesados-buscar {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.procesados-buscar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.file-count {
  background: var(--border);
  border-radius: 0;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--brown);
}

.file-list { overflow-y: auto; flex: 1; }

/* File item enriquecido con datos de sii_meta */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--sand-light);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.file-item:hover { background: var(--sand-xlight); }

.file-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.file-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.file-item-monto {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dark);
  font-weight: 500;
  white-space: nowrap;
}
.file-item-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  opacity: .4;
  padding: 2px 4px;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity .15s, color .15s;
}
.file-item-del:hover { opacity: 1; color: #c0392b; }

/* ── CONFIG CARDS ──────────────────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.config-card {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--white);
}
.config-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
}

.config-card .ph {
  font-size: 26px;
  color: var(--blue);
  margin-bottom: 10px;
  display: block;
}

.config-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.config-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.config-card-count {
  font-size: 11px;
  color: var(--blue);
  margin-top: 6px;
  font-weight: 600;
}

/* ── MÉTRICAS ──────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 20px 24px 0;
  flex-shrink: 0;
}

.metric-card {
  background: var(--sand-xlight);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
  font-family: 'DM Mono', monospace;
}

.metric-sub {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 3px;
}

/* Gráfico de barras simple */
.chart-container {
  margin: 16px 24px;
  background: var(--sand-xlight);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 16px 12px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  flex-shrink: 0;
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 4px;
}

.chart-bar {
  background: var(--blue);
  border-radius: 3px 3px 0 0;
  width: 100%;
  transition: opacity 0.12s;
  cursor: pointer;
  min-height: 2px;
}
.chart-bar:hover { opacity: 0.7; }

.chart-bar-label {
  font-size: 9px;
  color: var(--text-light);
  font-weight: 500;
}

/* ── MODAL ─────────────────────────────────────────────────── */
/* ── SISTEMA UNIFICADO DE POPUPS ────────────────────────────── */
.agron-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,24,14,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.agron-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.agron-popup {
  background: var(--white);
  border-radius: 2px;
  max-width: 95vw;
  box-shadow: var(--shadow-md);
  transform: translateY(12px);
  transition: transform 0.15s;
  overflow: hidden;
}
.agron-overlay.open .agron-popup { transform: translateY(0); }
.popup-md { width: 620px; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; }
.popup-sm { width: 380px; }
.popup-xs { width: 340px; }

/* ── MODAL GENÉRICO ─────────────────────────────────────────── */
/* base en .agron-overlay + .agron-popup.popup-md */
.modal-overlay { }
.modal-overlay.open { }
.modal { }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-muted);
  padding: 2px;
  line-height: 1;
  display: flex;
}
.modal-close:hover { color: var(--text-dark); }

.modal-body { padding: 20px 22px; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── FORMULARIO ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 5px;
}

.form-label .required { color: var(--gold); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: 0;
  border: 1px solid var(--border-mid);
  background: var(--white);
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  color: var(--text-dark);
  transition: border-color 0.12s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.form-textarea { resize: vertical; min-height: 80px; }

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


/* ── TOAST / NOTIFICACIONES ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-dark);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease;
  max-width: 320px;
}

.toast.success { background: #2a5a30; }
.toast.error   { background: #8a2020; }
.toast.warning { background: var(--brown); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── LOG DE ACTIVIDAD ──────────────────────────────────────── */
.activity-log {
  background: #1a1a16;
  color: #c8c0a8;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 12px 16px;
  height: 100px;
  overflow-y: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

.log-line { padding: 1px 0; }
.log-info { color: #90c0d0; }

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sand); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brown); }

/* ── UTILIDADES ────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 11px; }
.fw-medium   { font-weight: 500; }
.mt-8        { margin-top: 8px; }
.flex        { display: flex; }
.hidden      { display: none !important; }

/* ── BOTÓN CERRAR SERVIDOR ─────────────────────────────────── */
.btn-cerrar-servidor {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  width: 100%;
  padding: 7px 12px;
  border-radius: 0;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  text-align: left;
}

.btn-cerrar-servidor:hover {
  background: rgba(220, 80, 80, 0.25);
  border-color: rgba(220, 80, 80, 0.5);
  color: #ffaaaa;
}

.btn-cerrar-servidor .ph {
  font-size: 15px;
}

/* ── CONTROL DE LABORES ────────────────────────────────────── */
.ctrl-nivel { display:flex; flex-direction:column; flex:1; overflow:hidden; }
.ctrl-nivel.hidden { display:none !important; }

/* Calendario */
.ctrl-cal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px 20px;
  overflow-y: auto;
}

.ctrl-mes-card {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  background: var(--white);
}
.ctrl-mes-card:hover { border-color: var(--blue); background: #f8fcfd; }
.ctrl-mes-card.vacio { opacity: 0.7; }

.ctrl-mes-nombre {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 7px;
}
.ctrl-mes-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.ctrl-mes-sub { font-size: 10px; color: var(--text-muted); margin-top: 5px; }

/* Métricas nivel 2 */
.ctrl-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 20px 0;
  flex-shrink: 0;
}

/* Persona pill nivel 3 */
.ctrl-persona-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sand-xlight);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}
.ctrl-persona-pill .ph { font-size: 15px; color: var(--blue); }

/* Tabla de labores */
.ctrl-table-scroll {
  flex: 1;
  overflow: auto;
  overflow-y: scroll;
}

.ctrl-labor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}

.ctrl-labor-table thead tr {
  background: var(--sand-xlight);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ctrl-labor-table th {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.35;
  vertical-align: middle;
  text-align: center;
  white-space: normal;
  word-break: keep-all;   /* no cortar palabras a mitad */
  overflow-wrap: normal;
}
.ctrl-labor-table th.al { text-align: left; }
.ctrl-labor-table th.ac { text-align: center; }
.ctrl-labor-table th.ar { text-align: right; }

.ctrl-labor-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--sand-light);
  color: var(--text-dark);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctrl-labor-table td.al { text-align: left; }
.ctrl-labor-table td.ac { text-align: center; }
.ctrl-labor-table td.ar { text-align: right; }

.ctrl-labor-table tr:hover td { background: var(--sand-xlight); }

.ctrl-labor-table tr.ctrl-sabado td   { background: #f5e8c0; }
.ctrl-labor-table tr.ctrl-domingo td  { background: #c8e8e4; }
.ctrl-labor-table tr.ctrl-festivo td  { background: #c8e8e4; }
.ctrl-labor-table tr.ctrl-sabado:hover td  { background: #eddfa8; }
.ctrl-labor-table tr.ctrl-domingo:hover td { background: #b0dad4; }

.ctrl-labor-table tr.ctrl-totales td {
  background: var(--sand-xlight);
  font-weight: 700;
  border-top: 2px solid var(--border);
}

.ctrl-labor-table tr.row-pending td { background: rgba(229,176,80,0.07); }


/* Leyenda de colores */
.ctrl-leyenda {
  display: flex;
  gap: 14px;
  padding: 7px 20px;
  border-top: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}
.ctrl-ley-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-muted);
}
.ctrl-ley-dot {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Avatar persona en resumen */
.ctrl-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e8f4f8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-dark);
  flex-shrink: 0;
  cursor: pointer;
}
.ctrl-avatar:hover { background: #d0ecf5; }
.ctrl-persona-name { cursor: pointer; font-weight: 500; }
.ctrl-persona-name:hover { color: var(--blue); text-decoration: underline; }

/* ── INPUTS NIVEL 3 — tipo Excel ─────────────────────────────── */
.n3-input {
  width: 100%;
  border: 1px solid rgba(184,137,85,0.35);
  background: transparent;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--text-dark);
  padding: 2px 4px;
  border-radius: 0;
  outline: none;
  opacity: 0.4;
  -moz-appearance: textfield;
  box-sizing: border-box;
}
.n3-input.n3-filled { opacity: 1; border-color: rgba(184,137,85,0.6); }
.n3-input.n3-text   { text-align: left; }
.n3-input.n3-readonly {
  background: var(--sand-xlight);
  cursor: default;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  text-align: center;
}
.n3-input.n3-center { text-align: center; }
.n3-input.n3-right  { text-align: right; }
.n3-input:focus     { opacity:1; border-color: var(--blue); background: var(--white); box-shadow: 0 0 0 2px rgba(89,174,195,0.15); }
.n3-input:hover     { opacity: 0.75; }
.n3-input::-webkit-inner-spin-button,
.n3-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Wrapper signo $ */
.n3-peso-wrap { position: relative; display: flex; align-items: center; }
.n3-peso-wrap.n3-peso-visible::before {
  content: '$';
  position: absolute;
  left: 4px;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  pointer-events: none;
}
.n3-peso-wrap.n3-peso-visible .n3-input { padding-left: 12px; }

/* Total Trato — solo lectura */
.n3-total {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--text-dark);
}

/* Fila con cambios sin guardar */
.ctrl-labor-table tr.n3-dirty td:first-child {
  box-shadow: inset 3px 0 0 var(--gold);
}
.ctrl-labor-table tr.n3-dirty.ctrl-sabado td:first-child  { box-shadow: inset 3px 0 0 var(--brown); }
.ctrl-labor-table tr.n3-dirty.ctrl-domingo td:first-child { box-shadow: inset 3px 0 0 var(--blue-dark); }

/* ── POPUP RELLENAR MES ─────────────────────────────────────── */
/* .n3-relleno-overlay — base en .agron-overlay */
/* .n3-relleno-popup   — base en .agron-popup.popup-sm */
.n3-relleno-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.n3-relleno-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}
.n3-relleno-body {
  padding: 20px;
}
.n3-relleno-cols {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.n3-relleno-col-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.n3-relleno-chk-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-dark);
  cursor: pointer;
  min-width: 130px;
}
.n3-relleno-chk-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #B88955;
  border-radius: 0;
  background: #fff;
  position: relative;
  flex-shrink: 0;
}
.n3-relleno-chk-label input[type="checkbox"]:checked {
  background: #E5B050;
  border-color: #E5B050;
}
.n3-relleno-chk-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 4px; height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.n3-relleno-val {
  flex: 1;
  font-size: 12px;
  padding: 5px 8px;
  height: 30px;
}
.n3-relleno-dias {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.n3-relleno-dia-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dark);
  cursor: pointer;
}
.n3-relleno-dia-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #B88955;
  border-radius: 0;
  background: #fff;
  position: relative;
  flex-shrink: 0;
}
.n3-relleno-dia-row input[type="checkbox"]:checked {
  background: #E5B050;
  border-color: #E5B050;
}
.n3-relleno-dia-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 4px; height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.n3-relleno-todos-row {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-mid);
  font-weight: 500;
}
.n3-relleno-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--sand-xlight);
}


/* Prioridad color de día sobre row-pending — el color del día siempre gana */
.ctrl-labor-table tr.ctrl-sabado.row-pending td  { background: #f5e8c0; }
.ctrl-labor-table tr.ctrl-domingo.row-pending td { background: #c8e8e4; }

/* ── ÍCONOS DUPLICAR/ELIMINAR EN CELDA FECHA ────────────────── */
.n3-fecha-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 2px;
}
.n3-fecha-label {
  font-size: 11px;
  color: var(--text-dark);
  white-space: nowrap;
  flex: 1;
  text-align: center;
}
.n3-fecha-acciones {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.ctrl-labor-table td:first-child:hover .n3-fecha-acciones {
  opacity: 1;
}
.n3-fecha-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--white);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  flex-shrink: 0;
}
.n3-fecha-btn:hover {
  background: var(--sand-xlight);
  color: var(--blue);
  border-color: var(--blue);
}
.n3-fecha-btn.danger:hover {
  background: #fff0f0;
  color: #c0392b;
  border-color: #ffcccc;
}
.ctrl-sabado  .n3-fecha-btn { background: #f5e8c0; }
.ctrl-domingo .n3-fecha-btn { background: #c8e8e4; }

/* ── POPUP DUPLICAR FILA ────────────────────────────────────── */
/* .n3-dup-overlay — base en .agron-overlay */
/* .n3-dup-popup   — base en .agron-popup.popup-xs */
.n3-dup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.n3-dup-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}
.n3-dup-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.n3-dup-body {
  padding: 18px 20px;
}
.n3-dup-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dark);
  cursor: pointer;
  padding: 5px 0;
}
.n3-dup-radio input[type="radio"] {
  accent-color: var(--gold);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.n3-dup-check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.n3-dup-check-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #B88955;
  border-radius: 0;
  background: #fff;
  position: relative;
}
.n3-dup-check-label input[type="checkbox"]:checked {
  background: #E5B050;
  border-color: #E5B050;
}
.n3-dup-check-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 4px; height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.n3-dup-dividir-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.n3-dup-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--sand-xlight);
}

/* ── CAMPOS TRATO BLOQUEADOS ────────────────────────────────── */
.n3-trato-bloq {
  opacity: 0.25 !important;
  pointer-events: none;
  background: var(--sand-xlight) !important;
}

/* ── TABS POPUP RELLENAR/LIMPIAR ────────────────────────────── */
.n3-relleno-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}
.n3-relleno-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.n3-relleno-tab:hover {
  background: var(--sand-xlight);
  color: var(--text-dark);
}
.n3-relleno-tab.active {
  background: var(--gold-light);
  border-color: var(--gold);
  color: var(--text-dark);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   TEMPORADAS — Vista + Calendar Range Picker
══════════════════════════════════════════════════════════════ */

/* ── Temporada activa card ──────────────────────────────────── */
.temp-activa-card {
  background: #fff;
  border: 2px solid var(--dorado);
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.temp-activa-card .temp-info { flex: 1; }
.temp-activa-card .temp-nombre {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}
.temp-activa-card .temp-rango {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}
.temp-activa-card .temp-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.temp-badge-activa {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #d4f0d4;
  color: #2a7a2a;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.temp-badge-activa::before {
  content: '';
  width: 6px; height: 6px;
  background: #2a7a2a;
  border-radius: 50%;
}
.temp-meta-mes {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 0;
  padding: 3px 10px;
}
.temp-sin-activa {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 12px;
  border: 2px dashed var(--border);
  margin-bottom: 28px;
  font-size: 14px;
}

/* ── Temporadas pasadas ─────────────────────────────────────── */
.temp-pasadas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.temp-pasadas-titulo {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.temp-pasadas-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.temp-pasada-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.temp-pasada-row .temp-nombre {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
  min-width: 100px;
}
.temp-pasada-row .temp-rango {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  flex: 1;
}
.temp-pasada-row .temp-mes-chip {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 0;
  padding: 2px 9px;
}

/* ── Popup Temporada — overlay dedicado ─────────────────────── */
.temp-popup-overlay { z-index: 1100; }
.temp-popup {
  max-width: 480px;
  width: 100%;
}
.temp-popup .popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.temp-popup .popup-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.temp-popup .popup-body { padding: 16px 20px; }
.temp-popup .popup-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

/* ── Range chips ─────────────────────────────────────────────── */
.temp-range-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.temp-range-chip {
  flex: 1;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: text;
  transition: border-color .15s;
}
.temp-range-chip.active { border-color: var(--dorado); }
.temp-range-chip.filled { border-color: var(--cafe); }
.temp-range-chip .chip-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}
.temp-range-chip .chip-input {
  display: block;
  width: 100%;
  background: none;
  border: none;
  outline: none;
  padding: 0;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  cursor: text;
}
.temp-range-chip.filled .chip-input { color: var(--text-main); font-weight: 600; }

/* ── Calendar grid ───────────────────────────────────────────── */
.temp-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.temp-cal-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-main);
  font-size: 18px;
  line-height: 1;
  transition: background .1s;
}
.temp-cal-nav-btn:hover { background: var(--bg-soft); }
.temp-cal-mes-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  min-width: 140px;
  text-align: center;
}
.temp-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 30px;   /* altura fija por fila — nunca cambia al navegar */
  gap: 2px;
  margin-bottom: 4px;
}
.temp-cal-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.temp-cal-day {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
  color: var(--text-main);
  position: relative;
  user-select: none;
}
.temp-cal-day:hover:not(.tc-empty):not(.tc-off) {
  background: var(--bg-soft);
}
.temp-cal-day.tc-empty { cursor: default; }
.temp-cal-day.tc-off { color: var(--border); cursor: default; }
.temp-cal-day.tc-in-range {
  background: rgba(229,176,80,0.15);
  border-radius: 0;
}
.temp-cal-day.tc-start, .temp-cal-day.tc-end {
  background: var(--dorado);
  color: #fff;
  font-weight: 700;
}
.temp-cal-day.tc-start { border-radius: 6px 0 0 6px; }
.temp-cal-day.tc-end   { border-radius: 0 6px 6px 0; }
.temp-cal-day.tc-start:not(.tc-in-range),
.temp-cal-day.tc-end:not(.tc-in-range) { border-radius: 6px; }
.temp-cal-day.tc-today::after {
  content: '';
  display: block;
  width: 4px; height: 4px;
  background: var(--dorado);
  border-radius: 50%;
  margin: 1px auto 0;
}
.temp-cal-day.tc-start.tc-today::after,
.temp-cal-day.tc-end.tc-today::after { background: #fff; }
.temp-cal-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  height: 16px;
}

/* ── Form fields dentro del popup ───────────────────────────── */
.temp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.temp-form-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  cursor: pointer;
}
.temp-form-toggle input[type=checkbox] {
  width: 16px; height: 16px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #B88955;
  border-radius: 0;
  background: #fff;
  position: relative;
  flex-shrink: 0;
}
.temp-form-toggle input[type=checkbox]:checked {
  background: #E5B050;
  border-color: #E5B050;
}
.temp-form-toggle input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.temp-form-toggle label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════
   FACTURACIÓN — CALENDARIO DE COSTOS
══════════════════════════════════════════════════════════════ */

.facturacion-cal-section {
  padding: 20px 24px 24px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.facturacion-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.facturacion-cal-titulo {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
/* Cards sin datos — no clicables */
.ctrl-mes-sin-datos {
  cursor: default !important;
  opacity: .55;
}
.ctrl-mes-sin-datos:hover {
  border-color: var(--border) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ══════════════════════════════════════════════════════════════
   VISTA COSTOS DEL MES — Filtros + Tabla + Edición inline
══════════════════════════════════════════════════════════════ */

/* ── Barra de filtros ──────────────────────────────────────── */
.costos-filter-row td {
  padding: 4px 4px 6px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.costos-filter-input,
.costos-filter-select {
  width: 100%;
  height: 28px;
  border: 1px solid #D7C3A0;
  border-radius: 0;
  padding: 0 8px;
  font-size: 11px;
  font-family: 'Figtree', sans-serif;
  background: #fff;
  color: #9a8f78;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.costos-filter-select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23C8B89A'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  color: #9a8f78;
}
.costos-filter-select option { color: #1a1a16; }
.costos-filter-input:focus,
.costos-filter-select:focus { border-color: var(--dorado); }

/* ── Celda editable ────────────────────────────────────────── */
.costos-celda-editable {
  cursor: pointer;
  border-radius: 0;
  padding: 2px 5px;
  transition: background .1s;
  display: inline-block;
}
.costos-celda-editable:hover {
  background: rgba(229,176,80,0.12);
}
td:has(.costos-celda-editable) {
  cursor: pointer;
}
.costos-inline-input {
  width: 100%;
  min-width: 70px;
  border: 1.5px solid var(--dorado);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  font-family: 'Figtree', sans-serif;
  background: #fff;
  outline: none;
}

/* ══════════════════════════════════════════════════════════════
   ASIGNACIÓN CC — Nueva arquitectura v4.5
══════════════════════════════════════════════════════════════ */

/* Layout 50/50 */
.acc-layout { display:flex; flex:1; min-height:0; overflow:hidden; }
.acc-panel-left {
  width:50%; flex-shrink:0;
  border-right:1px solid var(--border);
  display:flex; flex-direction:column; overflow:hidden;
}
.acc-panel-right {
  width:50%; overflow-y:auto; padding:20px 24px;
  display:flex; flex-direction:column;
}

/* Header panel izq */
.acc-panel-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px;
  font-size:11px; font-weight:700; color:var(--text-muted);
  text-transform:uppercase; letter-spacing:.05em;
  border-bottom:1px solid var(--border); flex-shrink:0;
}
.acc-count {
  background:var(--dorado); color:#fff;
  font-size:11px; font-weight:700;
  min-width:20px; height:20px; border-radius:0;
  display:inline-flex; align-items:center; justify-content:center; padding:0 6px;
}
.acc-lista { flex:1; overflow-y:auto; padding:6px; }

/* Ítem lista */
.acc-item {
  display:flex; align-items:flex-start; gap:10px;
  padding:11px 12px; border-radius:0; cursor:pointer;
  transition:background .1s; margin-bottom:3px;
  border:1.5px solid var(--border);
}
.acc-item:hover      { background:var(--bg-soft); }
.acc-item-activo     { background:rgba(229,176,80,.08); }
.acc-item-activo:hover { background:rgba(229,176,80,.08); }
.acc-item-asignado   { opacity:.65; }
.acc-item-desc       { font-size:13px; font-weight:600; color:var(--text-main); line-height:1.3; margin-bottom:2px; }
.acc-item-monto      { font-size:14px; font-weight:500; color:var(--text-main); margin-bottom:4px; }
.acc-item-foot       { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.acc-item-meta       { font-size:10px; color:var(--text-muted); }

/* Placeholder */
.acc-placeholder {
  display:flex; flex-direction:column; align-items:center;
  justify-content:center; gap:10px; flex:1;
  color:var(--text-muted); font-size:13px;
}

/* Encabezado ítem activo */
.acc-item-header     { margin-bottom:16px; padding-bottom:14px; border-bottom:1px solid var(--border); }
.acc-item-h-desc     { font-size:15px; font-weight:700; color:var(--text-main); line-height:1.3; margin-bottom:4px; }
.acc-item-h-monto    { font-size:20px; font-weight:600; color:var(--text-main); margin-bottom:5px; }
.acc-item-h-meta     { font-size:12px; color:var(--text-muted); }

/* Sección títulos */
.acc-seccion-titulo {
  font-size:11px; font-weight:700; color:var(--text-muted);
  text-transform:uppercase; letter-spacing:.05em;
  margin-bottom:10px;
  display:flex; align-items:center; gap:12px;
}
.acc-chk-todos-label {
  display:flex; align-items:center; gap:5px;
  font-size:11px; font-weight:400; text-transform:none;
  letter-spacing:0; color:var(--text-main); cursor:pointer;
}
.acc-chk-todos-label input {
  width: 14px;
  height: 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #B88955;
  border-radius: 0;
  background: #fff;
  position: relative;
  flex-shrink: 0;
}
.acc-chk-todos-label input:checked {
  background: #E5B050;
  border-color: #E5B050;
}
.acc-chk-todos-label input:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 4px; height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Grid de botones CC */
.acc-cc-grid { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:6px; }
.acc-cc-btn {
  display:flex; flex-direction:column; align-items:center;
  min-width:68px; padding:8px 12px;
  border:1.5px solid var(--border); border-radius:0;
  background:#fff; cursor:pointer;
  transition:background .12s;
}
.acc-cc-btn:hover  { background:rgba(229,176,80,.10); }
.acc-cc-activo     { background:rgba(229,176,80,.10); }
.acc-cc-codigo     { font-size:14px; font-weight:700; color:var(--text-main); font-family:'DM Mono',monospace; }
.acc-cc-sub        { font-size:9px; color:var(--text-muted); margin-top:2px; text-align:center; max-width:80px; }

/* Distribución en tiempo real */
.acc-distribucion {
  margin-top:18px; background:var(--bg-soft);
  border:1px solid var(--border); border-radius:0; padding:14px 16px;
}
.acc-dist-titulo { font-size:10px; font-weight:700; color:var(--text-muted);
  text-transform:uppercase; letter-spacing:.05em; margin-bottom:10px; }
.acc-dist-fila {
  display:flex; align-items:center; gap:8px;
  padding:4px 0; border-bottom:1px solid var(--border);
}
.acc-dist-fila:last-child { border-bottom:none; }
.acc-dist-monto { margin-left:auto; font-size:13px; font-weight:600; }
.acc-dist-total {
  display:flex; justify-content:space-between;
  font-size:13px; font-weight:700;
  padding-top:8px; margin-top:4px;
  border-top:2px solid var(--border);
}

/* Badge N CC en Vista Costos del Mes */
.badge-cc-asignado {
  display:inline-block; padding:2px 9px; border-radius:0;
  font-size:11px; font-weight:700; cursor:pointer;
  background:rgba(89,174,195,.15); color:#2d6e80;
  border:1px solid rgba(89,174,195,.4);
  transition:background .1s;
}
.badge-cc-asignado:hover { background:rgba(89,174,195,.28); }

/* Badge N° Documento — estilo similar a cc-badge */
.ndoc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  transition: background .1s;
}
.ndoc-badge:hover { background: rgba(229,176,80,.12); border-color: var(--dorado); }

/* ── Editar mes — Costos ────────────────────────────────────────── */
.cm-trash-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: 0.5px solid var(--color-border-danger);
  background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-text-danger); font-size: 12px; opacity: .6;
}
.cm-trash-btn:hover { opacity: 1; background: var(--color-background-danger); }

.cm-opcion {
  padding: 11px 14px; border-radius: 8px;
  border: 0.5px solid var(--color-border-secondary);
  cursor: pointer; transition: border-color .1s, background .1s;
}
.cm-opcion:hover { border-color: var(--color-border-primary); background: var(--color-background-secondary); }
.cm-opcion-danger:hover { border-color: var(--color-border-danger); background: var(--color-background-danger); }

/* ══════════════════════════════════════════════════════════════
   CONFIG — EMPRESA  (v4.7)
══════════════════════════════════════════════════════════════ */

.empresa-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.empresa-seccion-titulo {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

/* Layout logo + campos en fila */
.empresa-datos-row {
  display: flex;
  align-items: center;
  gap: 32px;
}

.empresa-logo-area {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Estado vacío — borde punteado con icono */
.empresa-logo-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--sand-xlight);
  color: var(--text-muted);
  font-size: 12px;
  transition: border-color .15s, background .15s;
}
.empresa-logo-empty .ph {
  font-size: 36px;
  color: var(--sand);
}
.empresa-logo-area:hover .empresa-logo-empty {
  border-color: var(--blue);
  background: #f4fafc;
}

/* Logo cargado — sin fondo ni borde */
.empresa-logo-img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  background: transparent;
  display: block;
}

/* Overlay rollover — aparece al hover cuando hay logo */
.empresa-logo-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.28);
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity .18s;
}
.empresa-logo-overlay .ph {
  font-size: 26px;
  color: #fff;
}
.empresa-logo-area:hover .empresa-logo-overlay {
  opacity: 1;
}

.empresa-form-row {
  display: flex;
  align-items: flex-end;
  gap: 24px;
}

/* Valor en modo lectura */
.empresa-field-val {
  font-size: 13px;
  color: var(--text-dark);
  padding: 4px 2px;
  border-bottom: 1px solid var(--border-mid);
  min-height: 34px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empresa-field label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 5px;
}
.empresa-field input,
.empresa-field select {
  width: 100%;
  height: 34px;
  border: none;
  border-bottom: 1px solid var(--border-mid);
  padding: 0 2px;
  font-size: 13px;
  color: var(--text-dark);
  background: transparent;
  outline: none;
  font-family: 'Figtree', sans-serif;
}
.empresa-field input:focus,
.empresa-field select:focus {
  border-bottom-color: var(--blue);
}

.empresa-divider {
  border: none;
  border-top: 1px solid var(--border);
}

.empresa-usuarios-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.empresa-usuarios-header .empresa-seccion-titulo {
  margin-bottom: 0;
  border: none;
  padding: 0;
}

.empresa-tabla-usuarios {
  width: 100%;
  border-collapse: collapse;
}
.empresa-tabla-usuarios th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 0 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.empresa-tabla-usuarios td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--sand-light);
  font-size: 12.5px;
  vertical-align: middle;
}
.empresa-tabla-usuarios tr:last-child td {
  border-bottom: none;
}

.emp-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 600;
  flex-shrink: 0;
}
.emp-av-a { background: #fdf3e0; color: #c99a3a; }
.emp-av-s { background: #e8f4f2; color: #4a9b8f; }
.emp-av-o { background: #e8f4f8; color: #3d90a8; }

.emp-badge {
  display: inline-flex;
  padding: 2px 9px;
  border-radius: 0;
  font-size: 10.5px;
  font-weight: 600;
}
.badge-admin { background: #fdf3e0; color: #c99a3a; }
.badge-super { background: #e8f4f2; color: #4a9b8f; }
.badge-oper  { background: #e8f4f8; color: #3d90a8; }

.btn-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-mid);
  border-radius: 0;
  background: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: background .1s;
}
.btn-icon:hover { background: var(--sand-light); }
.btn-icon-danger { border-color: #f0a0a0; color: #c05050; }
.btn-icon-danger:hover { background: #fff0f0; }

/* ══════════════════════════════════════════════════════════════
   AUDITORÍA Y BACKUPS
══════════════════════════════════════════════════════════════ */

.audit-layout {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.audit-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audit-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.audit-section-titulo {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.audit-tabla {
  width: 100%;
  border-collapse: collapse;
}
.audit-tabla th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 0 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.audit-tabla td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--sand-light);
  vertical-align: middle;
}
.audit-tabla tr:last-child td { border-bottom: none; }
.audit-tabla tr:hover td { background: var(--sand-xlight); }

.audit-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 10.5px;
  font-weight: 600;
  background: #e8f4f8;
  color: #3d90a8;
}

.audit-paginacion { padding-top: 8px; }
.audit-pag-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ══════════════════════════════════════════════════════════════
   POPUP SUBIR LIQUIDACIÓN — RR.HH.
══════════════════════════════════════════════════════════════ */

.liq-dropzone {
  border: 1.5px dashed var(--border-mid);
  border-radius: 0;
  padding: 52px 24px;
  margin: 0 2px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--text-mid);
}
.liq-dropzone:hover,
.liq-dropzone.dragover {
  border-color: var(--gold);
  background: var(--gold-light);
}
.liq-dropzone .ph {
  font-size: 36px;
  display: block;
  margin-bottom: 10px;
  color: var(--brown);
}
.liq-dropzone p {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-dark);
}
.liq-dropzone span {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}
.liq-formatos {
  margin-top: 10px !important;
  font-size: 10px !important;
  color: var(--sand) !important;
  letter-spacing: .06em;
  font-weight: 600;
}

.liq-log {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  max-height: 120px;
  overflow-y: auto;
  background: var(--sand-xlight);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.liq-log-line { color: var(--text-mid); }
.liq-log-line.ok  { color: #2a7a2a; }
.liq-log-line.err { color: #c05050; }

/* ══════════════════════════════════════════════════════════════
   POPUP DETALLE LIQUIDACIÓN — RR.HH.  (v4.11)
══════════════════════════════════════════════════════════════ */

.liq-det-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #f8f4ee;
}
.liq-det-row:last-child { border-bottom: none; }
.liq-det-row span:first-child {
  font-size: 12px;
  color: var(--text-mid);
}
.liq-det-bloque {
  background: var(--sand-xlight);
  border: 1px solid var(--border);
  padding: 10px 14px;
  margin-bottom: 2px;
}
.liq-det-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  background: var(--gold-light);
  border: 1px solid var(--gold);
  margin-bottom: 14px;
}
.liq-det-total-label {
  font-size: 12px;
  font-weight: 600;
  color: #7a4f10;
}
.liq-det-total-val {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: #7a4f10;
}

/* ══════════════════════════════════════════════════════════════
   RR.HH. — TABS Y TOGGLE  (v4.11)
══════════════════════════════════════════════════════════════ */

.rrhh-tabs {
  display: flex;
  gap: 4px;
}

.rrhh-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid var(--border-mid);
  background: var(--white);
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.rrhh-tab .ph { font-size: 14px; }
.rrhh-tab:hover { background: var(--sand-xlight); border-color: var(--sand); }
.rrhh-tab.active {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}

.rrhh-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding-right: 215px; /* alinea sobre columna Estado */
}

.rrhh-toggle-txt {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 44px;
  text-align: right;
}

.rrhh-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--sand);
  border-radius: 0;
  transition: background 0.2s;
  cursor: pointer;
}
.rrhh-toggle.on { background: var(--gold); }

.rrhh-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 0;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.rrhh-toggle.on .rrhh-toggle-knob { left: 19px; }

/* ══════════════════════════════════════════════════════════════
   LIQUIDACIONES / FINIQUITOS — filtros inline thead  (v4.12)
══════════════════════════════════════════════════════════════ */

.filter-inline {
  width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--border-mid);
  background: var(--white);
  color: var(--text-dark);
  font-size: 11px;
  font-family: 'Figtree', sans-serif;
  border-radius: 0;
  outline: none;
}
.filter-inline:focus { border-color: var(--blue); }

/* ══════════════════════════════════════════════════════════════
   PANTALLA DE INICIO / LOGIN  (v4.13)
══════════════════════════════════════════════════════════════ */

#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: var(--login-display, flex);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#login-screen.oculto {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#login-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

#login-video-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 10, 0.45);
  z-index: 1;
}

#login-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

#login-logo {
  width: 220px;
  height: auto;
  filter: brightness(0) invert(1);
}

#login-entrar-btn {
  padding: 13px 48px;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.85);
  color: #fff;
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#login-entrar-btn:hover {
  background: rgba(255,255,255,0.15);
}

/* ── Dialog de login ─────────────────────────────────────── */
#login-dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
}
#login-dialog-wrap.hidden { display: none; }

#login-dialog-box {
  background: transparent;
  width: 340px;
  padding: 40px 36px 32px;
  border-radius: 0;
  border: 2px solid rgba(255,255,255,0.6);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#login-dialog-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-field label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.login-field input {
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.6);
  background: transparent;
  color: #fff;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  border-radius: 0;
  outline: none;
  transition: border-color 0.15s;
}
.login-field input::placeholder { color: rgba(255,255,255,0.4); }
.login-field input:focus { border-bottom-color: #fff; }

#login-error {
  background: rgba(180,30,30,0.5);
  border: 1px solid rgba(255,100,100,0.5);
  color: #ffd0d0;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 0;
  text-align: center;
}
#login-error.hidden { display: none; }

.login-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 4px;
}
.btn-login-cancel {
  padding: 9px 20px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: rgba(255,255,255,0.8);
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  border-radius: 0;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-login-cancel:hover { border-color: rgba(255,255,255,0.9); color: #fff; }

.btn-login-ok {
  padding: 9px 24px;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.85);
  color: #fff;
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-login-ok:hover { background: rgba(255,255,255,0.15); }
.btn-login-ok:disabled { opacity: 0.4; pointer-events: none; }

/* ─────────────────────────────────────────────────────────────────
   SII — Descarga de facturas electrónicas
   ───────────────────────────────────────────────────────────────── */

.sii-form-bar {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.sii-form-fields {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.sii-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sii-form-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sii-input-fecha { width: 148px; }

.sii-log {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 110px;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 7px 12px;
  font-size: 11px;
  font-family: var(--font-mono);
}

/* Columnas del header y filas SII */
.sii-col-fecha   { width: 82px;  flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.sii-col-rs      { flex: 1;      min-width: 0;   font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.sii-col-rut     { width: 100px; flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.sii-col-folio   { width: 80px;  flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; text-align: right; padding-right: 12px; }
.sii-col-monto   { width: 95px;  flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; text-align: right; padding-right: 12px; }
.sii-col-acciones{ flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end; width: 230px; }

/* Lista de archivos descargados */
.sii-lista-wrap {
  flex: 1;
  overflow-y: auto;
}

.sii-lista-header {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  flex-shrink: 0;
  gap: 12px;
}

.sii-fila {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  border-bottom: 0.5px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
  gap: 12px;
}

.sii-fila:hover { background: var(--bg-soft); }

/* Celdas de datos en cada fila */
.sii-fila .sii-col-fecha  { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); font-weight: 400; text-transform: none; letter-spacing: 0; }
.sii-fila .sii-col-rs     { font-size: 13px; color: var(--text-main);  font-weight: 400; text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sii-fila .sii-col-rut    { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); font-weight: 400; text-transform: none; letter-spacing: 0; }
.sii-fila .sii-col-folio  { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); font-weight: 400; text-transform: none; letter-spacing: 0; }
.sii-fila .sii-col-monto  { font-size: 12px; color: var(--text-main);  font-family: var(--font-mono); font-weight: 400; text-transform: none; letter-spacing: 0; }
.sii-fila .sii-col-acciones { justify-content: flex-end; }

.sii-fila-link { color: inherit; }

.sii-total-row {
  display: flex;
  align-items: center;
  padding: 7px 20px;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  flex-shrink: 0;
}
.sii-total-row .sii-col-rs    { font-size: 12px; color: var(--text-muted); }
.sii-total-row .sii-col-monto { font-size: 12px; font-family: var(--font-mono); font-weight: 600; color: var(--text-main); }
