/* ==========================================================================
   myVoTUM Design System
   TUM-konforme Farben, Typografie, Tokens & UI-Komponenten
   ========================================================================== */

:root {
    /* --- FARBEN / COLOR TOKENS --- */
    --primary: #0065BD;             /* TUM Blau */
    --primary-dark: #003359;        /* TUM Dunkelblau */
    --background: #F5F7FA;          /* Hintergrund */
    --surface: #FFFFFF;             /* Karten & Kacheln */
    --text-primary: #263238;        /* Haupttext */
    --text-secondary: #64748B;      /* Sekundärtext / Hilfetexte */
    --border: #E2E8F0;              /* Dezente Rahmen */
    --success: #16803C;             /* Erfolgsmeldungen */
    --error: #D9534F;               /* Fehler */

    /* Abgeleitete Hilfsfarben */
    --primary-hover: #005293;
    --border-hover: #CBD5E1;
    --success-light: #E8F5E9;
    --error-light: #FEECEB;

    /* --- TYPOGRAFIE TOKENS --- */
    --font-family: 'TUM Neue Helvetica', 'Arial', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;

    /* Seitentitel: 28px, font-weight 700 */
    --font-size-page-title: 28px;
    --font-weight-page-title: 700;

    /* Abschnittstitel: 18px, font-weight 600 */
    --font-size-section-title: 18px;
    --font-weight-section-title: 600;

    /* Unterüberschriften: 16px, font-weight 600 */
    --font-size-subheading: 16px;
    --font-weight-subheading: 600;

    /* Formularlabels: 14px, font-weight 600 */
    --font-size-form-label: 14px;
    --font-weight-form-label: 600;

    /* Buttons: 14px */
    --font-size-button: 14px;

    /* Eingabetexte: 14px */
    --font-size-input-text: 14px;
    --font-weight-input-text: 400;

    /* Hilfetexte: 12px */
    --font-size-help-text: 12px;
    --font-weight-help-text: 400;

    /* Standard Body */
    --font-size-body: 14px;
    --line-height-body: 1.5;

    /* --- ABSTÄNDE / SPACING SCALE --- */
    --spacing-xxs: 4px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;

    /* --- BORDER RADIUS & DEZENTE RAHMEN --- */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Globale Basisstile & Typografie
   ========================================================================== */

html, body {
    font-family: var(--font-family) !important;
    font-size: var(--font-size-body) !important;
    line-height: var(--line-height-body) !important;
    color: var(--text-primary) !important;
    background-color: var(--background) !important;
    margin: 0 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .page-title {
    font-family: var(--font-family) !important;
    font-size: var(--font-size-page-title) !important;
    font-weight: var(--font-weight-page-title) !important;
    line-height: 1.25 !important;
    color: var(--primary-dark) !important;
    margin-top: 0 !important;
    margin-bottom: var(--spacing-md) !important;
    letter-spacing: -0.2px;
}

h2, .section-title, legend, .table-header {
    font-family: var(--font-family) !important;
    font-size: var(--font-size-section-title) !important;
    font-weight: var(--font-weight-section-title) !important;
    line-height: 1.35 !important;
    color: var(--primary-dark) !important;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

h3, .subheading {
    font-family: var(--font-family) !important;
    font-size: var(--font-size-subheading) !important;
    font-weight: var(--font-weight-subheading) !important;
    line-height: 1.4 !important;
    color: var(--text-primary) !important;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

h4 {
    font-family: var(--font-family) !important;
    font-size: var(--font-size-subheading) !important;
    font-weight: var(--font-weight-subheading) !important;
    line-height: 1.4 !important;
    color: var(--primary-dark) !important;
    border-left: 3px solid var(--primary);
    padding-left: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

h5, h6 {
    font-family: var(--font-family) !important;
    font-size: var(--font-size-body) !important;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
    margin-bottom: var(--spacing-xxs);
}

p {
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-input-text);
    line-height: var(--line-height-body);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
}

.intro-lead {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}

p.bold {
    font-weight: 600;
}

.text-muted, small, .help-block {
    font-size: var(--font-size-help-text) !important;
    font-weight: var(--font-weight-help-text) !important;
    color: var(--text-secondary) !important;
    line-height: 1.45;
}

label, .control-label, .vote-form-label, legend.control-legend {
    font-size: var(--font-size-form-label) !important;
    font-weight: var(--font-weight-form-label) !important;
    color: var(--text-primary) !important;
    line-height: 1.4;
    display: inline-block;
    margin-bottom: var(--spacing-xxs);
}

input, textarea, select, .form-control {
    font-family: var(--font-family);
    font-size: var(--font-size-input-text) !important;
    color: var(--text-primary) !important;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

ul {
    list-style: square;
    margin: 0 0 var(--spacing-md) 1.4em;
    padding: 0;
}

li {
    line-height: 1.6;
    margin-bottom: var(--spacing-xxs);
}

.logo {
    max-height: 70px;
    margin-bottom: var(--spacing-md);
}

/* ==========================================================================
   Home & Info-Karten
   ========================================================================== */

.home-container {
    max-width: 100%;
}

.home-intro-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-subtle);
}

.home-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.home-info-item {
    font-size: var(--font-size-body);
    line-height: 1.5;
    color: var(--text-secondary);
}

.home-info-item strong {
    color: var(--primary-dark);
    display: block;
    margin-bottom: 2px;
}

.votings-section {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.home-actions {
    margin-top: var(--spacing-lg);
}

/* ==========================================================================
   Overview Header & Metadata Card
   ========================================================================== */

.overview-header-container {
    margin-bottom: var(--spacing-lg);
}

.voting-title-highlight {
    color: var(--primary);
}

.overview-header-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    box-shadow: var(--shadow-subtle);
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.overview-description {
    font-size: var(--font-size-body);
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.overview-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-body);
    color: var(--text-secondary);
    background-color: #F8FAFC;
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: var(--radius-md);
}

.meta-item strong {
    color: var(--primary-dark);
    font-weight: 600;
}

.meta-icon {
    font-size: 16px;
}

.meta-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: var(--font-size-help-text);
    font-weight: 600;
    border-radius: var(--radius-sm);
    background-color: var(--text-secondary);
    color: #FFFFFF;
}

/* ==========================================================================
   Alerts & Feedback-Meldungen
   ========================================================================== */

.error-message, .success-message, .selection_limit_exception {
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: var(--font-size-body);
    font-weight: 500;
    line-height: 1.45;
    margin: 12px 0;
}

.success-message {
    background-color: var(--success-light);
    border: 1px solid var(--success);
    color: var(--success);
}

.error-message, .selection_limit_exception {
    background-color: var(--error-light);
    border: 1px solid var(--error);
    color: var(--error);
}

/* ==========================================================================
   Einheitliches Button-System
   Deform vergibt automatisch: 1. Button -> .btn-primary, weitere -> .btn-default
   ========================================================================== */

button,
.btn,
a.button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    font-family: var(--font-family);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    font-size: var(--font-size-button);
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

/* 1. Primary Button: TUM-Blau (Speichern, Anlegen, Senden, Abstimmen)
      a.button: Links auf der Logout-Seite von pyramid_mytum */
.btn-primary,
a.button {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #FFFFFF !important;
    font-weight: 600 !important;
    padding: 10px 24px !important;
    box-shadow: 0 2px 4px rgba(0, 101, 189, 0.25) !important;
    transition: all 0.15s ease !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 10px rgba(0, 101, 189, 0.35) !important;
    transform: translateY(-1px);
}

.btn-primary:active {
    background-color: #004070 !important;
    border-color: #004070 !important;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 101, 189, 0.2) !important;
}

/* 2. Secondary / Default Button: Dezenter Rahmen (Abbrechen, Datei auswählen) */
.btn-default {
    background-color: var(--surface) !important;
    border: 1px solid var(--border-hover) !important;
    color: var(--text-primary) !important;
    font-weight: 500 !important;
    padding: 10px 20px !important;
    transition: all 0.15s ease !important;
}

.btn-default:hover,
.btn-default:focus {
    background-color: #F8FAFC !important;
    border-color: #94A3B8 !important;
    color: #0F172A !important;
    transform: translateY(-1px);
}

.btn-default:active {
    background-color: #F1F5F9 !important;
    transform: translateY(0);
}

/* 3. Formular-Aktionen („Speichern“, „Abbrechen“ etc.) */
.deform-form-buttons,
.form-actions {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin-top: 20px !important;
    margin-bottom: 0 !important;
    padding-top: 16px !important;
    border-top: 1px solid var(--border) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Letzte Formulargruppe (in der Regel die Button-Leiste) */
.deform .form-group:last-child {
    margin-top: 20px !important;
    padding-top: 16px !important;
    border-top: 1px solid var(--border) !important;
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    margin-bottom: 0 !important;
}

.deform-form-buttons button,
.form-actions button,
.form-actions a.btn {
    margin-right: 0 !important;
    margin-bottom: 0 !important;
}

/* ==========================================================================
   Deform Formulare & Kompaktes 1-Seiten Layout
   ========================================================================== */

.voting-form-container {
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
    padding: 0 12px;
    box-sizing: border-box;
}

.voting-form-header {
    margin-bottom: var(--spacing-sm);
}

.voting-form-header h1 {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: var(--primary-dark) !important;
    margin: 0 0 4px 0 !important;
    letter-spacing: -0.2px;
}

.voting-form-header p.text-muted {
    font-size: var(--font-size-body);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}

.voting-form-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 10px 20px -10px rgba(0, 101, 189, 0.05);
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.voting-section-header {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 18px 0 10px 0 !important;
    padding-bottom: 6px !important;
    border-bottom: 2px solid var(--border) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.voting-section-header:first-of-type,
.voting-section-header-1 {
    margin-top: 0 !important;
}

.voting-section-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--primary-dark) !important;
    margin: 0 !important;
    line-height: 1.3 !important;
    letter-spacing: -0.1px !important;
    text-transform: none !important;
}

.deform fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.deform .form-group fieldset {
    margin: 0 !important;
    padding: 0 !important;
}

.deform legend {
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

.deform .form-group,
.deform .mb-3 {
    margin-bottom: 12px;
}

.deform legend.control-legend,
.deform label.form-label,
.deform label.control-label {
    border: none;
    padding: 0;
    margin-bottom: 6px;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    line-height: 1.35;
    display: block;
}

/* Standard Inputs & Textarea */
.deform input[type="text"],
.deform input[type="number"],
.deform input[type="email"],
.deform textarea,
.deform select,
.form-control {
    width: 100%;
    height: 38px;
    padding: 7px 12px;
    font-size: var(--font-size-body);
    font-family: inherit;
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-md);
    line-height: 1.45;
    background-color: #FFFFFF;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.deform input[type="text"]:focus,
.deform input[type="number"]:focus,
.deform input[type="email"]:focus,
.deform textarea:focus,
.deform select:focus,
.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 101, 189, 0.12);
}

.deform textarea {
    height: auto;
    min-height: 72px;
    resize: vertical;
    padding: 8px 12px;
}

.deform input.is-invalid,
.deform textarea.is-invalid,
.deform select.is-invalid,
.deform .has-error .form-control {
    border-color: var(--error) !important;
    background-color: var(--error-light);
}

.deform input.is-invalid:focus,
.deform textarea.is-invalid:focus,
.deform select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.2) !important;
}

