/*
 * EWAY-Design (neu) – Bausteine: Buttons, Badges, Avatare, Karten, Tabellen, Tabs, Filter,
 * Formulare, Dropzone, Hinweise, Fortschritt, Leer-Zustand.
 * Plan: plans/layout.md · HTML-Aufbau: inc/php_functions/ui.php · Vorschau: system/styleguide
 * Wirkt nur auf Elemente mit ew-Klassen.
 */

/* ---------- Buttons ---------- */

.ew-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--ew-line-strong);
    border-radius: var(--ew-radius);
    background-color: transparent;
    color: var(--ew-text);
    font: 600 13px/1 var(--ew-font);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--ew-transition), border-color var(--ew-transition), color var(--ew-transition);
}
.ew-btn:hover { background-color: var(--ew-hover); border-color: var(--ew-line-strong); color: var(--ew-text); }
.ew-btn:active { transform: translateY(1px); }
.ew-btn .ew-icon { font-size: 16px; }

.ew-btn-primary { background-color: var(--ew-accent); border-color: var(--ew-accent); color: var(--ew-on-accent); }
.ew-btn-primary:hover { background-color: var(--ew-accent-hover); border-color: var(--ew-accent-hover); color: var(--ew-on-accent); }

.ew-btn-ghost { border-color: transparent; color: var(--ew-text-soft); }
.ew-btn-ghost:hover { border-color: transparent; color: var(--ew-text); }

.ew-btn-danger { background-color: var(--ew-danger-tint); border-color: transparent; color: var(--ew-danger); }
.ew-btn-danger:hover { background-color: var(--ew-danger-tint); border-color: var(--ew-danger); color: var(--ew-danger); }

.ew-btn-danger-solid { background-color: var(--ew-danger); border-color: var(--ew-danger); color: var(--ew-on-danger); }
.ew-btn-danger-solid:hover { filter: brightness(1.06); background-color: var(--ew-danger); color: var(--ew-on-danger); }

.ew-btn-sm { height: 30px; padding: 0 11px; font-size: 12px; }
.ew-btn-block { width: 100%; }
.ew-btn[disabled],
.ew-btn.disabled { opacity: .45; pointer-events: none; }

/* Icon-Button (quadratisch) */
.ew-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--ew-radius);
    background-color: transparent;
    color: var(--ew-text-muted);
    cursor: pointer;
    position: relative;
    transition: background-color var(--ew-transition), color var(--ew-transition);
}
.ew-icon-btn:hover,
.ew-icon-btn.show { background-color: var(--ew-active); color: var(--ew-text); }
.ew-icon-btn.ew-outline { border-color: var(--ew-line); color: var(--ew-text-soft); }
.ew-icon-btn.ew-outline:hover { border-color: var(--ew-line-strong); }
.ew-icon-btn-sm { width: 26px; height: 26px; }
.ew-icon-btn.ew-danger:hover { background-color: var(--ew-danger-tint); color: var(--ew-danger); }
.ew-icon-btn.ew-icon-btn-danger { background-color: var(--ew-danger-tint); border-color: transparent; color: var(--ew-danger); }
.ew-icon-btn.ew-icon-btn-warning { background-color: var(--ew-warning-tint); border-color: transparent; color: var(--ew-warning); }
.ew-icon-btn.ew-icon-btn-danger:hover,
.ew-icon-btn.ew-icon-btn-warning:hover { filter: brightness(1.15); }

/* Hinweispunkt (z. B. neue Hinweise, fällige Aufgaben) */
.ew-indicator {
    position: absolute;
    top: -3px;
    right: -3px;
    display: block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--ew-danger);
    box-shadow: 0 0 0 2px var(--ew-bg-header);
}
.ew-indicator.ew-indicator-start { left: -3px; right: auto; }

@keyframes ew-blink { 50% { opacity: .35; } }
.ew-blink { animation: ew-blink 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .ew-blink { animation: none; } }
.ew-icon-btn .ew-icon { font-size: 17px; vertical-align: 0; }
.ew-icon-btn .ew-count { position: absolute; top: -6px; right: -7px; }


/* ---------- Badges, Zähler, Avatare ---------- */

.ew-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--ew-radius-badge);
    background-color: var(--ew-neutral-tint);
    color: var(--ew-text-soft);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}
