:root {
  color-scheme: light;
  --ink: #1b2328;
  --muted: #5d6b73;
  --line: #d3dadf;
  --paper: #f1f3f5;
  --white: #fff;
  --navy: #0b3347;
  --navy-2: #176889;
  --teal: #176889;
  --teal-light: #dcebf2;
  --blue-bright: #1e88c8;
  --green: #2e9e4f;
  --amber: #a76812;
  --amber-light: #fff3df;
  --red: #b3261e;
  --shadow: 0 2px 8px rgba(11, 51, 71, .04);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 340px; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .92fr) 1.08fr; background: var(--white); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding: 9vw; overflow: hidden; color: white; background: radial-gradient(ellipse at 16% 84%, rgba(16, 137, 125, .31), transparent 42%), linear-gradient(145deg, #102b3b, #173e50); }
.login-brand::after { position: absolute; right: -180px; bottom: -235px; width: 560px; height: 560px; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; box-shadow: 0 0 0 52px rgba(255,255,255,.025), 0 0 0 104px rgba(255,255,255,.02); content: ""; }
.brand-mark { display: grid; width: 52px; height: 52px; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 16px; color: white; background: linear-gradient(145deg, #19a698, #08756f); font: 800 27px Inter, "Segoe UI", system-ui, sans-serif; box-shadow: 0 8px 22px rgba(0, 0, 0, .13); }
.login-brand .brand-mark { margin-bottom: 58px; }
.eyebrow { margin: 0 0 11px; color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.login-brand .eyebrow { color: #80cfc3; }
.login-brand h1 { margin: 0; font: 700 clamp(36px, 4vw, 58px)/1.13 Inter, "Segoe UI", system-ui, sans-serif; letter-spacing: -.055em; }
.login-copy { max-width: 430px; margin: 23px 0 0; color: #c1d0d5; font-size: 15px; line-height: 1.8; }
.login-footnote { position: absolute; z-index: 1; bottom: 40px; display: flex; align-items: center; gap: 9px; color: #c1d0d5; font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(390px, 100%); }
.login-card h2 { margin: 0 0 8px; font: 700 30px Inter, "Segoe UI", system-ui, sans-serif; letter-spacing: -.04em; }
.muted { color: var(--muted); }
.login-card > .muted { margin: 0 0 32px; font-size: 14px; }
.login-card label { display: block; margin: 18px 0 8px; font-size: 12px; font-weight: 700; }
.login-card input { width: 100%; height: 48px; padding: 0 13px; border: 1px solid #dce4e6; border-radius: 9px; outline: none; color: var(--ink); background: white; transition: border .15s, box-shadow .15s; }
.login-card input:focus, .search-box:focus-within { border-color: #159b8e; box-shadow: 0 0 0 3px rgba(21,155,142,.11); }
.button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px; font-size: 12px; font-weight: 700; transition: transform .15s, background .15s; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { color: white; background: var(--teal); }
.button-primary:hover { background: #08796f; }
.button-wide { width: 100%; min-height: 48px; margin-top: 24px; }
.login-security { margin: 18px 0 0; color: #96a2a7; font-size: 11px; text-align: center; }
.form-error { color: var(--red); font-size: 12px; line-height: 1.5; }

.app-layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; width: 248px; flex-direction: column; padding: 28px 18px 18px; color: white; background: var(--navy); }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 2px 5px 31px; color: white; text-decoration: none; }
.brand-lockup strong { display: block; font: 800 20px Inter, "Segoe UI", system-ui, sans-serif; letter-spacing: -.06em; }
.brand-lockup strong span { color: #74c9bd; }
.brand-lockup small { display: block; margin-top: 3px; color: #8da5ae; font-size: 8px; font-weight: 700; letter-spacing: .15em; }
.brand-mark-small { width: 39px; height: 39px; border-radius: 12px; font-size: 21px; }
.nav-caption { margin: 8px 10px 11px; color: #7d97a1; font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.main-nav { display: grid; gap: 6px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; color: #afc0c6; background: transparent; text-align: left; font-size: 12px; font-weight: 600; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.is-active { color: white; background: rgba(67, 174, 158, .2); box-shadow: inset 3px 0 #42b8a7; }
.nav-icon { width: 18px; color: #83c9be; font-size: 18px; text-align: center; }
.sidebar-bottom { display: grid; gap: 15px; margin-top: auto; padding: 14px 7px 3px; border-top: 1px solid rgba(255,255,255,.1); }
.connection-state { display: flex; align-items: center; gap: 8px; color: #aec1c6; font-size: 10px; }
.online-dot { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #45c7a5; box-shadow: 0 0 0 3px rgba(69,199,165,.12); }
.logout-button { display: flex; align-items: center; gap: 10px; padding: 9px 0; border: 0; color: #d0dcdf; background: transparent; text-align: left; font-size: 11px; }
.logout-button:hover { color: white; }
.logout-button span { font-size: 18px; }
.sidebar .nav-item[hidden] { display: none; }

.workspace { min-height: 100vh; margin-left: 248px; }
.topbar { position: sticky; top: 0; z-index: 1; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 15px; padding: 0 40px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: #879399; font-size: 11px; }
.breadcrumb-divider { color: #c2cbce; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.last-updated { color: #91a0a5; font-size: 10px; }
.button-refresh { min-height: 35px; border: 1px solid #dce5e6; color: #43575e; background: white; }
.button-refresh span { margin-right: 6px; color: var(--teal); font-size: 17px; vertical-align: -1px; }
.button-refresh:hover { border-color: #9acbc4; background: #f6fbfa; }
.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 15px; border-left: 1px solid var(--line); }
.avatar { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; color: #0a766e; background: #ddf2ed; font-size: 11px; font-weight: 700; }
.user-name { max-width: 145px; overflow: hidden; color: #465960; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.page-content { width: min(1400px, 100%); margin: auto; padding: 34px 40px 24px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.page-heading h1 { margin: 0 0 6px; font: 700 26px Inter, "Segoe UI", system-ui, sans-serif; letter-spacing: -.045em; }
.page-heading .muted { margin: 0; font-size: 12px; }
.live-badge { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; padding: 8px 11px; border: 1px solid #dbece8; border-radius: 20px; color: #41786e; background: #f6fbf9; font-size: 10px; font-weight: 600; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.metric-card, .panel, .zone-card { border: 1px solid #e8edef; border-radius: 12px; background: var(--white); box-shadow: var(--shadow); }
.metric-card { min-height: 132px; padding: 18px 18px 16px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: #708087; font-size: 10px; font-weight: 600; }
.metric-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; color: #0b897d; background: var(--teal-light); font-size: 14px; }
.metric-card:nth-child(2) .metric-icon { color: #a66d1a; background: var(--amber-light); }
.metric-card:nth-child(3) .metric-icon { color: #5280aa; background: #e9f2fa; }
.metric-card:nth-child(4) .metric-icon { color: #755db0; background: #f0ecfa; }
.metric-value { display: block; margin-top: 13px; color: var(--ink); font: 700 24px Inter, "Segoe UI", system-ui, sans-serif; letter-spacing: -.04em; }
.metric-foot { display: block; margin-top: 5px; color: #8b989d; font-size: 10px; }
.panel { margin-bottom: 16px; padding: 21px 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.panel-heading h2 { margin: 0 0 5px; font: 700 14px Inter, "Segoe UI", system-ui, sans-serif; letter-spacing: -.02em; }
.panel-heading .muted { margin: 0; font-size: 10px; }
.panel-unit { color: #8c999e; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.chart-panel { min-height: 228px; }
.weekly-chart { display: grid; min-height: 135px; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: end; gap: 18px; padding: 0 7px; }
.chart-day { display: grid; height: 125px; grid-template-rows: 1fr 15px; justify-items: center; gap: 6px; }
.chart-bar-wrap { display: flex; width: 100%; align-items: flex-end; justify-content: center; }
.chart-bar { width: min(27px, 60%); min-height: 3px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #3eb5a2, #128b80); }
.chart-day:first-child .chart-bar, .chart-day:last-child .chart-bar { background: #cbeae4; }
.chart-label { color: #8a979c; font-size: 9px; }
.zone-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.zone-card { width: 100%; padding: 16px; text-align: left; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.zone-card:hover { transform: translateY(-2px); border-color: #a9d6cf; box-shadow: 0 12px 27px rgba(20, 88, 81, .09); }
.zone-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.zone-card h3 { margin: 0; font: 700 13px Inter, "Segoe UI", system-ui, sans-serif; }
.zone-arrow { color: #0b897d; font-size: 18px; }
.zone-card .zone-meta { margin: 5px 0 14px; color: #849197; font-size: 10px; }
.zone-stats { display: flex; align-items: center; gap: 17px; padding-top: 12px; border-top: 1px solid #edf0f1; color: #67777e; font-size: 10px; }
.zone-stats strong { display: block; margin-top: 3px; color: var(--ink); font-size: 12px; }
.zone-debt { margin-left: auto; text-align: right; }
.text-button { border: 0; color: var(--teal); background: transparent; font-size: 10px; font-weight: 700; }
.text-button:hover { color: #075f58; }
.content-view { animation: appear .2s ease-out; }
@keyframes appear { from { opacity: .6; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.customers-panel { margin-top: 18px; padding: 22px 0 0; overflow: hidden; }
.customers-heading { align-items: flex-end; padding: 0 22px; }
.customers-heading h2 { font-size: 17px; }
.search-box { display: flex; width: min(340px, 45%); height: 39px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #dce5e6; border-radius: 8px; color: #829096; transition: border .15s, box-shadow .15s; }
.search-box > span { font-size: 18px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #f8fafa; }
th { padding: 11px 15px; color: #87949a; font-size: 8px; font-weight: 700; letter-spacing: .09em; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
td { padding: 13px 15px; border-top: 1px solid #edf0f1; color: #5f7077; font-size: 10px; vertical-align: middle; }
td.customer-cell { color: var(--ink); font-weight: 700; }
.customer-phone { display: block; margin-top: 4px; color: #929da1; font-size: 9px; font-weight: 400; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; color: #277b59; background: #e8f6ed; font-size: 9px; font-weight: 600; white-space: nowrap; }
.status-pill.inactive { color: #8b7070; background: #f5eded; }
.balance { color: #9c5f14; font-weight: 700; white-space: nowrap; }
.table-scroll table td.customer-cell,
.table-scroll table td.balance,
.table-scroll table td[data-label*="cliente" i],
.table-scroll table td[data-label*="saldo" i],
.table-scroll table td[data-label*="cliente" i] > .cell-text,
.table-scroll table td[data-label*="saldo" i] > .cell-text {
  font-weight: 700;
}
.align-right { text-align: right; }
.empty-state { padding: 25px; color: #8a979c; font-size: 11px; text-align: center; }
.row-actions { min-width: 150px; white-space: nowrap; }
.small-button { margin: 2px 4px 2px 0; padding: 6px 8px; border: 1px solid #dce6e7; border-radius: 6px; color: #315b5b; background: #fff; font-size: 9px; font-weight: 600; }
.small-button:hover { border-color: #a6d2cb; background: #f3faf8; }
.small-button.small-danger { border-color: #f0d8d5; color: #a34e49; }
.small-button.small-danger:hover { background: #fff6f5; }
.add-customer-action { display: flex; justify-content: flex-end; padding: 0 22px 14px; }
.filter-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.filter-row label, .form-grid > label { display: grid; gap: 7px; color: #52656c; font-size: 10px; font-weight: 600; }
.filter-row input, .filter-row select, .form-grid input, .form-grid select { min-height: 38px; min-width: 150px; padding: 0 10px; border: 1px solid #dce5e6; border-radius: 7px; outline: 0; color: var(--ink); background: white; font-size: 11px; }
.filter-row input:focus, .filter-row select:focus, .form-grid input:focus, .form-grid select:focus { border-color: #159b8e; box-shadow: 0 0 0 3px rgba(21,155,142,.1); }
.filter-row > .muted { margin: 0 0 11px auto; font-size: 10px; }
.report-metrics { margin-top: 15px; }
.module-skeleton { min-height: 250px; }
.notice-success { border-color: #c6e6d8; color: #2d7353; background: #f2fbf6; }
.modal-backdrop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 25px; background: rgba(11, 31, 40, .55); backdrop-filter: blur(3px); }
.modal-card { width: min(680px, 100%); max-height: min(88vh, 900px); overflow: auto; border: 1px solid #e0e8e9; border-radius: 14px; background: white; box-shadow: 0 25px 90px rgba(3, 22, 31, .28); }
.modal-heading { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); background: white; }
.modal-heading h2 { margin: 0; font: 700 16px Inter, "Segoe UI", system-ui, sans-serif; }
.icon-close { width: 30px; height: 30px; border: 0; border-radius: 50%; color: #6f7e83; background: #f1f5f5; font-size: 21px; }
.modal-content { padding: 20px 22px 23px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.form-grid fieldset { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.form-grid legend { padding: 0 5px; color: #52656c; font-size: 10px; font-weight: 700; }
.zone-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.zone-checks label, .checkbox-label { display: flex !important; align-items: center; gap: 8px !important; color: #596c72 !important; font-size: 10px !important; font-weight: 500 !important; }
.zone-checks input, .checkbox-label input { min-width: 0; min-height: 0; accent-color: var(--teal); }
.checkbox-label { align-self: center; min-height: 36px; }
.user-section { display: grid; gap: 12px; }
.user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 15px; }
.user-form-grid > label { display: grid; gap: 7px; color: #52656c; font-size: 10px; font-weight: 600; }
.user-form-grid .user-active { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 38px; color: #52656c; font-size: 10px; font-weight: 600; }
.user-active input, .permission-card input { min-width: 0; min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--teal); }
.user-subsection { display: grid; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
.user-subsection > strong { color: #334b53; font-size: 10px; }
.user-subsection > p, .user-section-help { margin: 0; color: #728188; font-size: 10px; line-height: 1.45; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.permission-card { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfdfd; cursor: pointer; }
.permission-card input { flex: 0 0 auto; margin: 2px 0 0; }
.permission-card span, .permission-card strong, .permission-card small { display: block; }
.permission-card strong { color: #334b53; font-size: 10px; line-height: 1.35; }
.permission-card small { margin-top: 4px; color: #728188; font-size: 9px; line-height: 1.4; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }

@media (max-width: 600px) {
  .user-form-grid, .permission-grid { grid-template-columns: 1fr; }
}
.receipt-preview { max-width: 400px; margin: auto; padding: 12px; color: #40535a; text-align: center; }
.receipt-brand { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 18px; text-align: left; }
.receipt-brand strong, .receipt-brand small { display: block; }
.receipt-brand small { margin-top: 3px; color: #849197; font-size: 8px; letter-spacing: .12em; }
.receipt-number { padding: 12px; border-block: 1px dashed #c7d1d4; font-weight: 700; }
.receipt-total { margin: 20px 0; color: var(--teal); font: 800 28px Inter, "Segoe UI", system-ui, sans-serif; }
.receipt-preview .form-actions { margin-top: 25px; }
.notice { margin-bottom: 20px; padding: 12px 15px; border: 1px solid; border-radius: 9px; font-size: 11px; line-height: 1.5; }
.notice-error { border-color: #f0d2d0; color: #984646; background: #fff7f6; }
.skeleton { min-height: 95px; border-radius: 12px; background: linear-gradient(90deg, #edf1f2 25%, #f6f8f8 50%, #edf1f2 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.page-footer { display: flex; justify-content: space-between; padding: 10px 2px 0; color: #9aa5a9; font-size: 9px; }

@media (max-width: 1100px) {
  .sidebar { width: 215px; }
  .workspace { margin-left: 215px; }
  .topbar { padding: 0 25px; }
  .page-content { padding: 29px 25px 20px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zone-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 250px; padding: 30px; }
  .login-brand .brand-mark { margin-bottom: 22px; }
  .login-brand h1 { font-size: 35px; }
  .login-copy { margin-top: 12px; font-size: 12px; }
  .login-footnote { display: none; }
  .login-panel { padding: 38px 25px; }
  .sidebar { position: sticky; top: 0; inset: auto; width: 100%; height: 59px; flex-direction: row; align-items: center; justify-content: space-between; padding: 0 12px; }
  .brand-lockup { padding: 0; }
  .brand-lockup strong { font-size: 16px; }
  .brand-lockup small, .nav-caption, .sidebar-bottom, .nav-item:not(.is-active) { display: none; }
  .brand-mark-small { width: 34px; height: 34px; }
  .main-nav { display: flex; overflow: visible; }
  .nav-item { min-height: 36px; padding: 0 10px; font-size: 10px; }
  .workspace { margin-left: 0; }
  .topbar { position: relative; min-height: 54px; padding: 0 15px; }
  .breadcrumb { font-size: 10px; }
  .topbar-actions { gap: 9px; }
  .last-updated, .user-name { display: none; }
  .user-chip { padding-left: 8px; }
  .button-refresh { min-height: 32px; padding: 0 9px; font-size: 10px; }
  .page-content { padding: 24px 15px 18px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 22px; }
  .page-heading .muted { max-width: 280px; line-height: 1.5; }
  .live-badge { padding: 7px; font-size: 0; }
  .live-badge .online-dot { margin: 0; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 112px; padding: 13px; }
  .metric-value { font-size: 19px; }
  .metric-top { font-size: 9px; }
  .metric-icon { width: 25px; height: 25px; }
  .zone-grid { grid-template-columns: 1fr; }
  .panel { padding: 17px 14px; }
  .customers-heading { align-items: stretch; flex-direction: column; padding: 0 14px; }
  .search-box { width: 100%; }
  th { padding: 10px; }
  td { padding: 11px 10px; }
  th:first-child, td:first-child { padding-left: 14px; }
  th:last-child, td:last-child { padding-right: 14px; }
  .page-footer { gap: 10px; font-size: 8px; }
}

@media print {
  body.print-report * { visibility: hidden !important; }
  body.print-report #module-view, body.print-report #module-view * { visibility: visible !important; }
  body.print-report #module-view { position: absolute; inset: 0; display: block; padding: 20px; background: white; }
  body:not(.print-report) * { visibility: hidden !important; }
  body:not(.print-report) #modal-root, body:not(.print-report) #modal-root * { visibility: visible !important; }
  body:not(.print-report) #modal-root { position: absolute; inset: 0; display: block; padding: 0; background: white; }
  body:not(.print-report) .modal-card { width: 100%; max-height: none; overflow: visible; border: 0; box-shadow: none; }
  body:not(.print-report) .modal-heading, body:not(.print-report) .receipt-preview .form-actions { display: none !important; }
  body:not(.print-report) .modal-content { padding: 0; }
}

/* Tema EnCobros: colores del logo y de la app Android, tipografía más grande */
@media screen {
  .table-excel-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
  .customer-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
  .customer-dashboard-grid .panel { margin: 0; }
  .customer-dashboard-data { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; }
  .customer-dashboard-data dt { color: var(--muted); }
  .customer-dashboard-data dd { margin: 0; overflow-wrap: anywhere; }
  .customer-dashboard-balances { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
  .customer-dashboard-balances .panel { margin: 0; }
  .customer-dashboard-balances span, .customer-dashboard-balances strong { display: block; }
  .customer-dashboard-balances strong { margin-top: 8px; font-size: 24px; }
  :root { font-size: 17px; }
  body { font-size: 16px; }
  .login-brand { background: radial-gradient(ellipse at 16% 84%, rgba(30, 136, 200, .45), transparent 46%), linear-gradient(145deg, #0b3347, #176889); }
  .login-brand .eyebrow { color: #9bd3f2; font-size: 13px; }
  .login-brand h1 { font-size: clamp(40px, 4.4vw, 64px); }
  .login-copy { color: #dbe9f0; font-size: 18px; }
  .login-footnote { color: #dbe9f0; font-size: 14px; }
  .login-logo { width: min(330px, 80%); margin: 0 0 40px -12px; }
  .login-card-logo { display: block; width: 190px; margin: 0 auto 6px; }
  .eyebrow { color: var(--blue-bright); font-size: 13px; }
  .login-card h2 { font-size: 34px; }
  .login-card > .muted { font-size: 16px; }
  .login-card label { font-size: 15px; }
  .login-card input { height: 54px; font-size: 16px; border-color: #b9c6cd; }
  .login-card input:focus, .search-box:focus-within, .filter-row input:focus, .filter-row select:focus, .form-grid input:focus, .form-grid select:focus { border-color: var(--blue-bright); box-shadow: 0 0 0 3px rgba(30, 136, 200, .2); }
  .login-security { color: var(--muted); font-size: 13px; }
  .form-error { font-size: 14px; }
  .button { min-height: 46px; padding: 0 20px; border-radius: 9px; font-size: 15px; }
  .button-primary { background: linear-gradient(135deg, #1e88c8, #176889); box-shadow: 0 6px 16px rgba(23, 104, 137, .28); }
  .button-primary:hover { background: linear-gradient(135deg, #176889, #0b3347); }
  .button-wide { min-height: 54px; font-size: 16px; }

  .sidebar { width: 280px; background: linear-gradient(180deg, #0b3347 0%, #124f69 100%); }
  .workspace { margin-left: 280px; }
  .brand-lockup { padding: 0 0 22px; }
  .brand-logo { width: 100%; max-width: 220px; height: auto; display: block; }
  .nav-caption { color: #9bd3f2; font-size: 12px; }
  .nav-item { min-height: 50px; gap: 13px; color: #dbe9f0; font-size: 16px; font-weight: 600; }
  .nav-item:hover { background: rgba(255, 255, 255, .1); }
  .nav-item.is-active { background: rgba(30, 136, 200, .38); box-shadow: inset 4px 0 #5cc0f2; }
  .nav-icon { width: 22px; color: #7fd0f7; font-size: 21px; }
  .connection-state { color: #dbe9f0; font-size: 14px; }
  .online-dot { background: #4fd273; box-shadow: 0 0 0 3px rgba(79, 210, 115, .22); }
  .logout-button { color: #fff; font-size: 15px; }

  .topbar { min-height: 76px; border-bottom: 3px solid var(--blue-bright); background: #fff; }
  .breadcrumb { color: var(--muted); font-size: 15px; }
  .breadcrumb strong { color: var(--navy); font-weight: 700; }
  .last-updated { color: var(--muted); font-size: 13px; }
  .button-refresh { min-height: 42px; border-color: #b9c6cd; color: var(--navy); }
  .button-refresh span { color: var(--blue-bright); }
  .avatar { width: 38px; height: 38px; color: #fff; background: var(--teal); font-size: 14px; }
  .user-name { font-size: 15px; color: var(--ink); }
  .page-heading h1 { color: var(--navy); font-size: 32px; }
  .page-heading .muted { font-size: 15px; }
  .live-badge { border-color: #bfe1f3; color: #0b5d86; background: #e8f4fb; font-size: 13px; }

  .metric-card, .panel, .zone-card { border-color: #d3dadf; }
  .metric-card { min-height: 150px; border-top: 4px solid var(--blue-bright); }
  .metric-card:nth-child(2) { border-top-color: var(--green); }
  .metric-card:nth-child(3) { border-top-color: var(--amber); }
  .metric-card:nth-child(4) { border-top-color: var(--red); }
  .metric-top { color: var(--muted); font-size: 14px; }
  .metric-card strong, .metric-value { font-size: 1.15em; }
  .zone-card h3 { font-size: 17px; }
  .zone-arrow, .text-button { color: var(--blue-bright); }
  .zone-card .zone-meta, .zone-stats { color: var(--muted); font-size: 13px; }
  .zone-stats strong { font-size: 16px; }
  .text-button { font-size: 14px; }
  .customers-heading h2, .panel h2 { color: var(--navy); font-size: 21px; }
  .search-box { height: 46px; border-color: #b9c6cd; }
  .search-box input { font-size: 15px; }
  thead { background: #e3edf2; }
  th { padding: 14px 15px; color: var(--navy); font-size: 12px; font-weight: 800; }
  td { padding: 16px 15px; color: #33434b; font-size: 15px; }
  td.customer-cell { color: var(--navy); }
  .customer-phone { color: var(--muted); font-size: 13px; }
  tbody tr:hover { background: #f1f7fb; }
  .status-pill { padding: 6px 11px; color: #1f7a3b; background: #def3e4; font-size: 13px; font-weight: 700; }
  .status-pill.inactive { color: #8a3b36; background: #f8e3e1; }
  .balance { color: #965b0b; }
  .empty-state { color: var(--muted); font-size: 15px; }
  .small-button { padding: 8px 11px; border-color: #b9c6cd; color: var(--teal); font-size: 13px; }
  .small-button:hover { border-color: var(--blue-bright); background: #e8f4fb; }
  .filter-row label, .form-grid > label { color: #33434b; font-size: 14px; }
  .filter-row input, .filter-row select, .form-grid input, .form-grid select { min-height: 46px; border-color: #b9c6cd; font-size: 15px; }
  .filter-row > .muted { font-size: 14px; }
  .modal-heading h2 { color: var(--navy); font-size: 21px; }
  .form-grid legend { font-size: 14px; }
  .zone-checks label, .checkbox-label { color: #33434b !important; font-size: 14px !important; }
  .receipt-brand small { font-size: 11px; }
  .receipt-total { color: var(--teal); }
  .notice { font-size: 15px; }
  .notice-error { border-color: #f0c4c1; color: #8f241e; background: #fdf0ef; }
  .notice-success { border-color: #bfe3cb; color: #1f6b3a; background: #eef9f1; }
  .page-footer { color: var(--muted); font-size: 12px; }

  /* Sin tonos verdosos: azules del logo y de la app, gris institucional */
  .login-brand .eyebrow, .nav-caption { color: #a9d8f3; }
  .brand-lockup { display: block; padding: 0 0 26px; }
  .brand-logo { display: block; width: 220px; max-width: 100%; height: auto; object-fit: contain; }
  .login-logo { display: block; width: 300px; max-width: 100%; height: auto; margin: 0 0 40px; object-fit: contain; }
  .button-primary:hover { background: linear-gradient(135deg, #176889, #0b3347); }
  .nav-icon { color: #7fc4ee; }
  .nav-item.is-active { background: rgba(30, 136, 200, .38); box-shadow: inset 4px 0 #5cb8f0; }
  .online-dot { background: #5cb8f0; box-shadow: 0 0 0 3px rgba(92, 184, 240, .25); }
  .button-refresh:hover { border-color: var(--blue-bright); background: #e8f4fb; }
  .metric-icon { color: var(--teal); background: #dcebf2; }
  .metric-card:nth-child(2) .metric-icon { color: #4b4d4c; background: #e8eaec; }
  .zone-arrow { color: var(--blue-bright); }
  .text-button:hover { color: #0b3347; }
  .small-button:hover { border-color: var(--blue-bright); background: #e8f4fb; }
  .receipt-total { color: var(--teal); }
  .metric-card:nth-child(2) { border-top-color: #4b4d4c; }
  .status-pill { color: #176889; background: #dcebf2; }
  .status-pill.inactive { color: #4b4d4c; background: #e8eaec; }
  .notice-success { border-color: #bcd8e8; color: #0b3347; background: #e8f4fb; }
  .login-card input:focus, .search-box:focus-within { border-color: var(--blue-bright); }
  .panel .muted, .panel-heading .muted, .zone-grid .muted { font-size: 14px; }
  .panel-unit { color: var(--teal); font-size: 13px; font-weight: 700; }
  .page-footer { font-size: 13px; }
  .nav-item { min-height: 44px; }
  .main-nav { scrollbar-width: thin; scrollbar-color: #5cb8f0 transparent; }
  .main-nav::-webkit-scrollbar { width: 6px; }
  .main-nav::-webkit-scrollbar-thumb { border-radius: 6px; background: #5cb8f0; }
  .main-nav::-webkit-scrollbar-track { background: transparent; }

  /* Tipografía ampliada */
  :root { font-size: 18px; }
  body { font-size: 18px; }
  .sidebar { width: 300px; }
  .workspace { margin-left: 300px; }
  .brand-logo { width: 240px; }
  .nav-caption { font-size: 13px; }
  .nav-item { min-height: 48px; font-size: 18px; }
  .nav-icon { font-size: 23px; }
  .connection-state { font-size: 15px; }
  .logout-button { font-size: 17px; }
  .breadcrumb { font-size: 17px; }
  .last-updated { font-size: 14px; }
  .button { font-size: 17px; min-height: 48px; }
  .button-refresh { min-height: 46px; }
  .user-name { font-size: 17px; }
  .avatar { width: 42px; height: 42px; font-size: 16px; }
  .page-content { width: 100%; max-width: none; margin: 0; padding: 32px 36px 28px; }
  .topbar { padding: 0 36px; }
  .zone-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .metric-grid { gap: 20px; }
  .customers-panel, .panel { width: 100%; }
  .search-box { width: min(480px, 50%); }
  .page-heading h1 { font-size: 38px; }
  .page-heading .muted { font-size: 17px; }
  .eyebrow { font-size: 14px; }
  .live-badge { font-size: 15px; }
  .metric-top { font-size: 16px; }
  .metric-card { min-height: 165px; }
  .metric-card strong { font-size: 30px; }
  .zone-card h3 { font-size: 20px; }
  .zone-card .zone-meta, .zone-stats { font-size: 15px; }
  .zone-stats strong { font-size: 18px; }
  .text-button { font-size: 16px; }
  .customers-heading h2, .panel h2 { font-size: 24px; }
  .panel .muted, .panel-heading .muted, .zone-grid .muted { font-size: 16px; }
  .panel-unit { font-size: 15px; }
  .search-box { height: 50px; }
  .search-box input { font-size: 17px; }
  th { padding: 16px 16px; font-size: 14px; }
  td { padding: 18px 16px; font-size: 17px; }
  .customer-phone { font-size: 15px; }
  .status-pill { padding: 7px 13px; font-size: 15px; }
  .empty-state { font-size: 17px; }
  .small-button { padding: 9px 13px; font-size: 15px; }
  .filter-row label, .form-grid > label { font-size: 16px; }
  .filter-row input, .filter-row select, .form-grid input, .form-grid select { min-height: 50px; font-size: 17px; }
  .filter-row > .muted { font-size: 16px; }
  .modal-card { width: min(760px, 100%); }
  .modal-heading h2 { font-size: 24px; }
  .form-grid legend { font-size: 16px; }
  .zone-checks label, .checkbox-label { font-size: 16px !important; }
  .notice { font-size: 17px; }
  .page-footer { font-size: 14px; }
  .receipt-total { font-size: 34px; }
  .login-card h2 { font-size: 38px; }
  .login-card > .muted { font-size: 18px; }
  .login-card label { font-size: 17px; }
  .login-card input { height: 58px; font-size: 18px; }
  .login-brand h1 { font-size: clamp(42px, 4.6vw, 68px); }
  .login-copy { font-size: 20px; }
  .login-security, .form-error { font-size: 15px; }

  /* Jerarquía equilibrada y colores más vivos */
  :root { font-size: 16px; --blue-bright: #1e90e0; --teal: #1470a0; --navy: #0a3a5a; }
  body { font-size: 16px; background: #eef3f8; }
  .sidebar { background: linear-gradient(180deg, #0a3a5a 0%, #0f5d8c 60%, #1470a0 100%); }
  .nav-item { font-size: 16px; min-height: 46px; }
  .nav-item.is-active { background: linear-gradient(90deg, rgba(30, 144, 224, .6), rgba(30, 144, 224, .22)); box-shadow: inset 4px 0 #6cc8ff; }
  .nav-icon { color: #8fd4ff; }
  .topbar { border-bottom: 3px solid #1e90e0; }
  .breadcrumb { font-size: 15px; }
  .button { font-size: 15px; }
  .button-primary { background: linear-gradient(135deg, #1e90e0, #1470a0); box-shadow: 0 6px 16px rgba(30, 144, 224, .35); }
  .button-primary:hover { background: linear-gradient(135deg, #1470a0, #0a3a5a); }
  .user-name { font-size: 15px; }
  .avatar { background: linear-gradient(135deg, #1e90e0, #1470a0); }
  .page-heading h1 { font-size: 36px; color: #0a3a5a; }
  .page-heading .muted { font-size: 16px; }
  .eyebrow { color: #1e90e0; }
  .live-badge { border-color: #a9d8f8; color: #0b5d94; background: #e1f1fd; font-size: 14px; }

  .metric-card, .panel, .zone-card { border: 1px solid #cfdde8; box-shadow: 0 8px 24px rgba(20, 112, 160, .12); }
  .metric-card { border-top-width: 5px; background: linear-gradient(180deg, #ffffff 0%, #f3f9fe 100%); }
  .metric-card:nth-child(1) { border-top-color: #1e90e0; }
  .metric-card:nth-child(2) { border-top-color: #2e9e4f; }
  .metric-card:nth-child(3) { border-top-color: #f0a020; }
  .metric-card:nth-child(4) { border-top-color: #d8392f; }
  .metric-top { color: #4b5b65; font-size: 14px; font-weight: 700; letter-spacing: .02em; }
  .metric-card strong { font-size: 34px; color: #0a3a5a; }
  .metric-icon { color: #fff; background: #1e90e0; }
  .metric-card:nth-child(2) .metric-icon { color: #fff; background: #2e9e4f; }
  .metric-card:nth-child(3) .metric-icon { color: #fff; background: #f0a020; }
  .metric-card:nth-child(4) .metric-icon { color: #fff; background: #d8392f; }

  .zone-card h3 { font-size: 20px; color: #0a3a5a; }
  .zone-card .zone-meta, .zone-stats { font-size: 14px; }
  .zone-stats strong { font-size: 17px; }
  .zone-card:hover { border-color: #1e90e0; box-shadow: 0 10px 28px rgba(30, 144, 224, .22); }
  .customers-heading h2, .panel h2 { font-size: 24px; color: #0a3a5a; }
  .panel .muted, .panel-heading .muted, .zone-grid .muted { font-size: 14px; }
  .text-button { font-size: 15px; color: #1470a0; }

  thead { background: linear-gradient(90deg, #d4e9f8, #e3f0fa); }
  th { color: #0a3a5a; font-size: 13px; }
  td { font-size: 15px; color: #2b3b44; }
  td.customer-cell { font-size: 16px; font-weight: 700; color: #0a3a5a; }
  .customer-phone { font-size: 13px; }
  tbody tr:hover { background: #e8f4fd; }
  .status-pill { color: #0b5d94; background: #d4ebfb; font-size: 13px; }
  .status-pill.inactive { color: #5a5d5c; background: #e6e8e8; }
  .balance { color: #c0720a; font-size: 16px; }
  .small-button { color: #1470a0; border-color: #a9d8f8; background: #f3f9fe; font-size: 14px; }
  .small-button:hover { color: #fff; border-color: #1e90e0; background: #1e90e0; }
  .small-button.small-danger { color: #d8392f; border-color: #f2c4c0; background: #fff6f5; }
  .small-button.small-danger:hover { color: #fff; background: #d8392f; border-color: #d8392f; }

  .filter-row label, .form-grid > label { font-size: 14px; font-weight: 700; color: #0a3a5a; }
  .filter-row input, .filter-row select, .form-grid input, .form-grid select { min-height: 46px; font-size: 15px; border-color: #a9bfcf; }
  .filter-row > .muted { font-size: 14px; }
  .search-box input { font-size: 15px; }
  .empty-state { font-size: 15px; }
  .modal-heading h2 { font-size: 22px; color: #0a3a5a; }
  .modal-heading { border-bottom: 3px solid #1e90e0; }
  .form-grid legend { font-size: 14px; }
  .zone-checks label, .checkbox-label { font-size: 15px !important; }
  .notice { font-size: 15px; }
  .page-footer { font-size: 13px; }
  .receipt-total { font-size: 32px; color: #1470a0; }
  .login-card h2 { font-size: 36px; }
  .login-card > .muted { font-size: 16px; }
  .login-card label { font-size: 15px; }
  .login-card input { height: 54px; font-size: 16px; }
  .login-copy { font-size: 18px; }
  .login-brand { background: radial-gradient(ellipse at 16% 84%, rgba(30, 144, 224, .6), transparent 46%), linear-gradient(145deg, #0a3a5a, #1470a0); }
}
@media print {
  .table-excel-toolbar { display: none !important; }
}
@media screen and (max-width: 760px) {
  .customer-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .customer-dashboard-balances { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 1100px) {
  .sidebar { width: 240px; }
  .workspace { margin-left: 240px; }
}
@media screen and (max-width: 740px) {
  .sidebar { width: 100%; }
  .workspace { margin-left: 0; }
  .brand-logo { max-width: 120px; }
  .login-logo { width: 220px; margin-bottom: 20px; }
  .nav-item { min-height: 40px; font-size: 14px; }
}

@media screen {
  body { background: radial-gradient(ellipse at 100% 0%, #d6ecfb 0%, transparent 45%), radial-gradient(ellipse at 0% 100%, #dff3e6 0%, transparent 40%), #eaf1f8; }
  .page-content { background: transparent; }

  .metric-card { position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; }
  .metric-card::after { content: ""; position: absolute; right: -34px; bottom: -34px; width: 120px; height: 120px; border-radius: 50%; opacity: .14; background: currentColor; pointer-events: none; }
  .metric-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(20, 112, 160, .22); }
  .metric-card:nth-child(1) { color: #1e90e0; background: linear-gradient(160deg, #ffffff 30%, #d9eefc 100%); }
  .metric-card:nth-child(2) { color: #2e9e4f; background: linear-gradient(160deg, #ffffff 30%, #dcf3e3 100%); }
  .metric-card:nth-child(3) { color: #f0a020; background: linear-gradient(160deg, #ffffff 30%, #fdeccd 100%); }
  .metric-card:nth-child(4) { color: #d8392f; background: linear-gradient(160deg, #ffffff 30%, #fbdcd9 100%); }
  .metric-card .metric-value, .metric-card strong { color: #0a3a5a; }
  .metric-foot { font-size: 14px; color: #3e5460; }
  .metric-icon { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; box-shadow: 0 6px 14px rgba(10, 58, 90, .25); }

  .panel { position: relative; border-top: 4px solid #1e90e0; background: linear-gradient(180deg, #ffffff 0%, #f6fafe 100%); }
  .chart-panel { border-top-color: #2e9e4f; background: linear-gradient(180deg, #ffffff 0%, #eef9f1 100%); }
  .chart-day { height: 160px; }
  .chart-bar { width: min(38px, 70%); background: linear-gradient(180deg, #4cc2ff, #1470a0); box-shadow: 0 4px 10px rgba(30, 144, 224, .3); transition: transform .15s, filter .15s; }
  .chart-day:hover .chart-bar { filter: brightness(1.12); transform: scaleY(1.03); transform-origin: bottom; }
  .chart-day:last-child .chart-bar { background: linear-gradient(180deg, #5fd88a, #2e9e4f); box-shadow: 0 4px 10px rgba(46, 158, 79, .35); }
  .chart-day:first-child .chart-bar { background: linear-gradient(180deg, #4cc2ff, #1470a0); }
  .chart-label { font-size: 13px; font-weight: 700; color: #4b6370; }

  .zone-card { position: relative; border-left: 6px solid #1e90e0; background: linear-gradient(135deg, #ffffff 40%, #e6f3fd 100%); transition: transform .18s, box-shadow .18s, border-color .18s; }
  .zone-card:nth-child(4n+2) { border-left-color: #2e9e4f; background: linear-gradient(135deg, #ffffff 40%, #e2f5e9 100%); }
  .zone-card:nth-child(4n+3) { border-left-color: #f0a020; background: linear-gradient(135deg, #ffffff 40%, #fdf0d6 100%); }
  .zone-card:nth-child(4n+4) { border-left-color: #8a5cd6; background: linear-gradient(135deg, #ffffff 40%, #efe8fb 100%); }
  .zone-card:hover { transform: translateY(-4px); }
  .zone-arrow { color: #fff; background: #1e90e0; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; }
  .zone-card:nth-child(4n+2) .zone-arrow { background: #2e9e4f; }
  .zone-card:nth-child(4n+3) .zone-arrow { background: #f0a020; }
  .zone-card:nth-child(4n+4) .zone-arrow { background: #8a5cd6; }
  .zone-debt strong { color: #c0720a; }
  .zone-stats strong { color: #0a3a5a; }

  thead { background: linear-gradient(90deg, #bfe0f8, #d9ecfa); }
  tbody tr:nth-child(even) { background: #f3f9fe; }
  tbody tr:hover { background: #dcefff; }
  .status-pill:not(.inactive) { color: #14733a; background: #d3f2de; }
  .panel-heading h2, .customers-heading h2 { position: relative; padding-left: 14px; }
  .panel-heading h2::before, .customers-heading h2::before { content: ""; position: absolute; left: 0; top: 14%; bottom: 14%; width: 5px; border-radius: 3px; background: linear-gradient(180deg, #1e90e0, #2e9e4f); }

  .icon-action { display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 0; border-radius: 10px; color: #fff; cursor: pointer; background: #1e90e0; box-shadow: 0 3px 8px rgba(10, 58, 90, .22); transition: transform .12s, filter .12s, box-shadow .12s; }
  .icon-action svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .icon-action:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: 0 7px 14px rgba(10, 58, 90, .3); }
  .icon-action:focus-visible { outline: 3px solid #0a3a5a; outline-offset: 2px; }
  .icon-action.tone-blue { background: linear-gradient(135deg, #1e90e0, #1470a0); }
  .icon-action.tone-green { background: linear-gradient(135deg, #3cb862, #2e9e4f); }
  .icon-action.tone-amber { background: linear-gradient(135deg, #f7b73a, #e08e0b); }
  .icon-action.tone-orange { background: linear-gradient(135deg, #f58a3c, #dd6a14); }
  .icon-action.tone-red { background: linear-gradient(135deg, #ee5a50, #c9302a); }
  .row-actions { min-width: 0; gap: 8px; }
  .floating-tip { position: fixed; z-index: 1000; max-width: 240px; padding: 7px 12px; border-radius: 8px; color: #fff; background: #0a3a5a; font-size: 14px; font-weight: 600; pointer-events: none; box-shadow: 0 6px 16px rgba(10, 58, 90, .35); }
  .floating-tip[hidden] { display: none; }
}

@media screen {
  .filter-row { gap: 16px 20px; padding: 4px 2px 18px; align-items: flex-end; }
  .filter-row label { gap: 8px; }
  .filter-row #service-search { min-width: 340px; }
  .filter-row select { min-width: 190px; }
  .filter-row .button { min-height: 46px; padding: 0 20px; }
  .filter-row input[type="search"], .search-box input[type="search"] { background-image: none; }
  .search-box { padding: 0 16px; gap: 12px; background: #fff; border-color: #a9bfcf; }
  .search-box > span { font-size: 22px; color: #1470a0; }
  .table-scroll { margin-top: 6px; }
  th, td { padding: 16px 18px; }
  .row-actions { display: table-cell; width: 1%; min-width: 0; text-align: right; white-space: nowrap; padding-top: 12px; padding-bottom: 12px; }
  .row-actions .small-button { margin: 0 0 0 8px; padding: 9px 16px; border-radius: 8px; font-weight: 700; line-height: 1.1; }
  .row-actions .icon-action { width: 34px; height: 34px; margin-left: 6px; vertical-align: middle; }
  .row-actions .icon-action svg { width: 18px; height: 18px; }
  table:has(td.row-actions) th:last-child { text-align: right; }
  .customer-phone { margin-top: 4px; }
  .panel { padding: 22px 24px; }
  .panel-heading, .customers-heading { margin-bottom: 18px; gap: 16px; }
  .form-grid { gap: 18px 20px; }
  .form-actions { gap: 12px; margin-top: 6px; }
}

/* Paleta sobria: suaviza los colores intensos */
@media screen {
  .metric-card:nth-child(1) { background: linear-gradient(160deg, #fff 40%, #eef5fb 100%); }
  .metric-card:nth-child(2) { background: linear-gradient(160deg, #fff 40%, #eff7f2 100%); }
  .metric-card:nth-child(3) { background: linear-gradient(160deg, #fff 40%, #fbf5e8 100%); }
  .metric-card:nth-child(4) { background: linear-gradient(160deg, #fff 40%, #fbefee 100%); }
  .metric-card::after { opacity: .06; }
  .metric-card:nth-child(1) { border-top-color: #4a8fc2; }
  .metric-card:nth-child(2) { border-top-color: #4f9a6a; }
  .metric-card:nth-child(3) { border-top-color: #cf9a3f; }
  .metric-card:nth-child(4) { border-top-color: #c9605a; }
  .metric-card:nth-child(2) .metric-icon { background: #4f9a6a; }
  .metric-card:nth-child(3) .metric-icon { background: #cf9a3f; }
  .metric-card:nth-child(4) .metric-icon { background: #c9605a; }
  .metric-card:nth-child(1) .metric-icon { background: #4a8fc2; }
  .panel { border-top-color: #6fa3cc; background: #fff; }
  .chart-panel { border-top-color: #7fb092; background: #fff; }
  .chart-bar { background: linear-gradient(180deg, #7db4d9, #3f7fae); box-shadow: none; }
  .chart-day:first-child .chart-bar { background: linear-gradient(180deg, #7db4d9, #3f7fae); }
  .chart-day:last-child .chart-bar { background: linear-gradient(180deg, #86c19a, #4f9a6a); box-shadow: none; }
  .zone-card, .zone-card:nth-child(4n+2), .zone-card:nth-child(4n+3), .zone-card:nth-child(4n+4) { background: #fff; border-left-color: #6fa3cc; }
  .zone-card:nth-child(4n+2) { border-left-color: #7fb092; }
  .zone-card:nth-child(4n+3) { border-left-color: #d8b06a; }
  .zone-card:nth-child(4n+4) { border-left-color: #a493c9; }
  .zone-card .zone-arrow { background: #6fa3cc; }
  .zone-card:nth-child(4n+2) .zone-arrow { background: #7fb092; }
  .zone-card:nth-child(4n+3) .zone-arrow { background: #d8b06a; }
  .zone-card:nth-child(4n+4) .zone-arrow { background: #a493c9; }
  thead { background: #e6eef5; }
  .panel-heading h2::before, .customers-heading h2::before { background: #6fa3cc; }
  .icon-action { box-shadow: none; }
  .icon-action.tone-blue { background: #4a8fc2; }
  .icon-action.tone-green { background: #4f9a6a; }
  .icon-action.tone-amber { background: #cf9a3f; }
  .icon-action.tone-orange { background: #d38449; }
  .icon-action.tone-red { background: #c9605a; }
  .sidebar { background: linear-gradient(180deg, #0f3a55 0%, #165476 100%); }
  .nav-item.is-active { background: rgba(255, 255, 255, .14); box-shadow: inset 4px 0 #7fbfe6; }
}

/* Coherencia: azul de marca + 3 colores semánticos (verde, ámbar, rojo) con mejor contraste */
@media screen {
  :root { --brand: #14608a; --brand-dark: #0a3a5a; --ok: #2f7d52; --warn: #b9780f; --bad: #b53a33; }
  body { color: #1b2a36; background: #eaf0f5; }
  .metric-card, .panel, .zone-card { border-color: #c5d3de; }
  .metric-card:nth-child(1) { border-top-color: var(--brand); }
  .metric-card:nth-child(2) { border-top-color: var(--ok); }
  .metric-card:nth-child(3) { border-top-color: var(--warn); }
  .metric-card:nth-child(4) { border-top-color: var(--bad); }
  .metric-card:nth-child(1) .metric-icon { background: var(--brand); }
  .metric-card:nth-child(2) .metric-icon { background: var(--ok); }
  .metric-card:nth-child(3) .metric-icon { background: var(--warn); }
  .metric-card:nth-child(4) .metric-icon { background: var(--bad); }
  .metric-card .metric-value, .metric-card strong { color: var(--brand-dark); }
  .panel, .chart-panel { border-top-color: var(--brand); }
  .chart-bar, .chart-day:first-child .chart-bar { background: linear-gradient(180deg, #4d90b8, var(--brand)); }
  .chart-day:last-child .chart-bar { background: linear-gradient(180deg, #55a77a, var(--ok)); }
  .zone-card, .zone-card:nth-child(4n+2), .zone-card:nth-child(4n+3), .zone-card:nth-child(4n+4) { border-left-color: var(--brand); }
  .zone-card .zone-arrow, .zone-card:nth-child(4n+2) .zone-arrow, .zone-card:nth-child(4n+3) .zone-arrow, .zone-card:nth-child(4n+4) .zone-arrow { background: var(--brand); }
  thead { background: #dbe7f0; }
  thead th { color: var(--brand-dark); }
  .panel-heading h2::before, .customers-heading h2::before { background: var(--brand); }
  .icon-action.tone-blue { background: var(--brand); }
  .icon-action.tone-green { background: var(--ok); }
  .icon-action.tone-amber { background: var(--warn); }
  .icon-action.tone-orange { background: #5f7a8c; }
  .icon-action.tone-red { background: var(--bad); }
  .button-primary { background: var(--brand); box-shadow: none; }
  .button-primary:hover { background: var(--brand-dark); }
  .avatar { background: var(--brand); }
  .sidebar { background: linear-gradient(180deg, var(--brand-dark) 0%, #104a70 100%); }
}

/* Marca en gris del logo */
@media screen {
  :root { --brand: #4b4d4c; --brand-dark: #2b2d2c; }
  body { background: #eceeed; }
  .metric-card, .panel, .zone-card { border-color: #cdd0cf; }
  .chart-bar, .chart-day:first-child .chart-bar { background: linear-gradient(180deg, #8a8d8c, var(--brand)); }
  thead { background: #e0e2e1; }
  .sidebar { background: linear-gradient(180deg, #2b2d2c 0%, #3d3f3e 100%); }
  .nav-item.is-active { background: rgba(255, 255, 255, .12); box-shadow: inset 4px 0 #9aa09e; }
  .metric-card:hover, .zone-card:hover { box-shadow: 0 10px 24px rgba(43, 45, 44, .16); }
}

/* Tarjetas con color de contraste (texto claro sobre fondo sólido) */
@media screen {
  .metric-card { border: 0; color: #fff; }
  .metric-card::after { background: #fff; opacity: .12; }
  .metric-card:nth-child(1) { background: linear-gradient(145deg, #4b4d4c, #2b2d2c); }
  .metric-card:nth-child(2) { background: linear-gradient(145deg, #2f7d52, #1f5d3b); }
  .metric-card:nth-child(3) { background: linear-gradient(145deg, #c98a1c, #9a640a); }
  .metric-card:nth-child(4) { background: linear-gradient(145deg, #c24a42, #8f2a24); }
  .metric-card, .metric-card strong, .metric-card .metric-value, .metric-card span, .metric-card small, .metric-card p { color: #fff; }
  .metric-card .metric-icon, .metric-card:nth-child(n) .metric-icon { color: #fff; background: rgba(255, 255, 255, .2); }
  .zone-card { background: #fff; border-left-width: 8px; }
  .zone-card:nth-child(4n+1) { border-left-color: #4b4d4c; }
  .zone-card:nth-child(4n+2) { border-left-color: #2f7d52; }
  .zone-card:nth-child(4n+3) { border-left-color: #c98a1c; }
  .zone-card:nth-child(4n+4) { border-left-color: #c24a42; }
  .zone-card:nth-child(4n+1) .zone-arrow { background: #4b4d4c; }
  .zone-card:nth-child(4n+2) .zone-arrow { background: #2f7d52; }
  .zone-card:nth-child(4n+3) .zone-arrow { background: #c98a1c; }
  .zone-card:nth-child(4n+4) .zone-arrow { background: #c24a42; }
}

/* Azul de acento: foco y líneas resaltadas */
@media screen {
  :root { --accent: #1e88e5; --accent-dark: #1565c0; }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30, 136, 229, .25); }
  button:focus-visible, a:focus-visible, .icon-action:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
  .panel, .chart-panel { border-top-color: var(--accent); }
  .panel-heading h2::before, .customers-heading h2::before { background: var(--accent); }
  thead { border-bottom: 3px solid var(--accent); }
  .nav-item.is-active { box-shadow: inset 4px 0 var(--accent); background: rgba(30, 136, 229, .28); }
  .topbar, .app-header, header.topbar { border-bottom-color: var(--accent); }
  .button-primary { background: var(--accent); }
  .button-primary:hover { background: var(--accent-dark); }
  .icon-action.tone-blue { background: var(--accent); }
  .chart-bar, .chart-day:first-child .chart-bar { background: linear-gradient(180deg, #64b5f6, var(--accent)); }
  tbody tr:hover { background: #e3f1fd; box-shadow: inset 3px 0 var(--accent); }
  a, .link-button { color: var(--accent-dark); }
  .avatar { background: var(--accent); }
  .topbar { border-bottom: 4px solid var(--accent); }
  .sidebar { border-right: 0; }
  .nav-item .nav-icon { color: #64b5f6; }
  .nav-item:hover { background: rgba(30, 136, 229, .22); box-shadow: none; }
  .nav-item.is-active { background: var(--accent); box-shadow: none; color: #fff; }
  .nav-item.is-active .nav-icon { color: #fff; }
  .breadcrumb strong { color: var(--accent-dark); }
  .topbar .button-secondary:hover, .topbar-actions button:hover { border-color: var(--accent); color: var(--accent-dark); }
}

/* Colores más vivos en tarjetas y acciones */
@media screen {
  .metric-card:nth-child(1) { background: linear-gradient(145deg, #5f6261, #353837); }
  .metric-card:nth-child(2) { background: linear-gradient(145deg, #2fa264, #1b7a47); }
  .metric-card:nth-child(3) { background: linear-gradient(145deg, #f0a021, #cc7d08); }
  .metric-card:nth-child(4) { background: linear-gradient(145deg, #e5483d, #b82a22); }
  .zone-card:nth-child(4n+1) { border-left-color: #5f6261; }
  .zone-card:nth-child(4n+2) { border-left-color: #2fa264; }
  .zone-card:nth-child(4n+3) { border-left-color: #f0a021; }
  .zone-card:nth-child(4n+4) { border-left-color: #e5483d; }
  .zone-card:nth-child(4n+1) .zone-arrow { background: #5f6261; }
  .zone-card:nth-child(4n+2) .zone-arrow { background: #2fa264; }
  .zone-card:nth-child(4n+3) .zone-arrow { background: #f0a021; }
  .zone-card:nth-child(4n+4) .zone-arrow { background: #e5483d; }
  .icon-action { box-shadow: 0 3px 8px rgba(0, 0, 0, .18); }
  .icon-action:hover { filter: brightness(1.1); transform: translateY(-1px); }
  .icon-action.tone-blue { background: #1e88e5; }
  .icon-action.tone-green { background: #2fa264; }
  .icon-action.tone-amber { background: #f0a021; }
  .icon-action.tone-orange { background: #6b7f8e; }
  .icon-action.tone-red { background: #e5483d; }
}

.header-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* Tema del login aplicado al dashboard: degradado azul #0a3a5a → #1470a0 y acento #1e90e0 */
@media screen {
  :root { --brand: #1470a0; --brand-dark: #0a3a5a; --accent: #1e90e0; --accent-dark: #1470a0; }
  body { background: #eef3f8; color: #1b2a36; }
  .sidebar { background: radial-gradient(ellipse at 16% 100%, rgba(30, 144, 224, .6), transparent 46%), linear-gradient(145deg, #0a3a5a, #1470a0); }
  .nav-caption { color: #a9d8f3; }
  .nav-item .nav-icon { color: #8fd4ff; }
  .nav-item:hover { background: rgba(255, 255, 255, .12); }
  .nav-item.is-active { color: #fff; background: linear-gradient(90deg, rgba(30, 144, 224, .6), rgba(30, 144, 224, .22)); box-shadow: inset 4px 0 #6cc8ff; }
  .nav-item.is-active .nav-icon { color: #fff; }
  .topbar { border-bottom: 3px solid #1e90e0; }
  .breadcrumb strong { color: #0a3a5a; }
  .button-primary { background: linear-gradient(135deg, #1e90e0, #1470a0); box-shadow: 0 6px 16px rgba(30, 144, 224, .35); }
  .button-primary:hover { background: linear-gradient(135deg, #1470a0, #0a3a5a); }
  .avatar { background: linear-gradient(135deg, #1e90e0, #1470a0); }
  .page-heading h1, .panel h2, .customers-heading h2, .modal-heading h2 { color: #0a3a5a; }
  .eyebrow { color: #1e90e0; }
  .metric-card:nth-child(1) { background: linear-gradient(145deg, #1470a0, #0a3a5a); }
  .metric-card, .panel, .zone-card { border-color: #cfdde8; }
  .metric-card { border: 0; }
  .zone-card:nth-child(4n+1) { border-left-color: #1470a0; }
  .zone-card:nth-child(4n+1) .zone-arrow { background: #1470a0; }
  .chart-bar, .chart-day:first-child .chart-bar { background: linear-gradient(180deg, #64b5f6, #1470a0); }
  thead { background: #d4e9f8; border-bottom: 3px solid #1e90e0; }
  thead th { color: #0a3a5a; }
  td.customer-cell { color: #0a3a5a; }
  tbody tr:hover { background: #e8f4fd; box-shadow: inset 3px 0 #1e90e0; }
  .modal-heading { border-bottom: 3px solid #1e90e0; }
  .metric-card:hover, .zone-card:hover { box-shadow: 0 10px 24px rgba(20, 112, 160, .22); }
  .icon-action.tone-blue { background: #1e90e0; }
  .chart-bar { box-shadow: none; }
}
.modal-card.modal-wide { width: min(1100px, 96vw); max-height: 94vh; }
.modal-card.modal-wide .modal-content { padding: 14px 18px 18px; }
.report-preview { display: flex; flex-direction: column; gap: 12px; }
.report-preview-frame { width: 100%; height: min(72vh, 760px); border: 1px solid #d5dbe3; border-radius: 8px; background: #525659; }

@media screen {
  .sidebar .brand-lockup { margin: -28px -16px 18px; padding: 36px 21px 22px; background: linear-gradient(180deg, rgba(3,22,38,.88), rgba(6,34,56,.62)); border-bottom: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 -12px 18px -12px rgba(0,0,0,.35); }
}

@media screen {
  .content-view { animation: none; }
  .topbar { background: #fff; backdrop-filter: none; }
  .sidebar .brand-lockup { background: linear-gradient(180deg, #04192b, #072a45); box-shadow: none; }
}

/* Responsivo: menú lateral tipo drawer en pantallas medianas y pequeñas */
.menu-toggle { display: none; }
@media screen and (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .menu-toggle { display: inline-grid; flex: 0 0 auto; width: 40px; height: 40px; place-items: center; padding: 0; border: 1px solid #cfdde8; border-radius: 10px; color: #0a3a5a; background: #fff; font-size: 20px; cursor: pointer; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: min(280px, 84vw); height: 100vh; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 28px 16px 18px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 15; background: rgba(3, 22, 38, .55); }
  .sidebar .brand-lockup { display: block; }
  .nav-caption { display: block; }
  .sidebar-bottom { display: grid; }
  .main-nav { display: grid; overflow-y: auto; }
  .nav-item:not(.is-active) { display: flex; }
  .nav-item { min-height: 44px; padding: 0 12px; font-size: 14px; }
  .workspace { margin-left: 0; min-width: 0; }
  .topbar { position: sticky; top: 0; z-index: 5; gap: 10px; padding: 0 14px; }
  .breadcrumb { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .topbar-actions { flex: 0 0 auto; gap: 9px; }
  .last-updated, .user-name { display: none; }
  .page-content { padding: 22px 14px 18px; }
  .page-heading { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
  .page-heading h1 { font-size: 24px; }
  .metric-grid, .zone-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { overflow-x: auto; }
  .filter-row input, .filter-row select, .form-grid input, .form-grid select, .filter-row #service-search { min-width: 0; width: 100%; }
  .filter-row label, .form-grid > label { flex: 1 1 150px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-card, .modal-card.modal-wide { width: 96vw; }
}
@media screen and (max-width: 520px) {
  .breadcrumb .breadcrumb-divider, .breadcrumb > span:first-child { display: none; }
  .metric-grid, .zone-grid { grid-template-columns: 1fr; }
  .button-refresh { padding: 0 10px; }
  .page-heading h1 { font-size: 22px; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1 1 auto; }
}
@media screen and (min-width: 901px) {
  body.nav-open::after { display: none; }
}

/* Textos descriptivos: usan todo el ancho disponible */
@media screen {
  .page-heading { flex-wrap: wrap; }
  .page-heading > div:first-child { flex: 1 1 320px; min-width: 0; }
  .page-heading .muted, .panel-heading .muted, .panel .muted, .form-grid .muted, .modal-content p, .login-card > .muted { max-width: none; width: 100%; line-height: 1.5; text-wrap: pretty; overflow-wrap: anywhere; }
  .panel-heading > div:first-child { flex: 1 1 260px; min-width: 0; }
  .form-grid .muted.field-wide { margin: 0; font-size: 13px; }
  .filter-row > .muted { flex: 1 1 100%; margin: 0; text-align: left; }
}
@media screen and (max-width: 900px) {
  .page-heading .muted { max-width: none; }
  .page-heading > div:first-child { flex-basis: 100%; }
  .modal-backdrop { padding: 10px; }
  .modal-content, .modal-card.modal-wide .modal-content { padding: 16px 14px 18px; }
  .live-badge { align-self: flex-start; }
}
/* Tablas responsivas: en pantallas angostas cada fila se muestra como tarjeta */
@media screen and (max-width: 760px) {
  .panel { overflow-x: visible; }
  .table-scroll { overflow-x: visible; }
  .table-scroll table, .table-scroll tbody { display: block; width: 100%; }
  .table-scroll thead { display: none; }
  .table-scroll tbody tr { display: block; margin: 0 0 12px; padding: 4px 14px; border: 1px solid #cfdde8; border-left: 4px solid #1470a0; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px rgba(10, 58, 90, .08); }
  .table-scroll tbody td { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; width: auto; padding: 9px 0 !important; border: 0; border-bottom: 1px solid #eaf0f5; text-align: right; overflow-wrap: anywhere; }
  .table-scroll tbody td:last-child { border-bottom: 0; }
  .table-scroll tbody td[data-label]::before { content: attr(data-label); flex: 0 0 38%; max-width: 42%; color: #4c6a7d; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
  .table-scroll tbody td.align-right { text-align: right; }
  .table-scroll tbody td.cell-actions { align-items: center; gap: 8px; }
  .table-scroll tbody td.cell-actions::before { flex: 1 1 auto; max-width: none; }
  .table-scroll tbody td.empty-state { display: block; text-align: center; }
  .table-scroll tbody tr:has(td.empty-state) { border-left-width: 1px; }
}
/* Títulos de una sola línea: la fuente se ajusta al ancho de su contenedor */
@media screen {
  .metric-card, .zone-card, .panel, .modal-card, .page-heading > div:first-child { container-type: inline-size; }
  .page-heading h1, .panel-heading h2, .customers-heading h2, .modal-heading h2, .zone-card h3, .eyebrow, .metric-foot, .zone-meta, .metric-top > span:first-child { min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .metric-top > span:first-child { flex: 1 1 auto; font-size: min(14px, 6.4cqw); }
  .metric-card .metric-value { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: min(34px, 13.5cqw); }
  .metric-foot { font-size: min(14px, 6cqw); }
  .zone-card-top > span:first-child { min-width: 0; flex: 1 1 auto; }
  .zone-card h3 { font-size: min(20px, 8cqw); }
  .zone-meta { display: block; font-size: min(13px, 5.6cqw); }
  .page-heading h1 { font-size: min(36px, 8.5cqw); }
  .panel-heading h2, .customers-heading h2 { font-size: min(22px, 6.4cqw); }
  .modal-heading h2 { flex: 1 1 auto; min-width: 0; font-size: min(22px, 5.2cqw); }
  .panel-heading > div:first-child, .customers-heading > div:first-child { min-width: 0; }
}
/* Tablas con filas expandibles: nombre, fecha y monto visibles; el resto bajo el botón "+" */
@media screen {
  .row-toggle-cell { display: none; }
}
@media screen and (max-width: 760px) {
  .table-scroll table.rt tbody tr.rt-row > td.rt-main { order: 1; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-extra { order: 2; }
  .table-scroll table.rt tbody tr.rt-row > td.row-toggle-cell { order: 0; }
  .table-scroll table.rt thead { display: none; }
  .table-scroll table.rt tbody tr.rt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0; padding: 10px 4px; border: 0; border-bottom: 1px solid #d6e3ec; border-radius: 0; background: transparent; box-shadow: none; }
  .table-scroll table.rt tbody tr.rt-row.is-open { background: #f3f8fc; }
  .table-scroll table.rt tbody tr.rt-row > td.row-toggle-cell { display: block; flex: 0 0 auto; padding: 0 !important; border: 0; }
  .row-toggle { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: #1e90e0; font: 700 18px/1 sans-serif; cursor: pointer; box-shadow: 0 2px 6px rgba(10, 58, 90, .25); }
  .table-scroll table.rt tbody tr.rt-row.is-open .row-toggle { background: #0a3a5a; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-main { display: block; flex: 1 1 0; min-width: 0; padding: 0 2px !important; border: 0; text-align: left; overflow-wrap: anywhere; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-main.align-right { flex: 0 0 auto; max-width: 38%; text-align: right; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-main::before { display: block; max-width: none; margin-bottom: 2px; font-size: 9px; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-extra { display: none; }
  .table-scroll table.rt tbody tr.rt-row.is-open > td.rt-extra { display: flex; flex: 1 1 100%; align-items: center; justify-content: space-between; gap: 12px; margin-left: 38px; padding: 8px 0 !important; border: 0; border-top: 1px dashed #cfdde8; text-align: right; }
  .table-scroll table.rt tbody tr.rt-row.is-open > td.rt-extra::before { flex: 0 0 40%; }
}
/* Acciones en tablas responsivas: botones juntos y alineados a la derecha */
@media screen and (max-width: 760px) {
  .table-scroll tbody td.cell-actions, .table-scroll tbody td.row-actions,
  .table-scroll table.rt tbody tr.rt-row.is-open > td.cell-actions, .table-scroll table.rt tbody tr.rt-row.is-open > td.row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
  .table-scroll tbody td.cell-actions::before, .table-scroll tbody td.row-actions::before { flex: 1 1 auto; margin-right: auto; max-width: none; }
  .table-scroll tbody td.row-actions > *, .table-scroll tbody td.cell-actions > * { flex: 0 0 auto; margin: 0; }
}
/* Sin saltos de línea innecesarios en filtros y encabezados */
@media screen {
  .filter-row > .muted { flex: 0 0 auto; width: auto; margin: 0 0 12px auto; white-space: nowrap; align-self: flex-end; }
  .filter-row { padding-bottom: 0; }
  .panel-heading > .muted, .panel-heading > .text-button, .panel-heading > .panel-unit { flex: 0 0 auto; white-space: nowrap; }
  .page-heading { margin-bottom: 18px; }
}
@media screen and (max-width: 900px) {
  .filter-row { gap: 10px 12px; }
  .filter-row > label { flex: 1 1 140px; }
  .filter-row > .button { flex: 0 0 auto; }
  .filter-row > .muted { margin: 0 0 12px auto; }
}@media screen {
  .filter-row { flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
  .filter-row > label { flex: 1 1 150px; min-width: 0; }
  .filter-row > label:first-child { flex: 2 1 220px; }
  .filter-row select, .filter-row input, .filter-row #service-search { min-width: 0; width: 100%; }
  .filter-row > .muted { margin: 0 2px 14px 0; align-self: flex-end; }
}
/* Contador de resultados: esquina superior derecha de la primera línea */
@media screen {
  .filter-row { position: relative; }
  .filter-row > .muted { position: absolute; top: 2px; right: 2px; margin: 0; align-self: auto; }
}
@media screen and (max-width: 900px) {
  .filter-row { padding-top: 22px; }
  .filter-row > .muted { top: 0; }
}
/* Contador de resultados: pie del panel, fuera de filtros y datos */
@media screen {
  .panel > .table-count { position: static; display: block; margin: 10px 4px 0; padding-top: 10px; border-top: 1px solid #e3ecf3; color: #4c6a7d; font-size: 12px; font-weight: 600; text-align: right; }
  .panel > .table-count:empty { display: none; }
}
@media screen and (max-width: 900px) {
  .filter-row { padding-top: 0; }
}
/* Acciones por fila: una acción principal visible y el resto en el menú "⋮" */
@media screen {
  .row-actions { display: table-cell; }
  td.row-actions { white-space: nowrap; }
  .row-menu-wrap { display: inline-block; margin-left: 6px; vertical-align: middle; }
  .row-menu-btn { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid #cfdde8; border-radius: 10px; color: #0a3a5a; background: #fff; font: 700 20px/1 sans-serif; cursor: pointer; }
  .row-menu-btn:hover, .row-menu-btn[aria-expanded="true"] { color: #fff; border-color: #1470a0; background: #1470a0; }
  .row-menu { position: fixed; inset: auto; margin: 0; width: 300px; min-width: 0; max-width: calc(100vw - 16px); padding: 6px; border: 1px solid #cfdde8; border-radius: 12px; background: #fff; box-shadow: 0 14px 38px rgba(10, 58, 90, .28); }
  .row-menu:popover-open { display: grid; gap: 2px; }
  .row-menu button { display: flex !important; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; height: auto !important; margin: 0 !important; padding: 10px 12px !important; border: 0 !important; border-radius: 8px !important; color: #0a3a5a !important; background: transparent !important; box-shadow: none !important; filter: none !important; transform: none !important; font: 600 14px/1.2 inherit; text-align: left; cursor: pointer; }
  .row-menu button:hover, .row-menu button:focus-visible { color: #fff !important; background: #1470a0 !important; outline: 0; }
  .row-menu button:hover svg, .row-menu button:focus-visible svg { color: inherit; stroke: currentColor; }
  .row-menu .icon-action svg { flex: 0 0 auto; width: 18px; height: 18px; }
  .row-menu .icon-action::after { content: attr(aria-label); }
  .row-menu button { white-space: nowrap; }
  .row-menu .tone-red, .row-menu .small-danger { color: #c9302a !important; }
  .row-menu .tone-red:hover, .row-menu .tone-red:focus-visible,
  .row-menu .small-danger:hover, .row-menu .small-danger:focus-visible { color: #fff !important; background: #c9302a !important; }
}
@media screen and (max-width: 760px) {
  .table-scroll tbody td.row-actions .row-menu-wrap { margin-left: 0; }
}
/* Botón dividido: acción principal + desplegable */
@media screen {
  .split-btn { display: inline-flex; align-items: stretch; vertical-align: middle; }
  .split-btn > :first-child { margin: 0 !important; border-radius: 10px 0 0 10px !important; }
  .split-btn .row-menu-btn { width: 26px; height: auto; min-height: 34px; margin: 0; border: 0; border-left: 1px solid rgba(255, 255, 255, .45); border-radius: 0 10px 10px 0; font: 700 13px/1 sans-serif; color: #fff; background: #1470a0; }
  .split-btn[data-tone="tone-green"] .row-menu-btn { background: #2b9a5f; }
  .split-btn[data-tone="tone-amber"] .row-menu-btn { background: #d58a12; }
  .split-btn[data-tone="tone-red"] .row-menu-btn { background: #c9302a; }
  .split-btn .row-menu-btn:hover, .split-btn .row-menu-btn[aria-expanded="true"] { filter: brightness(.88); background-color: inherit; }
}
@media screen {
  .split-btn .row-menu-btn.solo { width: auto; min-height: 34px; padding: 0 12px; border: 1px solid #cfdde8; border-radius: 10px; color: #0a3a5a; background: #fff; font: 700 13px/1 inherit; }
  .split-btn .row-menu-btn.solo:hover, .split-btn .row-menu-btn.solo[aria-expanded="true"] { color: #fff; background: #1470a0; filter: none; }
}
@media screen {
  .split-btn .row-menu-btn:hover, .split-btn .row-menu-btn:focus-visible, .split-btn .row-menu-btn[aria-expanded="true"], .split-btn .row-menu-btn:popover-open { color: #fff !important; background: #1e90e0 !important; filter: none; box-shadow: 0 0 0 3px rgba(30, 144, 224, .35), 0 4px 12px rgba(20, 112, 160, .4); outline: 0; }
  .split-btn .row-menu-btn.solo:hover, .split-btn .row-menu-btn.solo[aria-expanded="true"] { background: #1470a0 !important; }
  .split-btn .row-menu-btn { transition: background .15s, box-shadow .15s; }
}
/* Modales: el título queda fijo y solo el contenido se desplaza */
@media screen {
  body:not(.print-report) .modal-card { display: flex; flex-direction: column; overflow: hidden; }
  body:not(.print-report) .modal-heading { position: static; flex: 0 0 auto; }
  body:not(.print-report) .modal-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
/* Tablas ordenables */
@media screen {
  .table-scroll thead th { cursor: pointer; user-select: none; white-space: nowrap; }
  .table-scroll thead th:not([data-sort]):hover { color: #1470a0; }
  .table-scroll thead th[data-sort]::after { content: " ▲"; font-size: .7em; color: #1e90e0; }
  .table-scroll thead th[data-sort="desc"]::after { content: " ▼"; }
}
/* Buscar + Registrar cliente en la misma línea */
@media screen {
  .customers-tools { display: flex; flex: 1 1 360px; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
  .customers-tools .search-box { flex: 1 1 auto; width: auto; max-width: 480px; }
  .customers-tools .button { flex: 0 0 auto; white-space: nowrap; }
  .customers-heading { align-items: center; flex-wrap: wrap; }
}
@media screen and (max-width: 520px) {
  .customers-tools { flex-wrap: wrap; justify-content: stretch; }
  .customers-tools .search-box { max-width: none; flex-basis: 100%; }
  .customers-tools .button { flex: 1 1 100%; }
}
/* Título, buscador y botón siempre en una sola fila */
@media screen {
  .customers-heading { flex-wrap: nowrap !important; flex-direction: row !important; align-items: center !important; gap: 14px; }
  .customers-heading > div:first-child { flex: 0 1 auto; min-width: 0; }
  .customers-tools { flex: 1 1 0; flex-wrap: nowrap !important; min-width: 0; }
  .customers-tools .search-box { flex: 1 1 0; min-width: 0; width: auto !important; max-width: 480px; }
  .customers-tools .button { flex: 0 0 auto !important; }
}
@media screen and (max-width: 520px) {
  .customers-heading { flex-wrap: wrap !important; }
  .customers-tools { flex: 1 1 100%; }
  .customers-tools .search-box { flex: 1 1 0; max-width: none; }
  .customers-tools .button { flex: 0 0 auto !important; padding-inline: 12px; }
}
/* Buscador + botón en su propia fila, debajo del título */
@media screen {
  .customers-heading { flex-wrap: wrap !important; align-items: stretch !important; gap: 12px; }
  .customers-heading > div:first-child { flex: 1 1 100%; }
  .customers-tools { flex: 1 1 100% !important; justify-content: stretch; }
  .customers-tools .search-box { flex: 1 1 0; max-width: none; }
}
.row-menu .small-button svg { flex: 0 0 auto; width: 18px; height: 18px; }
/* Cobros y recibos / estado de cuenta */
@media screen {
  .tab-bar { display: flex; gap: 6px; margin: 0 0 14px; border-bottom: 2px solid #d5e3ee; }
  .tab-button { display: inline-flex; align-items: center; gap: 8px; margin-bottom: -2px; padding: 11px 18px; border: 0; border-bottom: 3px solid transparent; color: #4b6a80; background: transparent; font: 700 15px/1 inherit; cursor: pointer; white-space: nowrap; }
  .tab-button:hover { color: #0a3a5a; }
  .tab-button.is-active { color: #0a3a5a; border-bottom-color: #1e90e0; }
  .tab-count { padding: 3px 9px; border-radius: 999px; color: #fff; background: #1470a0; font-size: 12px; }
  .paid-summary { margin: 4px 22px 10px; font-weight: 700; color: #0a3a5a; }
  #pay-tab-done { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; }
  #pay-tab-done > .panel-heading, #pay-tab-done > .table-scroll { grid-column: 1 / -1; }
  #pay-tab-done > .paid-summary { grid-column: 1; grid-row: 2; margin: 4px 0 10px; }
  #pay-tab-done > .table-excel-toolbar { grid-column: 2; grid-row: 2; margin: 4px 0 10px; }
  tr.is-voided td { color: #8a99a3; text-decoration: line-through; }
  tr.is-voided td .status-pill, tr.is-voided td .row-actions * { text-decoration: none; }
  .statement-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px 24px; margin-bottom: 14px; }
  .statement-head > div:first-child { display: grid; gap: 3px; min-width: 0; }
  .statement-head > div:first-child strong { color: #0a3a5a; font-size: 20px; }
  .statement-totals { display: flex; flex-wrap: wrap; gap: 10px; }
  .statement-totals > div { display: grid; gap: 4px; min-width: 130px; padding: 10px 16px; border: 1px solid #d5e3ee; border-radius: 10px; background: #f4f9fd; }
  .statement-totals span { color: #5f7a8c; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
  .statement-totals strong { color: #0a3a5a; font-size: 20px; }
  .statement-totals strong.paid { color: #1f8a4c; }
  .statement-totals strong.due { color: #c9302a; }
}
@media print {
  .statement-actions { display: none !important; }
  tr.is-voided td { color: #777; text-decoration: line-through; }
}
@media screen and (max-width: 520px) {
  .tab-button { padding: 10px 12px; font-size: 14px; }
}
/* Menú PDF del estado de cuenta */
.pdf-menu { display: inline-block; }
.pdf-menu-list { position: fixed; inset: auto; margin: 0; padding: 6px; border: 1px solid #bcd3e4; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(10, 58, 90, .22); }
.pdf-menu-list:popover-open { display: grid; gap: 2px; }
.pdf-menu-list button { padding: 10px 14px; border: 0; border-radius: 7px; color: #0a3a5a; background: transparent; font: 700 14px/1 inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.pdf-menu-list button:hover, .pdf-menu-list button:focus-visible { color: #fff; background: #1e90e0; outline: 0; }
/* Tipografía: Inter autoalojada */
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/assets/fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body, button, input, select, textarea { font-family: Inter, "Segoe UI", system-ui, sans-serif; font-feature-settings: "cv11", "ss03"; }
td, th, .metric-value, .balance, .statement-totals strong { font-variant-numeric: tabular-nums; }
h1, h2, h3, .page-heading h1, .panel-heading h2, .metric-value { letter-spacing: -.02em; }
th { letter-spacing: .06em; font-weight: 700; }
/* Recibo: mismo ticket que imprime la app */
.receipt-ticket { width: fit-content; max-width: 100%; margin: 0 auto; padding: 16px 18px; border: 1px solid #cfdde8; border-radius: 10px; background: #fff; box-shadow: 0 6px 18px rgba(10, 58, 90, .1); overflow-x: auto; }
.receipt-ticket img { display: block; width: 70%; margin: 0 auto 10px; }
.receipt-ticket pre { margin: 0; color: #1b2328; font: 13px/1.35 "Courier New", ui-monospace, monospace; white-space: pre; text-align: left; }
.receipt-paper { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; font-weight: 600; color: #0a3a5a; }
.receipt-paper select { width: auto; }
@media screen {
  .receipt-preview { width: 100%; max-width: none; padding: 0; container-type: inline-size; }
  .receipt-preview .receipt-ticket { padding: 12px; }
  .receipt-preview .receipt-ticket pre {
    font-size: min(13px, calc((100cqw - 28px) / var(--receipt-text-units, 19.2)));
  }
  .receipt-preview .receipt-paper { flex-wrap: wrap; }
  .receipt-preview .form-actions { flex-wrap: wrap; }
}

.filter-chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border: 1px solid #cfdde8; border-radius: 999px; color: #0a3a5a; background: #fff; font: 700 14px/1 inherit; cursor: pointer; white-space: nowrap; }
.filter-chip:hover { border-color: #1e90e0; }
.filter-chip.is-active { color: #fff; border-color: #1470a0; background: linear-gradient(135deg, #1470a0, #1e90e0); }
.filter-chip.is-active::before { content: "✓"; }

.customer-results{display:flex;flex-direction:column;gap:4px;max-height:220px;overflow:auto}
.customer-result{display:flex;justify-content:space-between;gap:12px;align-items:center;text-align:left;padding:9px 12px;border:1px solid var(--line,#d9e2e8);border-radius:8px;background:#fff;cursor:pointer;font:inherit}
.customer-result:hover{background:#eef6fb}
.customer-result span{color:#5b6b76;font-size:.85em}
.promise-tag{display:inline-block;margin-top:4px;padding:2px 9px;border-radius:999px;background:#e6f4ea;color:#1b6b35;font:700 12px/1.5 inherit}
.promise-tag.is-overdue{background:#fdecea;color:#b3261e}

.gps-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.gps-row label { display: grid; gap: 7px; color: #52656c; font-size: 10px; font-weight: 600; }
.gps-row input { min-height: 38px; min-width: 130px; padding: 0 10px; border: 1px solid #dce5e6; border-radius: 7px; background: white; font-size: 11px; }
.gps-field small { display: block; margin-top: 6px; color: #7b8b90; font-size: 10px; }

.map-picker-backdrop { z-index: 20; }
.map-picker { width: min(760px, 100%); }
.map-picker-canvas { height: min(55vh, 420px); border-radius: 8px; border: 1px solid #dce5e6; }
.map-picker-hint { margin: 0 0 8px; }
.map-picker-footer { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 10px; }
.map-pin { font-size: 26px; line-height: 1; background: none; border: 0; }

.zone-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.zone-toolbar .search-box { flex: 1 1 260px; max-width: 380px; }
.zone-sort { display: flex; align-items: center; gap: 8px; color: #52656c; font-size: 11px; font-weight: 600; }
.zone-sort select { min-height: 38px; padding: 0 10px; border: 1px solid #dce5e6; border-radius: 7px; background: white; font-size: 11px; }

/* Barras de filtros y encabezados: una sola fila ordenada, sin elementos sueltos ni huecos */
@media screen {
  .page-heading { flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 18px; }
  .page-heading > div:first-child { flex: 1 1 340px; min-width: 0; }
  .page-heading > .button, .page-heading > .header-actions { flex: 0 0 auto; width: auto; }
  .filter-row { position: static; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 0 0 14px; }
  .filter-row > label { flex: 1 1 160px; min-width: 0; }
  .filter-row > label:first-child { flex: 1 1 160px; }
  .filter-row > label:has(input[type="search"]) { flex: 2 1 260px; }
  .filter-row > label:has(input[type="date"]) { flex: 0 1 165px; }
  .filter-row input, .filter-row select, .filter-row #service-search, .filter-row select { min-width: 0; width: 100%; }
  .filter-row > .button { flex: 0 0 auto; align-self: flex-end; white-space: nowrap; }
  .filter-row > .muted { position: static !important; flex: 0 0 auto; margin: 0 0 0 auto; align-self: center; white-space: nowrap; }
  .filter-row + .table-scroll, .filter-row + .paid-summary { margin-top: 2px; }
  .panel-heading { flex-wrap: wrap; gap: 8px 15px; }
  .panel-heading > div:first-child { flex: 1 1 200px; min-width: 0; }
}
@media screen and (max-width: 640px) {
  .filter-row > label, .filter-row > label:has(input[type="search"]), .filter-row > label:has(input[type="date"]) { flex: 1 1 100%; }
  .filter-row > .button { flex: 1 1 auto; }
  .filter-row > .muted { margin: 0; flex: 1 1 100%; }
}

/* Iconos en títulos y encabezados de contenedores compactos */
@media screen {
  .title-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.45em; height: 1.45em; margin-right: 10px; border-radius: 10px; background: #e6f2f9; font-size: .72em; vertical-align: middle; line-height: 1; }
  .zone-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
  .zone-toolbar .search-box { flex: 2 1 260px; width: auto; }
  .zone-toolbar .zone-sort { flex: 1 1 200px; }
  .zone-toolbar > .muted { flex: 0 0 auto; margin: 0 0 0 auto; align-self: center; }
  .customers-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
  .customers-heading > div:first-child { flex: 1 1 220px; min-width: 0; }
  .customers-heading > .search-box { flex: 2 1 260px; width: auto; max-width: 420px; }
  .customers-heading > .filter-chip { flex: 0 0 auto; }
  .tab-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
  .paid-summary { flex-wrap: wrap; gap: 8px 16px; }
}

/* Navegación lateral con iconos de color, y títulos de formularios más finos */
@media screen {
  .sidebar .nav-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; font-size: 15px; line-height: 1; color: #fff; background: rgba(255,255,255,.12); transition: transform .15s, background .15s; }
  .sidebar .nav-item:hover .nav-icon { transform: scale(1.08); }
  .sidebar .nav-item[data-view="overview"] .nav-icon { background: linear-gradient(135deg, #3b9ff0, #1b6fd1); }
  .sidebar .nav-item[data-view="zones"] .nav-icon { background: linear-gradient(135deg, #ff7a6b, #e5483a); }
  .sidebar .nav-item[data-view="services"] .nav-icon { background: linear-gradient(135deg, #34c9a5, #16977b); }
  .sidebar .nav-item[data-view="payments"] .nav-icon { background: linear-gradient(135deg, #5ccf6e, #2f9e44); }
  .sidebar .nav-item[data-view="promises"] .nav-icon { background: linear-gradient(135deg, #ffc247, #e8970f); }
  .sidebar .nav-item[data-view="expenses"] .nav-icon { background: linear-gradient(135deg, #ff9a56, #e46a1c); }
  .sidebar .nav-item[data-view="signups"] .nav-icon { background: linear-gradient(135deg, #b48cf5, #7b4bd6); }
  .sidebar .nav-item[data-view="reports"] .nav-icon { background: linear-gradient(135deg, #4cc6e8, #1b95bd); }
  .sidebar .nav-item[data-view="users"] .nav-icon { background: linear-gradient(135deg, #f08bc4, #cc4f98); }
  .sidebar .nav-item[data-view="audit"] .nav-icon { background: linear-gradient(135deg, #8fa3b5, #5d7387); }
  .sidebar .nav-item[data-view="settings"] .nav-icon { background: linear-gradient(135deg, #a3aab3, #6f7882); }
  .sidebar .nav-item { gap: 12px; font-size: 14px; font-weight: 600; letter-spacing: .1px; }
  .sidebar .nav-item.is-active .nav-icon { box-shadow: 0 0 0 2px rgba(255,255,255,.28); }

  .modal-heading { padding: 16px 24px; border-bottom: 1px solid #dfe9f0; }
  .modal-heading h2 { font-size: 19px; font-weight: 700; letter-spacing: -.1px; color: #0a3a5a; }
  .modal-heading .icon-close { width: 34px; height: 34px; border-radius: 10px; font-size: 22px; line-height: 1; color: #5b7487; background: #eef4f8; }
  .modal-heading .icon-close:hover { color: #fff; background: #e5483a; }
  .page-heading h1 { font-size: 28px; letter-spacing: -.3px; }
  .panel-heading h2 { font-size: 17px; font-weight: 700; }
  .title-icon { background: linear-gradient(135deg, #e3f1fb, #cfe6f6); box-shadow: inset 0 0 0 1px #c3dcee; }
}

/* Iconos de color sin fondo */
@media screen {
  .sidebar .nav-item .nav-icon, .sidebar .nav-item[data-view] .nav-icon { background: none !important; box-shadow: none !important; width: 26px; height: 26px; font-size: 20px; border-radius: 0; }
  .sidebar .nav-item.is-active .nav-icon { box-shadow: none !important; filter: drop-shadow(0 0 4px rgba(255,255,255,.45)); }
  .title-icon { background: #e8f2fa; box-shadow: none; width: 44px; height: 44px; color: #1565c0; border: 1px solid #b5cfe3; border-radius: 8px; margin-right: 10px; flex: none; }
  .title-icon svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
}

/* Reportes: barras de participación y pestañas */
@media screen {
  .share-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
  .share-cell > span:last-child { flex: 0 0 52px; font-size: 13px; font-weight: 600; color: #35566b; text-align: right; }
  .share-bar { flex: 1 1 auto; height: 8px; border-radius: 99px; background: #e3edf4; overflow: hidden; }
  .share-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1e90e0, #34c9a5); }
  .total-row td { font-weight: 700; border-top: 2px solid #c9dbe7; background: #f4f9fc; }
  .report-note { margin: 0 4px 8px; }
  [data-rep-pane][hidden] { display: none; }
}

/* Reportes: selector de tipo de reporte */
@media screen {
  .filter-row > label.report-type-field { flex: 2 1 260px; }
  .filter-row > #report-scope-note { flex: 1 0 100%; margin: 0; align-self: auto; white-space: normal; }
  .filter-row > #report-scope-note:empty { display: none; }
  .filter-row input:disabled, .filter-row select:disabled { opacity: .55; cursor: not-allowed; }
}

/* Administración de usuarios: zonas buscables y permisos claros. */
.zone-picker-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-height: 190px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}
.zone-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  color: #40545c;
  font-size: 10px;
  cursor: pointer;
}
.zone-option:hover { background: #eef6f5; }
.zone-option input {
  flex: 0 0 auto;
  width: 15px;
  min-width: 15px;
  min-height: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--teal);
}
.zone-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-picker-results .zone-results-empty, .zone-picker-results .zone-results-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px;
  color: #728188;
  font-size: 10px;
}
.zone-selection-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.zone-selection-summary strong { color: #334b53; font-size: 10px; }
.zone-selection-summary .small-button { margin: 0; }
.selected-zone-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.selected-zone-chip, .selected-zone-extra {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #cfe4df;
  border-radius: 999px;
  color: #276258;
  background: #f1f9f7;
  font-size: 9px;
}
.selected-zone-chip { overflow: hidden; }
.selected-zone-chip button {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.selected-zone-extra { border-color: #dce5e6; color: #66777d; background: #f7f9f9; }
.zone-selection-empty { color: #728188; font-size: 10px; }
.zone-search-label { display: grid; gap: 7px; color: #52656c; font-size: 10px; font-weight: 600; }
.zone-search-label input { min-width: 0; width: 100%; }
.permission-groups { display: grid; gap: 12px; }
.permission-group { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; }
.permission-group h3 {
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: #52656c;
  background: #f7f9fa;
  font-size: 13px;
  font-weight: 700;
}
.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 13px 14px;
  cursor: pointer;
}
.permission-row + .permission-row { border-top: 1px solid #edf1f2; }
.permission-copy { display: grid; gap: 3px; min-width: 0; }
.permission-copy strong { color: #334b53; font-size: 14px; }
.permission-copy small { color: #66777d; font-size: 12px; line-height: 1.45; }
.permission-control { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.role-grant { color: #557a70; font-size: 11px; white-space: nowrap; }
.switch-control { position: relative; display: inline-flex; flex: 0 0 auto; width: 40px; height: 23px; }
.switch-control input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5d7;
  transition: background .15s ease;
}
.switch-track::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  content: "";
  transition: transform .15s ease;
}
.switch-control input:checked + .switch-track { background: var(--teal); }
.switch-control input:checked + .switch-track::before { transform: translateX(17px); }
.switch-control input:focus-visible + .switch-track { outline: 3px solid rgba(21, 155, 142, .25); outline-offset: 2px; }

/* Superficies corporativas compartidas; no modifica recibos ni reportes impresos. */
@media screen {
  :root {
    --ink: #1b2a36;
    --muted: #5d6b73;
    --paper: #eef3f8;
    --line: #cfdde8;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --ui-font: "Segoe UI Variable", "Segoe UI", Inter, system-ui, sans-serif;
    --navy: #0a3a5a;
    --navy-2: #1470a0;
    --teal: #1470a0;
    --teal-light: #dcebf2;
    --brand: #1470a0;
    --brand-dark: #0a3a5a;
    --accent: #147bbd;
    --accent-dark: #1470a0;
    --cyan: #8fd4ff;
    --blue-bright: #147bbd;
    --ok: #26712d;
    --green: #2fa264;
    --warn: #8b4d0a;
    --amber: #f0a021;
    --bad: #b32d29;
    --red: #e5483d;
    --chart-turquoise: #087f8c;
    --chart-indigo: #4338ca;
    --chart-orange: #c2410c;
  }
  body { background: var(--paper); font-size: 14px; line-height: 1.55; }
  body, button, input, select, textarea, .page-heading h1, .panel-heading h2,
  .modal-heading h2, .zone-card h3, .metric-value, .login-brand h1, .login-card h2 {
    font-family: var(--ui-font);
    font-feature-settings: normal;
  }
  .sidebar { color: #fff; background: #0a3a5a; border-right: 0; }
  .sidebar .brand-lockup { color: #fff; background: transparent; box-shadow: none; }
  .sidebar .brand-lockup strong span { color: var(--accent); }
  .sidebar .brand-lockup small { color: #fff; }
  .sidebar .nav-item { color: #fff; border-radius: 8px; }
  .sidebar .nav-item:hover { color: #fff; background: rgba(255, 255, 255, .12); }
  .sidebar .nav-item.is-active { color: #fff; background: #104b70; box-shadow: inset 4px 0 #6cc8ff; }
  .sidebar .nav-caption, .sidebar .connection-state { color: #fff; }
  .sidebar-bottom { border-top-color: rgba(255, 255, 255, .25); }
  .sidebar .logout-button { color: #fff; }
  .sidebar .logout-button:hover { color: #fff; background: rgba(255, 255, 255, .12); }
  .sidebar .nav-item { --nav-icon-color: #64b5f6; }
  .sidebar .nav-item[data-view="zones"], .sidebar .nav-item[data-view="signups"] { --nav-icon-color: #5eead4; }
  .sidebar .nav-item[data-view="services"], .sidebar .nav-item[data-view="users"] { --nav-icon-color: #a5b4fc; }
  .sidebar .nav-item[data-view="payments"], .sidebar .nav-item[data-view="audit"] { --nav-icon-color: #86efac; }
  .sidebar .nav-item[data-view="promises"], .sidebar .nav-item[data-view="reports"] { --nav-icon-color: #fcd34d; }
  .sidebar .nav-item[data-view="expenses"] { --nav-icon-color: #fdba74; }
  .sidebar .nav-item[data-view="settings"] { --nav-icon-color: #93c5fd; }
  .sidebar .nav-item .nav-icon { color: var(--nav-icon-color); transform: none; }
  .sidebar .logout-button .nav-icon { color: #fca5a5; transform: none; }
  .sidebar .nav-icon svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .sidebar .nav-item.is-active .nav-icon { filter: none; }
  .topbar, header.topbar { border-bottom: 2px solid var(--accent); background: var(--surface); backdrop-filter: none; }
  .page-heading h1 { color: var(--navy); font-size: clamp(24px, 2.2vw, 30px); letter-spacing: -.03em; }
  .panel, .metric-card:nth-child(n), .zone-card:nth-child(n) {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: none;
  }
  .metric-card:nth-child(n), .zone-card:nth-child(n) {
    --card-color: #10628d;
    --card-end: #0a3a5a;
    --card-accent: #fff;
    --card-text: #fff;
    --card-image: url("/assets/card-network.svg");
    --muted: var(--card-text);
    position: relative;
    color: var(--card-text);
    border: 1px solid var(--card-color);
    border-radius: 12px;
    background: linear-gradient(145deg, var(--card-color), var(--card-end));
    background-image: var(--card-image), linear-gradient(145deg, color-mix(in srgb, var(--card-color) 85%, transparent), color-mix(in srgb, var(--card-end) 85%, transparent));
    background-size: 210px 158px, 100% 100%;
    background-position: right bottom, center;
    background-repeat: no-repeat;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }
  .metric-card:nth-child(7n+2), .zone-card:nth-child(7n+2) { --card-color: #176b3d; --card-end: #17693d; }
  .metric-card:nth-child(7n+3), .zone-card:nth-child(7n+3) { --card-color: #f0a021; --card-end: #cc7d08; --card-text: #241706; --card-accent: #241706; }
  .metric-card:nth-child(7n+4), .zone-card:nth-child(7n+4) { --card-color: #b72e27; --card-end: #b0251e; }
  .metric-card:nth-child(7n+5), .zone-card:nth-child(7n+5) { --card-color: #086a74; --card-end: #07545e; }
  .metric-card:nth-child(7n+6), .zone-card:nth-child(7n+6) { --card-color: var(--chart-indigo); --card-end: #312e81; }
  .metric-card:nth-child(7n+7), .zone-card:nth-child(7n+7) { --card-color: #af390a; --card-end: #7c2d12; }
  .zone-card:nth-child(7n+1) { --card-color: #1470a0; }
  .zone-card:nth-child(7n+2) { --card-color: #2fa264; }
  .zone-card:nth-child(7n+4) { --card-color: #e5483d; }
  .metric-card:nth-child(even), .zone-card:nth-child(even) { --card-image: url("/assets/card-waves.svg"); }
  .zone-card:nth-child(n) {
    --card-text: var(--ink); --card-accent: var(--navy); --muted: #5d6b73;
    color: var(--ink); background: #fff; border: 1px solid var(--line); border-left: 8px solid var(--card-color);
    background-image: var(--card-image), linear-gradient(145deg, #fff, color-mix(in srgb, var(--card-color) 8%, #fff));
    background-size: 210px 158px, 100% 100%;
    background-position: right bottom, center;
    background-repeat: no-repeat;
  }
  .metric-card:nth-child(n) {
    --card-text: #1f2937; --card-accent: #4b5563; --muted: #283e4d; --amount-color: #0063a3;
    color: var(--card-text);
    border-color: var(--line);
    background: #e7f0f6;
    background-image: var(--card-image), linear-gradient(145deg, color-mix(in srgb, var(--card-color) 10%, transparent), color-mix(in srgb, var(--card-end) 18%, transparent));
    background-size: 210px 158px, 100% 100%;
    background-position: right bottom, center;
    background-repeat: no-repeat;
  }
  .metric-card:nth-child(7n+2) { --amount-color: #087033; }
  .metric-card:nth-child(7n+3) { --amount-color: #965400; }
  .metric-card:nth-child(7n+4) { --amount-color: #b52e25; }
  .metric-card:nth-child(7n+5) { --amount-color: #006c78; }
  .metric-card:nth-child(7n+6) { --amount-color: #4930c7; }
  .metric-card:nth-child(7n+7) { --amount-color: #ab3c0a; }
  .panel::before, .metric-card::before, .metric-card::after, .zone-card::before,
  .panel-heading h2::before, .customers-heading h2::before { display: none; }
  .panel-heading h2, .customers-heading h2 { padding-left: 0; }
  .metric-card:nth-child(n):hover, .zone-card:nth-child(n):hover {
    border-color: var(--card-accent);
    box-shadow: none;
    transform: none;
  }
  .metric-card:nth-child(n) .metric-value { color: var(--card-text); font-weight: 600; letter-spacing: -.025em; }
  .metric-card:nth-child(n) .metric-amount { color: var(--amount-color); font-weight: 700; font-size: clamp(20px, 13.5cqw, 34px); }
  .metric-top > span:first-child, .metric-card .metric-foot, .zone-card .zone-meta, .zone-stats { color: var(--muted); font-weight: 400; }
  .metric-card .metric-top > span:first-child { color: var(--card-text); }
  .metric-card .metric-top > span:first-child {
    font-size: 20px; font-weight: 600; line-height: 1.4; white-space: normal;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    line-clamp: 2; overflow: hidden;
  }
  .metric-card .metric-foot, .zone-card .zone-meta {
    font-size: 15px; line-height: 1.45; white-space: normal;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    line-clamp: 2; overflow: hidden;
  }
  .metric-card:nth-child(n) .metric-icon { color: var(--card-text); background: transparent; border: 1px solid var(--card-text); border-radius: 8px; box-shadow: none; }
  .zone-card h3 { color: var(--card-text); font-weight: 600; font-size: 20px; line-height: 1.4; letter-spacing: normal; white-space: normal; overflow-wrap: anywhere; }
  .zone-card:nth-child(n) .zone-stats strong { color: var(--card-text); }
  .button-primary { color: #fff; background: linear-gradient(135deg, var(--accent), #1470a0); box-shadow: none; }
  .eyebrow { color: var(--accent-dark); }
  .avatar { background: linear-gradient(135deg, var(--accent), #1470a0); }
  .modal-heading { border-bottom-color: var(--accent); }
  .table-scroll thead th[data-sort]::after { color: var(--accent-dark); }
  .button-primary:hover { color: #fff; background: linear-gradient(135deg, #1470a0, #0a3a5a); box-shadow: none; }
  .button-refresh, .small-button { border-color: var(--line); background: var(--surface-raised); color: var(--navy); }
  .button-refresh:hover { border-color: var(--muted); background: var(--paper); }
  .button-refresh span { color: var(--navy); }
  .text-button { color: var(--accent-dark); }
  .search-box, .filter-row input, .filter-row select, .zone-toolbar select { background: var(--surface-raised); border-color: var(--line); }
  .avatar { color: var(--navy); background: var(--teal-light); }
  .login-brand { color: #fff; background: radial-gradient(ellipse at 16% 84%, rgba(30, 144, 224, .6), transparent 46%), linear-gradient(145deg, #0a3a5a, #1470a0); }
  .login-brand h1 { color: #fff; }
  .login-brand .login-copy, .login-brand .login-footnote { color: #fff; }
  .login-brand .eyebrow { color: #fff; }
  .login-brand::after { display: none; }
  .login-card input:focus, .search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 123, 179, .12); }
  button:focus-visible, a:focus-visible { outline: 3px solid #8bb8de; outline-offset: 3px; }
  .settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
  .settings-nav { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .settings-nav-item { display: grid; gap: 5px; width: 100%; padding: 14px 12px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; text-align: left; }
  .settings-nav-item strong { font-size: 14px; font-weight: 600; }
  .settings-nav-item span { color: var(--muted); font-size: 12px; line-height: 1.4; }
  .settings-nav-item:hover { background: #f4f7fa; }
  .settings-nav-item.is-active { color: var(--accent-dark); background: var(--teal-light); box-shadow: inset 3px 0 var(--accent); }
  .settings-content { min-width: 0; }
  .settings-content .panel-heading { flex-wrap: wrap; gap: 12px; }
  .settings-content .panel-heading .muted { max-width: 680px; line-height: 1.6; }
  .settings-content td input, .settings-content td select { min-width: 140px; width: 100%; }
  .settings-content .table-scroll { max-width: 100%; }
  .page-heading h1 { font-weight: 600; line-height: 1.25; letter-spacing: -.02em; font-size: clamp(24px, 2vw, 28px); }
  .page-heading .muted, .panel-heading .muted { font-size: 14px; line-height: 1.6; }
  .panel-heading h2, .panel h2 { font-size: 18px; font-weight: 600; line-height: 1.35; }
  .nav-item, .button, .small-button { font-size: 14px; font-weight: 500; }
  .eyebrow { font-size: 11px; letter-spacing: .1em; }
  .table-scroll table { background: var(--surface); }
  .table-scroll th { background: #d4e9f8; font-size: 12px; font-weight: 600; letter-spacing: .025em; }
  .table-scroll td { font-size: 14px; font-weight: 400; line-height: 1.5; }
  .table-scroll .customer-cell { font-weight: 500; }
  .table-scroll tbody tr { background: transparent; }
  .table-scroll tbody tr:hover, .table-scroll table.rt tbody tr.rt-row.is-open { background: var(--paper); box-shadow: none; }
  .settings-nav { background: var(--surface); }
  .settings-nav-item strong { font-weight: 500; }
  body:not(.print-report) .modal-card { background: var(--surface); }
  body:not(.print-report) .modal-heading { background: #e8eef4; border-bottom: 1px solid var(--line); }
  .modal-heading h2 { font-size: 20px; font-weight: 600; }
  .form-grid label, .form-grid legend { font-size: 13px; font-weight: 500; line-height: 1.5; }
  .form-grid input, .form-grid select, .form-grid textarea { font-size: 14px; font-weight: 400; background: var(--surface-raised); border-color: var(--line); }
  .permission-group h3, .permission-group, .zone-picker-results { background: var(--surface-raised); border-color: var(--line); }
  .permission-copy strong { font-weight: 500; }
  .login-layout, .login-panel { background: var(--surface); }
  .login-card input { background: var(--surface-raised); border-color: var(--line); }
  .report-note { font-size: 13px; line-height: 1.65; }
  .branch-zone-options { display: grid; gap: 4px; max-height: 280px; overflow: auto; margin-top: 12px; }
  .settings-form .branch-zone-option { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; font-weight: 400; cursor: pointer; }
  .branch-zone-option:hover { background: #e3ecf4; }
  .settings-form .branch-zone-option input { width: 18px; height: 18px; min-height: 18px; min-width: 18px; padding: 0; flex: none; accent-color: var(--accent); }
  .branch-zone-option span { display: grid; gap: 3px; min-width: 0; }
  .branch-zone-option strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
  .branch-zone-option small { color: var(--muted); font-size: 12px; }
  .settings-form fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
  .branch-context { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); }
  .branch-context label { font-size: 12px; color: var(--muted); }
  .branch-context select { max-width: 240px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); color: var(--ink); font-size: 13px; }
  #active-branch-name { max-width: 220px; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #refresh-button { display: grid; place-items: center; width: 40px; min-width: 40px; height: 40px; padding: 0; }
  #refresh-button span { margin: 0; font-size: 24px; }
  .refresh-spinning { animation: refresh-spin 1s linear infinite; }
  @keyframes refresh-spin { to { transform: rotate(360deg); } }
}

@media screen and (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding-block: 8px; }
  .topbar-actions { gap: 10px; flex-wrap: wrap; }
  .branch-context select { max-width: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  .refresh-spinning { animation: none; }
}

@media screen and (max-width: 1100px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .settings-nav { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (max-width: 600px) {
  .zone-picker-results { grid-template-columns: 1fr; }
  .permission-row { gap: 10px; padding: 10px; }
  .permission-control { gap: 7px; }
  .role-grant { max-width: 115px; font-size: 10px; white-space: normal; text-align: right; }
  .permission-copy strong { font-size: 13px; }
  .permission-copy small { font-size: 11px; }
}

@media screen {
  body { min-width: 0; }
  .workspace, .page-content, .content-view, .panel, .modal-content,
  .topbar-actions, .breadcrumb, .user-chip, .form-grid > *, .filter-row > *,
  .user-form-grid > *, .permission-copy, .zone-option, .zone-stats > * { min-width: 0; }
  .topbar-actions { max-width: 100%; }
  .branch-context { flex: 0 1 auto; max-width: 100%; }
  .branch-context label, .avatar, .nav-icon, .icon-close { flex-shrink: 0; }
  .table-scroll { width: 100%; max-width: 100%; }
  .table-scroll table { table-layout: fixed; min-width: 0; }
  .table-scroll th { overflow: hidden; text-overflow: ellipsis; }
  .table-scroll td { min-width: 0; overflow-wrap: normal; }
  .cell-text, .table-scroll td > span:not(.split-btn), .table-scroll td > strong,
  .table-scroll td > a, .table-scroll td > small, .table-scroll td > em, .branch-zone-option strong, .branch-zone-option small,
  .zone-option > span, .settings-nav-item strong, .settings-nav-item span,
  .permission-copy strong, .permission-copy small {
    display: block; min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }
  .table-scroll td > .status-pill { display: inline-block; }
  .table-scroll td.row-actions, .table-scroll td.cell-actions { white-space: normal; min-width: 0; }
  .table-scroll .cell-actions { width: 150px; }
  .table-scroll .cell-actions button { max-width: 100%; }
  .cell-text:focus-visible, [data-tip-focus]:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
  .floating-tip { max-width: min(360px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow: auto; overflow-wrap: anywhere; font-weight: 400; pointer-events: auto; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  select, textarea {
    min-width: 0; max-width: 100%; font-family: var(--ui-font); font-size: 14px;
    color: var(--ink); background-color: var(--surface-raised); border: 1px solid var(--line); border-radius: 8px;
  }
  select:not([multiple]) {
    appearance: none; min-height: 40px; padding: 8px 34px 8px 10px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%234f6072' stroke-width='1.7' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  }
  .branch-context select { padding-right: 34px; background-color: var(--surface-raised); }
  select option, select optgroup { color: var(--ink); background: var(--surface-raised); font: inherit; }
  input:disabled, select:disabled, textarea:disabled { opacity: .65; cursor: not-allowed; }
  .form-grid input:not([type="checkbox"]):not([type="radio"]), .form-grid select,
  .form-grid textarea, .user-form-grid input:not([type="checkbox"]), .user-form-grid select { width: 100%; }
  .search-box input { border: 0; border-radius: 0; background: transparent; }
  .form-actions, .header-actions, .customers-heading, .page-footer, .zone-stats { flex-wrap: wrap; }
  .zone-toolbar { flex-wrap: wrap; }
  .zone-toolbar > label { flex: 1 1 180px; min-width: 0; max-width: 100%; }
  .zone-toolbar select { width: 100%; min-width: 0; }
  .search-box { min-width: 0; }
  a { text-decoration: none; color: var(--accent-dark); }
  a:hover { text-decoration: underline; }
  .brand-lockup:hover { text-decoration: none; }
  .table-scroll tr th, .table-scroll tr td { border: 0; border-bottom: 1px solid var(--line); }
  .table-scroll thead { border-bottom: 1px solid var(--line); }
  .table-scroll tr th { background-color: #d4e9f8; color: var(--navy); }
  .table-scroll td { color: var(--ink); }
  .zone-card:nth-child(n) .zone-arrow { color: #fff; background: var(--card-color); border: 0; }
  .zone-card:nth-child(7n+3) .zone-arrow { color: #241706; }
  .zone-card .zone-stats { border-top-color: var(--line); }
  .row-toggle { color: var(--ink); background: var(--accent); box-shadow: none; }
  .table-scroll table.rt tbody tr.rt-row.is-open .row-toggle { color: var(--ink); background: var(--accent); }
  .chart-bar, .chart-day:first-child .chart-bar { background: var(--accent); }
  .online-dot { background: var(--green); outline: 1px solid var(--ok); }
  .status-pill:not(.inactive) { color: var(--ink); background: var(--accent); }
  .status-pill.inactive { color: var(--ink); background: #e5e7eb; }
  .icon-action { box-shadow: none; }
  .icon-action.tone-blue { color: var(--navy); background: #dceaf4; }
  .icon-action.tone-green { color: var(--ok); background: #e0f0e7; }
  .icon-action.tone-amber, .icon-action.tone-orange { color: var(--warn); background: #faeed8; }
  .icon-action.tone-red { color: var(--bad); background: #f9e5e8; }
  .split-btn .row-menu-btn { color: var(--navy); background: #dceaf4; border-left-color: var(--line); }
  .split-btn[data-tone="tone-green"] .row-menu-btn { color: var(--ok); background: #e0f0e7; }
  .split-btn[data-tone="tone-amber"] .row-menu-btn { color: var(--warn); background: #faeed8; }
  .split-btn[data-tone="tone-red"] .row-menu-btn { color: var(--bad); background: #f9e5e8; }
  .row-menu, .split-btn .row-menu-btn.solo { background: var(--surface-raised); border-color: var(--line); }
  .split-btn .row-menu-btn:hover, .split-btn .row-menu-btn:focus-visible,
  .split-btn .row-menu-btn[aria-expanded="true"] { color: var(--ink) !important; background: var(--accent) !important; box-shadow: none; outline: 2px solid var(--accent-dark); }
  .notice-success { border-color: #a8ccba; color: var(--ok); background: #e0f0e7; }
  .notice-error { border-color: #e6b4be; color: var(--bad); background: #f9e5e8; }
  .form-error { color: var(--bad); }
  .small-button.small-danger { color: var(--bad); border-color: #e6b4be; }
  .dashboard-decisions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
  .daily-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px; margin-bottom: 18px; }
  .daily-charts > .panel { min-width: 0; margin: 0; }
  .daily-charts .weekly-chart { gap: 10px; }
  .dashboard-decisions > .panel { min-width: 0; margin: 0; }
  .decision-row { margin-bottom: 14px; }
  .decision-row-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 13px; }
  .decision-row-heading span { overflow-wrap: anywhere; min-width: 0; }
  .decision-row-heading strong { white-space: nowrap; }
  .decision-track { height: 10px; margin-top: 6px; overflow: hidden; border-radius: 8px; background: var(--paper); }
  .decision-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
  .decision-fill.tone-green { background: var(--green); }
  .decision-fill.tone-red { background: var(--red); }
  .decision-fill.tone-amber { background: var(--amber); }
  .decision-fill.tone-turquoise { background: var(--chart-turquoise); }
  .decision-fill.tone-indigo { background: var(--chart-indigo); }
  .decision-fill.tone-orange { background: var(--chart-orange); }
  .chart-bar-wrap { display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
  .weekly-chart .chart-day .chart-bar { flex: 1 1 0; min-width: 0; min-height: 0; max-width: 30px; background: var(--accent); }
  .weekly-chart .chart-day .chart-expense-bar { background: var(--amber); }
  .chart-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
}
@media screen and (max-width: 760px) {
  .dashboard-decisions { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (max-width: 760px) {
  .table-scroll .cell-actions { width: auto; }
  .table-scroll tbody td[data-label]:not(.cell-actions):not(.row-actions),
  .table-scroll table.rt tbody tr.rt-row.is-open > td.rt-extra:not(.cell-actions):not(.row-actions) {
    display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 4px 12px;
  }
  .table-scroll tbody td[data-label]::before { grid-column: 1; grid-row: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-scroll tbody td[data-label] > * { grid-column: 2; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-main { display: block; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-extra { display: none; }
  .table-scroll table.rt tbody tr.rt-row > td.rt-main.align-right { flex: 0 1 32%; min-width: 0; }
  .table-scroll tbody tr { background: var(--surface); box-shadow: none; }
  .table-scroll tbody td.cell-actions, .table-scroll tbody td.row-actions { flex-wrap: wrap; }
  .settings-content td input, .settings-content td select { min-width: 0; }
  .filter-row > .muted { position: static; flex: 1 1 100%; white-space: normal; }
  .customers-heading .search-box { width: 100%; }
}
@media screen and (max-width: 520px) {
  .topbar-actions { flex: 1 1 100%; justify-content: flex-end; }
  .branch-context { flex: 1 1 0; }
  .branch-context select { width: 100%; max-width: 100%; }
  .branch-context #active-branch-name { flex: 1 1 0; }
  .form-grid, .user-form-grid, .zone-checks { grid-template-columns: minmax(0, 1fr); }
  .login-layout { grid-template-columns: minmax(0, 1fr); }
  .login-panel { padding-inline: 20px; min-width: 0; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea,
  .form-grid input, .form-grid select, .branch-context select { font-size: 16px; }
}
@media print {
  .floating-tip { display: none !important; }
}
@media screen {
  .zone-search { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
  .zone-search-field { position: relative; flex: 1; min-width: 0; }
  .zone-search #customer-search { width: 100%; min-height: 40px; padding: 0 36px 0 10px; background-image: none; }
  .zone-search-icon { position: absolute; right: 10px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
  .zone-search #add-customer-button { flex: none; }
  #zone-picker .zone-card { min-width: 0; }
  #zone-picker .zone-card.is-selected { outline: 2px solid var(--accent); outline-offset: -2px; }
  .customers-panel .customers-heading { padding-inline: 0; }
}
@media screen and (min-width: 761px) {
  .table-scroll table.rt-desktop { display: block; width: 100%; }
  .table-scroll table.rt-desktop thead, .table-scroll table.rt-desktop tbody { display: block; }
  .table-scroll table.rt-desktop tr { display: grid; grid-template-columns: var(--table-columns); align-items: stretch; }
  .table-scroll table.rt-desktop th, .table-scroll table.rt-desktop td {
    display: block; width: auto; min-width: 0; max-width: none; margin: 0; padding: 12px 10px;
  }
  .table-scroll table.rt-desktop td[colspan] { grid-column: 1 / -1; }
  .table-scroll table.rt-desktop .rt-collapsed,
  .table-scroll table.rt-desktop td.row-toggle-cell { display: none; }
  .table-scroll table.rt-desktop.rt-overflow thead tr::before { content: ""; background: #d4e9f8; }
  .table-scroll table.rt-desktop.rt-overflow td.row-toggle-cell { display: flex; align-items: center; justify-content: center; padding: 8px 4px; }
  .table-scroll table.rt-desktop .row-toggle {
    width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
    color: var(--ink); background: var(--accent); font: 700 18px/1 sans-serif;
  }
  .table-scroll table.rt-desktop .row-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
  .table-scroll table.rt-desktop tr.is-open > td.rt-collapsed {
    display: grid; grid-column: 1 / -1; order: 1; grid-template-columns: minmax(100px, 25%) minmax(0, 1fr);
    gap: 12px; margin-left: 42px; border-bottom: 1px dashed var(--line); background: var(--surface-raised);
  }
  .table-scroll table.rt-desktop tr.is-open > td.rt-collapsed::before { content: attr(data-label); color: var(--muted); font-weight: 600; text-align: left; }
  .table-scroll table.rt-desktop tr.is-open > td.rt-collapsed > * { grid-column: 2; min-width: 0; }
  .table-scroll table.rt-desktop td.cell-actions:not(.rt-collapsed) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
}

@media screen {
  .main-nav { display: block; min-height: 0; }
  .nav-list, .nav-submenu { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
  .nav-list > li, .nav-submenu > li { min-width: 0; }
  .nav-list .nav-item { width: 100%; }
  .nav-submenu-toggle { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 8px; color: #fff; background: transparent; text-align: left; font-size: 14px; font-weight: 600; }
  .nav-submenu-toggle:hover, .nav-submenu-toggle.has-active-view { background: #104b70; }
  .nav-submenu-toggle:focus-visible { outline: 2px solid #6cc8ff; outline-offset: 2px; }
  .nav-submenu-chevron { display: inline-flex; width: 16px; height: 16px; flex: none; margin-left: auto; transition: transform .18s ease; }
  .nav-submenu-chevron svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
  .nav-submenu-toggle[aria-expanded="false"] .nav-submenu-chevron { transform: rotate(-90deg); }
  .nav-submenu { gap: 2px; margin: 4px 0 4px 24px; padding-left: 6px; border-left: 1px solid rgba(255, 255, 255, .18); }
  .sidebar .nav-submenu .nav-item { padding: 6px 8px; font-size: 13px; }
  .nav-submenu .nav-section-label { padding: 12px 8px 4px; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  .nav-submenu-toggle .nav-icon { color: #93c5fd; }
}

@media screen {
  .status-pill.is-active { color: #166534; background: #dcfce7; }
  .table-scroll .row-toggle,
  .table-scroll table.rt tbody tr.rt-row.is-open .row-toggle,
  .table-scroll table.rt-desktop .row-toggle { color: #166534; background: #bbf7d0; }
}

@media screen {
  :is(#customers-panel, #services-panel) .customer-cell > strong,
  :is(#customers-panel, #services-panel) td.balance { font-weight: 700; }
  :is(#customers-panel, #services-panel) .customer-status { text-align: center; }
  :is(#customers-panel, #services-panel) td.row-actions,
  :is(#customers-panel, #services-panel) td.cell-actions { text-align: right; justify-content: flex-end; }
  :is(#customers-panel, #services-panel) td.cell-actions.rt-collapsed > * { justify-self: end; }
}

@media screen {
  .table-scroll thead,
  .table-scroll tr th,
  .table-scroll table.rt-desktop.rt-overflow thead tr::before { background: var(--accent); color: #fff; }
}

@media screen {
  :is(#customers-panel, #services-panel) .split-btn .customer-collect-button { display: inline-flex; width: auto; min-height: 36px; align-items: center; gap: 6px; padding: 0 10px; font-size: 13px; font-weight: 600; }
  :is(#customers-panel, #services-panel) .customer-collect-button svg { width: 18px; height: 18px; flex: none; }
  :is(#customers-panel, #services-panel) .split-btn .customer-options-button { width: 36px; min-height: 36px; }
  :is(#customers-panel, #services-panel) .customer-options-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
  #show-zone-cards { display: inline-flex; min-height: 30px; align-items: center; gap: 5px; padding: 0 8px; font-size: 12px; }
  #show-zone-cards svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  #payment-delete-form .payment-delete-confirm { display: flex; flex-direction: row; align-items: center; gap: 8px; }
  #payment-delete-form input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; min-height: 16px; flex: none; padding: 0; margin: 0; }
}
.payment-charge-dropdown { position: relative; }
.payment-charge-dropdown > summary { cursor: pointer; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); color: var(--ink); font-size: 14px; }
.payment-charge-dropdown > summary:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; }
.payment-charge-menu { position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.payment-charge-menu label { display: flex; align-items: center; gap: 10px; padding: 10px; cursor: pointer; }
.payment-charge-menu label:hover { background: rgba(30,136,200,.1); }
.form-grid .payment-charge-menu input[type="checkbox"] { width: 18px; height: 18px; min-width: 18px; min-height: 18px; margin: 0; padding: 0; flex: 0 0 18px; }

@media screen {
  #service-invoices-panel .invoice-history-actions { justify-content: flex-end; margin-bottom: 12px; }
  #service-invoices-panel th:nth-child(7),
  #service-invoices-panel td:has(> .status-pill) { text-align: center; justify-content: center; }
  #service-invoices-panel .status-pill { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; box-sizing: border-box; text-align: center; }
  #service-invoices-panel > .table-scroll .status-pill { max-width: 100%; white-space: nowrap; }
  #service-invoices-panel > .table-scroll th:last-child,
  #service-invoices-panel > .table-scroll td.row-actions { text-align: right; justify-content: flex-end; }
  #service-invoices-panel > .table-scroll th:last-child { overflow: visible; text-overflow: clip; text-align: right; }
  #service-invoices-panel .invoice-inline-action { display: inline-grid; place-items: center; width: 36px; height: 36px; margin: 0; border: 1px solid #b7d4e7; border-radius: 10px; color: var(--accent-dark); background: #e1eff8; }
  #service-invoices-panel .invoice-inline-action:hover,
  #service-invoices-panel .invoice-inline-action:focus-visible { color: #fff; background: var(--accent-dark); }
  #service-invoices-panel .invoice-inline-action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  #service-invoices-panel .status-pill[data-status="PAGADO"],
  #service-invoices-panel .status-pill[data-status="REGISTRADO"] { color: #166534; background: #dcfce7; }
  #service-invoices-panel .status-pill[data-status="PENDIENTE"] { color: #854d0e; background: #fef3c7; }
  #service-invoices-panel .status-pill[data-status="PARCIAL"] { color: #075985; background: #e0f2fe; }
  #service-invoices-panel .status-pill[data-status="ANULADO"] { color: #991b1b; background: #fee2e2; }
  .customer-dashboard-grid .panel { border: 1px solid #c8ddeb; border-top: 4px solid var(--accent); border-radius: 14px; background: linear-gradient(150deg, #f0f8fd, #fff 60%); box-shadow: 0 5px 16px rgba(10, 58, 90, .06); }
  .customer-dashboard-grid .panel h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: #0a5079; font-size: 18px; }
  .customer-dashboard-grid h2 svg { width: 36px; height: 36px; flex: none; padding: 8px; border-radius: 10px; color: var(--accent-dark); background: #dceffc; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .customer-dashboard-data { margin: 0; align-items: start; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: 0 16px; }
  .customer-dashboard-data dt, .customer-dashboard-data dd { padding: 10px 0; border-bottom: 1px solid #e1edf4; font-size: 14px; }
  .customer-dashboard-data dd { color: var(--ink); font-weight: 500; }
  .customer-dashboard-data dt { display: flex; align-items: center; gap: 8px; }
  .customer-dashboard-data dt svg { width: 17px; height: 17px; flex: none; color: var(--accent-dark); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .swal2-container.portal-input-container { z-index: 1100; padding: 16px; background: rgba(11, 31, 40, .55); backdrop-filter: blur(3px); }
  .swal2-popup.portal-input-popup { width: min(480px, 100%); padding: 0 0 20px; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 14px; color: var(--ink); background: var(--surface); font-family: inherit; box-shadow: 0 12px 40px rgba(10, 58, 90, .2); }
  .portal-input-popup .swal2-title { padding: 20px 24px 12px; color: var(--accent-dark); font-size: 20px; text-align: left; }
  .portal-input-popup .swal2-input-label { justify-content: flex-start; margin: 0 24px 8px; color: var(--muted); font-size: 14px; text-align: left; overflow-wrap: anywhere; }
  .portal-input-popup :is(.swal2-input, .swal2-textarea) { width: calc(100% - 48px); margin: 0 24px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface-raised); font: inherit; font-size: 15px; box-shadow: none; }
  .portal-input-popup .swal2-textarea { height: 110px; resize: vertical; }
  .portal-input-popup :is(.swal2-input, .swal2-textarea):focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }
  .portal-input-popup .swal2-actions { width: calc(100% - 48px); justify-content: flex-end; gap: 8px; margin: 20px 24px 0; }
  .portal-input-popup .swal2-actions .button { margin: 0; }
  .portal-input-popup .swal2-validation-message { margin-top: 12px; padding: 10px 24px; color: #a32626; background: #fff1f1; font-size: 13px; }
  .customer-dashboard-data dt:last-of-type, .customer-dashboard-data dd:last-of-type { border-bottom: 0; }
  .customer-dashboard-balances .panel { --balance-accent: #1470a0; --balance-tint: #eaf5fd; min-width: 0; border: 1px solid #c8ddeb; border-top: 4px solid var(--balance-accent); border-radius: 14px; background: linear-gradient(140deg, var(--balance-tint), #fff); box-shadow: 0 5px 16px rgba(10, 58, 90, .06); }
  .customer-dashboard-balances .balance-collectible { --balance-accent: #965a0a; --balance-tint: #fff4df; }
  .customer-dashboard-balances .balance-future { --balance-accent: #6652a3; --balance-tint: #f1edfc; }
  .customer-dashboard-balances .balance-credit { --balance-accent: #247346; --balance-tint: #eaf7ef; }
  .customer-dashboard-balances span { color: var(--balance-accent); font-size: 16px; font-weight: 600; line-height: 1.5; }
  .customer-dashboard-balances strong { color: var(--balance-accent); font-size: clamp(20px, 2.2vw, 30px); overflow-wrap: anywhere; }
  .customer-dashboard-balances small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
  #service-invoices-panel .row-actions { text-align: right; justify-content: flex-end; gap: 4px; }
  #service-invoices-panel > .table-scroll table tbody tr > td.row-actions { flex-wrap: nowrap; }
  #service-invoices-panel > .table-scroll table.rt-desktop tbody tr.is-open > td.row-actions.rt-collapsed { display: flex; align-items: center; }
  #service-invoices-panel > .table-scroll table.rt-desktop tbody tr.is-open > td.row-actions.rt-collapsed::before { flex: 1 1 auto; margin-right: auto; }
  #service-invoices-panel .row-actions .invoice-inline-action { flex: 0 0 36px; }
  #service-invoices-panel .invoice-pay-button { color: var(--accent-dark); background: #e1eff8; }
  #service-invoices-panel .invoice-pay-button:hover { color: #fff; background: var(--accent-dark); }
  #service-invoices-panel #invoices-pay:disabled { cursor: default; }
  #monthly-invoice-filters .invoice-client-filter { display: grid; gap: 8px; flex: 0 0 100%; min-width: 0; }
  #monthly-invoice-filters .invoice-filter-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  #monthly-invoice-filters .invoice-filter-heading #invoice-count { width: auto; margin-left: auto; text-align: right; }
  .panel.table-filter-card { border: 1px solid #bdd9eb; border-top: 4px solid var(--accent); border-radius: 14px; box-shadow: 0 6px 18px rgba(10, 58, 90, .08); background: linear-gradient(120deg, #eaf5fd, #f7fbff 65%, #eef9f6); }
  .table-filter-card .filter-row { padding-bottom: 0; }
  .table-filter-card label { color: #0a5079; }
  .table-filter-card input,
  .table-filter-card select { border-color: #a7cce3; background-color: #fff; box-shadow: 0 2px 4px rgba(10, 58, 90, .04); }
  .table-filter-card input:focus,
  .table-filter-card select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 123, 189, .16); }
  #monthly-invoice-filters #invoice-count { padding: 8px 12px; margin-bottom: 0; border: 1px solid #b7d9ec; border-radius: 20px; color: #0a5079; background: #dceffc; font-weight: 600; }
  #monthly-invoice-filters .invoice-client-filter input { width: 100%; min-width: 0; box-sizing: border-box; }
  #monthly-invoices-panel th:last-child,
  #monthly-invoices-panel td.row-actions { text-align: right; }
  #monthly-invoices-panel td.row-actions { justify-content: flex-end; white-space: nowrap; }
  #monthly-invoices-panel .invoice-actions { --invoice-action-color: var(--accent-dark); --invoice-action-bg: #e1eff8; border-radius: 10px; }
  #monthly-invoices-panel .invoice-actions[data-status="PAGADO"] { --invoice-action-color: var(--ok); --invoice-action-bg: #e0f0e7; }
  #monthly-invoices-panel .invoice-actions[data-status="ANULADO"] { --invoice-action-color: var(--muted); --invoice-action-bg: var(--surface); }
  #monthly-invoices-panel .invoice-actions .customer-collect-button,
  #monthly-invoices-panel .invoice-actions .row-menu-btn { min-height: 36px; color: var(--invoice-action-color); background: var(--invoice-action-bg); border: 1px solid var(--line); box-shadow: none; }
  #monthly-invoices-panel .invoice-actions .customer-collect-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 100px; padding: 0 12px; font-size: 13px; font-weight: 600; }
  #monthly-invoices-panel .invoice-actions .row-menu-btn { width: 34px; border-left: 0; }
  #monthly-invoices-panel .invoice-actions:not(:has(.row-menu-btn)) > :first-child { border-radius: 10px !important; }
  #monthly-invoices-panel .invoice-actions .customer-collect-button:not(:disabled):hover { color: #fff; background: var(--accent-dark); }
  #monthly-invoices-panel .invoice-actions .customer-collect-button:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
  #monthly-invoices-panel .invoice-actions .customer-collect-button:disabled { opacity: 1; cursor: default; }
  #monthly-invoices-panel .invoice-actions svg,
  .monthly-invoice-menu svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .monthly-invoice-menu button:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
}

@media screen {
  :root {
    --accent: #1976d2;
    --accent-dark: #1565c0;
    --brand: #1976d2;
    --brand-dark: #0b2d4a;
    --navy: #0b2d4a;
    --navy-2: #1976d2;
    --blue-bright: #1976d2;
    --teal: #1976d2;
    --teal-light: #e8f2fc;
    --network-accent: #00bcd4;
    --telecom-spectrum: linear-gradient(90deg, #d86a38 0% 10%, #ddb438 10% 25%, #82b854 25% 45%, #43b99f 45% 65%, #30acc4 65% 82%, #1976d2 82% 100%);
    --ink: #102f46;
    --muted: #245674;
    --line: #dce1e4;
    --paper: #f7f8f9;
    --surface: #fff;
    --surface-raised: #fff;
    --green: #16a34a;
    --ok: #16a34a;
    --amber: #f59e0b;
    --amber-light: #fef3c7;
    --red: #dc2626;
  }
  body, .workspace, .app-layout { color: var(--ink); background: var(--paper); }
  .sidebar { background: var(--navy); }
  .panel, .metric-card:nth-child(n), .zone-card:nth-child(n),
  .customer-dashboard-grid .panel, .customer-dashboard-balances .panel { background: var(--surface); }
  .metric-card:nth-child(n), .zone-card:nth-child(n), .service-kpi,
  .customer-dashboard-grid .panel, .customer-dashboard-balances .panel {
    --technology-pattern: url("/assets/card-network.svg?v=2");
    --card-base: #f1f5f8;
    background-color: var(--card-base);
    background-image: var(--telecom-spectrum), linear-gradient(90deg, var(--card-base) 15%, transparent 100%),
      var(--technology-pattern);
    background-repeat: no-repeat;
    background-position: bottom, center, right center;
    background-size: 100% 2px, 100% 100%, auto 100%;
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: none;
  }
  .metric-card:nth-child(4n+2), .zone-card:nth-child(4n+2), .service-kpi:nth-child(4n+2),
  .customer-dashboard-grid .panel:nth-child(4n+2), .customer-dashboard-balances .panel:nth-child(4n+2) {
    --technology-pattern: url("/assets/card-waves.svg?v=2");
    --card-base: #f0f5f3;
  }
  .metric-card:nth-child(4n+3), .zone-card:nth-child(4n+3), .service-kpi:nth-child(4n+3),
  .customer-dashboard-grid .panel:nth-child(4n+3), .customer-dashboard-balances .panel:nth-child(4n+3) {
    --technology-pattern: url("/assets/card-circuit.svg?v=1");
    --card-base: #f3f5f5;
  }
  .metric-card:nth-child(4n+4), .zone-card:nth-child(4n+4), .service-kpi:nth-child(4n+4),
  .customer-dashboard-grid .panel:nth-child(4n+4), .customer-dashboard-balances .panel:nth-child(4n+4) {
    --technology-pattern: url("/assets/card-fiber.svg?v=1");
    --card-base: #eef5f6;
  }
  .panel.table-filter-card { background: #fafbfc; border-color: var(--line); border-top-color: var(--line); border-radius: 4px; }
  .topbar { background: var(--surface); border-bottom-color: var(--line); }
  .button-primary { background: var(--accent); }
  .button-primary:hover { background: var(--accent-dark); }
  #new-customer-button { font-weight: 600; box-shadow: 0 2px 5px rgba(25, 118, 210, .12); }
  .metric-card:nth-child(n) .metric-icon { color: var(--accent-dark); background: #e8f2fc; border-color: #c6def5; }
  .customer-network-summary { border-left: 3px solid var(--network-accent); }
  .customer-network-summary strong { color: #08758a; }
  .icon-action[data-service-action="network"] { color: #08758a; background: #e0f7fa; }
  a { color: var(--accent-dark); text-decoration: none; }
  a:hover { text-decoration: underline; }
  .topbar { min-height: 58px; border-bottom-width: 2px; }
  .page-heading { align-items: center; gap: 12px; margin-bottom: 12px; }
  .page-heading h1 { margin: 0; font-size: clamp(22px, 2vw, 26px); }
  .page-heading p { margin: 4px 0 0; }
  .page-heading .eyebrow { margin: 0 0 3px; }
  .page-heading .muted { line-height: 1.4; }
  .panel { padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 4px; box-shadow: none; }
  .panel.table-filter-card { padding: 12px 16px; border-top-width: 1px; box-shadow: none; }
  .table-filter-card .filter-row { gap: 10px 14px; margin: 0; }
  .table-scroll thead { background: #fafbfc; border-bottom: 1px solid #ccd4d9; }
  .table-scroll tr th, .table-scroll table.rt-desktop.rt-overflow thead tr::before {
    background: #fafbfc;
    color: #0b2d4a;
    border: 0;
    border-bottom: 1px solid #ccd4d9;
  }
  .table-scroll thead th:not([data-sort]):hover { color: #0b2d4a; background: #f4f7fb; }
  .table-scroll thead th[data-sort] { background: #f4f7fb; }
  .table-scroll thead th[data-sort]::after { color: #1565c0; }
  .table-scroll tr td, .table-scroll table.rt-desktop tr td { padding: 6px 10px; border: 0; border-bottom: 1px solid #edf1f5; }
  .table-scroll tr td.cell-secondary { color: var(--muted); font-size: 13px; }
  .nav-item.is-active { background: rgba(25, 118, 210, .3); box-shadow: inset 4px 0 var(--accent), 0 2px 5px rgba(0, 0, 0, .08); }
  .nav-item .nav-icon svg { width: 20px; height: 20px; }
  .metric-card:nth-child(n) {
    --card-text: var(--ink);
    --muted: #245674;
    --card-accent: var(--accent-dark);
    --amount-color: var(--accent-dark);
  }
  .zone-card:nth-child(n) { --muted: #245674; }
  .customer-dashboard-balances .balance-future { --balance-accent: #1565c0; --balance-tint: #e8f2fc; }
  .status-pill { padding: 4px 8px; border-radius: 7px; font-weight: 600; }
  .status-pill[data-status="ACTIVO" i], .status-pill[data-status="PAGADO" i], .status-pill[data-status="APROBADO" i], .status-pill[data-status="REGISTRADO" i] { color: #166534; background: #dcfce7; }
  .status-pill[data-status="SUSPENDIDO" i], .status-pill[data-status="RECHAZADO" i], .status-pill[data-status="ANULADO" i], .status-pill[data-status="VENCIDA" i] { color: #b91c1c; background: #fee2e2; }
  .status-pill[data-status="PENDIENTE" i] { color: #854d0e; background: #fef3c7; }
  .status-pill[data-status="INSTALACION" i], .status-pill[data-status="INSTALACIÓN" i], .status-pill[data-status="PARCIAL" i] { color: #145a86; background: #dceffc; }
  .status-pill[data-status="BAJA" i], .status-pill[data-status="CORTADO" i], .status-pill[data-status="INACTIVO" i] { color: #245674; background: #e9edf1; }
  .table-scroll td.balance[data-debt="clear"] { color: #166534; background: #f0faf3; }
  .table-scroll td.balance[data-debt="low"], .table-scroll td.balance[data-debt="pending"] { color: #854d0e; background: #fef3c7; }
  .table-scroll td.balance[data-debt="high"] { color: #b91c1c; background: #fee2e2; }
  #service-filters .service-search-field { position: relative; flex: 1 1 100%; min-width: 0; }
  #service-filters { position: relative; }
  #service-filters #service-count { position: absolute; top: 12px; right: 16px; width: auto; margin: 0; padding: 0; font-size: 12px; line-height: 18px; }
  #service-filters label { gap: 4px; font-size: 12px; line-height: 18px; }
  #service-filters :is(input, select), #service-filters .button { min-height: 36px; height: 36px; font-size: 13px; }
  #service-filters .filter-row { gap: 8px 12px; }
  #service-filters #service-search { width: 100%; padding-left: 38px; }
  .service-search-icon { position: absolute; left: 12px; bottom: 9px; width: 18px; height: 18px; fill: none; stroke: var(--accent-dark); stroke-width: 2; pointer-events: none; }
  .service-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
  .service-kpi { display: grid; gap: 6px; padding: 10px 12px 12px; min-width: 0; }
  .service-kpi span { color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
  .service-kpi strong { color: var(--navy); font-size: 19px; overflow-wrap: anywhere; }
  .service-kpi[data-tone="positive"] { --kpi-text: #166534; }
  .service-kpi[data-tone="warning"] { --kpi-text: #854d0e; }
  .service-kpi[data-tone="alert"] { --kpi-text: #b91c1c; }
  .service-kpi[data-tone="info"] { --kpi-text: #104b70; }
  .service-kpi[data-tone] :is(span, strong) { color: var(--kpi-text); }
  .customer-network-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 13px; }
  .customer-network-summary strong { color: #08758a; }
  .customer-network-summary small { flex-basis: 100%; color: var(--muted); }
}

@media screen {
  .customer-dashboard-grid .panel { border-top-color: var(--line); }
  .table-scroll {
    border: 1px solid #8aa5b8;
    border-radius: 2px;
    background: #fff;
    overflow-x: auto;
    box-shadow: none;
  }
  .table-scroll tbody tr:is(:hover, :focus-within),
  .table-scroll table.rt tbody tr.rt-row.is-open,
  .table-scroll table.rt-desktop tbody tr.is-open {
    background: #e1edf6;
    box-shadow: inset 3px 0 #1976d2;
  }
  .table-scroll tbody tr:is(:hover, :focus-within) > td:not(.balance[data-debt]),
  .table-scroll table.rt tbody tr.rt-row.is-open > td:not(.balance[data-debt]),
  .table-scroll table.rt-desktop tbody tr.is-open > td:not(.balance[data-debt]) {
    background: #e1edf6;
  }
  .customer-dashboard-grid .panel h2 { color: #104b70; }
  .customer-dashboard-grid h2 svg { color: #376487; background: #e5edf5; }
  .table-filter-card label { color: #104b70; }
  .breadcrumb, .breadcrumb-divider, .last-updated, .user-name,
  .login-security, .customer-phone, .customer-result span,
  .gps-row label, .gps-field small, .zone-sort, .zone-search-label,
  .zone-selection-summary, .zone-selection-empty, .permission-copy small,
  .statement-totals span { color: var(--muted); }
  .form-grid label, .customer-dashboard-data dt { color: var(--muted); }
  .panel > .table-count { color: var(--muted); }
  :is(input, select, textarea):not(:disabled) { color: var(--ink); }
  input:not(:disabled)::placeholder, textarea:not(:disabled)::placeholder { color: var(--muted); opacity: 1; }
  .button-refresh { color: #104b70; }
  .table-scroll tbody td[data-label]::before { color: var(--muted); }
  .sidebar .connection-state, .sidebar .brand-lockup small { color: #b6e3fa; }
  .table-filter-card input, .table-filter-card select { border-color: #cedae5; box-shadow: none; }
  .table-scroll tr td { border-left-color: #edf1f5; border-right-color: #edf1f5; }
  .table-scroll td.balance[data-debt="clear"] { background: #f2f8f3; }
  .table-scroll td.balance[data-debt="low"], .table-scroll td.balance[data-debt="pending"] { background: #fff9ec; }
  .table-scroll td.balance[data-debt="high"] { background: #fdf2f2; }
}
@media screen and (max-width: 740px) {
  .service-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-kpi:last-child { grid-column: 1 / -1; }
  .page-heading { flex-wrap: wrap; align-items: flex-start; }
  .panel { padding: 12px; }
}

@media screen {
  .table-scroll .row-toggle,
  .table-scroll table.rt tbody tr.rt-row.is-open .row-toggle,
  .table-scroll table.rt-desktop .row-toggle {
    color: #fff;
    background: #08758a;
    border: 1px solid #08758a;
    box-shadow: none;
  }
  .table-scroll .row-toggle:hover,
  .table-scroll table.rt tbody tr.rt-row.is-open .row-toggle:hover,
  .table-scroll table.rt-desktop .row-toggle:hover {
    color: #fff;
    background: #075a6b;
    border-color: #075a6b;
  }
  .table-scroll .row-toggle:focus-visible {
    outline: 2px solid #08758a;
    outline-offset: 3px;
  }
  .table-scroll :is(td.row-actions, td.cell-actions) button:not(:disabled):not(.small-danger):not(.tone-red),
  :is(#customers-panel, #services-panel, #service-invoices-panel, #monthly-invoices-panel) :is(td.row-actions, td.cell-actions) button:not(:disabled):not(.small-danger):not(.tone-red) {
    color: #104b70;
    background: #f1f7fb;
    border: 1px solid #67859c;
    box-shadow: none;
  }
  .table-scroll :is(td.row-actions, td.cell-actions) button:not(:disabled):not(.small-danger):not(.tone-red):hover,
  :is(#customers-panel, #services-panel, #service-invoices-panel, #monthly-invoices-panel) :is(td.row-actions, td.cell-actions) button:not(:disabled):not(.small-danger):not(.tone-red):hover {
    color: #0b2d4a;
    background: #e1edf6;
    border-color: #104b70;
  }
  .table-scroll :is(td.row-actions, td.cell-actions) button:not(:disabled):not(.small-danger):not(.tone-red):focus-visible {
    outline: 2px solid #104b70;
    outline-offset: 3px;
  }
  .split-btn .row-menu-btn:not(:disabled):not(.small-danger):not(.tone-red):hover,
  .split-btn .row-menu-btn:not(:disabled):not(.small-danger):not(.tone-red):focus-visible,
  .split-btn .row-menu-btn:not(:disabled):not(.small-danger):not(.tone-red)[aria-expanded="true"] {
    color: #0b2d4a !important;
    background: #e1edf6 !important;
    border-color: #104b70;
    filter: none;
    box-shadow: none;
  }
  .split-btn .row-menu-btn:not(:disabled):not(.small-danger):not(.tone-red):focus-visible {
    outline: 2px solid #104b70;
    outline-offset: 3px;
  }
}
