.shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .shell { grid-template-columns: 250px minmax(0, 1fr); } }

.side { background: var(--ink); color: #f3f5f7; padding: 14px 16px; display: grid; gap: 12px; align-content: start; }
@media (min-width: 900px) { .side { position: sticky; top: 0; height: 100vh; padding: 24px 18px; gap: 20px; overflow-y: auto; } }
.side .logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: #fff; text-decoration: none; letter-spacing: -0.02em; }
.side label.f { color: #c9d2db; }
.side select { background: #1b2a38; color: #fff; border-color: #44566a; }
#nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
#nav a {
  flex: none; padding: 9px 13px; border-radius: 9px; color: #d6dde4; text-decoration: none; font-weight: 600; white-space: nowrap;
}
#nav a:hover { background: #1f2f3e; color: #fff; }
#nav a[aria-current="page"] { background: #f3f5f7; color: var(--ink); }
@media (min-width: 900px) { #nav { flex-direction: column; overflow: visible; } }

#view { padding: 22px 18px 90px; max-width: 980px; width: 100%; outline: none; display: grid; gap: 28px; align-content: start; }
@media (min-width: 900px) { #view { padding: 36px 40px 90px; } }
#view h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.03em; }
#view h2 { font-size: 22px; }
.sub { color: var(--muted); margin-top: 6px; max-width: 62ch; }
.sec { display: grid; gap: 14px; }
.sec > header { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }

/* Portada: coste por km */
.hero-app { background: var(--ink); color: #f3f5f7; border-radius: 20px; padding: 26px; display: grid; gap: 22px; }
@media (min-width: 760px) { .hero-app { grid-template-columns: auto 1fr; align-items: center; gap: 40px; padding: 30px 34px; } }
.hero-app .who { font-weight: 700; color: #c9d2db; margin-bottom: 10px; }
.hero-app .unit { margin-top: 10px; font-weight: 700; }
.hero-app .hint { color: #c9d2db; max-width: 36ch; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin: 0; }
.kpis div { display: grid; gap: 2px; }
.kpis dt { color: #b9c3cd; font-size: 14px; font-weight: 600; }
.kpis dd { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.kpis.light dt { color: var(--muted); }

/* Listados con regla (libro de registro) */
.ledger-app { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--line); }
.ledger-app li { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; align-items: center; padding: 12px 2px; border-bottom: 1.5px solid var(--line); }
.ledger-app .t { font-weight: 650; }
.ledger-app .m { color: var(--muted); font-size: 14px; grid-column: 1; }
.ledger-app .amt { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; grid-row: 1; grid-column: 2; }
.ledger-app .act { grid-column: 2; grid-row: 2; justify-self: end; display: flex; gap: 6px; }
.empty { padding: 22px; border: 2px dashed #b7c0ca; border-radius: var(--r); color: var(--muted); display: grid; gap: 10px; justify-items: start; }
.empty strong { color: var(--ink); font-size: 18px; }

/* Formularios del app */
.form { background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 14px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
details.form > summary { cursor: pointer; font-weight: 700; font-size: 18px; list-style: none; }
details.form > summary::-webkit-details-marker { display: none; }
details.form > summary::before { content: "+"; display: inline-block; width: 24px; font-weight: 800; color: var(--blue); }
details.form[open] > summary::before { content: "−"; }
details.form[open] > summary { margin-bottom: 14px; }

/* Estados de avisos */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 750; white-space: nowrap; }
.chip.overdue { background: var(--red-wash); color: #8f2119; }
.chip.soon { background: var(--amber-wash); color: #6f4b00; }
.chip.ok { background: var(--green-wash); color: #115a3a; }

/* Gráficas */
.chart { background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .cap { color: var(--muted); font-size: 14px; margin-top: 6px; }
.cats { display: grid; gap: 10px; }
.cats .row { display: grid; grid-template-columns: 150px 1fr 90px; gap: 10px; align-items: center; font-size: 14px; }
.cats .bar { height: 12px; border-radius: 6px; background: #e3e8ed; overflow: hidden; }
.cats .bar i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.cats .v { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .cats .row { grid-template-columns: 110px 1fr 74px; } }

.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 16px; background: var(--panel); }
table.t { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 15px; }
table.t th, table.t td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
table.t th { font-size: 13px; color: var(--muted); font-weight: 700; background: #eef1f4; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:last-child td { border-bottom: 0; }

.banner { background: var(--amber-wash); border-left: 5px solid var(--amber); border-radius: 0 10px 10px 0; padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.protray { display: flex; gap: 10px; flex-wrap: wrap; }
.note { color: var(--muted); font-size: 14px; max-width: 70ch; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 650; z-index: 50;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.station { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; padding: 12px 2px; border-bottom: 1.5px solid var(--line); }
.station .price { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; grid-row: 1 / span 2; grid-column: 2; align-self: center; }

#printSheet { display: none; }
@media print {
  body > *:not(#printSheet) { display: none !important; }
  #printSheet { display: block !important; padding: 0; color: #000; background: #fff; }
  #printSheet h1 { font-size: 26px; margin-bottom: 4px; }
  #printSheet table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 12px; }
  #printSheet th, #printSheet td { border-bottom: 1px solid #999; padding: 5px 6px; text-align: left; }
}

.gasctl { display: grid; gap: 12px; margin-bottom: 8px; }
.station .t .dist { font-weight: 600; color: var(--muted); font-size: 15px; white-space: nowrap; }
.station .act { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }

/* Cuenta y acceso */
.auth-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.auth-tabs .btn[aria-pressed="true"] { background: var(--blue); color: #fff; }
.acctbox { display: grid; gap: 10px; }
.acctbox .row { display: flex; gap: 10px; flex-wrap: wrap; }
.banner .row { display: flex; gap: 8px; flex-wrap: wrap; }
dialog.cw [hidden] { display: none !important; }

.acct-top { position: fixed; top: 10px; right: 14px; z-index: 40; }
.acct-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #44566a; background: #1b2a38; color: #fff; display: grid; place-items: center; font: 700 17px/1 inherit; cursor: pointer; padding: 0; }
.acct-btn.on { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.acct-btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
@media (min-width: 900px) { .acct-btn { border-color: var(--line, #d5dbe1); background: #fff; color: var(--ink); } .acct-btn.on { background: var(--amber); border-color: var(--amber); } }
.acct-menu { position: absolute; top: 48px; right: 0; width: min(320px, calc(100vw - 28px)); background: #fff; color: var(--ink); border: 1px solid var(--line, #d5dbe1); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,27,38,.22); padding: 14px; display: grid; gap: 10px; }
.acct-menu .who { display: grid; gap: 2px; margin: 0; word-break: break-all; }
.acct-menu .who span { color: var(--muted, #5b6470); font-size: 14px; }
.acct-menu .mi { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line, #e3e7eb); padding: 11px 2px 0; font: inherit; color: inherit; cursor: pointer; text-decoration: none; }
.acct-menu .mi:hover { text-decoration: underline; }
.acct-menu .mi.danger { color: #b3261e; }
@media (max-width: 899px) { .side .logo { margin-right: 52px; } }
