@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Instrument+Sans:wght@400;500;600&display=swap');

:root {
  --navy: #0F2038;
  --navy-2: #162C4A;
  --blue: #F5A53A;
  --cyan: #F5A53A;
  --cyan-soft: #FDE6C0;
  --bg: #FFFFFF;
  --white: #FFFFFF;
  --border: #E6E8EE;
  --text: #0F2038;
  --text-secondary: #4A5A78;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --font-heading: 'Bricolage Grotesque', system-ui, sans-serif;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;

  --sidebar-width: 232px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--navy);
  letter-spacing: -0.02em;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.sidebar-header {
  display: block;
  margin-bottom: 20px;
}

.sidebar-logo {
  display: block;
  line-height: 0;
}

.sidebar-logo img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}

.sidebar-subtitle {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #6E85A6;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 -4px;
  padding: 0 4px;
}

.nav-section-title {
  margin: 16px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #5C7396;
  text-transform: uppercase;
}

.nav-section-title:first-child {
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: #C4CDDB;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
}

.nav-item .icon {
  flex: none;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.nav-item.active {
  background: var(--blue);
  color: var(--navy);
  border-left-color: transparent;
}

.nav-item.is-mock {
  cursor: default;
}

/* Sidebar footer: plan card + copyright */
.sidebar-footer {
  flex: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.plan-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
}

.plan-card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #6E85A6;
  text-transform: uppercase;
}

.plan-card-title {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.plan-card-expiry {
  margin-top: 2px;
  font-size: 12px;
  color: #8598B5;
}

.plan-progress-track {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.plan-progress-fill {
  height: 100%;
  width: 62%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.plan-card-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(245, 165, 58, 0.4);
  background: transparent;
  color: var(--cyan);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.plan-card-btn:hover {
  background: rgba(245, 165, 58, 0.14);
}

.sidebar-copyright {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  color: #5C7396;
}

/* Main content area */
.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg);
}

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main { margin-left: 0; min-width: 0; }
  .page-content { padding: 24px 20px; }
}

/* Standalone pages (no sidebar): registro, login, etc. */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--navy);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(15, 32, 56, 0.18);
  padding: 36px 32px;
}

.auth-logo {
  display: block;
  max-width: 220px;
  height: auto;
  margin: 0 auto 24px;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  margin: 0 0 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: #8598B5;
  text-align: center;
  margin: 0 0 28px;
}

.form-field {
  margin-bottom: 18px;
}

.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #C4CDDB;
  margin-bottom: 6px;
}

.form-field input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}

.form-field input.is-invalid {
  border-color: #E24C4C;
}

.form-field .field-error {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: #E24C4C;
}

.form-field.has-error .field-error {
  display: block;
}

