/**
 * TaktFlo Design-System
 * Einheitliches modernes Design für alle Apps in Notenverwaltung.
 * Hintergrund/Header wie Scan-Drucker; Karten, Buttons, Inputs einheitlich.
 */

:root {
    /* Hintergrund & Header (wie Scan) */
    --ds-bg-gradient: linear-gradient(135deg, #4a5568 0%, #2d3748 50%, #1a202c 100%);
    --ds-header-bg: #4a5f7a;
    --ds-header-text: #ecf0f1;
    --ds-header-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    
    /* Karten (solid: vermeidet weißen Kasten bei Floating-Labels auf halbtransparentem Alt-Look) */
    --ds-surface: #f8f9fb;
    --ds-card-bg: var(--ds-surface);
    --ds-card-radius: 16px;
    --ds-card-shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 24px -4px rgba(0,0,0,0.12);
    --ds-card-border: 1px solid rgba(0,0,0,0.04);
    
    /* Typo */
    --ds-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --ds-text: #1e293b;
    --ds-text-muted: #64748b;
    --ds-label: #475569;
    
    /* Fluid Typography (skaliert mit Viewport) */
    --ds-font-size-base: clamp(0.75rem, 0.7rem + 0.35vw, 0.9375rem);
    --ds-font-size-lg: clamp(0.9375rem, 0.85rem + 0.45vw, 1.25rem);
    --ds-font-size-xl: clamp(1.1rem, 1rem + 0.55vw, 1.4rem);
    --ds-font-size-sm: clamp(0.7rem, 0.65rem + 0.2vw, 0.8125rem);
    --ds-page-header-title-mobile: 1.2rem;
    
    /* Fluid Spacing */
    --ds-spacing-sm: clamp(8px, 2vw, 12px);
    --ds-spacing-md: clamp(12px, 3vw, 24px);
    --ds-spacing-lg: clamp(18px, 4vw, 32px);
    
    /* Inputs */
    --ds-input-border: #e2e8f0;
    --ds-input-radius: 10px;
    --ds-input-focus: #3b82f6;
    --ds-focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.15);
    /* Standard-Eingaben (Optik wie Stück-Informationen) */
    --ds-field-border: #7891ac;
    --ds-field-border-width: 1.5px;
    --ds-field-bg: #ffffff;
    /* Floating-Label am Rahmen: Kartenfläche (Felder selbst bleiben weiß) */
    --ds-outlined-label-notch-bg: var(--ds-surface);
    --ds-field-font-size: 0.9375rem;
    --ds-field-line-height: 1.25;
    --ds-field-padding-y: 8px;
    --ds-field-padding-x: 10px;
    --ds-field-min-height: 44px;
    --ds-label-strong: #1a3347;
    --ds-label-soft: #4a5d6e;
    
    /* Buttons */
    --ds-btn-radius: 10px;
    --ds-primary: linear-gradient(180deg, #059669 0%, #047857 100%);
    --ds-primary-hover: linear-gradient(180deg, #10b981 0%, #059669 100%);
    --ds-primary-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
    --ds-danger: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    --ds-danger-hover: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
    --ds-danger-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
    --ds-neutral-bg: #f1f5f9;
    --ds-neutral-text: #475569;
    --ds-neutral-border: #e2e8f0;
    
    /* Modals */
    --ds-modal-backdrop: rgba(0,0,0,0.5);
    --ds-modal-blur: blur(4px);
}

/* Page load animation (wie Index-Seite) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal-Animation (wie Scan-Handy „Titel eingeben“) */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalSlideIn {
    from { transform: translateY(-30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes modalSlideInCentered {
    from { transform: translate(-50%, calc(-50% - 30px)) scale(0.95); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.content,
.ds-content,
.login-box,
.login-container {
    animation: fadeIn 0.6s ease-out;
}

/* Basis: Hintergrund (für Body/HTML wenn Klasse gesetzt) */
.ds-app,
body.ds-app {
    font-family: var(--ds-font);
    color: var(--ds-text);
    line-height: 1.6;
}
html.ds-app {
    background: var(--ds-bg-gradient);
    background-attachment: scroll;
    min-height: 100vh;
}
body.ds-app {
    background: transparent;
    margin: 0;
    padding: 0;
}

/* Obere Leiste – exakt wie TaktFlo */
/* Dunkelblaugrau #37475a, Höhe ~64–70px, Zurück-Button pillenförmig #5C748C */
.ds-header,
.page-header,
.page-header.ds-header {
    background: var(--ds-header-bg) !important;
    color: var(--ds-header-text) !important;
    padding: 0 24px !important;
    min-height: 64px !important;
    height: 64px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: relative !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    box-shadow: var(--ds-header-shadow) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
}
.ds-header h1,
.ds-header .ds-title,
.page-header h1,
.page-header.ds-header h1 {
    margin: 0 !important;
    font-size: 1.35rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em;
    color: var(--ds-header-text) !important;
    font-family: var(--ds-font);
}
/* Zurück-Button: exakt wie TaktFlo – auf ALLEN Seiten identisch */
/* Basis für jeden .back-button (Login, Header, etc.) */
a.back-button,
.back-button {
    display: inline-block !important;
    position: absolute !important;
    left: 24px !important;
    top: 24px !important;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 8px 24px !important;
    background: linear-gradient(180deg, #7690a8 0%, #627d9a 100%) !important;
    border: none !important;
    border-radius: 9999px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s !important;
    font-family: var(--ds-font) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
}
a.back-button:hover,
.back-button:hover {
    background: linear-gradient(180deg, #849ab0 0%, #6e8aa6 100%) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}
/* In page-header: vertikal zentrieren statt top:24px */
.page-header .back-button,
.ds-header .back-button,
.page-header.ds-header .back-button {
    top: 50% !important;
    transform: translateY(-50%) !important;
}
/* Logo rechts: nur das reine Logo, ohne Rahmen/Hintergrund */
.page-header .logo,
.ds-header .logo {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    max-height: 56px;
    max-width: 180px;
    height: auto;
    width: auto;
    background: transparent;
    padding: 0;
    box-sizing: content-box;
}

/* Inhalts-Karte */
.ds-card,
.content.ds-card,
.ds-content {
    background: var(--ds-card-bg) !important;
    border-radius: var(--ds-card-radius) !important;
    padding: var(--ds-spacing-lg) !important;
    max-width: 1100px;
    margin: 24px auto;
    box-shadow: var(--ds-card-shadow) !important;
    border: var(--ds-card-border) !important;
    box-sizing: border-box;
}

/* ========== Content-Box (zentral für alle Menüseiten) ==========
 * Basis-Klassen: .content.ds-content-width (auf allen Menüseiten)
 * Modifier: .ds-content-no-padding (Stimmenverwaltung: .window ist die weiße Box)
 * Modifier: .ds-content-flex (TaktFlo: flex-Layout für Karten)
 * Print: automatisch weißer Hintergrund, kein Schatten
 */
.page-header + .content,
body > .content,
.content.ds-content-width {
    width: 1100px !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 24px !important;
    margin-bottom: 24px !important;
    padding: 32px !important;
    box-sizing: border-box !important;
    background: var(--ds-card-bg) !important;
    border-radius: var(--ds-card-radius) !important;
    box-shadow: var(--ds-card-shadow) !important;
    border: var(--ds-card-border) !important;
}
/* Schmale Inhalts-Spalte (z. B. Kontoeinstellungen) */
.content.ds-content-width.ds-content-narrow {
    max-width: min(520px, 100%) !important;
    width: 100% !important;
}
.content.ds-content-width.ds-content-no-padding {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}
.content.ds-content-width.ds-content-flex {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}
/* Portal-Nav: Karten liegen in .ds-portal-page-body – gleicher Abstand wie ohne Nav */
.content.ds-content-width.ds-content-flex .ds-portal-page-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Print: Content-Box für Druck optimieren */
@media print {
    .content.ds-content-width {
        background: white !important;
        box-shadow: none !important;
    }
}

/* Kachel-Header: exakt gleiche Größe wie page-header (64px), gleiches Blau */
.kachel-header {
    margin: -24px -24px 20px -24px;
    padding: 0 24px;
    height: 64px !important;
    min-height: 64px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ds-header-bg) !important;
    color: var(--ds-header-text) !important;
    border-radius: 8px 8px 0 0;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.kachel-header .kachel-title,
.kachel-header .kachel-icon {
    color: var(--ds-header-text) !important;
}
.kachel-header .kachel-title {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.kachel-header .kachel-icon {
    font-size: 1.2rem;
}
.kachel-header .btn {
    color: #fff !important;
}

/* Karten-Titel & Text */
.ds-card-title {
    font-size: var(--ds-font-size-xl);
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}
.ds-card-subtitle {
    font-size: var(--ds-font-size-base);
    color: var(--ds-text-muted);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* Standard-Karte in Inhaltsbereichen */
.ds-section-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --ds-field-bg: #ffffff;
    --ds-outlined-label-notch-bg: #ffffff;
}

/* Scroll-Wrapper für Tabellen */
.ds-table-scroll {
    overflow-x: auto;
}

.ds-table-scroll-md {
    max-height: 400px;
    overflow-y: auto;
}

/* Seiten-Intro (Titel + Untertitel in Inhaltskarten) */
.ds-page-intro-title {
    font-family: var(--ds-font);
    font-size: 1.2rem;
    color: #0f172a;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.ds-page-intro-subtitle {
    font-family: var(--ds-font);
    font-size: 1rem;
    color: var(--ds-text-muted);
    font-weight: 400;
    margin: 0 0 20px 0;
}

/* Typography defaults for content areas */
.content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
    font-family: var(--ds-font);
    margin-bottom: 20px;
}
.content h3,
.print-area h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: #0f172a;
    font-family: var(--ds-font);
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}
.content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    font-family: var(--ds-font);
}

/* ds-card-title überschreibt Element-Styles – einheitliche Größe auf allen Seiten */
.content h2.ds-card-title,
.content h3.ds-card-title,
.container h2.ds-card-title,
.container h3.ds-card-title,
.print-area h2.ds-card-title,
.print-area h3.ds-card-title {
    font-size: var(--ds-font-size-xl);
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

/* ds-card-subtitle – einheitlicher Abstand zur Überschrift (6px von title margin-bottom) */
.content .ds-card-subtitle,
.container .ds-card-subtitle,
.print-area .ds-card-subtitle {
    margin: 0 0 24px 0;
}
.print-area > p,
.content > .print-area > p {
    font-size: 0.95rem;
    color: var(--ds-text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}
.content label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ds-label-strong);
    font-family: var(--ds-font);
}

/* Formulare */
.ds-form-group {
    margin-bottom: 20px;
}
.ds-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ds-label-strong);
    margin-bottom: 8px;
    display: block;
}
.ds-input,
.ds-select,
input.ds-input,
select.ds-input,
textarea.ds-input {
    width: 100%;
    padding: var(--ds-field-padding-y) var(--ds-field-padding-x);
    font-size: var(--ds-field-font-size);
    line-height: var(--ds-field-line-height);
    border: var(--ds-field-border-width) solid var(--ds-field-border);
    border-radius: var(--ds-input-radius);
    background: var(--ds-field-bg);
    color: var(--ds-text);
    font-family: var(--ds-font);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    min-height: var(--ds-field-min-height);
}
select.ds-input,
.ds-select {
    min-height: var(--ds-field-min-height);
}
textarea.ds-input {
    min-height: 6.5rem;
    resize: vertical;
}
.ds-input:focus,
.ds-select:focus,
textarea.ds-input:focus {
    outline: none;
    border-color: var(--ds-input-focus) !important;
    box-shadow: var(--ds-focus-ring) !important;
}

/**
 * Eingabe mit ×-Clear (ds-input-clear.js)
 * Wrapper relativ, Button absolut rechts in der Zeile — verhindert „× unter dem Feld“.
 */
.ds-input-with-clear {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.ds-input-with-clear input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ds-input-with-clear textarea {
    box-sizing: border-box;
    width: 100%;
    border: var(--ds-field-border-width) solid var(--ds-field-border);
    border-radius: var(--ds-input-radius);
    background: var(--ds-field-bg);
    color: var(--ds-text);
    font-family: var(--ds-font);
    font-size: var(--ds-field-font-size);
    line-height: var(--ds-field-line-height);
    min-height: var(--ds-field-min-height);
    padding: var(--ds-field-padding-y) 3.25rem var(--ds-field-padding-y) var(--ds-field-padding-x) !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ds-input-with-clear input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.ds-input-with-clear textarea:focus {
    outline: none;
    border-color: var(--ds-input-focus) !important;
    box-shadow: var(--ds-focus-ring) !important;
}
.ds-input-with-clear textarea {
    min-height: 6.5rem;
    resize: vertical;
}

/* display:inline-flex würde sonst [hidden] vom Button wirkungslos machen */
.ds-input-with-clear .ds-clear-btn[hidden] {
    display: none !important;
}

.ds-input-with-clear .ds-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 2.375rem;
    height: 2.375rem;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--ds-text-muted);
    font-size: 1.45rem;
    font-weight: 500;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: background 0.15s, color 0.15s;
}

.ds-input-with-clear .ds-clear-btn:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--ds-text);
}

.ds-input-with-clear .ds-clear-btn:focus-visible {
    outline: 2px solid var(--ds-input-focus);
    outline-offset: 2px;
}

/* Mehrzeilig: × oben rechts statt vertikal mittig */
.ds-input-with-clear:has(textarea) .ds-clear-btn {
    top: 10px;
    right: 8px;
    transform: none;
}

/* Notiz-Dialog: Rahmen am Wrapper, × innerhalb des Textfeld-Rahmens */
#noteBox .ds-input-with-clear {
    margin: 0 24px;
    width: calc(100% - 48px);
    box-sizing: border-box;
}

#noteBox .ds-input-with-clear #noteTextarea,
#noteBox .ds-input-with-clear textarea {
    margin: 0 !important;
    width: 100% !important;
    min-height: 200px;
    display: block;
}

/* Unbestimmter Fortschritt (z. B. PDF-Vorschau lädt) */
.ds-busy-block {
    margin-top: 12px;
    padding: 12px 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-sizing: border-box;
}
.ds-busy-block__text {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.45;
    margin: 0 0 10px 0;
}
.ds-indeterminate-bar {
    height: 5px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.ds-indeterminate-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(90deg, #93c5fd, #3b82f6, #93c5fd);
    animation: ds-indeterminate-slide 1.15s ease-in-out infinite;
}
@keyframes ds-indeterminate-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(280%); }
}

/* Buttons */
.ds-btn {
    border: none;
    border-radius: var(--ds-btn-radius);
    padding: var(--ds-spacing-sm) var(--ds-spacing-md);
    font-size: var(--ds-font-size-sm);
    font-weight: 600;
    font-family: var(--ds-font);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ds-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.ds-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ds-btn-primary {
    background: var(--ds-primary) !important;
    color: #fff !important;
    box-shadow: var(--ds-primary-shadow);
}
.ds-btn-primary:hover:not(:disabled) {
    background: var(--ds-primary-hover) !important;
}
.ds-btn-danger {
    background: var(--ds-danger) !important;
    color: #fff !important;
    box-shadow: var(--ds-danger-shadow);
}
.ds-btn-danger:hover:not(:disabled) {
    background: var(--ds-danger-hover) !important;
}
.ds-btn-secondary {
    background: var(--ds-neutral-bg);
    color: var(--ds-neutral-text);
    border: 1px solid var(--ds-neutral-border);
}
.ds-btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
    color: #0f172a;
}

/* Modals / Dialoge */
.ds-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ds-modal-backdrop);
    backdrop-filter: var(--ds-modal-blur);
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease-out;
}
.ds-modal-content {
    background: #fff;
    border-radius: var(--ds-card-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-width: min(92vw, 600px);
    max-height: 90vh;
    overflow: auto;
    border: var(--ds-card-border);
    animation: modalSlideIn 0.3s ease-out;
}
.ds-modal-header {
    background: transparent;
    color: var(--ds-text);
    padding: 20px 24px 12px;
    border-radius: var(--ds-card-radius) var(--ds-card-radius) 0 0;
}
.ds-modal-header h2,
.ds-modal-header h3 {
    margin: 0;
    font-size: var(--ds-font-size-lg);
    font-weight: 600;
    color: var(--ds-text);
}
.ds-modal-body {
    padding: var(--ds-spacing-lg);
}
.ds-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--ds-input-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Link-Karten (für Übersichtsseiten wie index.php) */
.ds-section {
    background: var(--ds-card-bg) !important;
    border-radius: var(--ds-card-radius) !important;
    padding: 32px !important;
    margin-bottom: 24px !important;
    box-shadow: var(--ds-card-shadow) !important;
    border: var(--ds-card-border) !important;
}
.ds-section h2 {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ds-input-border);
}
.ds-link-card {
    background: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--ds-input-border);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.ds-link-card:hover {
    background: #fff;
    border-color: #cbd5e1;
    box-shadow: var(--ds-card-shadow);
    transform: translateY(-2px);
}
.ds-link-card h3 {
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}
.ds-link-card .description {
    color: var(--ds-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* Tabellen (modern) */
.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}
.ds-table th,
.ds-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--ds-input-border);
}
.ds-table th {
    font-weight: 600;
    color: var(--ds-label);
    background: #f8fafc;
}
.ds-table tr:hover td {
    background: #f8fafc;
}
.ds-table-sticky-head th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ========== Tabs ========== */
.ds-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    border-bottom: 2px solid var(--ds-input-border);
    flex-wrap: wrap;
    padding-bottom: 0;
}
.ds-tab-button {
    padding: 12px 22px;
    background: transparent;
    color: var(--ds-text-muted);
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    margin-bottom: -2px;
}
.ds-tab-button:hover {
    color: var(--ds-text);
    background: rgba(59, 130, 246, 0.06);
}
.ds-tab-button.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: rgba(37, 99, 235, 0.06);
}

