/* ========================================
   SETTINGS PAGES - UNIFIED MODERN UI
   ======================================== */

.settings-page {
    /* Feste Höhe unter dem Header + eigener Scrollbereich: der Header steht,
       nur der Inhalt scrollt — gleiches Muster wie /settings/changelog. */
    height: calc(100vh - var(--app-header-h));
    height: calc(100dvh - var(--app-header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 28px 28px 64px;
    color: #16181c;
    background: #f5f5f7;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* -- Page header ------------------------------------------------------- */
.settings-header {
    max-width: 1020px;
    margin: 0 auto 22px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.settings-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.settings-kicker {
    color: #80858d;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.settings-header h1 {
    margin: 3px 0 0;
    color: #16181c;
    font-size: 1.72rem;
    font-weight: 800;
    line-height: 1.22;
}

.settings-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.settings-title-link {
    padding: 0;
    border: none;
    background: transparent;
    color: #80858d;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.15s;
    min-width: 0;
    text-align: left;
}

@media (hover: hover) {
    .settings-title-link:hover {
        color: #16181c;
    }
}

.settings-title-sep {
    color: #cfd0d3;
    font-weight: 600;
    flex-shrink: 0;
}

.settings-title-current {
    color: #16181c;
    line-height: 1.3;
    padding-bottom: 2px;
    font-weight: 800;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -- Card -------------------------------------------------------------- */
.settings-card {
    max-width: 1020px;
    margin: 0 auto;
    background: white;
    border: 1.5px solid #e4e4e7;
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(28, 28, 30, 0.08);
    overflow: hidden;
}

.settings-card + .settings-card {
    margin-top: 16px;
}

/* -- Toolbar ----------------------------------------------------------- */
.settings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e4e4e7;
    background: #fafafa;
}

.settings-counter {
    color: #3c4148;
    font-size: 0.84rem;
    font-weight: 600;
}

/* -- Buttons ----------------------------------------------------------- */
.settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: 11px;
    border: 1.5px solid transparent;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.settings-btn:active {
    transform: translateY(1px);
}

.settings-btn--primary {
    color: white;
    background: #16181c;
    box-shadow: 0 5px 14px rgba(22, 24, 28, 0.18);
}

@media (hover: hover) {
    .settings-btn--primary:hover {
        background: #26282e;
        box-shadow: 0 8px 18px rgba(22, 24, 28, 0.24);
    }
}

.settings-btn--ghost {
    color: #3c4148;
    background: white;
    border-color: #e4e4e7;
}

@media (hover: hover) {
    .settings-btn--ghost:hover {
        color: #16181c;
        background: #efeff1;
        border-color: #cfd0d3;
    }
}

.settings-btn--danger {
    color: white;
    background: #e2483b;
    box-shadow: 0 5px 14px rgba(226, 72, 59, 0.2);
}

@media (hover: hover) {
    .settings-btn--danger:hover {
        background: #cf3f33;
        box-shadow: 0 8px 18px rgba(226, 72, 59, 0.26);
    }
}

.settings-btn--danger[disabled] {
    background: #f0b8b2;
    cursor: not-allowed;
    box-shadow: none;
}

.settings-btn--sm {
    height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
}

/* -- Inline form ------------------------------------------------------- */
.settings-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #efeff1;
    border-bottom: 1px solid #e4e4e7;
}

.settings-input {
    box-sizing: border-box;
    height: 40px;
    border: 1.5px solid #e4e4e7;
    border-radius: 11px;
    padding: 0 12px;
    color: #16181c;
    background: #ffffff;
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.2;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}

select.settings-input {
    -webkit-appearance: auto;
    appearance: auto;
}

.settings-input:focus {
    outline: none;
    border-color: #16181c;
    background: #efeff1;
    box-shadow: 0 0 0 3px rgba(22, 24, 28, 0.12);
}

.settings-input--flex {
    min-width: 0;
}

.settings-inline-form .settings-input--flex {
    flex: 1 1 240px;
}

.settings-input--erp {
    width: 96px;
    flex-shrink: 0;
}

.settings-input--num {
    width: 110px;
    flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Einheiten-Auswahl in Inline-Formularen: Shared IconSelect statt nativem <select> */
.settings-unitsel {
    width: 110px;
    flex-shrink: 0;
}

.settings-unitsel .iconsel-trigger {
    min-height: 40px;
}

/* Phasen-Auswahl (Baustellen-Status): Shared IconSelect im Inline-Formular */
.settings-phasesel {
    width: 160px;
    flex-shrink: 0;
}

.settings-phasesel .iconsel-trigger {
    min-height: 40px;
}

.settings-input--error {
    border-color: #e2483b;
    background: #fbeae8;
}

.settings-input--error:focus {
    border-color: #e2483b;
    box-shadow: 0 0 0 3px rgba(226, 72, 59, 0.16);
}

.settings-field-error {
    width: 100%;
    margin: -4px 0 0;
    color: #e2483b;
    font-size: 0.82rem;
    font-weight: 600;
}

.settings-field-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 0 auto;
}

.settings-field-label > span {
    color: #3c4148;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* -- List -------------------------------------------------------------- */
.settings-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding: 8px 8px;
}

.settings-list::-webkit-scrollbar {
    width: 10px;
}

.settings-list::-webkit-scrollbar-thumb {
    background: #cfd0d3;
    border-radius: 6px;
    border: 2px solid white;
}

@media (hover: hover) {
    .settings-list::-webkit-scrollbar-thumb:hover {
        background: #80858d;
    }
}

/* -- Row --------------------------------------------------------------- */
.settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 11px;
    background: white;
    border: 1.5px solid transparent;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

@media (hover: hover) {
    .settings-row:hover {
        background: #efeff1;
    }
}

.settings-row--drag-target {
    border-color: #16181c;
    background: #efeff1;
    box-shadow: 0 0 0 2px rgba(22, 24, 28, 0.18);
}

.settings-row--editing {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
    background: #efeff1;
    border-color: #e4e4e7;
    box-shadow: 0 0 0 1px rgba(22, 24, 28, 0.08);
}

@media (hover: hover) {
    .settings-row--editing:hover {
        background: #efeff1;
    }
}

.settings-edit-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.settings-edit-actions .settings-btn {
    min-width: 100px;
}

.settings-edit-row-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.settings-pin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    color: #16181c;
    font-size: 0.84rem;
    font-weight: 700;
}

.settings-pin-toggle input {
    width: 17px;
    height: 17px;
    accent-color: #16181c;
    cursor: pointer;
}

.settings-row--drag-source {
    opacity: 0.35;
}

.settings-row-text {
    flex: 1;
    min-width: 0;
    color: #16181c;
    font-size: 0.94rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-row-body .settings-row-name {
    color: #16181c;
    font-size: 0.94rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-row-body .settings-row-meta {
    color: #3c4148;
    font-size: 0.82rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-row-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

@media (hover: hover) {
    .settings-row-nav-btn:hover .settings-row-name {
        color: #16181c;
    }
}

.settings-row-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    color: #16181c;
    background: #efeff1;
}

.settings-row-chevron {
    flex-shrink: 0;
    color: #cfd0d3;
    transition: transform 0.15s, color 0.15s;
}

@media (hover: hover) {
    .settings-row-nav-btn:hover .settings-row-chevron {
        color: #16181c;
        transform: translateX(2px);
    }
}

/* -- Drag handle ------------------------------------------------------- */
.settings-drag-handle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: #cfd0d3;
    cursor: grab;
    touch-action: none;
    transition: color 0.15s, background 0.15s;
}

@media (hover: hover) {
    .settings-drag-handle:hover {
        color: #16181c;
        background: #efeff1;
    }
}

.settings-drag-handle:active {
    cursor: grabbing;
}

.settings-drag-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 20px 38px rgba(0, 0, 0, 0.18);
    border: 1.5px solid #16181c !important;
    background: white !important;
    border-radius: 11px;
    opacity: 0.92;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

body.settings-dragging {
    cursor: grabbing !important;
    user-select: none;
}

body.settings-dragging * {
    cursor: grabbing !important;
}

/* -- Badge ------------------------------------------------------------- */
.settings-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    min-width: 42px;
    padding: 0 9px;
    border-radius: 8px;
    color: #16181c;
    background: #efeff1;
    font-size: 0.78rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.settings-badge--empty {
    color: #80858d;
    background: #efeff1;
}

.settings-cost-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 11px;
    border-radius: 8px;
    color: #16181c;
    background: #efeff1;
    border: 1px solid #e4e4e7;
    font-size: 0.84rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* -- Row actions ------------------------------------------------------- */
.settings-row-action {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: #3c4148;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

@media (hover: hover) {
    .settings-row-action:hover {
        color: #16181c;
        background: #efeff1;
    }
}

@media (hover: hover) {
    .settings-row-action--delete:hover {
        color: #e2483b;
        background: #fbeae8;
    }
}

/* -- Empty state ------------------------------------------------------- */
.settings-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 24px;
    color: #80858d;
}

.settings-empty p {
    margin: 0;
    color: #80858d;
    font-size: 0.94rem;
    font-weight: 600;
}

/* -- Produkt-Form (Material) ------------------------------------------ */
.settings-produkt-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px;
    background: #efeff1;
    border-bottom: 1px solid #e4e4e7;
}

.settings-produkt-nums-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.settings-calc-preview {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    border-radius: 11px;
    color: #16181c;
    background: white;
    border: 1.5px solid #e4e4e7;
    font-size: 0.92rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* -- Toggle ----------------------------------------------------------- */
.settings-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    height: 40px;
}

.settings-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-toggle-track {
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #cfd0d3;
    position: relative;
    transition: background 0.18s;
}

.settings-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: transform 0.18s;
}

.settings-toggle-input:checked + .settings-toggle-track {
    background: #16181c;
}

.settings-toggle-input:checked + .settings-toggle-track .settings-toggle-thumb {
    transform: translateX(18px);
}

/* -- Color picker (Baustellen-Status) --------------------------------- */
.settings-color-input {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1.5px solid #e4e4e7;
    border-radius: 11px;
    background: white;
    cursor: pointer;
}

.settings-color-input::-webkit-color-swatch-wrapper {
    padding: 4px;
}

.settings-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 7px;
}

