:root {
  --navy: #0B2545;
  --blue-900: #13315C;
  --blue-700: #1F4E8C;
  --blue-500: #2F6DB5;
  --blue-300: #8DB6E3;
  --blue-100: #DCE9F7;
  --blue-50: #F0F5FB;
  --bg: #EEF3F9;
  --card: #fff;
  --ink: #0F2037;
  --muted: #5E7089;
  --line: #DAE4F0;
  --ok: #1E8E6B;
  --warn: #C47A12;
  --bad: #C0392B;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --sidebar-w: 290px;
  --shadow: 0 1px 2px rgba(11, 37, 69, .06), 0 8px 24px -12px rgba(11, 37, 69, .18);
}

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* ==========================================================================
   Barra Superior (Topbar)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 68px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  transition: margin-left .3s cubic-bezier(.2, .8, .2, 1), width .3s cubic-bezier(.2, .8, .2, 1);
}

.burger {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--blue-50);
  transition: background .2s;
}

.burger:hover {
  background: var(--blue-100);
}

.burger span,
.burger span::before,
.burger span::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--blue-900);
  position: relative;
  transition: transform .25s, background .25s;
}

.burger span::before,
.burger span::after {
  content: "";
  position: absolute;
  left: 0;
}

.burger span::before {
  top: -6px;
}

.burger span::after {
  top: 6px;
}

.brand img {
  height: 40px;
  display: block;
}

.crumb {
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb b {
  color: var(--blue-900);
  font-weight: 600;
}

.spacer {
  flex: 1;
}

.company {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--blue-50);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-700);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.company small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.company strong {
  font-size: 13px;
  line-height: 1.2;
}

/* ==========================================================================
   Menú Lateral (Drawer)
   ========================================================================== */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(11, 37, 69, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--navy), var(--blue-900));
  color: #fff;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 2px 0 16px rgba(11, 37, 69, .14);
}

body.open .drawer {
  transform: translateX(0);
}

body.open .burger span {
  background: transparent;
}

body.open .burger span::before {
  transform: translateY(6px) rotate(45deg);
  background: var(--blue-900);
}

body.open .burger span::after {
  transform: translateY(-6px) rotate(-45deg);
  background: var(--blue-900);
}

.drawer-head {
  padding: 18px 18px 14px;
}

.drawer-logo {
  background: #fff;
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-bottom: 14px;
}

.drawer-logo img {
  height: 34px;
  display: block;
}

.search {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font: inherit;
}

.search::placeholder {
  color: rgba(255, 255, 255, .6);
}

.tree {
  flex: 1;
  overflow: auto;
  padding: 4px 10px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
}

.tree ul {
  list-style: none;
  padding: 0;
}

.tree ul ul {
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, .14);
  display: none;
}

.tree li.exp>ul {
  display: block;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, .86);
  transition: background .15s;
}

.row:hover {
  background: rgba(255, 255, 255, .09);
  color: #fff;
}

.row.active {
  background: var(--blue-500);
  color: #fff;
  font-weight: 600;
}

.row .code {
  flex: none;
  min-width: 30px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-300);
  font-variant-numeric: tabular-nums;
}

.row.active .code {
  color: #fff;
}

.lvl1>.row {
  padding: 11px 10px;
  font-weight: 600;
  font-size: 14.5px;
  color: #fff;
}

.lvl1>.row .code,
.area-title .code {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 12px;
}

.lvl1>.row .code.ico,
.area-title .code.ico {
  font-size: 16px;
}

.cap {
  font-size: 12px;
  font-weight: 600;
  color: #91A5C2;
  padding: 14px 10px 6px;
}

.row .count {
  flex: none;
  font-size: 11px;
  color: rgba(255, 255, 255, .55);
}

.name small {
  display: block;
  font-size: 11px;
  color: var(--blue-300);
  margin-top: 1px;
}

.back {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  margin: 4px 0 6px;
  border-radius: var(--r-sm);
  color: var(--blue-300);
  font-weight: 600;
  font-size: 13px;
}

.back:hover {
  background: rgba(255, 255, 255, .09);
  color: #fff;
}

.area-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 15px;
}

