:root {
  color-scheme: dark;
  --u: min(1vh, .47vw);
  --bg: #080809; --panel: #191a1d; --panel2: #25262b;
  --muted: #a3a6ae; --text: #f4f4f5; --red: #ff092b;
  --green: #00e0a1; --line: #38393f;
  font-family: Arial, Helvetica, sans-serif;
}
@supports (height: 100dvh) { :root { --u: min(1dvh, .47vw); } }
* { box-sizing: border-box; }
html, body { width:100%; height:100%; margin:0; overflow:hidden; background:var(--bg); color:var(--text); }
button, input, select { font:inherit; }
button { cursor:pointer; }
button:disabled { cursor:not-allowed; }
button:focus-visible { outline:2px solid #fff; outline-offset:3px; }
[hidden] { display:none!important; }
.sr-only, .hidden-select { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.hidden-select { opacity:0!important; pointer-events:none!important; }

/* The cropped instrument fills the screen. No decorative outer dashboard. */
.app-shell { position:fixed; inset:0; width:100%; height:100%; margin:0; padding:0; overflow:hidden; }
.meter-card { position:absolute; inset:0; margin:0; padding:0; background:#0b0b0c; }
.meter-face {
  position:relative; display:grid; grid-template-columns:17.5% minmax(0,1fr); grid-template-rows:minmax(0,1fr); min-height:0; gap:1.3vw;
  width:100%; height:100%; padding:0;
  border:0; border-radius:0; overflow:hidden;
  background:linear-gradient(180deg,#292a2c 0,#1a1b1d 14%,#101113 73%,#08090a 100%);
  box-shadow:none;
}
.keypad { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(4,minmax(0,1fr)); align-items:center; justify-items:center; gap:0 .4vw; min-width:0; min-height:0; height:100%; padding:0; }
.meter-key {
  width:calc(15 * var(--u)); height:calc(15 * var(--u)); min-width:0; min-height:0;
  padding:0; border:calc(.4 * var(--u)) solid #3c070d; border-radius:50%; touch-action:manipulation;
  box-shadow:inset 0 calc(.5 * var(--u)) calc(.5 * var(--u)) #ffccd477,inset 0 calc(-.6 * var(--u)) calc(.8 * var(--u)) #74000a,0 calc(.4 * var(--u)) calc(.7 * var(--u)) #000;
}
.red-key { background:radial-gradient(circle at 44% 34%,#ff1530 0,#fa001f 57%,#c00017 79%,#76000d 100%); }
.black-key { width:calc(13.5 * var(--u)); height:calc(13.5 * var(--u)); border-color:#08090b; background:radial-gradient(circle at 43% 30%,#272b30 0,#101318 59%,#050608 100%); box-shadow:inset 0 1px 2px #a0adbc44,inset 0 calc(-.4 * var(--u)) calc(.8 * var(--u)) #000,0 1px 3px #000; }
.grey-key { width:calc(16 * var(--u)); height:calc(16 * var(--u)); border-color:#282a2d; background:radial-gradient(circle at 35% 25%,#56595d 0,#303337 57%,#111316 100%); box-shadow:inset 0 2px 3px #ffffff35,inset 0 calc(-.5 * var(--u)) calc(.9 * var(--u)) #000,0 2px 4px #000; }
.meter-key:disabled { opacity:.64; }
.meter-key:active:not(:disabled) { transform:translateY(1px); filter:brightness(.86); }
.key-start { grid-area:1/1; } .key-stop { grid-area:1/2; }
.key-tariff { grid-area:2/1; } .key-settings { grid-area:2/2; }
.key-start,.key-tariff{justify-self:start;margin-left:calc(.6 * var(--u))}
.key-stop,.key-settings{justify-self:end;margin-right:calc(.6 * var(--u))}
.key-distance { grid-area:3/1; } .key-wait { grid-area:3/2; } .key-gps { grid-area:4/1; }
.key-gps.gps-active { outline:2px solid #00c88c; outline-offset:-4px; }
.key-gps.gps-uncertain { outline-color:#ffc928; }

.meter-reading {
  position:relative; min-width:0; min-height:0; height:100%; display:grid;
  grid-template-rows:minmax(0,14fr) minmax(0,49fr) minmax(0,29fr) minmax(0,4fr); gap:calc(.65 * var(--u));
  padding:0; border:0; border-radius:0;
  background:linear-gradient(180deg,#191a1b 0,#09090a 22%,#040405 100%);
}
.meter-labels { display:grid; grid-template-columns:74% 26%; align-items:center; min-width:0; padding:0 1vw; border-bottom:1px solid #62666b66; background:linear-gradient(#252527,#101113); border-radius:calc(1.2 * var(--u)); box-shadow:inset 0 1px #ffffff22; color:#f2f2f3; font-weight:800; letter-spacing:.015em; }
.meter-labels span:first-child { text-align:center; font-size:calc(10.3 * var(--u)); }
.meter-labels span:last-child { text-align:center; font-size:calc(7.5 * var(--u)); }
.meter-display { position:relative; display:grid; grid-template-columns:74% 26%; align-items:start; min-width:0; min-height:0; overflow:hidden; padding:calc(6 * var(--u)) 1.4vw 0; border-bottom:1px solid #64676c88; border-radius:0 0 calc(2.5 * var(--u)) calc(2.5 * var(--u)); background:radial-gradient(ellipse at 63% 45%,#280209 0,#110105 38%,#050304 85%); box-shadow:inset 0 -2px 3px #aeb8bf2b,inset 0 0 14px #000; }
.fare-zone { position:relative; min-width:0; padding:0 4.5% 0 2%; }
.led-output { display:flex; align-items:center; justify-content:flex-end; min-width:0; height:.84em; white-space:nowrap; transform:translateZ(0); backface-visibility:hidden; }
.fare, .fare-ghost { width:100%; font-size:calc(40 * var(--u)); line-height:1; }
.fare { position:relative; z-index:1; }
.fare-ghost { position:absolute; inset:0 4.5% auto 2%; width:auto; opacity:.025; }
.led-vector { display:block; flex:0 1 auto; height:100%; width:auto; max-width:100%; overflow:visible; transform:skewX(-6deg); transform-origin:center; }
.led-vector polygon { fill:#27050d; fill-opacity:.75; }
.fare .led-vector polygon:not(.is-on),.tariff-readout .led-vector polygon:not(.is-on){fill:#18050a;fill-opacity:.025;stroke:none}
.led-vector .is-on { fill:#fff3f2; fill-opacity:1; stroke:#ff3853; stroke-width:.3; }
.fare .led-vector, .tariff-readout .led-vector { filter:drop-shadow(0 0 calc(.22 * var(--u)) #ff4160) drop-shadow(0 0 calc(.65 * var(--u)) #ff002d) drop-shadow(0 0 calc(1.5 * var(--u)) #d90020); }
.fare-ghost .led-vector .is-on { fill:#5c091b; stroke:none; }
.tariff-readout { display:flex; justify-content:center; align-items:flex-start; min-width:0; font-size:calc(26 * var(--u)); line-height:1; }
.tariff-readout .led-output { justify-content:center; max-width:85%; }
.occupancy-status { position:absolute; top:calc(10.5 * var(--u)); left:71%; width:10%; text-align:center; color:#452408; font-family:'Arial Narrow','Roboto Condensed',Arial,sans-serif; font-size:calc(3.5 * var(--u)); font-stretch:condensed; font-weight:800; letter-spacing:-.055em; transform:scaleX(.82); transform-origin:center; }
.occupancy-status.active { color:#ffe345; text-shadow:0 0 calc(.35 * var(--u)) #ffb000,0 0 calc(1.2 * var(--u)) #ff7b00,0 0 calc(2 * var(--u)) #f45b00; }
.currency { position:absolute; left:73%; top:calc(39.6 * var(--u)); transform:translateY(-100%); width:6%; text-align:center; color:#fff6f5; font-size:calc(7.2 * var(--u)); line-height:1; font-weight:800; text-shadow:0 0 calc(.3 * var(--u)) #ff3550,0 0 calc(.85 * var(--u)) #ff002d,0 0 calc(1.5 * var(--u)) #d90020; }
.meter-secondary { display:grid; grid-template-rows:minmax(0,1fr) auto; align-items:center; justify-items:center; min-height:0; margin:0 5% 0 15%; border:1px solid #2e2328; border-top-color:#77767a55; border-bottom-color:#b2b1b04d; border-radius:calc(1 * var(--u)); background:linear-gradient(160deg,#11080b,#050405); box-shadow:inset 0 3px 6px #000; }
.inactive-digits { justify-content:center; font-size:calc(20 * var(--u)); opacity:.72; }
.inactive-digits .led-vector .is-on { fill:#57202c; stroke:none; }
.secondary-label { width:100%; padding:calc(.55 * var(--u)) 0; color:#f1f1f2; background:linear-gradient(#151516,#080809); border-top:1px solid #5b5d6155; text-align:center; font-size:calc(4.8 * var(--u)); line-height:1; font-weight:800; letter-spacing:.025em; }
.meter-disclaimer { display:flex; align-items:center; justify-content:flex-end; padding-right:1vw; color:#aeb0b4; font-size:calc(2.2 * var(--u)); font-weight:700; letter-spacing:.1em; }
.last-trip { display:none!important; }
#notice.is-visible { clip:auto!important; width:auto!important; height:auto!important; max-height:25%; left:21%; right:2%; bottom:1.5%; z-index:10; margin:0!important; padding:6px 10px!important; white-space:normal!important; overflow:auto!important; border:1px solid var(--line)!important; border-radius:8px; background:#181a1ff2; color:var(--text); font-size:12px; line-height:1.3; pointer-events:none; }

/* Existing tariff editor: same controls and cancellation behavior. */
dialog { width:min(calc(100% - 24px),480px); max-height:94vh; max-height:94dvh; overflow:auto; padding:20px; border:1px solid var(--line); border-radius:20px; background:#181a1f; color:var(--text); box-shadow:0 25px 80px #000b; }
dialog::backdrop { background:#000b; backdrop-filter:blur(4px); }
.dialog-heading { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.eyebrow { color:var(--red); font-size:10px; font-weight:800; letter-spacing:.18em; }
.dialog-heading h1 { margin:6px 0 0; font-size:23px; }
.icon-button { flex:none; width:42px; height:42px; border:1px solid var(--line); border-radius:13px; background:var(--panel); color:var(--text); font-size:25px; }
.muted { color:var(--muted); font-size:13px; line-height:1.5; }
.driver-label { display:grid; gap:7px; margin:12px 0; color:var(--muted); font-size:12px; }
.driver-label input { min-width:0; padding:11px 12px; border:1px solid var(--line); border-radius:10px; background:#111216; color:var(--text); font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.tariff-editor { display:grid; gap:12px; margin:18px 0; }
.tariff-item { padding:14px; border:1px solid var(--line); border-radius:14px; background:#22242a; }
.tariff-item-head { display:flex; justify-content:space-between; align-items:center; gap:9px; margin-bottom:12px; }
.tariff-item-head strong { font-size:14px; } .tariff-item-head span { color:var(--muted); font-size:10px; }
.tariff-fields { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.tariff-fields label { display:grid; gap:6px; color:var(--muted); font-size:11px; }
.tariff-item input { width:100%; min-width:0; padding:10px 11px; border:1px solid #393b42; border-radius:9px; background:#111216; color:var(--text); }
.rates-confirmation { display:flex; align-items:flex-start; gap:9px; margin:12px 0; color:var(--muted); font-size:12px; line-height:1.4; }
.rates-confirmation input { flex:none; width:18px; height:18px; margin:0; accent-color:var(--green); }
.settings-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.secondary-button, .primary-button, .import-button { min-height:44px; padding:10px 14px; border:1px solid var(--line); border-radius:12px; background:var(--panel2); color:var(--text); font-size:12px; font-weight:700; cursor:pointer; }
.settings-actions>* { display:grid; place-items:center; text-align:center; }
.primary-button { background:var(--red); border-color:var(--red); color:#fff; font-size:16px; min-height:50px; }
.dialog-actions { margin-top:14px; } .dialog-actions .primary-button { width:100%; }
.pwa-actions { display:flex; align-items:center; gap:7px; margin-top:12px; }
.pwa-action { min-height:36px; padding:0 10px; border:1px solid var(--line); border-radius:10px; background:var(--panel2); color:var(--text); font-size:10px; font-weight:800; }
.legal-note { margin:13px 0 0; color:#8f929b; font-size:10px; line-height:1.45; }
@media (orientation:portrait) {
  .meter-face { grid-template-columns:27% minmax(0,1fr); gap:1vw; }
  .meter-key { width:clamp(42px,11vw,62px); height:clamp(42px,11vw,62px); }
  .grey-key { width:clamp(46px,13vw,68px); height:clamp(46px,13vw,68px); }
  .black-key { width:clamp(42px,10.5vw,58px); height:clamp(42px,10.5vw,58px); }
  .occupancy-status { font-size:calc(3.2 * var(--u)); }
  .meter-secondary { margin-left:3%; margin-right:3%; }
}

.occupancy-status.free{color:#64ff7d;text-shadow:0 0 calc(.4 * var(--u)) #00cd45,0 0 calc(1.1 * var(--u)) #009c31}.occupancy-status.finished{color:#ab7b36;text-shadow:none}
.currency{height:calc(7.2 * var(--u))}.currency svg{display:block;width:100%;height:100%;overflow:visible;fill:#fff6f5;filter:drop-shadow(0 0 calc(.3 * var(--u)) #ff3550) drop-shadow(0 0 calc(.85 * var(--u)) #ff002d)}

/* Fail closed without collapsing or moving the accepted meter layout. */
body.server-locked .fare, body.server-locked .fare-ghost,
body.server-locked .currency, body.server-locked .inactive-digits,
body.server-locked .last-trip { visibility: hidden; }
#deviceIdentity { overflow-wrap: anywhere; }