.settings-color-presets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px;
    border-radius: 11px;
    background: white;
    border: 1.5px solid #e4e4e7;
}

.settings-color-preset {
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 7px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.15s;
}

@media (hover: hover) {
    .settings-color-preset:hover {
        transform: scale(1.08);
    }
}

.settings-color-preset--active {
    border-color: #16181c;
    transform: scale(1.05);
}

.settings-status-dot {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--status-color, #16181c);
    box-shadow: 0 0 0 3px var(--status-surface, rgba(22, 24, 28, 0.18));
}

.settings-status-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 9px;
    border-radius: 8px;
    color: var(--status-color, #16181c);
    background: var(--status-surface, rgba(22, 24, 28, 0.14));
    font-size: 0.78rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
}

/* Baustellen-Status: die Seite selbst scrollt NICHT — nur die Statusliste in der
   Karte bekommt den Scrollbereich (kein äußerer Scrollbalken am Fenster). */
.settings-page--bstatus {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 28px;
}

.settings-page--bstatus .settings-header {
    flex: 0 0 auto;
    /* Im Flex-Container verhindert margin:auto das Stretchen (schrumpft auf
       Textbreite und zentriert) — width:100% richtet ihn wieder an der
       1020px-Karte aus. */
    width: 100%;
}

.settings-page--bstatus .settings-card {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.settings-page--bstatus .settings-toolbar,
.settings-page--bstatus .settings-inline-form {
    flex: 0 0 auto;
}

.settings-page--bstatus .settings-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

/* Phasen-Gruppenköpfe in der Baustellen-Status-Liste (Stil wie Header-Menü-Gruppen) */
.settings-phase-group {
    margin: 10px 0 3px;
    padding: 6px 9px 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a6aab1;
}

.settings-phase-group:not(:first-child) {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f2;
}

/* Bestätigungs-Modal: Status per Drag in eine andere Phase gezogen.
   Status-Name + Von→Nach-Zeile sitzen mittig in einer abgesetzten Box. */
.settings-phasemove-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 4px auto 12px;
    padding: 14px 18px;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    background: #f5f5f7;
}

