:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #142033;
  background: #f6f8fb;
  line-height: 1.4;
}

* { box-sizing: border-box; }
body { margin: 0; }
.hidden { display: none !important; }
.global-body { min-height: 100vh; background: #f6f8fb; }
.admin-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right, #22304a 0, #101b31 42%, #0b1426 100%); }
.auth-card { width: min(100%, 430px); background: #fff; border-radius: 14px; padding: 30px; box-shadow: 0 20px 60px #050b18aa; }
.auth-brand { color: #142033; padding: 0 0 30px; }
.auth-card h1 { margin: 8px 0 0; font-size: 26px; }
.auth-subtitle { color: #708096; font-size: 12px; margin: 8px 0 22px; }
.auth-form, .compact-form { display: grid; gap: 13px; }
.auth-form label, .compact-form label { display: grid; gap: 6px; color: #708096; font-size: 11px; }
.auth-form input, .compact-form input, .compact-form select { border: 1px solid #d7dfeb; border-radius: 7px; padding: 10px; color: #142033; background: #fff; font: inherit; }
.auth-note { color: #708096; font-size: 10px; line-height: 1.5; margin: 16px 0; }
.preview-link { padding: 0; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 242px; }
.admin-form-grid { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(260px, 1.1fr); gap: 15px; margin-bottom: 15px; }
.catalog-actions { display: flex; flex-wrap: wrap; gap: 10px; }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(92vw, 520px); box-shadow: 0 24px 70px #050b1855; }
dialog::backdrop { background: #07122599; }
dialog .compact-form { padding: 24px; }
dialog h3 { margin: 0 0 4px; }
.compact-form h2 { font-size: 14px; margin: 0 0 2px; color: #142033; }
.compact-form .primary-btn { margin-top: 4px; }
.form-section-title { margin-top: 4px; padding-top: 8px; border-top: 1px solid #e5eaf1; color: #142033; font-size: 12px; font-weight: 700; }
.form-section-title span { color: #708096; font-weight: 400; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 224px; background: #101b31; color: #bac5d5; padding: 25px 14px; display: flex; flex-direction: column; }
.brand { color: #fff; font-size: 18px; font-weight: 750; display: flex; align-items: center; gap: 10px; padding: 0 10px 36px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #f5a623; color: #101b31; font-weight: 900; }
.workspace-label { font-size: 10px; letter-spacing: 1.2px; color: #75849b; padding: 0 11px 9px; }
.nav { display: grid; gap: 4px; }
.nav-item { border: 0; background: transparent; color: #aebbd0; text-align: left; padding: 11px; border-radius: 8px; display: flex; gap: 11px; align-items: center; font: inherit; font-size: 12px; cursor: pointer; }
.nav-item:hover, .nav-item.active { background: #22304a; color: #fff; }
.nav-item.active span { color: #f5a623; }
.nav-item span { width: 17px; text-align: center; color: #8292aa; }
.sidebar-bottom { margin-top: auto; }
.profile { border-top: 1px solid #2b3850; padding: 18px 8px 0; display: flex; gap: 9px; align-items: center; font-size: 11px; }
.avatar { display: grid; place-items: center; background: #dde6ff; color: #3249a5; width: 31px; height: 31px; border-radius: 50%; font-weight: 800; }
.profile small { display: block; color: #8292aa; margin-top: 2px; }
.logout-btn { width: 100%; margin-top: 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 7px; padding: 9px 10px; background: transparent; color: #cbd5e1; font: inherit; font-size: 11px; cursor: pointer; text-align: left; }
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.main-content { flex: 1; min-width: 0; }
.admin-shell .content { max-width: none; }
.topbar { height: 65px; border-bottom: 1px solid #e5eaf1; background: #fff; display: flex; justify-content: space-between; align-items: center; padding: 0 30px; }
.breadcrumb { font-size: 12px; color: #708096; }
.breadcrumb span { padding: 0 8px; color: #c4ccda; }
.breadcrumb strong { color: #142033; }
.station-picker { display: flex; align-items: center; gap: 9px; font-size: 11px; color: #708096; }
.station-picker select { border: 1px solid #e5eaf1; border-radius: 7px; padding: 8px 10px; color: #142033; background: #fff; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 21px; color: #708096; }
.content { max-width: 1440px; margin: auto; padding: 29px 32px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 19px; }
.eyebrow { margin: 0 0 6px; color: #708096; font-size: 11px; }
.page-heading h1 { margin: 0; font-size: 27px; line-height: 1.15; }
.page-heading p:not(.eyebrow) { color: #708096; font-size: 12px; margin: 7px 0 0; }
.page-actions { display: flex; gap: 9px; align-items: center; }
.primary-btn, .secondary-btn { border-radius: 7px; padding: 10px 14px; font-weight: 700; font-size: 12px; cursor: pointer; }
.primary-btn { border: 0; background: #f5a623; color: #101b31; }
.secondary-btn { border: 1px solid #d7dfeb; background: #fff; color: #142033; }
.mode-line { height: 20px; text-align: right; }
.connection { font-size: 10px; color: #9a6200; }
.connection:before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #f5a623; margin-right: 5px; }
.connection.online { color: #13784d; }
.connection.online:before { background: #1aa76c; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 18px; }
.stat-card, .panel { background: #fff; border: 1px solid #e5eaf1; border-radius: 10px; }
.stat-card { padding: 15px; }
.stat-label { color: #708096; font-size: 11px; }
.stat-value { font-size: 23px; font-weight: 800; margin-top: 9px; }
.stat-value.green { color: #1aa76c; }
.stat-value.red { color: #d9485f; }
.stat-foot { font-size: 10px; color: #708096; margin-top: 6px; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 15px; }
.panel { padding: 18px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.panel h2 { font-size: 14px; margin: 0; }
.text-button { border: 0; background: transparent; color: #c77d00; font-size: 11px; cursor: pointer; }
.station-row { border: 1px solid #e5eaf1; border-radius: 8px; padding: 13px; margin-bottom: 9px; display: grid; grid-template-columns: 1fr 100px 75px; gap: 10px; align-items: center; font-size: 11px; }
.station-row:last-child { margin-bottom: 0; }
.station-row strong { display: block; font-size: 12px; }
.station-row small, .alert-row small { display: block; color: #708096; margin-top: 3px; }
.status { color: #1aa76c; font-size: 10px; }
.status:before { content: ""; display: inline-block; width: 6px; height: 6px; background: #1aa76c; border-radius: 50%; margin-right: 5px; }
.status.warning { color: #c77d00; }
.status.warning:before { background: #f5a623; }
.row-total { text-align: right; }
.alert-row { display: flex; gap: 9px; border-bottom: 1px solid #edf0f5; padding: 11px 0; font-size: 11px; }
.alert-row:last-child { border-bottom: 0; }
.alert-dot { width: 7px; height: 7px; border-radius: 50%; background: #d9485f; margin-top: 4px; flex: 0 0 auto; }
.alert-dot.warning { background: #f5a623; }
.step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 15px; }
.step { background: #fff; border: 1px solid #e5eaf1; border-radius: 9px; padding: 15px; display: grid; grid-template-columns: 27px 1fr; column-gap: 9px; }
.step b { grid-row: span 2; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #eaf0ff; color: #3156bd; }
.step strong { font-size: 12px; }
.step small { color: #708096; font-size: 11px; }
.tag { display: inline-block; font-size: 9px; border-radius: 20px; padding: 4px 7px; background: #dff6ea; color: #13784d; }
.warning-tag { background: #fff0d5; color: #9a6200; }
.table-scroll { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 11px; }
.table th { text-align: left; color: #708096; font-size: 9px; text-transform: uppercase; padding: 10px 7px; border-bottom: 1px solid #e5eaf1; white-space: nowrap; }
.table td { padding: 12px 7px; border-bottom: 1px solid #edf0f5; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.filter-bar { display: flex; gap: 10px; align-items: end; margin-bottom: 15px; }
.filter-bar label { display: grid; gap: 5px; color: #708096; font-size: 10px; }
.filter-bar input { border: 1px solid #d7dfeb; border-radius: 7px; padding: 9px; color: #142033; }
.number-input { width: 92px; border: 1px solid #d7dfeb; border-radius: 6px; padding: 7px 8px; color: #142033; background: #fff; font: inherit; }
.number-input:read-only, .payment-field input:read-only { background: #f6f8fb; color: #708096; cursor: not-allowed; }
.number-input:focus { outline: 2px solid #f5c86e; border-color: #f5a623; }
.helper-text { color: #708096; font-size: 11px; margin: -4px 0 12px; }
.password-rules { color: #53657d; background: #f7f9fc; border: 1px solid #e5eaf1; border-radius: 6px; padding: 8px 10px; margin-top: -7px; line-height: 1.45; }
.inline-note { background: #fff5df; border: 1px solid #f5d48e; color: #815600; border-radius: 8px; padding: 10px 12px; font-size: 11px; margin-bottom: 14px; }
.closed-action { display: inline-flex; align-items: center; border-radius: 7px; padding: 10px 14px; background: #dff6ea; color: #13784d; font-size: 12px; font-weight: 700; }
.payment-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.payment-field { display: grid; gap: 6px; color: #708096; font-size: 10px; }
.payment-field input { border: 1px solid #d7dfeb; border-radius: 7px; padding: 9px; color: #142033; font: inherit; }
dialog { border: 0; border-radius: 14px; padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 24px 70px rgba(15, 23, 42, .28); color: #142033; }
dialog::backdrop { background: rgba(15, 23, 42, .42); }
dialog .compact-form { display: grid; gap: 12px; }
.reconciliation-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.reconciliation-grid div { background: #f6f8fb; border-radius: 8px; padding: 11px; }
.reconciliation-grid small { display: block; color: #708096; font-size: 10px; }
.reconciliation-grid strong { display: block; margin-top: 6px; font-size: 15px; }
.difference { color: #d9485f; }
.report-actions { display: flex; gap: 8px; }
.action-group { display: flex; gap: 8px; }
.rule-panel { margin-bottom: 15px; }
.inline-action { display: inline-flex; align-items: center; gap: 6px; }
.inline-action select { border: 1px solid #d7dfeb; border-radius: 6px; padding: 5px; color: #142033; background: #fff; font: inherit; font-size: 10px; }
.inline-action .text-button { padding: 0; white-space: nowrap; }
.table td strong { font-size: 11px; }
.table td small { display: block; color: #708096; margin-top: 3px; }
.conditional-field { padding: 10px; border: 1px solid #dfe7f2; border-radius: 8px; background: #f8faff; }
.conditional-field[hidden] { display: none; }
.credential-note { background: #eaf8f0; border: 1px solid #a8e0bf; color: #12623f; border-radius: 8px; padding: 11px 12px; font-size: 11px; }
.field-error { color: #b4233c !important; }
.field-error input, .field-error select { border-color: #d9485f !important; background: #fff5f7 !important; box-shadow: 0 0 0 2px rgba(217, 72, 95, .08); }
.field-error-message { color: #b4233c; font-size: 10px; line-height: 1.35; }
.conditional-field.field-error { border-color: #d9485f; background: #fff5f7; }
.assignment-label { display: block; font-weight: 600; }
.tank-overview, .setup-panel { margin-bottom: 20px; }
.tank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tank-card { border: 1px solid #dfe6ef; border-radius: 12px; padding: 14px; background: #fbfcfe; }
.tank-card.tank-low { border-color: #ef9a9a; background: #fff7f7; }
.tank-card-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.tank-card-header small, .tank-card > small { display: block; color: #72819a; margin-top: 5px; }
.tank-level { height: 10px; border-radius: 99px; background: #e5eaf2; margin: 15px 0 7px; overflow: hidden; }
.tank-level span { display: block; height: 100%; border-radius: inherit; background: #19a66a; }
.tank-low .tank-level span { background: #e04f5f; }
.tank-refill-form { margin-top: 18px; border-top: 1px solid #e7ebf1; padding-top: 18px; }
.empty-state { padding: 26px; text-align: center; color: #61708a; }
.empty-state strong { color: #15233c; display: block; font-size: 17px; }
.inline-action-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 22px; background: rgba(15, 23, 42, .52); }
.modal-card { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 44px); overflow: auto; padding: 24px; background: #fff; border: 1px solid #e5eaf1; border-radius: 14px; box-shadow: 0 24px 70px rgba(15, 23, 42, .3); }
.modal-card-large { width: min(820px, calc(100vw - 32px)); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-close { width: 31px; height: 31px; border: 1px solid #d7dfeb; border-radius: 50%; background: #fff; color: #708096; font-size: 22px; line-height: 1; cursor: pointer; }
.modal-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.modal-form-grid .form-section-title { grid-column: 1 / -1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 18px; margin-top: 7px; border-top: 1px solid #e5eaf1; }

@media (max-width: 900px) {
  .content { padding: 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; z-index: 4; height: 100%; width: 224px; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 16px; }
  .station-picker { font-size: 0; }
  .station-picker select { font-size: 11px; max-width: 158px; }
  .content { padding: 21px 16px; }
  .page-heading { display: block; }
  .page-heading .primary-btn { margin-top: 14px; }
  .page-actions { margin-top: 14px; flex-wrap: wrap; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 19px; }
  .dashboard-grid { gap: 12px; }
  .station-row { grid-template-columns: 1fr 86px; }
  .row-total { display: none; }
  .step-grid { grid-template-columns: 1fr; }
  .payment-grid { grid-template-columns: 1fr 1fr; }
  .reconciliation-grid { grid-template-columns: 1fr; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-sidebar { width: 224px; }
  .filter-bar { align-items: stretch; flex-wrap: wrap; }
  .filter-bar label { flex: 1; }
  .filter-bar button { height: 37px; }
  .modal-backdrop { padding: 12px; }
  .modal-card, .modal-card-large { width: 100%; max-height: calc(100vh - 24px); padding: 18px; }
  .modal-form-grid { grid-template-columns: 1fr; }
  .modal-form-grid .form-section-title { grid-column: auto; }
}

/* Propuesta local: mapa operativo de la estructura física */
.topology-map { display: grid; gap: 12px; }
.topology-island, .topology-pump { border: 1px solid #dfe6ef; border-radius: 12px; background: #fbfcfe; overflow: hidden; }
.topology-island > summary, .topology-pump > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 16px; cursor: pointer; list-style: none; }
.topology-island > summary::-webkit-details-marker, .topology-pump > summary::-webkit-details-marker { display: none; }
.topology-island > summary::before, .topology-pump > summary::before { content: '▸'; color: #f3a51b; font-size: 16px; transition: transform .15s ease; }
.topology-island[open] > summary::before, .topology-pump[open] > summary::before { transform: rotate(90deg); }
.topology-island > summary > span:first-of-type, .topology-pump > summary > span:first-of-type { flex: 1; }
.topology-island summary strong, .topology-pump summary strong { display: block; color: #142033; font-size: 13px; }
.topology-island summary small, .topology-pump summary small { display: block; color: #72819a; margin-top: 4px; font-size: 11px; }
.topology-island-body { padding: 0 16px 16px 42px; border-top: 1px solid #e7ebf1; }
.topology-pump { margin-top: 12px; background: #fff; }
.topology-pump-body { padding: 0 14px 14px 28px; border-top: 1px solid #e7ebf1; }
.topology-flow-label { padding: 12px 0 2px; color: #8a640f; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.topology-hose-list { display: grid; gap: 8px; margin: 12px 0; }
.topology-hose { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #e4e9f1; border-radius: 8px; background: #f8faff; }
.topology-hose strong { display: block; color: #142033; font-size: 11px; }
.topology-hose small { display: block; color: #72819a; margin-top: 3px; font-size: 10px; }
.topology-node-actions { display: flex; gap: 8px; padding-top: 12px; }
.compact-empty { padding: 14px; font-size: 11px; text-align: left; }
.setup-actions button:disabled { opacity: .45; cursor: not-allowed; }
.station-setup-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.setup-step-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.setup-step { display: flex; flex-direction: column; gap: 8px; min-height: 150px; padding: 14px; border: 1px solid #d7dfeb; border-radius: 10px; background: #fff; }
.setup-step b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #fff1ce; color: #8d5b00; }
.setup-step strong { color: #142033; font-size: 13px; }
.setup-step small { flex: 1; color: #708096; }
.setup-step button { align-self: flex-start; }
.setup-step button:disabled { opacity: .45; cursor: not-allowed; }
.setup-product { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid #e1e7ef; border-radius: 8px; }
.station-setup-dialog { width: min(480px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 24px; border: 1px solid #d7dfeb; border-radius: 14px; box-shadow: 0 20px 55px #14203333; }
.station-setup-dialog::backdrop { background: #101b3188; }
@media (max-width: 900px) { .setup-step-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .setup-step-grid { grid-template-columns: 1fr; } }
/* Crédito y PGR: módulos separados, con acciones explícitas y estados visibles. */
.module-tabs { display: flex; gap: 8px; margin-bottom: 16px; padding: 5px; border: 1px solid #d7dfeb; border-radius: 10px; background: #eef2f7; width: fit-content; }
.module-tab { border: 1px solid transparent; border-radius: 7px; padding: 10px 15px; background: transparent; color: #53657d; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.module-tab:hover { background: #fff; color: #142033; }
.module-tab.active { border-color: #d7dfeb; background: #fff; color: #142033; box-shadow: 0 1px 3px rgba(20,32,51,.08); }
.receivable-summary { margin-bottom: 16px; }
.account-mini-stats { grid-template-columns: repeat(3, 1fr); margin: 0 0 16px; }
.receivable-payment-form { border: 1px solid #d7dfeb; border-radius: 10px; padding: 15px; margin-top: 17px; background: #fbfcfe; }
.receivable-payment-form h3 { margin: 0 0 4px; font-size: 13px; }
.checkbox-label { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; }
.checkbox-label input { width: auto; }
.table td .secondary-btn { padding: 7px 10px; font-size: 10px; }
@media (max-width: 640px) {
  .module-tabs { width: 100%; }
  .module-tab { flex: 1; padding: 9px 8px; }
  .account-mini-stats { grid-template-columns: 1fr; }
}
