:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #215ee9;
  --primary-hover: #1849b7;
  --nav: #101828;
  --success: #067647;
  --warning: #b54708;
  --danger: #b42318;
  --shadow: 0 8px 28px rgb(16 24 40 / 7%);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.hidden { display: none !important; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #dbeafe 0, transparent 32%), var(--bg); }
.auth-card { width: min(430px, 100%); display: grid; gap: 24px; padding: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 70px rgb(16 24 40 / 14%); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand small { margin-top: 2px; color: var(--muted); font-size: .8rem; }
.auth-card h1 { margin: 0 0 8px; font-size: 1.65rem; }
.auth-card p { margin: 0; color: var(--muted); }
.auth-form { display: grid; gap: 16px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px; background: var(--nav); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.brand-mark { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; background: var(--primary); color: #fff; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .95rem; }
.brand small { margin-top: 2px; color: #98a2b3; font-size: .76rem; }
.app-version { display: inline-flex !important; width: max-content; margin-top: 5px !important; padding: 2px 7px; border-radius: 999px; background: rgb(255 255 255 / 8%); font-size: .68rem !important; font-weight: 800; }
.main-nav { display: grid; gap: 8px; }
.nav-btn { display: flex; gap: 10px; align-items: center; min-height: 46px; padding: 11px 14px; border: 0; border-radius: 11px; background: transparent; color: #d0d5dd; text-align: left; }
.nav-btn:hover, .nav-btn.active { background: #1d2939; color: #fff; }
.user-card { display: grid; grid-template-columns: 38px minmax(0, 1fr) 32px; gap: 10px; align-items: center; margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgb(255 255 255 / 9%); }
.user-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #344054; font-weight: 900; }
.user-copy { min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: .82rem; }
.user-copy small { margin-top: 3px; color: #98a2b3; font-size: .72rem; text-transform: capitalize; }

.content { min-width: 0; padding: 28px; }
.view, .tab-pane { display: none; }
.view.active, .tab-pane.active { display: block; }
.page-head, .page-subhead { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.page-head h1, .page-subhead h2 { margin: 0 0 5px; }
.page-head h1 { font-size: clamp(1.65rem, 3vw, 2.15rem); }
.page-head p, .page-subhead p { margin: 0; color: var(--muted); }

.card { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.field { display: grid; gap: 7px; min-width: 150px; }
.field.grow { flex: 1; min-width: 260px; }
.field.compact { min-width: 180px; }
.field label, .choice-field legend { color: #475467; font-size: .86rem; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #d0d5dd; border-radius: 10px; outline: none; background: #fff; color: var(--text); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #84adff; box-shadow: 0 0 0 4px rgb(33 94 233 / 10%); }
.field input[readonly] { background: #f9fafb; }
.field input:disabled, .field select:disabled, .field textarea:disabled { cursor: not-allowed; background: #f2f4f7; color: #667085; }

.btn { min-height: 42px; padding: 9px 14px; border: 1px solid #d0d5dd; border-radius: 10px; background: #fff; color: #344054; font-weight: 750; }
.btn:hover { background: #f9fafb; }
.btn.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #fecdca; background: #fef3f2; color: var(--danger); }
.btn.small { min-height: 34px; padding: 6px 9px; font-size: .78rem; }
.btn.full { width: 100%; }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.btn.state-btn { border-color: #b2ccff; background: #eff4ff; color: #1849b7; }
.icon-btn { border: 0; background: transparent; color: #667085; font-size: 1.7rem; }
.icon-btn.compact { color: #d0d5dd; font-size: 1.2rem; }

.filters-card { padding: 16px; }
.filters-top { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.filter-actions { display: flex; gap: 8px; }
.advanced-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.choice-field { margin: 0; padding: 0; border: 0; }
.check-list { display: flex; flex-wrap: wrap; gap: 7px; }
.check-list label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid #d0d5dd; border-radius: 999px; background: #fff; font-size: .78rem; font-weight: 650; }
.check-list label:has(input:checked) { border-color: #84adff; background: #eff4ff; color: #1849b7; }
.check-list input { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); }

.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.table-head small { display: block; margin-top: 4px; color: var(--muted); font-size: .76rem; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: .82rem; }
th { position: sticky; top: 0; z-index: 1; background: #f9fafb; color: #667085; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:hover { background: #fcfcfd; }
.money { font-variant-numeric: tabular-nums; font-weight: 750; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 6px; }
.row-actions { min-width: 150px; }
.page-size { display: flex; align-items: center; gap: 8px; min-width: 0 !important; }
.page-size select { min-height: 36px; width: 76px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 14px; border-top: 1px solid var(--line); }
.pagination span { color: var(--muted); font-size: .82rem; }

.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 850; }
.badge.planificado { background: #eef2ff; color: #4338ca; }
.badge.cargando, .badge.descargando { background: #fffaeb; color: #b54708; }
.badge.en-viaje { background: #eff8ff; color: #175cd3; }
.badge.finalizado, .badge.pagado { background: #ecfdf3; color: #067647; }
.badge.cancelado { background: #fef3f2; color: #b42318; }
.badge.pendiente { background: #fff6ed; color: #c4320a; }

.tabs { display: flex; gap: 7px; margin-bottom: 16px; }
.tab-btn { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 750; }
.tab-btn.active { border-color: var(--nav); background: var(--nav); color: #fff; }
.kpi-grid, .dashboard-kpi-grid, .dashboard-secondary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi, .dashboard-kpi, .dashboard-mini-kpi { border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.kpi { padding: 17px; }
.kpi small, .dashboard-kpi small, .dashboard-mini-kpi small { color: var(--muted); font-weight: 750; }
.kpi strong { display: block; margin-top: 7px; font-size: 1.5rem; }
.kpi .delta { margin-top: 6px; font-size: .78rem; }
.delta.pos { color: var(--success); }
.delta.neg { color: var(--danger); }
.grid-2, .dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.section-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.section-title h2 { margin: 0; font-size: 1.08rem; }
.section-title small { display: block; margin-top: 4px; color: var(--muted); font-size: .76rem; }
.dashboard-head-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.dashboard-kpi { min-height: 128px; display: flex; gap: 14px; align-items: flex-start; padding: 18px; }
.dashboard-kpi-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: #f2f4f7; font-weight: 900; }
.dashboard-kpi strong { display: block; margin-top: 6px; font-size: 1.55rem; }
.dashboard-kpi span { display: block; margin-top: 8px; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.dashboard-kpi.operational .dashboard-kpi-icon { background: #eff8ff; color: #175cd3; }
.dashboard-kpi.success .dashboard-kpi-icon { background: #ecfdf3; color: #067647; }
.dashboard-kpi.info .dashboard-kpi-icon { background: #eef2ff; color: #4338ca; }
.dashboard-kpi.warning .dashboard-kpi-icon { background: #fff6ed; color: #c4320a; }
.dashboard-mini-kpi { padding: 14px 16px; }
.dashboard-mini-kpi strong { display: block; margin: 5px 0; font-size: 1.08rem; }
.dashboard-mini-kpi span { color: var(--muted); font-size: .75rem; }
.dashboard-mini-kpi.positive strong { color: var(--success); }
.dashboard-mini-kpi.negative strong { color: var(--danger); }
.dashboard-card { min-height: 290px; }
.status-overview, .commercial-overview { display: grid; gap: 13px; margin-top: 16px; }
.status-row { display: grid; gap: 7px; }
.status-row-top { display: flex; justify-content: space-between; align-items: center; }
.status-progress, .bar-track { height: 9px; overflow: hidden; border-radius: 999px; background: #eef2f6; }
.status-progress span, .bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.status-row small { color: var(--muted); font-size: .74rem; }
.commercial-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; }
.commercial-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--nav); color: #fff; font-weight: 900; }
.commercial-info strong, .commercial-info small, .commercial-money strong, .commercial-money small { display: block; }
.commercial-info small, .commercial-money small { margin-top: 3px; color: var(--muted); font-size: .74rem; }
.commercial-money { text-align: right; }
.bar-list { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 10px; font-size: .78rem; }
.bar-fill.neg { background: var(--danger); }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgb(15 23 42 / 58%); }
.modal-card { width: min(680px, 96vw); max-height: 92vh; overflow: auto; padding: 20px; border-radius: 18px; background: #fff; box-shadow: 0 30px 80px rgb(0 0 0 / 25%); }
.modal-card.wide { width: min(1120px, 96vw); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { margin: 0 0 4px; }
.modal-head small { color: var(--muted); }
.modal-head-pro { align-items: center; }
.modal-title-wrap { display: flex; align-items: center; gap: 12px; }
.modal-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #eff4ff; color: #1849b7; font-size: 1.2rem; font-weight: 850; }
.form-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.alert { padding: 12px; border-radius: 10px; font-size: .85rem; line-height: 1.4; }
.alert.warning { border: 1px solid #fedf89; background: #fffaeb; color: #93370d; }
.carga-modal { padding: 0; overflow: hidden; }
.carga-modal .modal-head { margin: 0; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(#fff, #fbfdff); }
.carga-modal form { max-height: calc(92vh - 86px); overflow: auto; padding: 20px 24px 0; }
.form-section { margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.form-section-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 14px; }
.form-section-head > div { display: flex; align-items: center; gap: 9px; }
.form-section-head h3 { margin: 0; font-size: .96rem; }
.form-section-head p { margin: 0; color: var(--muted); font-size: .78rem; text-align: right; }
.section-step { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: #f2f4f7; color: #475467; font-size: .7rem; font-weight: 900; }
.economic-section { border-color: #b2ccff; background: #fcfdff; }
.payment-section .section-step { background: #d1fadf; color: #067647; }
.main-data-grid { max-width: 620px; }
.default-state-note, .status-impact-note { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid #e4e7ec; border-radius: 10px; background: #f9fafb; color: var(--muted); font-size: .76rem; }
.status-impact-note { margin-top: 12px; border-color: #b2ccff; background: #eff4ff; color: #1849b7; }
.route-grid { display: grid; grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr); align-items: end; gap: 10px; }
.route-arrow { height: 43px; display: grid; place-items: center; color: #98a2b3; font-size: 1.35rem; }
.input-prefix { display: flex; overflow: hidden; border: 1px solid #d0d5dd; border-radius: 10px; background: #fff; }
.input-prefix:focus-within { border-color: #84adff; box-shadow: 0 0 0 4px rgb(33 94 233 / 10%); }
.input-prefix span { display: grid; place-items: center; padding: 0 11px; border-right: 1px solid var(--line); background: #f9fafb; color: var(--muted); font-weight: 800; }
.input-prefix input { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.commission-result input { border-color: #a6f4c5 !important; background: #ecfdf3 !important; color: #067647; font-weight: 900; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; justify-content: space-between; align-items: center; margin: 18px -24px 0; padding: 14px 24px; border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(8px); }
.action-group { display: flex; gap: 8px; }
.form-hint { color: var(--muted); font-size: .78rem; }
.form-hint span { color: var(--danger); font-weight: 900; }
.state-modal { width: min(620px, 96vw); }
.state-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.state-current-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f9fafb; }
.state-current-card > span { color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.quick-edit-section { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.payment-quick-section { border-color: #a6f4c5; background: #fbfefc; }
.quick-edit-title { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.quick-edit-title strong { font-size: .85rem; }
.quick-edit-title small { color: var(--muted); font-size: .72rem; text-align: right; }
.autocomplete-wrap { position: relative; }
.autocomplete-list { position: absolute; top: 100%; right: 0; left: 0; z-index: 20; display: none; max-height: 190px; overflow: auto; border: 1px solid #d0d5dd; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgb(0 0 0 / 12%); }
.autocomplete-list.open { display: block; }
.autocomplete-item { padding: 10px 11px; font-size: .84rem; }
.autocomplete-item:hover, .autocomplete-item.active { background: #eff4ff; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: min(420px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 10px; background: var(--nav); color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }
.loading { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgb(255 255 255 / 70%); font-weight: 800; }
.spinner { width: 25px; height: 25px; border: 3px solid #dbeafe; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.mobile-header, .mobile-list { display: none; }
.modal-open { overflow: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .advanced-filters { grid-template-columns: repeat(2, 1fr); }
  .cols-4, .cols-3, .kpi-grid, .dashboard-kpi-grid, .dashboard-secondary-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { background: #f4f7fb; }
  .app-shell { display: block; min-height: 100dvh; }
  .mobile-header { position: sticky; top: 0; z-index: 28; display: flex; justify-content: space-between; align-items: center; min-height: 62px; padding: calc(9px + env(safe-area-inset-top)) 16px 9px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 94%); backdrop-filter: blur(14px); }
  .mobile-brand { display: flex; align-items: center; gap: 10px; }
  .mobile-brand .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: .86rem; }
  .mobile-brand strong, .mobile-brand small { display: block; }
  .mobile-brand strong { font-size: .9rem; }
  .mobile-brand small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
  .mobile-logout { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #f2f4f7; font-size: 1.25rem; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 40; height: auto; padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid rgb(255 255 255 / 11%); box-shadow: 0 -10px 30px rgb(15 23 42 / 16%); }
  .sidebar .brand, .sidebar .user-card { display: none; }
  .main-nav { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .nav-btn { min-height: 56px; justify-content: center; flex-direction: column; gap: 3px; padding: 7px 4px; border-radius: 10px; font-size: .7rem; line-height: 1; }
  .nav-btn span:first-child { font-size: 1rem; line-height: 1; }
  .content { padding: 17px 14px calc(92px + env(safe-area-inset-bottom)); }
  .page-head, .page-subhead { align-items: stretch; flex-direction: column; }
  .page-head { gap: 14px; margin-bottom: 16px; }
  .page-head h1 { font-size: 1.65rem; }
  .page-head p, .page-subhead p { font-size: .88rem; }
  .page-head > .btn, .page-subhead > .btn { width: 100%; }
  .dashboard-head-actions, .filter-actions { align-items: stretch; flex-wrap: wrap; }
  .dashboard-head-actions > *, .dashboard-head-actions .btn { width: 100%; }
  .filters-top { display: grid; }
  .field, .field.grow, .field.compact { min-width: 0; }
  .field input, .field select, .field textarea { min-height: 48px; font-size: 1rem; }
  .btn { min-height: 46px; }
  .filter-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .filter-actions .btn:last-child { grid-column: 1 / -1; }
  .advanced-filters, .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .kpi-grid, .dashboard-kpi-grid, .dashboard-secondary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dashboard-kpi { min-height: 142px; flex-direction: column; gap: 9px; padding: 14px; }
  .dashboard-kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .dashboard-kpi strong { margin-top: 4px; font-size: 1.18rem; overflow-wrap: anywhere; }
  .dashboard-kpi span { margin-top: 5px; font-size: .7rem; }
  .dashboard-mini-kpi, .kpi { min-width: 0; padding: 13px; }
  .dashboard-mini-kpi strong, .kpi strong { overflow-wrap: anywhere; font-size: 1.05rem; }
  .dashboard-card { min-height: auto; }
  .card { margin-bottom: 14px; padding: 15px; border-radius: 14px; }
  .table-card { padding: 0; }
  .table-head { padding: 14px 14px 10px; }
  .page-size label { display: none; }
  .desktop-data { display: none; }
  .mobile-list { display: grid; gap: 11px; }
  .table-card > .mobile-list { padding: 10px 12px 14px; }
  .mobile-data-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 4px 14px rgb(16 24 40 / 5%); }
  .mobile-card-head, .mobile-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .mobile-card-head > small { color: var(--muted); font-size: .72rem; text-align: right; }
  .mobile-card-primary strong, .mobile-card-primary small { display: block; }
  .mobile-card-primary strong { font-size: 1rem; }
  .mobile-card-primary small { margin-top: 4px; color: var(--muted); font-size: .78rem; }
  .mobile-route { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); align-items: center; gap: 5px; padding: 10px; border-radius: 10px; background: #f7f9fc; font-size: .8rem; font-weight: 700; }
  .mobile-route b { color: var(--primary); text-align: center; }
  .mobile-route span:last-child { text-align: right; }
  .mobile-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .mobile-detail-grid.three-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mobile-metric { min-width: 0; }
  .mobile-metric small, .mobile-metric span { display: block; }
  .mobile-metric small { margin-bottom: 3px; color: var(--muted); font-size: .68rem; }
  .mobile-metric span { overflow-wrap: anywhere; font-size: .78rem; }
  .mobile-payment { display: grid; justify-items: start; gap: 4px; }
  .mobile-payment small { color: var(--muted); font-size: .68rem; }
  .mobile-card-actions { display: flex; gap: 7px; }
  .mobile-card-actions .btn { min-height: 40px; padding: 8px 10px; font-size: .76rem; }
  .mobile-card-actions.full-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .mobile-empty { display: grid; justify-items: center; gap: 5px; padding: 28px 14px; color: var(--muted); text-align: center; }
  .mobile-empty span { font-size: 1.5rem; }
  .mobile-empty p { margin: 0; font-size: .84rem; }
  .mobile-person { display: flex; align-items: center; gap: 8px; }
  .mobile-person span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--nav); color: #fff; font-weight: 900; }
  .mobile-category { padding: 5px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: .72rem; font-weight: 800; }
  .mobile-delta { padding-top: 10px; border-top: 1px solid var(--line); font-size: .72rem; font-weight: 750; }
  .mobile-delta.positive, .success-text { color: var(--success); }
  .mobile-delta.negative, .danger-text { color: var(--danger); }
  .warning-text { color: #b54708; }
  .pagination { justify-content: space-between; gap: 7px; padding: 12px; }
  .pagination .btn { min-height: 40px; padding: 8px 10px; font-size: .72rem; }
  .pagination span { text-align: center; font-size: .74rem; }
  .modal { place-items: stretch; padding: 0; }
  .modal-card, .modal-card.wide, .state-modal { width: 100%; height: 100dvh; max-height: none; padding: 16px; border-radius: 0; overscroll-behavior: contain; }
  .carga-modal .modal-head { padding: 16px; }
  .carga-modal form { max-height: calc(100dvh - 75px); padding: 14px 14px 0; }
  .form-section { padding: 14px; }
  .form-section-head, .quick-edit-title { align-items: flex-start; flex-direction: column; gap: 6px; }
  .form-section-head p, .quick-edit-title small { text-align: left; }
  .route-grid { grid-template-columns: 1fr; }
  .route-arrow { height: 20px; transform: rotate(90deg); }
  .sticky-actions { align-items: stretch; flex-direction: column; margin: 16px -14px 0; padding: 12px 14px; }
  .action-group { display: grid; grid-template-columns: 1fr 1fr; }
  .state-summary-grid { grid-template-columns: 1fr; }
  .modal-actions:not(.sticky-actions) { position: sticky; bottom: -16px; display: grid; grid-template-columns: 1fr 1fr; margin-right: -16px; margin-left: -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(8px); }
  .tabs { position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 20; overflow: auto; padding: 4px 0 8px; background: #f4f7fb; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 1 0 auto; min-height: 44px; }
  .bar-row { grid-template-columns: 58px 1fr; }
  .bar-row > span { grid-column: 2; }
  .toast { right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 12px; max-width: none; text-align: center; }
  .auth-page { padding: 16px; }
  .auth-card { padding: 24px 20px; border-radius: 18px; }
}

@media (max-width: 370px) {
  .kpi-grid, .dashboard-kpi-grid, .dashboard-secondary-grid { grid-template-columns: 1fr; }
  .dashboard-kpi { min-height: auto; }
  .mobile-detail-grid.three-metrics { grid-template-columns: 1fr; }
}

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