.row .name {
  flex: 1;
  font-size: 13.5px;
}

.row .chev {
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s;
  opacity: .7;
}

li.exp>.row .chev {
  transform: rotate(45deg);
}

.empty-note {
  padding: 16px;
  color: rgba(255, 255, 255, .6);
  font-size: 13px;
  display: none;
}

/* ==========================================================================
   Contenido Principal (Main)
   ========================================================================== */
main {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  min-height: calc(100vh - 68px);
  transition: margin-left .3s cubic-bezier(.2, .8, .2, 1), width .3s cubic-bezier(.2, .8, .2, 1), max-width .3s cubic-bezier(.2, .8, .2, 1);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--navy);
}

.page-head p {
  color: var(--muted);
  margin-top: 2px;
}

.period {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--line);
}

.period button {
  padding: 6px 14px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.period button.on {
  background: var(--blue-700);
  color: #fff;
}

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.card .sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.kpi {
  position: relative;
  overflow: hidden;
}

.kpi .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.kpi .value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 4px 0 6px;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.kpi .delta {
  font-size: 12.5px;
  font-weight: 600;
}

.up {
  color: var(--ok);
}

.down {
  color: var(--bad);
}

.kpi.feature {
  background: linear-gradient(135deg, var(--blue-700), var(--navy));
  color: #fff;
}

.kpi.feature .label,
.kpi.feature .delta {
  color: #CFE0F5;
}

.kpi.feature .value {
  color: #fff;
}

.kpi svg {
  position: absolute;
  right: 14px;
  bottom: 14px;
  opacity: .9;
}

/* Shortcuts */
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin: 26px 0 12px;
}

.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.shortcut {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  padding: 16px;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid var(--line);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.shortcut:hover {
  border-color: var(--blue-500);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.shortcut .ic {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--blue-50);
  color: var(--blue-700);
  font-size: 19px;
}

.shortcut strong {
  font-size: 13.5px;
  line-height: 1.3;
}

.shortcut small {
  color: var(--muted);
  font-size: 12px;
}

/* Grillas, Gráficas y Tablas */
.grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.g-charts {
  grid-template-columns: 1.6fr 1fr 1fr;
}

.g-tables {
  grid-template-columns: 1.4fr 1fr;
}

.chart-box {
  position: relative;
  height: 250px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--blue-50);
  font-size: 13.5px;
}

tr:last-child td {
  border-bottom: 0;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.b-ok {
  background: #DDF3EA;
  color: var(--ok);
}

.b-warn {
  background: #FBEFD6;
  color: var(--warn);
}

.b-bad {
  background: #F9DEDA;
  color: var(--bad);
}

.link {
  color: var(--blue-500);
  font-weight: 600;
  font-size: 13px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Vista Genérica de Módulos (Placeholder para pantallas en construcción) */
.view-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  background: #fff;
  border-radius: var(--r-lg);
  border: 2px dashed var(--line);
  padding: 40px 24px;
  margin-top: 16px;
}

.view-placeholder .icon-box {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--blue-50);
  color: var(--blue-700);
  display: grid;
  place-items: center;
  font-size: 32px;
  margin-bottom: 18px;
}

.view-placeholder h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.view-placeholder p {
  color: var(--muted);
  max-width: 460px;
  font-size: 13.5px;
  line-height: 1.6;
}

/* ==========================================================================
   Comportamiento Responsive del Menú Lateral y Pantalla Principal
   ========================================================================== */
@media (min-width: 769px) {
  /* En escritorio, el scrim queda oculto para que la pantalla NO se tape */
  .scrim {
    display: none !important;
  }

  /* Al expandir el menú, el topbar y la pantalla se desplazan y se encogen */
  body.open .drawer {
    transform: translateX(0);
  }

  body.open .topbar {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
  }

  body.open main {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    max-width: calc(100% - var(--sidebar-w));
  }
}

