@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,300..800;1,300..800&display=swap');

/* ============================================================
   autava – Design System (abgestimmt auf die Autava-Landingpage)
   Farben: Autava-Blau #4B6EFF · Ink #0F0F0F · Soft #F6F7FB
   ============================================================ */
:root {
    --brand: #4B6EFF;
    --brand-600: #3E5CDF;
    --brand-700: #3450C4;
    --brand-glow: rgba(75, 110, 255, 0.35);
    --brand-soft: rgba(75, 110, 255, 0.12);

    --bg: #0F0F0F; /* Ink – wie Header/Footer der Landingpage */
    --surface: #171717;
    --topbar: rgba(15, 15, 15, 0.85);
    --sidebar: #0A0A0A;
    --sidebar-soft: rgba(255, 255, 255, 0.06);
    --sidebar-text: #c9c9c9;
    --sidebar-active: #ffffff;

    --text: #ffffff;
    --text-soft: #a9adba;
    --border: rgba(255, 255, 255, 0.08);

    --green: #10b981;
    --green-soft: rgba(16, 185, 129, 0.12);
    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, 0.12);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, 0.12);
    --blue: #4B6EFF;
    --blue-soft: rgba(75, 110, 255, 0.14);
    --gray-soft: rgba(255, 255, 255, 0.05);

    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 30px 60px rgba(0, 0, 0, 0.5);
    --font: "Inter Tight", system-ui, -apple-system, sans-serif;

    /* Aliase – werden in einzelnen Views verwendet */
    --bg-card: var(--surface);
    --bg-soft: var(--gray-soft);
    --border-color: var(--border);
}

* {
    box-sizing: border-box;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3 { letter-spacing: -.02em; line-height: 1.12; }

a { color: inherit; text-decoration: none; }

/* Native Browser-Controls (Dropdown-Listen, Datepicker, Checkboxen)
   an das jeweilige Theme anpassen statt Weiß */
:root { color-scheme: dark; }
.light-theme { color-scheme: light; }
select option { background-color: var(--surface); color: var(--text); }

/* Dezente, schöne Scrollleisten überall */
* { scrollbar-width: thin; scrollbar-color: rgba(120, 130, 150, 0.35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(120, 130, 150, 0.32);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 130, 150, 0.55);
    background-clip: content-box;
}

/* ---------- App-Shell ---------- */
.app {
    display: flex;
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% -10%, rgba(75, 110, 255, 0.14) 0%, transparent 55%);
}

.sidebar {
    width: 260px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 24px;
    font-weight: 700;
    font-size: 22px;
    color: #fff;
    letter-spacing: -.02em;
}

.sidebar__brand img { mix-blend-mode: screen; }

.sidebar__nav {
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
    /* Scrollen bleibt, Scrollleiste im Menü unsichtbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar__nav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.sidebar__section {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #7e828e;
    padding: 20px 12px 6px;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 13.5px;
}

.nav-item:hover {
    background: var(--sidebar-soft);
    color: #fff;
}

.nav-item.active {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px var(--brand-glow);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex: none;
    opacity: 0.8;
}

.nav-item.active svg {
    opacity: 1;
}

/* Dropdowns in Sidebar */
.nav-dropdown-chevron {
    width: 13px;
    height: 13px;
    flex: none;
    color: var(--text-soft);
    transition: transform 0.18s ease;
}
.nav-dropdown-chevron.is-open { transform: rotate(180deg); }

.nav-dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-sm);
}

.nav-dropdown-trigger:hover {
    background: var(--sidebar-soft);
    color: #fff;
}

.nav-dropdown-items {
    padding-left: 14px;
    margin-top: 4px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 1.5px solid rgba(255, 255, 255, 0.1);
}

.nav-dropdown-item {
    display: block;
    color: var(--sidebar-text);
    padding: 8px 14px;
    font-size: 13px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
}

.nav-dropdown-item:hover, .nav-dropdown-item.active {
    color: #fff;
    background: var(--sidebar-soft);
}

.nav-dropdown-item.active { color: #9db0ff; }

.sidebar__footer {
    margin-top: auto;
    padding: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-700));
    color: #fff;
    font-weight: 700;
    display: grid;
    place-items: center;
    font-size: 14px;
    flex: none;
    box-shadow: 0 4px 10px rgba(75, 110, 255, 0.3);
}

