* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f5f7;
  color: #111827;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(97, 64, 255, 0.12), transparent 30%),
    linear-gradient(135deg, #f8fafc, #eef2ff);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.12);
  border: 1px solid #e5e7eb;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #4f46e5;
  color: #fff;
  font-weight: 700;
}

h1 {
  font-size: 24px;
  margin: 0;
  line-height: 1.2;
}

.subtitle {
  color: #6b7280;
  margin: 6px 0 0;
  font-size: 14px;
}

label {
  display: block;
  margin: 16px 0 7px;
  font-weight: 700;
  font-size: 14px;
}

input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 16px;
}

input:focus {
  outline: 2px solid #c7d2fe;
  border-color: #6366f1;
}

button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  margin-top: 22px;
  background: #4f46e5;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

button.secondary {
  background: #111827;
}

button.danger {
  background: #b91c1c;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.message {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  display: none;
  font-size: 14px;
}

.message.error {
  display: block;
  background: #fee2e2;
  color: #991b1b;
}

.message.success {
  display: block;
  background: #dcfce7;
  color: #166534;
}

.dashboard {
  min-height: 100vh;
}

.topbar {
  background: #111827;
  color: #fff;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 20px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.card .number {
  font-size: 32px;
  font-weight: 800;
  margin-top: 8px;
}

.card .label {
  color: #6b7280;
  font-size: 14px;
}

.panel {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  margin-top: 20px;
  border: 1px solid #e5e7eb;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row button {
  width: auto;
}

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}


.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a {
  color: #ffffff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.14);
  padding: 9px 12px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 16px;
  font-family: inherit;
  background: #ffffff;
}

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

.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar label {
  margin-top: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 11px 9px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f9fafb;
  font-weight: 800;
}

.status-badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-verified {
  background: #dcfce7;
  color: #166534;
}

.status-not_found {
  background: #fee2e2;
  color: #991b1b;
}

.status-needs_review {
  background: #e0e7ff;
  color: #3730a3;
}

.status-voided {
  background: #e5e7eb;
  color: #374151;
}

.inline-actions {
  display: flex;
  gap: 8px;
  min-width: 260px;
}

.inline-actions select,
.inline-actions input {
  font-size: 14px;
  padding: 8px;
}

.inline-actions button {
  margin-top: 0;
  padding: 8px 10px;
  font-size: 13px;
  width: auto;
}

.btn-small {
  margin-top: 0;
  padding: 8px 10px;
  font-size: 13px;
  width: auto;
}

@media (max-width: 760px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }
}

.status-registered {
  background: #e0e7ff;
  color: #3730a3;
}

.status-paid {
  background: #dcfce7;
  color: #166534;
}


.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.report-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
}

.report-card .label {
  color: #6b7280;
  font-size: 14px;
}

.report-card .amount {
  font-size: 26px;
  font-weight: 900;
  margin-top: 8px;
}

.report-card.positive .amount {
  color: #166534;
}

.report-card.negative .amount {
  color: #991b1b;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 860px) {
  .report-summary {
    grid-template-columns: 1fr 1fr;
  }

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


/* v14 professional UI improvements */
.topbar {
  gap: 18px;
  flex-wrap: wrap;
}

.topbar > div:first-child {
  min-width: 260px;
}

.topbar h1 {
  letter-spacing: 0.2px;
  margin-bottom: 4px;
}

.nav-links {
  align-items: center;
}

.nav-links a {
  color: #f9fafb !important;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-decoration: none !important;
  transition: 0.15s ease;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.24);
}

.nav-links a.active {
  background: #4f46e5;
  color: #ffffff !important;
  border-color: #818cf8;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.home-hero {
  background: linear-gradient(135deg, #ffffff, #eef2ff);
  border: 1px solid #e5e7eb;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.action-card {
  display: block;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  transition: 0.15s ease;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: #a5b4fc;
}

.action-card strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

.action-card span {
  display: block;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.35;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.profile-field {
  padding: 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.profile-field .label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-field .value {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 16px;
}

.export-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
}

.export-box h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.export-box p {
  margin-top: 0;
  color: #6b7280;
  font-size: 13px;
  min-height: 34px;
}

.export-box button {
  margin-top: 12px;
}

.report-summary {
  align-items: stretch;
}

.report-card {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.compact-summary {
  display: grid;
  gap: 10px;
}

.compact-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.compact-summary-row:last-child {
  border-bottom: 0;
}

.compact-summary-row strong {
  font-size: 16px;
}

@media (max-width: 920px) {
  .home-actions,
  .export-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 620px) {
  .home-actions,
  .export-grid,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 18px;
  }

  .nav-links a {
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* v15 navbar orange button fix */
.topbar {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%) !important;
  align-items: flex-start;
}

.topbar .row {
  align-items: flex-start;
}

.nav-links {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  align-items: center !important;
  justify-content: flex-end;
}

.nav-links a.nav-button,
.nav-links a,
.nav-links a:visited,
.nav-links a:link,
.nav-links a:hover,
.nav-links a:active {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 118px;
  padding: 12px 18px !important;
  border-radius: 14px !important;
  text-decoration: none !important;
  font-weight: 800 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  letter-spacing: 0.01em;
  color: #fff7ed !important;
  background: linear-gradient(180deg, #fb923c 0%, #ea580c 100%) !important;
  border: 1px solid #fdba74 !important;
  box-shadow: 0 10px 22px rgba(234, 88, 12, 0.28) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease !important;
}

.nav-links a.nav-button:hover,
.nav-links a:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 14px 26px rgba(234, 88, 12, 0.34) !important;
}

.nav-links a.nav-button.active,
.nav-links a.active,
.nav-links a.nav-button[aria-current="page"] {
  background: linear-gradient(180deg, #c2410c 0%, #9a3412 100%) !important;
  color: #ffffff !important;
  border: 2px solid #ffedd5 !important;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.32), 0 14px 26px rgba(154, 52, 18, 0.38) !important;
}

@media (max-width: 900px) {
  .topbar {
    gap: 14px;
  }

  .topbar .row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .nav-links {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .nav-links a.nav-button,
  .nav-links a {
    min-width: 0;
    width: 100%;
    font-size: 15px !important;
    min-height: 46px;
    padding: 11px 14px !important;
  }
}


/* v16 premium header with church logo */
.premium-header {
  padding: 22px 30px !important;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98)),
    radial-gradient(circle at top left, rgba(251, 146, 60, 0.20), transparent 34%) !important;
  border-bottom: 1px solid rgba(253, 186, 116, 0.20);
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 24px !important;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 320px;
}

.church-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  padding: 3px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.25), 0 0 0 2px rgba(253, 186, 116, 0.35);
  flex: 0 0 auto;
}

.brand-copy h1 {
  margin: 0;
  font-size: 24px !important;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.church-name {
  margin-top: 4px;
  color: #fed7aa;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.user-line {
  margin-top: 6px;
  color: #e5e7eb;
  font-size: 14px;
  line-height: 1.25;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.header-actions .nav-links {
  display: flex !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  justify-content: flex-end;
  margin-right: 4px;
}

.header-actions .nav-links a.nav-button,
.header-actions .nav-links a,
.header-actions .nav-links a:visited,
.header-actions .nav-links a:link {
  min-height: 48px !important;
  min-width: 112px !important;
  padding: 13px 18px !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #f97316 0%, #ea580c 100%) !important;
  border: 1px solid rgba(255, 237, 213, 0.65) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  box-shadow: 0 12px 22px rgba(234, 88, 12, 0.30) !important;
}

.header-actions .nav-links a.nav-button.active,
.header-actions .nav-links a.active {
  background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 100%) !important;
  color: #9a3412 !important;
  border: 2px solid #fb923c !important;
  box-shadow: 0 0 0 4px rgba(251, 146, 60, 0.22), 0 14px 28px rgba(251, 146, 60, 0.25) !important;
}

.notification-button,
.user-chip,
.logout-button {
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.20);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 900;
}

.notification-button {
  position: relative;
  width: 52px;
  padding: 0;
  margin: 0;
  background: rgba(255,255,255,0.10);
  color: #ffffff;
  box-shadow: none;
}

.notification-dot {
  position: absolute;
  top: 11px;
  right: 12px;
  width: 9px;
  height: 9px;
  background: #ef4444;
  border: 2px solid #111827;
  border-radius: 50%;
}

.user-chip {
  gap: 9px;
  padding: 6px 14px 6px 8px;
  background: rgba(255,255,255,0.10);
  color: #ffffff !important;
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(180deg, #fb923c, #c2410c);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.logout-button {
  width: auto !important;
  margin: 0 !important;
  padding: 0 20px !important;
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%) !important;
  color: #ffffff !important;
  border-color: rgba(254, 202, 202, 0.55) !important;
  box-shadow: 0 12px 22px rgba(185, 28, 28, 0.28) !important;
}

.login-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  flex: 0 0 auto;
}