@media (max-width: 768px) {
  .drawer {
    width: min(320px, 86vw);
  }
  body.open .drawer {
    transform: translateX(0);
  }
  body.open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Responsive */
@media(max-width: 1100px) {
  .g-charts,
  .g-tables {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 640px) {
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .crumb,
  .company div {
    display: none;
  }

  .company {
    padding: 4px;
  }

  main {
    padding: 20px 14px 40px;
  }

  h1 {
    font-size: 22px;
  }
}

@media(prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ==========================================================================
   Botones y Elementos de Acción
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--r-md);
  padding: 9px 18px;
  transition: all .2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue-700);
  color: #fff;
  border: 1px solid var(--blue-700);
}

.btn-primary:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px rgba(11, 37, 69, .15);
}

.btn-secondary {
  background: var(--blue-50);
  color: var(--blue-900);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: var(--blue-100);
  color: var(--navy);
}

.btn-outline {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-outline:hover {
  border-color: var(--blue-500);
  color: var(--blue-700);
  background: var(--blue-50);
}

.btn-danger {
  background: #FDF2F2;
  color: var(--bad);
  border: 1px solid #F9DEDA;
}

.btn-danger:hover {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--r-sm);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--r-sm);
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  transition: all .15s ease;
}

.btn-icon:hover {
  color: var(--blue-700);
  border-color: var(--blue-500);
  background: var(--blue-50);
}

/* ==========================================================================
   Formularios y Controles Modernos
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .req {
  color: var(--bad);
  font-weight: 700;
  margin-left: 3px;
}

.form-control,
.form-select {
  width: 100%;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}

.form-control::placeholder {
  color: #A0B2C6;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, .14);
}

textarea.form-control {
  resize: vertical;
  min-height: 72px;
}

.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border: 1px solid var(--line);
  border-left: 0;
  padding: 0 14px;
  background: var(--blue-50);
  color: var(--blue-700);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s;
}

.input-group-btn:hover {
  background: var(--blue-100);
  color: var(--navy);
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.form-check-input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue-700);
  cursor: pointer;
  margin: 0;
}

/* ==========================================================================
   Tabs / Pestañas de Detalle
   ========================================================================== */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--line);
  margin: 20px 0 18px;
}

.tab-btn {
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--blue-700);
}

.tab-btn.active {
  color: var(--blue-700);
  border-bottom-color: var(--blue-700);
  font-weight: 700;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Sub-tarjetas y Secciones Internas del Formulario
   ========================================================================== */
.subcard {
  background: var(--blue-50);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  margin-top: 16px;
}

.subcard-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subcard-title i {
  color: var(--blue-700);
  font-size: 16px;
}

/* ==========================================================================
   Listado de Clientes y Tabla
   ========================================================================== */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 7px 14px;
  width: min(380px, 100%);
  transition: border-color .15s;
}

.search-box:focus-within {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, .12);
}

.search-box input {
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 13.5px;
  width: 100%;
  color: var(--ink);
}

.search-box i {
  color: var(--muted);
  font-size: 15px;
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--blue-700);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}

.client-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-info strong {
  display: block;
  font-size: 13.5px;
  color: var(--navy);
}

.client-info small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

@media(max-width: 900px) {
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media(max-width: 600px) {
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr;
  }
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ==========================================================================
   Filtros por Columna en Tablas
   ========================================================================== */
.table-filter-row th {
  padding: 6px 8px;
  background: var(--blue-50);
  border-bottom: 2px solid var(--line);
}

.table-filter-row input,
.table-filter-row select {
  width: 100%;
  padding: 5px 8px;
  font-size: 11.5px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}

.table-filter-row input:focus,
.table-filter-row select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(47, 109, 181, .15);
}

/* ==========================================================================
   Facturación y Emisión de Comprobantes DTE
   ========================================================================== */
.dte-status-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--blue-50);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.dte-meta-badges {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
}

.dte-meta-badges strong {
  color: var(--navy);
}

.item-entry-card {
  background: linear-gradient(135deg, var(--navy), var(--blue-900));
  border-radius: var(--r-md);
  padding: 16px;
  color: #fff;
  margin-bottom: 16px;
}

.item-entry-card .form-label {
  color: #CFE0F5;
  font-size: 12px;
}

.item-entry-card .form-control,
.item-entry-card .form-select {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
}

