:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef5f1;
  --text: #1d2733;
  --muted: #6d7885;
  --line: #dbe3ea;
  --primary: #0f8a7a;
  --primary-2: #0b6b60;
  --danger: #c94747;
  --shadow: 0 18px 45px rgba(25, 39, 52, 0.12);
}

/* V26 · navegación lateral y edición clara */
.mobile-topbar {
  display: none;
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.app-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
  background: #f3f7f9;
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 18px 14px 14px;
  overflow: auto;
  color: #eaf8ff;
  background: linear-gradient(180deg, #0d4b70 0%, #07344f 100%);
  box-shadow: 10px 0 34px rgba(16, 54, 75, 0.12);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 18px;
}

.sidebar-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(0,0,0,.18));
}

.sidebar-brand > div {
  display: grid;
  gap: 0;
}

.sidebar-brand b {
  color: #35c4ff;
  font-size: 1.3rem;
  letter-spacing: .12em;
}

.sidebar-brand span {
  color: #fff;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .2em;
}

.sidebar-brand > button {
  display: none;
  margin-left: auto;
}

.sidebar-client,
.sidebar-period {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px;
  background: rgba(255,255,255,.075);
}

.sidebar-client > span,
.sidebar-period label {
  color: #82d9ff;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.sidebar-client select,
.sidebar-period input {
  min-height: 42px;
  border-color: rgba(255,255,255,.2);
  color: #122c3b;
  background: #fff;
  font-size: .76rem;
}

.sidebar-client small,
.sidebar-period small {
  color: #bbd8e8;
  font-size: .67rem;
}

.sidebar-client > button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.1);
  font-size: .72rem;
}

.sidebar-period label {
  display: grid;
  gap: 6px;
}

.sidebar-period > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 5px;
}

.sidebar-period a,
.sidebar-period button {
  display: grid;
  min-height: 36px;
  place-items: center;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  color: #fff;
  background: #0b91c7;
  text-decoration: none;
  font-size: .74rem;
  font-weight: 900;
}

.app-sidebar .app-nav {
  position: static;
  z-index: auto;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 4px;
  margin: 0;
  padding: 3px 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.app-sidebar .app-nav > p {
  margin: 12px 10px 4px;
  color: #74b8d8;
  font-size: .6rem;
  font-weight: 900;
  letter-spacing: .13em;
}

.app-sidebar .app-nav > a,
.app-sidebar .sidebar-more > summary,
.app-sidebar .sidebar-more a,
.app-sidebar .sidebar-more button {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  justify-content: flex-start;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  color: #dcedf6;
  background: transparent;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 800;
}

.app-sidebar .app-nav > a:hover,
.app-sidebar .sidebar-more a:hover,
.app-sidebar .sidebar-more button:hover {
  color: #fff;
  background: rgba(44,190,238,.17);
}

.app-sidebar .app-nav [data-screen-open].screen-active,
.app-sidebar .app-nav .nav-primary.screen-active {
  color: #fff;
  background: linear-gradient(135deg, #0aa3d7, #0c87be);
  box-shadow: 0 8px 22px rgba(1,117,167,.28);
}

.sidebar-more {
  margin-top: 4px;
}

.sidebar-more > summary {
  cursor: pointer;
  list-style: none;
}

.sidebar-more > summary::-webkit-details-marker {
  display: none;
}

.sidebar-more > div {
  display: grid;
  gap: 2px;
  padding: 4px 0 4px 13px;
  border-left: 1px solid rgba(124,210,244,.22);
}

.sidebar-footer {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.14);
}

.sidebar-footer button,
.sidebar-footer a {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 9px;
  justify-content: flex-start;
  padding: 8px 11px;
  border: 0;
  border-radius: 9px;
  color: #e5f4fb;
  background: rgba(255,255,255,.07);
  text-decoration: none;
  font-size: .74rem;
  font-weight: 800;
}

.sidebar-scrim {
  display: none;
}

.app-content {
  min-width: 0;
  padding: 22px clamp(16px, 2.4vw, 36px) 54px;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
  padding: 15px 18px;
  border: 1px solid #dbe5ea;
  border-radius: 13px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 9px 26px rgba(25,55,70,.055);
}

.content-header span {
  color: #087f72;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.content-header h1 {
  margin: 2px 0;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
}

.content-header p {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
}

.app-screen.active {
  animation: screen-fade 170ms ease both;
}

@keyframes screen-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.home-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  padding: 5px 18px 18px;
}

.home-status-grid article {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid #d9e4e8;
  border-radius: 12px;
  background: #fff;
}

.home-status-grid span,
.balance-source-grid span {
  color: var(--muted);
  font-size: .73rem;
  font-weight: 800;
}

.home-status-grid b,
.balance-source-grid b {
  font-size: 1.35rem;
}

.home-status-grid small {
  color: var(--muted);
  font-size: .67rem;
}

.balance-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.balance-source-grid > div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #cde6dd;
  border-radius: 10px;
  background: #effaf6;
}

.bank-formula-help,
.reconciliation-help {
  margin: 10px 0 14px;
  border: 1px solid #b8dce8;
  border-radius: 10px;
  color: #244655;
  background: #eef9fc;
}

.bank-formula-help {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
}

.bank-formula-help > span {
  font-size: 1.25rem;
}

.bank-formula-help p,
.reconciliation-help p {
  margin: 4px 0 0;
  font-size: .77rem;
  line-height: 1.45;
}

.reconciliation-help > summary {
  padding: 10px 13px;
  color: #0a6f7b;
  font-size: .76rem;
  font-weight: 900;
  cursor: pointer;
}

.reconciliation-help p {
  padding: 0 13px 12px;
}

.tool {
  z-index: 1000;
}

.modal-backdrop {
  z-index: 900;
}