.sidebar__user-name { color: #fff; font-weight: 600; font-size: 14px; }
.sidebar__user-role { color: #7e828e; font-size: 11.5px; }

/* ---------- Main Layout Area ---------- */
.main {
    flex: 1;
    margin-left: 260px;
    min-width: 0;
}

.topbar {
    height: 70px;
    background: var(--topbar);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -.02em;
}

.content {
    padding: 36px 44px;
    max-width: 1720px;
    margin: 0 auto;
    width: 100%;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card__head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card__title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -.01em;
}

.card__body {
    padding: 24px;
}

.section-gap { margin-top: 30px; }

/* ---------- Fahrzeug-Detailseite ---------- */
.detail-head {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}

.detail-hero {
    width: 300px;
    max-width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.detail-hero--empty {
    display: grid;
    place-items: center;
    background: var(--gray-soft);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.detail-title {
    margin: 4px 0 2px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.detail-sub {
    margin: 0 0 12px;
    color: var(--text-soft);
    font-size: 14.5px;
}

.detail-price {
    font-size: 26px;
    font-weight: 800;
    color: var(--brand);
    letter-spacing: -0.02em;
}

/* ---------- Tabs (moderne Segment-Leiste) ---------- */
.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 5px;
    margin-bottom: 18px;
    width: fit-content;
    max-width: 100%;
}

.tab {
    border: none;
    background: transparent;
    color: var(--text-soft);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.tab:hover { background: var(--gray-soft); color: var(--text); }

.tab.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 12px rgba(75, 110, 255, 0.3);
}

/* ---------- Daten-Raster (Übersicht) ---------- */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

.data-item {
    background: var(--gray-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    min-width: 0;
}

.data-item__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-soft);
    margin-bottom: 3px;
}

.data-item__value {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    overflow-wrap: break-word;
}

/* ---------- Galerie (Bild-Thumbnails) ---------- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.gallery img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

@media (max-width: 700px) {
    .detail-hero { width: 100%; height: 200px; }
    .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
}

/* ---------- Tabellen ---------- */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-soft);
    font-weight: 700;
    padding: 16px 20px;
    border-bottom: 1.5px solid var(--border);
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 14px;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(75, 110, 255, 0.04);
}

/* Kompakte Dashboard-Tabellen (passen ohne horizontales Scrollen in die Karten) */
.table--dash { table-layout: auto; }
.table--dash th { padding: 14px 18px; }
.table--dash td { padding: 13px 18px; font-size: 13.5px; }
.table--dash td strong { font-weight: 700; }

.thumb {
    width: 58px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--gray-soft);
}

.thumb--empty {
    display: grid;
    place-items: center;
    color: #7e828e;
}

/* ---------- Badges ---------- */
/* Dezente Chips: neutraler Hintergrund + farbiger Statuspunkt (statt bunter Flächen) */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--gray-soft);
    color: var(--text);
    border: 1px solid var(--border);
    white-space: nowrap;
    line-height: 1.5;
}
.badge--green::before, .badge--amber::before, .badge--red::before, .badge--blue::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dot);
    flex: none;
}
.badge--green { --dot: var(--green); }
.badge--amber { --dot: var(--amber); }
.badge--red { --dot: var(--red); }
.badge--blue { --dot: var(--blue); }

/* Editierbarer Status-Chip (Dropdown mit farbigem Punkt) */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 7px;
    background: var(--gray-soft);
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}
.status-chip:hover { border-color: var(--brand); }
.status-chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, #9aa0ad); flex: none; }
.status-chip--green { --dot: var(--green); }
.status-chip--amber { --dot: var(--amber); }
.status-chip--red { --dot: var(--red); }
.status-chip--blue { --dot: var(--blue); }
.status-chip__select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 15px 0 0;
    margin: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a9adba'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 11px;
}
.status-chip__select:focus { outline: none; }
.status-chip__select option { background: var(--surface); color: var(--text); font-weight: 500; }

/* Modernes eigenes Dropdown-Menü (ersetzt native Select-Popups) */
.dropdown-menu {
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 20, 40, 0.18);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dropdown-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    transition: background 0.12s;
}
.dropdown-menu__item:hover { background: var(--gray-soft); }
.dropdown-menu__item.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.dropdown-menu .dd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #9aa0ad); flex: none; }

/* Chevron in Dropdown-Triggern (Größe über Klasse, nie über :style binden!) */
.dd-chevron { width: 12px; height: 12px; flex: none; color: var(--text-soft); transition: transform 0.18s ease; }
.dd-chevron.is-open { transform: rotate(180deg); }