.ew-badge .ew-icon { font-size: 13px; vertical-align: 0; }
.ew-badge-accent { background-color: var(--ew-accent-tint); color: var(--ew-accent-text); }
.ew-badge-success { background-color: var(--ew-success-tint); color: var(--ew-success); }
.ew-badge-warning { background-color: var(--ew-warning-tint); color: var(--ew-warning); }
.ew-badge-danger { background-color: var(--ew-danger-tint); color: var(--ew-danger); }
.ew-badge-info { background-color: var(--ew-info-tint); color: var(--ew-info); }

.ew-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 17px;
    padding: 0 5px;
    border-radius: 9px;
    background-color: var(--ew-accent);
    color: var(--ew-on-accent);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.ew-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background-color: currentColor; }

.ew-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: 50%;
    background-color: var(--ew-accent-tint);
    color: var(--ew-accent-text);
    font-size: 12px;
    font-weight: 600;
}
.ew-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ew-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.ew-avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.ew-avatar-info { background-color: var(--ew-info-tint); color: var(--ew-info); }
.ew-avatar-neutral { background-color: var(--ew-neutral-tint); color: var(--ew-text-muted); }
.ew-avatar.ew-selected { outline: 2px solid var(--ew-accent); outline-offset: 2px; }

.ew-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ew-person-name { font-weight: 600; color: var(--ew-text); }
.ew-person-sub { color: var(--ew-text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ---------- Karten ---------- */

.ew-card {
    background-color: var(--ew-surface);
    border: 1px solid var(--ew-line);
    border-radius: var(--ew-radius-card);
    color: var(--ew-text);
}
.ew-card-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ew-line);
}
.ew-card-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--ew-text); }
.ew-card-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.ew-card-body { padding: 16px; }
.ew-card-footer { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--ew-line); color: var(--ew-text-muted); font-size: 12px; }

/* Listenzeilen in Karten (z. B. Dashboard „Auf einen Blick“) */
.ew-list-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--ew-line); }
.ew-list-row:first-child { border-top: 0; }
.ew-list-row > .ew-icon { color: var(--ew-text-muted); }
.ew-list-row .ew-list-end { margin-left: auto; }

/* Positionen: Bezeichnung (mit Beschreibung) links, Betrag rechts – z. B. Leistungen eines Vertrags */
.ew-kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; font-size: 12px; }
.ew-kv-label { min-width: 0; }
.ew-kv-label > span { display: block; color: var(--ew-text-muted); }
.ew-kv-value { color: var(--ew-text-soft); text-align: right; white-space: nowrap; }
@media (min-width: 576px) { table.ew-table .ew-kv { min-width: 200px; } }

/* Kennzahl */
.ew-stat-label { display: flex; align-items: center; gap: 6px; color: var(--ew-text-soft); }
.ew-stat-value { margin: 6px 0 2px; font-size: 24px; font-weight: 600; line-height: 1.15; }
.ew-stat-unit { color: var(--ew-text-soft); font-size: 13px; font-weight: 400; }


/* ---------- Tabellen (auch DataTables) ---------- */

.ew-table-wrap { overflow-x: auto; }
table.ew-table {
    width: 100%;
    margin: 0 !important;
    border-collapse: collapse;
    color: var(--ew-text);
    font-size: 13px;
}
table.ew-table > thead > tr > th {
    padding: 10px 16px;
    border-bottom: 1px solid var(--ew-line) !important;
    background: transparent;
    color: var(--ew-text-muted);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}
table.ew-table > tbody > tr > td {
    padding: 10px 16px;
    border-top: 0;
    border-bottom: 1px solid var(--ew-line);
    background: transparent;
    vertical-align: middle;
}
table.ew-table > tbody > tr:last-child > td { border-bottom: 0; }
table.ew-table > tbody > tr { transition: background-color var(--ew-transition); }
table.ew-table > tbody > tr:hover > td { background-color: var(--ew-hover); }
table.ew-table .ew-col-actions { width: 1%; text-align: right; white-space: nowrap; }
table.ew-table .ew-col-num { text-align: right; white-space: nowrap; }   /* Beträge */
table.ew-table th.sorting,
table.ew-table th.dt-orderable-asc,
table.ew-table th.dt-orderable-desc { cursor: pointer; }
table.ew-table th.sorting_asc,
table.ew-table th.sorting_desc,
table.ew-table th.dt-ordering-asc,
table.ew-table th.dt-ordering-desc { color: var(--ew-text-soft); }