/* ========== Aliase: bestehende Klassen auf DS mappen ========== */

/* dialog-backdrop → DS Modal Backdrop */
.dialog-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--ds-modal-backdrop);
    backdrop-filter: var(--ds-modal-blur);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease-out;
}

/* besetzung-modal-* → DS Modal */
.besetzung-modal-content {
    position: relative;
    background: #fff;
    border-radius: var(--ds-card-radius) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: dsModalSlideIn 0.3s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    width: 90%;
    max-width: 800px;
    border: var(--ds-card-border);
}
.besetzung-modal-header {
    background: var(--ds-header-bg) !important;
    color: var(--ds-header-text) !important;
    padding: 18px 24px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    box-shadow: none;
    flex-shrink: 0;
    border-radius: var(--ds-card-radius) var(--ds-card-radius) 0 0;
}
.besetzung-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ds-header-text) !important;
    font-family: var(--ds-font);
}
.besetzung-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    font-family: var(--ds-font);
}
.besetzung-modal-body p {
    color: var(--ds-text-muted);
    margin-bottom: 20px;
    font-size: 1rem;
}
.besetzung-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--ds-input-border);
    background: #fff;
    flex-shrink: 0;
}

/* besetzung-btn → DS Buttons */
.besetzung-btn {
    border: none;
    border-radius: var(--ds-btn-radius) !important;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.besetzung-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.besetzung-btn.save {
    background: var(--ds-primary) !important;
    color: #fff !important;
    box-shadow: var(--ds-primary-shadow);
}
.besetzung-btn.save:hover {
    background: var(--ds-primary-hover) !important;
}
.besetzung-btn.cancel {
    background: var(--ds-neutral-bg) !important;
    color: var(--ds-neutral-text) !important;
    border: 1px solid var(--ds-neutral-border);
}
.besetzung-btn.cancel:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}
.besetzung-btn.delete {
    background: var(--ds-danger) !important;
    color: #fff !important;
    box-shadow: var(--ds-danger-shadow);
}
.besetzung-btn.delete:hover {
    background: var(--ds-danger-hover) !important;
}