body.modal-open .app-sidebar,
body.modal-open .app-content {
  filter: none;
}

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .home-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 120;
    display: flex;
  }

  .app-layout {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 160;
    width: min(310px, 88vw);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 190ms ease;
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-brand > button {
    display: grid;
    width: 34px;
    min-height: 34px;
    place-items: center;
    padding: 0;
    background: rgba(255,255,255,.12);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: block;
    visibility: hidden;
    padding: 0;
    border: 0;
    opacity: 0;
    background: rgba(5,30,43,.5);
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  body.sidebar-open .sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .app-sidebar .app-nav {
    position: static;
    inset: auto;
    display: grid;
    grid-template-columns: 1fr;
    padding: 3px 0 14px;
    border: 0;
    background: transparent;
  }

  .app-sidebar .app-nav > a,
  .app-sidebar .app-nav > button {
    display: flex;
    min-height: 42px;
    padding: 9px 12px;
    font-size: .82rem;
  }

  .app-sidebar .app-nav span {
    font-size: inherit;
  }

  body {
    padding-bottom: 0;
  }

  .app-content {
    padding: 14px 12px 38px;
  }
}

.sat-difference-guide {
  margin: 10px 18px 16px;
  border: 1px solid #e8c77f;
  border-radius: 10px;
  background: #fff9ea;
}

.sat-difference-guide > summary {
  padding: 11px 13px;
  color: #70520c;
  font-weight: 900;
  cursor: pointer;
}

.sat-difference-guide ol,
.sat-difference-guide p {
  margin: 0 18px 12px 34px;
  color: #4c5963;
  font-size: .78rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .content-header {
    align-items: stretch;
    flex-direction: column;
  }

  .content-header > button {
    width: 100%;
  }

  .home-status-grid,
  .balance-source-grid {
    grid-template-columns: 1fr;
  }

  .home-status-grid {
    padding-right: 12px;
    padding-left: 12px;
  }

  .tool {
    z-index: 1000;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button,
.actions a {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover,
.button:hover,
.actions a:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 138, 122, 0.18);
}

button,
.tool button,
.card button {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

button:hover,
.tool button:hover,
.card button:hover {
  background: var(--primary-2);
}

.ghost {
  background: var(--surface-2);
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  text-transform: uppercase;
}

input[type="email"],
input[type="password"] {
  text-transform: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.08;
}

h2 {
  font-size: 1.02rem;
}

h3 {
  font-size: 0.98rem;
  line-height: 1.15;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar div {
  display: grid;
  gap: 2px;
}

.topbar span,
.toolbar p,
.panel-head span,
.row summary span,
.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.shell {
  min-width: 0;
  padding: 22px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.toolbar > div {
  min-width: 260px;
}

.inline {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: min(820px, 100%);
}

.inline select {
  flex: 1 1 430px;
  min-width: min(430px, 100%);
}

.inline input {
  width: 150px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.actions a:nth-child(1)::before {
  content: "🧾";
}

.actions a:nth-child(2)::before {
  content: "📄";
}

.actions a:nth-child(3)::before {
  content: "📱";
}

.actions a:nth-child(4)::before {
  content: "🔎";
}

.actions a:nth-child(5)::before {
  content: "➕";
}

.actions a:nth-child(6)::before {
  content: "👤";
}

.actions a:nth-child(7)::before {
  content: "⚙️";
}

.actions a:nth-child(8)::before {
  content: "🧾";
}

.actions a:nth-child(9)::before {
  content: "📊";
}

.tools {
  display: block;
  margin-bottom: 18px;
}

.tool {
  display: none;
  width: min(760px, 100%);
  padding: 16px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(25, 39, 52, 0.06);
}

.tool:target {
  display: grid;
  gap: 12px;
}

.tool-note {
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tool form,
.card,
.detail {
  display: grid;
  gap: 12px;
}

.cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cols label:last-of-type {
  grid-column: 1 / -1;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics article,
.panel,
.empty,
.card,
.fatal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(25, 39, 52, 0.06);
}

.metrics article {
  display: grid;
  gap: 8px;
  min-height: 98px;
  padding: 16px;
}

.metrics span {
  color: var(--muted);
  font-size: 0.86rem;
}

.metrics b {
  font-size: 1.25rem;
}

.panel {
  min-width: 0;
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.regime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  padding: 14px;
}

.regime-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.regime-card div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.regime-card span {
  display: grid;
  gap: 3px;
  padding: 9px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
}

.regime-card b {
  color: var(--text);
  font-size: 1rem;
}

.regime-card b.amount-pay,
.metrics b.amount-pay,
.sat-panel b.amount-pay {
  color: var(--danger);
}

.regime-card b.amount-favor,
.metrics b.amount-favor,
.sat-panel b.amount-favor {
  color: var(--primary-2);
}

.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.sat-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.sat-summary article {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.sat-summary span,
.sat-block summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.sat-summary b {
  font-size: 1.2rem;
}

.sat-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

.sat-kpis article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #d8e4ea;
  border-radius: 8px;
  background: #ffffff;
}

.sat-kpis span,
.sat-categories span {
  color: var(--muted);
  font-size: 0.82rem;
}

.sat-kpis b {
  font-size: 1.12rem;
}

.sat-sections {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.sat-help {
  margin: 14px 14px 0;
  padding: 12px 14px;
  border: 1px solid #b9ded5;
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: #eef8f5;
  color: var(--primary-2);
  font-weight: 700;
}

.sat-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.sat-block.iva-total {
  border-color: #9ecdc4;
  background: #f3fbf8;
}

.sat-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}

.sat-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.sat-columns > div {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
}

.sat-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #eef2f5;
}

.sat-line span {
  color: var(--muted);
  font-size: 0.84rem;
}

.sat-line b {
  white-space: nowrap;
}

.sat-note {
  margin: 0 14px 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef8f5;
  color: var(--primary-2);
  font-weight: 700;
  font-size: 0.86rem;
}

.sat-categories {
  display: grid;
  gap: 8px;
  margin: 0 14px 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
}

.sat-categories h3 {
  margin: 0;
}

.sat-categories div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #eef2f5;
}

.reconcile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
  padding: 14px 16px 16px;
}

.reconcile-grid > div {
  min-width: 0;
}

.reconcile-grid h3 {
  margin-bottom: 10px;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.mini-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-row span {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-row b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  white-space: nowrap;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(160px, 0.9fr) auto;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfa;
}

.filters select,
.filters button {
  min-width: 0;
}

.list {
  display: grid;
  max-height: 430px;
  overflow: auto;
}

.row {
  border-bottom: 1px solid var(--line);
}

.row summary {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.row summary::-webkit-details-marker {
  display: none;
}

.row strong,
.row summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.row-desc {
  color: var(--muted);
  font-size: 0.88rem;
}

.chip-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-line em {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: #eef5f1;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 0.74rem;
  font-style: normal;
}

.chip-line em.chip-warning {
  background: #fff1d6;
  color: #8a5a00;
}

.row b {
  white-space: nowrap;
}

.detail {
  padding: 0 16px 16px;
  color: var(--muted);
}

.invoice-treatment {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.invoice-treatment button {
  align-self: end;
}

.cfdi-search-item {
  position: relative;
}

.invoice-quick-edit-button {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 2;
  min-height: 34px;
  padding: 7px 12px;
  background: #2f739d;
  font-size: 0.78rem;
}

.cfdi-search-item .cfdi-row > summary {
  padding-right: 142px;
}

.invoice-edit-tool {
  width: min(780px, calc(100vw - 28px));
}

.invoice-edit-tool > h2 {
  padding-right: 48px;
}

.invoice-edit-tool .invoice-treatment {
  margin-top: 0;
}

.adjustment-group-title {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 7px;
  color: #075f56;
  background: #e8f6f3;
  font-size: 0.84rem;
}

.invoice-exclusion-help {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid #e09b2d;
  border-radius: 7px;
  color: #73500f;
  background: #fff8e8;
  font-size: 0.76rem;
  line-height: 1.45;
}

.cfdi-row.cfdi-excluded {
  border-left: 4px solid #db5757;
  background: #fffafa;
}

.cfdi-row.cfdi-excluded summary {
  background: #fff5f4;
}

.invoice-exclusion-banner,
.cfdi-excluded-summary,
.declaration-exclusion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid #efb0aa;
  border-radius: 8px;
  color: #8d2929;
  background: #fff0ef;
  font-size: 0.76rem;
}

.invoice-exclusion-banner {
  align-items: flex-start;
  flex-direction: column;
  margin-bottom: 12px;
}

.invoice-exclusion-banner small {
  color: #8d5252;
}

.cfdi-excluded-summary {
  border-width: 1px 0;
  border-radius: 0;
}

.declaration-exclusion-summary {
  margin: 12px 0;
}

.finance-regime-table tbody th > small.excluded-note {
  color: #a12d2d;
  font-weight: 800;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
}

.audit-grid article {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.audit-grid span,
.import-log span,
.import-log em {
  color: var(--muted);
  font-size: 0.82rem;
}

.audit-grid b {
  font-size: 1.2rem;
}

.audit-status {
  padding: 5px 9px;
  border-radius: 6px;
  font-weight: 800;
}

.audit-status.ok {
  color: #176b53;
  background: #ddf4ea;
}

.audit-status.pending {
  color: #765400;
  background: #fff1c7;
}

.audit-status.error {
  color: #9f3030;
  background: #ffe2e2;
}

.audit-note {
  margin: 0 14px 14px;
  padding: 10px 12px;
  border-left: 4px solid #d59522;
  background: #fff8e8;
  overflow-wrap: anywhere;
}

.import-log {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.import-log summary {
  padding: 12px;
  cursor: pointer;
  font-weight: 800;
}

.import-log div {
  display: grid;
  grid-template-columns: 110px minmax(160px, 0.5fr) minmax(0, 1fr);
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
}

.import-log em {
  font-style: normal;
  overflow-wrap: anywhere;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.card,
.fatal {
  width: min(440px, 100%);
  padding: 28px;
}

.fatal {
  width: min(760px, calc(100% - 32px));
  margin: 40px auto;
}

.fatal pre,
.alert {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff1f1;
  border: 1px solid #f0b8b8;
  border-radius: 8px;
  padding: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  top: 78px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--primary);
}

.toast.error {
  border-left-color: var(--danger);
}

.empty {
  min-height: 340px;
  display: grid;
  gap: 16px;
  padding: 28px;
}

.db-note {
  border: 1px solid #b9ded5;
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: #eef8f5;
  color: var(--primary-2);
  padding: 12px 14px;
  font-weight: 700;
}

@media (max-width: 1060px) {
  .toolbar,
  .grid2,
  .reconcile-grid,
  .sat-columns,
  .sat-summary,
  .sat-kpis {
    display: grid;
    grid-template-columns: 1fr;
  }

  .inline {
    justify-content: flex-start;
    min-width: 0;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.45rem;
  }

  .topbar,
  .shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .inline,
  .filters,
  .cols,
  .regime-card div,
  .sat-categories div,
  .import-log div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .inline input,
  .inline select {
    width: 100%;
    min-width: 0;
  }

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

  .actions > * {
    flex: 1 1 calc(50% - 10px);
  }

  .row summary {
    grid-template-columns: 1fr;
  }
}

/* Simulador de declaracion y papel de trabajo */
.declaration-simulator,
.declaration-workpaper {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(31, 52, 64, 0.08);
}

.declaration-simulator {
  padding: 18px;
}

.declaration-simulator-head,
.workpaper-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.declaration-simulator-head h2,
.workpaper-preview h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.declaration-simulator-head p,
.workpaper-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.declaration-actions,
.workpaper-preview > div:last-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.declaration-actions a,
.declaration-actions button,
.workpaper-preview button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 800;
}

.declaration-actions a {
  display: inline-grid;
  place-items: center;
  border: 1px solid #b9d8d2;
  color: var(--primary-2);
  background: #f1fbf8;
  text-decoration: none;
}

.readiness {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 900;
}

.readiness.ready {
  color: #07685d;
  background: #dff6ee;
}

.readiness.needs-review {
  color: #865709;
  background: #fff1c9;
}

.declaration-rule {
  margin: 15px 0;
  padding: 11px 13px;
  border: 1px solid #c8e4dd;
  border-left: 4px solid var(--primary);
  border-radius: 7px;
  color: #34515c;
  background: #f1faf7;
  font-size: 0.78rem;
  line-height: 1.45;
}

.general-sat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.general-isr-stack {
  display: grid;
  gap: 14px;
}

.sat-simulator-card {
  overflow: hidden;
  border: 1px solid #ccd9df;
  border-top: 4px solid var(--primary);
  border-radius: 9px;
  background: #fff;
}

.sat-simulator-card.iva-simulator {
  border-top-color: #347dc1;
}

.sat-simulator-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  background: #f6f9fa;
}

.sat-simulator-card > header > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sat-simulator-card header h3 {
  margin: 1px 0 0;
  font-size: 0.9rem;
}

.sat-simulator-card header small {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
}

.sat-simulator-card header em {
  padding: 6px 8px;
  border-radius: 999px;
  color: #24556b;
  background: #e8f1f5;
  font-size: 0.61rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.tax-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: #fff;
  background: var(--primary);
  font-size: 0.75rem;
  font-weight: 900;
}

.iva-simulator .tax-icon {
  background: #347dc1;
}

.sat-sim-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #d8e2e7;
  border-bottom: 1px solid #d8e2e7;
  background: #f8fafb;
}

.sat-sim-tabs button {
  min-height: 40px;
  padding: 6px 8px;
  border: 0;
  border-right: 1px solid #d8e2e7;
  border-radius: 0;
  color: #33434e;
  background: transparent;
  font-size: 0.69rem;
  font-weight: 800;
}

.sat-sim-tabs button:last-child {
  border-right: 0;
}

.sat-sim-tabs button.active {
  color: #fff;
  background: var(--primary);
}

.iva-simulator .sat-sim-tabs button.active {
  background: #347dc1;
}

.sat-sim-panes {
  min-height: 355px;
  padding: 14px;
}

.sat-sim-pane {
  display: none;
}

.sat-sim-pane.active {
  display: block;
}

.sat-sim-pane h4 {
  margin: 0 0 14px;
  color: #23343e;
  font-size: 0.83rem;
}

.sat-sim-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px 112px;
  align-items: center;
  min-height: 46px;
  gap: 6px;
  border-bottom: 1px dashed #dce5e9;
  font-size: 0.73rem;
}

.sat-sim-line > span {
  min-width: 0;
}

.sat-sim-line small {
  display: block;
  margin-top: 2px;
  color: #71808a;
  font-size: 0.55rem;
  font-weight: 800;
}

.sat-sim-line small.manual {
  color: #a65b00;
}

.sat-sim-line i {
  color: #5c6f79;
  font-style: normal;
  text-align: center;
}

.sat-sim-line > b {
  padding: 7px 9px;
  border: 1px solid #c7d5dc;
  border-radius: 5px;
  color: #1f303b;
  background: #eef3f6;
  text-align: right;
}

.sat-sim-line.is-total > span,
.sat-sim-line.is-total > b {
  font-weight: 900;
}

.sat-sim-line.is-total > b {
  border-color: #a9c7c1;
  color: #075f56;
  background: #e7f6f2;
}

.sat-simulator-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 9px 13px;
  border-top: 1px solid #d8e2e7;
  color: #5d6d77;
  background: #f6f9fa;
  font-size: 0.62rem;
}

.sat-simulator-card > footer b {
  color: var(--primary-2);
  font-size: 0.78rem;
}

.declaration-disclaimer {
  margin: 13px 0 0;
  color: #6b7881;
  font-size: 0.68rem;
  text-align: center;
}

.declaration-workpaper {
  padding: 16px 18px;
}

.workpaper-preview > div:last-child button:first-child {
  color: var(--primary-2);
  background: #edf8f5;
}

.workpaper-print-body {
  display: none;
  margin-top: 18px;
  color: #17242d;
}

.declaration-workpaper.is-expanded .workpaper-print-body {
  display: block;
}

.workpaper-letterhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--primary);
}

.workpaper-letterhead > div {
  display: grid;
  gap: 3px;
}

.workpaper-letterhead > div:last-child {
  text-align: right;
}

.workpaper-print-body section {
  margin-top: 18px;
}

.workpaper-print-body h3 {
  margin: 0 0 8px;
  color: #075f56;
  font-size: 0.9rem;
}

.workpaper-print-body h4 {
  margin: 14px 0 6px;
  font-size: 0.76rem;
}

.workpaper-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid #cfdae0;
  border-radius: 7px;
}