/* Hilfe-Texte unter Feldern */
.help-block,
.form-text {
    margin-top: 4px;
    margin-bottom: 0;
    font-size: var(--font-size-help-text) !important;
    color: var(--text-secondary) !important;
    line-height: 1.4;
}

.deform .has-error .help-block[id^="error-"],
.deform .error-msg,
.invalid-feedback,
.live-validation-message {
    color: var(--error) !important;
    font-size: var(--font-size-help-text);
    font-weight: 500;
}

/* ==========================================================================
   Radio-Buttons & Checkboxen (.form-check, .radio, .checkbox)
   ========================================================================== */

.deform .form-check,
.deform .radio,
.deform .checkbox {
    display: flex !important;
    align-items: flex-start !important;
    gap: 9px !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    padding: 7px 11px !important;
    background-color: #F8FAFC !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.deform .form-check:last-child,
.deform .radio:last-child,
.deform .checkbox:last-child {
    margin-bottom: 0 !important;
}

.deform .form-check:hover,
.deform .radio:hover,
.deform .checkbox:hover {
    background-color: #F1F5F9 !important;
    border-color: var(--border-hover) !important;
}

.deform .form-check:has(input:checked),
.deform .radio:has(input:checked),
.deform .checkbox:has(input:checked) {
    background-color: #F0F6FC !important;
    border-color: var(--primary) !important;
}

/* Input steht links oben, Text läuft bündig darunter weiter */
.deform input[type="radio"],
.deform input[type="checkbox"],
.deform .form-check-input {
    flex: 0 0 16px !important;
    width: 16px !important;
    height: 16px !important;
    margin: 2px 0 0 0 !important;
    padding: 0 !important;
    position: static !important;
    cursor: pointer !important;
    accent-color: var(--primary) !important;
    align-self: flex-start !important;
}

.deform .form-check-label,
.deform .radio label,
.deform .checkbox label {
    display: block !important;
    width: 100% !important;
    flex: 1 1 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 13.5px !important;
    font-weight: 400 !important;
    color: var(--text-primary) !important;
    line-height: 1.45 !important;
    cursor: pointer !important;
    text-align: left !important;
}

.deform .form-check:has(input:checked) .form-check-label,
.deform .radio:has(input:checked) label,
.deform .checkbox:has(input:checked) label {
    font-weight: 500 !important;
    color: #0F172A !important;
}

/* ==========================================================================
   Auswahllimits (Min / Max) – item_css_class='myvotum-limit-field'
   ========================================================================== */

.myvotum-limit-field {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    height: 100% !important;
    box-sizing: border-box !important;
    background-color: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 11px 13px !important;
    margin-bottom: 0 !important;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.myvotum-limit-field:focus-within {
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 3px rgba(0, 101, 189, 0.08);
}

.myvotum-limit-field label,
.myvotum-limit-field .form-label {
    order: 1 !important;
    color: var(--primary-dark) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    display: block !important;
}

.deform .myvotum-limit-field input,
.myvotum-limit-field .form-control {
    order: 2 !important;
    max-width: 140px !important;
    height: 38px !important;
    padding: 6px 10px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    border: 1px solid var(--border-hover) !important;
    border-radius: var(--radius-md) !important;
    background-color: #FFFFFF !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.deform .myvotum-limit-field input:focus,
.myvotum-limit-field .form-control:focus {
    border-color: var(--primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(0, 101, 189, 0.12) !important;
}

.myvotum-limit-field .form-text,
.myvotum-limit-field .help-block {
    order: 3 !important;
    margin-top: 6px !important;
    margin-bottom: 0 !important;
    font-size: var(--font-size-help-text) !important;
    color: var(--text-secondary) !important;
    line-height: 1.4 !important;
}

.myvotum-limit-field .invalid-feedback,
.myvotum-limit-field .live-validation-message {
    order: 4 !important;
    margin-top: 4px !important;
    margin-bottom: 0 !important;
}

/* ==========================================================================
   Datum & Zeit – item_css_class='myvotum-datetime'
   ========================================================================== */

.myvotum-datetime {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    height: 100% !important;
    box-sizing: border-box !important;
    background-color: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 11px 13px !important;
    margin-bottom: 0 !important;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.myvotum-datetime:focus-within {
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 3px rgba(0, 101, 189, 0.08);
}

.myvotum-datetime label,
.myvotum-datetime .form-label {
    order: 1 !important;
    color: var(--primary-dark) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    display: block !important;
}

.myvotum-datetime .input-group,
.myvotum-datetime .row {
    order: 2 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
    border-radius: var(--radius-md) !important;
}

.myvotum-datetime [class*="col-"] {
    flex: 1 1 180px;
    min-width: 0;
    padding: 0;
}

.myvotum-datetime .input-group-text,
.myvotum-datetime .input-group-addon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 10px !important;
    height: 38px !important;
    border: 1px solid var(--border-hover) !important;
    border-right: none !important;
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
    background-color: #F1F5F9 !important;
    color: var(--text-secondary) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
}

.myvotum-datetime input[type="date"],
.myvotum-datetime input[type="time"] {
    height: 38px !important;
    padding: 4px 8px !important;
    border: 1px solid var(--border-hover) !important;
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
    font-weight: 500 !important;
    font-size: 13.5px !important;
    background-color: #FFFFFF !important;
    box-sizing: border-box !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease !important;
    margin: 0 !important;
}

.myvotum-datetime input[type="date"] {
    flex: 1.3 1 125px !important;
    min-width: 115px !important;
}

.myvotum-datetime input[type="time"] {
    flex: 1 1 85px !important;
    min-width: 75px !important;
}

.myvotum-datetime input[type="date"]:focus,
.myvotum-datetime input[type="time"]:focus {
    border-color: var(--primary) !important;
    outline: none !important;
    z-index: 3 !important;
    box-shadow: 0 0 0 3px rgba(0, 101, 189, 0.12) !important;
}

.myvotum-datetime .form-text,
.myvotum-datetime .help-block {
    order: 3 !important;
    margin-top: 6px !important;
    margin-bottom: 0 !important;
    font-size: var(--font-size-help-text) !important;
    color: var(--text-secondary) !important;
    line-height: 1.4 !important;
}

.myvotum-datetime .invalid-feedback,
.myvotum-datetime .live-validation-message {
    order: 4 !important;
    margin-top: 4px !important;
    margin-bottom: 0 !important;
}

/* ==========================================================================
   2-Spalten Grid im Formular (Optionen, Limits & Datum nebeneinander)
   ========================================================================== */

@media (min-width: 768px) {
    .voting-form-card fieldset {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        column-gap: 16px !important;
        row-gap: 12px !important;
        align-items: stretch !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    /* Standard: jedes Element über die volle Breite */
    .voting-form-card fieldset > * {
        grid-column: 1 / -1 !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin-bottom: 0 !important;
    }

    .voting-form-card legend {
        width: 100% !important;
    }

    /* 2-Spalten Anordnung für Optionen, Limits und Datum */
    .voting-form-card .item-visibility,
    .voting-form-card .item-voting_conditions,
    .voting-form-card .item-checkbox_flags,
    .voting-form-card .item-votes_cast,
    .voting-form-card .myvotum-limit-field,
    .voting-form-card .myvotum-datetime {
        grid-column: span 1 !important;
    }
}

/* ==========================================================================
   Datei-Upload (deform file_upload)
   ========================================================================== */

.myvotum-file-upload-wrapper,
.deform .myvotum-file-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 6px;
}

.myvotum-file-control-group,
.deform .myvotum-file-control-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.myvotum-file-btn,
.deform .myvotum-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background-color: var(--surface-hover, #f0f4f8) !important;
    color: var(--text-primary, #333) !important;
    border: 1px solid var(--border, #ccc) !important;
    border-radius: var(--radius-sm, 4px) !important;
    transition: all 0.2s ease;
    margin-bottom: 0 !important;
    user-select: none;
}

.myvotum-file-btn:hover,
.deform .myvotum-file-btn:hover {
    background-color: var(--border, #e2e8f0) !important;
    border-color: #a0aec0 !important;
}

.myvotum-file-placeholder,
.deform .myvotum-file-placeholder {
    font-size: 13px;
    color: var(--text-secondary, #666);
    word-break: break-all;
}

.myvotum-file-input-hidden,
.deform .myvotum-file-input-hidden {
    display: none !important;
    position: absolute !important;
    width: 0.1px !important;
    height: 0.1px !important;
    opacity: 0 !important;
    overflow: hidden !important;
    z-index: -1 !important;
}

.myvotum-file-input,
.deform .myvotum-file-input {
    font-size: var(--font-size-body, 14px);
    color: var(--text-primary);
    cursor: pointer;
}

.myvotum-file-status,
.deform .myvotum-file-status {
    margin-top: 2px;
}

.myvotum-file-info,
.deform .myvotum-file-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: var(--surface-hover, #f0f4f8);
    border: 1px solid var(--border, #d2d6dc);
    border-radius: var(--radius-sm, 4px);
    font-size: 13px;
    color: var(--text-primary);
}

.myvotum-file-info.myvotum-file-selected,
.deform .myvotum-file-info.myvotum-file-selected {
    background-color: #EBF8FF;
    border-color: #BEE3F8;
    color: #2B6CB0;
}

.myvotum-file-label,
.deform .myvotum-file-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.myvotum-file-selected .myvotum-file-label,
.deform .myvotum-file-selected .myvotum-file-label {
    color: #2B6CB0;
}

.myvotum-file-name,
.deform .myvotum-file-name {
    word-break: break-all;
    font-weight: 600;
}

/* ==========================================================================
   Deform Sequence / Optionen-Verwaltung
   ========================================================================== */

.deform .deform-seq-item {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 20px;
    padding: 12px 14px;
    box-shadow: var(--shadow-subtle);
    transition: all 0.2s ease;
}

/* Dezente abwechselnde Hintergrundfarben zur klaren visuellen Unterscheidung */
.deform .deform-seq-item:nth-child(even) {
    background-color: #F8FAFC;
}

.deform .deform-seq-item:nth-child(odd) {
    background-color: var(--surface);
}

.deform .deform-seq-item:hover {
    border-color: var(--border-hover);
    border-left-color: var(--primary-hover);
    box-shadow: 0 3px 8px rgba(0, 101, 189, 0.08);
}

.deform .deform-seq-item .form-group:last-child {
    border-top: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.deform .deform-seq-item .col-md-2 {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* ==========================================================
   Terminabstimmung: Datum links, Zeitraum rechts
   ========================================================== */

.deform .deform-seq-item .card-body:has(> .item-date) {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
}

.deform .deform-seq-item .card-body:has(> .item-date) > .item-date,
.deform .deform-seq-item .card-body:has(> .item-date) > .card {
    flex: 1 1 240px;
    min-width: 0;
    margin-bottom: 0 !important;
}

.deform .deform-seq-item .card-body:has(> .item-date) > .card > .card-header:empty {
    display: none;
}

.deform .deform-seq-item .card-body:has(> .item-date) > .card > .card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0;
}

.deform .deform-seq-item .item-start_time,
.deform .deform-seq-item .item-end_time {
    flex: 1 1 100px;
    min-width: 0;
    margin-bottom: 0 !important;
}

/* Eingabefelder vollständig an die verfügbare Breite anpassen */
.deform .deform-seq-item .card-body:has(> .item-date) .form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Bildabstimmung: Bildname links, Dateiauswahl rechts */
.deform .deform-seq-item .card-body:has(> .item-picture_path) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
}

.deform .deform-seq-item .card-body:has(> .item-picture_path) > .item-title,
.deform .deform-seq-item .card-body:has(> .item-picture_path) > .item-picture_path {
    flex: 1 1 240px;
    min-width: 0;
    margin-bottom: 0;
}

/* Beschriftungen der drei Felder */
.deform .deform-seq-item .item-date .form-label,
.deform .deform-seq-item .item-start_time .form-label,
.deform .deform-seq-item .item-end_time .form-label {
    margin-bottom: 6px;
    font-weight: 500;
    line-height: 1.4;
    display: block;
}

/* Pflichtfeld-Kennzeichnung (*) in Rot für alle Deform-Formulare */
.deform label.form-label:has(~ input[required])::after,
.deform label.form-label:has(~ select[required])::after,
.deform label.form-label:has(~ textarea[required])::after,
.deform label.form-label:has(+ input[required])::after,
.deform label.form-label:has(+ select[required])::after,
.deform label.form-label:has(+ textarea[required])::after,
.deform label.form-label:has(~ .input-group input[required])::after {
    content: ' *';
    color: var(--error, #D9534F) !important;
    font-weight: bold;
}

.deform .panel-footer {
    background-color: transparent;
    border-top: none;
    padding: 8px 0 16px 0;
    margin-top: 8px;
}

/* Button: Option hinzufügen */
.deform .deform-seq-add {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 16px !important;
    background-color: var(--surface) !important;
    border: 1px solid var(--primary) !important;
    border-radius: var(--radius-md) !important;
    color: var(--primary) !important;
    font-size: var(--font-size-button) !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.deform .deform-seq-add::before {
    content: "+" !important;
    display: inline-block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.deform .deform-seq-add small {
    font-size: var(--font-size-button) !important;
    font-weight: 600 !important;
    color: inherit !important;
}

.deform .deform-seq-add:hover,
.deform .deform-seq-add:focus {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0, 101, 189, 0.25) !important;
}

/* Sequence Drag & Drop (jquery-sortable) */
body.dragging, body.dragging * {
    cursor: move !important;
}

.deform .deform-seq-container .dragged {
    position: absolute;
    opacity: 0.85;
    z-index: 2000;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.15));
    background-color: var(--surface);
    pointer-events: none;
}

.deform .deform-seq-container .placeholder {
    position: relative;
    background: var(--surface-hover, #f0f4f8);
    border: 2px dashed var(--primary, #0065BD);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    min-height: 48px;
    display: block;
}

/* Sequence Control Icons (Reihenfolge & Löschen) */
.deform .deform-order-button {
    cursor: move;
    color: var(--text-secondary);
    padding: 4px 8px;
    margin-right: 6px;
    background: transparent;
    border: none;
    transition: color 0.15s ease, background-color 0.15s ease;
    border-radius: var(--radius-sm, 4px);
}

.deform .deform-order-button:hover {
    color: var(--primary);
    background-color: rgba(0, 101, 189, 0.08);
}

.deform .deform-order-button:empty::before {
    content: "⋮⋮";
    font-size: 16px;
    font-weight: bold;
    display: inline-block;
    line-height: 1;
}

.deform .deform-close-button {
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    opacity: 0.7;
    padding: 2px 6px;
    background: transparent;
    border: none;
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
    border-radius: var(--radius-sm, 4px);
}

.deform .deform-close-button:hover {
    color: var(--error) !important;
    opacity: 1;
    text-decoration: none;
    background-color: rgba(229, 57, 53, 0.08);
}

.deform .deform-close-button:empty::before {
    content: "✕";
    font-size: 14px;
    font-weight: bold;
    display: inline-block;
    line-height: 1;
}

/* ==========================================================================
   Tabellen & Abstimmungsmatrix
   ========================================================================== */

.table-responsive,
.table-responsive-lg {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--surface);
}

.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    border-collapse: collapse;
}

.table td,
.table th {
    padding: 10px 14px;
    vertical-align: middle;
    border: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
    font-size: var(--font-size-body);
}

.table-sm td,
.table-sm th {
    padding: 8px 12px;
}

.thead-light th {
    color: var(--primary-dark);
    background-color: #EDF2F7;
    border-color: var(--border);
    font-weight: 600;
}

/* Tabellenkopf TUM-Blau */
.table-primary-green th,
.table-primary-green td {
    background-color: var(--primary) !important;
    color: #FFFFFF !important;
    font-weight: 600;
    border: 1px solid var(--primary-dark) !important;
}

.table-hover tbody tr:hover {
    background-color: #F8FAFC;
}

/* Sticky Erste Spalte (Teilnehmer) */
.table-content th:first-child,
.table-content td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 180px;
    background-color: var(--surface);
}

/* Kopfzelle links oben liegt über der Sticky-Spalte */
.table-primary-green th:first-child {
    z-index: 3;
}

.table-content th.option-header {
    min-width: 110px;
    max-width: 160px;
    white-space: normal !important;
    word-break: break-word;
    text-align: center !important;
    vertical-align: bottom;
    padding: 10px 8px;
    font-size: var(--font-size-body);
    color: #FFFFFF;
}

td.option-cell {
    text-align: center !important;
    vertical-align: middle !important;
}

/* --summenzeile */
.table-sum-row th,
.table-sum-row td {
    background-color: #EDF2F7 !important;
    color: var(--primary-dark) !important;
    font-weight: 600;
    border: 1px solid var(--border) !important;
}

/* Kommentar-Icon & Tooltip */
.comment-box {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    cursor: pointer;
}

.comment-icon {
    width: 16px;
    height: 16px;
    display: block;
    opacity: 0.75;
    transition: opacity 0.15s ease;
}

.comment-box:hover .comment-icon {
    opacity: 1;
}

.comment-vote {
    display: none;
    position: absolute;
    left: 24px;
    top: -6px;
    background-color: var(--text-primary);
    color: #FFFFFF;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-help-text);
    line-height: 1.35;
    white-space: normal;
    min-width: 140px;
    max-width: 260px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    pointer-events: none;
}

.comment-vote::before {
    content: "";
    position: absolute;
    top: 9px;
    left: -5px;
    border-width: 5px 5px 5px 0;
    border-style: solid;
    border-color: transparent var(--text-primary) transparent transparent;
}

.comment-box:hover .comment-vote {
    display: block;
}

/* ==========================================================================
   Stimmabgabe Panel (Vote Form)
   ========================================================================== */

tr.vote-form-height,
tr.vote-form-height td {
    height: 16px;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
}

tr.vote-form-selection-row,
tr.vote-form-selection-row td {
    background-color: #FFFFFF !important;
    height: 52px;
    vertical-align: middle !important;
    border: 1px solid var(--border) !important;
}

tr.vote-form-selection-row td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    font-weight: 700;
    font-size: var(--font-size-form-label);
    color: var(--primary-dark);
    padding-left: 16px;
}

tr.vote-form-selection-row td.option-cell input[type="radio"],
tr.vote-form-selection-row td.option-cell input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    margin: 0 auto;
    vertical-align: middle;
}

tr.vote-form-details-row,
tr.vote-form-details-row td {
    background-color: #FAFCFE !important;
    border: 1px solid var(--border) !important;
    border-top: none !important;
}

tr.vote-form-details-row td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
}

.vote-form-details-cell {
    padding: 20px 24px !important;
    vertical-align: top !important;
}

.vote-form-details-card,
.vote-form-details-container {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-subtle);
}

.vote-form-header-area {
    margin-bottom: 2px;
}

.vote-form-heading {
    font-size: var(--font-size-section-title);
    font-weight: var(--font-weight-section-title);
    color: var(--primary-dark);
    margin: 0 0 2px 0;
}

.vote-form-subheading {
    font-size: var(--font-size-help-text);
    color: var(--text-secondary);
    margin: 0;
}

.vote-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.vote-form-field label,
.vote-form-label {
    margin-bottom: 0;
}

.vote-form-field input[readonly],
.vote-form-field input:read-only {
    background-color: #F1F5F9;
    color: var(--text-secondary);
    cursor: default;
}

.vote-form-actions {
    margin-top: 4px;
}

/* ==========================================================================
   Bilderabstimmung / Picture Thumbnails & Modal
   ========================================================================== */

.picture-th-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 4px;
}

.picture-thumbnail-link {
    display: inline-block;
    border: none !important;
    text-decoration: none !important;
    border-radius: var(--radius-md);
}

.voting-thumbnail {
    width: 90px !important;
    height: 90px !important;
    min-width: 90px !important;
    min-height: 90px !important;
    max-width: 90px !important;
    max-height: 90px !important;
    object-fit: cover !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: block;
    margin: 0 auto;
}

.voting-thumbnail:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.picture-title {
    font-size: var(--font-size-body);
    font-weight: 600;
    line-height: 1.3;
    max-width: 140px;
    word-break: break-word;
    text-align: center;
    color: #FFFFFF;
    margin: 0;
}

.picture-modal {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.picture-modal:target {
    display: flex !important;
}

.picture-modal-content {
    background: #FFFFFF;
    padding: 20px;
    border-radius: var(--radius-lg);
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.picture-modal-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: var(--font-size-section-title);
    color: var(--primary-dark);
}

.picture-modal-body {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 80vw;
    max-height: 75vh;
}

.picture-modal-img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.picture-modal-close {
    position: absolute;
    top: 8px;
    right: 14px;
    font-size: 26px;
    line-height: 1;
    text-decoration: none;
    color: var(--text-secondary);
    border: none !important;
}

.picture-modal-close:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   Help & Admin Pages
   ========================================================================== */

.help-header {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    display: inline-block;
    font-size: var(--font-size-help-text);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: var(--spacing-md) 0;
}

.feature {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-subtle);
}

.feature h3 {
    margin-top: 0;
    color: var(--primary-dark);
}