.settings-phasemove-name {
    font-size: 0.98rem;
    font-weight: 800;
    color: #16181c;
    text-align: center;
}

.settings-phasemove-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #a6aab1;
}

.settings-phasemove-badge {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border: 1px solid #e4e4e7;
    border-radius: 999px;
    background: #ffffff;
    color: #52525b;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.settings-phasemove-badge--neu {
    background: #16181c;
    border-color: #16181c;
    color: #ffffff;
}

.settings-phasemove-hint {
    margin: 0;
    text-align: center;
    font-size: 0.82rem;
    color: #80858d;
}

/* -- Delete dialog ----------------------------------------------------- */
.settings-delete-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.settings-delete-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 28, 30, 0.42);
    backdrop-filter: blur(2px);
    border: none;
    cursor: pointer;
}

.settings-delete-card {
    position: relative;
    width: min(420px, 100%);
    background: white;
    border-radius: 16px;
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.settings-delete-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid #efeff1;
    color: #e2483b;
}

.settings-delete-header h2 {
    margin: 0;
    color: #16181c;
    font-size: 1.1rem;
    font-weight: 800;
}

.settings-delete-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
}

.settings-delete-subject {
    margin: 0;
    color: #16181c;
    font-size: 1rem;
    font-weight: 700;
}