.workpaper-kpis > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-right: 1px solid #cfdae0;
}

.workpaper-kpis > div:last-child {
  border-right: 0;
  background: #e7f6f2;
}

.workpaper-kpis span {
  color: #63737d;
  font-size: 0.62rem;
}

.workpaper-kpis b {
  font-size: 1rem;
}

.workpaper-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.66rem;
}

.workpaper-table th,
.workpaper-table td {
  padding: 7px 6px;
  border: 1px solid #d5dfe4;
  vertical-align: top;
  text-align: right;
}

.workpaper-table th {
  color: #344851;
  background: #edf3f5;
  font-weight: 900;
}

.workpaper-table th:first-child,
.workpaper-table td:first-child,
.workpaper-table td:nth-child(2),
.workpaper-table.evidence-table td:last-child {
  text-align: left;
}

.workpaper-table small {
  display: block;
  margin-top: 2px;
  color: #6c7b84;
  font-size: 0.54rem;
}

.workpaper-formula {
  max-width: 720px;
}

.workpaper-formula .formula-result {
  min-width: 180px;
  color: #075f56;
  background: #e8f7f3;
  text-align: center;
  vertical-align: middle;
}

.formula-result span,
.formula-result b {
  display: block;
}

.formula-result b {
  margin: 4px 0 10px;
  font-size: 1.2rem;
}

.uuid-cell {
  max-width: 130px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.57rem;
  text-align: left !important;
}

.workpaper-notes {
  padding: 12px;
  border: 1px solid #d5e2e6;
  border-radius: 7px;
  background: #f8fafb;
  font-size: 0.65rem;
  line-height: 1.45;
}

.workpaper-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 44px;
}

.workpaper-signatures span {
  padding-top: 6px;
  border-top: 1px solid #63737d;
  text-align: center;
}

@media (max-width: 980px) {
  .general-sat-grid {
    grid-template-columns: 1fr;
  }

  .sat-sim-panes {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .declaration-simulator-head,
  .workpaper-preview {
    align-items: flex-start;
    flex-direction: column;
  }

  .declaration-actions,
  .workpaper-preview > div:last-child {
    justify-content: flex-start;
  }

  .sat-sim-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sat-sim-tabs button:nth-child(2) {
    border-right: 0;
  }

  .sat-sim-line {
    grid-template-columns: minmax(0, 1fr) 20px 92px;
  }

  .sat-simulator-card > header,
  .sat-simulator-card > footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .workpaper-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  @page {
    size: landscape;
    margin: 9mm;
  }

  body.printing-workpaper {
    padding: 0;
    color: #000;
    background: #fff;
  }

  body.printing-workpaper .topbar,
  body.printing-workpaper .toast,
  body.printing-workpaper main.shell > :not(#declaration-workpaper),
  body.printing-workpaper .workpaper-preview {
    display: none !important;
  }

  body.printing-workpaper main.shell,
  body.printing-workpaper #declaration-workpaper,
  body.printing-workpaper .workpaper-print-body {
    display: block !important;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  body.printing-workpaper .workpaper-print-body section,
  body.printing-workpaper .workpaper-table,
  body.printing-workpaper .workpaper-kpis {
    break-inside: avoid;
  }

  body.printing-workpaper .evidence-table {
    break-inside: auto;
  }

  body.printing-workpaper .evidence-table tr {
    break-inside: avoid;
  }

  body.printing-workpaper .workpaper-table {
    font-size: 7.5pt;
  }

  body.printing-workpaper .workpaper-table th,
  body.printing-workpaper .workpaper-table td {
    padding: 4px;
  }
}

@media print {
  .topbar,
  .actions,
  .tools,
  .filters,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .shell {
    padding: 0;
  }
}

/* App workspace */
:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #edf7f4;
  --text: #18232d;
  --muted: #65727e;
  --line: #d9e2e7;
  --primary: #087f72;
  --primary-2: #06685f;
  --sky: #e9f4ff;
  --sky-strong: #216a9a;
  --amber: #fff4d8;
  --amber-strong: #8a5a08;
  --coral: #fff0ed;
  --danger: #bd3d38;
}

body {
  padding-bottom: 18px;
}

.topbar {
  min-height: 68px;
  justify-content: flex-start;
  padding: 10px clamp(14px, 3vw, 32px);
}

.brand-mark {
  display: grid !important;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-size: 0.92rem;
  font-weight: 900;
}

.brand-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  object-fit: contain;
}

.brand-copy {
  flex: 1;
}

.brand-copy strong {
  line-height: 1.1;
}

.sound-toggle.is-muted {
  color: var(--muted);
  background: #f1f4f6;
}

.install-toggle[hidden] {
  display: none;
}

.install-toggle {
  color: #08735f;
  background: #edf9f5;
}

.sound-toggle:active {
  animation: coin-ring 220ms ease;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  text-decoration: none;
  font-size: 1.25rem;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 28px);
}

.app-client-bar {
  align-items: center;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-2);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.app-nav {
  position: sticky;
  top: 76px;
  z-index: 15;
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, auto)) minmax(86px, auto);
  justify-content: start;
  gap: 7px;
  margin-bottom: 14px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 26px rgba(31, 52, 64, 0.08);
  backdrop-filter: blur(12px);
}

.app-nav > a,
.app-nav > button {
  min-height: 44px;
  padding: 0 12px;
  white-space: nowrap;
}

.app-nav a::before {
  content: none !important;
}

.app-nav .nav-primary {
  color: #fff;
  background: var(--primary);
}

.nav-more {
  color: var(--text);
  background: var(--surface-2);
}