/* ---------- KPI-Karten (Stats Grid) ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat__label {
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat__value {
    font-size: 32px;
    font-weight: 800;
    margin-top: 8px;
    letter-spacing: -.03em;
    color: var(--text);
}

.stat__icon {
    float: right;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
}

.stat__icon svg { width: 22px; height: 22px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13.5px;
    font-family: var(--font);
    border: 1px solid transparent;
    cursor: pointer;
    background: var(--gray-soft);
    color: var(--text);
    white-space: nowrap;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 14px var(--brand-glow);
}

.btn--primary:hover {
    background: var(--brand-600);
    box-shadow: 0 6px 18px var(--brand-glow);
}

.btn--ghost {
    background: transparent;
    border-color: var(--border);
}

.btn--ghost:hover {
    background: var(--gray-soft);
    border-color: rgba(75, 110, 255, 0.35);
}

.btn--secondary {
    background: var(--gray-soft);
    border-color: var(--border);
    color: var(--text);
}

.btn--sm {
    padding: 6px 14px;
    font-size: 12.5px;
    border-radius: 8px;
}

/* Kompakter, quadratischer Icon-Button (Tabellen-Aktionen) */
.btn--icon {
    padding: 7px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.btn--icon svg { width: 16px; height: 16px; }

.btn--danger {
    background: var(--red);
    color: #fff;
}

.btn--danger:hover {
    background: #c53030;
}

.btn svg { width: 16px; height: 16px; }

/* ---------- Formulare ---------- */
.field { margin-bottom: 20px; }
.field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-soft);
}

.input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.input::placeholder {
    color: #7e828e;
}

/* Datei-Auswahl im Seiten-Design statt nativem Grau/Weiß */
input[type="file"].input { padding: 8px 10px; cursor: pointer; }
input[type="file"]::file-selector-button {
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    margin-right: 12px;
    cursor: pointer;
    transition: background 0.18s ease;
}
input[type="file"]::file-selector-button:hover { background: var(--brand-600); }

.error { color: var(--red); font-size: 13px; margin-top: 6px; font-weight: 600; }
.empty { text-align: center; color: var(--text-soft); padding: 50px 20px; font-weight: 500; }

/* ---------- Toolbars & Filter ---------- */
.toolbar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar__search {
    flex: 1;
    min-width: 280px;
}

.select { max-width: 240px; }

/* Einheitlicher Pfeil für ALLE Dropdowns (statt teils nativ, teils eigen) */
select.input,
.select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a9adba'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 36px !important;
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 15, 0.7);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    z-index: 50;
    padding: 20px;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
}

.modal__head {
    padding: 22px 26px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 17px;
}

.modal__body {
    padding: 24px 26px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal__foot {
    padding: 18px 26px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ---------- Bestätigungs-Dialog (ersetzt natives confirm/alert) ---------- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

.confirm-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 28px 26px 24px;
    text-align: center;
    animation: slideDown 0.2s ease;
}

.confirm-box__icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--red-soft);
    color: var(--red);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 21px;
    margin: 0 auto 14px;
}

.confirm-box__icon--info {
    background: var(--brand-soft);
    color: var(--brand);
}

.confirm-box__msg {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 22px;
    line-height: 1.5;
}

.confirm-box__actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Flash-Meldungen ---------- */
.flash {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

.flash--success {
    background: var(--green-soft);
    color: var(--green);
    border: 1.5px solid rgba(16, 185, 129, 0.2);
}

.flash--danger {
    background: var(--red-soft);
    color: var(--red);
    border: 1.5px solid rgba(239, 68, 68, 0.2);
}

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Hamburger-Button (nur auf Mobile sichtbar) */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle:hover { background: var(--gray-soft); }
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 14, 0.55);
    backdrop-filter: blur(3px);
    z-index: 29;
}

/* Farb-Vorlagen im Website-Baukasten */
.cw-preset {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    padding: 0;
    transition: transform 0.12s;
}
.cw-preset:hover { transform: scale(1.15); }