.settings-delete-cascade {
    margin: 0;
    color: #ff9500;
    font-size: 0.88rem;
    font-weight: 600;
    background: #fff7ed;
    border: 1px solid #ffe4c2;
    border-radius: 10px;
    padding: 9px 12px;
}

.settings-delete-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 6px 0 0;
}

.settings-delete-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(#e2483b calc(var(--pct, 0) * 1%), #efeff1 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.settings-delete-ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    background: white;
    border-radius: 50%;
}

.settings-delete-ring span {
    position: relative;
    color: #16181c;
    font-size: 1.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.settings-delete-hint {
    color: #3c4148;
    font-size: 0.86rem;
    font-weight: 600;
}

.settings-delete-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #efeff1;
    background: #fafafa;
}

/* -- Settings overview tiles ------------------------------------------ */
.settings-overview {
    max-width: 1020px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.settings-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: white;
    border: 1.5px solid #e4e4e7;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(28, 28, 30, 0.06);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
    cursor: pointer;
}

@media (hover: hover) {
    .settings-tile:hover {
        border-color: #16181c;
        transform: translateY(-2px);
        box-shadow: 0 18px 36px rgba(22, 24, 28, 0.12);
    }
}

.settings-tile-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #16181c;
    background: #efeff1;
}

.settings-tile-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-tile-title {
    color: #16181c;
    font-size: 1rem;
    font-weight: 800;
}

.settings-tile-desc {
    color: #3c4148;
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1.36;
}

.settings-tile-chevron {
    flex-shrink: 0;
    color: #cfd0d3;
    transition: transform 0.15s, color 0.15s;
}

@media (hover: hover) {
    .settings-tile:hover .settings-tile-chevron {
        color: #16181c;
        transform: translateX(2px);
    }
}

/* -- NumPad popup (global, used by Material & Lohn settings pages) ----- */
.np-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: transparent;
}

.np-popup {
    position: fixed;
    z-index: 301;
    background: white;
    border: 1.5px solid #e4e4e7;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    padding: 0 0 4px;
    display: flex;
    flex-direction: column;
    animation: settings-np-in 0.15s cubic-bezier(0.34, 1.3, 0.64, 1);
    width: 220px;
    height: 288px;
}