.more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 35;
  width: min(320px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.more-menu:not([hidden]) {
  display: grid;
  gap: 4px;
  animation: menu-in 150ms ease both;
}

.more-menu a,
.more-menu button {
  min-height: 42px;
  justify-content: flex-start;
  color: var(--text);
  background: #fff;
}

.regime-app {
  overflow: visible;
}

.app-screen {
  display: none;
  min-width: 0;
}

.app-screen.active {
  display: block;
  animation: pane-in 180ms ease both;
}

.app-nav [data-screen-open].screen-active {
  color: #fff;
  background: var(--primary);
}

.module-home {
  overflow: hidden;
}

.module-home-head,
.screen-toolbar,
.screen-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.module-home-head,
.screen-toolbar {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.module-home-head h2,
.screen-toolbar h2 {
  margin: 2px 0 0;
}

.module-home-head p,
.screen-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.home-invoice-finder {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(220px, 0.8fr) auto;
  align-items: center;
  gap: 12px;
  margin: 16px 18px;
  padding: 14px;
  border: 2px solid #7fcbbd;
  border-radius: 12px;
  background: #ecfaf6;
}

.home-invoice-finder > div {
  display: grid;
  gap: 3px;
}

.home-invoice-finder span {
  color: var(--muted);
  font-size: 0.76rem;
}

.module-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 2px 18px 18px;
}

button.module-card {
  min-height: 172px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 7px;
  padding: 18px;
  border: 1px solid #d6e3e6;
  color: var(--text);
  background: #fff;
  box-shadow: 0 8px 24px rgba(28, 49, 60, 0.06);
  text-align: left;
}

button.module-card:hover {
  border-color: #7fcbbd;
  color: var(--text);
  background: #f5fcfa;
  transform: translateY(-2px);
}

.module-card > span {
  font-size: 1.65rem;
}

.module-card > strong {
  font-size: 1rem;
}

.module-card > small {
  min-height: 34px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.module-card > em {
  color: #076b60;
  font-size: 0.72rem;
  font-weight: 850;
  font-style: normal;
}

button.module-card.module-enterprise {
  border-top: 5px solid #087f72;
}

button.module-card.module-platform {
  border-top: 5px solid #d99a2b;
}

button.module-card.module-cfdi {
  border-top: 5px solid #507fa8;
}

button.module-card.module-bank {
  border-top: 5px solid #356a97;
}

button.module-card.module-total {
  border-top: 5px solid #6d7e87;
}

button.module-card.module-declaration {
  border-top: 5px solid #9a4363;
}

.home-edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #f7fafb;
}

.home-edit-actions b {
  margin-right: auto;
  font-size: 0.8rem;
}

.single-module-panel {
  padding: 0 18px 18px;
}

.screen-action-bar {
  margin: 0 -18px 10px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: #f5f8f9;
}

.screen-action-bar > span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.screen-action-bar > div {
  display: flex;
  gap: 7px;
}

.screen-action-bar button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.74rem;
}

.screen-toolbar {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.cfdi-search-box {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto;
  gap: 8px;
  width: min(520px, 48%);
}

.cfdi-screen-heading > span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
}

.cfdi-filter-panel {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid #cfe1da;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.cfdi-filter-grid {
  display: grid;
  grid-template-columns: repeat(6,minmax(135px,1fr));
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg,#f7fbf9 0%,#eef7f3 100%);
}

.cfdi-filter-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.cfdi-filter-grid label > span {
  color: #45635a;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.cfdi-filter-grid input,
.cfdi-filter-grid select {
  width: 100%;
  min-width: 0;
  min-height: 41px;
  border-color: #bfd6cd;
  background: #fff;
  font-size: .76rem;
}

.cfdi-filter-search,
.cfdi-filter-grid label:nth-child(2) {
  grid-column: span 2;
}

.cfdi-filter-panel > footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid #d9e7e1;
  color: #49655c;
  background: #fff;
  font-size: .72rem;
}

.cfdi-filter-panel > footer > span b {
  color: var(--primary);
  font-size: 1rem;
}

.cfdi-filter-panel > footer small {
  margin-right: auto;
  color: var(--muted);
}

.cfdi-filter-panel > footer button {
  min-height: 35px;
  padding: 7px 12px;
  font-size: .7rem;
}

.cfdi-search-item[hidden] {
  display: none !important;
}

.cfdi-row[hidden] {
  display: none !important;
}

.cfdi-no-results {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
  padding: 13px 15px;
  border: 1px solid #e7b75b;
  border-radius: 9px;
  color: #76500a;
  background: #fff7e6;
  font-size: 0.78rem;
}

.cfdi-no-results[hidden] {
  display: none;
}

@media (max-width: 1180px) {
  .cfdi-filter-grid { grid-template-columns: repeat(4,minmax(135px,1fr)); }
}

@media (max-width: 760px) {
  .cfdi-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cfdi-filter-panel > footer { align-items: stretch; flex-direction: column; }
  .cfdi-filter-panel > footer button { width: 100%; }
}

@media (max-width: 480px) {
  .cfdi-filter-grid { grid-template-columns: 1fr; }
  .cfdi-filter-search,
  .cfdi-filter-grid label:nth-child(2) { grid-column: auto; }
}

.app-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 10px;
}

.app-section-head > span {
  color: var(--muted);
  font-size: 0.82rem;
}

.regime-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 18px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.iva-credit-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(240px, 1.35fr);
  align-items: center;
  gap: 1px;
  margin: 0 18px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.iva-credit-strip > div,
.iva-credit-strip > p {
  min-height: 58px;
  margin: 0;
  padding: 9px 11px;
  background: #f8fbfc;
}

.iva-credit-strip > div {
  display: grid;
  align-content: center;
  gap: 3px;
}

.iva-credit-strip span,
.iva-credit-strip small {
  color: var(--muted);
  font-size: 0.68rem;
}

.iva-credit-strip b {
  font-size: 0.98rem;
}

.iva-credit-strip > p {
  display: grid;
  align-content: center;
  color: #08735f;
  font-size: 0.76rem;
  font-weight: 800;
}

.iva-credit-strip.credit-used > p {
  color: #8a5b08;
  background: #fff8e8;
}

.iva-overview-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 0 18px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.iva-overview-strip > div {
  min-width: 0;
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 12px;
  background: #fff;
}

.iva-overview-strip span,
.iva-overview-strip small {
  color: var(--muted);
  font-size: 0.7rem;
}

.iva-overview-strip b {
  font-size: 1.04rem;
}

.cfdi-panel {
  overflow: hidden;
}

.cfdi-panel .panel-head > div p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.cfdi-tax-note {
  padding: 10px 16px;
  border-bottom: 1px solid #cfe2df;
  color: #315f59;
  background: #edf8f6;
  font-size: 0.8rem;
}

.cfdi-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  background: var(--line);
  gap: 1px;
}

.cfdi-column {
  min-width: 0;
  background: #fff;
}

.cfdi-column-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.cfdi-column-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.cfdi-column-head h3 {
  margin-top: 3px;
  font-size: 1rem;
}

.cfdi-column-head > b {
  padding: 5px 8px;
  border-radius: 999px;
  color: #176b53;
  background: #e3f4ef;
  font-size: 0.74rem;
  white-space: nowrap;
}

.cfdi-received .cfdi-column-head > b {
  color: #385f89;
  background: #eaf2fb;
}

.cfdi-column-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px 0;
  background: var(--line);
}

.cfdi-column-summary > div {
  min-width: 0;
  min-height: 80px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 14px;
  background: #f9fbfc;
}

.cfdi-column-summary .tax-total {
  background: #eaf8f4;
}

.cfdi-received .cfdi-column-summary .tax-total {
  background: #eaf3fc;
}

.cfdi-column-summary span,
.cfdi-column-summary small {
  color: var(--muted);
  font-size: 0.7rem;
}

.cfdi-column-summary b {
  font-size: 1.06rem;
}

.cfdi-list {
  max-height: 720px;
  overflow: auto;
}

.cfdi-column-footer {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-top: 2px solid #b8d9cf;
  background: linear-gradient(180deg, #f4fbf8 0%, #e8f6f1 100%);
}

.cfdi-received .cfdi-column-footer {
  border-top-color: #bad0e7;
  background: linear-gradient(180deg, #f5f9fd 0%, #e9f2fb 100%);
}

.cfdi-column-footer > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cfdi-column-footer > div > span {
  color: var(--primary-2);
  font-size: .69rem;
  font-weight: 900;
  letter-spacing: .035em;
}

.cfdi-column-footer > div > b {
  color: var(--muted);
  font-size: .72rem;
}

.cfdi-column-footer dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.cfdi-column-footer dl > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #cfe1da;
  border-radius: 8px;
  background: rgba(255,255,255,.88);
}

.cfdi-received .cfdi-column-footer dl > div {
  border-color: #cbdbea;
}

.cfdi-column-footer dt {
  color: var(--muted);
  font-size: .65rem;
}

.cfdi-column-footer dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: .91rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cfdi-column-footer .cfdi-column-grand-total {
  border-color: #91cbbb;
  color: #075f56;
  background: #fff;
}

.cfdi-received .cfdi-column-footer .cfdi-column-grand-total {
  border-color: #9ebfdf;
  color: #275b88;
}

.cfdi-column-footer > small {
  color: var(--muted);
  font-size: .67rem;
}

@media (max-width: 480px) {
  .cfdi-column-footer dl { grid-template-columns: 1fr; }
}

.cfdi-row summary {
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.72fr);
  align-items: start;
}

.invoice-amount-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.invoice-amount-grid > span {
  min-width: 0;
  display: grid;
  gap: 1px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.invoice-amount-grid small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-amount-grid b {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
}

.invoice-amount-grid .invoice-month-vat {
  border-color: #a8d9ce;
  background: #eaf8f4;
}

.cfdi-received .invoice-amount-grid .invoice-month-vat {
  border-color: #b7cee7;
  background: #eaf3fc;
}

.fiscal-explanation {
  padding: 8px 10px;
  border-radius: 6px;
  color: #285b53;
  background: #edf8f6;
}

.cfdi-empty {
  padding: 22px 16px;
}

.regime-tabs button {
  min-width: 112px;
  color: var(--text);
  background: #edf2f5;
}

.regime-tabs button.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(8, 127, 114, 0.2);
}

.separated-workspace {
  scroll-margin-top: 88px;
}

.workspace-tabs {
  margin: 0 18px 10px;
  padding: 7px;
  border: 1px solid #d9e5e8;
  border-radius: 11px;
  background: #f5f8f9;
}