/* Zeilenaktionen: höchstens ein Schnell-Icon + ⋯-Menü */
.ew-row-actions { display: inline-flex; align-items: center; gap: 2px; }

/* DataTables-Bedienelemente in ew-Karten (DataTables 2: dt-…, ältere Version: dataTables_…) */
.ew-card .dataTables_wrapper .row { margin: 0; }
.ew-card .dt-info,
.ew-card .dataTables_wrapper .dataTables_info { padding: 12px 16px; color: var(--ew-text-muted); font-size: 12px; }
/* Abstand am Seitenbereich, nicht an ul.pagination – DataTables 2 blendet sonst Seitenknöpfe aus */
.ew-card .dt-paging { padding: 10px 16px !important; }
.ew-card .dataTables_wrapper .dataTables_paginate { padding: 0 !important; }
.ew-card .dt-length select,
.ew-card .dataTables_wrapper .dataTables_length select {
    height: 30px;
    padding: 0 26px 0 10px;
    background-color: var(--ew-input-bg);
    border: 1px solid var(--ew-line-strong);
    border-radius: var(--ew-radius);
    color: var(--ew-text);
}
.ew-card .dataTables_wrapper .pagination { gap: 2px; margin: 0; padding: 10px 16px; }
.ew-card .dt-paging .pagination { gap: 2px; margin: 0; padding: 0; }
.ew-card .dt-paging .page-link,
.ew-card .dataTables_wrapper .page-link {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--ew-radius) !important;
    background: transparent;
    color: var(--ew-text-soft);
    font-size: 12px;
    line-height: 30px;
    text-align: center;
}
.ew-card .dt-paging .page-link:hover,
.ew-card .dataTables_wrapper .page-link:hover { background-color: var(--ew-active); color: var(--ew-text); }
.ew-card .dt-paging .page-item.active .page-link,
.ew-card .dataTables_wrapper .page-item.active .page-link { background-color: var(--ew-accent-tint); color: var(--ew-accent-text); }
.ew-card .dt-paging .page-item.disabled .page-link,
.ew-card .dataTables_wrapper .page-item.disabled .page-link { background: transparent; opacity: .4; }

/* Smartphone: Tabelle als Kartenliste (td braucht data-label) */
@media (max-width: 575.98px) {
    table.ew-table.ew-table-stack,
    table.ew-table.ew-table-stack > tbody { display: block; width: 100% !important; }   /* DataTables setzt sonst eine feste Breite */
    table.ew-table.ew-table-stack > thead { display: none; }
    table.ew-table.ew-table-stack > tbody > tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--ew-line); }
    table.ew-table.ew-table-stack > tbody > tr > td { display: block; padding: 3px 0; border: 0; text-align: left; }
    /* Label links, Inhalt rechtsbündig daneben – auch mehrzeilig (Adresse, Badges, Positionen) */
    table.ew-table.ew-table-stack > tbody > tr > td[data-label] { text-align: right; }
    table.ew-table.ew-table-stack > tbody > tr > td[data-label]::before { content: attr(data-label); float: left; margin-right: 12px; color: var(--ew-text-muted); font-size: 12px; text-align: left; }
    table.ew-table.ew-table-stack > tbody > tr > td[data-label]::after { content: ""; display: block; clear: both; }
    table.ew-table.ew-table-stack > tbody > tr > td[data-label] .ew-row { justify-content: flex-end; }
    table.ew-table.ew-table-stack > tbody > tr > td[data-label] .ew-kv-label { text-align: left; }
    table.ew-table.ew-table-stack > tbody > tr > td.ew-col-main { padding-bottom: 6px; }
    table.ew-table.ew-table-stack > tbody > tr > td.ew-col-actions { width: auto; text-align: right; }
}


/* ---------- Tabs ---------- */

.ew-tabs { display: flex; gap: 22px; margin-bottom: 16px; overflow-x: auto; border-bottom: 1px solid var(--ew-line); }
.ew-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 0 11px;
    border: 0;
    background: transparent;
    color: var(--ew-text-soft);
    font: 500 13px/1.2 var(--ew-font);
    white-space: nowrap;
    cursor: pointer;
}
.ew-tab:hover { color: var(--ew-text); }
.ew-tab.active { color: var(--ew-text); }
.ew-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background-color: var(--ew-accent); }
.ew-tab-count { color: var(--ew-text-muted); font-weight: 600; }