@keyframes dsModalSlideIn {
    from { transform: translateY(-30px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* overwrite-dialog → DS Modal */
.overwrite-dialog {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: var(--ds-card-border);
    border-radius: var(--ds-card-radius) !important;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 10000;
    max-width: 500px;
    width: 90%;
    font-family: var(--ds-font);
    animation: modalSlideInCentered 0.3s ease-out;
}
.overwrite-dialog h3 {
    margin-top: 0;
    color: var(--ds-text);
    font-weight: 600;
}
.overwrite-dialog-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
}
.overwrite-dialog-btn {
    border: none;
    border-radius: var(--ds-btn-radius) !important;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    transition: transform 0.15s, box-shadow 0.15s;
}
.overwrite-dialog-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.overwrite-dialog-btn.view {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
    color: #fff !important;
}
.overwrite-dialog-btn.view:hover { background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%) !important; }
.overwrite-dialog-btn.cancel {
    background: var(--ds-neutral-bg) !important;
    color: var(--ds-neutral-text) !important;
    border: 1px solid var(--ds-neutral-border);
}
.overwrite-dialog-btn.cancel:hover { background: #e2e8f0 !important; }
.overwrite-dialog-btn.overwrite {
    background: var(--ds-danger) !important;
    color: #fff !important;
    box-shadow: var(--ds-danger-shadow);
}
.overwrite-dialog-btn.overwrite:hover { background: var(--ds-danger-hover) !important; }

/* print-hint-dialog → DS Modal */
.print-hint-dialog {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    color: var(--ds-text);
    border-radius: var(--ds-card-radius) !important;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 10001;
    min-width: 400px;
    max-width: 600px;
    overflow: hidden;
    border: var(--ds-card-border);
    font-family: var(--ds-font);
    animation: modalSlideInCentered 0.3s ease-out;
}
.print-hint-dialog-header {
    background: transparent !important;
    padding: 18px 24px;
    border-bottom: 1px solid var(--ds-input-border);
    border-radius: var(--ds-card-radius) var(--ds-card-radius) 0 0;
}
.print-hint-dialog-header h3 {
    margin: 0;
    color: var(--ds-text) !important;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--ds-font);
}
.print-hint-dialog-body {
    padding: 24px;
    color: var(--ds-text);
    line-height: 1.6;
}
.print-hint-dialog-body p {
    margin: 10px 0;
    color: var(--ds-text);
}
.print-hint-dialog-body .warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid #f59e0b;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.print-hint-dialog-body .warning-icon { font-size: 1.5rem; flex-shrink: 0; }
.print-hint-dialog-body .warning-text { flex: 1; font-weight: 600; color: #b45309; }
.print-hint-dialog-buttons {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--ds-input-border);
    background: #f8fafc;
}
.print-hint-dialog-buttons button {
    border: none;
    border-radius: var(--ds-btn-radius) !important;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    transition: transform 0.15s, box-shadow 0.15s;
}
.print-hint-dialog-buttons button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.print-hint-dialog-buttons .btn-ok {
    background: var(--ds-primary) !important;
    color: #fff !important;
    box-shadow: var(--ds-primary-shadow);
}
.print-hint-dialog-buttons .btn-ok:hover { background: var(--ds-primary-hover) !important; }
.print-hint-dialog-buttons .btn-cancel {
    background: var(--ds-neutral-bg) !important;
    color: var(--ds-neutral-text) !important;
    border: 1px solid var(--ds-neutral-border);
}
.print-hint-dialog-buttons .btn-cancel:hover { background: #e2e8f0 !important; }

/* progress-dialog → DS */
.progress-dialog {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: var(--ds-card-border);
    border-radius: var(--ds-card-radius) !important;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 10001;
    min-width: 400px;
    max-width: 600px;
    font-family: var(--ds-font);
    animation: modalSlideInCentered 0.3s ease-out;
}
.progress-dialog h3 {
    margin-top: 0;
    color: var(--ds-text);
    font-weight: 600;
}

/* Legacy button aliases → DS */
.upload-btn,
.print-btn,
.scanner-btn {
    border: none;
    border-radius: var(--ds-btn-radius) !important;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    color: #fff !important;
}
.upload-btn:hover,
.print-btn:hover,
.scanner-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.upload-btn,
.print-btn {
    background: var(--ds-primary) !important;
    box-shadow: var(--ds-primary-shadow);
}
.upload-btn:hover,
.print-btn:hover {
    background: var(--ds-primary-hover) !important;
}
.scanner-btn {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.scanner-btn:hover {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%) !important;
}

.remove-btn {
    background: var(--ds-danger) !important;
    color: #fff !important;
    border: none;
    padding: 6px 12px;
    border-radius: var(--ds-btn-radius) !important;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--ds-font);
    transition: transform 0.15s, box-shadow 0.15s;
}
.remove-btn:hover {
    background: var(--ds-danger-hover) !important;
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--ds-btn-radius) !important;
    font-family: var(--ds-font);
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* ========== Form aliases ========== */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--ds-label-strong);
    font-size: 0.875rem;
    font-family: var(--ds-font);
}
.form-group select,
.form-group input[type="text"],
.form-group input[type="search"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="datetime-local"],
.form-group input:not([type]),
.form-group textarea,
.input-field {
    width: 100%;
    padding: var(--ds-field-padding-y) var(--ds-field-padding-x);
    font-size: var(--ds-field-font-size);
    line-height: var(--ds-field-line-height);
    border: var(--ds-field-border-width) solid var(--ds-field-border);
    border-radius: var(--ds-input-radius) !important;
    background: var(--ds-field-bg);
    color: var(--ds-text);
    font-family: var(--ds-font);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    min-height: var(--ds-field-min-height);
}
.form-group textarea {
    min-height: 6.5rem;
    resize: vertical;
}
.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus,
.input-field:focus {
    outline: none;
    border-color: var(--ds-input-focus);
    box-shadow: var(--ds-focus-ring);
}

/* Upload area → DS */
.upload-area {
    border: 2px dashed var(--ds-input-border);
    border-radius: var(--ds-card-radius) !important;
    padding: 40px;
    text-align: center;
    background: #f8fafc;
    margin-bottom: 20px;
    transition: all 0.3s;
    cursor: pointer;
}
.upload-area:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.04);
}
.upload-area.dragover {
    border-color: #059669;
    background: rgba(5, 150, 105, 0.06);
}

/* Combobox → DS */
.combobox-dropdown {
    border: 1px solid var(--ds-input-border) !important;
    border-radius: 0 0 var(--ds-input-radius) var(--ds-input-radius) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
    background: #fff;
}
.combobox-option {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-family: var(--ds-font);
    transition: background 0.15s;
}
.combobox-option:hover {
    background: #f1f5f9;
}
.combobox-option.new-item {
    background: rgba(5, 150, 105, 0.08);
    font-weight: 600;
    color: #059669;
}
.combobox-option.new-item:hover {
    background: rgba(5, 150, 105, 0.14);
}

/* Status messages → DS */
.status-message {
    padding: 16px 20px;
    border-radius: var(--ds-input-radius);
    margin: 20px 0;
    display: none;
    white-space: pre-line;
    font-family: var(--ds-font);
}
.status-message.success {
    background: rgba(5, 150, 105, 0.08);
    color: #065f46;
    border: 1px solid rgba(5, 150, 105, 0.2);
    display: block;
}
.status-message.error {
    background: rgba(239, 68, 68, 0.08);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: block;
}

/* File list → DS */
.file-list {
    margin-top: 20px;
    padding: 16px;
    background: #fff;
    border-radius: var(--ds-input-radius);
    border: 1px solid var(--ds-input-border);
    max-height: 400px;
    overflow-y: auto;
}
.file-item {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--ds-font);
    transition: background 0.15s;
}
.file-item:hover {
    background: #f8fafc !important;
}
.file-item:last-child { border-bottom: none; }

/* Progress bar → DS */
.progress-bar-container {
    width: 100%;
    background: #f1f5f9;
    border-radius: var(--ds-input-radius);
    padding: 3px;
    margin: 20px 0;
}
.progress-bar {
    height: 28px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 8px;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: var(--ds-font);
}

/* ========== Responsive Breakpoints (480, 640, 768, 1024, 1200px) ========== */

/* 1200px: Desktop */
@media (max-width: 1200px) {
    .ds-card, .content.ds-card, .ds-content {
        max-width: 95%;
    }
    .page-header + .content,
    body > .content,
    .content.ds-content-width {
        width: min(1100px, 95vw) !important;
        max-width: 100% !important;
    }
}

/* 1024px: Laptop */
@media (max-width: 1024px) {
    .ds-section {
        padding: var(--ds-spacing-lg) !important;
    }
    .ds-link-card {
        padding: var(--ds-spacing-md);
    }
}

/* 768px: Tablet */
@media (max-width: 768px) {
    .ds-header, .page-header, .page-header.ds-header {
        padding: 0 16px !important;
        height: 60px !important;
        min-height: 60px !important;
    }
    .kachel-header {
        height: 60px !important;
        min-height: 60px !important;
        margin: -16px -16px 16px -16px;
        padding: 0 16px;
        border-radius: 6px 6px 0 0;
    }
    .ds-header .back-button, .ds-header .ds-back, .page-header .back-button {
        padding: 8px 16px;
        font-size: var(--ds-font-size-sm);
        left: 16px;
    }
    .ds-card, .content.ds-card, .ds-content {
        padding: var(--ds-spacing-md) !important;
        margin: var(--ds-spacing-md) auto;
    }
    .page-header + .content,
    body > .content,
    .content.ds-content-width {
        width: min(1100px, calc(100vw - 48px)) !important;
        max-width: 100% !important;
        margin-top: var(--ds-spacing-md) !important;
        margin-bottom: var(--ds-spacing-md) !important;
    }
    .content.ds-content-width:not(.ds-content-no-padding) {
        padding: var(--ds-spacing-md) !important;
    }
    .ds-modal-content {
        max-width: min(96vw, 600px);
    }
    .ds-modal-header, .ds-modal-body, .ds-modal-footer {
        padding: var(--ds-spacing-md);
    }
    .print-hint-dialog {
        min-width: 0;
        width: calc(100vw - 48px);
        max-width: calc(100vw - 48px);
    }
    .print-hint-dialog-header { padding: 12px 16px; }
    .print-hint-dialog-header h3 { font-size: 1rem; }
    .print-hint-dialog-body { padding: 12px 16px; }
    .print-hint-dialog-buttons { padding: 12px 16px; }
    .print-hint-dialog-buttons button { padding: 10px 16px; font-size: 0.875rem; }
}

/* 768px: Einheitliche Seitenüberschrift auf Mobil/Tablet */
@media (max-width: 768px) {
    .ds-header h1,
    .ds-header .ds-title,
    .page-header h1,
    .page-header.ds-header h1,
    body.has-portal-nav .page-header h1 {
        font-size: var(--ds-page-header-title-mobile) !important;
        font-weight: 600 !important;
        letter-spacing: -0.02em;
    }
}

/* 640px: Handy */
@media (max-width: 640px) {
    .page-header .logo, .ds-header .logo {
        max-height: 44px;
        max-width: 120px;
        right: 16px;
    }
    .ds-card-title,
    .content h2.ds-card-title,
    .content h3.ds-card-title,
    .container h2.ds-card-title,
    .container h3.ds-card-title,
    .print-area h2.ds-card-title,
    .print-area h3.ds-card-title {
        font-size: var(--ds-font-size-lg);
    }
    .ds-section h2 {
        font-size: var(--ds-font-size-lg);
        margin-bottom: var(--ds-spacing-md);
    }
    .ds-btn {
        min-height: 44px;
        min-width: 44px;
        padding: var(--ds-spacing-sm) var(--ds-spacing-md);
    }
}

/* 480px: Kleine Handys */
@media (max-width: 480px) {
    .ds-header, .page-header, .page-header.ds-header {
        padding: 0 10px !important;
        height: 56px !important;
        min-height: 56px !important;
    }
    .kachel-header {
        height: 56px !important;
        min-height: 56px !important;
        margin: -12px -12px 12px -12px;
        padding: 0 12px;
        border-radius: 6px 6px 0 0;
    }
    .ds-header .back-button, .ds-header .ds-back, .page-header .back-button {
        padding: 6px 12px;
        font-size: 0.85rem;
        left: 10px;
    }
    .ds-card, .content.ds-card, .ds-content {
        padding: var(--ds-spacing-sm) !important;
        margin: var(--ds-spacing-sm) auto;
    }
    .page-header + .content,
    body > .content,
    .content.ds-content-width {
        width: calc(100vw - 24px) !important;
        max-width: 100% !important;
        margin-top: var(--ds-spacing-sm) !important;
        margin-bottom: var(--ds-spacing-sm) !important;
    }
    .content.ds-content-width:not(.ds-content-no-padding) {
        padding: var(--ds-spacing-sm) !important;
    }
    .ds-modal-content {
        max-width: calc(100vw - 24px);
    }
}

