:root {
    color-scheme: light;
    --ink: #18212a;
    --muted: #53606d;
    --line: #dce1e5;
    --accent: #bd1725;
    font: 16px/1.5 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: #f3f5f6;
}
* { box-sizing: border-box }
body { margin: 0 }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px max(calc((100vw - 1200px) / 2), 5vw);
    min-height: 74px; border-bottom: 1px solid var(--line); background: white;
}
.brand { display: flex; align-items: center; gap: 20px }
.brand img { object-fit: cover; width: 172px; height: 44px }
.brand span { padding-left: 20px; border-left: 1px solid #cbd1d7; color: var(--muted); font-weight: 600 }
main { width: min(1200px, 90vw); margin: clamp(24px, 6vh, 68px) auto }
.entry-grid { display: grid; grid-template-columns: 1.05fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 15px 48px #13233412 }
.hero {
    display: flex; align-items: flex-end; color: white; min-height: clamp(520px, 67vh, 690px); padding: clamp(26px,4vw,60px);
    background: linear-gradient(0deg,#061016f5 0%,#09131c88 30%,transparent 60%),#121d24 url("steuergeraet.jpg") center 36% / cover no-repeat;
}
.hero h2 { font-size: clamp(32px,3.8vw,60px); line-height: 1.04; letter-spacing: -.05em; max-width: 10em }
.hero h2 span { display: block }
.hero p { max-width: 36ch; color: #e6eaed; margin: 16px 0 0 }
.auth-panel { display: grid; min-width: 0; align-items: center; padding: clamp(28px,5vw,82px) }
.login { width: 100%; max-width: 410px; margin: 0 auto }
h1,h2,p { margin: 0 }
h1,h2 { text-wrap: balance; overflow-wrap: anywhere }
h1 { font-size: clamp(29px,3vw,44px); letter-spacing: -.045em; line-height: 1.15 }
h2 { font-size: 24px; letter-spacing: -.03em }
p { color: var(--muted) }
.intro { margin: 9px 0 26px }
form { margin: 0 }
label { display: block; font-size: .92rem; font-weight: 650; margin: 16px 0 }
input {
    display: block; width: 100%; min-width: 0; font: inherit; margin-top: 6px; border: 1px solid #aeb8c2;
    border-radius: 7px; color: var(--ink); background: white; min-height: 46px; padding: 9px 12px;
}
input:hover { border-color: #617282 }
input:focus { border-color: #253f50 }
:focus-visible { outline: 3px solid #007283; outline-offset: 3px }
button {
    border: 1px solid transparent; border-radius: 7px; font: inherit; font-weight: 650; cursor: pointer;
    min-height: 44px; padding: 10px 18px; color: white; background: #1b2b35; overflow-wrap: anywhere;
}
button:hover { background: #324653 }
.login button { width: 100%; background: var(--accent) }
.login button:hover { background: #9c1521 }
.secondary, .login button.secondary, .topbar button, .files button {
    background: white; color: var(--ink); border-color: var(--line);
}
.secondary:hover, .files button:hover, .topbar button:hover { background: #f2f5f6; border-color: #9aa8b2 }
.first-login { margin: 18px 0; padding: 10px 14px; border-left: 3px solid #aebbc4; background: #f4f6f7; font-size: .86rem }
.first-login strong { display: block; margin-bottom: 2px }
details { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px }
summary { color: #354754; cursor: pointer; font-size: .92rem; font-weight: 600 }
.notice, .error { border-radius: 8px; padding: 13px 18px; margin-bottom: 16px; border: 1px solid #9abbb3; background: #f0faf6; color: #244b3d }
.error { border-color: #d6a5a9; background: #fff3f4; color: #751722 }
.workspace-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; margin-bottom: 28px }
.workspace-head p { margin-top: 6px }
.account-email { font-size: .92rem; overflow-wrap: anywhere; color: var(--muted) }
.workspace section { margin: 0 0 18px; padding: clamp(18px,2.7vw,34px); border: 1px solid var(--line); border-radius: 12px; background: white }
.ecu-meta { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .88rem; font-weight: 650 }
.expiry { color: #4c5c65; font-variant-numeric: tabular-nums; font-weight: 500 }
.device-id { margin-top: 6px; overflow-wrap: anywhere }
.device-customer { margin: 0; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,190px),1fr)); gap: 12px 20px }
.device-customer dt { color: var(--muted); font-size: .82rem }
.device-customer dd { margin: 2px 0 0; overflow-wrap: anywhere }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 }
.upload { border-top: 1px solid var(--line); padding-top: 16px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap }
.upload label { flex: 1 1 280px; min-width: 0; margin: 0 }
.file-drop { border: 2px dashed #91a1ac; border-radius: 8px; padding: 14px; cursor: pointer }
.file-drop small { display: block; color: var(--muted); font-weight: 400 }
.file-drop.dragover, .file-drop:focus-within { border-color: #007283; background: #ecf8fa }
.file-drop [role=status] { overflow-wrap: anywhere }
.delete-record button { margin-top: 10px; background: var(--accent) }
input[type=file] { font-weight: 400; padding: 6px; border-style: dashed; background: #f8fafb }
input::file-selector-button { padding: .5em .9em; margin-right: 10px; border: 0; border-radius: 4px; background: #e4e9ec; color: var(--ink); cursor: pointer }
@media (max-width: 760px) {
    main { width: min(94vw,540px); margin: 18px auto }
    .entry-grid { grid-template-columns: minmax(0,1fr) }
    .hero { min-height: 154px; padding: 20px 26px; background-position: center 30% }
    .hero h2 { font-size: 27px; max-width: none }
    .hero h2 span { display: inline }
    .hero p { display: none }
    .auth-panel { padding: 24px }
    .topbar { min-height: 62px; padding: 8px 4vw }
    .brand { gap: 8px }
    .brand img { width: 125px; height: 36px }
    .brand span { padding-left: 8px; font-size: .85rem }
    .upload button { width: 100% }
}
@media (max-width: 380px) { .topbar button { padding: 7px 10px } .auth-panel { padding: 18px } }
.signed-in { --bar: 72px; background: #f4f6f8 }
.signed-in .topbar { position: sticky; z-index: 3; top: 0; height: var(--bar); min-height: 0; padding: 0 28px }
.signed-in .brand img { width: 152px; object-fit: contain }
.portal-shell { display: grid; grid-template-columns: clamp(252px,20vw,308px) minmax(0,1fr); min-height: calc(100vh - var(--bar)) }
.side { min-width: 0; background: #192630; color: #f4f6f8 }
.side nav { display: flex; flex-direction: column; position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); height: calc(100dvh - var(--bar)); padding: 22px 14px 14px; overflow: auto }
.side a,.side button { text-decoration: none; color: inherit; text-align: left; border: 0; border-radius: 7px; background: transparent }
.side .nav-item { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 13px; padding: 8px 13px; font-size: .91rem; font-weight: 600 }
.nav-item::before { width: 17px; height: 17px; flex: none; content: ""; color: #c1ced7; box-sizing: border-box }
.fleet::before { background: linear-gradient(currentColor 0 0) 0 0 / 7px 7px, linear-gradient(currentColor 0 0) 100% 0 / 7px 7px, linear-gradient(currentColor 0 0) 0 100% / 7px 7px, linear-gradient(currentColor 0 0) 100% 100% / 7px 7px; background-repeat: no-repeat }
.info::before { border: 1.5px solid; border-radius: 50%; background: linear-gradient(currentColor 0 0) center 3px / 2px 2px, linear-gradient(currentColor 0 0) center 7px / 2px 5px; background-repeat: no-repeat }
.password::before { border-radius: 2px; background: linear-gradient(currentColor 0 0) center bottom / 15px 10px, radial-gradient(ellipse at 50% 72%, transparent 42%,currentColor 45% 64%,transparent 67%) center top / 12px 10px; background-repeat: no-repeat }
.logout::before { border-left: 1.5px solid; background: linear-gradient(currentColor 0 0) center / 12px 1.5px,linear-gradient(45deg,transparent 42%,currentColor 45% 57%,transparent 60%) right 2px top 3px / 6px 6px,linear-gradient(-45deg,transparent 42%,currentColor 45% 57%,transparent 60%) right 2px bottom 3px / 6px 6px; background-repeat: no-repeat }
.side a:hover,.side .nav-item:hover { background-color: #293a46 }
.side [aria-current="page"] { background-color: #324451; box-shadow: inset 3px 0 #ff5968 }
.side :focus-visible { outline-color: #92d8ee; outline-offset: -2px }
.nav-heading { margin: 27px 12px 10px; color: #b4c3ce; font-size: .7rem; font-weight: 650; letter-spacing: .085em; text-transform: uppercase }
.side-vehicles { flex: 1 1 auto; min-height: 40px; overflow-y: auto; scrollbar-color: #526371 transparent }
.side-empty { padding: 0 12px; color: #c4cfd6; font-size: .86rem }
.side-vehicle { display: grid; gap: 2px; padding: 11px 13px; margin-bottom: 4px; overflow-wrap: anywhere }
.side-vehicle strong { font-size: .91rem; line-height: 1.35 }
.side-vehicle span,.side-vehicle small { font-size: .78rem; color: #bfced9; font-variant-numeric: tabular-nums }
.side-vehicle small { font-size: .72rem }
.account-links { flex: none; border-top: 1px solid #394955; padding-top: 10px; margin-top: 16px }
.menu-toggle { display: none }
.portal-shell main { width: min(100%,1170px); min-width: 0; margin: 0 auto; padding: clamp(24px,4vw,62px) clamp(18px,4vw,64px) 50px }
.workspace section[id^="ecu-"] { scroll-margin-top: calc(var(--bar) + 12px) }
.workspace h3 { margin: 24px 0 10px; font-size: 1.08rem }
.workspace h4 { margin: 4px 0 8px; color: var(--muted) }
.protocol-groups { display: grid; grid-template-columns: 2fr 1fr; gap: 18px }
.protocol-groups ul { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,205px),1fr)); gap: 4px; list-style: none; padding: 0; margin: 0 }
.protocol-groups li { border-radius: 4px; padding: 6px 9px; background: #f2f5f7; font-size: .84rem }
.workspace #vehicle-list { padding: 4px clamp(16px,2.4vw,30px) }
#vehicle-list > p { padding: 24px 0 }
.vehicle-link { display: grid; gap: 4px; padding: 14px 0; color: var(--ink); text-decoration: none; overflow-wrap: anywhere }
.vehicle-link + .vehicle-link { border-top: 1px solid var(--line) }
.vehicle-link span { color: var(--muted); font-size: .88rem }
.vehicle-link:hover strong,.workspace-head a { color: #00677a }
.password-form { max-width: 410px }
.ecu-detail .ecu-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap }
.ecu-detail .ecu-detail-head h2 { margin: 7px 0 0; font-size: clamp(1.42rem,2.2vw,1.8rem); line-height: 1.2; letter-spacing: -.025em }
.ecu-detail .ecu-detail-head h2 span { color: #8d99a2; font-weight: 400 }
.ecu-type { color: #334956; font-size: .78rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase }
.ecu-detail .expiry { padding-top: 2px; font-size: .83rem; white-space: nowrap }
.detail-head-side { display: grid; justify-items: end; gap: 9px }
.vehicle-delete { position: relative; margin: 0 }
.vehicle-delete summary { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border: 1px solid #cdd9de; border-radius: 7px; background: white; color: #1d4250; font-size: .83rem; font-weight: 650; cursor: pointer; list-style: none }
.vehicle-delete summary::-webkit-details-marker { display: none }
.vehicle-delete summary:hover { border-color: #7e9faa; background: #f3f8f9 }
.vehicle-delete .delete-popover { top: calc(100% + 7px); width: min(270px,85vw) }
.ecu-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 24px; padding: 20px 0 23px; margin-top: 20px; border-top: 1px solid var(--line) }
.ecu-facts div { min-width: 0; display: grid; gap: 3px }
.ecu-facts span { color: var(--muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .035em }
.ecu-facts strong { font-size: .95rem; font-weight: 600; overflow-wrap: anywhere }
.detail-block { padding: 24px 0 0; border-top: 1px solid var(--line) }
.detail-block + .detail-block { margin-top: 26px }
.detail-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 18px; margin-bottom: 15px }
.detail-block-head h3 { margin: 0; font-size: 1.05rem }
.version-count { color: var(--muted); font-size: .82rem; white-space: nowrap }
.asset-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px 16px; padding: 15px 16px; border: 1px solid #dce5e9; border-radius: 10px; background: #fcfdfd }
.asset-row + .asset-row { margin-top: 9px }
.asset-symbol { display: grid; place-items: center; width: 42px; height: 46px; border: 1px solid #b8d5dc; border-radius: 7px; color: #135c69; background: #edf7f9; font-size: .72rem; font-weight: 800; letter-spacing: .03em }
.asset-symbol.virtual { color: #465e81; border-color: #c6d3e4; background: #f0f4fb }
.asset-symbol.tuning { color: #546a45; border-color: #d3ddc8; background: #f3f7ef }
.asset-info { min-width: 0; display: grid; align-content: center; gap: 2px; font-size: .88rem }
.asset-info strong { font-size: .91rem; font-weight: 680 }
.asset-info span { color: var(--muted) }
.asset-info .asset-filename { overflow-wrap: anywhere; color: #233642 }
.series-status { display: inline-flex; align-items: center; gap: 6px; width: fit-content; margin-top: 4px; color: #66747d !important; font-size: .79rem }
.series-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #a4afb6 }
.series-status.approved { color: #167052 !important }
.series-status.approved::before { background: #20a26f }
.asset-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px 12px; flex-wrap: wrap }
.asset-actions form { margin: 0 }
.asset-actions .action-outline { min-height: 36px; padding: 6px 12px; border-color: #cdd9de; background: white; color: #1d4250; font-size: .83rem }
.asset-actions .action-outline:hover { border-color: #7e9faa; background: #f3f8f9 }
.asset-actions .action-link { min-height: 36px; padding: 6px 4px; background: transparent; color: #00677a; font-size: .82rem }
.asset-actions .action-link:hover { background: transparent; color: #004d5c; text-decoration: underline }
.asset-empty { padding: 17px 18px; border: 1px dashed #d1dce1; border-radius: 9px; background: #f9fbfc; font-size: .88rem }
.version-delete { position: relative; border: 0; padding: 0; margin: 0 }
.version-delete summary { display: flex; align-items: center; min-height: 36px; padding: 6px 4px; color: #79565a; font-size: .82rem; list-style: none }
.version-delete summary::-webkit-details-marker { display: none }
.version-delete summary:hover { color: #a21c2b; text-decoration: underline }
.delete-popover { position: absolute; z-index: 2; top: 39px; right: 0; width: 236px; padding: 15px; border: 1px solid #d9e0e4; border-radius: 9px; background: white; box-shadow: 0 12px 30px #182c3a2b }
.delete-popover p { margin-bottom: 10px; font-size: .84rem }
.delete-popover button { width: 100%; min-height: 36px; padding: 6px 10px; background: #a82433; font-size: .82rem }
.delete-popover button:hover { background: #891928 }
.upload-panel { margin-top: 17px; padding: 18px; border: 1px solid #d8e3e7; border-radius: 10px; background: #f7fafb }
.upload-intro { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 5px 16px; margin-bottom: 12px }
.upload-intro strong { font-size: .92rem }
.upload-intro span { color: var(--muted); font-size: .81rem }
.ecu-detail .upload { display: block; padding: 0; border: 0 }
.ecu-detail .upload .file-drop { display: block; margin: 0; padding: 14px 16px; border: 1.5px dashed #91aab3; border-radius: 8px; background: white }
.file-drop > span:first-child { display: block; color: #204657; font-size: .9rem; font-weight: 650 }
.file-drop > small { margin: 2px 0 9px }
.ecu-detail .file-drop input[type=file] { min-height: 40px; margin-top: 0; padding: 4px 6px; border: 1px solid #d6e0e5; border-radius: 6px; border-style: solid; background: #fafcfd; font-size: .82rem }
.file-drop [role=status]:not(:empty) { display: block; margin-top: 9px; color: #176275; font-size: .82rem }
.file-drop [role=status].upload-error { color: #a82433 }
.upload-progress { display: flex; align-items: center; gap: 12px; margin-top: 13px }
.upload-progress[hidden] { display: none }
.upload-progress progress { flex: 1; width: 100%; height: 12px; accent-color: #07869b }
.upload-percent { min-width: 40px; color: #204657; font-size: .81rem; font-variant-numeric: tabular-nums; text-align: right }
.upload-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px 22px; margin-top: 13px }
.upload-footer > span { color: var(--muted); font-size: .8rem; line-height: 1.35 }
.upload-footer button { flex: none; min-height: 38px; padding: 7px 16px; background: #203844; font-size: .84rem }
.upload-footer button:hover { background: #315564 }
.upload-footer button:disabled { opacity: .6; cursor: wait }
@media(max-width:760px) {
    .signed-in { --bar: 58px }
    .signed-in .topbar { padding: 0 18px }
    .portal-shell { display: block }
    .side nav { position: static; height: auto; max-height: 70vh; padding: 10px 12px }
    .nav-ready .menu-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 20px; font-size: .9rem }
    .menu-toggle::before { content: ""; width: 16px; height: 10px; border-block: 1.5px solid; background: linear-gradient(currentColor 0 0) center / 100% 1.5px no-repeat }
    .nav-ready .menu-toggle[aria-expanded="false"] + nav { display: none }
    .nav-heading { margin-top: 14px }
    .side-vehicles { max-height: 34vh }
    .account-links { margin-top: 10px }
    .protocol-groups { grid-template-columns: minmax(0,1fr) }
}
@media(max-width:600px) {
    .ecu-facts { grid-template-columns: minmax(0,1fr); gap: 12px }
    .asset-row { grid-template-columns: 38px minmax(0,1fr); padding: 13px; gap: 10px 12px }
    .asset-symbol { width: 38px; height: 42px }
    .asset-actions { grid-column: 2; justify-content: flex-start }
    .upload-footer { align-items: stretch; flex-direction: column }
    .upload-footer button { align-self: flex-end }
}
