/* Reset y Variables CSS - Similar a CSS Modules o Styled Components en React */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --bg-color: #ffffff;
  --bg-secondary: #f3f4f6;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --border-radius: 0.5rem;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.6;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Navbar */
.navbar {
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
}

.navbar-menu {
  display: flex;
  list-style: none;
  gap: var(--spacing-lg);
}

.navbar-menu a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s;
}

.navbar-menu a:hover {
  color: var(--primary-color);
}

/* Main Content */
main {
  min-height: calc(100vh - 200px);
  padding: var(--spacing-2xl) 0;
}

.app-layout main {
  padding: 1.5rem;
  min-height: auto;
}

/* Footer */
.footer {
  background-color: var(--bg-secondary);
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-2xl);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  text-align: center;
  color: var(--text-light);
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-xl);
}

.card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card h2 {
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--secondary-color);
}

/* Forms */
.contact-form {
  max-width: 600px;
  margin: var(--spacing-xl) auto;
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Page 404 */
.page-404 {
  text-align: center;
  padding: var(--spacing-2xl) 0;
}

.page-404 h1 {
  font-size: 6rem;
  color: var(--primary-color);
  margin-bottom: var(--spacing-lg);
}

/* Login Page */
.page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  padding: var(--spacing-lg);
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: var(--bg-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.login-header h1 {
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.login-header p {
  color: var(--text-light);
}

.login-form .form-group {
  margin-bottom: var(--spacing-lg);
}

.login-footer {
  text-align: center;
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.login-footer a {
  color: var(--primary-color);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* Checkbox Label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
  width: auto;
}

/* Dashboard Page */
.page-dashboard {
  padding: var(--spacing-xl) 0;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
}

.stat-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
}

.stat-icon-green {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.stat-icon-yellow {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.stat-icon-purple {
  background-color: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.stat-content h3 {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Dashboard Section */
.dashboard-section {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.section-header h2 {
  margin: 0;
}

/* Table */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background-color: var(--bg-secondary);
}

.data-table th,
.data-table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.875rem;
}

.data-table tbody tr:hover {
  background-color: var(--bg-secondary);
}

.text-center {
  text-align: center;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pagada {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.status-pendiente {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.status-vencida {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-container {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .navbar-menu {
    flex-direction: column;
    gap: var(--spacing-sm);
    text-align: center;
  }

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

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

/* ============================================================
   CUENTAS BANCARIAS
   ============================================================ */

.page-cuentas {
  background: #f4f6f9;
  min-height: 100vh;
  padding: 2rem 0;
}

.cuentas-container {
  margin: 0 auto;
  padding: 0 1.5rem;
}

.cuentas-header {
  margin-bottom: 2rem;
}

.cuentas-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 0.25rem;
}

.cuentas-summary {
  color: #718096;
  font-size: 0.9rem;
  margin: 0;
}

.cuentas-loading,
.cuentas-error {
  text-align: center;
  padding: 3rem;
  color: #718096;
}

/* Titular card */
.titular-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.titular-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid #f0f4f8;
}

.titular-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.titular-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #718096;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.titular-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: #3b82f6;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.titular-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 0.15rem;
  line-height: 1.3;
}

.titular-code {
  font-size: 0.8rem;
  color: #718096;
  margin: 0;
}

.titular-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.filter-month,
.filter-year {
  appearance: none;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.3rem 1.6rem 0.3rem 0.6rem;
  font-size: 0.82rem;
  color: #374151;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  background-size: 0.75rem;
}

.filter-month:focus,
.filter-year:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.filter-year {
  width: 4.5rem;
}

.titular-period-label {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.78rem;
  color: #718096;
  gap: 0.1rem;
  white-space: nowrap;
}

.titular-period-dash {
  color: #cbd5e0;
}

/* Banks grid */
.banks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1rem 1.5rem 1.5rem;
}

.no-accounts {
  color: #a0aec0;
  font-size: 0.85rem;
  padding: 0.5rem 0;
  grid-column: 1 / -1;
}

/* Bank card */
.bank-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s;
}

.bank-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.bank-card-accent {
  height: 4px;
  width: 100%;
}

.bank-card-body {
  padding: 0.75rem 1rem 0.9rem;
}

.bank-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.bank-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #2d3748;
}

.currency-badge {
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  letter-spacing: 0.04em;
}

.currency-pen {
  color: #3b82f6;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.currency-usd {
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.bank-account-number {
  font-size: 0.78rem;
  color: #718096;
  margin: 0 0 0.75rem;
}

.bank-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.4rem;
}

.bank-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.bank-stat-label {
  font-size: 0.68rem;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bank-stat-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2d3748;
}

.bank-pagos {
  font-size: 0.72rem;
  color: #a0aec0;
  margin: 0;
}

.badge-detraccion {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.bank-card-det {
  opacity: 0.85;
}

@media (max-width: 900px) {
  .banks-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .banks-grid {
    grid-template-columns: 1fr;
  }
  .titular-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ── Cuentas: type-filter tabs ──────────────────────────── */
.cuentas-type-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.type-tab {
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #4a5568;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.type-tab:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.type-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* ── Cuentas: verify switch ─────────────────────────────── */
.verify-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.verify-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.verify-track {
  position: relative;
  width: 34px;
  height: 18px;
  background: #cbd5e0;
  border-radius: 9px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.verify-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform 0.2s;
}

.verify-switch input:checked ~ .verify-track {
  background: #2563eb;
}

.verify-switch input:checked ~ .verify-track .verify-thumb {
  transform: translateX(16px);
}

.verify-label {
  font-size: 0.78rem;
  color: #4a5568;
  white-space: nowrap;
}

/* ── Cuentas: titular navigator ─────────────────────────── */
.cuentas-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.cuentas-nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #718096;
  text-transform: uppercase;
  white-space: nowrap;
}

.titular-selector {
  flex: 1;
  min-width: 160px;
  padding: 0.3rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.83rem;
  color: #2d3748;
  background: #f8fafc;
  cursor: pointer;
  outline: none;
}

.titular-selector:focus {
  border-color: #2563eb;
}

.titular-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #4a5568;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  flex-shrink: 0;
}

.titular-nav-btn:hover:not(:disabled) {
  background: #f0f4f8;
  border-color: #cbd5e0;
}

.titular-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.titular-counter {
  font-size: 0.8rem;
  color: #718096;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   TOPBAR + SIDEBAR LAYOUT
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
  background: #f4f6f9;
}

/* ── Topbar ── */
.app-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 102;
  padding-right: 1.25rem;
}

/* ── Notification panel ── */
.notif-panel {
  position: fixed;
  top: 58px;
  right: 1rem;
  width: 310px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 300;
  overflow: hidden;
}
.notif-panel[hidden] { display: none; }

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem 0.625rem;
}
.notif-panel-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
}
.notif-panel-unread {
  font-size: 0.75rem;
  color: #6b7280;
}

.notif-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #f3f4f6;
}

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f9fafb;
  transition: background 0.12s;
  cursor: default;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f9fafb; }

.notif-dot-wrap {
  padding-top: 0.3rem;
  flex-shrink: 0;
  width: 10px;
}
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
}

.notif-body { flex: 1; min-width: 0; }
.notif-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.15rem;
}
.notif-sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}
.notif-time {
  font-size: 0.7rem;
  color: #9ca3af;
}