/* ========== Portal Mobile: Kacheln, Tabellen, Modals ========== */

/* --- 768px: Tablet / schmales Fenster --- */
@media (max-width: 768px) {
    /* Kachel-Header: kompakte Zeile, nicht column */
    .ds-section-card > .kachel-header,
    .kachel-header {
        height: auto !important;
        min-height: 48px !important;
        padding: 10px 16px !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }
    .kachel-header .kachel-title {
        font-size: 1rem !important;
        gap: 8px !important;
    }
    .kachel-header .kachel-icon {
        font-size: 1rem !important;
    }
    /* Kachel-Header Buttons: NICHT volle Breite */
    .kachel-header .btn {
        width: auto !important;
        padding: 8px 14px !important;
        font-size: 0.85rem !important;
        min-height: 36px !important;
    }

    /* Tabellen: kompakt + horizontal scrollbar */
    .table-container,
    .ds-table-scroll {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .ds-table {
        font-size: 0.85rem !important;
    }
    .ds-table th,
    .ds-table td {
        padding: 8px 6px !important;
    }
    .ds-table th {
        font-size: 0.8rem !important;
    }

    /* Tabellen-Buttons: kompakter Icon-Button, NICHT volle Breite */
    .ds-table td .btn,
    .ds-table td .btn-icon-square,
    .ds-table td .btn-danger {
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
        font-size: 0.9rem !important;
    }
    .ds-table td .btn .btn-icon {
        font-size: 16px !important;
    }

    /* Besetzungs-/Zahleneingaben in Tabellen */
    .besetzung-input,
    .ds-table input[type="number"] {
        width: 52px !important;
        min-width: 52px !important;
        padding: 6px 8px !important;
        font-size: 0.85rem !important;
        min-height: 32px !important;
        height: 32px !important;
        text-align: center !important;
    }

    /* Volle Breite NUR für Formular-Aktionen */
    .upload-btn,
    .modal-actions > .btn,
    .modal-buttons > .btn,
    .modal-buttons > button,
    .modal-actions > button {
        width: 100% !important;
        min-height: 44px !important;
    }
    .modal-actions,
    .modal-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* Modals: weniger Padding, volle Breite */
    .modal .modal-content,
    .modal.modal-stueck-info .modal-content {
        width: 96vw !important;
        max-width: 96vw !important;
        padding: 20px 16px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    .modal .modal-header h2,
    .modal .modal-content h3 {
        font-size: 1.15rem !important;
    }

    /* Select + Plus-Button Zeile (Modal "Neue Stimme") */
    .select-plus-row {
        gap: 6px !important;
    }
    .select-plus-row .btn-plus,
    .btn-plus {
        width: 36px !important;
        min-width: 36px !important;
        height: 36px !important;
    }

    /* Outlined Fields in Modals kompakter */
    .modal .ds-outlined-group {
        gap: 14px !important;
    }
    .modal .ds-outlined-field input,
    .modal .ds-outlined-field select {
        font-size: 0.9rem !important;
        padding: 10px 12px !important;
        min-height: 40px !important;
    }

    /* Bestätigungs-Modals */
    .confirm-modal .ds-modal-content,
    .ds-modal-backdrop .ds-modal-content {
        width: 94vw !important;
        max-width: 94vw !important;
        padding: 20px 16px !important;
    }
    .ds-modal-footer {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .ds-modal-footer .ds-btn,
    .ds-modal-footer button {
        width: 100% !important;
    }

    /* Besetzung-Modal */
    .besetzung-modal-content {
        width: 94vw !important;
        max-width: 94vw !important;
        padding: 20px 16px !important;
    }
    .besetzung-modal-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .besetzung-modal-buttons button,
    .besetzung-btn {
        width: 100% !important;
    }
}

/* --- 480px: Kleine Smartphones --- */
@media (max-width: 480px) {
    .ds-section-card > .kachel-header,
    .kachel-header {
        min-height: 44px !important;
        padding: 8px 12px !important;
    }
    .kachel-header .kachel-title {
        font-size: 0.9rem !important;
        gap: 6px !important;
    }
    .kachel-header .btn {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
        min-height: 32px !important;
    }

    .ds-table {
        font-size: 0.78rem !important;
    }
    .ds-table th,
    .ds-table td {
        padding: 6px 4px !important;
    }
    .ds-table th {
        font-size: 0.72rem !important;
    }

    .ds-table td .btn,
    .ds-table td .btn-icon-square,
    .ds-table td .btn-danger {
        width: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
        height: 30px !important;
        min-height: 30px !important;
        border-radius: 6px !important;
    }
    .ds-table td .btn .btn-icon {
        font-size: 13px !important;
    }

    .besetzung-input,
    .ds-table input[type="number"] {
        width: 44px !important;
        min-width: 44px !important;
        padding: 4px 6px !important;
        font-size: 0.8rem !important;
        min-height: 28px !important;
        height: 28px !important;
    }

    .modal .modal-content,
    .modal.modal-stueck-info .modal-content {
        padding: 16px 12px !important;
    }
    .modal .modal-header h2,
    .modal .modal-content h3 {
        font-size: 1.05rem !important;
    }

    .modal .ds-outlined-field input,
    .modal .ds-outlined-field select {
        font-size: 0.85rem !important;
        padding: 8px 10px !important;
        min-height: 36px !important;
    }

    .select-plus-row .btn-plus,
    .btn-plus {
        width: 30px !important;
        min-width: 30px !important;
        height: 30px !important;
    }
    .btn-plus::before { width: 12px !important; }
    .btn-plus::after { height: 12px !important; }

    .upload-btn {
        padding: 10px 16px !important;
        font-size: 0.85rem !important;
        min-height: 40px !important;
    }
}

/* ========== Legacy .btn Aliase (für alle Bereiche) ========== */
.btn {
    border: none;
    border-radius: var(--ds-btn-radius) !important;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
}
.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background: var(--ds-primary) !important;
    color: #fff !important;
    box-shadow: var(--ds-primary-shadow);
}
.btn-primary:hover:not(:disabled) {
    background: var(--ds-primary-hover) !important;
}
.btn-success {
    background: var(--ds-primary) !important;
    color: #fff !important;
    box-shadow: var(--ds-primary-shadow);
}
.btn-success:hover:not(:disabled) {
    background: var(--ds-primary-hover) !important;
}
.btn-danger,
.btn-warning {
    background: var(--ds-danger) !important;
    color: #fff !important;
    box-shadow: var(--ds-danger-shadow);
}
.btn-danger:hover:not(:disabled),
.btn-warning:hover:not(:disabled) {
    background: var(--ds-danger-hover) !important;
}
.btn-secondary,
.btn-gray {
    background: var(--ds-neutral-bg) !important;
    color: var(--ds-neutral-text) !important;
    border: 1px solid var(--ds-neutral-border);
}
.btn-secondary:hover:not(:disabled),
.btn-gray:hover:not(:disabled) {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/**
 * Gedämpftes Rot, umrandet (z. B. PDF-Auswahl zurücksetzen) – kein Knallrot.
 * Größe wie Standard-.btn, Inhalt zentriert.
 */
.btn-outline-danger-soft {
    background: #fdf5f5 !important;
    color: #6b3030 !important;
    border: 2px solid #c47a7a !important;
    box-shadow: 0 2px 8px rgba(140, 70, 70, 0.14);
    font-weight: 600;
    justify-content: center;
    text-align: center;
    padding-left: 18px;
    padding-right: 18px;
}
.btn-outline-danger-soft:hover:not(:disabled) {
    background: #faeeee !important;
    color: #5a2828 !important;
    border-color: #a86666 !important;
    box-shadow: 0 3px 10px rgba(120, 60, 60, 0.18);
}
.btn-outline-danger-soft:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(168, 102, 102, 0.35), 0 2px 8px rgba(140, 70, 70, 0.14);
}

/* Durchsuchbare Combobox (z. B. Interpret/Genre/Schwierigkeit – Notenverwaltung, Stimmen zuordnen) */
.stueck-combobox {
    position: relative;
}
.stueck-combobox input[type="text"],
.stueck-combobox input:not([type]) {
    width: 100%;
    box-sizing: border-box;
    padding: var(--ds-field-padding-y) var(--ds-field-padding-x);
    font-size: var(--ds-field-font-size);
    line-height: var(--ds-field-line-height);
    font-family: var(--ds-font);
    color: var(--ds-text);
    background: var(--ds-field-bg);
    border-radius: var(--ds-input-radius);
    border: var(--ds-field-border-width) solid var(--ds-field-border);
    min-height: var(--ds-field-min-height);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.stueck-combobox input[type="text"]:focus,
.stueck-combobox input:not([type]):focus {
    outline: none;
    border-color: var(--ds-input-focus) !important;
    box-shadow: var(--ds-focus-ring) !important;
}

/* Combobox mit „Eingabe leeren“ (rechts im Feld, z. B. Stückname) — wie .ds-clear-btn */
.stueck-combobox.stueck-combobox--with-clear input[type="text"],
.stueck-combobox.stueck-combobox--with-clear input:not([type]) {
    padding-right: 3.25rem;
}
.stueck-combobox .ds-combobox-clear-btn[hidden] {
    display: none !important;
}
.stueck-combobox .ds-combobox-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    box-sizing: border-box;
    width: 2.375rem;
    height: 2.375rem;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--ds-text-muted, #64748b);
    font-size: 1.45rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    z-index: 6;
}
.stueck-combobox .ds-combobox-clear-btn:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--ds-text);
}
.stueck-combobox .ds-combobox-clear-btn:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus-ring);
}

.stueck-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 6px;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--ds-input-border);
    border-radius: var(--ds-input-radius);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    z-index: 1000;
}
.stueck-dropdown.open {
    display: block;
}
.stueck-dropdown .item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.15s, color 0.15s;
    font-size: 0.98rem;
    color: #2c3e50;
}
.stueck-dropdown .item:hover,
.stueck-dropdown .item.highlight {
    background: #eaf4fd;
    color: #154360;
}
.stueck-dropdown .item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}
.stueck-dropdown .item:first-child {
    border-radius: 8px 8px 0 0;
}
.stueck-dropdown .empty {
    padding: 16px;
    color: #7f8c8d;
    font-size: 0.9rem;
}
.stueck-dropdown .item.is-selected {
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 500;
}