.item-entry-card .form-control::placeholder {
  color: rgba(255, 255, 255, .5);
}

.item-entry-card .form-control:focus,
.item-entry-card .form-select:focus {
  background: #fff;
  color: var(--ink);
  border-color: var(--blue-300);
}

.invoice-totals-box {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 1px dashed var(--line);
}

.total-row strong {
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.total-row.grand-total {
  font-size: 19px;
  font-weight: 800;
  color: var(--navy);
  border-bottom: 0;
  padding-top: 12px;
  margin-top: 6px;
  border-top: 2px solid var(--blue-500);
}

.total-row.grand-total strong {
  font-size: 24px;
  color: var(--blue-700);
}

/* ==========================================================================
   Modales del Sistema y Diálogos DTE
   ========================================================================== */
.az-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all .2s ease;
}

.az-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.az-modal {
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.3);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.az-modal-backdrop.open .az-modal {
  transform: translateY(0) scale(1);
}

.az-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.az-modal-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.az-modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}

.az-modal-close:hover {
  background: var(--line);
  color: var(--navy);
}

.az-modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13.5px;
}

.az-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-doc-summary {
  background: var(--blue-50);
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  font-size: 12.5px;
}

.modal-doc-summary small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.modal-doc-summary strong {
  color: var(--navy);
  font-size: 13.5px;
}

/* ==========================================================================
   Dashboard Ejecutivo de Reportes (Módulo 4.5) - Tarjetas Visuales
   ========================================================================== */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
  margin-top: 14px;
}

.report-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: all .2s ease;
  position: relative;
}

.report-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue-500);
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.12);
}

.report-card-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.report-card-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  line-height: 1.3;
}

.report-card-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 22px 0;
  flex-grow: 1;
}

.report-card-bullets li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.report-card-bullets li::before {
  content: "•";
  position: absolute;
  left: 3px;
  top: -1px;
  color: var(--blue-500);
  font-size: 18px;
}

.report-card-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.report-card-footer .btn {
  padding: 7px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-sm);
}

/* ==========================================================================
   Módulo de Notas de Abono (Ventas › Clientes › 4.3)
   ========================================================================== */
.abono-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.abono-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.abono-filter-client {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.abono-filter-client label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.abono-client-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  width: min(320px, 100%);
  transition: all .15s ease;
}

.abono-client-input:focus-within {
  background: #fff;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, 0.12);
}

.abono-client-input input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  width: 100%;
  color: var(--ink);
}

.period-selector-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  flex-wrap: wrap;
}

.period-year-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.period-year-select {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
  outline: none;
  cursor: pointer;
}

.period-months-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  flex-wrap: wrap;
  overflow-x: auto;
}

.month-pill-btn {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.month-pill-btn:hover {
  background: var(--blue-50);
  color: var(--blue-700);
}

.month-pill-btn.active {
  background: var(--blue-700);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(47, 109, 181, 0.25);
}

/* ==========================================================================
   Formulario Modal: Aplicación de Abonos a Clientes
   ========================================================================== */
.abono-form-header-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.abono-form-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.abono-form-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.abono-form-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.abono-form-field label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

.abono-balance-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: flex-end;
  background: var(--bg);
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}

.abono-balance-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.abono-balance-item label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.abono-balance-item input {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--navy);
  background: #fff;
}

.abono-docs-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
}

.abono-docs-table-wrap table {
  margin: 0;
  width: 100%;
}

/* ==========================================================================
   Reporte Cuentas por Cobrar y Antigüedad de Saldos (Incrustado)
   ========================================================================== */
.reporte-cxc-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 18px;
  margin-bottom: 18px;
}

.reporte-filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.reporte-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.reporte-header-doc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.reporte-group-header td {
  background: #f1f5f9;
  font-weight: 700;
  color: var(--navy);
  padding: 8px 10px !important;
}

.reporte-subtotal-row td {
  background: #f8fafc;
  font-weight: 700;
  border-bottom: 2px solid var(--line);
  padding: 8px 10px !important;
}

.reporte-grand-total td {
  background: #e2e8f0;
  font-weight: 800;
  font-size: 13.5px;
  padding: 10px !important;
}