/* ---------- Suche und Filter-Chips ---------- */

.ew-search { position: relative; display: flex; align-items: center; min-width: 200px; }
.ew-search > .ew-icon { position: absolute; left: 11px; color: var(--ew-text-muted); pointer-events: none; }
.ew-search .ew-input { padding-left: 34px; }

.ew-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ew-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid var(--ew-line);
    border-radius: var(--ew-radius);
    background: transparent;
    color: var(--ew-text-soft);
    font: 500 12px/1 var(--ew-font);
    white-space: nowrap;
    cursor: pointer;
}
.ew-chip:hover { border-color: var(--ew-line-strong); color: var(--ew-text); }
.ew-chip.active { background-color: var(--ew-accent-tint); border-color: transparent; color: var(--ew-accent-text); }
.ew-chip-count { font-weight: 600; }


/* ---------- Formulare ---------- */

.ew-label { display: block; margin-bottom: 5px; color: var(--ew-text-soft); font-size: 12px; font-weight: 500; }
.ew-label .ew-required { color: var(--ew-danger); }
.ew-field { margin-bottom: 14px; }
.ew-field:last-child { margin-bottom: 0; }
/* Mehrere Felder nebeneinander; Spalten über --ew-field-cols (z. B. "140px minmax(0, 1fr)"), Smartphone untereinander */
.ew-field-row { display: grid; grid-template-columns: var(--ew-field-cols, repeat(2, minmax(0, 1fr))); gap: 0 12px; margin-bottom: 14px; }
.ew-field-row:last-child { margin-bottom: 0; }
.ew-field-row > .ew-field { margin-bottom: 0; }
/* Datum + Uhrzeit nebeneinander */
.ew-datetime { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; }
@media (max-width: 575.98px) {
    .ew-field-row { grid-template-columns: minmax(0, 1fr); gap: 14px 0; }
}

.ew-input {
    display: block;
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background-color: var(--ew-input-bg);
    border: 1px solid var(--ew-line-strong);
    border-radius: var(--ew-radius);
    color: var(--ew-text);
    font: 13px/1.4 var(--ew-font);
    transition: border-color var(--ew-transition), box-shadow var(--ew-transition);
}
.ew-input::placeholder { color: var(--ew-text-muted); }
.ew-input:hover { border-color: var(--ew-text-muted); }
.ew-input:focus { outline: none; border-color: var(--ew-accent); box-shadow: var(--ew-focus-ring); }
textarea.ew-input { height: auto; min-height: 90px; padding: 9px 12px; }
select.ew-input {
    appearance: none;
    padding-right: 34px;
    background-image: linear-gradient(45deg, transparent 50%, var(--ew-text-muted) 50%), linear-gradient(135deg, var(--ew-text-muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}
select.ew-input option { background-color: var(--ew-raised); color: var(--ew-text); }
.ew-input.is-invalid { border-color: var(--ew-danger); }
.ew-input[disabled] { opacity: .55; }
.ew-help { margin-top: 5px; color: var(--ew-text-muted); font-size: 12px; }
.ew-error { margin-top: 5px; color: var(--ew-danger); font-size: 12px; }

.ew-input-group { display: flex; align-items: stretch; }
.ew-input-group > .ew-input { border-radius: 0; }
.ew-input-group > :first-child { border-top-left-radius: var(--ew-radius); border-bottom-left-radius: var(--ew-radius); }
.ew-input-group > :last-child { border-top-right-radius: var(--ew-radius); border-bottom-right-radius: var(--ew-radius); }
.ew-input-group > :not(:first-child) { margin-left: -1px; }
.ew-input-addon {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background-color: var(--ew-hover);
    border: 1px solid var(--ew-line-strong);
    color: var(--ew-text-muted);
    white-space: nowrap;
}
.ew-input-group .ew-icon-btn { height: auto; width: 40px; border: 1px solid var(--ew-line-strong); border-radius: 0; }

/* Schalter */
.ew-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ew-text); }
.ew-switch input {
    appearance: none;
    position: relative;
    flex: none;
    width: 36px;
    height: 20px;
    margin: 0;
    border-radius: 10px;
    background-color: var(--ew-line-strong);
    cursor: pointer;
    transition: background-color var(--ew-transition);
}
.ew-switch input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--ew-text-soft);
    transition: transform var(--ew-transition), background-color var(--ew-transition);
}
.ew-switch input:checked { background-color: var(--ew-accent); }
.ew-switch input:checked::after { transform: translateX(16px); background-color: var(--ew-on-accent); }
.ew-switch input:focus-visible { outline: none; box-shadow: var(--ew-focus-ring); }