@keyframes settings-np-in {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* -- Responsive -------------------------------------------------------- */
@media (max-width: 720px) {
    .settings-page {
        padding: 16px 12px 48px;
    }

    /* Einheitliche Höhe für alle Form-Elemente (Tap-Target) */
    .settings-input,
    .settings-calc-preview,
    .settings-btn,
    .settings-btn--sm,
    .settings-toggle,
    .settings-toggle-wrap {
        height: 44px;
        min-height: 44px;
    }

    .settings-color-input {
        height: 44px;
        width: 44px;
    }


    .settings-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 14px;
    }

    .settings-header h1 {
        font-size: 1.42rem;
    }

    .settings-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .settings-counter {
        font-size: 0.78rem;
    }

    .settings-toolbar .settings-btn {
        width: 100%;
    }

    .settings-inline-form {
        padding: 12px 14px;
    }

    .settings-inline-form .settings-input--erp,
    .settings-inline-form .settings-input--flex {
        width: 100%;
        flex: 1 1 100%;
    }

    .settings-list {
        padding: 6px 6px;
        max-height: none;
    }

    /* Compact one-line row on phone */
    .settings-row {
        gap: 6px;
        padding: 8px 10px;
        flex-wrap: nowrap;
    }

    .settings-drag-handle {
        width: 28px;
        height: 28px;
    }

    .settings-row-action {
        width: 30px;
        height: 30px;
    }

    .settings-row-icon {
        width: 28px;
        height: 28px;
    }

    .settings-badge {
        height: 22px;
        min-width: 36px;
        padding: 0 7px;
        font-size: 0.72rem;
    }

    .settings-cost-badge,
    .settings-status-badge {
        height: 24px;
        padding: 0 8px;
        font-size: 0.74rem;
    }

    .settings-row-text,
    .settings-row-body .settings-row-name {
        font-size: 0.88rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .settings-row-body .settings-row-meta {
        font-size: 0.74rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .settings-row-nav-btn {
        gap: 8px;
    }

    /* Produkt-Form sinnvoll umbrechen */
    .settings-produkt-form {
        padding: 12px 14px;
    }

    .settings-produkt-nums-row {
        gap: 8px;
    }

    .settings-field-label {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .settings-field-label .settings-input--num,
    .settings-field-label .settings-unitsel {
        width: 100%;
    }

    /* Edit-Modus innerhalb der Liste */
    .settings-row--editing {
        padding: 12px;
        gap: 10px;
    }

    .settings-row--editing .settings-input--erp,
    .settings-row--editing .settings-input--flex {
        flex: 1 1 100%;
        width: 100%;
    }

    .settings-edit-actions {
        gap: 8px;
    }

    .settings-edit-actions .settings-btn {
        flex: 1;
    }

    /* Status-Form (Farbpicker + Presets) auf Mobile */
    .settings-color-input {
        flex-shrink: 0;
    }

    .settings-color-presets {
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    /* Delete dialog */
    .settings-delete-card {
        width: 100%;
    }

    /* Tiles / breadcrumb */
    .settings-overview {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .settings-row {
        gap: 4px;
        padding: 8px 8px;
    }

    .settings-drag-handle,
    .settings-row-icon {
        width: 26px;
        height: 26px;
    }

    .settings-row-action {
        width: 28px;
        height: 28px;
    }

    .settings-cost-badge,
    .settings-status-badge {
        display: none;
    }
}


/* ==============================================================
   Voreinstellungen (/settings/voreinstellungen)
   ============================================================== */

/* -- Listenzeile: Text + Wert-Chips -------------------------- */
.vst-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vst-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.vst-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 7px;
    background: #efeff1;
    color: #55555a;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.vst-chip--warn {
    background: #fdeaea;
    color: #b3261e;
}

/* Kompakt-Variante (z. B. Beschreibungs-Picker in /calc) */
.vst-chips--sm {
    gap: 3px;
}

.vst-chips--sm .vst-chip {
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
}

/* -- Editor-Modal --------------------------------------------- */
.vst-card {
    position: relative;
    width: min(560px, 100%);
    max-height: min(92vh, 92dvh);
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.26), 0 6px 14px -10px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.vst-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #efeff1;
    flex-shrink: 0;
    background: #ffffff;
}

.vst-head-ico {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: #efeff1;
    color: #3c4148;
}

.vst-head-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.vst-head-text h2 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    color: #16181c;
    line-height: 1.2;
}

.vst-head-text span {
    font-size: 0.76rem;
    font-weight: 600;
    color: #80858d;
}

.vst-card-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 9px;
    background: #efeff1;
    color: #55555a;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

@media (hover: hover) {
    .vst-card-close:hover {
        background: #e4e4e7;
        color: #16181c;
    }
}

.vst-card-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vst-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #efeff1;
    flex-shrink: 0;
}

.vst-card-actions .settings-btn {
    min-width: 110px;
}

/* -- Formular: Kicker + gruppierte Zeilen ----------------------- */
.vst-kicker {
    margin: 6px 4px 2px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #80858d;
}

.vst-kicker span {
    text-transform: none;
    letter-spacing: 0.01em;
    font-weight: 600;
}

.vst-group {
    display: flex;
    flex-direction: column;
}

.vst-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 8px 0;
}