@media (max-width: 1120px) {
  .premium-header {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .header-actions .nav-links {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .premium-header {
    padding: 18px !important;
  }

  .brand-area {
    min-width: 0;
    width: 100%;
    align-items: flex-start;
  }

  .church-logo {
    width: 62px;
    height: 62px;
  }

  .brand-copy h1 {
    font-size: 20px !important;
  }

  .church-name {
    font-size: 12px;
  }

  .header-actions .nav-links {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .header-actions .nav-links a.nav-button,
  .header-actions .nav-links a {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    font-size: 14px !important;
  }

  .notification-button,
  .user-chip,
  .logout-button {
    min-height: 46px;
  }

  .logout-button {
    flex: 1;
  }
}


/* v17 verified header correction */
.premium-header{background:linear-gradient(180deg,#0f172a 0%,#111827 100%)!important;color:#fff!important;padding:18px 28px!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:16px!important;border-bottom:1px solid rgba(253,186,116,.22)!important;}
.brand-area{display:flex!important;align-items:center!important;gap:16px!important;width:100%!important;min-width:0!important;}
.church-logo{width:76px!important;height:76px!important;max-width:76px!important;max-height:76px!important;object-fit:contain!important;border-radius:50%!important;background:rgba(255,255,255,.07)!important;padding:3px!important;box-shadow:0 10px 26px rgba(0,0,0,.25),0 0 0 2px rgba(253,186,116,.32)!important;flex:0 0 76px!important;display:block!important;}
.brand-copy{min-width:0!important;}.brand-copy h1{margin:0!important;font-size:25px!important;line-height:1.15!important;color:#fff!important;letter-spacing:.01em!important;}.church-name{margin-top:4px!important;color:#fed7aa!important;font-size:13px!important;font-weight:800!important;line-height:1.25!important;}.user-line{margin-top:6px!important;color:#e5e7eb!important;font-size:14px!important;line-height:1.25!important;}.header-actions{display:grid!important;grid-template-columns:1fr auto auto auto!important;align-items:center!important;gap:12px!important;width:100%!important;}.header-actions .nav-links{display:flex!important;flex-wrap:wrap!important;justify-content:flex-start!important;align-items:center!important;gap:10px!important;margin:0!important;}.header-actions .nav-links a.nav-button,.header-actions .nav-links a,.header-actions .nav-links a:visited,.header-actions .nav-links a:link,.header-actions .nav-links a:hover,.header-actions .nav-links a:active{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-height:46px!important;min-width:104px!important;padding:12px 16px!important;border-radius:999px!important;text-decoration:none!important;font-size:15px!important;font-weight:900!important;line-height:1!important;color:#fff!important;background:linear-gradient(180deg,#fb923c 0%,#ea580c 100%)!important;border:1px solid rgba(255,237,213,.70)!important;box-shadow:0 10px 20px rgba(234,88,12,.28)!important;}.header-actions .nav-links a.nav-button.active,.header-actions .nav-links a.active{background:linear-gradient(180deg,#fff7ed 0%,#fed7aa 100%)!important;color:#9a3412!important;border:2px solid #fb923c!important;box-shadow:0 0 0 4px rgba(251,146,60,.22),0 12px 24px rgba(251,146,60,.24)!important;}.notification-button,.user-chip,.logout-button{min-height:46px!important;border-radius:999px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;text-decoration:none!important;font-weight:900!important;white-space:nowrap!important;}.notification-button{position:relative!important;width:50px!important;padding:0!important;margin:0!important;background:rgba(255,255,255,.10)!important;color:#fff!important;border:1px solid rgba(255,255,255,.22)!important;box-shadow:none!important;}.notification-dot{position:absolute!important;top:10px!important;right:11px!important;width:9px!important;height:9px!important;background:#ef4444!important;border:2px solid #111827!important;border-radius:50%!important;}.user-chip{gap:8px!important;padding:6px 14px 6px 8px!important;background:rgba(255,255,255,.10)!important;color:#fff!important;border:1px solid rgba(255,255,255,.22)!important;}.avatar-circle{width:32px!important;height:32px!important;border-radius:50%!important;display:inline-grid!important;place-items:center!important;background:linear-gradient(180deg,#fb923c,#c2410c)!important;color:#fff!important;font-size:13px!important;font-weight:900!important;}.logout-button{width:auto!important;margin:0!important;padding:0 20px!important;background:linear-gradient(180deg,#dc2626 0%,#991b1b 100%)!important;color:#fff!important;border:1px solid rgba(254,202,202,.55)!important;box-shadow:0 10px 20px rgba(185,28,28,.26)!important;}.login-logo{width:74px!important;height:74px!important;max-width:74px!important;max-height:74px!important;object-fit:contain!important;border-radius:50%!important;flex:0 0 74px!important;display:block!important;}@media(max-width:900px){.premium-header{padding:16px 22px!important}.brand-copy h1{font-size:22px!important}.header-actions{grid-template-columns:1fr!important}.notification-button,.user-chip,.logout-button{justify-self:start!important}.header-actions .nav-links{width:100%!important}.header-actions .nav-links a.nav-button,.header-actions .nav-links a{min-width:112px!important}}@media(max-width:620px){.brand-area{align-items:flex-start!important}.church-logo{width:62px!important;height:62px!important;max-width:62px!important;max-height:62px!important;flex-basis:62px!important}.brand-copy h1{font-size:19px!important}.church-name{font-size:12px!important}.header-actions .nav-links{display:grid!important;grid-template-columns:1fr 1fr!important;width:100%!important}.header-actions .nav-links a.nav-button,.header-actions .nav-links a{width:100%!important;min-width:0!important;font-size:14px!important}.logout-button{width:100%!important}}

/* v17 final exact nav widths */

.header-actions .nav-links a.nav-button,.header-actions .nav-links a,.header-actions .nav-links a:visited,.header-actions .nav-links a:link,.header-actions .nav-links a:hover,.header-actions .nav-links a:active{width:112px!important;min-width:112px!important;max-width:112px!important;padding-left:10px!important;padding-right:10px!important;}
@media(max-width:900px){.header-actions{grid-template-columns:1fr!important}.header-actions .nav-links{display:flex!important;width:100%!important}.header-actions .nav-links a.nav-button,.header-actions .nav-links a{width:112px!important;min-width:112px!important;max-width:112px!important}}
@media(max-width:620px){.header-actions .nav-links a.nav-button,.header-actions .nav-links a{width:100%!important;min-width:0!important;max-width:none!important}}


/* v18 clean header + Settings profile photo + income form alignment */
.header-actions {
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  align-items: center !important;
  gap: 16px !important;
  width: 100% !important;
}

.notification-button,
.user-chip {
  display: none !important;
}

.header-actions .nav-links {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  margin: 0 !important;
}

.header-actions .nav-links a.nav-button,
.header-actions .nav-links a,
.header-actions .nav-links a:visited,
.header-actions .nav-links a:link,
.header-actions .nav-links a:hover,
.header-actions .nav-links a:active {
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  min-height: 48px !important;
  padding: 13px 12px !important;
  border-radius: 999px !important;
  text-decoration: none !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  color: #ffffff !important;
  background: linear-gradient(180deg, #fb923c 0%, #ea580c 100%) !important;
  border: 1px solid rgba(255, 237, 213, 0.75) !important;
  box-shadow: 0 10px 22px rgba(234, 88, 12, 0.30) !important;
}

.header-actions .nav-links a.nav-button.active,
.header-actions .nav-links a.active {
  background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 100%) !important;
  color: #9a3412 !important;
  border: 2px solid #fb923c !important;
  box-shadow: 0 0 0 4px rgba(251, 146, 60, 0.22), 0 12px 24px rgba(251, 146, 60, 0.24) !important;
}

.logout-button {
  justify-self: end !important;
  min-height: 48px !important;
  width: auto !important;
  min-width: 170px !important;
  margin: 0 !important;
  padding: 0 24px !important;
  border-radius: 999px !important;
}

#incomeForm .form-grid,
.income-form-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: start !important;
  column-gap: 20px !important;
  row-gap: 18px !important;
}

#incomeForm .form-grid > div,
.income-form-grid > div {
  min-width: 0 !important;
}

#incomeForm input,
#incomeForm select,
#incomeForm textarea {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 54px !important;
  display: block !important;
}

#incomeForm textarea {
  min-height: 118px !important;
}

#incomeForm .full,
.income-form-grid .full {
  grid-column: 1 / -1 !important;
}

.profile-photo-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  border: 1px solid #fed7aa;
  border-radius: 16px;
  margin-bottom: 20px;
}

.profile-photo-preview {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fb923c, #c2410c);
  color: #ffffff;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(234, 88, 12, 0.22);
  border: 3px solid #ffffff;
}

.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.profile-photo-actions h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.profile-photo-actions p {
  margin: 0 0 12px;
  color: #6b7280;
}

.profile-photo-actions input[type="file"] {
  padding: 12px;
  background: #ffffff;
}

.photo-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.photo-buttons button {
  width: auto !important;
  margin-top: 0 !important;
}

@media (max-width: 900px) {
  .header-actions {
    grid-template-columns: 1fr !important;
  }

  .logout-button {
    justify-self: start !important;
  }

  #incomeForm .form-grid,
  .income-form-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 620px) {
  .header-actions .nav-links {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
  }

  .header-actions .nav-links a.nav-button,
  .header-actions .nav-links a {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  .logout-button {
    width: 100% !important;
    min-width: 0 !important;
  }

  #incomeForm .form-grid,
  .income-form-grid {
    grid-template-columns: 1fr !important;
  }

  .profile-photo-card {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .photo-buttons {
    justify-content: center;
  }
}

/* v19 Settings admin and audit center */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.admin-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
}

.admin-card h3 {
  margin-top: 0;
}

.user-table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-table-actions button {
  width: auto !important;
  margin-top: 0 !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
}

.inline-edit-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.5fr 1fr 0.8fr auto;
  gap: 8px;
  align-items: end;
}

.inline-edit-grid input,
.inline-edit-grid select {
  min-height: 42px !important;
  font-size: 14px !important;
  padding: 9px 10px !important;
}

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

.audit-item strong {
  display: block;
  margin-bottom: 3px;
}

.audit-meta {
  color: #6b7280;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.active {
  color: #166534;
  background: #dcfce7;
}

.status-pill.inactive {
  color: #991b1b;
  background: #fee2e2;
}

.hidden-admin-section {
  display: none !important;
}

@media (max-width: 920px) {
  .admin-grid,
  .inline-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* v20 monthly closing nav support */
.header-actions .nav-links a.nav-button,
.header-actions .nav-links a {
  min-width: 104px !important;
}
@media(max-width:1050px){
  .header-actions .nav-links a.nav-button,
  .header-actions .nav-links a { min-width: 96px !important; padding-left: 12px !important; padding-right: 12px !important; }
}


/* v21 attachments UI */
.attachment-cell {
  display: grid;
  gap: 8px;
  min-width: 190px;
}
.attachment-cell small {
  color: #4b5563;
  font-weight: 700;
}
.attachment-cell input[type="file"] {
  font-size: 12px;
  padding: 8px;
  background: #f9fafb;
}
.attachment-cell .attachment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.attachment-cell button,
.modal-panel button {
  width: auto;
  margin-top: 0;
  padding: 8px 11px;
  font-size: 13px;
  border-radius: 9px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 18px;
}
.modal-backdrop[hidden] { display: none; }
.modal-panel {
  width: min(640px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #ffffff;
  color: #111827;
  border-radius: 18px;
  padding: 22px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 24px 70px rgba(0,0,0,0.25);
}
.attachment-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.attachment-item {
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}
.attachment-item a {
  font-weight: 800;
  color: #ea580c;
}
.attachment-meta {
  margin-top: 5px;
  color: #6b7280;
  font-size: 13px;
}


/* v22 annual reports */
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f97316, #ea580c);
  color: #fff !important;
  font-weight: 900;
  text-decoration: none !important;
  box-shadow: 0 12px 24px rgba(234, 88, 12, 0.24);
}
.annual-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.annual-note {
  font-size: 13px;
  color: #6b7280;
  margin-top: 10px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.status-pill.open { background:#dcfce7; color:#166534; }
.status-pill.closed { background:#fee2e2; color:#991b1b; }
@media(max-width:900px){.annual-summary-grid{grid-template-columns:1fr 1fr}}
@media(max-width:620px){.annual-summary-grid{grid-template-columns:1fr}}


/* v23 import/reconciliation UI */
#importMessage { margin-top: 14px; }
#reconciliationList .panel { margin-top: 16px; }
#reconciliationList small { color: #6b7280; }


/* v24 backups page */
.export-box h3 { margin-bottom: 8px; }
.export-box p { color: #6b7280; }

/* v25 permissions page */
#permissionsTable td:last-child { min-width: 130px; }


/* v26 organization settings */
#organizationForm textarea {
  min-height: 90px;
}


/* v27 executive dashboard */
.alert-list {
  display: grid;
  gap: 12px;
}

.alert-card {
  display: block;
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
}

.alert-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.alert-card span {
  display: block;
  color: #4b5563;
  font-size: 14px;
}

.alert-card.warning {
  background: #fff7ed;
  border-color: #fdba74;
}

.alert-card.danger {
  background: #fef2f2;
  border-color: #fecaca;
}

.alert-card.info {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.alert-card.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}


/* v28 category management */
#categoryTable input,
#categoryTable select {
  min-width: 160px;
  font-size: 14px;
  padding: 8px 10px;
}


/* v29 donor statements */
#donorTable .inline-actions {
  min-width: 140px;
}


/* v30 budget module */
#budgetTable input,
#budgetTable select {
  min-width: 120px;
  font-size: 14px;
  padding: 8px 10px;
}


/* v31 recurring expenses */
#recurringTable input,
#recurringTable select {
  min-width: 110px;
  font-size: 14px;
  padding: 8px 10px;
}
#recurringTable .inline-actions {
  min-width: 170px;
}


/* v32 advanced search */
#resultsTable small {
  color: #6b7280;
}
#resultsTable a {
  color: #ea580c;
  font-weight: 800;
}


/* v33 public integration */
.code-block {
  background: #111827;
  color: #f9fafb;
  border-radius: 14px;
  padding: 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
}


/* v34 password recovery */
.login-link {
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
}
.login-link a {
  color: #ea580c;
  font-weight: 800;
}
.inline-actions.vertical {
  display: grid;
  gap: 8px;
  min-width: 220px;
}
.inline-actions.vertical input {
  width: 100%;
  min-width: 180px;
}


/* v35.1 attachments fixed */
#attachmentsTable a.btn-small,
#attachmentsTable .btn-small {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}
#file {
  background: #ffffff;
}


/* v36 inline attachment upload buttons */
.attachment-cell {
  min-width: 210px;
}
.attachment-cell input[type="file"] {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}
.attachment-cell .attachment-actions button:first-child {
  background: linear-gradient(180deg, #f97316, #ea580c);
  color: #ffffff;
}
.attachment-cell .attachment-actions button:last-child {
  background: #111827;
  color: #ffffff;
}
.attachment-item a {
  word-break: break-word;
}


/* v38 professional SaaS dashboard/sidebar redesign */
:root {
  --sidebar-width: 292px;
  --navy-950: #07111f;
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
  --slate-700: #334155;
  --green-600: #16a34a;
  --red-600: #dc2626;
}

body.dashboard.app-shell-page {
  background: var(--slate-50) !important;
  color: #0f172a;
}

body.app-shell-page .topbar,
body.app-shell-page .nav-links {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #07111f 0%, #0f172a 52%, #111827 100%);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
  z-index: 40;
  box-shadow: 18px 0 45px rgba(15, 23, 42, 0.18);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 14px;
}

.sidebar-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
}

.sidebar-brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.1;
  color: #ffffff;
}

.sidebar-brand span {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  margin-top: 2px;
}

.sidebar-nav {
  overflow-y: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
}

.sidebar-section-title {
  margin: 18px 8px 8px;
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #dbeafe;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
  margin: 3px 0;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  box-shadow: 0 10px 24px rgba(234, 88, 12, 0.28);
}

.sidebar-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 13px;
  flex: 0 0 auto;
}

.sidebar-link.active .sidebar-icon {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-user-card {
  margin-top: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.82);
  border-radius: 16px;
  padding: 14px;
}

.sidebar-user-label {
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 900;
  margin-bottom: 7px;
}

.sidebar-user-info {
  font-size: 13px;
  line-height: 1.45;
  color: #ffffff;
  word-break: break-word;
}

.sidebar-logout {
  width: 100% !important;
  margin-top: 12px !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fecaca !important;
  border: 1px solid rgba(248, 113, 113, 0.35) !important;
  font-size: 14px !important;
  box-shadow: none !important;
}

.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #ffffff !important;
}

.app-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 24px;
}

.content-header {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 22px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  margin-bottom: 24px;
}

.content-header-main {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: 1;
}

.content-header h1 {
  font-size: 26px;
  color: #0f172a;
  margin: 0;
}

.content-header p {
  margin: 6px 0 0;
  color: var(--slate-500);
  font-size: 14px;
}