/* Checkbox und Radio */
.ew-check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--ew-text); }
.ew-check input {
    appearance: none;
    flex: none;
    display: inline-grid;
    place-content: center;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1px solid var(--ew-line-strong);
    border-radius: 5px;
    background-color: var(--ew-input-bg);
    cursor: pointer;
}
.ew-check input[type="radio"] { border-radius: 50%; }
.ew-check input:checked { background-color: var(--ew-accent); border-color: var(--ew-accent); }
.ew-check input[type="checkbox"]:checked::after {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -2px;
    border-left: 2px solid var(--ew-on-accent);
    border-bottom: 2px solid var(--ew-on-accent);
    transform: rotate(-45deg);
}
.ew-check input[type="radio"]:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background-color: var(--ew-on-accent); }
.ew-check input:focus-visible { outline: none; box-shadow: var(--ew-focus-ring); }

/* Auswahlkarte (z. B. Rolle) */
.ew-choice { display: flex; gap: 10px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--ew-line-strong); border-radius: var(--ew-radius); cursor: pointer; }
.ew-choice:hover { border-color: var(--ew-text-muted); }
.ew-choice:has(input:checked) { border-color: var(--ew-accent); background-color: var(--ew-accent-tint); }
.ew-choice-title { font-weight: 600; }
.ew-choice-end { margin-left: auto; color: var(--ew-text-soft); white-space: nowrap; }   /* z. B. Preis rechts */
.ew-choice-desc { color: var(--ew-text-muted); font-size: 12px; }

/* Segment-Auswahl (z. B. 2FA aus/E-Mail/SMS, Tag/Woche) */
.ew-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--ew-radius); background-color: var(--ew-hover); border: 1px solid var(--ew-line); }
.ew-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ew-seg label,
.ew-seg .ew-seg-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    margin: 0;
    padding: 5px 12px;
    border-radius: 6px;
    color: var(--ew-text-soft);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.ew-seg input:checked + label,
.ew-seg .ew-seg-item.active { background-color: var(--ew-active); color: var(--ew-text); }
.ew-seg input:focus-visible + label { box-shadow: var(--ew-focus-ring); }
.ew-seg-block { display: flex; }

/* Formular-Abschnitt: Titel + Kurztext links, Felder rechts */
.ew-form-section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-top: 1px solid var(--ew-line); }
.ew-form-section:first-child { border-top: 0; padding-top: 0; }
.ew-form-section-title { font-weight: 600; }
.ew-form-section-desc { margin-top: 2px; color: var(--ew-text-muted); font-size: 12px; }
@media (max-width: 767.98px) {
    .ew-form-section { grid-template-columns: 1fr; gap: 10px; }
}

/* Speicherleiste (erscheint bei Änderungen) */
.ew-savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background-color: var(--ew-raised);
    border: 1px solid var(--ew-line-strong);
    border-radius: var(--ew-radius-card);
    box-shadow: var(--ew-shadow-float);
}
.ew-savebar-text { display: flex; align-items: center; gap: 8px; color: var(--ew-text-soft); }
.ew-savebar-text .ew-dot { color: var(--ew-warning); }
.ew-savebar .ew-btn:first-of-type { margin-left: auto; }


/* ---------- Wiederholgruppe (Metronic-Formrepeater), z. B. Zusatzoptionen am Lizenzserver ---------- */