.notif-panel-footer {
  padding: 0.625rem 1rem;
  text-align: center;
  border-top: 1px solid #f3f4f6;
}
.notif-panel-footer a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #3b82f6;
  text-decoration: none;
}
.notif-panel-footer a:hover { text-decoration: underline; }

.topbar-toggle {
  width: 56px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
  transition: color 0.15s;
}
.topbar-toggle:hover { color: #111827; }
.topbar-toggle .icon-close { display: none; }
body.sidebar-expanded .topbar-toggle .icon-open  { display: none; }
body.sidebar-expanded .topbar-toggle .icon-close { display: block; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-notif {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  padding: 0.35rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.topbar-notif:hover { color: #111827; background: #f3f4f6; }

.topbar-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.topbar-badge[hidden] { display: none; }

.topbar-user-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  cursor: default;
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.topbar-username {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

/* ── Sidebar ── */
.sidebar {
  width: 56px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 103;
  overflow: hidden;
  transition: width 0.22s ease;
}

.sidebar-brand {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
  overflow: hidden;
}

body.sidebar-expanded .sidebar-brand {
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0 0 0 0.75rem;
}

.sidebar-brand-logo {
  display: none;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

body.sidebar-expanded .sidebar-brand-logo { display: block; }

.sidebar-brand-text {
  flex: 1;
  min-width: 0;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.18s ease, max-width 0.22s ease;
}

body.sidebar-expanded .sidebar-brand-text {
  opacity: 1;
  max-width: 130px;
}

.sidebar-brand-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  line-height: 1.2;
}

.sidebar-brand-sub {
  display: block;
  font-size: 0.7rem;
  color: #9ca3af;
  white-space: nowrap;
}

.sidebar-brand-toggle {
  width: 56px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

body.sidebar-expanded .sidebar-brand-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  margin-left: auto;
  margin-right: 0.35rem;
}

.sidebar-brand-toggle:hover { color: #374151; background: #f3f4f6; }

.sidebar-brand-toggle .icon-expand  { display: flex; }
.sidebar-brand-toggle .icon-collapse { display: none; }
body.sidebar-expanded .sidebar-brand-toggle .icon-expand  { display: none; }
body.sidebar-expanded .sidebar-brand-toggle .icon-collapse { display: flex; }

body.sidebar-expanded .sidebar { width: 220px; }

.app-content {
  margin-left: 56px;
  padding-top: 52px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.22s ease;
}

body.sidebar-expanded .app-content { margin-left: 220px; }

/* Nav links */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.4rem;
  flex: 1;
  gap: 0.15rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0.65rem;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

body.sidebar-expanded .sidebar-link {
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
}

.sidebar-link:hover {
  background: #f3f4f6;
  color: #111827;
}

.sidebar-link.active {
  background: #fee2e2;
  color: #dc2626;
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar-label {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.18s ease, max-width 0.22s ease;
}

body.sidebar-expanded .sidebar-label {
  opacity: 1;
  max-width: 160px;
}

.sidebar-footer {
  padding: 0.4rem;
  border-top: 1px solid #f3f4f6;
}

.sidebar-logout {
  text-align: left;
  color: #6b7280;
}

.sidebar-logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* Ajustar páginas que tenían fondo propio */
.page-dashboard,
.page-cuentas {
  background: transparent;
  min-height: auto;
  padding: 0;
}

.cuentas-container,
.dashboard-container {
  padding-top: 1rem;
}

.cuentas-header {
  margin-bottom: 1rem;
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .app-content { margin-left: 0; }
  body.sidebar-expanded .sidebar { transform: translateX(0); }
  body.sidebar-expanded .app-content { margin-left: 0; }
}

/* ============================================================
   CLIENTES
   ============================================================ */

.page-clientes {
  background: #f4f6f9;
  min-height: calc(100vh - 200px);
}

.clientes-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.clientes-header {
  margin-bottom: 1.25rem;
}

.clientes-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.clientes-header p {
  color: #6b7280;
  font-size: 0.95rem;
}

/* Search */
.clientes-search {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-input-wrapper {
  position: relative;
  flex: 0 1 380px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.clientes-search .search-input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.4rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.625rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.clientes-search .search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clientes-search .search-submit {
  background-color: #1e3a8a;
  color: #fff;
  padding: 0.7rem 1.5rem;
  border-radius: 0.625rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background-color 0.15s;
}

.clientes-search .search-submit:hover {
  background-color: #1e40af;
}

/* IGV Tabs */
.igv-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.igv-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  min-width: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: #0f172a;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.igv-tab:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.igv-tab.is-active {
  background-color: #1e3a8a;
  border-color: #1e3a8a;
  color: #fff;
}

.igv-tab.is-active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background-color: #fff;
  border-radius: 3px 3px 0 0;
}

.igv-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.igv-tab-badge--blue {
  background-color: rgba(30, 58, 138, 0.1);
  color: #1e3a8a;
}

.igv-tab.is-active .igv-tab-badge--blue {
  background-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.igv-tab-badge--yellow {
  background-color: #fef3c7;
  color: #b45309;
}

.igv-tab.is-active .igv-tab-badge--yellow {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.igv-tab-badge--purple {
  background-color: #ede9fe;
  color: #6d28d9;
}

.igv-tab.is-active .igv-tab-badge--purple {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.igv-tab-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.igv-tab-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.igv-tab-sub {
  font-size: 0.78rem;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.igv-tab-count {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-shrink: 0;
}

.igv-tab-count strong {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.igv-tab-count span {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

/* Panel + tabla */
.clientes-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
}

.clientes-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.875rem;
  color: #6b7280;
}

.clientes-panel-count strong {
  color: #0f172a;
  font-weight: 700;
}

.clientes-panel-view strong {
  color: #1e3a8a;
  font-weight: 600;
}

.clientes-table-wrapper {
  overflow-x: auto;
}

.clientes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.clientes-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #6b7280;
  background-color: #f9fafb;
  box-shadow: inset 0 -1px 0 #e5e7eb;
}

.clientes-table tbody td {
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 0.88rem;
}

.clientes-table tbody tr:last-child td {
  border-bottom: none;
}

.clientes-table tbody tr:hover {
  background-color: #f9fafb;
}

.clientes-table .col-center { text-align: center; }
.clientes-table .col-right  { text-align: right; }

/* Skeleton loader (tabla clientes) */
@keyframes skeleton-shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  display: inline-block;
  background-color: #e2e8f0;
  background-image: linear-gradient(
    90deg,
    #e2e8f0 0%,
    #f1f5f9 40%,
    #f1f5f9 60%,
    #e2e8f0 100%
  );
  background-size: 200px 100%;
  background-repeat: no-repeat;
  border-radius: 4px;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  vertical-align: middle;
}

.skeleton-text {
  height: 12px;
  width: 100%;
}

.skeleton-pill {
  height: 20px;
  width: 110px;
  border-radius: 999px;
}

.skeleton-row td {
  vertical-align: middle;
}

/* Paginación */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.9rem;
  border-top: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.pagination-left {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.82rem;
  color: #64748b;
}

.per-page {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.per-page select {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 0.3rem 1.7rem 0.3rem 0.6rem;
  border-radius: 0.4rem;
  font: inherit;
  font-size: 0.82rem;
  color: #0f172a;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  transition: border-color 0.15s;
}

.per-page select:hover  { border-color: #cbd5e1; }
.per-page select:focus  { outline: none; border-color: #1e3a8a; }

.pagination-info {
  color: #94a3b8;
}

.pagination-right {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pag-btn {
  min-width: 36px;
  height: 34px;
  padding: 0 0.75rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 0.45rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pag-btn:hover:not(:disabled):not(.is-active) {
  background: #f1f5f9;
  color: #0f172a;
}

.pag-btn.is-active {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #fff;
  font-weight: 700;
  cursor: default;
}

.pag-btn:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
  background: transparent;
}

.pag-ellipsis {
  min-width: 32px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  user-select: none;
  padding: 0 0.15rem;
}

/* Toolbar — toggle deslizante (abonos subidos / conciliada) */
.clientes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.view-toggle-label {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s;
}

.view-toggle-label:hover {
  color: #475569;
}

.view-toggle-label.is-active {
  color: #0f172a;
  font-weight: 600;
}

.view-toggle-track {
  position: relative;
  appearance: none;
  border: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.18s ease;
}

.view-toggle[data-mode="conciliada"] .view-toggle-track {
  background: #1e3a8a;
}

.view-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.18s ease;
}

.view-toggle[data-mode="conciliada"] .view-toggle-thumb {
  transform: translateX(16px);
}

/* Celda COTIZACIONES — pill total + desglose por tipo IGV */
.coti-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.coti-total-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}

.coti-total-pill--mixto {
  background: #eef2ff;
  color: #1e3a8a;
}

.coti-breakdown {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  color: #94a3b8;
  white-space: nowrap;
}

.coti-bd        { font-weight: 500; }
.coti-bd strong { color: #0f172a; font-weight: 700; }

.coti-bd-sep {
  color: #cbd5e1;
}

.col-ruc {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #334155;
}

.razon-main {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
  font-size: 0.88rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  max-width: 280px;
}

.razon-sub {
  font-size: 0.8rem;
  color: #6b7280;
}

.amount-paid     { color: #059669; font-weight: 500; }
.amount-zero     { color: #94a3b8; }
.amount-due      { color: #dc2626; font-weight: 600; }
.amount-discount { color: #b45309; font-weight: 600; }

.clientes-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #6b7280;
}

@media (max-width: 768px) {
  .clientes-search {
    flex-direction: column;
  }

  .search-input-wrapper {
    flex: 1 1 auto;
  }

  .igv-tabs {
    grid-template-columns: 1fr;
  }

  .igv-tab {
    flex-wrap: wrap;
  }

  .clientes-table thead {
    display: none;
  }

  .clientes-table tbody td {
    padding: 0.7rem 1rem;
  }
}

/* Razón social como link en la tabla de clientes */
.razon-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.razon-link:hover .razon-main {
  color: #1e3a8a;
  text-decoration: underline;
}

/* ============================================================
   DETALLE DE CLIENTE
   ============================================================ */

.page-cliente {
  background: #f4f6f9;
  min-height: calc(100vh - 200px);
  padding: 1.5rem 0 3rem;
}

.cliente-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.cliente-back {
  display: inline-block;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.cliente-back:hover { color: #1e3a8a; }

.cliente-header {
  margin-bottom: 1.5rem;
}

.cliente-header-title {
  display: flex;
  align-items: center;
  justify-content: left;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
  text-align: center;
}

.cliente-header-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: #1e3a8a;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.cliente-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.01em;
}

.cliente-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem 1.5rem;
  margin: 0;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
}

.cliente-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.cliente-meta-item dt {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.cliente-meta-item dd {
  margin: 0;
  font-size: 0.92rem;
  color: #0f172a;
  font-weight: 500;
  word-break: break-word;
}

.cliente-meta-item:first-child dd {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

/* Stats */
.cliente-stats {
  display: grid;
  grid-template-columns: 0.7fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cliente-stat {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

.cliente-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.cliente-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 0.65rem;
}

/* Card de COTIZACIONES — breakdown vertical */
.cliente-stat--count .cliente-stat-value {
  margin-bottom: 0;
  font-size: 2.4rem;
  line-height: 1;
}

.count-card-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
}

.count-card-total {
  text-align: center;
  padding-right: 0.9rem;
  border-right: 1px solid #e5e7eb;
}

.count-card-total-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.count-card-breakdown {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.count-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: #475569;
}

.count-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.count-row-label {
  flex: 1;
}

.count-row-value {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.95rem;
}

.count-row--cerradas .count-row-dot { background: #10b981; }
.count-row--curso    .count-row-dot { background: #3b82f6; }
.count-row--no       .count-row-dot { background: #94a3b8; }

/* Cards de moneda — filas Cotizado/Cobrado/Pendiente */
.cliente-stat-rows {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.cliente-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #e5e7eb;
}

.cliente-stat-row:last-child { border-bottom: none; }

.cliente-stat-row dt {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 500;
}

.cliente-stat-row dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.cliente-stat-row--total dt {
  color: #1f2937;
  font-weight: 600;
}

.cliente-stat-row--total dd {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Secciones */
.cotizaciones-section,
.no-cerraron-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.cotizaciones-section > h2,
.no-cerraron-section > h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
}

.cotizaciones-section .count,
.no-cerraron-section .count {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.9rem;
  margin-left: 0.25rem;
}

/* Leyenda de tipo de cobro (con IGV / sin IGV / mixto) */
.igv-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  padding: 0.55rem 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  background: #f8fafc;
  font-size: 0.82rem;
  color: #475569;
}

.igv-legend-label {
  font-weight: 600;
  color: #334155;
  margin-right: 0.25rem;
}

.igv-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #1f2937;
}

.igv-legend-bar {
  display: inline-block;
  width: 5px;
  height: 18px;
  border-radius: 2px;
  background: #cbd5e1;
}

.igv-legend-bar--con-igv { background: rgb(37, 99, 235); }
.igv-legend-bar--sin-igv { background: rgb(245, 158, 11); }
.igv-legend-bar--mixto   {
  background: linear-gradient(
    rgb(37, 99, 235) 0%,
    rgb(37, 99, 235) 50%,
    rgb(245, 158, 11) 50%,
    rgb(245, 158, 11) 100%
  );
}

/* Coti card */
.coti-card {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.1rem 1.25rem 0 1.45rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.coti-card:last-child { margin-bottom: 0; }

/* Franja izquierda por condición de IGV */
.coti-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: #cbd5e1;          /* default (sin clasificar) */
}
.coti-card--con-igv::before {
  background: rgb(37, 99, 235);    /* azul */
}
.coti-card--sin-igv::before {
  background: rgb(245, 158, 11);   /* naranja */
}
.coti-card--mixto::before {
  background: linear-gradient(
    rgb(37, 99, 235) 0%,
    rgb(37, 99, 235) 50%,
    rgb(245, 158, 11) 50%,
    rgb(245, 158, 11) 100%
  );
}

.coti-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.coti-card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.coti-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: #1e3a8a;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.coti-code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #1f2937;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.coti-code-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #1f2937;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed #94a3b8;
  transition: color 0.15s, border-color 0.15s;
}

.coti-code-link:hover {
  color: #1e3a8a;
  border-bottom-color: #1e3a8a;
}

.coti-card-total {
  text-align: right;
}

.coti-card-total-label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.15rem;
}

.coti-card-total-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.coti-card-info {
  margin-top: 0.5rem;
  margin-bottom: 0.85rem;
}

.coti-card-info h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem;
}

.coti-meta-line {
  font-size: 0.82rem;
  color: #6b7280;
}

.coti-meta-line strong {
  color: #1f2937;
  font-weight: 600;
}

.coti-asesor {
  margin-left: auto;
  font-size: 0.82rem;
  color: #6b7280;
}

.coti-asesor strong {
  color: #1f2937;
  font-weight: 600;
}

.coti-card-amounts {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 1.6rem;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.coti-amount-label {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 0.15rem;
}

.coti-amount-value {
  font-size: 1rem;
  font-weight: 700;
}

.coti-progress {
  width: 100%;
  max-width: 280px;
  grid-column: 4;       /* siempre en la última columna, aunque falten celdas previas */
  justify-self: end;
}

.coti-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 0.35rem;
}

.coti-progress-header :last-child {
  color: #0f172a;
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background-color: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: #10b981;
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Pagos */
.coti-pagos {
  padding-top: 0.85rem;
}

.coti-pagos-header {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.65rem;
}

.pagos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.pagos-table thead th {
  background-color: #f9fafb;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #6b7280;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.pagos-table tbody td {
  padding: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.pagos-table tbody tr:last-child td { border-bottom: none; }

.pagos-table .col-right { text-align: right; }

.cuenta-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: #0f172a;
}

.cuenta-line strong { font-weight: 700; }

.cuenta-empty {
  font-style: italic;
  color: #94a3b8;
  font-size: 0.85rem;
}

.cuenta-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #94a3b8;
}

.cuenta-dot--bcp       { background-color: #f59e0b; }
.cuenta-dot--bbva      { background-color: #2563eb; }
.cuenta-dot--interbank { background-color: #10b981; }
.cuenta-dot--scotia    { background-color: #ef4444; }
.cuenta-dot--nacion    { background-color: #7c3aed; }
.cuenta-dot--plin      { background-color: #06b6d4; }
.cuenta-dot--default   { background-color: #94a3b8; }

.currency-tag {
  font-size: 0.7rem;
  color: #6b7280;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cuenta-tag-detraccion {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7c3aed;
  background-color: #f3e8ff;
  padding: 1px 6px;
  border-radius: 4px;
}

.cuenta-sub {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

.cuenta-titular {
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.01em;
}

.cuenta-sep { color: #cbd5e1; }

.cuenta-num {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  color: #94a3b8;
}

.op-code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #334155;
}

.factura-num {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}

.coti-normas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
}

.norma-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  background: #eef2ff;
  color: #1e3a8a;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.voucher-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.voucher-preview:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #1e3a8a;
}

.voucher-preview svg {
  flex-shrink: 0;
  color: #64748b;
}

.voucher-preview:hover svg {
  color: #1e3a8a;
}

.factura-btn,
.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.factura-btn svg,
.pdf-btn svg {
  flex-shrink: 0;
}

.factura-btn {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

.factura-btn:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.pdf-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.pdf-btn--inline {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  align-self: center;
}
.pdf-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.pdf-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #1e293b;
}

.amount-strong {
  font-weight: 700;
  color: #0f172a;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-green-light {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-red-light {
  background-color: #fee2e2;
  color: #b91c1c;
}

.badge-blue-light {
  background-color: #dbeafe;
  color: #1e3a8a;
}

/* Footer de la coti card */
.coti-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background-color: #eef2ff;
  padding: 0.65rem 1rem;
  margin: 0 -1.25rem;
  font-size: 0.85rem;
  color: #1f2937;
}

.coti-card-footer .comision strong {
  color: #0f172a;
  font-weight: 700;
}

.comision-pending {
  color: #b45309;
  font-weight: 600;
}

.comision-paid {
  color: #047857;
  font-weight: 500;
}

/* No cerraron */
.no-cerraron-list { display: flex; flex-direction: column; }

.no-cerraron-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid #f1f5f9;
  min-width: 0;
}

.no-cerraron-item:last-child { border-bottom: none; }

.no-cerraron-item > .coti-code {
  flex-shrink: 0;
}

.no-cerraron-isos {
  flex: 1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  overflow: hidden;
}

.norma-chip--sm {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.no-cerraron-motivo {
  font-size: 0.8rem;
  color: #94a3b8;
  font-style: italic;
  flex-shrink: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.no-cerraron-motivo em { font-style: inherit; }

.no-cerraron-asesor {
  font-size: 0.82rem;
  color: #64748b;
  flex-shrink: 0;
  white-space: nowrap;
}

.no-cerraron-monto {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  flex-shrink: 0;
  text-align: right;
  min-width: 90px;
}

.cliente-empty-state {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 3rem 1.5rem;
  text-align: center;
  margin-top: 1rem;
}

.cliente-empty-state h2 {
  font-size: 1.25rem;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.cliente-empty-state p {
  color: #6b7280;
}

@media (max-width: 1024px) {
  .cliente-stats {
    grid-template-columns: 1fr 1fr;
  }

  .cliente-stat--count {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .cliente-stats {
    grid-template-columns: 1fr;
  }

  .cliente-stat--count {
    grid-column: auto;
  }

  .coti-card-amounts {
    grid-template-columns: 1fr 1fr;
  }

  .coti-progress {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: none;
    justify-self: stretch;
  }

  .pagos-table thead { display: none; }

  .pagos-table tbody td {
    display: block;
    padding: 0.35rem 0.85rem;
    border-bottom: none;
  }

  .pagos-table tbody tr {
    display: block;
    border-bottom: 1px solid #f1f5f9;
    padding: 0.5rem 0;
  }

  .no-cerraron-item {
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
  }
  .no-cerraron-isos { flex: 1 1 100%; flex-wrap: wrap; overflow: visible; }
  .no-cerraron-monto { margin-left: auto; min-width: 0; }
}
/* ============================================================
   EJECUTIVOS
   ============================================================ */

.page-ejecutivos {
  background: transparent;
  min-height: auto;
  padding: 0;
}

.ejecutivos-container {
  padding-top: 1rem;
}

.ejecutivos-header {
  margin-bottom: 1rem;
}

.ejecutivos-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 0.2rem;
}

.ejecutivos-summary {
  font-size: 0.85rem;
  color: #718096;
  margin: 0;
}

/* Filter bar */
.ejecutivos-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.exec-filter-select,
.exec-filter-input {
  appearance: none;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  color: #374151;
  height: 2rem;
}

.exec-filter-select {
  padding-right: 1.8rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 0.75rem;
  cursor: pointer;
}

.exec-filter-input {
  min-width: 220px;
  flex: 1 1 220px;
}

.exec-filter-select:focus,
.exec-filter-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* Grid */
.ejecutivos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.ejecutivos-grid.ejecutivos-grid-single {
  grid-template-columns: 1fr;
}

/* Card */
.ejecutivo-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ejecutivo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.ejecutivo-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ejecutivo-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
}

.ejecutivo-contact {
  font-size: 0.8rem;
  color: #718096;
  margin: 0;
}

.ejecutivo-comision {
  font-size: 0.8rem;
  color: #718096;
  margin: 0;
}

.ejecutivo-header-right {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  flex-shrink: 0;
}

.ejecutivo-ventas {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  flex-shrink: 0;
}

.stat-info-wrap { position: relative; }

.stat-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #a0aec0;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}

.stat-info-btn:hover { color: #2563eb; background: #eff6ff; }

.stat-info-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  width: 280px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  padding: 0.9rem 1rem;
}

.stat-info-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.6rem;
}

.stat-info-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.6rem;
}

.stat-info-list dt { font-size: 0.78rem; font-weight: 600; color: #374151; white-space: nowrap; }
.stat-info-list dd { font-size: 0.78rem; color: #6b7280; margin: 0; }

.stat-box-info {
  position: absolute;
  top: 6px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  color: #a0aec0;
  cursor: default;
}
.stat-box-info::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
  max-width: 200px;
  width: max-content;
  white-space: normal;
  text-align: left;
}
.stat-box-info:hover::after { opacity: 1; }
.stat-box-info:hover { color: #2563eb; }

.ventas-label {
  font-size: 0.72rem;
  color: #a0aec0;
  white-space: nowrap;
}

.ventas-count {
  font-size: 2rem;
  font-weight: 700;
  color: #6366f1;
  line-height: 1;
}

/* Stats */
.ejecutivo-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.exec-stat-box {
  flex: 1 1 140px;
  min-width: 120px;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
}

.exec-stat-label {
  font-size: 0.72rem;
  color: #a0aec0;
  font-weight: 500;
}

.exec-stat-value {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a202c;
}

.exec-stat-value.stat-green  { color: #16a34a; }
.exec-stat-value.stat-orange { color: #d97706; }
.exec-stat-value.stat-blue   { color: #2563eb; }
.exec-stat-value.stat-teal   { color: #0891b2; }
.exec-stat-value.stat-purple { color: #7c3aed; }
.exec-stat-value.stat-empty  { color: #cbd5e0; font-weight: 400; }

.stat-dash { color: #cbd5e0; }

/* cotizaciones section */
.cotizaciones-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cotizaciones-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: #a0aec0;
  letter-spacing: 0.05em;
  margin: 0;
}

.cotizaciones-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.cotizaciones-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: #a0aec0;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #f0f4f8;
}

.cotizaciones-table td {
  padding: 0.55rem 0.5rem;
  color: #374151;
  vertical-align: middle;
  border-bottom: 1px solid #f7fafc;
}

.cotizaciones-table tbody tr:last-child td {
  border-bottom: none;
}

.td-cot { font-family: monospace; font-size: 0.8rem; white-space: nowrap; }
.td-monto { text-align: left; font-weight: 600; white-space: nowrap; }
.td-estado { white-space: nowrap; }
.td-cuenta .desde-cuenta-wrap { display: flex; align-items: center; gap: 0.4rem; }

/* Badges */
.badge-pagada,
.badge-pendiente {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-pagada    { background: #dcfce7; color: #16a34a; }
.badge-pendiente { background: #fff7ed; color: #d97706; }

.badge-date {
  color: #a0aec0;
  font-size: 0.72rem;
}

/* Desde cuenta */
.desde-bullet {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.desde-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.desde-info strong { font-size: 0.8rem; color: #374151; }
.desde-info small  { font-size: 0.72rem; color: #a0aec0; }

/* Marcar pagada */
.marcar-pagada-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  color: #6366f1;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.marcar-pagada-btn:hover { color: #4f46e5; }

/* avatar de iniciales */
.ejecutivo-info { flex-direction: row !important; align-items: center; gap: 0.75rem; }
.ejecutivo-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #e0e7ff; color: #4f46e5;
  font-size: 0.85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* badge de estado inline */
.estado-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

/* celda cotización */
.cot-code { display: block; font-size: 0.8rem; font-weight: 600; color: #374151; }
.cot-fecha { color: #9ca3af; font-size: 0.73rem; }
.td-ruc    { color: #9ca3af; font-size: 0.73rem; display: block; }

/* celda pagos */
.td-pagos { min-width: 160px; }
.sin-pagos { color: #cbd5e0; font-size: 0.78rem; }
.pago-item {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; margin-bottom: 0.2rem;
}
.pago-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pago-banco { color: #374151; font-weight: 600; }
.pago-monto { color: #1a202c; }
.pago-fecha { color: #9ca3af; }
.pago-verify     { color: #cbd5e0; font-size: 0.7rem; }
.pago-verify.ok  { color: #16a34a; }

.no-cotizaciones {
  text-align: center;
  color: #a0aec0;
  font-size: 0.82rem;
  padding: 1rem;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: #a0aec0;
  padding: 2rem;
  font-size: 0.9rem;
}

.exec-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #a0aec0;
  padding: 2rem;
}

.exec-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.exec-page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #4a5568;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.exec-page-btn:hover:not(:disabled) {
  background: #f0f4f8;
  border-color: #cbd5e0;
}

.exec-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.exec-page-info {
  font-size: 0.82rem;
  color: #718096;
  white-space: nowrap;
}

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

/* ===========================================================
   Cotización — detalle (solo lectura)
   =========================================================== */
.page-cotizacion {
  padding: 1.5rem 2rem;
}

.cotizacion-container {
  max-width: 1200px;
  margin: 0 auto;
}

.cotizacion-header {
  margin-bottom: 1.5rem;
}

.cotizacion-code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 0.15rem;
}

.cotizacion-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
}

.cotizacion-normas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.coti-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.coti-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}

.coti-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.9rem;
  letter-spacing: 0.01em;
}

.coti-section h2 .count {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.9rem;
  margin-left: 0.25rem;
}

.coti-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem 1.25rem;
  margin: 0;
}

.coti-fields--two {
  grid-template-columns: 1fr 1fr;
}

.coti-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

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

.coti-field dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}

.coti-field dd {
  margin: 0;
  font-size: 0.92rem;
  color: #0f172a;
  font-weight: 500;
  word-break: break-word;
}

.coti-field--strong dd,
.coti-field dd.coti-field--strong {
  font-weight: 700;
  font-size: 1rem;
}

.isos-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.iso-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.iso-norma {
  font-weight: 700;
  color: #1e3a8a;
  font-size: 0.9rem;
}

.iso-tipo {
  color: #475569;
  font-size: 0.85rem;
}

.iso-monto {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.95rem;
  text-align: right;
}

.cronograma-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.cronograma-card {
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.cronograma-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 0.6rem;
  letter-spacing: 0.02em;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.pill--yes {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.pill--no {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

.llamadas-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.llamada-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  background: #dbeafe;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  .coti-detail-grid,
  .cronograma-grid,
  .coti-fields--two {
    grid-template-columns: 1fr;
  }

  .iso-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .iso-monto {
    text-align: left;
  }
}

/* ===========================================================
   Modal detalle de cotización (minimalista)
   =========================================================== */
.coti-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.coti-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.coti-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.coti-modal-dialog {
  position: relative;
  width: min(100%, 760px);
  max-height: 88vh;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(6px);
  transition: transform 0.18s ease;
}

.coti-modal.is-open .coti-modal-dialog {
  transform: translateY(0);
}

/* =====================================================================
   Voucher modal — previsualizador de comprobantes (zoom + drag + maximizar)
   ===================================================================== */
.voucher-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.voucher-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.voucher-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.voucher-modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, 92vw);
  height: min(560px, 86vh);
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Handles para redimensionar el dialog desde lados y esquinas. */
.voucher-resize {
  position: absolute;
  z-index: 5;
  background: transparent;
  /* Útil para depurar: background: rgba(255,0,0,.2); */
}
.voucher-resize--n  { top: 0;    left: 14px; right: 14px; height: 6px;  cursor: ns-resize;  }
.voucher-resize--s  { bottom: 0; left: 14px; right: 14px; height: 6px;  cursor: ns-resize;  }
.voucher-resize--e  { right: 0;  top: 14px; bottom: 14px; width: 6px;   cursor: ew-resize;  }
.voucher-resize--w  { left: 0;   top: 14px; bottom: 14px; width: 6px;   cursor: ew-resize;  }
.voucher-resize--ne { top: 0;    right: 0;  width: 14px;  height: 14px; cursor: nesw-resize; }
.voucher-resize--nw { top: 0;    left: 0;   width: 14px;  height: 14px; cursor: nwse-resize; }
.voucher-resize--se { bottom: 0; right: 0;  width: 14px;  height: 14px; cursor: nwse-resize; }
.voucher-resize--sw { bottom: 0; left: 0;   width: 14px;  height: 14px; cursor: nesw-resize; }

.voucher-modal-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem 0.5rem 0.85rem;
  background: #0f172a;
  color: #f1f5f9;
  cursor: grab;
  user-select: none;
}
.voucher-modal-header.is-dragging {
  cursor: grabbing;
}

.voucher-modal-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}
.voucher-modal-title svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.voucher-modal-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voucher-modal-zoom {
  font-size: 0.78rem;
  color: #cbd5e1;
  font-weight: 600;
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.voucher-modal-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.voucher-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.voucher-tool:hover {
  background: #ffffff;
  transform: translateY(-1px);
}
.voucher-tool:active {
  transform: translateY(0);
}
.voucher-tool--close:hover {
  background: #ef4444;
  color: #ffffff;
}

.voucher-modal-body {
  flex: 1;
  overflow: auto;
  background: #0f172a;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0.5rem;
}

.voucher-modal-image {
  display: block;
  margin: auto;             /* centrado cuando cabe; respeta scroll cuando no */
  user-select: none;
  -webkit-user-drag: none;
}

.voucher-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

/* El atributo `hidden` debe ganar sobre los display:block de arriba. */
.voucher-modal-image[hidden],
.voucher-modal-frame[hidden] {
  display: none !important;
}

.voucher-modal-body--pdf {
  padding: 0;
  background: #ffffff;
}

/* Impresión limpia: si el modal del comprobante está abierto, solo se imprime
   su contenido (imagen o PDF) — sin header, sin sidebar, sin nada de la página. */
@media print {
  body * { visibility: hidden !important; }
  .voucher-modal.is-open,
  .voucher-modal.is-open * { visibility: visible !important; }
  .voucher-modal.is-open .voucher-modal-header,
  .voucher-modal.is-open .voucher-modal-header * { visibility: hidden !important; }
  .voucher-modal.is-open .voucher-modal-backdrop { display: none !important; }
  .voucher-modal.is-open {
    position: absolute !important;
    inset: 0 !important;
    background: #ffffff !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .voucher-modal.is-open .voucher-modal-dialog {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
  .voucher-modal.is-open .voucher-modal-body {
    background: #ffffff !important;
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
    display: block !important;
  }
  .voucher-modal.is-open .voucher-modal-image {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
  .voucher-modal.is-open .voucher-modal-frame {
    width: 100% !important;
    min-height: 95vh !important;
    border: 0 !important;
  }
}

.coti-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.coti-modal-id {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  min-width: 0;
}

.coti-modal-asesor {
  margin-left: auto;
  font-size: 0.82rem;
  color: #64748b;
  white-space: nowrap;
}

.coti-modal-asesor strong {
  color: #0f172a;
  font-weight: 600;
}

.coti-modal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e3a8a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.coti-modal-code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.coti-modal-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.m-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.m-badge--green {
  background: #d1fae5;
  color: #047857;
}

.m-badge--green-soft {
  background: #ecfdf5;
  color: #065f46;
}

.m-badge--blue {
  background: #dbeafe;
  color: #1e40af;
}

.m-badge--factura {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.6rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: #065f46;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.m-badge--factura:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.coti-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s, background-color 0.15s;
  flex-shrink: 0;
}

.coti-modal-close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.coti-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1.25rem 1.4rem;
}

.m-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  margin: 0;
}

.m-grid--four {
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem 1rem;
}

.m-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

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

.m-field dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.m-field dd {
  margin: 0;
  font-size: 0.95rem;
  color: #0f172a;
  font-weight: 400;
  line-height: 1.4;
  word-break: break-word;
}

.m-field dd.m-strong,
.m-strong {
  font-size: 1.15rem;
  font-weight: 700;
}

.m-sub {
  display: block;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.1rem;
}

.m-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 1.3rem 0 1.1rem;
}

.m-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
}

.m-section-count {
  margin-left: 0.4rem;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0;
}

.m-isos {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.m-isos .iso-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0;
  background: transparent;
  border: none;
}

.m-isos .iso-norma {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.92rem;
}

.m-isos .iso-tipo {
  color: #64748b;
  font-size: 0.88rem;
}

.m-isos .iso-monto {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.95rem;
  text-align: right;
}

.m-llamadas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.m-llamadas .llamada-chip {
  background: #f1f5f9;
  color: #334155;
  border: none;
  font-weight: 500;
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  border-radius: 0.4rem;
}

@media (max-width: 900px) {
  .m-grid--four {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .coti-modal {
    padding: 0;
  }
  .coti-modal-dialog {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .m-grid,
  .m-grid--four {
    grid-template-columns: 1fr;
  }
  .m-isos .iso-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
  .m-isos .iso-monto {
    text-align: left;
  }
}

/* ============================================================
   DASHBOARD (nuevo diseño)
   ============================================================ */

.dash-header {
  margin-bottom: 1rem;
}

.dash-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 0.15rem;
}

.dash-period {
  font-size: 0.85rem;
  color: #718096;
  margin: 0;
}

/* Filter bar */
.dash-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.dash-filter-sel {
  appearance: none;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.35rem 1.8rem 0.35rem 0.7rem;
  font-size: 0.82rem;
  color: #374151;
  height: 2rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 0.75rem;
}

.dash-filter-sel:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

/* Sections */
.dash-section {
  margin-bottom: 1.75rem;
}

.dash-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.dash-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #718096;
}

.dash-section-right {
  font-size: 0.78rem;
  color: #a0aec0;
}

/* Total grid */
.total-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

/* Total card */
.total-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.total-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-currency-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #718096;
}

.cobrado-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.cobrado-badge.badge-pen { background: #ede9fe; color: #6d28d9; }
.cobrado-badge.badge-usd { background: #ccfbf1; color: #0d9488; }

.total-main-amount {
  font-size: 2rem;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.1;
}

.total-main-sub {
  font-size: 0.78rem;
  color: #a0aec0;
  margin: -0.4rem 0 0;
}

/* Progress bar */
.progress-track {
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* Cobrado / Falta row */
.total-stats-row {
  display: flex;
  justify-content: space-between;
}

.total-stat-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.total-stat-item.align-end {
  align-items: flex-end;
  flex-direction: row-reverse;
  text-align: right;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.3rem;
}

.dot-yellow { background: #f59e0b; }

.total-stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #a0aec0;
}

.total-stat-val {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a202c;
}

.falta-val { color: #f59e0b; }

.total-divider {
  border: none;
  border-top: 1px solid #f0f4f8;
  margin: 0;
}

/* Holder breakdown */
.holder-breakdown-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #a0aec0;
  margin: 0;
}

.holder-list {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
}

.holder-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #718096;
}

/* Tributaria grid */
.trib-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

/* Tributaria card */
.trib-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.trib-currency-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #718096;
  margin: 0;
}

.trib-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.trib-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.trib-row-neto {
  padding-top: 0.25rem;
}

.trib-label { color: #374151; }
.trib-val   { color: #1a202c; }
.trib-bold  { font-weight: 700; }

.trib-igv { color: #4f46e5; }
.trib-det { color: #d97706; }
.trib-neto { color: #16a34a; font-weight: 600; }

.trib-divider {
  border: none;
  border-top: 1px solid #f0f4f8;
  margin: 0;
}

/* Validation */
.trib-validation-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #a0aec0;
  margin: 0;
}

.trib-val-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.trib-val-entry {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.trib-val-main {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: #374151;
}

.trib-val-diff {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.diff-neg { color: #d97706; }
.diff-pos { color: #4f46e5; }
.diff-zero { color: #a0aec0; }

@media (max-width: 900px) {
  .total-grid,
  .trib-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   DASHBOARD – Clientes con saldo pendiente
   ============================================================ */

.pend-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
}

.pend-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.1rem 1.5rem 0.9rem;
  gap: 1rem;
}

.pend-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 0.15rem;
}

.pend-subtitle {
  font-size: 0.78rem;
  color: #a0aec0;
  margin: 0;
}

.pend-total-block {
  text-align: right;
  flex-shrink: 0;
}

.pend-total-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #a0aec0;
  margin-bottom: 0.2rem;
}

.pend-sum-line {
  font-size: 0.78rem;
  line-height: 1.5;
}

.pend-sum-sep { font-size: 0.72rem; }

.pend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.pend-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #a0aec0;
  padding: 0.5rem 1.5rem;
  border-top: 1px solid #f0f4f8;
  border-bottom: 1px solid #f0f4f8;
  background: #fafbfc;
}

.pend-table td {
  padding: 0.7rem 1.5rem;
  vertical-align: middle;
  border-bottom: 1px solid #f7fafc;
  color: #374151;
}

.pend-table tbody tr:last-child td { border-bottom: none; }

.pend-td-client { min-width: 200px; }
.pend-client-name { font-weight: 600; font-size: 0.85rem; color: #1a202c; }
.pend-client-ruc  { font-size: 0.75rem; color: #a0aec0; }

.pend-td-cotiz { text-align: center; }
.pend-cotiz-num { color: #0d9488; font-weight: 600; font-size: 0.88rem; }

.pend-td-amt {
  text-align: right;
  line-height: 1.6;
}

.pend-td-amt span { display: block; white-space: nowrap; }

.pend-amt-pen  { font-weight: 600; color: #1a202c; }
.pend-amt-usd  { font-weight: 600; color: #0d9488; }
.pend-amt-igv  { color: #4f46e5; }
.pend-amt-det  { color: #d97706; }
.pend-amt-neto { color: #16a34a; font-weight: 500; }

/* ============================================================
   DASHBOARD – Mini stats row
   ============================================================ */

.stats-mini-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  margin-top: 1.75rem;
}

.mini-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mini-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #a0aec0;
}

.mini-big {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.1;
}

.mini-amounts {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.mini-pen { font-size: 0.82rem; color: #374151; }
.mini-usd { font-size: 0.82rem; color: #0d9488; }

.mini-ratio {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.1;
}

.mini-ratio-d { color: #cbd5e0; }

.mini-progress { margin-top: 0.25rem; }

.mini-pct {
  font-size: 0.78rem;
  color: #a0aec0;
}

/* ============================================================
   DASHBOARD – Detalle por cuenta
   ============================================================ */

.detalle-cuenta-section { margin-bottom: 1rem; }

.detalle-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
}

.detalle-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  gap: 1rem;
}

.detalle-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.detalle-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a202c;
  white-space: nowrap;
}

.detalle-titular-sel {
  appearance: none;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.3rem 2rem 0.3rem 0.75rem;
  font-size: 0.82rem;
  color: #374151;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.75rem;
  max-width: 280px;
}

.detalle-titular-sel:focus {
  outline: none;
  border-color: #6366f1;
}

.detalle-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.detalle-movimientos {
  font-size: 0.78rem;
  color: #a0aec0;
}

.detalle-tipo-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6366f1;
}

.detalle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.detalle-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #a0aec0;
  padding: 0.5rem 1.5rem;
  border-top: 1px solid #f0f4f8;
  border-bottom: 1px solid #f0f4f8;
  background: #fafbfc;
}

.detalle-table td {
  padding: 0.65rem 1.5rem;
  border-bottom: 1px solid #f7fafc;
  color: #374151;
  vertical-align: middle;
}

.detalle-table tbody tr:last-child td { border-bottom: none; }

.detalle-td-banco {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.detalle-td-num    { color: #a0aec0; font-size: 0.8rem; }
.detalle-td-pagos  { text-align: center; color: #718096; }
.detalle-td-ingreso { text-align: right; font-weight: 600; }
.detalle-dash      { color: #cbd5e0; }

.moneda-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.moneda-pen { background: #ede9fe; color: #6d28d9; }
.moneda-usd { background: #ccfbf1; color: #0d9488; }

.detalle-td-pct { width: 160px; }

.detalle-prog-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detalle-prog-track {
  flex: 1;
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.detalle-prog-fill {
  height: 100%;
  background: #6366f1;
  border-radius: 999px;
}

.detalle-pct-val {
  font-size: 0.75rem;
  color: #a0aec0;
  white-space: nowrap;
  min-width: 2rem;
  text-align: right;
}

@media (max-width: 900px) {
  .stats-mini-row { grid-template-columns: 1fr; }
}

/* ============================================================
   DASHBOARD – Últimos movimientos
   ============================================================ */

.movs-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
}

.movs-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.1rem 1.5rem 0.75rem;
}

.movs-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 0.1rem;
}

.movs-subtitle {
  font-size: 0.78rem;
  color: #a0aec0;
  margin: 0;
}

.movs-link-validar {
  font-size: 0.82rem;
  font-weight: 600;
  color: #6366f1;
  text-decoration: none;
  white-space: nowrap;
  padding-top: 0.15rem;
}

.movs-link-validar:hover { color: #4f46e5; text-decoration: underline; }

/* Filters */
.movs-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.5rem 0.75rem;
  flex-wrap: wrap;
}

.movs-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.movs-search-icon {
  position: absolute;
  left: 0.55rem;
  color: #a0aec0;
  pointer-events: none;
}

.movs-search {
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.32rem 0.75rem 0.32rem 1.9rem;
  font-size: 0.82rem;
  color: #374151;
  height: 2rem;
  min-width: 160px;
  background: #fff;
}

.movs-search:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

.movs-filter-sel {
  appearance: none;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.32rem 1.8rem 0.32rem 0.7rem;
  font-size: 0.82rem;
  color: #374151;
  height: 2rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 0.75rem;
}

.movs-filter-sel:focus {
  outline: none;
  border-color: #6366f1;
}

/* Table */
.movs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.movs-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #a0aec0;
  padding: 0.5rem 1.5rem;
  border-top: 1px solid #f0f4f8;
  border-bottom: 1px solid #f0f4f8;
  background: #fafbfc;
}

.movs-table td {
  padding: 0.7rem 1.5rem;
  border-bottom: 1px solid #f7fafc;
  vertical-align: middle;
  color: #374151;
}

.movs-table tbody tr:last-child td { border-bottom: none; }

.movs-td-fecha {
  white-space: nowrap;
  color: #718096;
  font-size: 0.8rem;
  width: 48px;
}

.movs-td-cliente { min-width: 180px; }
.movs-client-name { font-weight: 600; color: #1a202c; font-size: 0.84rem; }
.movs-client-cot  { font-size: 0.74rem; color: #a0aec0; }

.movs-td-titular { color: #374151; font-size: 0.82rem; }

.movs-td-cuenta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-size: 0.82rem;
}

.movs-td-op {
  font-family: monospace;
  font-size: 0.78rem;
  color: #a0aec0;
  white-space: nowrap;
}

.movs-td-estado { white-space: nowrap; line-height: 1.5; }

.movs-ok   { color: #16a34a; font-size: 0.8rem; font-weight: 600; }
.movs-warn { color: #d97706; font-size: 0.8rem; font-weight: 600; }
.movs-fact { color: #6366f1; font-size: 0.74rem; }

.movs-td-monto {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  color: #1a202c;
}

.movs-empty {
  text-align: center;
  color: #a0aec0;
  padding: 1.5rem;
  font-size: 0.85rem;
}

/* ── Botones de acción en tabla de cotizaciones ── */
.td-acciones { white-space: nowrap; }

.btn-abono,
.btn-detalle {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #64748b;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
}
.btn-abono:hover  { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.btn-detalle:hover { background: #f0fdf4; color: #16a34a; border-color: #86efac; }

/* ── Modal de abonos ──────────────────────────── */
.abono-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.abono-modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 590px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

.abono-modal-hdr {
  color: #fff;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.abono-modal-hdr h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  flex: 1;
}
.abono-close-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  opacity: 0.85;
}
.abono-close-btn:hover { opacity: 1; }

.abono-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 0.5rem;
}

/* Grid 2 columnas, tipo Bootstrap row */
.ra-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
}
.ra-col6 { grid-column: span 1; }
.ra-col12 { grid-column: span 2; }
.ra-fila-bottom { align-self: start; padding-inline: 2px; }

.ra-label {
  display: block;
  font-size: 0.75rem;
  color: #6c757d;
  margin-bottom: 2px;
}

.ra-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #dee2e6;
  border-radius: 0;
  padding: 4px 0;
  font-size: 0.95rem;
  color: #222;
  outline: none;
  box-shadow: none;
}
.ra-input:focus { border-color: #681c1c; }

/* IGV badge */
.ra-igv-wrap { display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.igv-label-badge {
  color: #9B122E;
  border-bottom: 1px solid #AFAFAF;
  padding-bottom: 4px;
  letter-spacing: .5px;
  font-weight: 700;
  font-size: 0.85rem;
}

/* chips list (right) */
.ra-chips-list { display: flex; flex-direction: column; gap: 8px; }

/* comprobantes list (left) */
.ra-comp-list { display: flex; flex-direction: column; margin-top: 6px; }

/* Deuda box */
.ra-deuda-box {
  border-bottom: 1px solid #6A6A6A;
  padding: 6px 0 8px;
  text-align: center;
}
.ra-deuda-label { font-weight: 700; font-size: 0.88rem; }
.ra-deuda-valor { font-weight: 700; font-size: 0.95rem; }
.ra-sub-row { display: flex; justify-content: space-between; padding: 2px 4px; }
.ra-sub-center { justify-content: center; gap: 4px; }
.ra-sub-muted { font-size: 0.82rem; color: #6c757d; }

/* Saldo box */
.ra-saldo-box { border-radius: 4px; padding: 5px 8px; margin-top: 6px; font-size: 0.95rem; }
.ra-saldo-inner { display: flex; justify-content: center; align-items: center; gap: 4px; }
.reporte-saldo-cero  { background: #f0f0f0; }
.reporte-saldo-deuda { background: rgba(255, 0, 0, 0.2); }
.reporte-saldo-texto-cero  { color: #6c757d; }
.reporte-saldo-texto-deuda { color: #000; }
.fw-bold { font-weight: 700 !important; }

/* Chips de abono (derecha) */
.reporte-chip-abono {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.9rem;
  color: #333;
  cursor: pointer;
  transition: background 0.18s;
  border: 1px solid #AFAFAF;
}
.reporte-chip-abono:hover { background: #eee; }

.reporte-chip-abono-detalle {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0px 4px 4px 0px rgba(0,0,0,.25);
}
.reporte-chip-abono-row { display: flex; align-items: center; gap: 8px; }
.reporte-chip-abono-row .reporte-chip-abono-detalle { flex: 1; }

/* Comprobantes izquierda */
.reporte-comprobante-wrapper .reporte-chip-abono {
  background: transparent;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #AFAFAF;
}
.reporte-comprobante-wrapper .reporte-chip-abono:hover { background: transparent; }
.reporte-comprobante-wrapper .reporte-chip-abono--open {
  background: transparent;
  border-radius: 0;
  border-bottom-color: transparent;
}
.reporte-chip-abono--open {
  border-radius: 8px 8px 0 0;
  border-bottom-color: transparent;
  background: #eee;
}
.reporte-comprobante-preview-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.reporte-comprobante-preview-wrap.active { max-height: 320px; }
.reporte-comprobante-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 0 0 8px 8px;
  border: 1px solid #AFAFAF;
  border-top: none;
  display: block;
  cursor: zoom-in;
}

/* Verify badges */
.chip-verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 5px;
}
.chip-verify--approved { background: rgba(25,135,84,.12); color: #198754; }
.chip-verify--rejected { background: rgba(220,53,69,.12); color: #dc3545; }

@keyframes chip-permitted-blink {
  0%, 100% { background: #3B90FF; color: #fff; border-color: #3B90FF; }
  50%       { background: #f5f5f5; color: #333; border-color: #AFAFAF; }
}
.reporte-chip-abono--permitted {
  border-radius: 10px;
  box-shadow: 0 4px 4px 0 rgba(0,0,0,.25) !important;
  animation: chip-permitted-blink 1.8s ease-in-out infinite;
}

/* Footer */
.abono-modal-ftr {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.abono-cerrar-btn {
  border: 1.5px solid #adb5bd;
  background: transparent;
  color: #374151;
  padding: 0.5rem 3rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.abono-cerrar-btn:hover { background: #f8fafc; }