.content-header-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-field label,
.quick-search-wrap label {
  margin: 0 0 7px;
  color: var(--slate-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-field select,
.header-field input,
.quick-search-wrap input {
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  background: #ffffff;
  padding: 9px 12px;
  font-size: 14px;
}

.header-field.compact select {
  min-width: 135px;
}

.header-field.year-field input {
  width: 94px;
}

.quick-search-wrap {
  min-width: 250px;
}

.quick-search-wrap input {
  width: 100%;
}

.user-pill {
  min-width: 170px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 14px;
  padding: 10px 12px;
}

.user-pill span {
  display: block;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-pill strong {
  display: block;
  margin-top: 3px;
  color: var(--orange-600);
  font-size: 12px;
  font-weight: 900;
}

body.app-shell-page .container {
  max-width: none !important;
  width: 100%;
  margin: 0;
  padding: 0;
}

.dashboard-container {
  display: grid;
  gap: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 16px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
  min-height: 112px;
}

.metric-card span {
  display: block;
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 7px;
}

.metric-card strong {
  display: block;
  color: #0f172a;
  font-size: clamp(22px, 2.2vw, 31px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.metric-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 900;
  flex: 0 0 auto;
}

.metric-icon.income,
.metric-icon.balance {
  background: #dcfce7;
  color: #166534;
}

.metric-icon.expense,
.metric-icon.review {
  background: #fee2e2;
  color: #991b1b;
}

.metric-icon.neutral,
.metric-icon.occupancy,
.metric-icon.other {
  background: #e0f2fe;
  color: #075985;
}

.metric-icon.pending {
  background: #ffedd5;
  color: #9a3412;
}

.metric-card.positive {
  border-color: #bbf7d0;
}

.metric-card.negative {
  border-color: #fecaca;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  align-items: start;
}

.dashboard-grid.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-panel {
  border-radius: 20px !important;
  border: 1px solid var(--slate-200) !important;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.05);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.panel-heading a {
  color: var(--orange-600);
  font-weight: 900;
  text-decoration: none;
  font-size: 13px;
}

.attention-list {
  display: grid;
  gap: 10px;
}

.attention-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--slate-200);
}

.attention-list div:last-child {
  border-bottom: 0;
}

.attention-list span {
  color: var(--slate-500);
  font-weight: 700;
}

.attention-list strong {
  color: #0f172a;
  font-size: 20px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-verified,
.status-paid,
.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-pending,
.status-registered {
  background: #ffedd5;
  color: #9a3412;
}

.status-needs-review {
  background: #fef3c7;
  color: #92400e;
}

.status-not-found,
.status-voided,
.status-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.quick-actions-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.quick-actions-panel a {
  text-decoration: none;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  color: #0f172a;
  font-weight: 900;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.quick-actions-panel a:hover {
  border-color: #fdba74;
  color: var(--orange-600);
}

.mobile-menu-button {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 44px !important;
  height: 44px;
  margin: 0 !important;
  border-radius: 14px !important;
  padding: 0 !important;
  background: var(--orange-600) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 24px rgba(234, 88, 12, 0.28);
}

.sidebar-overlay {
  display: none;
}

table th,
table td {
  vertical-align: middle;
}

@media (max-width: 1280px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .dashboard-grid,
  .dashboard-grid.three-column {
    grid-template-columns: 1fr;
  }

  .content-header {
    align-items: stretch;
    flex-direction: column;
  }

  .content-header-main,
  .content-header-actions {
    width: 100%;
  }

  .content-header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 920px) {
  .app-sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

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

  .app-content {
    margin-left: 0;
    padding: 76px 16px 18px;
  }

  .mobile-menu-button {
    display: grid;
    place-items: center;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
    z-index: 35;
  }

  .content-header-main {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-search-wrap {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .metric-grid,
  .quick-actions-panel {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 92px;
  }

  .content-header {
    padding: 18px;
    border-radius: 18px;
  }

  .content-header-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .header-field.year-field input,
  .header-field.compact select,
  .user-pill {
    width: 100%;
    min-width: 0;
  }

  .app-sidebar {
    width: min(88vw, 320px);
  }
}


/* v38.1 responsive sidebar and visual-label fixes */
html,
body {
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sidebar-brand {
  align-items: flex-start !important;
}

.sidebar-brand .brand-title {
  display: block;
  line-height: 1.08;
}

.sidebar-brand .brand-title span,
.sidebar-brand .brand-title em {
  display: block;
}

.sidebar-brand .brand-title span {
  color: #ffffff;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.sidebar-brand .brand-title em {
  margin-top: 5px;
  font-style: normal;
  color: #fdba74;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.app-sidebar {
  overflow: hidden !important;
}

.sidebar-nav {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 4px 2px 28px !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(251, 146, 60, 0.65) rgba(255, 255, 255, 0.08);
}

.sidebar-nav::-webkit-scrollbar {
  width: 7px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(251, 146, 60, 0.65);
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-card {
  display: none !important;
}

.sidebar-logout-menu {
  width: 100% !important;
  border: 0 !important;
  appearance: none !important;
  cursor: pointer !important;
  text-align: left !important;
  font-family: inherit !important;
  background: transparent !important;
}

.sidebar-logout-menu:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #ffffff !important;
}

.sidebar-logout-menu .sidebar-icon {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
}

.content-header {
  min-width: 0;
}

.app-content {
  min-width: 0;
}

.metric-card strong,
.amount,
.report-card .amount,
td strong {
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
  .mobile-menu-button,
  .sidebar-overlay {
    display: none !important;
  }

  .app-sidebar {
    transform: none !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
  }

  .app-content {
    margin-left: var(--sidebar-width) !important;
    width: calc(100vw - var(--sidebar-width)) !important;
    max-width: calc(100vw - var(--sidebar-width)) !important;
    padding: 24px !important;
  }

  body.sidebar-open .sidebar-overlay {
    display: none !important;
  }
}

@media (max-width: 1023.98px) {
  .app-sidebar {
    transform: translateX(-105%) !important;
    transition: transform 0.22s ease !important;
    width: min(88vw, 320px) !important;
  }

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

  .app-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 76px 16px 18px !important;
  }

  .mobile-menu-button {
    display: grid !important;
    place-items: center !important;
  }

  body.sidebar-open .sidebar-overlay {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.46) !important;
    z-index: 35 !important;
  }

  .content-header,
  .content-header-main,
  .content-header-actions {
    width: 100% !important;
  }

  .metric-grid,
  .dashboard-grid,
  .dashboard-grid.three-column,
  .quick-actions-panel {
    grid-template-columns: 1fr !important;
  }

  .table-wrap {
    overflow-x: auto !important;
    max-width: 100% !important;
  }
}

@media (max-width: 620px) {
  .content-header {
    padding: 18px !important;
    border-radius: 18px !important;
  }

  .content-header-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .header-field.year-field input,
  .header-field.compact select,
  .user-pill,
  .quick-search-wrap {
    width: 100% !important;
    min-width: 0 !important;
  }
}


/* v38.2 mobile sidebar smooth-scroll and hamburger/logo fix */
.app-sidebar {
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
}

.sidebar-close-button {
  display: none;
}

.sidebar-brand {
  position: relative !important;
  padding-right: 38px !important;
}

.sidebar-nav {
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
  padding-bottom: 44px !important;
}

@media (max-width: 1023.98px) {
  .app-sidebar {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding-top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
    will-change: transform !important;
    transform: translate3d(-105%, 0, 0) !important;
    backface-visibility: hidden !important;
  }

  body.sidebar-open .app-sidebar {
    transform: translate3d(0, 0, 0) !important;
  }

  body.sidebar-open .mobile-menu-button {
    display: none !important;
    pointer-events: none !important;
  }

  .sidebar-close-button {
    display: grid !important;
    place-items: center !important;
    position: absolute !important;
    top: calc(14px + env(safe-area-inset-top, 0px)) !important;
    right: 14px !important;
    z-index: 70 !important;
    width: 38px !important;
    height: 38px !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.10) !important;
    color: #ffffff !important;
    font-size: 28px !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    cursor: pointer !important;
  }

  .sidebar-close-button:hover,
  .sidebar-close-button:focus {
    background: rgba(249, 115, 22, 0.30) !important;
    outline: none !important;
  }

  .sidebar-overlay {
    touch-action: none !important;
  }

  body.sidebar-open {
    overflow: hidden !important;
    position: relative !important;
  }

  body.sidebar-open .app-content {
    pointer-events: none !important;
  }

  body.sidebar-open .app-sidebar {
    pointer-events: auto !important;
  }

  .sidebar-brand img {
    margin-left: 0 !important;
  }
}

@media (min-width: 1024px) {
  .sidebar-close-button {
    display: none !important;
  }

  .app-sidebar {
    overflow: hidden !important;
  }

  .sidebar-nav {
    overflow-y: auto !important;
  }

  body.sidebar-open {
    overflow: auto !important;
  }

  body.sidebar-open .app-content {
    pointer-events: auto !important;
  }
}


/* v38.3 sidebar desktop toggle and larger navigation text */
.sidebar-link {
  font-size: 16px !important;
  font-weight: 850 !important;
  padding: 13px 14px !important;
  gap: 12px !important;
}

.sidebar-section-title {
  font-size: 12px !important;
  font-weight: 950 !important;
  letter-spacing: 0.09em !important;
  margin-top: 20px !important;
  margin-bottom: 10px !important;
}

.sidebar-icon {
  width: 27px !important;
  height: 27px !important;
  font-size: 14px !important;
}

.sidebar-brand .brand-title span {
  font-size: 15.5px !important;
}

.sidebar-brand .brand-title em {
  font-size: 12.5px !important;
}

.sidebar-close-button {
  display: grid !important;
  place-items: center !important;
  position: absolute !important;
  top: calc(14px + env(safe-area-inset-top, 0px)) !important;
  right: 14px !important;
  z-index: 70 !important;
  width: 38px !important;
  height: 38px !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
  font-size: 28px !important;
  line-height: 1 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

.sidebar-close-button:hover,
.sidebar-close-button:focus {
  background: rgba(249, 115, 22, 0.30) !important;
  outline: none !important;
}

@media (min-width: 1024px) {
  .sidebar-close-button {
    display: grid !important;
  }

  body.sidebar-collapsed .app-sidebar {
    transform: translate3d(-105%, 0, 0) !important;
  }

  body.sidebar-collapsed .app-content {
    margin-left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    padding-left: 84px !important;
  }

  body.sidebar-collapsed .mobile-menu-button {
    display: grid !important;
    place-items: center !important;
    pointer-events: auto !important;
  }

  body:not(.sidebar-collapsed) .mobile-menu-button {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-overlay,
  body.sidebar-open .sidebar-overlay {
    display: none !important;
  }

  .app-sidebar {
    transition: transform 0.22s ease !important;
    will-change: transform !important;
    backface-visibility: hidden !important;
  }
}

@media (max-width: 1023.98px) {
  .sidebar-link {
    font-size: 19px !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
    padding: 16px 16px !important;
    gap: 14px !important;
  }

  .sidebar-section-title {
    font-size: 14px !important;
    font-weight: 950 !important;
    letter-spacing: 0.11em !important;
    margin-top: 24px !important;
    margin-bottom: 12px !important;
  }

  .sidebar-icon {
    width: 30px !important;
    height: 30px !important;
    font-size: 15px !important;
  }
}


/* v38.4 top system title beside menu button */
.top-system-brand {
  position: fixed;
  top: 14px;
  left: 70px;
  z-index: 58;
  height: 44px;
  display: none;
  align-items: center;
  max-width: calc(100vw - 92px);
  padding: 0 16px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Mobile and iPad vertical: show title next to hamburger. */
@media (max-width: 1023.98px) {
  body:not(.sidebar-open) .top-system-brand {
    display: flex;
  }

  body.sidebar-open .top-system-brand {
    display: none;
  }
}

/* Desktop/iPad horizontal: show title only when sidebar is collapsed and hamburger is visible. */
@media (min-width: 1024px) {
  body.sidebar-collapsed .top-system-brand {
    display: flex;
  }

  body:not(.sidebar-collapsed) .top-system-brand {
    display: none;
  }
}

@media (max-width: 620px) {
  .top-system-brand {
    left: 66px;
    right: 10px;
    max-width: none;
    padding: 0 12px;
    font-size: 13px;
  }
}

@media (max-width: 390px) {
  .top-system-brand {
    font-size: 12px;
  }
}


/* v38.4.1 polished top system title */
.top-system-brand {
  height: 52px !important;
  min-height: 52px !important;
  padding: 0 22px !important;
  border-radius: 17px !important;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94)) !important;
  border: 1px solid rgba(203, 213, 225, 0.96) !important;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.10) !important;
  color: #0f172a !important;
  font-size: 18px !important;
  font-weight: 950 !important;
  letter-spacing: -0.015em !important;
  gap: 8px !important;
}

.top-brand-main,
.top-brand-accent,
.top-brand-divider {
  display: inline-block;
  white-space: nowrap;
}

.top-brand-main {
  color: #0f172a;
}

.top-brand-accent {
  color: #ea580c;
  font-weight: 1000;
}

.top-brand-divider {
  color: #c2410c;
  opacity: 0.75;
  font-weight: 900;
}

@media (max-width: 1023.98px) {
  body:not(.sidebar-open) .top-system-brand {
    display: flex !important;
    align-items: center !important;
  }
}

@media (min-width: 1024px) {
  body.sidebar-collapsed .top-system-brand {
    display: flex !important;
    align-items: center !important;
  }
}

@media (max-width: 760px) {
  .top-system-brand {
    left: 74px !important;
    right: 12px !important;
    max-width: none !important;
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 16px !important;
    font-size: 16px !important;
  }
}

@media (max-width: 560px) {
  .top-system-brand {
    font-size: 14px !important;
    padding: 0 13px !important;
  }

  .top-brand-divider {
    display: none !important;
  }

  .top-brand-accent {
    margin-left: 6px;
  }
}

@media (max-width: 430px) {
  .top-system-brand {
    font-size: 13px !important;
  }

  .top-brand-main {
    max-width: 64%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-brand-accent {
    max-width: 36%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}


/* v38.4.2 fixed top title, connected user photo and password eye */
.mobile-menu-button,
.top-system-brand {
  position: fixed !important;
  top: 14px !important;
}

.mobile-menu-button {
  z-index: 90 !important;
}

.top-system-brand {
  z-index: 89 !important;
}

body.app-shell-page .app-content {
  padding-top: 82px !important;
}

.user-pill.user-pill-with-photo {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 210px !important;
}

.user-pill-photo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #c2410c);
  color: #ffffff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.22);
}

.user-pill-photo img {
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
}

.user-pill-photo span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.02em;
}

.user-pill-meta {
  min-width: 0;
}

.user-pill-meta span,
.user-pill-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-photo-preview {
  overflow: hidden;
}

.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.password-field-wrap {
  position: relative;
}

.password-field-wrap input {
  padding-right: 54px !important;
}

.password-toggle-button {
  position: absolute !important;
  right: 7px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 10px !important;
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0 !important;
  display: grid !important;
  place-items: center !important;
  font-size: 17px !important;
  box-shadow: none !important;
}

.password-toggle-button:hover,
.password-toggle-button:focus {
  background: #eef2ff !important;
  border-color: #c7d2fe !important;
  outline: none !important;
}

@media (max-width: 1023.98px) {
  body.app-shell-page .app-content {
    padding-top: 82px !important;
  }

  body.sidebar-open .top-system-brand {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .top-system-brand {
    height: 50px !important;
  }

  body.app-shell-page .app-content {
    padding-top: 78px !important;
  }
}

@media (max-width: 430px) {
  .user-pill.user-pill-with-photo {
    min-width: 0 !important;
  }
}


/* v38.4.3 integrated title: menu fixed, title scrolls with content */
.mobile-menu-button {
  position: fixed !important;
  top: 14px !important;
  left: 14px !important;
  z-index: 90 !important;
}

.top-system-brand.top-system-brand-integrated {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  z-index: auto !important;
  display: none;
  width: min(100%, 760px) !important;
  max-width: 100% !important;
  height: 52px !important;
  min-height: 52px !important;
  margin: 0 0 16px 0 !important;
  padding: 0 22px !important;
  border-radius: 17px !important;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94)) !important;
  border: 1px solid rgba(203, 213, 225, 0.96) !important;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.10) !important;
  color: #0f172a !important;
  font-size: 18px !important;
  font-weight: 950 !important;
  letter-spacing: -0.015em !important;
  gap: 8px !important;
  align-items: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.top-system-brand.top-system-brand-integrated .top-brand-main,
.top-system-brand.top-system-brand-integrated .top-brand-accent,
.top-system-brand.top-system-brand-integrated .top-brand-divider {
  display: inline-block;
  white-space: nowrap;
}

.top-system-brand.top-system-brand-integrated .top-brand-main {
  color: #0f172a;
}

.top-system-brand.top-system-brand-integrated .top-brand-accent {
  color: #ea580c;
  font-weight: 1000;
}

.top-system-brand.top-system-brand-integrated .top-brand-divider {
  color: #c2410c;
  opacity: 0.75;
  font-weight: 900;
}

/* Keep enough top room only for the fixed hamburger, not for a floating title. */
body.app-shell-page .app-content {
  padding-top: 76px !important;
}

/* Mobile/iPad vertical: show title as part of the content when drawer is closed. */
@media (max-width: 1023.98px) {
  body:not(.sidebar-open) .top-system-brand.top-system-brand-integrated {
    display: flex !important;
  }

  body.sidebar-open .top-system-brand.top-system-brand-integrated {
    display: none !important;
  }

  body.app-shell-page .app-content {
    padding-top: 76px !important;
  }
}

/* Desktop/iPad horizontal: show title only when sidebar is collapsed, but still scroll with content. */
@media (min-width: 1024px) {
  body.sidebar-collapsed .top-system-brand.top-system-brand-integrated {
    display: flex !important;
  }

  body:not(.sidebar-collapsed) .top-system-brand.top-system-brand-integrated {
    display: none !important;
  }

  body.sidebar-collapsed .app-content {
    padding-top: 76px !important;
  }
}

@media (max-width: 760px) {
  .top-system-brand.top-system-brand-integrated {
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 16px !important;
    font-size: 16px !important;
  }
}

@media (max-width: 560px) {
  .top-system-brand.top-system-brand-integrated {
    font-size: 14px !important;
    padding: 0 13px !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-divider {
    display: none !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-accent {
    margin-left: 6px;
  }
}

@media (max-width: 430px) {
  .top-system-brand.top-system-brand-integrated {
    font-size: 13px !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-main {
    max-width: 64%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-accent {
    max-width: 36%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* v39.7 mobile UX/responsive refinement - visual only */
:root {
  --cd-card-radius: 18px;
  --cd-touch: 44px;
  --cd-soft-border: #e5e7eb;
}

.dashboard-v396 {
  display: grid;
  gap: 22px;
}

.dashboard-header-v396 {
  gap: 16px;
}

.dashboard-period-summary {
  display: none;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.dashboard-period-summary strong,
.dashboard-period-summary span {
  display: block;
}

.dashboard-period-summary strong {
  font-size: 18px;
  color: #0f172a;
}

.dashboard-period-summary span {
  margin-top: 5px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.35;
}

.dashboard-filter-panel {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.dashboard-filter-panel summary {
  cursor: pointer;
  min-height: 56px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  list-style: none;
}

.dashboard-filter-panel summary::-webkit-details-marker {
  display: none;
}

.dashboard-filter-panel summary strong,
.dashboard-filter-panel summary small {
  display: block;
}

.dashboard-filter-panel summary small {
  margin-top: 3px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-filter-panel summary em {
  font-style: normal;
  color: #4f46e5;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-filter-body {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 180px) minmax(120px, 150px);
  gap: 14px;
  padding: 0 18px 18px;
  align-items: end;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 22px;
  color: #0f172a;
}

.section-title-row p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 14px;
}

.dashboard-summary-section {
  background: transparent;
}

.dashboard-essential-metrics {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
}

.mobile-primary-actions {
  display: none;
}

.dashboard-quick-actions {
  margin-top: 0 !important;
}

.dashboard-quick-actions a,
.mobile-primary-actions a,
.primary-action {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.audit-panel[hidden] {
  display: none !important;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-verified,
.status-Verificado,
.status-confirmed,
.status-Confirmado,
.status-paid,
.status-Pagado,
.status-active,
.status-Activo {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.status-pending,
.status-Pendiente,
.status-registered,
.status-Registrado {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-color: #fcd34d !important;
}

.status-needs-review,
.status-En\ revisión,
.status-Necesita\ revisión,
.status-difference,
.status-Diferencia {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #fecaca !important;
}

.status-voided,
.status-Anulado,
.status-inactive,
.status-Inactivo,
.status-rejected,
.status-Rechazado {
  background: #f3f4f6 !important;
  color: #374151 !important;
  border-color: #d1d5db !important;
}

.status-not-found,
.status-No\ encontrado,
.status-unmatched,
.status-Sin\ conciliar {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border-color: #fdba74 !important;
}

.status-matched,
.status-Conciliado,
.status-resolved,
.status-Resuelto {
  background: #dbeafe !important;
  color: #1e40af !important;
  border-color: #93c5fd !important;
}

@media (max-width: 1180px) {
  .dashboard-essential-metrics {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-essential-metrics {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .dashboard-filter-body {
    grid-template-columns: 1fr 160px 140px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden !important;
  }

  body {
    font-size: 15px;
  }

  body.app-shell-page .app-content {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .container,
  .dashboard-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .content-header,
  .panel,
  .card,
  .metric-card,
  .dashboard-period-summary,
  .dashboard-filter-panel {
    border-radius: 18px !important;
  }

  .content-header {
    padding: 20px 16px !important;
  }

  .content-header-main {
    gap: 14px !important;
    align-items: flex-start !important;
  }

  .content-header h1,
  .panel h2,
  .section-title-row h2 {
    font-size: 22px !important;
    line-height: 1.18 !important;
  }

  .content-header p,
  .panel p,
  .section-title-row p {
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .dashboard-period-summary {
    display: block;
  }

  .dashboard-filter-panel {
    margin-top: 0;
  }

  .dashboard-filter-body {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }

  .dashboard-filter-panel summary {
    padding: 13px 14px;
  }

  .mobile-primary-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mobile-primary-actions a {
    min-height: 56px;
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
  }

  .mobile-primary-actions .income {
    background: linear-gradient(135deg, #16a34a, #15803d);
  }

  .mobile-primary-actions .expense {
    background: linear-gradient(135deg, #f97316, #ea580c);
  }

  .dashboard-essential-metrics,
  .metric-grid,
  .dashboard-grid,
  .dashboard-grid.three-column,
  .report-grid,
  .profile-grid,
  .form-grid,
  #incomeForm .form-grid,
  .income-form-grid,
  .toolbar,
  .row {
    grid-template-columns: 1fr !important;
    display: grid !important;
    gap: 14px !important;
  }

  .metric-card {
    min-height: 94px;
    padding: 16px !important;
  }

  .metric-card span,
  .card .label {
    font-size: 14px !important;
  }

  .metric-card strong,
  .card .number {
    font-size: 24px !important;
  }

  .panel,
  .card {
    padding: 18px 16px !important;
  }

  .panel-heading {
    gap: 10px !important;
    align-items: flex-start !important;
  }

  .panel-heading a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
  }

  label {
    font-size: 14px !important;
  }

  input,
  select,
  textarea,
  button,
  .btn-small,
  .secondary,
  .danger,
  .logout-button,
  .nav-button {
    min-height: 44px !important;
    font-size: 15px !important;
  }

  button,
  .btn-small {
    padding: 12px 14px !important;
  }

  form button[type="submit"],
  #incomeForm > button,
  #expenseForm > button {
    width: 100% !important;
    min-height: 54px !important;
    font-size: 16px !important;
    border-radius: 14px !important;
  }

  .message {
    position: relative;
    z-index: 1;
    font-size: 14px !important;
    line-height: 1.35;
  }

  .quick-actions-panel,
  .dashboard-quick-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 16px !important;
    border-radius: 18px !important;
  }

  .quick-actions-panel a,
  .dashboard-quick-actions a {
    width: 100% !important;
    min-height: 54px !important;
    padding: 14px 16px !important;
    font-size: 15px !important;
    border-radius: 14px !important;
  }

  .table-wrap,
  .responsive-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
  }

  .table-wrap table,
  .responsive-table-wrap table,
  table.responsive-cards-table {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
  }

  .table-wrap table thead,
  .responsive-table-wrap table thead,
  table.responsive-cards-table thead {
    display: none !important;
  }

  .table-wrap table tbody,
  .responsive-table-wrap table tbody,
  table.responsive-cards-table tbody {
    display: grid !important;
    gap: 12px !important;
  }

  .table-wrap table tr,
  .responsive-table-wrap table tr,
  table.responsive-cards-table tr {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
    padding: 12px !important;
    margin: 0 !important;
  }

  .table-wrap table td,
  .responsive-table-wrap table td,
  table.responsive-cards-table td {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 14px !important;
    width: 100% !important;
    min-height: 34px !important;
    border: 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 9px 4px !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: right !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
  }

  .table-wrap table td:last-child,
  .responsive-table-wrap table td:last-child,
  table.responsive-cards-table td:last-child {
    border-bottom: 0 !important;
  }

  .table-wrap table td::before,
  .responsive-table-wrap table td::before,
  table.responsive-cards-table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    text-align: left;
    color: #64748b;
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .table-wrap table td[colspan]::before,
  .responsive-table-wrap table td[colspan]::before,
  table.responsive-cards-table td[colspan]::before {
    content: "";
    display: none;
  }

  .inline-actions,
  .attachment-cell,
  .attachment-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .inline-actions select,
  .inline-actions input,
  .inline-actions button,
  .attachment-cell input,
  .attachment-actions button {
    width: 100% !important;
    margin: 0 !important;
  }

  .user-pill {
    width: 100% !important;
  }
}

@media (max-width: 430px) {
  body.app-shell-page .app-content {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .content-header,
  .panel,
  .card {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .table-wrap table td,
  .responsive-table-wrap table td,
  table.responsive-cards-table td {
    display: block !important;
    text-align: left !important;
  }

  .table-wrap table td::before,
  .responsive-table-wrap table td::before,
  table.responsive-cards-table td::before {
    display: block;
    margin-bottom: 4px;
  }
}

/* v39.7 dashboard mobile visual refinement - visual only, no data or calculation changes */
.dashboard-header-v397,
.dashboard-header-v396 {
  gap: 14px;
}

.top-system-brand.top-system-brand-integrated {
  justify-content: center !important;
  text-align: center !important;
  font-size: 21px !important;
  font-weight: 1000 !important;
  letter-spacing: -0.02em !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 64px !important;
  height: auto !important;
  padding: 12px 22px !important;
  line-height: 1.12 !important;
}

.top-system-brand.top-system-brand-integrated .top-brand-main,
.top-system-brand.top-system-brand-integrated .top-brand-accent {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
}

.dashboard-header-stack {
  display: grid !important;
  grid-template-columns: minmax(220px, auto) 1fr;
  align-items: center !important;
  gap: 16px !important;
}

.dashboard-user-card {
  max-width: 360px;
}

.dashboard-title-block h1 {
  font-size: 28px;
}

.dashboard-quick-actions {
  grid-template-columns: repeat(2, minmax(180px, 1fr)) !important;
}

.dashboard-essential-metrics .metric-card {
  min-height: 110px;
}

.dashboard-essential-metrics .metric-card:nth-child(n+4) {
  min-height: 86px;
}

.dashboard-essential-metrics .metric-card:nth-child(n+4) .metric-icon {
  width: 38px;
  height: 38px;
}

.dashboard-essential-metrics .metric-card:nth-child(n+4) strong {
  font-size: 25px;
}

@media (max-width: 920px) {
  .mobile-menu-button {
    top: 16px !important;
    left: 16px !important;
  }

  body.app-shell-page .app-content {
    padding-top: 86px !important;
  }
}

@media (max-width: 760px) {
  body.app-shell-page .app-content {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-top: 82px !important;
  }

  .top-system-brand.top-system-brand-integrated {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 74px !important;
    padding: 13px 14px !important;
    margin-bottom: 12px !important;
    font-size: 20px !important;
    line-height: 1.08 !important;
    white-space: normal !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-divider {
    display: none !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-main {
    max-width: 100% !important;
    font-size: 21px !important;
    line-height: 1.1 !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-accent {
    max-width: 100% !important;
    margin-left: 0 !important;
    font-size: 17px !important;
    line-height: 1.1 !important;
    text-transform: uppercase;
    letter-spacing: 0.035em;
  }

  .dashboard-header-stack {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .dashboard-user-card {
    width: 100% !important;
    max-width: none !important;
    padding: 10px 12px !important;
    min-height: 64px;
  }

  .dashboard-title-block h1,
  .content-header h1 {
    font-size: 24px !important;
  }

  .dashboard-title-block p,
  .content-header p {
    font-size: 15px !important;
    color: #475569 !important;
  }

  .dashboard-period-summary {
    padding: 13px 14px !important;
    min-height: auto !important;
  }

  .dashboard-period-summary strong {
    font-size: 18px !important;
  }

  .dashboard-period-summary span {
    font-size: 15px !important;
    color: #475569 !important;
  }

  .dashboard-filter-panel summary {
    min-height: 52px !important;
    padding: 12px 14px !important;
  }

  .dashboard-filter-panel summary strong {
    font-size: 16px !important;
  }

  .dashboard-filter-panel summary small {
    font-size: 13px !important;
    color: #475569 !important;
  }

  .dashboard-filter-panel summary em {
    font-size: 14px !important;
  }

  .mobile-primary-actions {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .mobile-primary-actions a {
    min-height: 52px !important;
    font-size: 15px !important;
    padding: 12px 10px !important;
  }

  .dashboard-essential-metrics,
  .metric-grid.dashboard-essential-metrics {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .dashboard-essential-metrics .metric-card {
    min-height: 82px !important;
    padding: 12px !important;
    border-radius: 16px !important;
    gap: 10px !important;
  }

  .dashboard-essential-metrics .metric-card:nth-child(-n+3) {
    grid-column: 1 / -1;
    min-height: 88px !important;
  }

  .dashboard-essential-metrics .metric-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 17px !important;
  }

  .dashboard-essential-metrics .metric-card span {
    font-size: 14px !important;
    line-height: 1.2 !important;
    color: #334155 !important;
  }

  .dashboard-essential-metrics .metric-card strong {
    font-size: 23px !important;
    line-height: 1.1 !important;
  }

  .dashboard-essential-metrics .metric-card:nth-child(n+4) strong {
    font-size: 21px !important;
  }

  .dashboard-v397,
  .dashboard-v396 {
    gap: 16px !important;
  }

  .section-title-row {
    margin-bottom: 10px !important;
  }

  .section-title-row h2,
  .panel-heading h2,
  .panel h2 {
    font-size: 24px !important;
    line-height: 1.12 !important;
  }

  .dashboard-recent-row .panel-heading h2 {
    font-size: 26px !important;
  }

  .panel,
  .card {
    padding: 16px 14px !important;
  }

  .quick-actions-panel.dashboard-quick-actions {
    grid-template-columns: 1fr 1fr !important;
    padding: 14px !important;
    gap: 10px !important;
  }

  .dashboard-quick-actions a {
    min-height: 50px !important;
    font-size: 15px !important;
  }

  .responsive-table-wrap table,
  .table-wrap table,
  table.responsive-cards-table {
    border-spacing: 0 10px !important;
  }

  .responsive-table-wrap table tbody,
  .table-wrap table tbody,
  table.responsive-cards-table tbody {
    gap: 10px !important;
  }

  .responsive-table-wrap table tr,
  .table-wrap table tr,
  table.responsive-cards-table tr {
    padding: 12px 13px !important;
    border-radius: 15px !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.055) !important;
  }

  .responsive-table-wrap table td,
  .table-wrap table td,
  table.responsive-cards-table td {
    display: grid !important;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr) !important;
    align-items: baseline !important;
    gap: 8px !important;
    min-height: 0 !important;
    padding: 5px 0 !important;
    border-bottom: 0 !important;
    text-align: left !important;
    font-size: 16px !important;
    line-height: 1.28 !important;
    color: #0f172a !important;
    word-break: break-word !important;
  }

  .responsive-table-wrap table td:first-child,
  .table-wrap table td:first-child,
  table.responsive-cards-table td:first-child {
    display: block !important;
    grid-template-columns: none !important;
    padding: 0 0 7px !important;
    font-size: 19px !important;
    font-weight: 900 !important;
    color: #0f172a !important;
    line-height: 1.2 !important;
  }

  .responsive-table-wrap table td:first-child::before,
  .table-wrap table td:first-child::before,
  table.responsive-cards-table td:first-child::before {
    display: none !important;
    content: "" !important;
  }

  .responsive-table-wrap table td::before,
  .table-wrap table td::before,
  table.responsive-cards-table td::before {
    display: block !important;
    content: attr(data-label) !important;
    width: auto !important;
    flex: none !important;
    margin: 0 !important;
    text-align: left !important;
    color: #475569 !important;
    font-weight: 900 !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.035em !important;
  }

  .responsive-table-wrap table td[data-label="Monto"],
  .table-wrap table td[data-label="Monto"],
  table.responsive-cards-table td[data-label="Monto"],
  .responsive-table-wrap table td[data-label="Total"],
  .table-wrap table td[data-label="Total"],
  table.responsive-cards-table td[data-label="Total"] {
    align-items: center !important;
  }

  .responsive-table-wrap table td[data-label="Monto"] strong,
  .table-wrap table td[data-label="Monto"] strong,
  table.responsive-cards-table td[data-label="Monto"] strong,
  .responsive-table-wrap table td[data-label="Total"] strong,
  .table-wrap table td[data-label="Total"] strong,
  table.responsive-cards-table td[data-label="Total"] strong {
    font-size: 22px !important;
    line-height: 1.1 !important;
    font-weight: 1000 !important;
    color: #0f172a !important;
  }

  .responsive-table-wrap table td[data-label="Estado"],
  .table-wrap table td[data-label="Estado"],
  table.responsive-cards-table td[data-label="Estado"] {
    align-items: center !important;
  }

  .responsive-table-wrap table td[colspan],
  .table-wrap table td[colspan],
  table.responsive-cards-table td[colspan] {
    display: block !important;
    font-size: 16px !important;
    color: #475569 !important;
    text-align: left !important;
  }

  .responsive-table-wrap table td[colspan]::before,
  .table-wrap table td[colspan]::before,
  table.responsive-cards-table td[colspan]::before {
    display: none !important;
  }

  .status-badge {
    min-height: 32px !important;
    padding: 7px 11px !important;
    font-size: 14px !important;
    line-height: 1 !important;
  }
}

@media (max-width: 430px) {
  body.app-shell-page .app-content {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .top-system-brand.top-system-brand-integrated {
    min-height: 72px !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-main {
    font-size: 19px !important;
  }

  .top-system-brand.top-system-brand-integrated .top-brand-accent {
    font-size: 15px !important;
  }

  .mobile-primary-actions {
    grid-template-columns: 1fr !important;
  }

  .quick-actions-panel.dashboard-quick-actions {
    grid-template-columns: 1fr !important;
  }

  .dashboard-essential-metrics .metric-card {
    padding: 11px !important;
  }

  .responsive-table-wrap table td,
  .table-wrap table td,
  table.responsive-cards-table td {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    padding: 5px 0 !important;
    font-size: 16px !important;
    text-align: left !important;
  }

  .responsive-table-wrap table td:first-child,
  .table-wrap table td:first-child,
  table.responsive-cards-table td:first-child {
    display: block !important;
    font-size: 18px !important;
  }

  .responsive-table-wrap table td::before,
  .table-wrap table td::before,
  table.responsive-cards-table td::before {
    display: block !important;
    margin-bottom: 0 !important;
    font-size: 13px !important;
  }

  .responsive-table-wrap table td[data-label="Monto"] strong,
  .table-wrap table td[data-label="Monto"] strong,
  table.responsive-cards-table td[data-label="Monto"] strong {
    font-size: 21px !important;
  }
}

/* v39.8 dashboard top cards enlargement - visual only, no logic/data changes */
.dashboard-user-card {
  border-radius: 18px !important;
}

@media (min-width: 761px) {
  .dashboard-user-card {
    max-width: 430px !important;
    padding: 14px 18px !important;
    min-height: 78px !important;
    gap: 14px !important;
  }

  .dashboard-user-card .user-pill-photo {
    width: 54px !important;
    height: 54px !important;
  }

  .dashboard-user-card .user-pill-photo span {
    font-size: 17px !important;
  }

  .dashboard-user-card .user-pill-meta span {
    font-size: 17px !important;
    line-height: 1.15 !important;
    font-weight: 950 !important;
  }

  .dashboard-user-card .user-pill-meta strong {
    font-size: 14px !important;
    line-height: 1.2 !important;
  }
}

@media (max-width: 760px) {
  .dashboard-user-card {
    width: 100% !important;
    min-height: 88px !important;
    padding: 16px 18px !important;
    gap: 16px !important;
    border-radius: 20px !important;
  }

  .dashboard-user-card .user-pill-photo {
    width: 64px !important;
    height: 64px !important;
  }

  .dashboard-user-card .user-pill-photo span {
    font-size: 20px !important;
    letter-spacing: 0.02em !important;
  }

  .dashboard-user-card .user-pill-meta span {
    font-size: 20px !important;
    line-height: 1.16 !important;
    font-weight: 950 !important;
    color: #0f172a !important;
  }

  .dashboard-user-card .user-pill-meta strong {
    margin-top: 6px !important;
    font-size: 17px !important;
    line-height: 1.18 !important;
    font-weight: 950 !important;
  }

  .dashboard-period-summary {
    min-height: 104px !important;
    padding: 18px 20px !important;
    border-radius: 20px !important;
  }

  .dashboard-period-summary strong {
    font-size: 22px !important;
    line-height: 1.18 !important;
    font-weight: 950 !important;
  }

  .dashboard-period-summary span {
    margin-top: 8px !important;
    font-size: 17px !important;
    line-height: 1.32 !important;
    color: #334155 !important;
  }

  .dashboard-filter-panel {
    border-radius: 20px !important;
  }

  .dashboard-filter-panel summary {
    min-height: 78px !important;
    padding: 18px 20px !important;
    border-radius: 20px !important;
  }

  .dashboard-filter-panel summary strong {
    font-size: 21px !important;
    line-height: 1.18 !important;
    font-weight: 950 !important;
  }

  .dashboard-filter-panel summary small {
    margin-top: 6px !important;
    font-size: 17px !important;
    line-height: 1.25 !important;
    color: #334155 !important;
  }

  .dashboard-filter-panel summary em {
    font-size: 17px !important;
    line-height: 1.1 !important;
    font-weight: 950 !important;
  }

  .dashboard-filter-body {
    padding: 16px 18px 18px !important;
    gap: 14px !important;
  }
}

@media (max-width: 430px) {
  .dashboard-user-card {
    min-height: 82px !important;
    padding: 14px 16px !important;
    gap: 14px !important;
  }

  .dashboard-user-card .user-pill-photo {
    width: 58px !important;
    height: 58px !important;
  }

  .dashboard-user-card .user-pill-photo span {
    font-size: 18px !important;
  }

  .dashboard-user-card .user-pill-meta span {
    font-size: 19px !important;
  }

  .dashboard-user-card .user-pill-meta strong {
    font-size: 16px !important;
  }

  .dashboard-period-summary {
    min-height: 98px !important;
    padding: 17px 18px !important;
  }

  .dashboard-period-summary strong {
    font-size: 21px !important;
  }

  .dashboard-period-summary span {
    font-size: 16px !important;
  }

  .dashboard-filter-panel summary {
    min-height: 74px !important;
    padding: 17px 18px !important;
  }

  .dashboard-filter-panel summary strong {
    font-size: 20px !important;
  }

  .dashboard-filter-panel summary small,
  .dashboard-filter-panel summary em {
    font-size: 16px !important;
  }
}


/* v39.10 visual readability pass for non-dashboard pages
   Scope: mobile/readability only. No accounting logic, DB, calculations or APIs changed.
   Dashboard is intentionally excluded from these page-specific enlargements. */

@media (max-width: 767.98px) {
  body:not(.page-dashboard) .page-header,
  body:not(.page-dashboard) .hero-card,
  body:not(.page-dashboard) .section-card:first-of-type {
    padding-top: 28px !important;
  }

  body:not(.page-dashboard) h1,
  body:not(.page-dashboard) .page-title,
  body:not(.page-dashboard) .hero-title,
  body:not(.page-dashboard) .section-title {
    font-size: clamp(28px, 8vw, 38px) !important;
    line-height: 1.12 !important;
    font-weight: 950 !important;
    letter-spacing: -0.02em !important;
  }

  body:not(.page-dashboard) .page-subtitle,
  body:not(.page-dashboard) .hero-subtitle,
  body:not(.page-dashboard) .section-subtitle,
  body:not(.page-dashboard) .muted,
  body:not(.page-dashboard) .help-text,
  body:not(.page-dashboard) p {
    font-size: 17px !important;
    line-height: 1.55 !important;
  }

  body:not(.page-dashboard) h2,
  body:not(.page-dashboard) h3 {
    font-size: clamp(23px, 6.5vw, 30px) !important;
    line-height: 1.18 !important;
    font-weight: 900 !important;
  }

  body:not(.page-dashboard) label,
  body:not(.page-dashboard) .form-label,
  body:not(.page-dashboard) .field-label,
  body:not(.page-dashboard) .filter-label {
    font-size: 16px !important;
    line-height: 1.35 !important;
    font-weight: 850 !important;
    color: #111827 !important;
    margin-bottom: 8px !important;
  }

  body:not(.page-dashboard) input,
  body:not(.page-dashboard) select,
  body:not(.page-dashboard) textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 50px !important;
    font-size: 17px !important;
    line-height: 1.35 !important;
    padding: 13px 15px !important;
    border-radius: 14px !important;
    box-sizing: border-box !important;
  }

  body:not(.page-dashboard) textarea {
    min-height: 112px !important;
  }

  body:not(.page-dashboard) input[type="date"],
  body:not(.page-dashboard) input[type="month"],
  body:not(.page-dashboard) input[type="datetime-local"],
  body:not(.page-dashboard) input[type="time"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    text-align: center !important;
    text-align-last: center !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  body:not(.page-dashboard) input[type="date"]::-webkit-date-and-time-value,
  body:not(.page-dashboard) input[type="month"]::-webkit-date-and-time-value,
  body:not(.page-dashboard) input[type="datetime-local"]::-webkit-date-and-time-value,
  body:not(.page-dashboard) input[type="time"]::-webkit-date-and-time-value {
    text-align: center !important;
  }

  body:not(.page-dashboard) .form-grid,
  body:not(.page-dashboard) form,
  body:not(.page-dashboard) .filters-grid,
  body:not(.page-dashboard) .grid,
  body:not(.page-dashboard) .two-col,
  body:not(.page-dashboard) .three-col,
  body:not(.page-dashboard) .four-col {
    grid-template-columns: 1fr !important;
  }

  body:not(.page-dashboard) .form-grid,
  body:not(.page-dashboard) .filters-grid {
    gap: 18px !important;
  }

  body:not(.page-dashboard) .form-actions,
  body:not(.page-dashboard) .actions,
  body:not(.page-dashboard) .button-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
  }

  body:not(.page-dashboard) button,
  body:not(.page-dashboard) .btn,
  body:not(.page-dashboard) .button,
  body:not(.page-dashboard) input[type="submit"] {
    min-height: 48px !important;
    font-size: 16.5px !important;
    font-weight: 850 !important;
    border-radius: 14px !important;
    padding: 13px 18px !important;
    touch-action: manipulation !important;
  }

  body:not(.page-dashboard) .card,
  body:not(.page-dashboard) .panel,
  body:not(.page-dashboard) .section-card,
  body:not(.page-dashboard) .form-card {
    padding: 24px !important;
    border-radius: 22px !important;
  }

  body:not(.page-dashboard) .table-card,
  body:not(.page-dashboard) .mobile-card,
  body:not(.page-dashboard) .record-card {
    font-size: 16px !important;
  }

  body:not(.page-dashboard) .table-card strong,
  body:not(.page-dashboard) .mobile-card strong,
  body:not(.page-dashboard) .record-card strong {
    font-size: 18px !important;
  }
}

/* Keep the connected user card only on Dashboard.
   Some pages still render it from the shared template; hide it outside dashboard. */
body:not(.page-dashboard) .dashboard-user-card,
body:not(.page-dashboard) .connected-user-card,
body:not(.page-dashboard) .user-summary-card,
body:not(.page-dashboard) .current-user-card,
body:not(.page-dashboard) .top-user-card,
body:not(.page-dashboard) .user-line {
  display: none !important;
}

/* Page-specific readability targets requested by the user. */
@media (max-width: 767.98px) {
  body.page-income .page-title,
  body.page-expenses .page-title,
  body.page-recurring .page-title,
  body.page-weekly-books .page-title,
  body.page-budget .page-title,
  body.page-closing .page-title,
  body.page-categories .page-title,
  body.page-imports .page-title,
  body.page-envelopes .page-title,
  body.page-organization .page-title,
  body.page-public-integration .page-title {
    font-size: 34px !important;
  }

  body.page-income .page-subtitle,
  body.page-expenses .page-subtitle,
  body.page-recurring .page-subtitle,
  body.page-weekly-books .page-subtitle,
  body.page-budget .page-subtitle,
  body.page-closing .page-subtitle,
  body.page-categories .page-subtitle,
  body.page-imports .page-subtitle,
  body.page-envelopes .page-subtitle,
  body.page-organization .page-subtitle,
  body.page-public-integration .page-subtitle {
    font-size: 18px !important;
    color: #374151 !important;
    line-height: 1.55 !important;
  }

  /* Do not alter the already-approved income/expense list tables visually. */
  body.page-income .income-list,
  body.page-income #income-list,
  body.page-income .list-table,
  body.page-expenses .expense-list,
  body.page-expenses #expense-list {
    /* intentionally left untouched */
  }
}


/* v39.11 external backup mobile readability: primary rules are injected inline after legacy CSS in target pages. */


/* v39.12 mobile card/action and member ID visual fixes
   Visual-only: no logic, database, calculations or functions changed. */
@media (max-width: 767.98px) {
  /* Remove the “Acción” label inside mobile cards and let the action controls use the full card width. */
  .table-wrap table td[data-label="Acción"],
  .responsive-table-wrap table td[data-label="Acción"],
  table.responsive-cards-table td[data-label="Acción"],
  .table-wrap table td[data-label="Accion"],
  .responsive-table-wrap table td[data-label="Accion"],
  table.responsive-cards-table td[data-label="Accion"] {
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 0 4px !important;
    text-align: center !important;
    border-bottom: 0 !important;
  }

  .table-wrap table td[data-label="Acción"]::before,
  .responsive-table-wrap table td[data-label="Acción"]::before,
  table.responsive-cards-table td[data-label="Acción"]::before,
  .table-wrap table td[data-label="Accion"]::before,
  .responsive-table-wrap table td[data-label="Accion"]::before,
  table.responsive-cards-table td[data-label="Accion"]::before {
    content: "" !important;
    display: none !important;
  }

  .table-wrap table td[data-label="Acción"] .inline-actions,
  .responsive-table-wrap table td[data-label="Acción"] .inline-actions,
  table.responsive-cards-table td[data-label="Acción"] .inline-actions,
  .table-wrap table td[data-label="Accion"] .inline-actions,
  .responsive-table-wrap table td[data-label="Accion"] .inline-actions,
  table.responsive-cards-table td[data-label="Accion"] .inline-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }

  .table-wrap table td[data-label="Acción"] .inline-actions > *,
  .responsive-table-wrap table td[data-label="Acción"] .inline-actions > *,
  table.responsive-cards-table td[data-label="Acción"] .inline-actions > *,
  .table-wrap table td[data-label="Accion"] .inline-actions > *,
  .responsive-table-wrap table td[data-label="Accion"] .inline-actions > *,
  table.responsive-cards-table td[data-label="Accion"] .inline-actions > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .table-wrap table td[data-label="Acción"] .inline-actions button,
  .responsive-table-wrap table td[data-label="Acción"] .inline-actions button,
  table.responsive-cards-table td[data-label="Acción"] .inline-actions button,
  .table-wrap table td[data-label="Accion"] .inline-actions button,
  .responsive-table-wrap table td[data-label="Accion"] .inline-actions button,
  table.responsive-cards-table td[data-label="Accion"] .inline-actions button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 50px !important;
  }

  /* Keep attachment buttons centered and inside the card. */
  .attachment-cell,
  .attachment-actions {
    width: 100% !important;
    max-width: 100% !important;
    justify-items: center !important;
    box-sizing: border-box !important;
  }

  .attachment-cell input,
  .attachment-actions button {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Remove visual underline from member phone numbers on iOS/Safari and normal mobile cards. */
  .page-members .table-wrap table td[data-label="Teléfono"],
  .page-members .table-wrap table td[data-label="Telefono"],
  .page-members .table-wrap table td[data-label="Teléfono"] *,
  .page-members .table-wrap table td[data-label="Telefono"] *,
  .page-members a[href^="tel"],
  .page-members a[x-apple-data-detectors],
  .page-members .member-phone,
  .page-members .member-phone * {
    text-decoration: none !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
    color: inherit !important;
  }
}

/* Prevent iOS data detector underline from changing the member list design. */
a[x-apple-data-detectors],
.page-members a[href^="tel"] {
  color: inherit !important;
  text-decoration: none !important;
  border-bottom: 0 !important;
}


/* v39.13 mobile attachment/action alignment fix
   Visual-only: centers Comprobante, Choose File, Adjuntar, Ver, Guardar and Eliminar inside mobile cards. */
@media (max-width: 767.98px) {
  .table-wrap table td[data-label="Comprobante"],
  .responsive-table-wrap table td[data-label="Comprobante"],
  table.responsive-cards-table td[data-label="Comprobante"],
  .table-wrap table td.mobile-attachment-td,
  .responsive-table-wrap table td.mobile-attachment-td,
  table.responsive-cards-table td.mobile-attachment-td {
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 14px 0 12px !important;
    text-align: center !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    border-bottom: 0 !important;
  }

  .table-wrap table td[data-label="Comprobante"]::before,
  .responsive-table-wrap table td[data-label="Comprobante"]::before,
  table.responsive-cards-table td[data-label="Comprobante"]::before,
  .table-wrap table td.mobile-attachment-td::before,
  .responsive-table-wrap table td.mobile-attachment-td::before,
  table.responsive-cards-table td.mobile-attachment-td::before {
    content: "Comprobante" !important;
    display: block !important;
    width: 100% !important;
    margin: 0 0 10px !important;
    text-align: center !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
  }

  .table-wrap table td[data-label="Comprobante"] .attachment-cell,
  .responsive-table-wrap table td[data-label="Comprobante"] .attachment-cell,
  table.responsive-cards-table td[data-label="Comprobante"] .attachment-cell,
  .table-wrap table td.mobile-attachment-td .attachment-cell,
  .responsive-table-wrap table td.mobile-attachment-td .attachment-cell,
  table.responsive-cards-table td.mobile-attachment-td .attachment-cell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: stretch !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
    overflow: hidden !important;
  }

  .table-wrap table td[data-label="Comprobante"] .attachment-cell small,
  .responsive-table-wrap table td[data-label="Comprobante"] .attachment-cell small,
  table.responsive-cards-table td[data-label="Comprobante"] .attachment-cell small,
  .table-wrap table td.mobile-attachment-td .attachment-cell small,
  .responsive-table-wrap table td.mobile-attachment-td .attachment-cell small,
  table.responsive-cards-table td.mobile-attachment-td .attachment-cell small {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    font-size: 15.5px !important;
    line-height: 1.25 !important;
    color: #475569 !important;
    font-weight: 850 !important;
    margin: 0 !important;
  }

  .table-wrap table td[data-label="Comprobante"] .attachment-cell input[type="file"],
  .responsive-table-wrap table td[data-label="Comprobante"] .attachment-cell input[type="file"],
  table.responsive-cards-table td[data-label="Comprobante"] .attachment-cell input[type="file"],
  .table-wrap table td.mobile-attachment-td .attachment-cell input[type="file"],
  .responsive-table-wrap table td.mobile-attachment-td .attachment-cell input[type="file"],
  table.responsive-cards-table td.mobile-attachment-td .attachment-cell input[type="file"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 12px 10px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    font-size: 15px !important;
    border-radius: 16px !important;
    overflow: hidden !important;
  }

  .attachment-cell input[type="file"]::file-selector-button {
    max-width: 50% !important;
    margin-right: 8px !important;
    border: 0 !important;
    border-radius: 999px !important;
    padding: 7px 12px !important;
  }

  .table-wrap table td[data-label="Comprobante"] .attachment-actions,
  .responsive-table-wrap table td[data-label="Comprobante"] .attachment-actions,
  table.responsive-cards-table td[data-label="Comprobante"] .attachment-actions,
  .table-wrap table td.mobile-attachment-td .attachment-actions,
  .responsive-table-wrap table td.mobile-attachment-td .attachment-actions,
  table.responsive-cards-table td.mobile-attachment-td .attachment-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 11px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .table-wrap table td[data-label="Comprobante"] .attachment-actions button,
  .responsive-table-wrap table td[data-label="Comprobante"] .attachment-actions button,
  table.responsive-cards-table td[data-label="Comprobante"] .attachment-actions button,
  .table-wrap table td.mobile-attachment-td .attachment-actions button,
  .responsive-table-wrap table td.mobile-attachment-td .attachment-actions button,
  table.responsive-cards-table td.mobile-attachment-td .attachment-actions button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 54px !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .table-wrap table td[data-label="Acción"],
  .responsive-table-wrap table td[data-label="Acción"],
  table.responsive-cards-table td[data-label="Acción"],
  .table-wrap table td[data-label="Accion"],
  .responsive-table-wrap table td[data-label="Accion"],
  table.responsive-cards-table td[data-label="Accion"],
  .table-wrap table td.mobile-actions-td,
  .responsive-table-wrap table td.mobile-actions-td,
  table.responsive-cards-table td.mobile-actions-td {
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 14px 0 0 !important;
    text-align: center !important;
    border-bottom: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .table-wrap table td[data-label="Acción"]::before,
  .responsive-table-wrap table td[data-label="Acción"]::before,
  table.responsive-cards-table td[data-label="Acción"]::before,
  .table-wrap table td[data-label="Accion"]::before,
  .responsive-table-wrap table td[data-label="Accion"]::before,
  table.responsive-cards-table td[data-label="Accion"]::before,
  .table-wrap table td.mobile-actions-td::before,
  .responsive-table-wrap table td.mobile-actions-td::before,
  table.responsive-cards-table td.mobile-actions-td::before {
    content: "" !important;
    display: none !important;
  }

  .table-wrap table td[data-label="Acción"] .inline-actions,
  .responsive-table-wrap table td[data-label="Acción"] .inline-actions,
  table.responsive-cards-table td[data-label="Acción"] .inline-actions,
  .table-wrap table td[data-label="Accion"] .inline-actions,
  .responsive-table-wrap table td[data-label="Accion"] .inline-actions,
  table.responsive-cards-table td[data-label="Accion"] .inline-actions,
  .table-wrap table td.mobile-actions-td .inline-actions,
  .responsive-table-wrap table td.mobile-actions-td .inline-actions,
  table.responsive-cards-table td.mobile-actions-td .inline-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: stretch !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .inline-actions select,
  .inline-actions input,
  .inline-actions button,
  .inline-actions .btn,
  .inline-actions .btn-small,
  .inline-actions .danger,
  .inline-actions .secondary {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
  }
}


/* v39.15 admin controls and mobile visual consistency */
body:not(.page-dashboard) .content-header-actions .user-pill,
body:not(.page-dashboard) .user-pill-with-photo {
  display: none !important;
}

.sidebar-close-button {
  display: grid !important;
  place-items: center !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  background: rgba(255,255,255,.10) !important;
  color: #fff !important;
  font-size: 34px !important;
  line-height: 1 !important;
  font-weight: 800 !important;
  text-align: center !important;
}

.sidebar-close-button::before,
.sidebar-close-button::after { content: none !important; }

@media (max-width: 760px) {
  .month-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .month-actions button,
  .month-actions a,
  .month-report-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
    min-height: 48px !important;
    line-height: 1.2 !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
  }

  .weekly-records-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-top: 12px !important;
    width: 100% !important;
  }
  .weekly-record-card {
    width: 100% !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 16px !important;
    padding: 14px !important;
    background: #fff !important;
    box-shadow: 0 10px 24px rgba(15,23,42,.06) !important;
    box-sizing: border-box !important;
  }
  .weekly-record-card div {
    display: grid !important;
    grid-template-columns: 92px 1fr !important;
    gap: 10px !important;
    align-items: baseline !important;
    padding: 4px 0 !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
  .weekly-record-card span {
    color: #475569 !important;
    font-weight: 900 !important;
  }
  .weekly-record-card strong {
    color: #0f172a !important;
    font-weight: 850 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
  .weekly-record-details summary {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 46px !important;
    width: 100% !important;
    border-radius: 14px !important;
    background: #111827 !important;
    color: #fff !important;
    font-weight: 900 !important;
    cursor: pointer !important;
    list-style: none !important;
  }
  .weekly-record-details summary::-webkit-details-marker { display: none !important; }
}


/* v39.16 tablet corrections: expense deletion visibility support, tablet forms/actions, user card hiding */
body:not(.page-dashboard) .content-header-actions,
body:not(.page-dashboard) .content-header-actions .user-pill,
body:not(.page-dashboard) .content-header-actions .user-pill-with-photo,
body:not(.page-dashboard) header.content-header .user-pill,
body:not(.page-dashboard) .current-user-card,
body:not(.page-dashboard) .dashboard-user-card,
body:not(.page-dashboard) .connected-user-card,
body:not(.page-dashboard) .top-user-card,
body:not(.page-dashboard) .user-line {
  display: none !important;
  visibility: hidden !important;
}

/* Keep the mobile sidebar close X identical across every page. */
.sidebar-close-button,
button.sidebar-close-button,
.app-sidebar .sidebar-close-button {
  display: grid !important;
  place-items: center !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  background: rgba(255,255,255,.10) !important;
  color: #ffffff !important;
  font-size: 34px !important;
  line-height: 1 !important;
  font-weight: 800 !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

@media (min-width: 768px) and (max-width: 1024px) {
  body.page-expenses #expenseForm .form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
    align-items: start !important;
    width: 100% !important;
  }

  body.page-expenses #expenseForm .form-grid > div,
  body.page-expenses #expenseForm .form-grid .full {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  body.page-expenses #expenseForm input,
  body.page-expenses #expenseForm select,
  body.page-expenses #expenseForm textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 50px !important;
    box-sizing: border-box !important;
  }

  body.page-expenses #expenseForm input[type="date"] {
    text-align: center !important;
    text-align-last: center !important;
  }

  body.page-expenses #expenseForm .full {
    grid-column: 1 / -1 !important;
  }

  /* Tablet income/expense lists: card-style rows to prevent compressed Action columns. */
  body.page-income .table-wrap,
  body.page-expenses .table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
  }

  body.page-income .table-wrap table,
  body.page-expenses .table-wrap table {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 14px !important;
  }

  body.page-income .table-wrap table thead,
  body.page-expenses .table-wrap table thead {
    display: none !important;
  }

  body.page-income .table-wrap table tbody,
  body.page-expenses .table-wrap table tbody {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  body.page-income .table-wrap table tr,
  body.page-expenses .table-wrap table tr {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 18px !important;
    box-shadow: 0 12px 28px rgba(15,23,42,.07) !important;
    padding: 18px !important;
    box-sizing: border-box !important;
  }

  body.page-income .table-wrap table td,
  body.page-expenses .table-wrap table td {
    display: grid !important;
    grid-template-columns: minmax(132px, 28%) minmax(0, 1fr) !important;
    gap: 14px !important;
    align-items: start !important;
    width: 100% !important;
    min-width: 0 !important;
    border: 0 !important;
    padding: 7px 0 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
  }

  body.page-income .table-wrap table td::before,
  body.page-expenses .table-wrap table td::before {
    content: attr(data-label) !important;
    display: block !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    text-transform: uppercase !important;
    letter-spacing: .07em !important;
  }

  body.page-income .table-wrap table td.mobile-actions-td,
  body.page-expenses .table-wrap table td.mobile-actions-td,
  body.page-income .table-wrap table td[data-label="Acción"],
  body.page-expenses .table-wrap table td[data-label="Acción"] {
    display: block !important;
    width: 100% !important;
    padding-top: 16px !important;
    border-top: 1px solid #edf2f7 !important;
  }

  body.page-income .table-wrap table td.mobile-actions-td::before,
  body.page-expenses .table-wrap table td.mobile-actions-td::before,
  body.page-income .table-wrap table td[data-label="Acción"]::before,
  body.page-expenses .table-wrap table td[data-label="Acción"]::before {
    content: "" !important;
    display: none !important;
  }

  body.page-income .inline-actions,
  body.page-expenses .inline-actions,
  body.page-income .attachment-cell,
  body.page-expenses .attachment-cell,
  body.page-income .attachment-actions,
  body.page-expenses .attachment-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.page-income .inline-actions select,
  body.page-expenses .inline-actions select,
  body.page-income .inline-actions input,
  body.page-expenses .inline-actions input,
  body.page-income .inline-actions button,
  body.page-expenses .inline-actions button,
  body.page-income .attachment-cell input,
  body.page-expenses .attachment-cell input,
  body.page-income .attachment-actions button,
  body.page-expenses .attachment-actions button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
  }

  body.page-income .inline-actions button,
  body.page-expenses .inline-actions button,
  body.page-income .attachment-actions button,
  body.page-expenses .attachment-actions button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
}

@media (min-width: 1024.02px) {
  body.page-income .table-wrap table th:last-child,
  body.page-income .table-wrap table td:last-child,
  body.page-expenses .table-wrap table th:last-child,
  body.page-expenses .table-wrap table td:last-child {
    min-width: 230px !important;
  }

  body.page-income .inline-actions,
  body.page-expenses .inline-actions {
    min-width: 220px !important;
  }
}


/* v39.17 tablet expense form date/category alignment
   Tablet-only correction: make the Fecha del gasto field narrower so it does not interfere with Categoría. */
@media (min-width: 768px) and (max-width: 1024px) {
  body.page-expenses #expenseForm .form-grid {
    grid-template-columns: minmax(220px, 0.85fr) minmax(280px, 1.15fr) !important;
    column-gap: 30px !important;
    row-gap: 20px !important;
    align-items: start !important;
  }

  body.page-expenses #expenseForm .form-grid > div:nth-child(1) {
    width: 100% !important;
    max-width: 100% !important;
    justify-self: start !important;
  }

  body.page-expenses #expenseForm #expense_date {
    width: 88% !important;
    max-width: 380px !important;
    min-width: 220px !important;
    justify-self: start !important;
    display: block !important;
    text-align: center !important;
    text-align-last: center !important;
    box-sizing: border-box !important;
  }

  body.page-expenses #expenseForm .form-grid > div:nth-child(2),
  body.page-expenses #expenseForm #category_id {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
}

/* On narrower tablets, use one column to avoid any field collision. */
@media (min-width: 768px) and (max-width: 860px) {
  body.page-expenses #expenseForm .form-grid {
    grid-template-columns: 1fr !important;
  }

  body.page-expenses #expenseForm #expense_date {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* v39.18 tablet-only expense attachment alignment
   Scope: tablet view only. Mobile phone and desktop layouts are not changed. */
@media (min-width: 768px) and (max-width: 1024.98px) {
  body.page-expenses .table-wrap table td.mobile-attachment-td,
  body.page-expenses .table-wrap table td[data-label="Comprobante"],
  body.page-expenses .table-wrap table td[data-label="COMPROBANTE"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 18px 0 !important;
    text-align: center !important;
    border-top: 1px solid #edf2f7 !important;
    box-sizing: border-box !important;
  }

  body.page-expenses .table-wrap table td.mobile-attachment-td::before,
  body.page-expenses .table-wrap table td[data-label="Comprobante"]::before,
  body.page-expenses .table-wrap table td[data-label="COMPROBANTE"]::before {
    content: attr(data-label) !important;
    display: block !important;
    width: 100% !important;
    margin: 0 auto 12px auto !important;
    text-align: center !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    text-transform: uppercase !important;
    letter-spacing: .07em !important;
  }

  body.page-expenses .table-wrap table td.mobile-attachment-td .attachment-cell,
  body.page-expenses .table-wrap table td[data-label="Comprobante"] .attachment-cell,
  body.page-expenses .table-wrap table td[data-label="COMPROBANTE"] .attachment-cell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    align-items: center !important;
    gap: 12px !important;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  body.page-expenses .table-wrap table td.mobile-attachment-td .attachment-cell small,
  body.page-expenses .table-wrap table td[data-label="Comprobante"] .attachment-cell small,
  body.page-expenses .table-wrap table td[data-label="COMPROBANTE"] .attachment-cell small {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 auto !important;
  }

  body.page-expenses .table-wrap table td.mobile-attachment-td .attachment-cell input[type="file"],
  body.page-expenses .table-wrap table td[data-label="Comprobante"] .attachment-cell input[type="file"],
  body.page-expenses .table-wrap table td[data-label="COMPROBANTE"] .attachment-cell input[type="file"] {
    display: block !important;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  body.page-expenses .table-wrap table td.mobile-attachment-td .attachment-actions,
  body.page-expenses .table-wrap table td[data-label="Comprobante"] .attachment-actions,
  body.page-expenses .table-wrap table td[data-label="COMPROBANTE"] .attachment-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    gap: 12px !important;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  body.page-expenses .table-wrap table td.mobile-attachment-td .attachment-actions button,
  body.page-expenses .table-wrap table td[data-label="Comprobante"] .attachment-actions button,
  body.page-expenses .table-wrap table td[data-label="COMPROBANTE"] .attachment-actions button {
    width: 100% !important;
    max-width: 620px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-content: center !important;
    text-align: center !important;
  }

  body.page-expenses .table-wrap table td.mobile-actions-td .inline-actions {
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-items: center !important;
  }

  body.page-expenses .table-wrap table td.mobile-actions-td .inline-actions select,
  body.page-expenses .table-wrap table td.mobile-actions-td .inline-actions input,
  body.page-expenses .table-wrap table td.mobile-actions-td .inline-actions button {
    width: 100% !important;
    max-width: 620px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
  }
}


/* v39.19 recurring expenses action button visibility and alignment */
@media (min-width: 768px) and (max-width: 1024px) {
  body.page-recurring .table-wrap table th:last-child,
  body.page-recurring .table-wrap table td:last-child {
    min-width: 220px !important;
    width: 220px !important;
  }

  body.page-recurring .inline-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    width: 100% !important;
    max-width: 220px !important;
    margin: 0 auto !important;
  }

  body.page-recurring .inline-actions .btn-small,
  body.page-recurring .inline-actions button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    white-space: normal !important;
    text-align: center !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1.15 !important;
  }
}

@media (min-width: 1024.02px) {
  body.page-recurring .inline-actions {
    gap: 8px !important;
    align-items: center !important;
  }
}


/* v39.20 income tablet/mobile alignment fixes
   Scope: Ingresos only. Corrects date/category grid collision and centers attachment/action controls. */
@media (min-width: 768px) and (max-width: 1024.98px) {
  body.page-income #incomeForm .form-grid,
  body.page-income .income-form-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    column-gap: 30px !important;
    row-gap: 28px !important;
    align-items: start !important;
  }

  body.page-income #incomeForm .form-grid > div,
  body.page-income .income-form-grid > div {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.page-income #incomeForm label {
    display: block !important;
    margin-bottom: 8px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
  }

  body.page-income #incomeForm input,
  body.page-income #incomeForm select,
  body.page-income #incomeForm textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  body.page-income #incomeForm #sent_date {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: block !important;
    text-align: center !important;
    text-align-last: center !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  body.page-income #incomeForm #sent_date::-webkit-date-and-time-value {
    text-align: center !important;
  }
}

@media (min-width: 768px) and (max-width: 860px) {
  body.page-income #incomeForm .form-grid,
  body.page-income .income-form-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1024.98px) {
  body.page-income .table-wrap table td.mobile-attachment-td,
  body.page-income .table-wrap table td[data-label="Comprobante"],
  body.page-income .table-wrap table td[data-label="COMPROBANTE"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 18px 0 !important;
    text-align: center !important;
    border-top: 1px solid #edf2f7 !important;
    box-sizing: border-box !important;
  }

  body.page-income .table-wrap table td.mobile-attachment-td::before,
  body.page-income .table-wrap table td[data-label="Comprobante"]::before,
  body.page-income .table-wrap table td[data-label="COMPROBANTE"]::before {
    content: attr(data-label) !important;
    display: block !important;
    width: 100% !important;
    margin: 0 auto 12px auto !important;
    text-align: center !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    text-transform: uppercase !important;
    letter-spacing: .07em !important;
  }

  body.page-income .table-wrap table td.mobile-attachment-td .attachment-cell,
  body.page-income .table-wrap table td[data-label="Comprobante"] .attachment-cell,
  body.page-income .table-wrap table td[data-label="COMPROBANTE"] .attachment-cell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    align-items: center !important;
    gap: 12px !important;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  body.page-income .table-wrap table td.mobile-attachment-td .attachment-cell small,
  body.page-income .table-wrap table td[data-label="Comprobante"] .attachment-cell small,
  body.page-income .table-wrap table td[data-label="COMPROBANTE"] .attachment-cell small {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 auto !important;
  }

  body.page-income .table-wrap table td.mobile-attachment-td .attachment-cell input[type="file"],
  body.page-income .table-wrap table td[data-label="Comprobante"] .attachment-cell input[type="file"],
  body.page-income .table-wrap table td[data-label="COMPROBANTE"] .attachment-cell input[type="file"] {
    display: block !important;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  body.page-income .table-wrap table td.mobile-attachment-td .attachment-actions,
  body.page-income .table-wrap table td[data-label="Comprobante"] .attachment-actions,
  body.page-income .table-wrap table td[data-label="COMPROBANTE"] .attachment-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    gap: 12px !important;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  body.page-income .table-wrap table td.mobile-attachment-td .attachment-actions button,
  body.page-income .table-wrap table td[data-label="Comprobante"] .attachment-actions button,
  body.page-income .table-wrap table td[data-label="COMPROBANTE"] .attachment-actions button {
    width: 100% !important;
    max-width: 620px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  body.page-income .table-wrap table td.mobile-actions-td,
  body.page-income .table-wrap table td[data-label="Acción"],
  body.page-income .table-wrap table td[data-label="ACCIÓN"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 18px 0 !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  body.page-income .table-wrap table td.mobile-actions-td .inline-actions,
  body.page-income .table-wrap table td[data-label="Acción"] .inline-actions,
  body.page-income .table-wrap table td[data-label="ACCIÓN"] .inline-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-items: center !important;
    box-sizing: border-box !important;
  }

  body.page-income .table-wrap table td.mobile-actions-td .inline-actions select,
  body.page-income .table-wrap table td.mobile-actions-td .inline-actions input,
  body.page-income .table-wrap table td.mobile-actions-td .inline-actions button,
  body.page-income .table-wrap table td[data-label="Acción"] .inline-actions select,
  body.page-income .table-wrap table td[data-label="Acción"] .inline-actions input,
  body.page-income .table-wrap table td[data-label="Acción"] .inline-actions button,
  body.page-income .table-wrap table td[data-label="ACCIÓN"] .inline-actions select,
  body.page-income .table-wrap table td[data-label="ACCIÓN"] .inline-actions input,
  body.page-income .table-wrap table td[data-label="ACCIÓN"] .inline-actions button {
    width: 100% !important;
    max-width: 620px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }
}


/* v39.20.11 weekly books mobile detail alignment fix
   Visual only: keeps calculations, verified/pending logic, Prisma and database untouched. */
@media (max-width: 760px) {
  body.page-weekly-books .table-wrap,
  body.page-weekly-books .responsive-table-wrap {
    overflow-x: hidden !important;
  }

  body.page-weekly-books .table-wrap table tr,
  body.page-weekly-books .responsive-table-wrap table tr,
  body.page-weekly-books table.responsive-cards-table tr {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.page-weekly-books .table-wrap table td.weekly-detail-cell,
  body.page-weekly-books .responsive-table-wrap table td.weekly-detail-cell,
  body.page-weekly-books table.responsive-cards-table td.weekly-detail-cell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    grid-template-columns: none !important;
    padding-top: 14px !important;
    margin-top: 8px !important;
    border-top: 1px solid #edf2f7 !important;
    text-align: left !important;
  }

  body.page-weekly-books .table-wrap table td.weekly-detail-cell::before,
  body.page-weekly-books .responsive-table-wrap table td.weekly-detail-cell::before,
  body.page-weekly-books table.responsive-cards-table td.weekly-detail-cell::before {
    content: "" !important;
    display: none !important;
  }

  body.page-weekly-books .weekly-record-details,
  body.page-weekly-books .weekly-record-details > summary,
  body.page-weekly-books .weekly-records-list,
  body.page-weekly-books .weekly-record-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  body.page-weekly-books .weekly-record-details > summary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 52px !important;
    padding: 14px 16px !important;
    border-radius: 16px !important;
  }

  body.page-weekly-books .weekly-record-details[open] > summary {
    margin-bottom: 12px !important;
  }

  body.page-weekly-books .weekly-records-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 0 !important;
  }

  body.page-weekly-books .weekly-record-card {
    padding: 16px !important;
    overflow: hidden !important;
  }

  body.page-weekly-books .weekly-record-card div {
    display: grid !important;
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.page-weekly-books .weekly-record-card strong,
  body.page-weekly-books .weekly-record-card span {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
  }
}

@media (max-width: 430px) {
  body.page-weekly-books .weekly-record-card div {
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr) !important;
  }
}

/* v39.20.29 mobile horizontal scroll containment
   Visual-only responsive fix: keep pages locked to the mobile viewport width. */
html,
body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

html {
  overscroll-behavior-x: none;
}

body {
  position: relative;
}

*,
*::before,
*::after {
  box-sizing: border-box !important;
}

body.app-shell-page,
body.app-shell-page .app-shell,
body.app-shell-page .container,
body.app-shell-page .app-content {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

body.app-shell-page .app-shell,
body.app-shell-page .app-content {
  width: 100% !important;
}

body.app-shell-page .content-header,
body.app-shell-page .content-header-main,
body.app-shell-page .content-header-actions,
body.app-shell-page .dashboard-container,
body.app-shell-page .dashboard-panel,
body.app-shell-page .panel,
body.app-shell-page .card,
body.app-shell-page .metric-grid,
body.app-shell-page .metric-card,
body.app-shell-page .dashboard-grid,
body.app-shell-page .quick-actions-panel,
body.app-shell-page .form-grid,
body.app-shell-page .toolbar,
body.app-shell-page .row,
body.app-shell-page form,
body.app-shell-page fieldset,
body.app-shell-page input,
body.app-shell-page select,
body.app-shell-page textarea,
body.app-shell-page button {
  max-width: 100% !important;
  min-width: 0;
}

body.app-shell-page img,
body.app-shell-page svg,
body.app-shell-page canvas,
body.app-shell-page video {
  max-width: 100% !important;
}

body.app-shell-page .table-wrap {
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

@media (max-width: 1023.98px) {
  html,
  body,
  body.app-shell-page,
  body.app-shell-page .app-shell {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.app-shell-page .app-shell {
    overflow-x: clip !important;
  }

  body.app-shell-page .app-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  body.app-shell-page .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-x: hidden !important;
  }

  body.app-shell-page .content-header,
  body.app-shell-page .dashboard-panel,
  body.app-shell-page .panel,
  body.app-shell-page .card,
  body.app-shell-page .metric-card {
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: break-word;
    word-break: normal;
  }

  body.app-shell-page .form-grid,
  body.app-shell-page .toolbar,
  body.app-shell-page .row,
  body.app-shell-page .content-header-actions {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.app-shell-page .form-grid > *,
  body.app-shell-page .toolbar > *,
  body.app-shell-page .row > *,
  body.app-shell-page .content-header-actions > * {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.app-shell-page input,
  body.app-shell-page select,
  body.app-shell-page textarea,
  body.app-shell-page button {
    max-width: 100% !important;
  }

  body.app-shell-page .app-sidebar {
    left: 0 !important;
    right: auto !important;
    max-width: 88vw !important;
    overflow-x: hidden !important;
  }

  body.app-shell-page:not(.sidebar-open) .app-sidebar {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.app-shell-page.sidebar-open .app-sidebar {
    visibility: visible !important;
    pointer-events: auto !important;
  }
}
