:root {
    --bg: #05070b;
    --bg-2: #080d15;
    --panel: rgba(12, 18, 30, 0.86);
    --panel-strong: rgba(10, 16, 27, 0.96);
    --panel-soft: rgba(255, 255, 255, 0.045);
    --line: rgba(0, 204, 255, 0.22);
    --line-strong: rgba(0, 204, 255, 0.42);
    --blue: #00c8ff;
    --blue-2: #1976ff;
    --green: #27ee98;
    --yellow: #ffd166;
    --red: #ff4d6d;
    --text: #f4f8ff;
    --muted: #90a0b8;
    --muted-2: #64728a;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
    --glow: 0 0 34px rgba(0, 200, 255, 0.16);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --font: Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 0%, rgba(0, 200, 255, 0.15), transparent 30%),
        radial-gradient(circle at 85% 10%, rgba(25, 118, 255, 0.16), transparent 28%),
        linear-gradient(135deg, #040609 0%, #07101a 58%, #03050a 100%);
    color: var(--text);
    font-family: var(--font);
    overflow-x: hidden;
}

.ambient {
    position: fixed;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(30px);
    opacity: 0.48;
    z-index: 0;
}

.ambient-one {
    width: 360px;
    height: 360px;
    left: -140px;
    top: 120px;
    background: rgba(0, 200, 255, 0.14);
}

.ambient-two {
    width: 320px;
    height: 320px;
    right: -130px;
    bottom: 70px;
    background: rgba(25, 118, 255, 0.14);
}

.app-shell {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 292px;
    padding: 24px;
    background: rgba(4, 7, 12, 0.86);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 70px;
}

.brand-logo,
.brand-mark {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    flex: 0 0 auto;
}

.brand-logo {
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(0, 200, 255, 0.35));
}

.brand-mark {
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.18), rgba(25, 118, 255, 0.12));
    color: var(--blue);
    font-weight: 950;
    font-size: 23px;
    box-shadow: var(--glow);
}

.brand-title {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.3px;
}

.brand-sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 13px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: rgba(0, 200, 255, 0.10);
    border-color: var(--line);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.06);
}

.nav-link.disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.nav-icon {
    width: 22px;
    color: var(--blue);
    text-align: center;
}

.license-card {
    margin-top: auto;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(0, 200, 255, 0.08), rgba(255, 255, 255, 0.03));
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--glow);
}

.license-card strong,
.license-card small,
.tiny-label {
    display: block;
}

.license-card strong {
    margin: 7px 0 5px;
    font-size: 20px;
    color: var(--blue);
}

.license-card small,
.tiny-label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main {
    flex: 1;
    padding: 28px;
    max-width: 1500px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 22px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 7px;
    font-size: clamp(32px, 4vw, 54px);
    line-height: 0.95;
    letter-spacing: -1.8px;
}

h2 {
    margin-bottom: 0;
    font-size: 24px;
    letter-spacing: -0.5px;
}

h3 {
    margin-bottom: 8px;
    font-size: 18px;
}

.top-subline,
.panel p,
.hero-card p,
.notice-box {
    color: var(--muted);
    line-height: 1.55;
}

.top-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.connection-badge,
.ghost-link,
.hero-pill,
.result-pill,
.small-btn,
.input-with-button button,
.action-btn {
    border-radius: 999px;
}

.connection-badge,
.ghost-link,
.hero-pill,
.result-pill,
.small-btn,
.input-with-button button {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
}

.connection-badge {
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    box-shadow: var(--glow);
    min-width: 130px;
    justify-content: center;
}

.connection-badge.ok {
    color: var(--green);
    border-color: rgba(39, 238, 152, 0.36);
    background: rgba(39, 238, 152, 0.08);
}

.connection-badge.error {
    color: var(--red);
    border-color: rgba(255, 77, 109, 0.38);
    background: rgba(255, 77, 109, 0.08);
}

.pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 18px rgba(255, 209, 102, 0.9);
}

.connection-badge.ok .pulse {
    background: var(--green);
    box-shadow: 0 0 18px rgba(39, 238, 152, 0.9);
}

.connection-badge.error .pulse {
    background: var(--red);
    box-shadow: 0 0 18px rgba(255, 77, 109, 0.9);
}

.ghost-link {
    padding: 12px 15px;
    text-decoration: none;
}

.hero-grid,
.workbench-grid,
.details-grid {
    display: grid;
    gap: 22px;
}

.hero-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.8fr);
    margin-bottom: 22px;
}

.workbench-grid {
    grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
    margin-bottom: 22px;
}

.details-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
}

.hero-card,
.panel {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(15, 24, 40, 0.9), rgba(7, 11, 18, 0.94));
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow), var(--glow);
}

.hero-card {
    padding: 28px;
}

.primary-hero {
    min-height: 280px;
    overflow: hidden;
    position: relative;
}

.primary-hero::after {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    right: -120px;
    top: -90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 200, 255, 0.16), transparent 70%);
}

.hero-topline {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.hero-kicker {
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-size: 12px;
}

.hero-pill {
    color: var(--blue);
    padding: 9px 12px;
    background: rgba(0, 200, 255, 0.08);
}

.ecu-number {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    font-size: clamp(38px, 6vw, 78px);
    line-height: 0.9;
    font-weight: 950;
    letter-spacing: -3px;
    color: #ffffff;
    text-shadow: 0 0 26px rgba(0, 200, 255, 0.23);
}

.ecu-part {
    position: relative;
    z-index: 1;
    margin: 12px 0 15px;
    color: var(--blue);
    font-size: 28px;
    font-weight: 900;
}

.hero-card p,
.hero-mini-grid {
    position: relative;
    z-index: 1;
}

.hero-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.hero-mini-grid div,
.telemetry-tile,
.bundle-rows div {
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 14px;
}

.hero-mini-grid span,
.telemetry-tile span,
.bundle-rows span,
.identity-main span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.hero-mini-grid strong,
.telemetry-tile strong,
.bundle-rows strong,
.identity-main strong {
    display: block;
    color: var(--text);
}

.compact-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.progress-list {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.progress-item {
    display: flex;
    gap: 11px;
    align-items: center;
    color: var(--muted);
    font-weight: 800;
}

.progress-item span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.09);
}