.auth-submit {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: var(--navy);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.auth-submit:hover {
  background: #E8941F;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.form-message {
  display: none;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.form-message.is-visible {
  display: block;
}

.form-message.is-error {
  background: #FDECEC;
  color: #B42318;
}

.form-message.is-info {
  background: var(--cyan-soft);
  color: #8A5A0A;
}

/* Confirmation screen: bank transfer details */
.confirm-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-icon svg {
  width: 26px;
  height: 26px;
  stroke: var(--success);
  stroke-width: 2;
  fill: none;
}

.bank-list {
  margin: 20px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.bank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

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

.bank-row-text {
  min-width: 0;
}

.bank-row-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.bank-row-value {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.copy-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  background: var(--cyan-soft);
  border-color: var(--cyan);
  color: var(--cyan);
}

.copy-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.copy-btn.is-copied {
  background: var(--cyan-soft);
  border-color: var(--cyan);
  color: var(--cyan);
}

.confirm-note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--cyan-soft);
  color: #8A5A0A;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* Pages with sidebar + content: clientes.html, etc. */
.page-content {
  padding: 32px 40px;
  max-width: 1080px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.035em;
  line-height: 1.06;
  margin: 0 0 8px;
}

.page-subtitle {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  appearance: none;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 4px;
  margin-right: 24px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.is-active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: #8A5A0A;
  font-size: 12px;
  font-weight: 600;
}

.table-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(15, 32, 56, 0.08);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 12px 16px;
  background: #FFFBF4;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

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

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

.cell-muted {
  color: var(--text-secondary);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pendiente {
  background: #EEF0F4;
  color: #51607A;
}

.badge-activo {
  background: rgba(16, 185, 129, 0.12);
  color: #067A5C;
}

.badge-moroso {
  background: rgba(239, 68, 68, 0.12);
  color: #B42318;
}

.badge-desactivado {
  background: rgba(102, 112, 133, 0.12);
  color: var(--text-secondary);
}

.btn-activar {
  appearance: none;
  border: none;
  border-radius: 7px;
  background: var(--blue);
  color: var(--navy);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-activar:hover {
  background: #E8941F;
}

.btn-activar:disabled {
  opacity: 0.6;
  cursor: default;
}

.cell-actions {
  display: flex;
  gap: 8px;
}

.btn-eliminar {
  appearance: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 7px;
  background: var(--white);
  color: var(--danger);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-eliminar:hover {
  background: rgba(239, 68, 68, 0.08);
}

.btn-eliminar:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-eliminar-cruz {
  padding: 5px 10px;
  font-size: 15px;
  line-height: 1;
}

.btn-desactivar {
  appearance: none;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 7px;
  background: var(--white);
  color: #B45309;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-desactivar:hover {
  background: rgba(245, 158, 11, 0.08);
}

.btn-desactivar:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-copiar-link {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-copiar-link:hover {
  background: var(--bg);
}

.btn-copiar-link.is-copied {
  background: var(--cyan-soft);
  border-color: var(--cyan);
  color: #8A5A0A;
}

.table-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.table-state.is-error {
  color: #B42318;
}

/* Portal del cliente (standalone, sin sidebar): portal_cliente.html */
.portal-page {
  min-height: 100vh;
  background: var(--bg);
}

.portal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 40px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.portal-header img {
  height: 28px;
  width: auto;
}

.portal-header-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.portal-header-text strong {
  color: var(--text);
}

.portal-body {
  padding: 32px 40px;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.info-card h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.info-card .desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.cupo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cupo-texto {
  font-size: 13px;
  color: var(--text-secondary);
}

.cupo-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cupo-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.btn-secundario {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-secundario:hover {
  background: var(--bg);
}

.btn-secundario:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Overlay "reposo por inactividad" (PARTE B, 2026-09-11) — portal cliente:
   a los 30 min sin click/tecla/touch/scroll del cliente, se atenúa el
   contenido de fondo (blur+opacity, sigue visible) y se corta el
   fetch/polling propio de la página hasta que el cliente aprieta
   "Reactivar facturador". Compartido por portal_cliente.html,
   dashboard_cliente.html, registro_ventas.html y conexion_sii_cliente.html
   (mismo sidebar/main en las 4). */
.overlay-reposo {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.overlay-reposo.activo {
  display: flex;
}
.overlay-reposo .reposo-card {
  background: var(--white);
  border-radius: 12px;
  padding: 36px 32px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(16, 37, 74, 0.18);
  text-align: center;
}
.overlay-reposo .reposo-icono {
  display: block;
  margin: 0 auto 18px;
}
.overlay-reposo .reposo-texto {
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 22px;
  line-height: 1.4;
}
.overlay-reposo .reposo-boton {
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  background: var(--blue);
  cursor: pointer;
  font-family: inherit;
}
.overlay-reposo .reposo-boton:hover {
  filter: brightness(0.95);
}
body.en-reposo .sidebar,
body.en-reposo .main {
  filter: blur(4px);
  opacity: 0.5;
  pointer-events: none;
  transition: filter 0.25s ease, opacity 0.25s ease;
}
