/* Sección 1: Tema y elementos comunes */
:root {
  color-scheme: dark;
  --bg: #131518;
  --panel: #1d2025;
  --edge: #363940;
  --text: #faf8f2;
  --muted: #bdc0c6;
  --yellow: #ffd332;
  --ink: #18160a;
  font: 16px/1.5 Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
button:disabled { opacity: .55; cursor: default; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 1.2rem; }
small, label, th { font-size: .875rem; }
.wrap { width: min(1120px, 92%); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* Sección 2: Encabezado, navegación y métricas */
.top { border-bottom: 1px solid var(--edge); background: #000; }
.view, .summary-heading, .filter, .panel-head { display: flex; align-items: center; gap: 12px; }
.summary-heading, .panel-head { justify-content: space-between; }
.top-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 108px;
  padding-block: 12px;
}
.top-inner .view { justify-self: end; flex-wrap: wrap; }
.view label, .filter label { color: var(--muted); }
select, input { border: 1px solid var(--edge); border-radius: 8px; background: var(--panel); color: var(--text); padding: 8px 10px; }
main { padding-block: 26px 50px; }
.demo, .notice { width: fit-content; border: 1px solid var(--edge); border-radius: 7px; padding: 5px 10px; color: var(--muted); font-size: .875rem; }
.notice { margin-bottom: 16px; color: var(--yellow); }
.heading { margin-block: 24px; }
.eyebrow { color: var(--yellow); margin-bottom: 5px; }
nav { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--edge); margin-bottom: 22px; }
nav button { border: 0; border-bottom: 2px solid transparent; padding: 9px 11px; color: var(--muted); background: none; font-weight: 650; }
nav button[aria-pressed="true"] { color: var(--yellow); border-bottom-color: var(--yellow); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-block: 15px 20px; }
.metric, .panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; }
.metric { padding: 15px; display: flex; flex-direction: column; }
.metric strong { font-size: clamp(1.3rem, 3vw, 2rem); line-height: 1.15; margin-block: 8px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric small, .panel p { color: var(--muted); }
.highlight { border-color: #8d7625; background: #2b2515; }
.highlight strong { color: var(--yellow); }
/* Sección 3: Tablas, formularios y vista móvil */
.panel-head, .settings { padding: 17px 19px; }
.panel-head { flex-wrap: wrap; }
.panel p { margin-top: 4px; font-size: .9rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { border-top: 1px solid var(--edge); padding: 10px 14px; text-align: left; }
th:first-child, td:first-child { padding-left: 19px; }
th { color: var(--muted); }
.tag { display: inline-block; font-size: .875rem; padding: 2px 8px; border-radius: 6px; background: #333740; }
.tag.ok { background: #233a2e; color: #c1f1d1; }
.tag.pending { background: #44391d; color: #ffe297; }
.actions { display: flex; gap: 6px; }
.primary, .action { border-radius: 8px; font-weight: 700; padding: 7px 11px; }
.primary { background: var(--yellow); color: var(--ink); border: 1px solid transparent; }
.action { border: 1px solid var(--edge); background: #282c34; color: var(--text); font-size: .875rem; }
.settings form { display: grid; gap: 13px; max-width: 340px; margin-top: 16px; }
.settings label { display: grid; gap: 4px; color: var(--muted); }
.settings form button { justify-self: start; }
.empty { color: var(--muted); }
@media (max-width: 760px) { .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 500px) {
  .view { flex-direction: column; align-items: flex-start; gap: 0; }
  .view select { padding-block: 4px; }
  .summary-heading { align-items: flex-start; flex-direction: column; }
  .metric { padding: 11px; }
}

/* Sección 4: Registro de recargas */
.refill-history { margin-top: 16px; }

/* Sección 5: Identidad de La Excavadora XS y Brusto */
.brand { display: grid; gap: 4px; min-width: 0; }
.brand img { display: block; width: clamp(130px, 31vw, 236px); height: auto; }
.brand small { color: var(--muted); }
.brusto-logo { display: block; width: 136px; height: auto; grid-column: 2; }
@media (max-width: 600px) {
  .top-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .brusto-logo { grid-column: 1 / -1; grid-row: 1; justify-self: center; width: 112px; }
}

/* Sección 6: Acceso y gestión de máquinas */
.access-panel { max-width: 500px; margin: 36px auto; }
.access-panel h1 { font-size: 2rem; }
.machine-picker { margin-top: 14px; }
.machine-picker select { max-width: 100%; }
.fleet-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px; margin-top: 14px; }

/* Sección 7: Confirmación de liquidación */
:is(#settlement-dialog, #refund-dialog) { width: min(420px, calc(100% - 32px)); color: var(--text); }
:is(#settlement-dialog, #refund-dialog)::backdrop { background: rgb(0 0 0 / 65%); }
:is(#settlement-dialog, #refund-dialog) form { display: flex; flex-wrap: wrap; justify-content: flex-end; max-width: none; }

/* Sección 8: Consulta de autorización */
.screen-status:not(:empty) { padding: 0 19px 12px; }


/* Sección 9: QR de prueba */
#mp-dialog { width: min(525px, 92vw); color: var(--text); }
#mp-dialog::backdrop { background: rgb(0 0 0 / 65%); }
#mp-canvas { display: block; max-width: 100%; height: auto; margin: 12px auto; image-rendering: pixelated; }
