:root {
    color-scheme: dark;
    --bg: #070a0f;
    --panel: rgba(18, 23, 31, .88);
    --panel-strong: #121821;
    --line: rgba(255,255,255,.09);
    --line-strong: rgba(255,255,255,.16);
    --text: #f7f9fc;
    --muted: #96a3b3;
    --blue: #1379c7;
    --blue-bright: #39a9ff;
    --cyan: #5cc8ff;
    --green: #46d18c;
    --yellow: #f3b44b;
    --red: #ff6974;
    --radius: 22px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); }
button, input { font: inherit; }
a { color: inherit; }

.auth-page {
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 78% 12%, rgba(30, 102, 159, .32), transparent 31%),
        radial-gradient(circle at 12% 88%, rgba(38, 151, 214, .12), transparent 28%),
        #070a0f;
}
.auth-shell { width: min(500px, 100%); }
.auth-shell.wide-auth { width: min(660px, 100%); }
.brand-stripes { display: flex; gap: 7px; margin: 0 0 20px 6px; }
.brand-stripes i { display: block; width: 34px; height: 5px; transform: skewX(-25deg); }
.brand-stripes i:nth-child(1) { background: #0066b1; }
.brand-stripes i:nth-child(2) { background: #39a9e8; }
.brand-stripes i:nth-child(3) { background: #e62535; }
.brand-stripes.compact { margin: 0; gap: 4px; }
.brand-stripes.compact i { width: 18px; height: 3px; }
.auth-card {
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: rgba(16, 21, 29, .94);
    box-shadow: 0 35px 90px rgba(0,0,0,.5);
    backdrop-filter: blur(20px);
}
.eyebrow { color: var(--cyan); font-size: 11px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.auth-card h1 { margin: 8px 0 10px; font-size: clamp(38px, 8vw, 58px); font-weight: 450; letter-spacing: -.055em; }
.auth-card p { color: var(--muted); line-height: 1.65; }
.auth-form { display: grid; gap: 16px; margin-top: 26px; }
.auth-form label { display: grid; gap: 7px; color: #bdc6d1; font-size: 13px; }
.auth-form input {
    width: 100%; padding: 14px 15px; border: 1px solid var(--line-strong); border-radius: 12px;
    outline: none; background: #0a0e14; color: #fff;
}
.auth-form input:focus { border-color: var(--blue-bright); box-shadow: 0 0 0 3px rgba(57,169,255,.14); }
.primary-button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 47px; padding: 0 20px;
    border: 0; border-radius: 12px; background: linear-gradient(135deg, #0873c3, #159ce8); color: #fff;
    font-weight: 750; text-decoration: none; cursor: pointer; box-shadow: 0 12px 30px rgba(0,102,177,.25);
}
.primary-button:hover { filter: brightness(1.08); }
.link-button { margin: 18px 0 8px; }
.notice { padding: 13px 16px; border-radius: 13px; margin: 16px 0; font-size: 13px; line-height: 1.5; }
.good-box { background: rgba(70,209,140,.1); border: 1px solid rgba(70,209,140,.3); color: #a9f0cd; }
.error-box { background: rgba(255,105,116,.1); border: 1px solid rgba(255,105,116,.3); color: #ffc4c9; }
.warning-box { background: rgba(243,180,75,.09); border: 1px solid rgba(243,180,75,.3); color: #ffdf9f; }
.device-code-panel { margin-top: 26px; padding: 25px; border-radius: 18px; border: 1px solid var(--line); background: rgba(5,9,14,.72); text-align: center; }
.code-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; }
.device-code { margin: 13px 0 4px; font-size: clamp(34px, 8vw, 52px); font-weight: 800; letter-spacing: .12em; }
.poll-status { display: flex; align-items: center; justify-content: center; gap: 10px; color: #b8c3cf; font-size: 13px; }
.spinner { width: 14px; height: 14px; border: 2px solid #ffffff33; border-top-color: var(--blue-bright); border-radius: 50%; animation: spin .8s linear infinite; }
.error-text { color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }

.dashboard-page { overflow-x: hidden; background: linear-gradient(180deg, #080b10 0%, #090e15 55%, #06080c 100%); }
.ambient { position: fixed; z-index: -1; width: 520px; height: 520px; border-radius: 50%; filter: blur(100px); opacity: .15; pointer-events: none; }
.ambient-one { top: -260px; right: -140px; background: #1479c9; }
.ambient-two { bottom: 10%; left: -300px; background: #2c9ad6; opacity: .08; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
    min-height: 74px; padding: 0 max(22px, calc((100vw - 1400px)/2)); border-bottom: 1px solid var(--line);
    background: rgba(7,10,15,.78); backdrop-filter: blur(22px);
}
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-lockup > div:last-child { display: grid; gap: 2px; }
.brand-lockup strong { font-size: 14px; letter-spacing: .01em; }
.brand-lockup span { color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.sync-label { color: var(--muted); font-size: 12px; }
.ghost-button, .ghost-link {
    min-height: 37px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px;
    border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(255,255,255,.035); color: #dce4ed;
    text-decoration: none; font-size: 12px; cursor: pointer;
}
.ghost-button:hover, .ghost-link:hover { border-color: rgba(92,200,255,.45); background: rgba(92,200,255,.07); }
.ghost-button:disabled { opacity: .5; cursor: wait; }
.dashboard-shell { width: min(1400px, calc(100% - 44px)); margin: 28px auto 45px; }
.glass-card {
    border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(20,26,35,.92), rgba(12,16,22,.88));
    box-shadow: 0 20px 55px rgba(0,0,0,.18); backdrop-filter: blur(15px);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(330px, .8fr); gap: 18px; }
.vehicle-hero { min-height: 430px; position: relative; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.vehicle-hero::after { content:""; position:absolute; inset:auto -5% -40% 25%; height: 75%; background: radial-gradient(ellipse, rgba(38,123,181,.26), transparent 66%); }
.hero-copy { position: relative; z-index: 2; padding: 30px 32px 0; }
.hero-copy h1 { margin: 7px 0 13px; font-size: clamp(40px, 5.4vw, 74px); font-weight: 420; letter-spacing: -.065em; }
.hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; color: #aab6c3; font-size: 13px; }
.vehicle-image-wrap { position: relative; z-index: 1; min-height: 260px; display: flex; align-items: flex-end; justify-content: center; padding: 0 5% 10px; }
.vehicle-image-wrap img { display: block; width: min(100%, 860px); max-height: 295px; object-fit: contain; filter: drop-shadow(0 30px 25px rgba(0,0,0,.55)); }
.image-placeholder { align-self: center; color: var(--muted); font-size: 13px; }
.state-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.state-pill b { width: 7px; height: 7px; border-radius: 50%; background: #687486; }
.state-pill.good b { background: var(--green); box-shadow: 0 0 12px rgba(70,209,140,.6); }
.state-pill.warn b { background: var(--yellow); box-shadow: 0 0 12px rgba(243,180,75,.45); }
.battery-card { min-height: 430px; padding: 28px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #e8edf4; font-size: 14px; font-weight: 700; }
.card-title small { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
.battery-layout { min-height: 350px; display: grid; align-content: center; gap: 30px; }
.soc-ring {
    --soc: 0; width: 190px; aspect-ratio: 1; margin: 0 auto; display: grid; place-items: center; border-radius: 50%;
    background: conic-gradient(var(--blue-bright) calc(var(--soc) * 1%), rgba(255,255,255,.07) 0);
    box-shadow: 0 0 55px rgba(20,121,201,.14);
}
.soc-ring::before { content:""; width: 158px; aspect-ratio: 1; position: absolute; border-radius: 50%; background: #10161f; border: 1px solid var(--line); }
.soc-ring > div { position: relative; z-index: 1; display: flex; align-items: baseline; }
.soc-ring strong { font-size: 63px; line-height: 1; font-weight: 450; letter-spacing: -.07em; }
.soc-ring span { margin-left: 5px; color: var(--muted); font-size: 16px; }
.battery-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.battery-stats div { min-width: 0; padding: 13px 8px; text-align: center; border-top: 1px solid var(--line); }
.battery-stats span, .stat-row span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.battery-stats strong { font-size: 13px; font-weight: 650; }
.metric-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 18px; margin-top: 18px; }
.charging-card { padding: 26px 28px; overflow: hidden; position: relative; }
.charging-card.active-charge::before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background: var(--blue-bright); box-shadow: 0 0 22px var(--blue-bright); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #5b6572; }
.active-charge .live-dot { background: var(--blue-bright); box-shadow: 0 0 14px var(--blue-bright); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.charging-headline { min-height: 135px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.big-status { font-size: clamp(28px, 4vw, 46px); font-weight: 450; letter-spacing: -.045em; }
.subtle { margin-top: 7px; color: var(--muted); font-size: 12px; }
.power-value { display: flex; align-items: baseline; }
.power-value strong { font-size: clamp(42px, 6vw, 68px); font-weight: 430; letter-spacing: -.065em; }
.power-value span { margin-left: 7px; color: var(--muted); }
.stat-row { display: grid; border-top: 1px solid var(--line); }
.stat-row.four { grid-template-columns: repeat(4, 1fr); }
.stat-row > div { padding: 18px 16px 0 0; min-width: 0; }
.stat-row strong { font-size: 12px; line-height: 1.4; }
.compact-card { padding: 26px 28px; }
.info-list { margin: 20px 0 0; }
.info-list div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-top: 1px solid var(--line); }
.info-list dt { color: var(--muted); font-size: 12px; }
.info-list dd { margin: 0; text-align: right; font-size: 12px; word-break: break-all; }
.status-section { margin-top: 42px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 2px 16px; }
.section-heading h2 { margin: 5px 0 0; font-size: 29px; font-weight: 470; letter-spacing: -.035em; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.status-group { padding: 24px 26px; }
.status-list { margin-top: 15px; }
.status-list > div { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 13px 0; border-top: 1px solid var(--line); }
.status-list span { color: var(--muted); font-size: 12px; }
.status-text { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.status-text.good { color: var(--green); }
.status-text.warn { color: var(--yellow); }
.status-text.neutral { color: #8793a1; }
.tyre-history-grid { display: grid; grid-template-columns: .9fr 1.6fr; gap: 18px; margin-top: 18px; }
.tyre-card, .history-card { padding: 26px 28px; }
.tyre-layout { position: relative; min-height: 390px; display: grid; grid-template-columns: 1fr .72fr 1fr; grid-template-rows: 1fr 1fr; gap: 20px 22px; align-items: center; margin-top: 10px; }
.car-silhouette { grid-column: 2; grid-row: 1 / 3; display: grid; place-items: center; align-content: center; gap: 12px; color: #6f7b89; font-size: 9px; letter-spacing: .18em; }
.car-silhouette div { width: 90px; height: 250px; border: 1px solid rgba(255,255,255,.15); border-radius: 40% 40% 28% 28%; background: linear-gradient(180deg, rgba(47,111,158,.22), rgba(255,255,255,.025)); box-shadow: inset 0 0 45px rgba(0,0,0,.5); }
.tyre { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
.tyre-fl, .tyre-rl { text-align: right; }
.tyre span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.tyre strong { display: block; margin: 4px 0; font-size: 31px; font-weight: 470; letter-spacing: -.04em; }
.tyre small { color: #798695; font-size: 10px; }
.tyre.good { border-color: rgba(70,209,140,.22); }
.tyre.warn { border-color: rgba(243,180,75,.35); }
.tyre-fl { grid-column: 1; grid-row: 1; }
.tyre-fr { grid-column: 3; grid-row: 1; }
.tyre-rl { grid-column: 1; grid-row: 2; }
.tyre-rr { grid-column: 3; grid-row: 2; }
.history-list { margin-top: 14px; max-height: 420px; overflow: auto; padding-right: 5px; }
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { background: #35404d; border-radius: 10px; }
.history-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) 150px; gap: 16px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); }
.history-date { display: grid; }
.history-date strong { font-size: 14px; }
.history-date span { color: var(--muted); font-size: 10px; }
.history-main { min-width: 0; }
.history-main > div:first-child { display: flex; justify-content: space-between; gap: 15px; min-width: 0; }
.history-main strong { font-size: 12px; white-space: nowrap; }
.history-main span { overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.charge-progress { height: 3px; margin-top: 10px; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.07); }
.charge-progress i { display: block; height: 100%; min-width: 2px; background: linear-gradient(90deg, #0c76c4, #51c6ff); }
.history-numbers { text-align: right; }
.history-numbers strong { display: block; font-size: 12px; }
.history-numbers span { color: var(--muted); font-size: 10px; }
.empty-state { display: grid; place-items: center; min-height: 260px; color: var(--muted); font-size: 13px; text-align: center; }
.dashboard-footer { display: flex; justify-content: space-between; gap: 20px; margin: 30px 2px 0; color: #637080; font-size: 10px; }

@media (max-width: 1050px) {
    .hero-grid, .metric-grid, .tyre-history-grid { grid-template-columns: 1fr; }
    .battery-card { min-height: auto; }
    .battery-layout { min-height: auto; grid-template-columns: 220px 1fr; align-items: center; margin-top: 25px; }
    .battery-stats { grid-template-columns: 1fr; }
    .battery-stats div { text-align: left; }
    .status-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .topbar { padding: 0 16px; }
    .sync-label { display: none; }
    .dashboard-shell { width: min(100% - 24px, 1400px); margin-top: 14px; }
    .vehicle-hero { min-height: 365px; }
    .hero-copy { padding: 23px 22px 0; }
    .vehicle-image-wrap { min-height: 220px; padding-left: 0; padding-right: 0; }
    .battery-card, .charging-card, .compact-card, .status-group, .tyre-card, .history-card { padding: 21px; }
    .battery-layout { grid-template-columns: 1fr; }
    .battery-stats { grid-template-columns: repeat(3, 1fr); }
    .battery-stats div { text-align: center; }
    .charging-headline { align-items: flex-end; }
    .stat-row.four { grid-template-columns: 1fr 1fr; row-gap: 15px; }
    .status-grid { grid-template-columns: 1fr; }
    .section-heading { align-items: center; }
    .section-heading .state-pill { display: none; }
    .tyre-layout { grid-template-columns: 1fr 50px 1fr; gap: 10px; }
    .car-silhouette div { width: 45px; height: 220px; }
    .tyre { padding: 12px 8px; }
    .tyre strong { font-size: 24px; }
    .history-item { grid-template-columns: 45px minmax(0, 1fr); }
    .history-numbers { grid-column: 2; display: flex; justify-content: space-between; text-align: left; margin-top: -8px; }
    .dashboard-footer { display: grid; }
}

@media (max-width: 480px) {
    .brand-lockup span, .ghost-link { display: none; }
    .topbar-actions { gap: 7px; }
    .hero-meta { gap: 10px; }
    .battery-stats { grid-template-columns: 1fr; }
    .battery-stats div { text-align: left; }
    .charging-headline { display: grid; }
    .power-value strong { font-size: 54px; }
    .tyre-layout { min-height: 340px; }
    .tyre small { display: block; line-height: 1.4; }
    .auth-card { padding: 24px; }
}