.workspace-tabs button {
  min-height: 43px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.workspace-tabs button:first-child {
  color: #086b60;
  background: #e2f4f0;
}

.workspace-tabs button:last-child {
  color: #275a82;
  background: #e7f0f9;
}

.workspace-tabs button.active {
  color: #fff;
  background: var(--primary);
}

.regime-pane {
  display: none;
  padding: 2px 18px 18px;
}

.regime-pane.active {
  display: block;
  animation: pane-in 220ms ease both;
}

.regime-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.regime-title > div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.app-section-head h2,
.consolidated-title h2,
.bank-title h2 {
  margin: 2px 0 0;
}

.app-section-head p,
.regime-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.consolidated-title,
.bank-title {
  margin-top: 4px;
  padding: 14px 2px;
}

.bank-title > button {
  flex: 0 0 auto;
  min-height: 40px;
}

.finance-total-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.finance-total-grid article,
.bank-reconciliation-grid article {
  min-width: 0;
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  border: 1px solid #d8e5e7;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff, #f7fbfb);
}

.finance-total-grid article:nth-child(1),
.finance-total-grid article:nth-child(3) {
  border-color: #bcded6;
  background: #effaf7;
}

.finance-total-grid article:nth-child(2),
.finance-total-grid article:nth-child(4) {
  border-color: #c7d9e9;
  background: #f1f7fc;
}

.finance-total-grid span,
.finance-total-grid small,
.bank-reconciliation-grid span,
.bank-reconciliation-grid small,
.regime-bank-strip span {
  color: var(--muted);
  font-size: 0.72rem;
}

.finance-total-grid b,
.bank-reconciliation-grid b {
  overflow: hidden;
  font-size: 1.28rem;
  text-overflow: ellipsis;
}

.finance-flow-compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: stretch;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fafb;
}

.finance-flow-compare section {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  background: #fff;
}

.finance-flow-compare > i {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
  font-style: normal;
}

.finance-flow-compare span,
.finance-flow-compare small {
  color: var(--muted);
  font-size: 0.72rem;
}

.finance-flow-compare b {
  font-size: 1.16rem;
}

.finance-flow-compare .finance-difference {
  background: #ecf8f5;
}

.finance-table-wrap {
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.finance-regime-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.76rem;
}

.finance-regime-table th,
.finance-regime-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.finance-regime-table thead th {
  color: #496069;
  background: #f2f7f8;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.finance-regime-table th:first-child {
  min-width: 250px;
  text-align: left;
}

.finance-regime-table tbody th > span {
  display: inline-block;
  margin-right: 7px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #0b665d;
  background: #e5f5f1;
}

.finance-regime-table tbody th > small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
}

.finance-regime-table .needs-match,
.bank-reconciliation-grid .needs-match,
.regime-bank-strip .needs-match {
  color: #a12626;
  background: #fff0ef;
  font-weight: 900;
}

.finance-regime-table .is-matched,
.bank-reconciliation-grid .is-matched,
.regime-bank-strip .is-matched {
  color: #08735f;
  background: #eaf8f4;
  font-weight: 900;
}

.finance-total-row th,
.finance-total-row td {
  border-bottom: 0;
  color: #083d39;
  background: #e8f5f2;
  font-weight: 900;
}

.finance-basis-note {
  margin: 10px 0 0;
  padding: 11px 13px;
  border-left: 4px solid #2b7fb8;
  border-radius: 7px;
  color: #45616b;
  background: #eef6fb;
  font-size: 0.76rem;
  line-height: 1.45;
}

.regime-bank-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--line);
}

.regime-bank-strip > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #f8fbfc;
}

.regime-bank-strip b {
  font-size: 0.98rem;
}

.bank-reconciliation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.bank-unclassified-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #edbf61;
  border-radius: 9px;
  color: #76500a;
  background: #fff8e9;
  font-size: 0.78rem;
}

.bank-unclassified-alert.is-complete {
  border-color: #9fd8ca;
  color: #086b60;
  background: #ebf9f5;
}

.bank-movement-panel {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.regime-title h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.regime-code,
.status-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--sky-strong);
  background: var(--sky);
  font-size: 0.76rem;
  font-weight: 900;
}

.platform-chip {
  max-width: 48%;
  overflow: hidden;
  color: var(--amber-strong);
  background: var(--amber);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.focus-metrics.focus-metrics-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.tax-signals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tax-signal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 82px;
  gap: 4px 12px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid;
  border-radius: 8px;
}

.tax-signal-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
}

.tax-signal-head strong {
  font-size: 0.8rem;
}

.tax-signal-head em {
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
}

.tax-signal > b {
  font-size: clamp(1.08rem, 2vw, 1.4rem);
  line-height: 1;
  text-align: right;
}

.tax-signal > small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.68rem;
}

.signal-light {
  display: inline-grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  animation: signal-pulse 1.8s ease-in-out infinite;
}

.tax-signal.signal-pay {
  border-color: #ef9b96;
  background: #fff1f0;
}

.tax-signal.signal-pay b,
.tax-signal.signal-pay em {
  color: #a92722;
}

.tax-signal.signal-pay em {
  background: #ffd7d4;
}

.tax-signal.signal-favor,
.tax-signal.signal-clear {
  border-color: #86cdbf;
  background: #edf9f5;
}

.tax-signal.signal-favor b,
.tax-signal.signal-favor em,
.tax-signal.signal-clear b,
.tax-signal.signal-clear em {
  color: #08735f;
}

.tax-signal.signal-favor em,
.tax-signal.signal-clear em {
  background: #d2f1e8;
}

@keyframes signal-pulse {
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.16); filter: saturate(1.35); }
}

.focus-metrics article {
  display: grid;
  align-content: start;
  min-height: 116px;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}

.focus-metrics article:nth-child(2) {
  background: var(--sky);
}

.focus-metrics article:nth-child(3) {
  background: var(--coral);
}

.focus-metrics article:nth-child(4),
.focus-metrics .metric-highlight {
  background: var(--amber);
}

.focus-metrics span,
.quick-balance span,
.platform-flow span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.focus-metrics b {
  font-size: clamp(1.08rem, 2vw, 1.42rem);
  overflow-wrap: anywhere;
}

.focus-metrics small {
  color: var(--muted);
  font-size: 0.75rem;
}

