:root {
  --bg: #f4f6f7; --card: #ffffff; --text: #1b2428; --muted: #6a7a82; --line: #dfe5e8;
  --accent: #0f766e; --accent-text: #ffffff; --danger: #b42318; --bar: #14b8a6;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101517; --card: #182024; --text: #e7eef0; --muted: #8fa1a8; --line: #2a363b;
    --accent: #2dd4bf; --accent-text: #06201d; --danger: #f97066; --bar: #2dd4bf;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }

header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line); }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }

nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav#tabs button { flex: 1; padding: 14px 4px; background: none; border: 0; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; }
nav#tabs button.on { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0; }
h2 { margin: 4px 0 12px; font-size: 20px; }
h3 { margin: 16px 0 8px; font-size: 16px; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 8px 0 0; transform: scale(1.25); }
label.check { display: flex; align-items: center; color: var(--text); font-size: 16px; }

button { font: inherit; cursor: pointer; }
button.primary, button.secondary, button.danger { padding: 11px 16px; border-radius: 10px; font-weight: 600; border: 1px solid transparent; }
button.primary { background: var(--accent); color: var(--accent-text); }
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.small { padding: 6px 10px; font-size: 14px; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.row > button { flex: 0 0 auto; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.login-card { max-width: 380px; margin: 14vh auto 0; }
.login-card h1 { margin-top: 0; }
.login-card button { width: 100%; }

.charge { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.charge .plate { font-weight: 700; letter-spacing: .5px; }
.charge .amount { text-align: right; font-weight: 700; }
.charge .actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; }
.thumb { height: 52px; width: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tile b { display: block; font-size: 22px; line-height: 1.2; }
.tile span { color: var(--muted); font-size: 13px; }
@media (max-width: 420px) { .tile b { font-size: 18px; } }

.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 38px 1fr 92px; gap: 8px; align-items: center; font-size: 14px; }
.bar .track { background: var(--bg); border-radius: 6px; height: 18px; overflow: hidden; }
.bar .fill { background: var(--bar); height: 100%; border-radius: 6px; min-width: 0; }
.bar .val { text-align: right; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

dialog { width: min(520px, 94vw); max-height: 92vh; border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog img.full { max-width: 100%; max-height: 74vh; display: block; margin: 0 auto 12px; border-radius: 8px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.access { display: grid; grid-template-columns: 1fr 130px; gap: 8px; align-items: center; margin-bottom: 8px; }
.access select { margin: 0; padding: 8px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); margin-left: 4px; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