.progress-item.done {
    color: var(--green);
}

.progress-item.done span {
    background: var(--green);
    border-color: var(--green);
}

.progress-item.active-step {
    color: var(--blue);
}

.progress-item.active-step span {
    background: var(--blue);
    border-color: var(--blue);
}

.panel {
    padding: 24px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.small-btn,
.input-with-button button {
    cursor: pointer;
    padding: 10px 13px;
    font-weight: 900;
    color: var(--blue);
}

.control-form {
    display: grid;
    gap: 15px;
}

label span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

input,
select {
    width: 100%;
    border: 1px solid rgba(0, 200, 255, 0.20);
    border-radius: 16px;
    background: rgba(2, 5, 10, 0.76);
    color: var(--text);
    padding: 14px 14px;
    font-size: 16px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(0, 200, 255, 0.08);
}

.input-with-button {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.port-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
}

.port-chip {
    border: 1px solid var(--line);
    color: var(--blue);
    background: rgba(0, 200, 255, 0.08);
    border-radius: 999px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 900;
}

.port-chip:hover {
    background: rgba(0, 200, 255, 0.16);
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.action-btn {
    cursor: pointer;
    border: 0;
    padding: 15px 12px;
    color: var(--text);
    font-weight: 950;
    font-size: 14px;
    transition: 0.15s ease;
}

.action-btn.soft {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.052);
}

.action-btn.live {
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    box-shadow: 0 0 24px rgba(0, 200, 255, 0.20);
}

.action-btn:hover,
.small-btn:hover,
.input-with-button button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.notice-box {
    border: 1px solid rgba(255, 209, 102, 0.22);
    border-radius: var(--radius-md);
    padding: 14px;
    background: rgba(255, 209, 102, 0.055);
}

.result-pill {
    padding: 10px 13px;
    font-weight: 950;
    color: var(--muted);
    white-space: nowrap;
}

.result-pill.ok {
    color: var(--green);
    border-color: rgba(39, 238, 152, 0.34);
    background: rgba(39, 238, 152, 0.08);
}

.result-pill.error {
    color: var(--red);
    border-color: rgba(255, 77, 109, 0.34);
    background: rgba(255, 77, 109, 0.08);
}

.result-pill.loading {
    color: var(--yellow);
    border-color: rgba(255, 209, 102, 0.34);
    background: rgba(255, 209, 102, 0.08);
}

.identity-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.identity-main {
    min-height: 130px;
    border: 1px solid var(--line-strong);
    background: linear-gradient(145deg, rgba(0, 200, 255, 0.11), rgba(255, 255, 255, 0.04));
    border-radius: var(--radius-lg);
    padding: 20px;
}

.identity-main strong {
    font-size: clamp(28px, 3.4vw, 48px);
    letter-spacing: -1.8px;
    overflow-wrap: anywhere;
}

.identity-main.secondary strong {
    color: var(--blue);
}

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.telemetry-tile strong {
    font-size: 16px;
    overflow-wrap: anywhere;
}

.decoded-block {
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-lg);
    padding: 16px;
    background: rgba(255, 255, 255, 0.035);
}

.terminal,
.decoded-block pre {
    margin: 0;
    width: 100%;
    max-height: 460px;
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: #03060b;
    color: #d7f7ff;
    padding: 16px;
    font-size: 13px;
    line-height: 1.48;
    white-space: pre-wrap;
    word-break: break-word;
}

.info-panel {
    min-height: 100%;
}

.bundle-rows {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 5;
    max-width: 420px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 16px;
    background: rgba(4, 8, 14, 0.94);
    box-shadow: var(--shadow), var(--glow);
    color: var(--text);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: 0.18s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.loading-overlay {
    opacity: 0.72;
    pointer-events: none;
}

@media (max-width: 1180px) {
    .hero-grid,
    .workbench-grid,
    .details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 850px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar,
    .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .identity-board,
    .telemetry-grid,
    .hero-mini-grid,
    .button-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .main,
    .sidebar {
        padding: 18px;
    }

    .hero-card,
    .panel {
        border-radius: 22px;
        padding: 18px;
    }

    .nav {
        grid-template-columns: 1fr;
    }

    .input-with-button {
        grid-template-columns: 1fr;
    }
}

/* Step 1.5 - ECU-Historie / Datenbank */
.mini-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.database-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 18px;
    margin-bottom: 18px;
}

.db-panel {
    position: relative;
    overflow: hidden;
}

.db-panel::after {
    content: '';
    position: absolute;
    inset: auto -120px -160px auto;
    width: 280px;
    height: 280px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(0, 200, 255, 0.12), transparent 70%);
    pointer-events: none;
}

.db-intro {
    color: var(--muted);
    line-height: 1.6;
    max-width: 980px;
}

.db-summary {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.035);
    border-radius: 18px;
    padding: 14px 16px;
    color: var(--text);
    margin: 16px 0;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-item {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(3, 6, 11, 0.62);
    border-radius: 16px;
    padding: 13px 15px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.history-item strong {
    color: var(--text);
    overflow-wrap: anywhere;
}

.history-item span {
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

@media (min-width: 1181px) {
    .telemetry-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .history-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-item span {
        text-align: left;
    }
}