.quick-balance {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.quick-balance div {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: #fff;
}

.platform-flow {
  display: grid;
  grid-template-columns: repeat(7, auto);
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.platform-flow div {
  display: grid;
  min-width: 130px;
  gap: 5px;
}

.platform-flow i {
  color: var(--muted);
  font-size: 1.25rem;
  font-style: normal;
  font-weight: 900;
}

.platform-flow .flow-result {
  padding: 10px;
  border-radius: 8px;
  color: var(--primary-2);
  background: #e2f4ef;
}

.platform-auto-panel { margin: 14px 0; overflow: hidden; border: 1px solid #b9d9d2; border-radius: 10px; background: #f6fbfa; }
.platform-auto-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid #cfe3df; }
.platform-auto-panel h3 { margin-top: 3px; }
.auto-status { padding: 5px 8px; border-radius: 999px; font-size: 0.68rem; white-space: nowrap; }
.auto-status.ready { color: #0b6b56; background: #d9f2ea; }
.auto-status.pending { color: #8a5a00; background: #fff0cf; }
.platform-auto-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: #d7e5e2; }
.platform-auto-grid > div { min-width: 0; min-height: 82px; display: grid; align-content: center; gap: 3px; padding: 10px 12px; background: #fff; }
.platform-auto-grid span, .platform-auto-grid small { color: var(--muted); font-size: 0.7rem; }
.platform-auto-grid b { overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.platform-auto-upload { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.platform-auto-upload form { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.platform-auto-upload label, .platform-auto-upload input { min-width: 0; }
.platform-auto-panel > p { margin: 0; padding: 0 14px 13px; color: var(--muted); font-size: 0.76rem; }
.platform-manual { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.platform-manual > summary { padding: 13px 15px; color: #0b6b60; font-weight: 900; cursor: pointer; }
.platform-manual > form { padding: 0 14px 14px; }
.platform-manual .mode-separate-check { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 9px 10px; border: 1px solid #efd08e; border-radius: 7px; background: #fff8e8; }
.platform-manual .mode-separate-check input { width: auto; margin: 0; }
.platform-manual .mode-separate-check span { color: #76520f; font-size: 0.76rem; font-weight: 800; }
.platform-income-rule { grid-column: 1 / -1; margin: 4px 0; padding: 10px 12px; border-left: 4px solid #27a387; border-radius: 7px; color: #315f56; background: #edf9f5; font-size: .76rem; }
.platform-income-preview { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(120px,1fr) auto minmax(120px,1fr) auto minmax(145px,1.15fr) minmax(165px,1.2fr); align-items: stretch; gap: 7px; padding: 10px; border: 1px solid #9fd4c7; border-radius: 9px; background: #f4fbf8; }
.platform-income-preview > div { min-width: 0; display: grid; align-content: center; gap: 3px; padding: 9px 10px; border: 1px solid #cee4de; border-radius: 7px; background: #fff; }
.platform-income-preview > i { align-self: center; color: #58766e; font-size: 1.05rem; font-style: normal; font-weight: 900; }
.platform-income-preview span, .platform-income-preview small { color: var(--muted); font-size: .66rem; }
.platform-income-preview b { overflow: hidden; color: #123b35; font-size: .96rem; text-overflow: ellipsis; white-space: nowrap; }
.platform-income-preview .platform-income-total { border-color: #69bda8; background: #e8f8f3; }
.platform-income-preview .platform-iva-preview { border-color: #e3b557; background: #fff7e4; }
.platform-income-preview .platform-iva-preview b { color: #885c08; }
@media (max-width: 760px) { .platform-income-preview { grid-template-columns: 1fr; } .platform-income-preview > i { display: none; } }
.automation-trace { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid #badfd5; border-radius: 8px; background: #ecf8f5; }
.automation-trace > div { min-width: 0; display: grid; gap: 3px; }
.automation-trace span { overflow: hidden; color: var(--muted); font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }
.automation-trace a { color: #087f72; font-weight: 900; white-space: nowrap; }
.automation-trace.incomplete { border-color: #efd08e; background: #fff8e8; }
.definitive-profile-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding: 9px 12px; border: 1px solid #b9ded5; border-radius: 8px; color: #087467; background: #eef9f6; }
.definitive-profile-note span { color: var(--muted); font-size: 0.75rem; }
.external-income-box { margin: 0 0 12px; overflow: hidden; border: 1px solid #e2bd65; border-radius: 9px; background: #fffaf0; }
.external-income-box > summary { padding: 12px 14px; color: #71500a; font-weight: 900; cursor: pointer; }
.external-income-box > form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 9px; padding: 0 13px 12px; }
.external-income-box label { min-width: 0; color: #52616e; font-size: 0.72rem; font-weight: 800; }
.external-income-box input, .external-income-box select { width: 100%; min-width: 0; margin-top: 5px; }
.external-income-box button { min-height: 42px; white-space: nowrap; }
.external-income-box > p { margin: 0; padding: 0 14px 12px; color: var(--muted); font-size: 0.74rem; }
.external-income-box .external-included-check { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 8px 10px; border: 1px solid #e2bd65; border-radius: 7px; background: #fff4d8; }
.external-income-box .external-included-check input { width: auto; margin: 0; }
.external-income-box .external-included-check span { color: #71500a; font-size: 0.72rem; font-weight: 800; }

.flow-explainer {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.inline-warning {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #f0d18c;
  border-radius: 8px;
  color: #7b5208;
  background: #fff8e8;
  font-size: 0.86rem;
  font-weight: 800;
}

.app-detail {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.app-detail > summary {
  padding: 13px 14px;
  cursor: pointer;
  color: var(--primary-2);
  background: var(--surface-2);
  font-weight: 850;
}

.tool {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 70;
  width: min(820px, calc(100vw - 28px));
  max-height: min(82vh, 820px);
  margin: 0;
  padding: 20px;
  overflow: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 30px 80px rgba(22, 38, 48, 0.28);
}

.tool.is-open,
.tool:target {
  display: grid;
  animation: modal-in 180ms ease both;
}

.tool-close {
  position: sticky;
  top: 0;
  z-index: 2;
  justify-self: end;
  width: 40px;
  min-height: 40px;
  margin: -8px -8px -42px 0;
  padding: 0;
  color: var(--text);
  background: #edf2f5;
  font-size: 1.2rem;
}

.upload-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.upload-options.single-upload {
  grid-template-columns: minmax(0, 1fr);
}

.upload-options > section {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.upload-options > section:nth-child(2) {
  background: var(--sky);
}

.upload-options p {
  min-height: 40px;
  color: var(--muted);
  font-size: 0.84rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.auth-brand strong {
  font-size: 1.05rem;
  line-height: 1.15;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 33, 42, 0.46);
  backdrop-filter: blur(3px);
  animation: fade-in 160ms ease both;
}

body.modal-open {
  overflow: hidden;
}

.tax-tool .focus-metrics.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.regime-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 290px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.regime-picker legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 850;
}

.regime-picker label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-height: 54px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  cursor: pointer;
}

.regime-picker input {
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.regime-picker span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.regime-picker b {
  color: var(--primary-2);
}

.cancelled-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cancelled-summary article {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #edc5c2;
  border-radius: 8px;
  background: var(--coral);
}

.cancelled-summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.cancelled-summary b {
  color: var(--danger);
  font-size: 1.4rem;
}

.empty-cancelled {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid #b9ded5;
  border-radius: 8px;
  color: var(--primary-2);
  background: #eef8f5;
}

.empty-cancelled span {
  color: var(--muted);
  font-size: 0.84rem;
}

.cancelled-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cancelled-columns > section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}

.cancelled-columns h3 {
  margin-bottom: 8px;
}

.cancelled-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.cancelled-row > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.cancelled-row strong,
.cancelled-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cancelled-row span,
.cancelled-row small {
  color: var(--muted);
  font-size: 0.74rem;
}

.cancelled-row > div:last-child {
  justify-items: end;
}

.cancelled-row em {
  color: var(--danger);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

.sat-monthly-platform {
  display: grid;
  gap: 13px;
  margin-bottom: 18px;
  padding: 18px;
  border-color: #cadbd8;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfa 100%);
}

.sat-monthly-platform .panel-head > div {
  display: grid;
  gap: 4px;
}

.sat-monthly-source {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #b9ded7;
  border-radius: 10px;
  background: #effaf7;
}

.sat-monthly-source b {
  color: var(--primary-2);
}

.sat-monthly-source span {
  color: var(--muted);
  font-size: 0.8rem;
}

.sat-monthly-source a {
  color: var(--primary-2);
  font-size: 0.78rem;
  font-weight: 900;
}

.sat-monthly-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}

.sat-form-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #cfd9e2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(26, 52, 68, 0.07);
}

.sat-isr-card { border-top: 4px solid #15967e; }
.sat-iva-card { border-top: 4px solid #3778b8; }

.sat-form-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border-bottom: 1px solid #dbe3ea;
  background: #f8fafc;
}

.sat-form-card > header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sat-form-card > header span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: #3778b8;
  font-weight: 900;
}

.sat-isr-card > header span { background: #15967e; }
.sat-isr-card > header em { color: #086757; background: #dff4ee; }
.sat-iva-card > header span { background: #3778b8; }
.sat-iva-card > header em { color: #285a88; background: #e6eef8; }

.sat-form-card > header h3 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.25;
}

.sat-form-card > header em {
  border-radius: 999px;
  padding: 7px 10px;
  color: #34536f;
  background: #e6eef8;
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
}

.sat-activity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 0;
}

.sat-activity-tabs span {
  border: 1px solid #ced9e4;
  border-radius: 7px 7px 0 0;
  padding: 8px 11px;
  color: #35495d;
  background: #f6f8fb;
  font-size: 0.72rem;
  font-weight: 800;
}

.sat-activity-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  flex: 1;
  padding: 12px;
}

.sat-activity-forms.single {
  grid-template-columns: minmax(0, 1fr);
}

.sat-empty-month {
  grid-column: 1 / -1;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.sat-activity-forms section {
  min-width: 0;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
}

.sat-activity-forms h4 {
  min-height: 34px;
  margin: 0 0 10px;
  color: #34495e;
  font-size: 0.82rem;
}

.sat-capture-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 138px;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border-bottom: 1px dashed #e2e8ef;
}

.sat-capture-line > span {
  color: #3b4652;
  font-size: 0.79rem;
}

.sat-capture-line > i {
  text-align: center;
  color: #5d6875;
  font-size: 0.76rem;
  font-style: normal;
}

.sat-capture-line > b {
  min-height: 31px;
  border: 1px solid #c5d0db;
  border-radius: 5px;
  padding: 6px 9px;
  text-align: right;
  background: #edf1f5;
  font-size: 0.82rem;
}

.sat-isr-card .sat-capture-line > b { border-color: #bfd9d3; background: #edf8f5; }
.sat-iva-card .sat-capture-line > b { border-color: #c7d6e5; background: #edf3f9; }

.sat-capture-line.is-total > span,
.sat-capture-line.is-total > b {
  color: #152536;
  font-weight: 900;
}

.sat-form-card > footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid #dbe3ea;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.75rem;
}

.sat-form-card > footer b {
  color: var(--primary-2);
  font-size: 0.9rem;
}

.sat-isr-card > footer b { color: #087f72; }
.sat-iva-card > footer b { color: #2d70ad; }

.sat-monthly-warning {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

@keyframes pane-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.cfdi-fiscal-locator {
  overflow: hidden;
  border-top: 4px solid #0b8b7c;
}

.locator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 14px;
}

.locator-head h2,
.locator-column h3 {
  margin: 3px 0;
}

.locator-head p,
.locator-column header p {
  margin: 0;
  color: #63727f;
}

.locator-head > a {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid #a8d5cf;
  border-radius: 10px;
  color: #076e63;
  font-weight: 800;
  text-decoration: none;
}

.locator-explanation {
  margin: 0 24px 14px;
  padding: 11px 14px;
  border: 1px solid #efd089;
  border-radius: 10px;
  background: #fff8e7;
  color: #684b0a;
  font-size: 0.9rem;
}

.locator-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 24px 18px;
  overflow: hidden;
  border: 1px solid #d8e2e7;
  border-radius: 12px;
  background: #d8e2e7;
}

.locator-kpis article {
  display: grid;
  align-content: center;
  min-height: 92px;
  padding: 13px 15px;
  background: #fff;
}

.locator-kpis span,
.locator-kpis small {
  color: #62727e;
  font-size: 0.75rem;
}

.locator-kpis b {
  margin: 2px 0;
  color: #14303b;
  font-size: 1.35rem;
}

.locator-kpis .locator-pending-kpi {
  background: #fff4ed;
}

.locator-kpis .locator-pending-kpi b {
  color: #b53b24;
}

.locator-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 24px 20px;
}

.locator-column {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7e2e7;
  border-radius: 13px;
  background: #f8fbfc;
}

.locator-column > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #d7e2e7;
  background: #edf8f6;
}

.locator-collections > header {
  background: #fff5eb;
}

.locator-column > header > div {
  display: flex;
  gap: 10px;
}

.locator-column > header > b {
  flex: 0 0 auto;
  color: #49606b;
  font-size: 0.78rem;
}

.locator-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 11px;
  background: #0b8b7c;
  color: #fff;
  font-weight: 900;
}

.locator-collections .locator-icon {
  background: #d48128;
}

.locator-list {
  display: grid;
  gap: 9px;
  padding: 10px;
}

.locator-row {
  overflow: hidden;
  border: 1px solid #d9e3e7;
  border-radius: 11px;
  background: #fff;
}

.locator-row.is-pending {
  border-color: #efb389;
  background: #fffdf9;
}

.locator-row.is-settled,
.locator-row.is-located {
  border-left: 4px solid #18a282;
}

.locator-row summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.8fr);
  gap: 14px;
  padding: 13px;
  cursor: pointer;
  list-style: none;
}

.locator-row summary::-webkit-details-marker {
  display: none;
}

.locator-row-main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.locator-row-main strong,
.locator-row-main small,
.locator-row-main code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locator-row-main small {
  color: #5b6c76;
}

.locator-row-main code {
  color: #75848b;
  font-size: 0.7rem;
}

.locator-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.locator-badges em {
  padding: 3px 7px;
  border-radius: 999px;
  background: #e8f3f1;
  color: #17675e;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 800;
}

.locator-badges .locator-state {
  background: #fff0d9;
  color: #89530b;
}

.locator-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #e0e7ea;
  border-radius: 9px;
}

.locator-amounts > span {
  display: grid;
  align-content: center;
  padding: 8px;
  border-left: 1px solid #e0e7ea;
}

.locator-amounts > span:first-child {
  border-left: 0;
}

.locator-amounts small {
  color: #75838c;
  font-size: 0.65rem;
}

.locator-amounts b {
  font-size: 0.85rem;
}

.locator-amounts .locator-balance b {
  color: #bd3a25;
}

.locator-detail {
  padding: 13px;
  border-top: 1px solid #e0e7ea;
  background: #fbfdfe;
  font-size: 0.8rem;
}

.locator-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.locator-detail-grid p {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  background: #f0f5f7;
}

.locator-detail-grid span {
  color: #70808a;
  font-size: 0.68rem;
}

.locator-reason {
  padding: 9px 10px;
  border-radius: 8px;
  background: #fff7df;
  color: #694b0c;
}

.locator-zero-concepts {
  padding: 9px 10px;
  border: 1px solid #a9ddd3;
  border-radius: 8px;
  background: #eaf9f6;
  color: #075f55;
}

.locator-uuid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px dashed #abc6cf;
  border-radius: 8px;
  background: #fff;
  overflow-wrap: anywhere;
}

.locator-uuid button {
  flex: 0 0 auto;
  padding: 7px 9px;
  font-size: 0.72rem;
}

.locator-empty,
.locator-footnote {
  color: #667680;
}

.locator-empty {
  margin: 0;
  padding: 18px;
  text-align: center;
}

.locator-footnote {
  margin: 0;
  padding: 12px 24px 18px;
  border-top: 1px solid #e0e8eb;
  font-size: 0.78rem;
}

@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -47%) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes coin-ring {
  0% { transform: rotate(0deg) scale(1); }
  35% { transform: rotate(-8deg) scale(1.08); }
  70% { transform: rotate(8deg) scale(1.08); }
  100% { transform: rotate(0deg) scale(1); }
}

@media (max-width: 1020px) {
  .sat-monthly-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

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

  .home-invoice-finder {
    grid-template-columns: 1fr 1fr;
  }

  .home-invoice-finder > div {
    grid-column: 1 / -1;
  }

  .screen-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .cfdi-search-box {
    width: 100%;
  }

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

  .locator-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .platform-auto-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .platform-auto-upload {
    grid-template-columns: 1fr;
  }

  .cfdi-split {
    grid-template-columns: 1fr;
  }

  .iva-overview-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .finance-total-grid,
  .regime-bank-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bank-reconciliation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-flow-compare {
    grid-template-columns: 1fr;
  }

  .finance-flow-compare > i {
    min-height: 28px;
  }

  .focus-metrics,
  .quick-balance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-nav {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-content: stretch;
    margin: 0;
    padding: 7px;
    border-color: #cbd8de;
  }

  .app-nav > a,
  .app-nav > button {
    display: grid;
    min-width: 0;
    min-height: 52px;
    gap: 2px;
    padding: 5px 2px;
    font-size: 1rem;
  }

  .app-nav span {
    font-size: 0.62rem;
  }

  .more-menu {
    top: auto;
    right: 0;
    bottom: calc(100% + 7px);
  }

  body {
    padding-bottom: 82px;
  }
}

@media (max-width: 640px) {
  .module-home-head,
  .screen-action-bar,
  .home-edit-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .module-home-head > button,
  .home-edit-actions button {
    width: 100%;
  }

  .module-card-grid,
  .home-invoice-finder {
    grid-template-columns: 1fr;
  }

  .module-card-grid {
    padding-right: 12px;
    padding-left: 12px;
  }

  .home-invoice-finder {
    margin-right: 12px;
    margin-left: 12px;
  }

  button.module-card {
    min-height: 148px;
  }

  .home-edit-actions b {
    margin-right: 0;
  }

  .screen-action-bar > div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cfdi-search-box {
    grid-template-columns: 1fr;
  }

  .locator-head,
  .locator-column > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .locator-head,
  .locator-columns {
    padding-right: 12px;
    padding-left: 12px;
  }

  .locator-explanation,
  .locator-kpis {
    margin-right: 12px;
    margin-left: 12px;
  }

  .locator-row summary {
    grid-template-columns: 1fr;
  }

  .locator-amounts {
    width: 100%;
  }

  .locator-detail-grid {
    grid-template-columns: 1fr;
  }

  .locator-uuid {
    align-items: flex-start;
    flex-direction: column;
  }

  .platform-auto-grid {
    grid-template-columns: 1fr;
  }

  .platform-auto-upload form {
    grid-template-columns: 1fr;
  }

  .automation-trace {
    align-items: flex-start;
    flex-direction: column;
  }

  .external-income-box > form {
    grid-template-columns: 1fr;
  }

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

  .cfdi-row summary {
    grid-template-columns: 1fr;
  }

  .cfdi-search-item .cfdi-row > summary {
    padding-right: 14px;
    padding-bottom: 8px;
  }

  .invoice-quick-edit-button {
    position: static;
    width: calc(100% - 24px);
    margin: 0 12px 10px;
  }

  .invoice-amount-grid {
    width: 100%;
  }

  .iva-overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-right: 12px;
    margin-left: 12px;
  }

  .app-client-bar {
    padding: 14px;
  }

  .app-client-bar h1 {
    font-size: 1.18rem;
  }

  .app-section-head,
  .regime-title {
    align-items: flex-start;
  }

  .app-section-head > span {
    display: none;
  }

  .workspace-tabs {
    margin-right: 12px;
    margin-left: 12px;
  }

  .finance-total-grid,
  .bank-reconciliation-grid,
  .regime-bank-strip {
    grid-template-columns: 1fr;
  }

  .bank-title {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-title > button {
    width: 100%;
  }

  .bank-unclassified-alert {
    align-items: flex-start;
    flex-direction: column;
  }

  .cfdi-excluded-summary,
  .declaration-exclusion-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .regime-title h2 {
    white-space: normal;
  }

  .status-chip {
    display: none;
  }

  .focus-metrics,
  .quick-balance,
  .tax-tool .focus-metrics.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tax-signals {
    grid-template-columns: 1fr;
  }

  .iva-credit-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-right: 12px;
    margin-left: 12px;
  }

  .iva-credit-strip > p {
    grid-column: 1 / -1;
    min-height: 48px;
  }

  .tax-signal {
    min-height: 76px;
  }

  .regime-picker,
  .cancelled-columns,
  .upload-options {
    grid-template-columns: 1fr;
  }

  .sat-monthly-platform {
    padding: 13px;
  }

  .sat-monthly-source {
    grid-template-columns: 1fr;
  }

  .sat-form-card > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sat-activity-forms {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sat-capture-line {
    grid-template-columns: minmax(0, 1fr) 24px 94px;
  }

  .brand-copy strong {
    font-size: 0.82rem;
  }

  .brand-copy span {
    display: none;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .focus-metrics article {
    min-height: 108px;
    padding: 12px;
  }

  .platform-flow {
    justify-content: start;
  }

  .regime-pane {
    padding-right: 12px;
    padding-left: 12px;
  }

  .tool {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 88vh;
    border-radius: 8px 8px 0 0;
    transform: none;
  }

  .tool.is-open,
  .tool:target {
    animation-name: sheet-in;
  }

  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* V26 overrides that must stay after the legacy responsive rules. */
@media (min-width: 901px) {
  .topbar.mobile-topbar { display: none; }
}

.shell.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

body .tool {
  z-index: 1000;
}

body .modal-backdrop {
  z-index: 900;
}

@media (max-width: 900px) {
  body { padding-bottom: 0; }
  .topbar.mobile-topbar { display: flex; }
  .app-sidebar .app-nav {
    position: static;
    inset: auto;
    grid-template-columns: 1fr;
  }
}

/* V27 · guía directa de captura SAT y temas de color. */
body[data-theme="jade"] {
  --primary: #13806a;
  --primary-2: #0d6654;
  --surface-2: #eaf6f1;
}

body[data-theme="terracotta"] {
  --primary: #b65f3f;
  --primary-2: #91472e;
  --surface-2: #fbefe9;
}

body[data-theme="violet"] {
  --primary: #7457a6;
  --primary-2: #5b4187;
  --surface-2: #f1edf8;
}

body[data-theme="rose"] {
  --primary: #ad5573;
  --primary-2: #8c405b;
  --surface-2: #faedf2;
}

/* La barra lateral siempre es verde claro, independientemente del tema. */
body .app-sidebar {
  color: #173f31;
  background: linear-gradient(180deg, #e3f6ea 0%, #caead8 100%);
  box-shadow: 10px 0 34px rgba(34, 91, 66, 0.12);
}

body .sidebar-brand b,
body .sidebar-brand span,
body .sidebar-client > span,
body .sidebar-period label,
body .app-sidebar .app-nav > p {
  color: #286b50;
}

body .sidebar-client,
body .sidebar-period {
  border-color: rgba(31, 101, 72, 0.18);
  background: rgba(255,255,255,.48);
}

body .sidebar-client small,
body .sidebar-period small {
  color: #557767;
}

body .sidebar-client > button,
body .sidebar-brand > button,
body .sidebar-period a,
body .sidebar-period button,
body .sidebar-footer button,
body .sidebar-footer a {
  border-color: rgba(31, 101, 72, 0.16);
  color: #174a36;
  background: rgba(255,255,255,.6);
}

body .sidebar-period a:hover,
body .sidebar-period button:hover,
body .sidebar-footer button:hover,
body .sidebar-footer a:hover {
  color: #fff;
  background: #4d9671;
}

body .app-sidebar .app-nav > a,
body .app-sidebar .sidebar-more > summary,
body .app-sidebar .sidebar-more a,
body .app-sidebar .sidebar-more button {
  color: #244f3d;
}

body .app-sidebar .app-nav > a:hover,
body .app-sidebar .sidebar-more a:hover,
body .app-sidebar .sidebar-more button:hover {
  color: #143b2c;
  background: rgba(74, 151, 111, .16);
}

body .app-sidebar .app-nav [data-screen-open].screen-active,
body .app-sidebar .app-nav .nav-primary.screen-active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 22px rgba(38, 92, 67, .22);
}

body .sidebar-more > div,
body .sidebar-footer {
  border-color: rgba(31, 101, 72, .18);
}

.sidebar-theme {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid rgba(31,101,72,.15);
  border-radius: 10px;
  background: rgba(255,255,255,.48);
}

.sidebar-theme > span {
  color: #286b50;
  font-size: .6rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.sidebar-theme > div {
  display: flex;
  gap: 9px;
}

.sidebar-theme button[data-theme-set] {
  width: 25px;
  min-width: 25px;
  min-height: 25px;
  padding: 0;
  border: 3px solid rgba(255,255,255,.85);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(25,65,48,.2);
}

.sidebar-theme button[data-theme-set="jade"] { background: #13806a; }
.sidebar-theme button[data-theme-set="terracotta"] { background: #b65f3f; }
.sidebar-theme button[data-theme-set="violet"] { background: #7457a6; }
.sidebar-theme button[data-theme-set="rose"] { background: #ad5573; }

.sidebar-theme button[data-theme-set].active {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 5px #397b5c;
}

.sidebar-theme small {
  color: #5c796c;
  font-size: .61rem;
  line-height: 1.35;
}

.sat-entry-guide {
  padding: 18px;
  border-top: 5px solid var(--primary);
}

.sat-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.sat-entry-head h2 {
  margin: 3px 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.sat-entry-head p {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
}

.sat-entry-result {
  display: grid;
  min-width: 220px;
  gap: 3px;
  padding: 13px 16px;
  border: 1px solid #badfcf;
  border-radius: 11px;
  background: #eefaf5;
}

.sat-entry-result span,
.sat-entry-result small {
  color: #557167;
  font-size: .69rem;
  font-weight: 800;
}

.sat-entry-result b {
  color: #116a55;
  font-size: 1.45rem;
}

.sat-entry-result.is-pay b { color: #b43832; }
.sat-entry-result.is-favor { border-color: #9fd7c2; background: #eaf8f2; }

.sat-entry-instructions {
  display: grid;
  grid-template-columns: 30px minmax(0,1fr) 30px minmax(0,1fr) 30px minmax(0,1fr);
  gap: 9px;
  margin: 15px 0 10px;
  padding: 13px;
  border-radius: 11px;
  background: #f5f8f7;
}

.sat-entry-instructions > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.sat-entry-instructions p {
  margin: 0;
  color: #526068;
  font-size: .72rem;
  line-height: 1.45;
}

.sat-rounding-rule {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 10px;
  padding: 11px 13px;
  border: 1px solid #a8d7c5;
  border-radius: 10px;
  color: #174d3e;
  background: #edf9f4;
}

.sat-rounding-rule > span {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.sat-rounding-rule p {
  margin: 2px 0 0;
  font-size: .72rem;
  line-height: 1.4;
}

.sat-entry-scope {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid #dfc682;
  border-radius: 10px;
  color: #5f4a13;
  background: #fff9e9;
  font-size: .75rem;
}

.sat-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.sat-entry-card {
  overflow: hidden;
  border: 1px solid #d9e3e6;
  border-radius: 12px;
  background: #fff;
}

.sat-entry-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid #dce5e8;
  background: #f6f9f8;
}

.sat-entry-card > header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sat-entry-card > header span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--primary);
  font-size: .75rem;
  font-weight: 900;
}

.sat-entry-card > header h3 {
  margin: 0;
  font-size: .9rem;
}

.sat-entry-card > header em {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--primary-2);
  background: var(--surface-2);
  font-size: .59rem;
  font-style: normal;
  font-weight: 900;
}

.sat-entry-card h4 {
  margin: 13px 14px 5px;
  color: #36454c;
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sat-entry-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 105px 178px 72px;
  align-items: center;
  gap: 8px;
  margin: 0 12px 6px;
  padding: 9px 9px 9px 11px;
  border: 1px solid #e1e7e9;
  border-radius: 9px;
  background: #fff;
}

.sat-entry-row.capture {
  border-color: #9fd5c1;
  background: #eefaf5;
}

.sat-entry-row.review {
  border-color: #ead39b;
  background: #fffaf0;
}

.sat-entry-row.automatic {
  background: #f4f6f7;
}

.sat-entry-row.source {
  border-style: dashed;
  background: #f7f9fa;
}

.sat-entry-description {
  display: grid;
  gap: 2px;
}

.sat-entry-row span {
  color: #27343a;
  font-size: .72rem;
  font-weight: 800;
}

.sat-entry-row small {
  color: #728087;
  font-size: .61rem;
  line-height: 1.3;
}

.sat-entry-row em {
  color: #6c777c;
  font-size: .55rem;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.sat-entry-row.capture em { color: #08745b; }
.sat-entry-row.review em { color: #8b6209; }
.sat-entry-row.source em { color: #65747a; }

.sat-entry-amounts {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 5px;
}

.sat-entry-amounts > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid #d9e1e3;
  border-radius: 7px;
  background: #f6f8f9;
}

.sat-entry-amounts small {
  font-size: .48rem;
  font-weight: 900;
  letter-spacing: .03em;
}

.sat-entry-amounts b {
  overflow: hidden;
  font-size: .72rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sat-entry-amounts .sat-entry-rounded {
  border-color: #91cdb6;
  color: #075d48;
  background: #dff5eb;
}

.sat-entry-amounts .sat-entry-rounded small,
.sat-entry-amounts .sat-entry-rounded b {
  color: #075d48;
}

.sat-entry-row > button {
  min-height: 31px;
  padding: 5px 7px;
  font-size: .62rem;
}

.sat-entry-row > button.copied {
  background: #398562;
}

.iva-entry-card {
  margin-top: 4px;
  border-top: 4px solid var(--primary);
}

.sat-entry-columns {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
  padding: 3px 0 10px;
}

.sat-entry-determination {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  border-top: 1px solid #dbe5e7;
  background: #f6f9f8;
}

.sat-entry-determination > div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-right: 1px solid #dbe5e7;
}

.sat-entry-determination > div:last-child { border-right: 0; }
.sat-entry-determination span { color: var(--muted); font-size: .66rem; font-weight: 800; }
.sat-entry-determination small { color: #708078; font-size: .58rem; }
.sat-entry-determination b { font-size: 1rem; }

.sat-entry-final-note {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 10px;
  color: #174636;
  background: #e5f6ed;
}

.sat-entry-final-note span { font-size: .72rem; line-height: 1.45; }
.sat-entry-final-note button { min-height: 36px; padding: 7px 11px; font-size: .7rem; }

.sat-entry-guide + .sat-monthly-platform {
  margin-top: 14px;
}

.finance-flow-sources {
  grid-template-columns: minmax(0,1fr) 30px minmax(0,1fr);
}

.regime-bank-sources {
  grid-template-columns: repeat(3,minmax(0,1fr));
}

.bank-source-grid {
  grid-template-columns: repeat(4,minmax(0,1fr));
}

@media (max-width: 1180px) {
  .sat-entry-instructions {
    grid-template-columns: 30px minmax(0,1fr);
  }

  .sat-entry-grid,
  .sat-entry-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sat-entry-guide { padding: 12px; }
  .sat-entry-head { align-items: stretch; flex-direction: column; }
  .sat-entry-result { min-width: 0; }
  .sat-entry-scope { align-items: flex-start; flex-direction: column; }
  .sat-entry-card > header { align-items: flex-start; flex-direction: column; }
  .sat-entry-row { grid-template-columns: minmax(0,1fr) 164px 70px; }
  .sat-entry-description { grid-column: 1; grid-row: 1; }
  .sat-entry-row em { grid-column: 1; grid-row: 2; text-align: left; }
  .sat-entry-amounts { grid-column: 2; grid-row: 1 / span 2; }
  .sat-entry-row > button { grid-column: 3; grid-row: 1 / span 2; }
  .sat-entry-determination { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sat-entry-final-note { align-items: stretch; grid-template-columns: 1fr; }
  .bank-source-grid,
  .regime-bank-sources { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 480px) {
  .sat-entry-row { grid-template-columns: 1fr; }
  .sat-entry-description,
  .sat-entry-row em,
  .sat-entry-amounts,
  .sat-entry-row > button { grid-column: 1; grid-row: auto; }
  .sat-entry-row > button { width: 100%; }
  .sat-entry-determination,
  .bank-source-grid,
  .regime-bank-sources { grid-template-columns: 1fr; }
}