/* Mehrfach-Genre: Chips über dem Suchfeld */
.ds-meta-multi-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 0;
}
.ds-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px 4px 10px;
    font-size: 0.85rem;
    line-height: 1.2;
    background: var(--ds-neutral-bg);
    color: var(--ds-neutral-text);
    border: 1px solid var(--ds-neutral-border);
    border-radius: 999px;
    max-width: 100%;
}
.ds-meta-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.ds-meta-chip-remove:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #b91c1c;
}

/* Combobox + grüner +-Button (Stück-Informationen): + vertikal zur Eingabe zentriert */
.select-plus-row {
    display: flex;
    gap: 5px;
    align-items: center;
}
.select-plus-row .btn-plus,
.ds-meta-combobox-row .btn-plus {
    margin-top: -2px;
}
.btn.btn-plus,
button.btn-plus {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0 !important;
    gap: 0 !important;
    border: none;
    background: var(--ds-primary) !important;
    color: transparent !important;
    border-radius: var(--ds-btn-radius);
    box-shadow: var(--ds-primary-shadow);
    font-size: 0 !important;
    line-height: 0 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
.btn.btn-plus::before,
.btn.btn-plus::after,
button.btn-plus::before,
button.btn-plus::after {
    content: '';
    position: absolute;
    background: #fff;
    border-radius: 1px;
}
.btn.btn-plus::before,
button.btn-plus::before {
    width: 14px;
    height: 2px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.btn.btn-plus::after,
button.btn-plus::after {
    width: 2px;
    height: 14px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.btn.btn-plus:hover:not(:disabled),
button.btn-plus:hover:not(:disabled) {
    background: var(--ds-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
/* Stück-Informationen: Abstand Überschrift → Felder (Floating-Labels ragen nach oben) */
.collapsible-header.collapsible-header--static:has(+ #metadataBody) {
    margin-bottom: 18px;
}
#metadataBody.collapsible-body.open {
    padding-top: 12px;
}

/* Stimmen zuordnen / Scan-Handy: Feld + Label-Notch = Kartenfläche (einheitlich, kein Kasten am Label) */
body:has(#metadataBody),
body.ds-gray-surface-fields {
    --ds-field-bg: var(--ds-card-bg);
    --ds-outlined-label-notch-bg: var(--ds-card-bg);
}
body:has(#metadataBody) .content.ds-content-width,
body:has(#metadataBody) .ds-portal-page-body,
body.ds-gray-surface-fields .content.ds-content-width,
body.ds-gray-surface-fields .ds-portal-page-body {
    --ds-field-bg: var(--ds-card-bg);
    --ds-outlined-label-notch-bg: var(--ds-card-bg);
}
/* Mit Portal-Nav: Inhaltsbereich wie Karte (sonst Verlauf sichtbar, Notch wirkt falsch) */
body:has(#metadataBody) .content.ds-portal-content-wrap .ds-portal-page-body {
    background: var(--ds-card-bg);
    border-radius: var(--ds-card-radius);
    box-shadow: var(--ds-card-shadow);
    border: var(--ds-card-border);
    box-sizing: border-box;
}

/* Notenverwaltung / Stück-Informationen: Feld + Label-Notch = Seitenfläche */
#stueck-info-display,
#stueck-info-tab .print-area {
    --ds-field-bg: var(--ds-card-bg);
    --ds-outlined-label-notch-bg: var(--ds-card-bg);
}
html.notenvw-stueck-info-tab-active .content.ds-content-width,
html.notenvw-stueck-info-tab-active .ds-portal-page-body,
html.ds-gray-surface-fields .content.ds-content-width,
html.ds-gray-surface-fields .ds-portal-page-body {
    --ds-field-bg: var(--ds-card-bg);
    --ds-outlined-label-notch-bg: var(--ds-card-bg);
}
html.notenvw-stueck-info-tab-active .content.ds-portal-content-wrap .ds-portal-page-body {
    background: var(--ds-card-bg);
    border-radius: var(--ds-card-radius);
    box-shadow: var(--ds-card-shadow);
    border: var(--ds-card-border);
    box-sizing: border-box;
}

/* Stimmen zuordnen & Co.: etwas mehr Abstand */
.ds-meta-combobox-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
/* Chips oberhalb, darunter nur Suchfeld + Button (Plus auf Input-Höhe) */
.ds-stueck-genre-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}
.ds-stueck-genre-stack .ds-meta-multi-chips {
    margin-bottom: 0;
}
.flex-shrink-0 {
    flex-shrink: 0;
}

/* Stück-Informationen: Zurück zur Stückliste („Stück wechseln“) */
#stueck-info-display button.stueck-info-zurueck.btn {
    margin: 0 0 20px 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
#stueck-info-display button.stueck-info-zurueck.btn:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus-ring), 0 1px 2px rgba(15, 23, 42, 0.06);
}
@media (max-width: 768px) {
    #stueck-info-display button.stueck-info-zurueck.btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========== Outlined Fields (global) + Floating-Label ========== */
.ds-modal-content,
.modal-content,
.progress-box,
.login-box,
.login-container {
    --ds-field-bg: #ffffff;
    /* Login-Karte: Label-Notch wie Kartenhintergrund (nicht graues --ds-surface) */
    --ds-outlined-label-notch-bg: #ffffff;
}

.ds-outlined-field {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    border: var(--ds-field-border-width) solid var(--ds-field-border);
    border-radius: var(--ds-input-radius);
    background: var(--ds-field-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: visible;
}
.ds-outlined-field:focus-within {
    border-color: var(--ds-input-focus);
    box-shadow: var(--ds-focus-ring);
}

/* Static: Label immer am Rahmen (z.B. Titel-Anzeige) */
.ds-outlined-field--static {
    padding: 9px 10px 5px;
}
.ds-outlined-field--static .ds-outlined-label {
    position: absolute;
    left: 8px;
    top: 0;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 5px;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--ds-label-strong);
    background: var(--ds-outlined-label-notch-bg);
    line-height: 1.15;
    z-index: 3;
    pointer-events: none;
    max-width: calc(100% - 24px);
}

/* Floating: Label mittig → bei Fokus/Inhalt am oberen Rand */
.ds-outlined-field--float {
    padding: 12px 10px 8px;
    min-height: 48px;
}
.ds-outlined-field--float .ds-outlined-label {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 5px;
    font-size: var(--ds-field-font-size);
    font-weight: 500;
    color: var(--ds-label-soft);
    background: transparent;
    line-height: 1.2;
    z-index: 3;
    pointer-events: none;
    max-width: calc(100% - 28px);
    transition:
        top 0.2s ease,
        transform 0.2s ease,
        font-size 0.2s ease,
        font-weight 0.2s ease,
        color 0.2s ease,
        background 0.2s ease;
}
/* Label oben: Fokus, Inhalt im sichtbaren Feld — nicht durch type=hidden (z. B. FK neben Combobox) triggern */
.ds-outlined-field--float:focus-within .ds-outlined-label,
.ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
.ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
/* Select: Label oben nur bei Fokus, bei gültig gewählter Option (z. B. required + nicht leer) oder Klasse has-value */
.ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
.ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
.ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--ds-label-strong);
    background: var(--ds-outlined-label-notch-bg);
}

/* Grauer Seitenhintergrund: Feldfläche + Label-Notch = --ds-card-bg (nicht in Modals) */
body:has(#metadataBody) .ds-outlined-field:not(.ds-section-card .ds-outlined-field):not(.stueck-info-kachel .ds-outlined-field):not(.modal .ds-outlined-field),
body.ds-gray-surface-fields .ds-outlined-field:not(.ds-section-card .ds-outlined-field):not(.stueck-info-kachel .ds-outlined-field):not(.modal .ds-outlined-field),
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field {
    background-color: var(--ds-card-bg, #f8f9fb) !important;
}
body:has(#metadataBody) .ds-outlined-field--static .ds-outlined-label,
body.ds-gray-surface-fields .ds-outlined-field--static .ds-outlined-label,
body:has(#metadataBody) .ds-outlined-field--float:focus-within .ds-outlined-label,
body.ds-gray-surface-fields .ds-outlined-field--float:focus-within .ds-outlined-label,
body:has(#metadataBody) .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
body.ds-gray-surface-fields .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
body.ds-gray-surface-fields .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
body.ds-gray-surface-fields .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
body:has(#metadataBody) .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
body.ds-gray-surface-fields .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label,
body.ds-gray-surface-fields .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label,
#stueck-info-display .ds-outlined-field--static .ds-outlined-label,
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field--static .ds-outlined-label,
#stueck-info-display .ds-outlined-field--float:focus-within .ds-outlined-label,
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field--float:focus-within .ds-outlined-label,
#stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
#stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
#stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
#stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
#stueck-info-display .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label,
html.ds-gray-surface-fields #stueck-info-display .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label {
    background-color: var(--ds-card-bg, #f8f9fb) !important;
    box-shadow: 0 0 0 4px var(--ds-card-bg, #f8f9fb) !important;
}
/* Weiße .ds-section-card (z. B. Stückliste): Feld + Notch bleiben weiß */
body:has(#metadataBody) .ds-section-card .ds-outlined-field,
body:has(#metadataBody) .stueck-info-kachel.ds-section-card .ds-outlined-field,
body.ds-gray-surface-fields .ds-section-card .ds-outlined-field,
body.ds-gray-surface-fields .stueck-info-kachel.ds-section-card .ds-outlined-field {
    --ds-field-bg: #ffffff;
    background-color: #ffffff !important;
}
body:has(#metadataBody) .ds-section-card .ds-outlined-field--static .ds-outlined-label,
body:has(#metadataBody) .ds-section-card .ds-outlined-field--float:focus-within .ds-outlined-label,
body:has(#metadataBody) .ds-section-card .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .ds-section-card .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .ds-section-card .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
body:has(#metadataBody) .ds-section-card .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .ds-section-card .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label,
.stueck-info-kachel.ds-section-card .ds-outlined-field--static .ds-outlined-label,
.stueck-info-kachel.ds-section-card .ds-outlined-field--float:focus-within .ds-outlined-label,
.stueck-info-kachel.ds-section-card .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
.stueck-info-kachel.ds-section-card .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
.stueck-info-kachel.ds-section-card .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label {
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px #ffffff !important;
}

.ds-outlined-label .ds-outlined-label-hint {
    font-weight: 500;
    color: #4a5663;
    font-size: 0.88em;
}
.ds-outlined-field--float:focus-within .ds-outlined-label .ds-outlined-label-hint,
.ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label .ds-outlined-label-hint,
.ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label .ds-outlined-label-hint {
    color: #4a5663;
}
.ds-outlined-slot {
    min-width: 0;
}
.ds-outlined-slot--static {
    font-weight: 700;
    color: var(--ds-text);
    padding: 0 2px;
    min-height: 1.25em;
    line-height: 1.25;
    font-size: var(--ds-field-font-size);
    background: transparent;
}

/* Innere Eingaben innerhalb outlined: kein Doppel-Rand */
.ds-outlined-field .ds-input-with-clear input[type="text"],
.ds-outlined-field .ds-input-with-clear input[type="search"],
.ds-outlined-field .ds-input-with-clear input[type="number"],
.ds-outlined-field .ds-input-with-clear input:not([type]),
.ds-outlined-field .stueck-combobox input[type="text"],
.ds-outlined-field .stueck-combobox input:not([type]),
.ds-outlined-field .ds-outlined-slot input,
.ds-outlined-field .ds-outlined-slot textarea {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 6px;
    font-size: var(--ds-field-font-size) !important;
    line-height: var(--ds-field-line-height) !important;
    min-height: 0 !important;
    padding: 6px 8px !important;
    width: 100%;
    font-family: var(--ds-font);
    color: var(--ds-text);
    appearance: none;
    -webkit-appearance: none;
}
/* type=search: keine eingebettete Lupen-/Kreis-Dekoration (WebKit/Blink) */
.ds-outlined-field .ds-outlined-slot input[type="search"]::-webkit-search-decoration,
.ds-outlined-field .ds-outlined-slot input[type="search"]::-webkit-search-cancel-button,
.ds-outlined-field .ds-outlined-slot input[type="search"]::-webkit-search-results-button,
.ds-outlined-field .ds-outlined-slot input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.ds-outlined-field .ds-input-with-clear {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.ds-outlined-field .ds-input-with-clear input {
    padding-right: 3.25rem !important;
}
.ds-outlined-field .ds-outlined-slot input:focus,
.ds-outlined-field .ds-outlined-slot input:focus-visible,
.ds-outlined-field .ds-outlined-slot textarea:focus,
.ds-outlined-field .ds-outlined-slot textarea:focus-visible,
.ds-outlined-field .ds-input-with-clear input:focus,
.ds-outlined-field .ds-input-with-clear input:focus-visible,
.ds-outlined-field .ds-input-with-clear textarea:focus,
.ds-outlined-field .ds-input-with-clear textarea:focus-visible,
.ds-outlined-field .stueck-combobox input:focus,
.ds-outlined-field .stueck-combobox input:focus-visible {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}
/* Schlägt .ds-input-with-clear input:not(...):focus (höhere Spezifität durch :not-Kette) — nur äußerer Outlined-Rahmen zeigt Fokus */
.ds-outlined-field .ds-input-with-clear input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.ds-outlined-field .ds-input-with-clear input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus-visible {
    outline: none !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* Notenverwaltung: Modals setzen .modal-content input mit hoher Spezifität → hier erzwingen nur einen Rahmen (Outlined außen) */
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot input[type="text"],
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot input[type="password"],
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot select {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin: 0 !important;
}
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot input[type="text"]:focus,
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot input[type="text"]:focus-visible,
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot input[type="password"]:focus,
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot input[type="password"]:focus-visible,
.modal.modal-stueck-info .modal-content .ds-outlined-field .ds-outlined-slot select:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}
.modal.modal-stueck-info .modal-content,
.modal .modal-content {
    --ds-field-bg: #ffffff;
    --ds-outlined-label-notch-bg: #ffffff;
}
.modal.modal-stueck-info .modal-content .ds-outlined-field,
.modal .modal-content .ds-outlined-field {
    background-color: #fff !important;
}
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field {
    background-color: #fff !important;
}
.modal.modal-stueck-info .modal-content .ds-outlined-field--static .ds-outlined-label,
.modal.modal-stueck-info .modal-content .ds-outlined-field--float:focus-within .ds-outlined-label,
.modal.modal-stueck-info .modal-content .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label,
.modal.modal-stueck-info .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:not(:placeholder-shown)) .ds-outlined-label,
.modal.modal-stueck-info .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
.modal.modal-stueck-info .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
.modal.modal-stueck-info .modal-content .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
.modal.modal-stueck-info .modal-content .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--static .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--float:focus-within .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:not(:placeholder-shown)) .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
body.ds-gray-surface-fields .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--static .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--float:focus-within .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--float.ds-outlined-field--has-value .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:is([type="text"], [type="search"], [type="number"], [type="email"], [type="tel"], [type="url"], [type="password"]):not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot input:not([type]):not(:placeholder-shown)) .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot select:valid) .ds-outlined-label,
body:has(#metadataBody) .modal .modal-content .ds-outlined-field--float:has(.ds-outlined-slot textarea:not(:placeholder-shown)) .ds-outlined-label {
    background-color: #fff !important;
    box-shadow: 0 0 0 5px #fff !important;
}

/* Kleine Dialoge „Stück-Info“ (z. B. Neue Stimmung, Schwierigkeitsgrad) – Maße/Abstände einheitlich */
.modal.modal-stueck-info {
    align-items: center;
    justify-content: center;
}
.modal.modal-stueck-info.active {
    display: flex !important;
    animation: modalFadeIn 0.2s ease-out;
}
.modal.modal-stueck-info .modal-content {
    padding: 20px 24px !important;
    border-radius: 12px;
    border: none !important;
    max-width: min(92vw, 500px);
    width: 90%;
    margin: 0 !important;
    position: relative;
    overflow: visible !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    background: #fff;
    box-sizing: border-box;
    animation: none;
}
.modal.modal-stueck-info.active .modal-content {
    animation: modalSlideIn 0.3s ease-out;
}
.modal.modal-stueck-info .modal-content h3 {
    background: none !important;
    background-color: transparent !important;
    color: #1e293b !important;
    padding: 0 !important;
    margin: 0 0 22px 0 !important;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: var(--ds-font);
}
.modal.modal-stueck-info .modal-content [id$="-error"] {
    margin: 0 0 8px 0 !important;
}
.modal.modal-stueck-info .modal-content .ds-input-with-clear input[type="text"] {
    margin-bottom: 0 !important;
}
.modal.modal-stueck-info .modal-content .ds-input-with-clear {
    margin-bottom: 8px;
}
.modal.modal-stueck-info .modal-buttons {
    border-top: none !important;
    padding: 0 !important;
    margin-top: 4px !important;
    gap: 10px;
    display: flex !important;
    justify-content: flex-end !important;
}
.modal.modal-stueck-info .modal-buttons button:first-child {
    background: var(--ds-primary) !important;
    box-shadow: var(--ds-primary-shadow);
    color: #fff !important;
    border: none !important;
    border-radius: var(--ds-btn-radius);
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.modal.modal-stueck-info .modal-buttons button:first-child:hover {
    background: var(--ds-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.modal.modal-stueck-info .modal-buttons button:last-child {
    background: var(--ds-neutral-bg) !important;
    color: var(--ds-neutral-text) !important;
    border: 1px solid var(--ds-neutral-border) !important;
    border-radius: var(--ds-btn-radius);
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--ds-font);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.modal.modal-stueck-info .modal-buttons button:last-child:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Stück-Info-Detail: schlägt ggf. .ds-input-with-clear:focus (Archivnummer, Länge, …) */
#stueck-info-display .ds-outlined-field .ds-input-with-clear input[type="text"]:focus,
#stueck-info-display .ds-outlined-field .ds-input-with-clear input[type="text"]:focus-visible {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}
.ds-outlined-field .ds-outlined-slot select {
    border: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    font-size: var(--ds-field-font-size) !important;
    font-family: var(--ds-font);
    color: var(--ds-text);
    padding: 4px 6px !important;
    padding-right: 28px !important;
    min-height: 0 !important;
    width: 100%;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.ds-outlined-field .ds-outlined-slot select:focus {
    outline: none !important;
    box-shadow: none !important;
}
.ds-outlined-field .select-plus-row {
    align-items: center;
    gap: 8px;
    margin: 0;
    width: 100%;
    min-width: 0;
}
.ds-outlined-field .select-plus-row .btn-plus {
    margin-top: 0;
}
/* Outlined-Felder mit Abstand in Formularen */
.ds-outlined-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}
/* Textarea in outlined fields: min-height, resize */
.ds-outlined-field .ds-outlined-slot textarea {
    min-height: 5rem;
    resize: vertical;
}
/* Outlined-field mit Combobox-Dropdown: z-index für Dropdown */
.ds-outlined-field .combobox-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 100;
}

/* ========== Button-Varianten ========== */

/* Icon-Button: quadratisch, z.B. für ✕, +, Pfeile */
.ds-btn-icon,
.btn-icon-square {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.15s;
}
.ds-btn-icon:hover:not(:disabled),
.btn-icon-square:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.ds-btn-icon.ds-btn-danger,
.btn-icon-square.btn-danger {
    background: var(--ds-danger) !important;
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.ds-btn-icon.ds-btn-danger:hover,
.btn-icon-square.btn-danger:hover {
    background: var(--ds-danger-hover) !important;
}
.ds-btn-icon.ds-btn-primary,
.btn-icon-square.btn-primary {
    background: var(--ds-primary) !important;
    color: #fff !important;
    box-shadow: var(--ds-primary-shadow);
}
.ds-btn-icon.ds-btn-primary:hover,
.btn-icon-square.btn-primary:hover {
    background: var(--ds-primary-hover) !important;
}
.ds-btn-icon.ds-btn-secondary,
.btn-icon-square.btn-secondary {
    background: var(--ds-neutral-bg);
    color: var(--ds-neutral-text);
    border: 1px solid var(--ds-neutral-border);
}
.ds-btn-icon.ds-btn-secondary:hover,
.btn-icon-square.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Größenvarianten */
.ds-btn-sm,
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
    border-radius: var(--ds-btn-radius);
}
.ds-btn-lg,
.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--ds-btn-radius);
}

/* Icon-Button klein (28×28) */
.ds-btn-icon-sm {
    width: 28px;
    min-width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

/* Icon-Button groß (44×44, Touch-tauglich) */
.ds-btn-icon-lg {
    width: 44px;
    min-width: 44px;
    height: 44px;
    font-size: 1.1rem;
}

/* Full-Width-Button */
.ds-btn-block,
.btn-block {
    width: 100%;
    justify-content: center;
}

/* ========== Tabellen-Erweiterungen ========== */

/* Alias: .overview-table → wie .ds-table */
.overview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    background: #fff;
}
.overview-table th,
.overview-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--ds-input-border);
}
.overview-table th {
    font-weight: 600;
    color: var(--ds-label);
    background: #f8fafc;
}
.overview-table tr:hover td {
    background: #f8fafc;
}

/* Tabellen-Badge (z.B. Seitenanzahl) */
.ds-badge,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
}
.ds-badge-success,
.badge-success,
.badge {
    background: #059669;
    color: #fff;
}
.ds-badge-danger,
.badge-danger {
    background: #ef4444;
    color: #fff;
}
.ds-badge-neutral,
.badge-neutral {
    background: var(--ds-neutral-bg);
    color: var(--ds-neutral-text);
    border: 1px solid var(--ds-neutral-border);
}

/* Status-Badge für Verein (z.B. Testphase in der Übersicht) */
.ds-status-badge-trialing {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    color: #fff;
    background: #dc2626;
    margin-left: 8px;
}
.ds-status-badge-grace {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    color: #fff;
    background: #d97706;
    margin-left: 8px;
}

/* ========== Alert / Hinweis-Boxen ========== */

.ds-alert,
.alert {
    padding: 12px 16px;
    border-radius: var(--ds-input-radius);
    font-size: 0.875rem;
    font-family: var(--ds-font);
    margin-bottom: 16px;
}
.ds-alert-success,
.alert-success,
.alert.success {
    background: rgba(5, 150, 105, 0.08);
    color: #065f46;
    border: 1px solid rgba(5, 150, 105, 0.2);
}
.ds-alert-error,
.alert-error,
.alert.error {
    background: rgba(239, 68, 68, 0.08);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.ds-alert-warning,
.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.ds-alert-info,
.alert-info {
    background: rgba(59, 130, 246, 0.08);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ========== Info-Box (neutraler Hintergrund für Zusammenfassungen) ========== */
.ds-info-box {
    background: var(--ds-neutral-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--ds-input-border);
    margin-bottom: 15px;
    font-size: 0.9375rem;
}

/* Schritt-Überschrift mit optionalem Info-Icon (z. B. Stimmen zuordnen) */
.ds-step-heading-with-help {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.ds-step-heading-with-help .ds-card-title {
    margin: 0;
}
.ds-info-icon-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: var(--ds-input-radius, 8px);
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.ds-info-icon-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.45);
}
.ds-info-icon-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.ds-info-icon-btn svg {
    display: block;
}

/* Icon-Buttons: Vorschau/Drehen (optional am Rand oder oberhalb des PDF) */
.ds-canvas-side-tools {
    position: absolute;
    top: 50%;
    right: clamp(6px, 1.2vw, 12px);
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 5;
    pointer-events: none;
}
/* Oberhalb des PDF, rechts neben/zur Zeile des Stücktitels */
.ds-canvas-side-tools.ds-canvas-side-tools--above-pdf {
    position: static;
    top: auto;
    right: auto;
    transform: none;
    flex-direction: row;
    flex-shrink: 0;
    z-index: auto;
    pointer-events: auto;
}
.ds-canvas-side-tools > * {
    pointer-events: auto;
}
.ds-canvas-tool-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--ds-input-border);
    border-radius: 10px;
    background: #fff;
    color: var(--ds-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.ds-canvas-tool-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.ds-canvas-tool-btn:focus-visible {
    outline: 2px solid var(--ds-input-focus);
    outline-offset: 2px;
}
.ds-canvas-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.ds-canvas-tool-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Modal: PDF-Seitenvorschau (nahezu vollflächig) */
.ds-pdf-zoom-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    box-sizing: border-box;
}
.ds-pdf-zoom-modal.is-open {
    display: flex;
}
.ds-pdf-zoom-modal__backdrop {
    position: absolute;
    inset: 0;
    background: var(--ds-modal-backdrop);
    backdrop-filter: var(--ds-modal-blur);
}
.ds-pdf-zoom-modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    border: none;
    padding: 0;
    box-sizing: border-box;
}
.ds-pdf-zoom-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 10px 14px;
    margin: 0;
    border-bottom: 1px solid var(--ds-input-border);
    background: #f8fafc;
}
.ds-pdf-zoom-modal__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ds-text);
}
.ds-pdf-zoom-modal__close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--ds-text);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ds-pdf-zoom-modal__close:hover {
    background: #e2e8f0;
}
.ds-pdf-zoom-modal__close:focus-visible {
    outline: 2px solid var(--ds-input-focus);
    outline-offset: 2px;
}
.ds-pdf-zoom-modal__canvas-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    background: #52525b;
    padding: 12px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}
.ds-pdf-zoom-modal__canvas-wrap canvas {
    max-width: none;
    width: auto;
    height: auto;
    display: block;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ========== Toolbar (Aktionsleisten) ========== */
.ds-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: var(--ds-input-radius);
    border: 1px solid var(--ds-input-border);
    margin-bottom: 12px;
}
.ds-toolbar-spacer {
    margin-left: auto;
}

/* ========== Setliste (Modal – nur Dirigent: Klick-Auswahl für +/−/Pfeile) ========== */
/* Gelbe Toolbar-Markierung nur bei .sl-setlist-dirigent (PHP setzt Klasse am #setlistBox) */
#setlistBox.sl-setlist-dirigent .sl-card.sl-selected:not(.sl-current) {
    background: #fef9c3 !important;
    border-color: #ca8a04 !important;
    border-width: 2px !important;
    box-shadow: 0 1px 4px rgba(202, 138, 4, 0.22);
}
#setlistBox.sl-setlist-dirigent .sl-card.sl-selected.sl-current {
    background: #d1fae5 !important;
    border-color: #047857 !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 3px #facc15, 0 2px 8px rgba(4, 120, 87, 0.2);
}

/* Setliste: Spalten weiß — Label-Notch wie Spalten-/Feldhintergrund (nicht graues --ds-surface) */
#setlistBox {
    --ds-field-bg: #ffffff;
    --ds-outlined-label-notch-bg: #ffffff;
}

/* Setliste: Suchfelder (verfügbar / aktuelle Liste) — kompakt; Floating-Label verhält sich wie global (--float mit 50 % Ruhe) */
#setlistBox .sl-setlist-search.ds-outlined-field--float {
    padding: 9px 10px 5px;
    min-height: 38px;
}
#setlistBox .sl-setlist-search.ds-outlined-field--float .ds-outlined-label {
    z-index: 5;
    font-size: 0.875rem;
}
#setlistBox .sl-setlist-search.ds-outlined-field .ds-input-with-clear input[type="search"],
#setlistBox .sl-setlist-search.ds-outlined-field .ds-outlined-slot input[type="search"] {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    line-height: 1.25 !important;
    font-size: 0.875rem !important;
}
/*
 * Links: #slAvailPanel overflow:hidden beschneidet das nach oben ragende Floating-Label.
 * Mindest-Innenabstand oben (wie .sl-list-header margin-bottom rechts ~8px);
 * keine doppelte Lücke zur Überschrift (TaktFlo .sl-avail-heading padding wird nur hier neutralisiert).
 */
