/* VagDiag Online – tmavý vzhľad ako appka: farbu nesú widgety, čisté plochy, jemné animácie. */
:root {
  --bg: #000;
  --surface: rgba(255, 255, 255, .045);
  --surface-hi: rgba(255, 255, 255, .08);
  --stroke: rgba(255, 255, 255, .09);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --dim: #5c5f66;
  --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a;
  --blue: #0a84ff; --cyan: #64d2ff; --teal: #40cbe0; --purple: #bf5af2; --indigo: #5e5ce6; --pink: #ff375f;
  --radius: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text); background: var(--bg);
  font: 16px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
body::before {
  content: ""; position: fixed; inset: -20vh -10vw auto; height: 70vh; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 60% at 20% 0%, rgba(10, 132, 255, .16), transparent 70%),
              radial-gradient(50% 50% at 85% 10%, rgba(191, 90, 242, .12), transparent 70%);
  filter: blur(20px);
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: #9be3ff; }
.mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; font-size: .86em; letter-spacing: .01em; }
.muted { color: var(--muted); }
.ok { color: var(--green); } .bad { color: var(--red); } .warn { color: var(--orange); }

/* Hlavička */
.top {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px;
  padding: 12px max(20px, calc((100vw - 1180px) / 2));
  background: rgba(0, 0, 0, .66); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--stroke);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: conic-gradient(from 210deg, var(--cyan), var(--blue), var(--purple), var(--pink), var(--orange), var(--cyan)); position: relative; }
.brand .logo::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #000; box-shadow: inset 0 0 0 2px rgba(255,255,255,.9); }
.nav { display: flex; gap: 2px; margin-left: auto; align-items: center; }
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .nav { margin: 0 -14px; padding: 0 10px; width: calc(100% + 28px); overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav button { white-space: nowrap; padding: 7px 12px; }
  main { padding: 18px 14px 60px; }
}
html, body { overflow-x: hidden; }
.nav a, .nav button {
  color: var(--muted); padding: 7px 14px; border-radius: 999px; font-size: 14px; background: none; border: 0;
  font: inherit; font-size: 14px; cursor: pointer; transition: color .2s, background .2s;
}
.nav a:hover, .nav button:hover { color: var(--text); }
.nav a.on { color: var(--text); background: var(--surface-hi); }
.nav .live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 0 0 rgba(48,209,88,.6); animation: pulse 1.8s infinite; vertical-align: 1px; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.08; letter-spacing: -.025em; margin: 6px 0 22px; font-weight: 700; }
h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 40px 0 14px; }
.eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* Karty a widgety */
.card {
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 20px;
  transition: transform .4s var(--ease), border-color .3s, background .3s;
}
a.card { display: block; color: inherit; }
a.card:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); }
.widget { position: relative; overflow: hidden; }
.widget::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, var(--tint, transparent) 0%, transparent 55%); opacity: .16; pointer-events: none; }
.widget .label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tint, var(--muted)); }
.widget .big { font-size: 42px; font-weight: 600; letter-spacing: -.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.widget .sub { color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
@media (max-width: 520px) { .g2, .g3 { grid-template-columns: 1fr; } }

/* Auto v hlavnej úlohe */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 10px; align-items: center; padding: 26px 30px; }
.hero .car { width: 100%; aspect-ratio: 2.1 / 1; display: grid; place-items: center; }
.hero .car canvas, .hero .car img { width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .55)); }
.hero h1 { margin: 6px 0 6px; }
.hero .meta { color: var(--muted); }
.hero .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding: 20px; } }
.car-thumb { width: 100%; aspect-ratio: 2.2 / 1; display: grid; place-items: center; margin: -4px 0 8px; }
.car-thumb canvas, .car-thumb img { width: 92%; height: auto; filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .5)); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px; background: var(--surface-hi); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.ok { color: var(--green); background: rgba(48, 209, 88, .12); }
.pill.bad { color: var(--red); background: rgba(255, 69, 58, .12); }
.pill.warn { color: var(--orange); background: rgba(255, 159, 10, .12); }
.pill.info { color: var(--cyan); background: rgba(100, 210, 255, .12); }
.pill.plain::before { display: none; }

