:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #111315;
  --text: #111315;
  --muted: #667085;
  --line: #e7e9ee;
  --primary: #111315;
  --accent: #0f8b8d;
  --success: #16815c;
  --warning: #b7791f;
  --danger: #c2413a;
  --radius: 24px;
  --shadow: 0 18px 50px rgba(17, 19, 21, .08);
  --sidebar-width: 280px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-strong: #f4f7fb;
    --text: #f4f7fb;
    --muted: #9aa4b2;
    --line: #2a3039;
    --primary: #f4f7fb;
    --accent: #37b9bb;
    --success: #5ed39e;
    --warning: #f0b75d;
    --danger: #f07167;
    --shadow: 0 18px 50px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }

  body {
    background: radial-gradient(circle at top right, rgba(55, 185, 187, .14), transparent 32rem), var(--bg);
  }

  .sidebar,
  .topbar,
  .bottom-nav {
    background: rgba(23, 26, 32, .86);
    border-color: var(--line);
  }

  .card,
  .list-card,
  .finance-card,
  .closure-panel,
  .closure-item,
  .timeline-card,
  .collection-mobile-card,
  .modal-panel,
  .folder-document-item,
  .sheet-scroll,
  .field input,
  .field select,
  .field textarea,
  .status-form select {
    color: var(--text);
    background: var(--surface);
    border-color: var(--line);
  }

  .session-pill,
  .sidebar-toggle,
  .expediente-info,
  .document-upload,
  .document-picker,
  .document-item,
  .folder-documents,
  .folder-document-item,
  .invoice-grid > div,
  .invoice-totals > div,
  .invoice-concept,
  .invoice-documents,
  .collection-mobile-money div,
  .finance-amounts span,
  .finance-route-mini span,
  .closure-dot,
  .timeline-meta span,
  .movement-details summary,
  .finance-owner-note,
  .check-pill,
  .filter-chip,
  .service-show-amount,
  .catalog-action,
  .catalog-meta span,
  .btn-soft,
  .nav-item:hover,
  .nav-item.is-active,
  .bottom-nav a.is-active,
  .status-strip,
  .service-filter-strip,
  .collection-mobile-meta span {
    color: var(--text);
    background: #20242c;
    border-color: var(--line);
  }

  .brand-mark,
  .session-avatar {
    color: #101317;
    background: #f4f7fb;
  }

  .avatar,
  .catalog-avatar {
    color: #dff7f8;
    background: #24444a;
  }

  .badge {
    color: #d9e2ee;
    background: #242a33;
  }

  .badge.success { color: #9cf2c6; background: rgba(94, 211, 158, .16); }
  .badge.warning { color: #ffd38a; background: rgba(240, 183, 93, .16); }
  .badge.danger { color: #ffaaa4; background: rgba(240, 113, 103, .16); }
  .badge.info { color: #9ee7e8; background: rgba(55, 185, 187, .16); }

  .collection-sheet th {
    color: var(--muted);
    background: #20242c;
  }

  .collection-sheet tbody tr:hover { background: #1d222a; }
  .collection-sheet td { border-bottom-color: var(--line); }

  .audit-meta span {
    color: var(--muted);
    background: #20242c;
    border-color: var(--line);
  }

  .payment-instruction,
  .payment-instruction-summary {
    color: var(--text);
    background: #20242c;
    border-color: var(--line);
  }

  .finance-hero-card {
    background: linear-gradient(135deg, rgba(23, 26, 32, .98), rgba(20, 64, 70, .72));
  }

  .finance-progress,
  .skeleton {
    background: #242a33;
  }

  .sheet-pending { color: #ffaaa4; }

  .toast {
    color: #f4f7fb;
    background: #20242c;
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .38);
  }

  .filter-chip.is-active {
    color: #071113;
    background: #7ee4e5;
    border-color: #7ee4e5;
    box-shadow: 0 10px 22px rgba(55, 185, 187, .18);
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at top right, rgba(15, 139, 141, .12), transparent 32rem), var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
p, strong, small, span, h1, h2, h3 { overflow-wrap: anywhere; }

.min-h-dvh { min-height: 100dvh; }
.grid { display: grid; }
.place-items-center { place-items: center; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-10 { padding-top: 40px; padding-bottom: 40px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-5 { margin-top: 20px; }
.text-center { text-align: center; }
.text-xs { font-size: 12px; line-height: 1.4; }
.text-sm { font-size: 14px; line-height: 1.45; }
.text-xl { font-size: 20px; line-height: 1.2; }
.text-2xl { font-size: 24px; line-height: 1.18; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.uppercase { text-transform: uppercase; }
.leading-none { line-height: 1; }
.overflow-x-auto { overflow-x: auto; }
.gap-3 { gap: 12px; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.min-h-12 { min-height: 48px; }
.rounded-2xl { border-radius: 16px; }
.border { border-width: 1px; border-style: solid; }
.border-slate-200 { border-color: #e2e8f0; }
.p-0 { padding: 0; }

.app-shell { display: grid; min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: none;
  width: var(--sidebar-width);
  padding: 24px;
  background: rgba(255, 255, 255, .82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  transition: width .22s ease, padding .22s ease;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand-copy { min-width: 0; white-space: nowrap; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--surface-strong);
  border-radius: 16px;
}
.sidebar-toggle {
  display: grid;
  width: 42px;
  min-height: 38px;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(17, 19, 21, .045);
}
.sidebar-toggle svg { transform: rotate(180deg); transition: transform .22s ease; }
.nav-list { display: grid; gap: 6px; margin-top: 28px; }
.nav-item {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  color: var(--muted);
  border-radius: 16px;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.nav-item:hover, .nav-item.is-active { color: var(--text); background: #eef2f3; }
.nav-item:active, .pressable:active { transform: scale(.98); }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(94px + env(safe-area-inset-top)) 16px 106px;
}
.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: rgba(246, 247, 249, .84);
  border-bottom: 1px solid rgba(231, 233, 238, .72);
  backdrop-filter: blur(18px);
}
.topbar > div:first-child {
  min-width: 0;
}
.topbar > .row {
  flex: 0 0 auto;
  gap: 7px;
}
.topbar .btn {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 15px;
}
.page-title { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 800; }
.subtle { color: var(--muted); }
.session-pill {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 4px;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: transform .18s ease, background .18s ease;
}
.session-pill:active { transform: scale(.98); }
.session-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--surface-strong);
  border-radius: 13px;
  font-size: 13px;
  font-weight: 900;
}
.session-meta { display: none; padding-right: 8px; line-height: 1.05; }
.session-meta strong { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.session-meta small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  min-height: 72px;
  padding: 8px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.bottom-nav a {
  display: grid;
  place-items: center;
  gap: 0;
  min-width: 0;
  min-height: 54px;
  color: var(--muted);
  border-radius: 18px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}
.bottom-nav svg, .nav-item svg, .icon { width: 21px; height: 21px; stroke-width: 2; }
.bottom-nav a.is-active { color: var(--text); background: #eef2f3; }

.grid { display: grid; gap: 14px; }
.metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(231, 233, 238, .9);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(17, 19, 21, .05);
}
.card,
.list-card,
.finance-card,
.closure-panel,
  .timeline-card,
  .collection-mobile-card {
  min-width: 0;
}
.metric-value {
  margin-top: 10px;
  font-size: clamp(24px, 8vw, 38px);
  line-height: 1;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.metric-value.money {
  font-size: clamp(20px, 5.7vw, 30px);
  overflow-wrap: anywhere;
}
.expediente-info {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  background: rgba(246, 247, 249, .78);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.expediente-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.expediente-actions .btn {
  min-height: 40px;
  padding: 0 13px;
  border-radius: 14px;
}
.document-upload {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: rgba(246, 247, 249, .78);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.document-picker {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px dashed color-mix(in srgb, var(--accent) 54%, var(--line));
  border-radius: 18px;
  cursor: pointer;
  font-weight: 850;
}
.document-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.document-list {
  display: grid;
  gap: 8px;
}
.document-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.document-item-main,
.document-item-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}
.document-item-main {
  flex: 1 1 auto;
}
.document-item-actions {
  flex: 0 0 auto;
  gap: 8px;
}
.document-item-actions .btn,
.folder-document-actions .btn {
  min-height: 44px;
}
.btn-icon {
  width: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}
.btn-icon .icon {
  display: block;
}
.document-item span {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.document-item small {
  color: var(--muted);
  font-size: 12px;
}
.talent-document-strip {
  display: grid;
  gap: 8px;
}
.service-folder-list {
  display: grid;
  gap: 14px;
}
.service-folder {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(17, 19, 21, .05);
}
.service-folder-head {
  display: grid;
  gap: 12px;
}
.service-folder-head h3 {
  margin: 8px 0 2px;
  font-size: 18px;
}
.service-folder-amount {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.folder-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.folder-documents {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(246, 247, 249, .78);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.folder-documents-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.folder-document-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.folder-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.folder-document-actions .btn {
  flex: 1 1 0;
  min-height: 44px;
  border-radius: 14px;
}
.folder-document-actions .btn-icon {
  flex: 0 0 44px;
}
.cfdi-document-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 8px;
}
.cfdi-document-actions .btn {
  min-height: 44px;
}
@media (max-width: 560px) {
  .document-item {
    align-items: stretch;
    flex-direction: column;
  }
  .document-item-actions .btn:not(.btn-icon) {
    flex: 1 1 auto;
  }
}
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-head.compact { margin: 0 0 14px; }
.section-head .btn,
.section-head .badge {
  flex: 0 0 auto;
}
.page-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}
.page-actions .btn {
  min-height: 42px;
  padding: 0 13px;
  border-radius: 14px;
}
.dashboard-report-action {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.dashboard-report-action .btn {
  min-height: 42px;
  padding: 0 13px;
  border-radius: 14px;
}
.report-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.report-custom-date {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.report-custom-date[hidden] { display: none; }
.chart-card { margin-top: 14px; }
.mini-chart {
  display: grid;
  height: 180px;
  grid-template-columns: repeat(12, minmax(18px, 1fr));
  align-items: end;
  gap: 7px;
}
.mini-bar {
  display: grid;
  height: 100%;
  grid-template-rows: 1fr auto;
  gap: 8px;
  text-align: center;
}
.mini-bar-fill {
  align-self: end;
  width: 100%;
  min-height: 8px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, #0f8b8d, #1f2937);
  box-shadow: 0 10px 22px rgba(15, 139, 141, .18);
}
.mini-bar small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.users-hero {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.users-hero h2 {
  margin: 10px 0 4px;
  font-size: 26px;
  line-height: 1.05;
  font-weight: 900;
}
.user-editor summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}
.user-editor summary::-webkit-details-marker { display: none; }
.user-card .row { align-items: flex-start; }
.user-identity { display: flex; min-width: 0; align-items: flex-start; gap: 12px; }
.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: var(--surface-strong);
  border-radius: 16px;
  font-weight: 900;
}
.user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.user-actions .btn { min-height: 38px; padding: 0 12px; border-radius: 13px; }
.status-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  background: #eef2f3;
  border-radius: 18px;
  scrollbar-width: none;
}
.status-strip::-webkit-scrollbar { display: none; }
.status-strip button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 850;
}
.status-strip button.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 19, 21, .06);
}
.status-strip button:disabled {
  cursor: not-allowed;
  opacity: .45;
  box-shadow: none;
}
.service-filter-strip {
  display: flex;
  gap: 2px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin-bottom: 14px;
  padding: 1px;
  background: #eef2f3;
  border-radius: 18px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.service-filter-strip::-webkit-scrollbar { display: none; }
.service-filter-strip a {
  display: inline-flex;
  flex: 0 0 86px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 4px;
  color: var(--muted);
  background: transparent;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  scroll-snap-align: start;
}
.service-filter-strip a.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 19, 21, .06);
}
.service-filter-strip span {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 4px;
  color: inherit;
  background: rgba(17, 19, 21, .08);
  border-radius: 999px;
  font-size: 10px;
}
.service-filter-strip a.is-active span {
  background: rgba(17, 19, 21, .1);
}
.action-hint {
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: end center;
  padding: 18px;
  background: rgba(17, 19, 21, .42);
  backdrop-filter: blur(10px);
}
.modal.open {
  display: grid;
}
.modal-panel {
  width: min(100%, 430px);
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  animation: modal-rise .18s ease-out;
}
.modal-panel h3 {
  margin: 12px 0 6px;
  font-size: 20px;
}
.modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.modal-actions form,
.modal-actions button {
  width: 100%;
}
.btn-danger {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 16px;
  cursor: pointer;
  font-weight: 850;
}
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.list { display: grid; gap: 12px; }
.list-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(17, 19, 21, .045);
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.row > * { min-width: 0; }
.list-card > .row,
.card > .row {
  align-items: flex-start;
}
.row-tight { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 8px; }
.service-show-head {
  display: grid;
  gap: 12px;
}
.service-show-title {
  min-width: 0;
}
.service-show-amount {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  align-items: center;
  padding: 0 12px;
  background: rgba(238, 242, 243, .76);
  border-radius: 16px;
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
}
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--muted);
  background: #eef2f3;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}
.filter-chip.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 10px 22px rgba(17, 19, 21, .12);
}
.filter-chip span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  color: inherit;
  background: rgba(255, 255, 255, .22);
  border-radius: 999px;
  font-size: 11px;
}
.filter-chip:not(.is-active) span {
  background: rgba(17, 19, 21, .08);
}
.invoice-request-card { gap: 14px; }
.invoice-head { align-items: flex-start; }
.invoice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.invoice-grid > div,
.invoice-totals > div,
.invoice-concept,
.invoice-documents {
  padding: 12px;
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.invoice-documents {
  display: grid;
  gap: 8px;
}
.mini-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.invoice-grid strong,
.invoice-totals strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.invoice-concept p { margin: 0; line-height: 1.45; }
.invoice-totals {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.invoice-actions { align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
.invoice-actions .btn,
.invoice-actions .status-form {
  flex: 1 1 100%;
}
.payment-instruction {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: rgba(246, 247, 249, .78);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.payment-instruction-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.payment-instruction-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.payment-instruction-fields[hidden] { display: none; }
.payment-instruction-summary {
  display: grid;
  gap: 4px;
  padding: 13px;
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.payment-instruction-summary p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}
.status-form {
  display: flex;
  flex: 1 1 260px;
  gap: 8px;
}
.status-form select {
  flex: 1;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.sheet-card { padding: 14px; }
.collection-filters { margin-bottom: 14px; }
.collection-filters form {
  display: grid;
  gap: 12px;
}
.collection-filters input[type="date"] {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.collection-check {
  min-height: 52px;
  align-self: end;
  justify-content: center;
}
.collection-filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}
.collection-filter-actions .btn:last-child {
  grid-column: 1 / -1;
}
.sheet-scroll {
  display: none;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.collection-sheet {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.collection-sheet th,
.collection-sheet td {
  padding: 12px 11px;
  border-bottom: 1px solid #eef1f4;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.collection-sheet th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475467;
  background: #f7f9fa;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.collection-sheet tbody tr:hover { background: #fbfcfd; }
.collection-sheet small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.sheet-link {
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}
.sheet-pending {
  color: #8a2520;
  font-weight: 900;
}
.audit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.audit-meta span {
  max-width: 220px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  background: #f8fafb;
  font-size: 12px;
}
.collection-mobile-list {
  display: grid;
  gap: 10px;
}
.collection-mobile-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(17, 19, 21, .04);
}
.collection-mobile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.collection-mobile-head .badge { flex: 0 0 auto; }
.collection-mobile-money {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.collection-mobile-money div {
  min-width: 0;
  padding: 11px;
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.collection-mobile-money small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.collection-mobile-money strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
}
.collection-mobile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.collection-mobile-meta span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 9px;
  color: var(--muted);
  background: #f3f6f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.commission-back {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  margin: -4px 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}
.commission-summary-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.commission-summary-bar div {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.commission-summary-bar div:nth-child(2n) { border-right: 0; }
.commission-summary-bar div:nth-last-child(-n+2) { border-bottom: 0; }
.commission-summary-bar small,
.commission-row-values small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.commission-summary-bar strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
}
.commission-filters {
  margin-bottom: 14px;
}
.commission-filters form {
  display: grid;
  gap: 10px;
}
.commission-custom-date[hidden] { display: none; }
.commission-sheet { padding: 14px; }
.commission-mobile-list {
  display: grid;
  border-top: 1px solid var(--line);
}
.commission-mobile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  gap: 8px;
  min-width: 0;
  padding: 13px 2px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.commission-row-main,
.commission-row-values span {
  min-width: 0;
}
.commission-row-main strong,
.commission-row-main small {
  display: block;
}
.commission-row-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.commission-row-values {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.commission-row-values strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}
.commission-chevron {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
}
.commission-chevron .icon,
.commission-open .icon {
  width: 18px;
  height: 18px;
}
.commission-table-wrap { display: none; }
.commission-open {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.commission-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}
.commission-pagination .btn {
  width: 44px;
  min-height: 44px;
  padding: 0;
}
.finance-section { margin-top: 18px; }
.closure-panel {
  display: grid;
  gap: 14px;
  padding: 15px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 22px;
}
.closure-head {
  display: grid;
  gap: 12px;
}
.closure-head h3 {
  margin: 8px 0 4px;
  font-size: 17px;
}
.closure-list {
  display: grid;
  gap: 8px;
}
.closure-item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.closure-dot {
  display: inline-flex;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: #eef2f3;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 950;
}
.closure-item.is-ready .closure-dot {
  color: #0d4b38;
  background: rgba(94, 211, 158, .28);
}
.closure-item strong,
.closure-item small {
  display: block;
}
.closure-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.finance-hero-card {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  padding: 18px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(223,247,248,.78));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 14px 30px rgba(17, 19, 21, .055);
}
.finance-route-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.finance-route-mini span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.finance-grid {
  display: grid;
  gap: 12px;
}
.finance-card {
  display: grid;
  gap: 13px;
  padding: 16px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(17, 19, 21, .045);
}
.finance-progress {
  height: 9px;
  overflow: hidden;
  background: #eef2f3;
  border-radius: 999px;
}
.finance-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: inherit;
}
.finance-amounts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.finance-amounts span {
  min-width: 0;
  padding: 10px;
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.finance-amounts small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.quick-entry {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.quick-entry summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  border-radius: 15px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}
.quick-entry summary::-webkit-details-marker { display: none; }
.quick-entry form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.finance-owner-note {
  margin: 0;
  padding: 11px 12px;
  color: var(--muted);
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 750;
}
.timeline-section {
  margin-top: 18px;
}
.timeline-list {
  position: relative;
  display: grid;
  gap: 12px;
}
.timeline-list::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 13px;
  width: 2px;
  background: var(--line);
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
}
.timeline-dot {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  margin-top: 8px;
  background: #eef2f3;
  border: 5px solid var(--surface);
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
}
.timeline-dot.solicitud { background: #f0b75d; }
.timeline-dot.cfdi { background: #37b9bb; }
.timeline-dot.movimiento { background: #5ed39e; }
.timeline-dot.bitacora { background: #a8b1bd; }
.timeline-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(17, 19, 21, .04);
}
.timeline-top {
  display: grid;
  align-items: flex-start;
  gap: 12px;
}
.timeline-top .amount {
  width: fit-content;
  font-size: 14px;
}
.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.timeline-meta span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  color: var(--muted);
  background: #f3f6f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}
.movement-row { grid-template-columns: minmax(0, 1fr); }
.movement-details { margin-top: 14px; }
.movement-details summary {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--text);
  background: #eef2f3;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}
.movement-details summary::-webkit-details-marker { display: none; }
.movement-details .list { margin-top: 12px; }
.movement-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.movement-side .btn {
  flex: 1 1 130px;
}
.catalog-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  max-width: 100%;
  gap: 8px;
}
.catalog-tabs .btn {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 14px;
  white-space: nowrap;
  font-size: 14px;
}
.catalog-card {
  gap: 14px;
}
.catalog-main {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 12px;
}
.catalog-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--surface-strong);
  border-radius: 15px;
  font-weight: 900;
}
.catalog-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.catalog-copy strong {
  line-height: 1.2;
}
.catalog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.catalog-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  color: var(--muted);
  background: rgba(238, 242, 243, .72);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.catalog-actions {
  display: flex;
  width: 100%;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.catalog-actions::-webkit-scrollbar { display: none; }
.catalog-actions .badge,
.catalog-action {
  flex: 0 0 auto;
}
.catalog-action {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: var(--text);
  background: #eef2f3;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.stack { display: grid; gap: 10px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 800; }

.badge {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: #2f3a45;
  background: #eef2f3;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.success { color: #075f43; background: #dff7ec; }
.badge.warning { color: #7a4d10; background: #fff1d6; }
.badge.danger { color: #8a2520; background: #ffe1df; }
.badge.info { color: #075b66; background: #dff7f8; }
.badge-wrap {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.2;
}

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  text-align: center;
  overflow-wrap: anywhere;
}
.btn-primary { color: #fff; background: var(--primary); box-shadow: 0 12px 26px rgba(17, 19, 21, .18); }
.btn-soft { color: var(--text); background: #eef2f3; }
.btn-accent { color: #fff; background: var(--accent); }
.btn-full { width: 100%; }
.fab {
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: 35;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 20px;
  color: #fff;
  background: #111315;
  box-shadow: 0 16px 34px rgba(17, 19, 21, .22);
}

.form-grid { display: grid; gap: 14px; }
.field { display: grid; min-width: 0; gap: 7px; }
.field label { color: #344054; font-size: 13px; font-weight: 800; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  transition: border .2s ease, box-shadow .2s ease;
}
.field textarea { min-height: 112px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 139, 141, .14);
}
.money-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.check-pill {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #f3f6f7;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.check-pill input {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  accent-color: var(--accent);
}
.check-pill:has(input:checked) {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 10px 22px rgba(15, 139, 141, .16);
}

.toast-wrap { position: fixed; top: 78px; right: 14px; left: 14px; z-index: 80; display: grid; gap: 10px; }
.toast { padding: 14px 16px; color: #fff; background: var(--surface-strong); border-radius: 18px; box-shadow: var(--shadow); }
.empty { padding: 28px; text-align: center; }
.skeleton { min-height: 74px; background: linear-gradient(90deg, #eef1f4, #f9fafb, #eef1f4); background-size: 220% 100%; animation: shimmer 1.2s infinite; border-radius: 22px; }

@keyframes shimmer { to { background-position-x: -220%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 380px) {
  .main { padding-right: 12px; padding-left: 12px; }
  .card,
  .list-card,
  .finance-card,
  .timeline-card { padding: 14px; }
  .bottom-nav {
    right: 8px;
    left: 8px;
    gap: 2px;
    padding: 7px;
    border-radius: 22px;
  }
  .bottom-nav a {
    font-size: 10px;
    border-radius: 15px;
  }
  .filter-chip {
    min-height: 40px;
    padding: 0 11px;
    font-size: 12px;
  }
  .invoice-totals,
  .finance-amounts,
  .collection-mobile-money {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 768px) {
  .sidebar { display: block; }
  .topbar { left: var(--sidebar-width); padding: 12px 28px; }
  .topbar .btn { width: auto; min-width: 44px; padding: 0 14px; }
  .main {
    width: calc(100% - var(--sidebar-width));
    max-width: none;
    min-width: 0;
    margin-left: var(--sidebar-width);
    padding: 94px 28px 42px;
    container-name: workspace;
    container-type: inline-size;
  }
  .bottom-nav { display: none; }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .money-check { grid-template-columns: minmax(0, 1fr) auto; }
  .catalog-tabs { display: flex; width: fit-content; }
  .session-meta { display: block; }
  .catalog-tabs .btn { width: auto; padding: 0 12px; }
  .catalog-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .catalog-actions {
    width: auto;
    justify-content: flex-end;
  }
  .service-folder-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .folder-document-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .folder-document-actions .btn {
    flex: 0 0 auto;
    min-width: 76px;
  }
  .collection-filters form { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
  .commission-filters form { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
  .commission-summary-bar {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
  }
  .commission-summary-bar div,
  .commission-summary-bar div:nth-child(2n) {
    background: var(--surface);
    border-right: 0;
    border-bottom: 0;
  }
  .collection-filter-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .collection-filter-actions .btn { min-width: 112px; }
  .invoice-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .invoice-totals { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .payment-instruction-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-instruction-wide { grid-column: 1 / -1; }
  .invoice-actions .btn,
  .invoice-actions .status-form { flex: 0 1 auto; }
  .service-show-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .service-show-amount {
    justify-self: end;
  }
  .finance-hero-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .closure-head { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .closure-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-grid { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
  .movement-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .movement-side { justify-content: flex-end; }
  .movement-side .btn { flex: 0 0 auto; }
  .timeline-top { grid-template-columns: minmax(0, 1fr) auto; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 768px) and (max-width: 1199px) {
  html,
  body { --sidebar-width: 220px; }
  .topbar { padding-right: 18px; padding-left: 18px; }
  .main { padding-right: 18px; padding-left: 18px; }
}

@media (min-width: 768px) and (max-width: 899px) {
  .session-meta { display: none; }
}

@media (min-width: 1200px) {
  .topbar { padding-right: 30px; padding-left: 30px; }
  .main { padding-right: 34px; padding-left: 34px; }
  .fab { bottom: 32px; }
}

@container workspace (max-width: 619px) {
  .form-grid.two { grid-template-columns: minmax(0, 1fr); }
  .form-grid.two .md\:col-span-2 { grid-column: auto; }
}

@container workspace (min-width: 920px) {
  .sheet-scroll { display: block; }
  .collection-mobile-list { display: none; }
  .commission-mobile-list { display: none; }
  .commission-table-wrap { display: block; overflow-x: auto; }
}

@supports not (container-type: inline-size) {
  @media (min-width: 1200px) {
    .sheet-scroll { display: block; }
    .collection-mobile-list { display: none; }
    .commission-mobile-list { display: none; }
    .commission-table-wrap { display: block; overflow-x: auto; }
  }
}

@media (min-width: 768px) {
  html.sidebar-collapsed,
  body.sidebar-collapsed { --sidebar-width: 86px; }
  body.sidebar-collapsed .sidebar { padding: 18px 14px; }
  body.sidebar-collapsed .brand { justify-content: center; }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-label { display: none; }
  body.sidebar-collapsed .sidebar-head { display: grid; justify-items: center; }
  body.sidebar-collapsed .sidebar-toggle svg { transform: rotate(0deg); }
  body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
}

@media (prefers-color-scheme: dark) {
  body {
    background: radial-gradient(circle at top right, rgba(55, 185, 187, .14), transparent 32rem), var(--bg);
  }

  .sidebar,
  .topbar,
  .bottom-nav {
    background: rgba(23, 26, 32, .86);
    border-color: var(--line);
  }

  .card,
  .list-card,
  .finance-card,
  .closure-panel,
  .closure-item,
  .timeline-card,
  .collection-mobile-card,
  .modal-panel,
  .sheet-scroll,
  .field input,
  .field select,
  .field textarea,
  .status-form select {
    color: var(--text);
    background: var(--surface);
    border-color: var(--line);
  }

  .session-pill,
  .sidebar-toggle,
  .expediente-info,
  .document-upload,
  .document-picker,
  .document-item,
  .folder-documents,
  .invoice-grid > div,
  .invoice-totals > div,
  .invoice-concept,
  .collection-mobile-money div,
  .finance-amounts span,
  .finance-route-mini span,
  .closure-dot,
  .timeline-meta span,
  .movement-details summary,
  .finance-owner-note,
  .check-pill,
  .filter-chip,
  .service-show-amount,
  .catalog-action,
  .catalog-meta span,
  .btn-soft,
  .nav-item:hover,
  .nav-item.is-active,
  .bottom-nav a.is-active,
  .status-strip,
  .collection-mobile-meta span {
    color: var(--text);
    background: #20242c;
    border-color: var(--line);
  }

  .brand-mark,
  .session-avatar {
    color: #101317;
    background: #f4f7fb;
  }

  .avatar,
  .catalog-avatar {
    color: #dff7f8;
    background: #24444a;
  }

  .badge {
    color: #d9e2ee;
    background: #242a33;
  }

  .badge.success { color: #9cf2c6; background: rgba(94, 211, 158, .16); }
  .badge.warning { color: #ffd38a; background: rgba(240, 183, 93, .16); }
  .badge.danger { color: #ffaaa4; background: rgba(240, 113, 103, .16); }
  .badge.info { color: #9ee7e8; background: rgba(55, 185, 187, .16); }

  .collection-sheet th {
    color: var(--muted);
    background: #20242c;
  }

  .collection-sheet tbody tr:hover { background: #1d222a; }
  .collection-sheet td { border-bottom-color: var(--line); }

  .audit-meta span {
    color: var(--muted);
    background: #20242c;
    border-color: var(--line);
  }

  .payment-instruction,
  .payment-instruction-summary {
    color: var(--text);
    background: #20242c;
    border-color: var(--line);
  }

  .finance-hero-card {
    background: linear-gradient(135deg, rgba(23, 26, 32, .98), rgba(20, 64, 70, .72));
  }

  .finance-progress,
  .skeleton {
    background: #242a33;
  }

  .sheet-pending { color: #ffaaa4; }

  .toast {
    color: #f4f7fb;
    background: #20242c;
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .38);
  }

  .filter-chip.is-active {
    color: #071113;
    background: #7ee4e5;
    border-color: #7ee4e5;
    box-shadow: 0 10px 22px rgba(55, 185, 187, .18);
  }

  .btn-primary {
    color: #071113;
    background: #7ee4e5;
    box-shadow: 0 12px 26px rgba(55, 185, 187, .22);
  }

  .fab {
    color: #071113;
    background: #7ee4e5;
    box-shadow: 0 16px 34px rgba(55, 185, 187, .28);
  }

  .status-strip button.is-active {
    color: #071113;
    background: #7ee4e5;
    box-shadow: 0 8px 18px rgba(55, 185, 187, .18);
  }

  .service-filter-strip {
    background: #20242c;
    border: 1px solid var(--line);
  }

  .service-filter-strip span {
    background: rgba(244, 247, 251, .1);
  }

  .service-filter-strip a.is-active {
    color: #071113;
    background: #7ee4e5;
    box-shadow: 0 8px 18px rgba(55, 185, 187, .18);
  }

  .service-filter-strip a.is-active span {
    background: rgba(7, 17, 19, .12);
  }

  .document-upload {
    background: transparent;
  }

  .document-picker,
  .document-item {
    background: #20242c;
  }
}