#setlistBox .sl-avail-heading {
    padding-bottom: 0;
}
#setlistBox #slAvailPanel {
    padding-top: 8px;
    box-sizing: border-box;
}

/* Teilen-Button in Setlisten-Karten: Höhe wie linke Spalte (globaler .share-btn ist 44px hoch) */
#setlistBox .sl-share-compact {
    margin-left: 0;
    min-width: 0;
    width: 28px;
    height: 28px;
    max-height: 28px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    border-radius: 8px;
    flex-shrink: 0;
    box-sizing: border-box;
}
#setlistBox .sl-share-compact:hover:not(:disabled) {
    transform: translateY(-1px);
}
#setlistBox .sl-col.right .sl-btnwrap {
    min-width: 0;
    gap: 4px;
    align-items: center;
}
#setlistBox .sl-col.right .sl-card {
    padding: 6px 10px;
    padding-right: 8px;
    min-height: 0;
    align-items: center;
}
#setlistBox .sl-col.right .sl-title {
    margin-right: 6px;
}

/* Setlisten-Modal (Desktop): etwas hoeher, damit oben/unten weniger Rand bleibt */
#setlistBox.sl-box {
    height: 88vh !important;
    max-height: 94vh !important;
}

/* Setliste-Seite (mode=setliste): mittig, ohne Portal-Nav-Versatz */
body.setliste-mode #setlistOverlay {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
}
body.setliste-mode #setlistBox.sl-box {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Top-Reihe im Setlisten-Toolbar: GEMA/Schliessen kompakter */
#setlistBox .sl-toolbar-top-row .sl-toolbar-btn {
    padding: 3px 8px;
    font-size: 0.72rem;
    line-height: 1.1;
    min-height: 30px;
    border-radius: 8px;
}