.ew-addon {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.7fr) minmax(0, .8fr) minmax(0, .7fr) auto 38px;   /* letzte Spalte fest: erste Zeile hat keinen Löschknopf */
    align-items: end;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--ew-line);
}
.ew-addon:first-child { padding-top: 0; }
.ew-addon-check { height: 38px; }
.ew-addon-delete { height: 38px; width: 38px; }
.ew-addons-actions { display: flex; justify-content: space-between; gap: 8px; padding-top: 14px; }
@media (max-width: 767.98px) {
    .ew-addon { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ---------- Bild-Upload (Dropzone) ---------- */

.ew-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 140px;
    padding: 20px;
    border: 1.5px dashed var(--ew-line-strong);
    border-radius: var(--ew-radius-card);
    background-color: var(--ew-hover);
    color: var(--ew-text-soft);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--ew-transition), background-color var(--ew-transition);
}
.ew-dropzone:hover,
.ew-dropzone.dz-drag-hover { border-color: var(--ew-accent); background-color: var(--ew-accent-tint); }
.ew-dropzone-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background-color: var(--ew-accent-tint); color: var(--ew-accent-text); font-size: 20px; }
.ew-dropzone-title { color: var(--ew-text); font-weight: 600; }
.ew-dropzone-hint { color: var(--ew-text-muted); font-size: 12px; }
.ew-dropzone .dz-preview,
.ew-dropzone .dz-message { display: none; }
.ew-dropzone.ew-uploading { pointer-events: none; opacity: .7; }
.ew-dropzone-progress { width: 60%; height: 4px; margin-top: 6px; border-radius: 2px; overflow: hidden; background-color: var(--ew-line); }
.ew-dropzone-progress span { display: block; height: 100%; width: 0; background-color: var(--ew-accent); transition: width .2s ease; }

.ew-image-preview {
    position: relative;
    display: inline-flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 100%;
    padding: 12px;
    border: 1px solid var(--ew-line-strong);
    border-radius: var(--ew-radius-card);
    background-color: var(--ew-hover);
}
.ew-image-preview img { display: block; flex: 0 1 auto; min-width: 0; max-width: 100%; max-height: 160px; border-radius: 6px; }
.ew-image-preview-actions { display: flex; flex: none; gap: 6px; }
.ew-image-preview-actions .ew-icon-btn { background-color: var(--ew-raised); border: 1px solid var(--ew-line-strong); color: var(--ew-text-soft); }
.ew-image-preview-actions .ew-icon-btn.ew-danger:hover { color: var(--ew-danger); }


/* ---------- Hinweise, Fortschritt, Leer-Zustand ---------- */

.ew-alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--ew-radius); background-color: var(--ew-neutral-tint); color: var(--ew-text); }
.ew-alert > .ew-icon { margin-top: 1px; font-size: 17px; }
.ew-alert-title { font-weight: 600; }
.ew-alert-success { background-color: var(--ew-success-tint); }
.ew-alert-success > .ew-icon { color: var(--ew-success); }
.ew-alert-warning { background-color: var(--ew-warning-tint); }
.ew-alert-warning > .ew-icon { color: var(--ew-warning); }
.ew-alert-danger { background-color: var(--ew-danger-tint); }
.ew-alert-danger > .ew-icon { color: var(--ew-danger); }
.ew-alert-info { background-color: var(--ew-info-tint); }
.ew-alert-info > .ew-icon { color: var(--ew-info); }

.ew-meter-box { min-width: 0; }
.ew-card-footer .ew-meter-box { flex: 0 1 280px; }
.ew-meter-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; font-size: 12px; }
.ew-meter-label { color: var(--ew-text); font-weight: 600; }
.ew-meter-value { color: var(--ew-text-muted); white-space: nowrap; }
.ew-meter { height: 6px; margin-top: 6px; overflow: hidden; border-radius: 3px; background-color: var(--ew-line); }
.ew-meter > span { display: block; height: 100%; border-radius: 3px; background-color: var(--ew-accent); }
.ew-meter.ew-meter-warning > span { background-color: var(--ew-warning); }
.ew-meter.ew-meter-danger > span { background-color: var(--ew-danger); }

.ew-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 20px; text-align: center; }
.ew-empty-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 6px; border-radius: 12px; background-color: var(--ew-neutral-tint); color: var(--ew-text-soft); font-size: 22px; }
.ew-empty-title { font-size: 15px; font-weight: 600; }
.ew-empty-text { max-width: 360px; margin-bottom: 8px; color: var(--ew-text-muted); }

/* Hilfsklassen für Abstände in ew-Layouts */
.ew-stack { display: flex; flex-direction: column; gap: 12px; }
.ew-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ew-grid { display: grid; gap: 12px; grid-template-columns: repeat(var(--ew-cols, 3), minmax(0, 1fr)); }
@media (max-width: 991.98px) { .ew-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .ew-grid { grid-template-columns: 1fr; } }
