:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e6eaf0;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --accent-soft: #ccfbf1;
  --danger: #e11d48;
  --danger-soft: #ffe4e6;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --ok: #059669;
  --ok-soft: #d1fae5;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --sidebar: #0b1220;
  --sidebar-2: #111827;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  font-family: var(--font);
}
body.app-body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #0d9488; }
img { max-width: 100%; }

.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
  width: 268px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  flex-shrink: 0;
}
.app-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 16px 18px 20px;
  flex-shrink: 0;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  padding: 0;
  color: #fff;
}
.app-sidebar-close {
  display: none;
  margin-left: auto;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.app-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff;
  font-size: 16px;
}
.app-brand strong { display: block; font-size: 15px; letter-spacing: -.02em; }
.app-brand small { color: #94a3b8; font-size: 11px; }

.app-user {
  margin: 0 16px 16px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.app-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #1e293b;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #99f6e4;
}
.app-user span { display: block; font-size: 13px; color: #fff; }
.app-user small { color: #94a3b8; font-size: 11px; }

.app-nav {
  padding: 6px 12px 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.app-nav-label {
  color: #64748b;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 12px 12px 8px;
}
.app-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 4px;
}
.app-nav a i { width: 18px; text-align: center; color: #94a3b8; }
.app-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-nav a.active { background: rgba(20, 184, 166, .16); color: #99f6e4; }
.app-nav a.active i { color: #2dd4bf; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(243,245,248,.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid transparent;
}
.app-topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.app-topbar p { margin: 0; color: var(--muted); font-size: 13px; }
.app-top-actions { display: flex; gap: 10px; align-items: center; }
.app-icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  line-height: 1;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
}
.app-icon-btn i {
  display: block;
  line-height: 1;
  font-size: 16px;
  width: 16px;
  text-align: center;
}
.app-content { padding: 8px 28px 32px; }
.app-footer {
  padding: 0 28px 22px;
  color: var(--muted);
  font-size: 12px;
}
.app-footer .app-version {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  opacity: .75;
  letter-spacing: .02em;
}

.card, .box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header, .box-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.card-title, .box-title, h2.box-title, h3.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.card-body, .box-body { padding: 20px; }
.card-tools { margin-left: auto; }
.card-body.p-0, .p-0 { padding: 0; }

.form-group { margin-bottom: 14px; }
.form-group label, label { display: block; margin-bottom: 6px; font-size: 13px; color: #334155; font-weight: 600; }
.form-control, select.form-control, textarea.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="file"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  outline: none;
}
.form-control:focus, select:focus, input:focus, textarea:focus {
  border-color: #5eead4;
  box-shadow: 0 0 0 4px rgba(20,184,166,.15);
}
.form-control-sm { padding: 6px 8px; border-radius: 8px; font-size: 13px; }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  line-height: 1.2;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #1e293b; color: #fff; }
.btn-success { background: var(--accent); color: #fff; }
.btn-info { background: var(--info-soft); color: #0369a1; }
.btn-warning { background: var(--warn-soft); color: #92400e; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-default, .btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn-xs { padding: 4px 7px; font-size: 12px; }
.btn-outline-light { background: transparent; color: inherit; border: 1px solid currentColor; }

/* Botones de acción en pantallas de reportes (mismo tamaño en todos) */
.reporte-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.reporte-acciones > .btn,
.reporte-acciones > a.btn {
  width: auto;
  flex: 0 0 auto;
  align-self: center;
  min-height: 40px;
  box-sizing: border-box;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table thead th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: #f8fafc; }
.table-hover tbody tr:hover, .table-striped tbody tr:nth-child(odd) { background: #f8fafc; }
.table-bordered { border: 0; }
.table a .fa-edit, .table a .fa-trash, .table a i { font-size: 15px; }
.table a { color: var(--ink); margin-right: 8px; }
.table a.btn { margin-right: 6px; }
.table a.btn-info { color: #0369a1; }
.table a.btn-danger { color: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-success { background: var(--ok-soft); color: var(--ok); }
.badge-warning { background: var(--warn-soft); color: #92400e; }
.badge-info { background: var(--info-soft); color: var(--info); }

.alert { padding: 12px 14px; border-radius: 12px; margin: 12px 0 0; }
.alert-info { background: var(--info-soft); color: #075985; }
.alert-danger { background: var(--danger-soft); color: #9f1239; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--ok); }
.text-danger { color: var(--danger); }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.mr-2 { margin-right: 8px; }

.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.row > [class*="col-"] { padding: 0 10px; min-width: 0; }
.col-12, .col-xs-12, .col-sm-12, .col-md-12 { width: 100%; }
.col-6 { width: 50%; }
.col-md-2 { width: 16.666%; }
.col-md-3 { width: 25%; }
.col-md-4 { width: 33.333%; }
.col-md-5 { width: 41.666%; }
.col-md-6 { width: 50%; }
.col-md-8 { width: 66.666%; }
.col-lg-3 { width: 25%; }
.col-sm-4, .col-sm-6 { width: 50%; }
@media (max-width: 960px) {
  .app-sidebar {
    position: fixed;
    left: -280px;
    z-index: 50;
    transition: left .2s ease;
    width: min(280px, 88vw);
  }
  body.sidebar-open .app-sidebar { left: 0; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .app-main { overflow: hidden; }
  .app-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 45;
  }
  body.sidebar-open .app-sidebar-backdrop { display: block; }
  .app-sidebar-close { display: inline-flex; }
  .col-6, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-8, .col-md-12, .col-lg-3, .col-sm-4, .col-sm-6 { width: 100%; }
}

.small-box {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  min-height: 132px;
}
.small-box .inner h3 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.04em; }
.small-box .inner p { margin: 0; color: var(--muted); }
.small-box .icon { position: absolute; right: 16px; top: 16px; font-size: 22px; opacity: .9; }
.small-box-footer {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.small-box.bg-info, .small-box.bg-warning, .small-box.bg-success, .small-box.bg-primary {
  background: #fff;
  color: var(--ink);
}
.small-box.bg-info .icon { color: var(--info); }
.small-box.bg-warning .icon { color: var(--warn); }
.small-box.bg-success .icon { color: var(--ok); }
.small-box.bg-primary .icon { color: var(--accent); }

.modal { display: none; position: fixed; inset: 0; z-index: 1050; overflow: auto; }
.modal.show, .modal.in { display: block; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1040; }
.modal-dialog { width: calc(100% - 32px); max-width: 520px; margin: 8vh auto; }
.modal-dialog.modal-lg { max-width: 760px; }
.modal-content {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(15, 23, 42, .2);
}
.modal-header, .modal-body, .modal-footer { padding: 16px 20px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-title { margin: 0; font-size: 18px; }
.modal-footer { border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.close { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-content.bg-success { background: #fff; }
.modal-content.bg-success .modal-header { background: var(--ok-soft); color: var(--ok); }
.modal-content.bg-danger { background: #fff; }
.modal-content.bg-danger .modal-header { background: var(--danger-soft); color: var(--danger); }

.dataTables_wrapper { overflow: auto; }
.dataTables_length, .dataTables_filter, .dataTables_info, .dataTables_paginate {
  padding: 12px 4px;
  color: var(--muted);
  font-size: 13px;
}
.card-body > .dataTables_wrapper {
  margin: 0;
}
.card-body > .dataTables_wrapper .dataTables_length,
.card-body > .dataTables_wrapper .dataTables_filter,
.card-body > .dataTables_wrapper .dataTables_info,
.card-body > .dataTables_wrapper .dataTables_paginate {
  padding-left: 0;
  padding-right: 0;
}
.dataTables_filter input, .dataTables_length select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
}
.dataTables_paginate .paginate_button {
  padding: 6px 10px;
  margin: 0 2px;
  border-radius: 8px;
  cursor: pointer;
}
.dataTables_paginate .paginate_button.current { background: var(--ink); color: #fff !important; }

.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding-top: 6px;
}
.ui-datepicker { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 400px at 10% 10%, rgba(20,184,166,.25), transparent 50%),
    radial-gradient(700px 400px at 90% 90%, rgba(15,23,42,.18), transparent 45%),
    #0b1220;
  font-family: var(--font);
}
.login-shell {
  width: min(920px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
.login-aside {
  background: linear-gradient(160deg, #0f766e 0%, #0b1220 80%);
  color: #fff;
  padding: 40px 36px;
}
.login-aside h2 { margin: 28px 0 10px; font-size: 30px; letter-spacing: -.04em; }
.login-aside p { color: #ccfbf1; margin: 0; }
.login-powered {
  display: inline-block;
  margin-top: 20px;
  color: #99f6e4;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.login-form { padding: 40px 36px; }
.login-form h1 { margin: 0 0 8px; font-size: 26px; }
.login-form .hint { color: var(--muted); margin-bottom: 24px; }
.login-alert {
  background: var(--danger-soft);
  color: #9f1239;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 16px;
}
.login-pass { position: relative; }
.login-pass .form-control { padding-right: 46px; }
.login-pass-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
@media (max-width: 800px) {
  .login-page {
    display: block;
    padding: 0;
    background: #0b1220;
  }
  .login-shell {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    grid-template-columns: 1fr;
    box-shadow: none;
    align-content: start;
  }
  .login-aside {
    display: block;
    padding: calc(20px + env(safe-area-inset-top)) 24px 22px;
  }
  .login-aside h2 {
    font-size: 22px;
    margin: 14px 0 8px;
    line-height: 1.25;
  }
  .login-aside p { font-size: 14px; line-height: 1.45; }
  .login-powered { margin-top: 14px; }
  .login-form {
    padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  }
  .login-form h1 { font-size: 22px; }
  .login-form .hint { font-size: 14px; margin-bottom: 18px; }
  .login-form .form-control {
    font-size: 16px;
    min-height: 48px;
    padding: 12px 14px;
  }
  .login-pass .form-control { padding-right: 48px; }
  .login-form .btn-block {
    min-height: 48px;
    font-size: 16px;
    margin-top: 6px;
  }
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 960px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.kpi-card .k { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-card .v { font-size: 28px; font-weight: 800; letter-spacing: -.04em; margin: 8px 0; }
.kpi-card a { font-size: 13px; font-weight: 700; }
.section-title { margin: 0 0 16px; font-size: 18px; }
.menu-toggle { display: none; }
@media (max-width: 960px) { .menu-toggle { display: inline-flex; } }

.carga-paso {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: #fff;
}
.carga-paso h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.carga-paso .paso-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  margin-right: 8px;
}
.carga-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .carga-opciones { grid-template-columns: 1fr; } }
.carga-opcion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.carga-opcion:hover {
  border-color: #99f6e4;
}
.carga-opcion:has(input:checked) {
  border-color: #059669;
  background: rgba(236, 253, 245, .3);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .18), 0 8px 20px rgba(15, 23, 42, .06);
}
.carga-opcion input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0 0 12px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  box-shadow: none;
  outline: none;
}
.carga-opcion input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .2);
}
.carga-opcion input[type="radio"]:checked {
  border-color: #059669;
  background: #059669;
  box-shadow: inset 0 0 0 4px #fff;
}
.carga-opcion-icono {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #0f766e;
  font-size: 22px;
  margin-bottom: 12px;
}
.carga-opcion:has(input:checked) .carga-opcion-icono {
  background: #d1fae5;
  color: #047857;
}
.carga-opcion strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -.02em;
}
.carga-opcion-desc {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.carga-ayuda { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.carga-subpaso {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  margin-top: 14px;
}
.carga-subpaso h4 { margin: 0 0 6px; font-size: 14px; }

.overlay-carga {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11, 18, 32, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.overlay-carga.is-visible,
.overlay-carga:not([hidden]) {
  display: flex;
}
.overlay-carga[hidden] { display: none !important; }
body.overlay-carga-activo { overflow: hidden; }
.overlay-carga-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
}
.overlay-carga-spin {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 26px;
  animation: overlay-pulse 1.2s ease-in-out infinite;
}
.overlay-carga-card strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.overlay-carga-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
@keyframes overlay-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: .85; }
}
.qr-cam-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
#btn_flash.is-on {
  background: #f59e0b;
  border-color: #d97706;
  color: #111;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, .35);
}

.tabla-renglones-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabla-renglones { table-layout: fixed; }
.tabla-renglones .renglon-articulo,
.tabla-tarjetas .renglon-articulo,
#lbl_articulo {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.tabla-renglones .renglon-cats small { display: block; color: var(--muted); margin-top: 4px; }
.pdf-visor {
  width: 100%;
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.asig-form-grid {
  display: grid;
  grid-template-columns: 1.4fr .6fr .8fr auto;
  gap: 12px;
  align-items: end;
}
.asig-form-add { padding-bottom: 2px; }

@media (max-width: 960px) {
  .app-content { padding: 8px 14px 28px; }
  .app-topbar { padding: 10px 14px; height: auto; min-height: 72px; }
  .app-topbar h1 { font-size: 18px; }
  .app-footer { padding: 0 14px 22px; }
  .card-header { flex-wrap: wrap; }
  .pdf-visor { height: 280px; }

  .tabla-renglones thead,
  .tabla-tarjetas thead,
  .tabla-asig thead { display: none; }
  .tabla-renglones,
  .tabla-renglones tbody,
  .tabla-tarjetas,
  .tabla-tarjetas tbody,
  .tabla-asig,
  .tabla-asig tbody { display: block; width: 100%; }
  .tabla-renglones,
  .tabla-tarjetas { table-layout: auto; }
  .tabla-renglones tr,
  .tabla-tarjetas tr,
  .tabla-asig tr {
    display: block;
    margin: 12px 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
  }
  .tabla-tarjetas tbody tr,
  .tabla-tarjetas.table-striped tbody tr:nth-child(odd),
  .tabla-tarjetas.table-hover tbody tr:hover { background: #fff; }
  .tabla-renglones td,
  .tabla-tarjetas td,
  .tabla-asig td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border: 0;
    padding: 8px 0;
    width: 100% !important;
  }
  .tabla-renglones td::before,
  .tabla-tarjetas td::before,
  .tabla-asig td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    flex: 0 0 38%;
  }
  .tabla-renglones td.renglon-articulo,
  .tabla-tarjetas td.renglon-articulo {
    display: block;
    font-weight: 700;
    font-size: 15px;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px dashed var(--line);
  }
  .tabla-renglones td.renglon-articulo::before,
  .tabla-tarjetas td.renglon-articulo::before,
  .tabla-renglones td.renglon-accion::before,
  .tabla-tarjetas td.renglon-accion::before,
  .tabla-asig td.renglon-accion::before { display: none; content: none; }
  .tabla-renglones td.renglon-accion,
  .tabla-tarjetas td.renglon-accion,
  .tabla-asig td.renglon-accion {
    display: flex;
    gap: 8px;
    padding-top: 12px;
  }
  .tabla-renglones td.renglon-accion .btn,
  .tabla-tarjetas td.renglon-accion .btn,
  .tabla-asig td.renglon-accion .btn { flex: 1; width: auto; }
  .tabla-renglones td.renglon-cats { align-items: flex-start; }
  .tabla-renglones td.renglon-cats small { text-align: right; }
  .tabla-tarjetas tr.fila-vacia td {
    display: block;
    text-align: center;
    color: var(--muted);
  }
  .tabla-tarjetas tr.fila-vacia td::before { display: none; content: none; }
  .dataTables_wrapper:has(.tabla-tarjetas) { overflow: visible; }
  .dataTables_wrapper:has(.tabla-tarjetas) .dataTables_filter,
  .dataTables_wrapper:has(.tabla-tarjetas) .dataTables_length {
    float: none;
    text-align: left;
    padding-left: 0;
    padding-right: 0;
  }
  .dataTables_wrapper:has(.tabla-tarjetas) .dataTables_filter input {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-top: 6px;
  }

  .asig-form-grid { grid-template-columns: 1fr 1fr; }
  .asig-form-grid > :first-child { grid-column: 1 / -1; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .btn { flex: 1 1 auto; }
}

/* Guía de uso */
.guia {
  max-width: 760px;
}
.guia-intro {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.guia-toc {
  margin-bottom: 28px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}
.guia-toc strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.guia-toc ol {
  margin: 0;
  padding-left: 1.2rem;
}
.guia-toc li { margin: 4px 0; }
.guia-toc a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.guia-toc a:hover { color: var(--accent); }
.guia-seccion {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 88px;
}
.guia-seccion:last-of-type { border-bottom: 0; }
.guia-seccion h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  letter-spacing: -.02em;
}
.guia-seccion p,
.guia-seccion li {
  color: var(--ink);
  line-height: 1.55;
}
.guia-seccion > p { margin: 0 0 10px; color: var(--muted); }
.guia-seccion ul { margin: 0 0 8px; padding-left: 1.2rem; }
.guia-pasos {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.guia-pasos > li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.guia-paso-num {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 184, 166, .14);
  color: #0f766e;
  font-weight: 800;
  font-size: 13px;
}
.guia-pasos strong { display: block; margin-bottom: 2px; }
.guia-pasos p { margin: 0; color: var(--muted); font-size: 14px; }
.guia-avisos {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.guia-avisos li {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #f8fafc;
  border-radius: 0 10px 10px 0;
}
.guia-avisos strong { display: block; margin-bottom: 4px; }
.guia-cierre {
  margin-top: 8px;
  padding-top: 8px;
}
.guia-cierre > p {
  margin: 0 0 10px;
  font-weight: 700;
}
.guia-ref-cuentas {
  margin-top: 16px;
  display: grid;
  gap: 18px;
}
.guia-ref-cuenta {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}
.guia-ref-cuenta h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  color: var(--ink);
}
.guia-ref-desc {
  margin: 0 0 10px !important;
  font-size: 14px;
  color: var(--muted) !important;
}
.guia-ref-subcuentas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.guia-ref-subcuentas li {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}
.guia-ref-subcuentas strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}
.guia-ref-subcuentas span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
@media (max-width: 768px) {
  .guia { max-width: none; }
}

/* Recorrido interactivo */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(15, 23, 42, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.tour-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.tour-highlight {
  position: relative !important;
  z-index: 9991 !important;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, .95), 0 0 0 9999px rgba(15, 23, 42, .5) !important;
  border-radius: 10px;
  pointer-events: none;
}
.app-sidebar .tour-highlight,
.app-nav a.tour-highlight {
  background: rgba(20, 184, 166, .22) !important;
  color: #fff !important;
}
.tour-popover {
  position: fixed;
  z-index: 9992;
  width: min(360px, calc(100vw - 24px));
  padding: 16px 16px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}
.tour-popover.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.tour-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.tour-progress {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
}
.tour-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}
.tour-popover h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
.tour-popover p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.tour-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
body.tour-activo {
  overflow: hidden;
}
body.tour-activo .app-sidebar {
  z-index: 9991;
}

/* Buzón de sugerencias: solo formulario; consulta vía base de datos */