/* Teilen-Button in rechter Setlisten-Spalte etwas breiter */
#setlistBox .sl-share-compact {
    width: 34px;
    min-width: 34px;
}

/* —— Linke Spalte: Archiv-Stück mit Meta (Länge, Genre …) für die Planung —— */
#setlistBox .sl-col.left .sl-card.sl-avail-item {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 8px 10px;
}
#setlistBox .sl-col.left .sl-card.sl-avail-item .sl-title {
    width: 100%;
    overflow-wrap: anywhere;
}
#setlistBox .sl-avail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px 10px;
    font-size: 0.72rem;
    line-height: 1.22;
    color: var(--ds-text-muted, #64748b);
}
#setlistBox .sl-avail-chip {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
#setlistBox .sl-avail-dur {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ds-text, #334155);
    flex-shrink: 0;
    max-width: 5rem;
}

/* Verfügbare Stücke: Meta-Filter (Genre, Schwierigkeit, Interpret) */
#setlistBox .sl-avail-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px 10px;
    align-items: end;
    margin-bottom: 8px;
    flex-shrink: 0;
}
#setlistBox .sl-avail-filter-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--ds-text-muted, #64748b);
    margin-bottom: 3px;
}
#setlistBox .sl-avail-filter-select {
    width: 100%;
    min-height: 34px;
    font-size: 0.8rem !important;
    box-sizing: border-box;
}
#setlistBox .sl-avail-filter-reset {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 0.74rem !important;
    line-height: 1.15;
    white-space: nowrap;
}

/*
 * Meta-Filter (Genre, Schwierigkeit, Interpret): immer per Taste aufklappbar.
 * Eingeklappt = Standard; display:none für Panel darf nicht nur in einem Breakpoint gelten —
 * sonst waren die Filter bei breiten Viewports trotz Klasse sichtbar und der Toggle war ausgeblendet.
 */
#setlistBox .sl-avail-filters-toggle {
    display: inline-flex;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 6px 0;
    min-height: 36px;
    font-size: 0.8rem !important;
    flex-shrink: 0;
    justify-content: center;
}
#setlistBox .sl-avail-filters.sl-avail-filters-panel--collapsed {
    display: none !important;
    margin-bottom: 0;
}