@media (max-width: 900px) {
    /* Kein horizontales Wegscrollen der ganzen Seite auf kleinen Geräten */
    html, body { overflow-x: hidden; }
    .main { margin-left: 0; max-width: 100vw; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(.4, 0, .2, 1);
        width: 264px;
    }
    .sidebar.sidebar--open { transform: translateX(0); box-shadow: 0 0 50px rgba(0, 0, 0, 0.55); }
    .form-row { grid-template-columns: 1fr; }
    .content { padding: 18px 14px; }
    .nav-toggle { display: inline-flex; }
    .builder-grid { grid-template-columns: 1fr !important; }
    .invoice-grid { grid-template-columns: 1fr !important; }
    .mobile-grid { grid-template-columns: 1fr !important; }

    /* Topbar: Titel-Zeile oben, Aktionen in scrollbarer Zeile darunter */
    .topbar {
        height: auto;
        min-height: 58px;
        flex-wrap: wrap;
        row-gap: 8px;
        padding: 10px 14px;
    }
    .topbar h1 { font-size: 17px; }
    .topbar__left { flex: 1 1 auto; }
    .topbar__right {
        width: 100%;
        order: 3;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 8px !important;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .topbar__right::-webkit-scrollbar { display: none; }
    .topbar__right > *, .topbar__right .btn { flex-shrink: 0; }
    /* Aktions-Buttons im @slot('actions') als kompakte, nicht umbrechende Reihe */
    .topbar__right > div[style*="flex"] { flex-shrink: 0; flex-wrap: nowrap; }

    /* Dashboard-Widgets kompakter */
    #widget-container { gap: 16px !important; }

    /* Breite Tabellen scrollen horizontal statt abgeschnitten zu werden */
    .card__body { max-width: 100%; }
    .card .table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .toolbar { gap: 10px; }
    .toolbar__search { min-width: 0; }
}

/* Ganz kleine Geräte: Kennzahlen-Karten etwas kompakter */
@media (max-width: 480px) {
    .content { padding: 14px 12px; }
}

/* ---------- Light Theme (Standard-Look der Landingpage:
   dunkle Ink-Sidebar, heller Content auf #F6F7FB) ---------- */
.light-theme {
    --brand: #4B6EFF;
    --brand-600: #3E5CDF;
    --brand-700: #3450C4;
    --brand-glow: rgba(75, 110, 255, 0.22);
    --brand-soft: rgba(75, 110, 255, 0.1);

    --bg: #F6F7FB;
    --surface: #ffffff;
    --topbar: rgba(255, 255, 255, 0.9);
    --sidebar: #0F0F0F;
    --sidebar-soft: rgba(255, 255, 255, 0.06);
    --sidebar-text: #c9c9c9;
    --sidebar-active: #ffffff;

    --text: #0F0F0F;
    --text-soft: #666666;
    --border: #ECECEC;

    --green: #059669;
    --green-soft: #ecfdf5;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --blue: #4B6EFF;
    --blue-soft: rgba(75, 110, 255, 0.08);
    --gray-soft: #F6F7FB;

    --shadow: 0 16px 40px rgba(20, 30, 80, 0.05);
    --shadow-lg: 0 30px 60px rgba(20, 30, 80, 0.12);
}

.light-theme .app {
    background: var(--bg);
}

/* WICHTIG: background-color statt background-Shorthand, sonst wird das
   Pfeil-Bild der Dropdowns zurückgesetzt und kachelt sich mehrfach. */
.light-theme .input { background-color: #fff; border-color: #dcdfe8; color: var(--text); }
.light-theme .input:focus { border-color: var(--brand); background-color: #fff; }
.light-theme .input::placeholder { color: #A0A0A0; }
.light-theme select.input,
.light-theme .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23666666'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); }
.light-theme .btn { background: #fff; border-color: #ECECEC; box-shadow: 0 1px 2px rgba(20, 30, 80, 0.04); }
.light-theme .btn:hover { background: var(--gray-soft); }
.light-theme .btn--primary { background: var(--brand); border-color: transparent; color: #fff; }
.light-theme .btn--primary:hover { background: var(--brand-600); }
.light-theme .btn--ghost { background: transparent; }
.light-theme .btn--danger { background: var(--red); border-color: transparent; color: #fff; }
.light-theme .btn--danger:hover { background: #c53030; }
.light-theme .table tr:hover td { background: rgba(75, 110, 255, 0.03); }
.light-theme .badge--green { border-color: rgba(5, 150, 105, 0.15); }
.light-theme .badge--amber { border-color: rgba(217, 119, 6, 0.15); }
.light-theme .badge--red { border-color: rgba(220, 38, 38, 0.15); }
.light-theme .modal-overlay { background: rgba(15, 15, 15, 0.45); }

.hidden { display: none !important; }
[x-cloak] { display: none !important; }

/* ---------- A4-Rechnungsvorschau (echtes Blatt) ---------- */
.a4-sheet {
    display: flex;
    flex-direction: column;          /* Fußzeile via margin-top:auto an den Blattrand */
    background: #ffffff;
    color: #1a1a1a;
    width: 100%;
    max-width: 820px;
    min-height: 1160px;              /* A4-Proportion (210:297) */
    padding: 54px 58px 40px;
    box-sizing: border-box;
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.28);
    border-radius: 4px;
    font-family: var(--font);
}
.a4-sheet * { box-sizing: border-box; }
.a4-sheet > * { flex-shrink: 0; }
.light-theme .a4-sheet { box-shadow: 0 10px 36px rgba(15, 15, 15, 0.14), 0 0 0 1px var(--border); }

/* Editor als A4-Blatt (gleiches Format wie die Vorschau/PDF) */
.a4-sheet--edit { max-width: 100%; }

/* ---------- Schwebender KI-Assistent (Ava) ---------- */
.ava-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, #7B94FF 100%);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 120;
    box-shadow: 0 10px 30px rgba(75, 110, 255, 0.45);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.ava-fab svg { width: 24px; height: 24px; }
.ava-fab:hover { transform: scale(1.07); box-shadow: 0 14px 36px rgba(75, 110, 255, 0.55); }
.ava-fab--open { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }

.ava-panel {
    position: fixed;
    right: 24px;
    bottom: 94px;
    width: min(400px, calc(100vw - 48px));
    height: min(560px, calc(100vh - 130px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 119;
    overflow: hidden;
}

.ava-panel__inner { display: flex; flex-direction: column; height: 100%; }

.ava-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.ava-panel__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, #7B94FF 100%);
    color: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.ava-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ava-bubble {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    background: var(--gray-soft);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.ava-bubble--user {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
}

.ava-panel__input {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.ava-loading {
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
    font-size: 12.5px;
}

.ava-typing {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    display: inline-block;
    animation: avaPulse 1s ease-in-out infinite;
}

@keyframes avaPulse {
    0%, 100% { opacity: 0.35; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.15); }
}

/* Mobile Scanner-Seiten: responsive Dark/Light-Regeln */
@media (prefers-color-scheme: light) {
    body:has(.m-wrap) {
        background-color: #F6F7FB !important;
        color: #0F0F0F !important;
    }
    .m-head img[src*="autava-weiss-ob.svg"] {
        filter: invert(1) !important;
    }
}

/* Dashboard Responsive Grid */
@media (max-width: 1250px) {
    #widget-container {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 20px !important;
    }
    .draggable-widget {
        grid-column: span 1 !important;
        min-width: 0;
    }
    /* Karten & Inhalte dürfen nie breiter als der Bildschirm werden */
    .draggable-widget .card { max-width: 100%; }
    .draggable-widget .table { display: block; overflow-x: auto; }
}

@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .content {
        padding: 20px 16px !important;
    }
    .stat {
        padding: 16px !important;
    }
}

/* ---------- Login (Ink-Hero wie die Landingpage) ---------- */
.login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% -20%, rgba(75, 110, 255, 0.22) 0%, transparent 65%), #0F0F0F;
    padding: 20px;
}

.login__card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #ECECEC;
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    color: #0F0F0F;
}

.login__card .input {
    background: #fff;
    border-color: #dcdfe8;
    color: #0F0F0F;
}

.login__card .input::placeholder { color: #A0A0A0; }

.login__card .field label { color: #666666; }

.login__brand {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login__brand img { filter: invert(1); }

.login__sub {
    font-size: 16px;
    font-weight: 700;
    color: #0F0F0F;
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
}

.login__hint {
    margin-top: 24px;
    font-size: 13px;
    color: #666666;
    text-align: center;
    background: #F6F7FB;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid #ECECEC;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #666666;
    cursor: pointer;
    margin-bottom: 20px;
    user-select: none;
}

.checkbox-row input {
    cursor: pointer;
}

/* ---------- Responsive Tabellen-Padding ---------- */
@media (max-width: 1400px) {
    .table th, .table td {
        padding: 12px 10px !important;
    }
}

/* ---------- Global Responsive Layout Overrides ---------- */
@media (max-width: 991px) {
    .show-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .data-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 12px 16px !important;
    }
    
    .topbar h1 {
        font-size: 18px !important;
    }

    .content {
        padding: 16px 12px !important;
    }

    .card {
        border-radius: var(--radius-sm) !important;
    }

    /* Segmented Controls und Buttons bei kleinen Bildschirmen */
    [style*="display: flex; background: var(--bg-soft); border-radius: 8px; padding: 4px; border: 1px solid var(--border-color);"] {
        flex-direction: column !important;
        gap: 4px !important;
    }
    
    [style*="display: flex; background: var(--bg-soft); border-radius: 8px; padding: 4px; border: 1px solid var(--border-color);"] button {
        width: 100% !important;
        text-align: center !important;
        padding: 8px 10px !important;
    }
}