.vst-line + .vst-line {
    border-top: 1px solid #f2f2f4;
}

.vst-line-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    cursor: pointer;
}

.vst-line-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #efeff1;
    color: #3c4148;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.vst-line:focus-within .vst-line-ico {
    background: #16181c;
    color: #ffffff;
}

.vst-line-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #16181c;
    white-space: nowrap;
}

.vst-line-value {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* Wert-Box: sichtbares Eingabefeld, feste Spaltenbreite → alle Werte fluchten */
.vst-value-box {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 260px;
    height: 40px;
    padding: 0 12px;
    background: #ffffff;
    border: 1.5px solid #e4e4e7;
    border-radius: 11px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* Menge/Einheit teilen sich die 260px-Spalte 50/50 (inkl. 8px Lücke) */
.vst-value-box--menge {
    width: 126px;
}

.vst-value-box:focus-within {
    border-color: #16181c;
    box-shadow: 0 0 0 3px rgba(22, 24, 28, 0.12);
}

.vst-value-box--text {
    flex: 1;
    width: auto;
    min-width: 0;
}

.vst-box-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0;
    text-align: right;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    color: #16181c;
    font-variant-numeric: tabular-nums;
    outline: none;
    cursor: pointer;
    caret-color: transparent;
}

.vst-box-input::placeholder {
    color: #c0c3c9;
    font-weight: 700;
}

.vst-box-input--text {
    text-align: left;
    font-weight: 700;
    font-variant-numeric: normal;
    cursor: text;
    caret-color: auto;
}

.vst-box-input--text::placeholder {
    font-weight: 600;
}

.vst-box-suffix {
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #80858d;
}

.vst-req {
    flex-shrink: 0;
    color: #e2483b;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
}

/* Einheit-Dropdown rechts neben der Menge (50%-Anteil der Wert-Spalte) */
.vst-line-unit {
    flex-shrink: 0;
    width: 126px;
}

/* Lager-/Leistung-Wähl-Button in der Zeile */
.vst-line-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid #e4e4e7;
    border-radius: 999px;
    background: #ffffff;
    color: #16181c;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 6px 18px -12px rgba(0, 0, 0, 0.22);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

@media (hover: hover) {
    .vst-line-pick:hover {
        background: #efeff1;
    }
}

.vst-line-pick:active {
    background: #16181c;
    border-color: #16181c;
    color: #ffffff;
}

/* Picker-Popup: fix am Button verankert, Koordinaten kommen aus C# (in den
   Viewport geklemmt). position:relative-Kontext für die internen mkp-Popups. */
.vst-picker-catcher {
    position: fixed;
    inset: 0;
    z-index: 10;
    background: transparent;
}

.vst-picker-popup {
    position: fixed;
    z-index: 11;
    background: white;
    border: 1px solid #e4e4e7;
    border-radius: 20px;
    box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.30), 0 6px 14px -10px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    animation: vst-pop-in 0.15s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes vst-pop-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* NumPad-Popup: globale .np-overlay/.np-popup (siehe oben) — kein eigener Stil nötig. */

/* -- Gewählte Referenz: schwarze Pill (aktiv-Zustand) ----------- */
.vst-ref-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    height: 32px;
    padding: 0 5px 0 12px;
    border-radius: 999px;
    background: #16181c;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
}

.vst-ref-pill--warn {
    background: #fbeae8;
    color: #e2483b;
}

.vst-ref-pill-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vst-ref-pill-cost {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.vst-ref-pill-x {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

@media (hover: hover) {
    .vst-ref-pill-x:hover {
        background: rgba(255, 255, 255, 0.32);
    }
}

.vst-ref-pill--warn .vst-ref-pill-x {
    background: rgba(226, 72, 59, 0.14);
}

@media (hover: hover) {
    .vst-ref-pill--warn .vst-ref-pill-x:hover {
        background: rgba(226, 72, 59, 0.26);
    }
}

@media (max-width: 640px) {
    .vst-line {
        flex-wrap: wrap;
    }

    .vst-line-value {
        flex: 1 1 100%;
    }

    .vst-value-box {
        width: auto;
        flex: 1;
        min-width: 0;
    }

    .vst-value-box--menge {
        flex: 7;
    }

    .vst-line-unit {
        flex: 3;
        width: auto;
    }
}