/* Tablet / schmale Fenster: 3-Spalten-Editor untereinander, Pfeil-Leiste mittig quer */
@media (max-width: 1024px) {
    /*
     * Wichtig: Keine kleinen max-vh-/px-Deckel auf den Listenzeilen –
     * Suche + Archivfilter würden die „Verfügbaren Stücke“-Liste fast vollständig verdrängen (iPad).
     * Gleiche Resthöhe per 1fr aufteilen, mit Mindesthöhe für Bedienbarkeit.
     */
    #setlistBox.sl-box {
        height: min(92dvh, 94vh) !important;
        max-height: min(92dvh, 94vh) !important;
    }

    #setlistBox.sl-box .sl-toolbar {
        padding: 8px 10px;
        margin-bottom: 8px;
    }

    #setlistBox.sl-box .sl-col {
        padding: 8px 10px;
    }

    #setlistBox.sl-box .sl-avail-heading {
        font-size: 0.9rem;
        padding-bottom: 2px;
        line-height: 1.25;
    }

    #setlistBox.sl-box .sl-grid:not(.edit-mode-off):not(.onecol) {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(200px, 1fr) auto minmax(200px, 1fr);
        gap: 8px;
    }

    #setlistBox.sl-box .sl-grid:not(.edit-mode-off):not(.onecol) .sl-actions {
        position: relative;
        width: 100%;
        min-width: unset;
        min-height: 0;
        padding: 0;
    }

    #setlistBox.sl-box .sl-grid:not(.edit-mode-off):not(.onecol) .sl-actions-fixed {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        width: 100%;
        gap: 6px;
    }

    #setlistBox.sl-box .sl-grid:not(.edit-mode-off):not(.onecol) .sl-actions .sl-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        font-size: 1.1rem;
    }

    #setlistBox .sl-avail-filters {
        grid-template-columns: 1fr 1fr;
        gap: 5px 8px;
        margin-bottom: 5px;
    }

    #setlistBox .sl-avail-filter-label {
        font-size: 0.62rem;
        margin-bottom: 2px;
    }

    #setlistBox .sl-avail-filter-select {
        min-height: 30px;
        font-size: 0.78rem !important;
    }

    #setlistBox .sl-avail-filter-reset {
        min-height: 30px;
        padding: 4px 8px;
        font-size: 0.71rem !important;
    }

    #setlistBox .sl-avail-filter-field--interpret {
        grid-column: 1 / -1;
    }

    #setlistBox .sl-avail-filter-reset {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    /* Suchfelder linker/rechter Bereich weniger Luft → mehr für .sl-scroll */
    #setlistBox #slAvailPanel .sl-search {
        margin-bottom: 6px !important;
        padding: 8px 12px;
        font-size: 0.875rem !important;
    }

    #setlistBox #slAvailPanel .sl-setlist-search.ds-outlined-field--float {
        padding: 6px 8px 4px;
        margin-bottom: 4px !important;
        min-height: 34px;
    }

    #setlistBox #slAvailPanel .sl-setlist-search.ds-outlined-field--float .ds-outlined-label {
        font-size: 0.78rem !important;
    }

    /* Rechte Spalte: Headline + Floating-Suche ebenfalls dichter */
    #setlistBox .sl-col.right .ds-outlined-field--float.sl-setlist-search {
        padding: 6px 8px 4px;
        margin-bottom: 8px !important;
        min-height: 34px;
    }

    #setlistBox #slAvailPanel {
        padding-top: 6px !important;
    }
}

/* ========== Hilfsklassen ========== */

.ds-text-muted { color: var(--ds-text-muted); }
.ds-text-center { text-align: center; }
.ds-text-right { text-align: right; }
.ds-mt-0 { margin-top: 0; }
.ds-mt-1 { margin-top: 8px; }
.ds-mt-2 { margin-top: 16px; }
.ds-mt-3 { margin-top: 24px; }
.ds-mb-0 { margin-bottom: 0; }
.ds-mb-1 { margin-bottom: 8px; }
.ds-mb-2 { margin-bottom: 16px; }
.ds-mb-3 { margin-bottom: 24px; }
.ds-p-0 { padding: 0; }
.ds-p-1 { padding: 8px; }
.ds-p-2 { padding: 16px; }
.ds-flex { display: flex; }
.ds-flex-col { flex-direction: column; }
.ds-flex-wrap { flex-wrap: wrap; }
.ds-gap-1 { gap: 8px; }
.ds-gap-2 { gap: 16px; }
.ds-gap-3 { gap: 24px; }
.ds-items-center { align-items: center; }
.ds-justify-between { justify-content: space-between; }
.ds-justify-end { justify-content: flex-end; }
.ds-justify-center { justify-content: center; }
.ds-w-full { width: 100%; }
.ds-hidden { display: none; }

/* ========== Bestätigungsmodal (z. B. Stück löschen) ========== */
.ds-confirm-message-wrap {
    margin: 0 0 var(--ds-spacing-md, 16px) 0;
    text-align: left;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--ds-text);
}
.ds-confirm-intro {
    margin: 0 0 var(--ds-spacing-sm, 12px) 0;
}
ul.ds-confirm-list {
    margin: 0;
    padding-left: 1.35rem;
    list-style-type: disc;
}
ul.ds-confirm-list li {
    margin-bottom: 0.4rem;
}
ul.ds-confirm-list li:last-child {
    margin-bottom: 0;
}

/* Startseite: Feedback-Kachel (nur bei Abo „Testphase“ / trialing sichtbar) */
a.link-card.link-card--feedback-trial {
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fbbf24;
    color: inherit;
}
a.link-card.link-card--feedback-trial:hover {
    border-color: #f59e0b;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.2);
}
a.link-card.link-card--feedback-trial h3 {
    color: #78350f;
}
a.link-card.link-card--feedback-trial .description {
    color: #92400e;
}
a.link-card.link-card--has-notify {
    position: relative;
}
a.link-card.link-card--has-notify::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    left: auto;
    bottom: auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 2px #fff;
    opacity: 1;
    pointer-events: none;
    z-index: 2;
}

/* TaktFlo: Haupt-/Unterstimme – Custom-Dropdown öffnet immer nach unten (native <select> nicht steuerbar) */
.ds-select-facade {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}
select.ds-select-facade-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
button.ds-select-facade-trigger {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    text-align: left;
    cursor: pointer;
    font-family: var(--ds-font, system-ui, sans-serif);
    font-size: var(--ds-field-font-size);
    line-height: var(--ds-field-line-height);
    color: var(--ds-text, #1e293b);
    background: var(--ds-field-bg);
    border: var(--ds-field-border-width) solid var(--ds-field-border);
    border-radius: var(--ds-input-radius);
    padding: var(--ds-field-padding-y) 36px var(--ds-field-padding-y) var(--ds-field-padding-x) !important;
    min-height: var(--ds-field-min-height);
    transition: border-color 0.2s, box-shadow 0.2s;
}
button.ds-select-facade-trigger:focus-visible {
    outline: none;
    border-color: var(--ds-input-focus);
    box-shadow: var(--ds-focus-ring);
}
button.ds-select-facade-trigger::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top: -3px;
    border: solid #64748b;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
}
.ds-select-facade-trigger {
    position: relative;
    padding-right: 36px !important;
}
.ds-select-facade-panel {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    max-height: min(260px, 45vh);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--ds-field-bg);
    border: var(--ds-field-border-width) solid var(--ds-field-border);
    border-radius: var(--ds-input-radius, 10px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    z-index: 10050;
    text-align: left;
}
.ds-select-facade-panel.is-open {
    display: block;
}
.ds-select-facade-option {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-family: var(--ds-font, system-ui, sans-serif);
    color: var(--ds-text, #1e293b);
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}
.ds-select-facade-option:last-child {
    border-bottom: none;
}
.ds-select-facade-option:hover,
.ds-select-facade-option:focus {
    outline: none;
    background: #eaf4fd;
}
.ds-select-facade-option.is-active {
    background: #e8f4fd;
    font-weight: 500;
}

/* Übersicht: Mitgliedskonto + Zahnrad Kontoeinstellungen */
.header-card-member-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.header-card-settings-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #475569;
    text-decoration: none;
    line-height: 0;
    transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.header-card-settings-gear svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    display: block;
}
.header-card-settings-gear:hover {
    background: linear-gradient(180deg, #eff6ff 0%, #e0f2fe 100%);
    color: #2563eb;
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}
.header-card-settings-gear:focus-visible {
    outline: 2px solid var(--ds-input-focus, #3b82f6);
    outline-offset: 2px;
}

/* Login-Seite: TaktFlo-Maskottchen über den Eingabefeldern */
.ds-login-brand {
    text-align: center;
    margin: 0 0 22px 0;
}
.ds-login-brand img {
    display: block;
    width: min(200px, 92%);
    max-height: 150px;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

/* ========== Eingaben: Placeholder + Combobox-Suche (greift auch bei späteren Seiten-Styles) ========== */
input::placeholder,
textarea::placeholder {
    color: var(--ds-label-soft);
    opacity: 1;
}

.combobox-container.ds-input-with-clear > input[type="text"],
.combobox-container.ds-input-with-clear > input:not([type]) {
    border: var(--ds-field-border-width) solid var(--ds-field-border) !important;
    border-radius: var(--ds-input-radius) !important;
    background: var(--ds-field-bg) !important;
    color: var(--ds-text) !important;
    font-family: var(--ds-font) !important;
    font-size: var(--ds-field-font-size) !important;
    line-height: var(--ds-field-line-height) !important;
    min-height: var(--ds-field-min-height) !important;
    padding: var(--ds-field-padding-y) 3.25rem var(--ds-field-padding-y) var(--ds-field-padding-x) !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}
.combobox-container.ds-input-with-clear > input[type="text"]:focus,
.combobox-container.ds-input-with-clear > input:not([type]):focus {
    outline: none !important;
    border-color: var(--ds-input-focus) !important;
    box-shadow: var(--ds-focus-ring) !important;
}

/* ========== Stabile Viewport-Höhe (iOS Safari) ========== */
html.ds-app {
    min-height: calc(var(--app-vh, 1vh) * 100);
}
.besetzung-modal-content {
    max-height: calc(var(--app-vh, 1vh) * 90);
}
.ds-pdf-zoom-modal__panel {
    max-height: calc(var(--app-vh, 1vh) * 100);
}

/* ========== Touch-Geräte (kein Hover, grober Zeiger) ========== */
@media (hover: none), (pointer: coarse) {
    button,
    a,
    label,
    .btn,
    .ds-btn,
    .besetzung-btn,
    .voice-checkbox-item,
    .voice-group-header,
    .voice-selection-action-btn,
    .ds-portal-nav-link,
    .overwrite-dialog-btn,
    .print-hint-dialog-buttons button {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .btn:hover:not(:disabled),
    .ds-btn:hover:not(:disabled),
    .besetzung-btn:hover:not(:disabled),
    .overwrite-dialog-btn:hover,
    .print-hint-dialog-buttons button:hover {
        transform: none !important;
        box-shadow: none !important;
    }

    .btn:active:not(:disabled),
    .ds-btn:active:not(:disabled),
    .besetzung-btn:active:not(:disabled) {
        opacity: 0.8;
        transition: opacity 0.1s;
    }

    .besetzung-modal-buttons,
    .ds-modal-footer {
        padding-bottom: max(env(safe-area-inset-bottom), 12px);
    }
}

/* Portal-Seitenleiste: includes/portal_nav.css */