/* Zoznamy */
.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 14px; }
.row .grow { flex: 1; min-width: 0; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item img.ecu { width: 46px; height: 46px; object-fit: contain; }
.chev { color: var(--dim); font-size: 20px; }

/* Jednotky skenu */
.modules { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.module { display: flex; gap: 14px; align-items: flex-start; }
.module img { width: 54px; height: 54px; object-fit: contain; flex: none; }
.module .addr { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: 13px; }
.dtc { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 10px 0 0; margin-top: 10px; border-top: 1px solid var(--stroke); }
.dtc .c { font-family: ui-monospace, Menlo, monospace; font-weight: 600; }
.dtc .c.active { color: var(--red); } .dtc .c.stored { color: var(--orange); }

/* Formuláre */
input[type=text], input[type=password], input[type=search], input[type=email] {
  width: 100%; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, .06);
  color: var(--text); font: inherit; outline: none; transition: border-color .2s, background .2s;
}
input:focus { border-color: rgba(100, 210, 255, .6); background: rgba(255, 255, 255, .09); }
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: 999px; border: 0;
  background: var(--text); color: #000; font: inherit; font-weight: 600; cursor: pointer; transition: transform .2s var(--ease), opacity .2s, background .2s;
}
.btn:hover { transform: scale(1.03); color: #000; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface-hi); color: var(--text); }
.btn.danger { background: rgba(255, 69, 58, .14); color: var(--red); }
.btn[disabled] { opacity: .4; pointer-events: none; }
pre.log {
  margin: 0; background: #06070a; border: 1px solid var(--stroke); border-radius: 16px; padding: 16px; overflow: auto; max-height: 72vh;
  font: 12px/1.55 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; word-break: break-all; color: #d6d6d9;
}
.empty { color: var(--muted); text-align: center; padding: 34px; }

/* Prihlásenie s 3D autom */
.stage { position: fixed; inset: 0; z-index: 0; }
.stage canvas { display: block; }
.auth { position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: end center; padding: 0 20px 7vh; }
@media (max-width: 700px) { .auth .glass { padding: 22px; gap: 10px; } .auth h1 { font-size: 28px; } }
.auth .glass {
  width: min(400px, 100%); padding: 28px; border-radius: 28px; display: grid; gap: 12px;
  background: rgba(20, 20, 24, .55); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: saturate(180%) blur(28px); -webkit-backdrop-filter: saturate(180%) blur(28px);
  box-shadow: 0 40px 80px rgba(0, 0, 0, .6);
}
.auth h1 { font-size: 34px; margin: 0; text-align: center; }
.auth .tag { text-align: center; color: var(--muted); margin: -4px 0 8px; }
.auth .btn { width: 100%; padding: 14px; }
.headline { position: fixed; top: max(5vh, 28px); left: 0; right: 0; z-index: 1; text-align: center; pointer-events: none; }
.headline .t { font-size: clamp(40px, 7vw, 84px); font-weight: 700; letter-spacing: -.035em; line-height: 1;
  background: linear-gradient(180deg, #fff 30%, rgba(255,255,255,.55)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.headline .s { color: var(--muted); font-size: clamp(16px, 2vw, 21px); margin-top: 12px; }

/* Naživo */
.live-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.gauges { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 520px) { .gauges { grid-template-columns: 1fr 1fr; gap: 10px; } .gauge svg { width: 110px; height: 110px; } .gauge .v { font-size: 24px; margin-top: -70px; } .gauge .u { margin-bottom: 36px; } }
.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.6); }
.gauge { display: grid; place-items: center; text-align: center; padding: 18px 10px; }
.gauge svg { width: 132px; height: 132px; }
.gauge .v { font-size: 30px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: -84px; }
.gauge .u { color: var(--muted); font-size: 13px; margin-bottom: 44px; }
.gauge .n { font-size: 13px; color: var(--muted); }
.values { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.values .card { padding: 14px 16px; }
.values .k { color: var(--muted); font-size: 13px; }
.values .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
#map { height: 380px; border-radius: var(--radius); border: 1px solid var(--stroke); overflow: hidden; background: #0d0e11; }
.commands { display: flex; gap: 8px; flex-wrap: wrap; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 99; max-width: 380px; padding: 14px 18px; border-radius: 16px;
  background: rgba(30, 30, 34, .9); border: 1px solid var(--stroke); backdrop-filter: blur(20px); white-space: pre-line;
  transform: translateY(20px); opacity: 0; transition: all .4s var(--ease); }
.toast.show { transform: none; opacity: 1; }
.marker-pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(10,132,255,.6); animation: pulse 1.8s infinite; }

/* Animácie */
.reveal { opacity: 0; transform: translateY(16px); animation: rise .8s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, .55); } 70% { box-shadow: 0 0 0 10px rgba(48, 209, 88, 0); } 100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); } }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; opacity: 1; transform: none; } * { transition: none !important; } }

/* Prstenec ako v appke */
.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .c b { font-size: 30px; letter-spacing: -.02em; }
.ring .c span { color: var(--muted); font-size: 12px; }
.ring circle.track { stroke: rgba(255, 255, 255, .08); }
.ring circle.seg { transition: stroke-dashoffset 1.2s var(--ease); }

table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 11px 6px; border-bottom: 1px solid var(--stroke); text-align: left; vertical-align: top; }
table.t th { color: var(--muted); font-weight: 500; font-size: 14px; width: 34%; }
table.t tr:last-child td, table.t tr:last-child th { border-bottom: 0; }
.leaflet-container { background: #0d0e11 !important; font: inherit !important; }
.leaflet-control-attribution { background: rgba(0,0,0,.5) !important; color: #888 !important; }
.leaflet-control-attribution a { color: #aaa !important; }
.leaflet-bar a { background: rgba(28, 29, 33, .92) !important; color: var(--text) !important; border-color: var(--stroke) !important; }
.leaflet-bar { border: 1px solid var(--stroke) !important; box-shadow: none !important; border-radius: 12px !important; overflow: hidden; }
