/* ===== CSS-Variablen ===== */
:root {
    --color-primary: #0d9488;
    --color-primary-dark: #0f766e;
    --color-primary-light: #ccfbf1;
    --color-primary-50: #f0fdfa;
    --color-accent: #f59e0b;
    --color-accent-light: #fef3c7;
    --color-success: #16a34a;
    --color-success-light: #dcfce7;
    --color-warning: #d97706;
    --color-warning-light: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-light: #fef2f2;
    --color-info: #0891b2;
    --color-info-light: #ecfeff;
    --color-bg: #f5f6fa;
    --color-surface: #ffffff;
    --color-text: #1a1d2e;
    --color-text-light: #5f6377;
    --color-text-lighter: #9096ab;
    --color-border: #e3e6ee;
    --color-border-light: #f0f1f6;
    --color-navbar: #1a1d2e;
    --color-navbar-text: #c7cad6;
    --color-navbar-hover: #2a2d3e;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-colored: 0 4px 14px rgba(13, 148, 136, 0.15);
    --transition: 0.2s ease;
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.3);
    --sidebar-width: 240px;
}

body {
    padding-left: var(--sidebar-width);
}

/* ===== Google Fonts Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.01em;
    line-height: 1.3;
}

/* ===== Fokus-Indikatoren (Barrierefreiheit) ===== */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

/* Skip-Link für Tastaturnavigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--spacing-md);
    z-index: 1000;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: var(--spacing-sm);
}

/* ===== Navbar (Sidebar links) ===== */
.navbar {
    background: var(--color-navbar);
    padding: var(--spacing-lg) var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 100;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.navbar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    width: 100%;
    margin-bottom: var(--spacing-lg);
}

.navbar-brand a {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.navbar-brand a::before {
    content: "";
    display: inline-block;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: 6px;
    flex-shrink: 0;
}

.navbar-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: #ffffff;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition);
}

.navbar-toggle:hover {
    background-color: var(--color-navbar-hover);
}

.navbar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 0;
    width: 100%;
    flex: 1;
}

.navbar-menu > li {
    width: 100%;
}

.navbar-menu a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    color: var(--color-navbar-text);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius);
    transition: all var(--transition);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.nav-icon {
    display: flex;
    flex-shrink: 0;
    opacity: 0.8;
}

.navbar-menu a:hover .nav-icon,
.navbar-menu a[aria-current="page"] .nav-icon {
    opacity: 1;
}

.navbar-menu a:hover {
    background-color: var(--color-navbar-hover);
    color: #ffffff;
    text-decoration: none;
}

.navbar-menu a[aria-current="page"] {
    background-color: var(--color-primary);
    color: #ffffff;
    font-weight: 600;
}

.navbar-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
    width: 100%;
    margin-top: auto;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.navbar-user span {
    color: var(--color-navbar-text);
    font-size: var(--font-size-sm);
}

.navbar-user .btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: var(--font-size-xs);
}

.navbar-user .btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) 0;
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-sm);
    color: var(--color-text-lighter);
    list-style: none;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.breadcrumb li + li::before {
    content: "\203A";
    color: var(--color-text-lighter);
    margin: 0 var(--spacing-xs);
    font-size: 1.2em;
}

.breadcrumb a {
    color: var(--color-text-lighter);
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--color-primary);
}

.breadcrumb li:last-child {
    color: var(--color-text);
    font-weight: 600;
}

/* ===== Container ===== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-xl);
    flex: 1;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.page-header h1 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 0.5rem 1.125rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all var(--transition);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    min-height: 40px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-colored);
    text-decoration: none;
    color: #fff;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: var(--font-size-xs);
    min-height: 32px;
    border-radius: 0.375rem;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), #b91c1c);
}

.btn-danger:hover {
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success), #15803d);
}

.btn-success:hover {
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25);
}

.btn-group {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

/* ===== Formulare ===== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 0.5625rem var(--spacing-md);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: all var(--transition);
    min-height: 42px;
    background-color: var(--color-surface);
    color: var(--color-text);
}

.form-control::placeholder {
    color: var(--color-text-lighter);
}

.form-control:hover {
    border-color: var(--color-text-lighter);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
    background-color: #fff;
}

.form-control.is-invalid {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-help {
    font-size: var(--font-size-xs);
    color: var(--color-text-lighter);
    margin-top: var(--spacing-xs);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--color-danger);
    margin-top: var(--spacing-xs);
    font-weight: 500;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235f6377' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.5l-5-5h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2.5rem;
}

.filter-form {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    align-items: end;
}

.filter-form .form-group {
    margin-bottom: 0;
}

/* ===== Alerts / Flash Messages ===== */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    animation: alertSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
    font-weight: 500;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-0.75rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border-left-color: var(--color-success);
}

.alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border-left-color: var(--color-danger);
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border-left-color: var(--color-warning);
}

.alert-info {
    background-color: #ecfeff;
    color: #155e75;
    border-left-color: var(--color-info);
}

.alert-dismiss {
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: inherit;
    opacity: 0.4;
    padding: 0;
    line-height: 1;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}

.alert-dismiss:hover {
    opacity: 0.8;
    background-color: rgba(0, 0, 0, 0.05);
}

/* ===== Tabellen ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

th, td {
    padding: 0.75rem var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

th {
    background-color: var(--color-bg);
    font-weight: 600;
    font-size: var(--font-size-xs);
    color: var(--color-text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    padding: 0.875rem var(--spacing-md);
}

tbody tr {
    transition: background-color var(--transition);
}

tbody tr:hover {
    background-color: var(--color-primary-50);
}

tbody tr:last-child td {
    border-bottom: none;
}

td .btn-group {
    white-space: nowrap;
}

/* ===== Cards ===== */
.card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--color-border-light);
    transition: box-shadow var(--transition-slow);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-border-light);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.card-header h2 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
}

/* ===== Dashboard Widgets ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.widget {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--spacing-xl) var(--spacing-lg);
    text-align: center;
    transition: all var(--transition-slow);
    border: 1px solid var(--color-border-light);
    position: relative;
    overflow: hidden;
}

.widget::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.widget:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: transparent;
}

a.widget {
    display: block;
    color: inherit;
}

a.widget:hover {
    text-decoration: none;
}

.widget-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.widget-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    margin-top: var(--spacing-sm);
    font-weight: 500;
}

/* Widget color variations via nth-child */
.dashboard-grid .widget:nth-child(2)::before {
    background: linear-gradient(90deg, var(--color-info), #06b6d4);
}
.dashboard-grid .widget:nth-child(2) .widget-value {
    background: linear-gradient(135deg, var(--color-info), #06b6d4);
    -webkit-background-clip: text;
    background-clip: text;
}

.dashboard-grid .widget:nth-child(3)::before {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}
.dashboard-grid .widget:nth-child(3) .widget-value {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
}

.dashboard-grid .widget:nth-child(4)::before {
    background: linear-gradient(90deg, var(--color-warning), #f59e0b);
}
.dashboard-grid .widget:nth-child(4) .widget-value {
    background: linear-gradient(135deg, var(--color-warning), #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
}

.dashboard-grid .widget:nth-child(5)::before {
    background: linear-gradient(90deg, var(--color-danger), #ef4444);
}
.dashboard-grid .widget:nth-child(5) .widget-value {
    background: linear-gradient(135deg, var(--color-danger), #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
}

.dashboard-grid .widget:nth-child(6)::before {
    background: linear-gradient(90deg, #ec4899, #f472b6);
}
.dashboard-grid .widget:nth-child(6) .widget-value {
    background: linear-gradient(135deg, #ec4899, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ===== Auth Page ===== */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f766e 0%, #1a1d2e 100%);
    position: relative;
    padding-left: 0;
}

.auth-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(13, 148, 136, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(13, 148, 136, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: var(--spacing-xl);
    position: relative;
    z-index: 1;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.auth-header h1 {
    color: #ffffff;
    font-size: var(--font-size-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.auth-header h1::before {
    content: "";
    display: inline-block;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: 8px;
    flex-shrink: 0;
}

.auth-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-sm);
}

.auth-form {
    background-color: var(--color-surface);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-form h2 {
    margin-bottom: var(--spacing-xl);
    font-size: var(--font-size-lg);
    font-weight: 700;
    text-align: center;
    color: var(--color-text);
}

.auth-form .btn {
    min-height: 46px;
    font-size: var(--font-size-base);
}

.btn-login {
    width: 100%;
}

.auth-hint {
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.auth-form .text-center {
    margin-top: var(--spacing-lg);
}

.auth-form .text-center a {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    transition: color var(--transition);
}

.auth-form .text-center a:hover {
    color: var(--color-primary);
}

.auth-page .footer {
    position: relative;
    z-index: 1;
    border-top-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
}

/* ===== Error Pages ===== */
.error-page {
    text-align: center;
    padding: var(--spacing-2xl) 0;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-text-lighter), var(--color-border));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.error-page p {
    color: var(--color-text-light);
    margin: var(--spacing-md) 0 var(--spacing-xl);
    font-size: var(--font-size-lg);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
    color: var(--color-text-lighter);
    font-size: var(--font-size-sm);
    border-top: 1px solid var(--color-border-light);
    margin-top: auto;
}

/* ===== Loading Spinner ===== */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Confirmation Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 29, 46, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: var(--spacing-2xl);
    max-width: 420px;
    width: 90%;
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal h3 {
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.modal p {
    margin-bottom: var(--spacing-xl);
    color: var(--color-text-light);
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* ===== Search Input ===== */
.search-input-wrapper {
    position: relative;
}

.search-input {
    padding-left: var(--spacing-xl) !important;
}

.search-highlight {
    background-color: var(--color-accent-light);
    padding: 1px 3px;
    border-radius: 3px;
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-light); }
.mt-1 { margin-top: var(--spacing-lg); }
.mt-2 { margin-top: var(--spacing-xl); }
.mb-1 { margin-bottom: var(--spacing-lg); }
.mb-2 { margin-bottom: var(--spacing-xl); }
.gap-sm { gap: var(--spacing-sm); }
.flex-wrap { flex-wrap: wrap; }
.d-flex { display: flex; }
.d-inline { display: inline; }
.flex-1 { flex: 1; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.list-unstyled { list-style: none; padding: 0; }
.list-unstyled li { padding: 4px 0; }
.date-range-group { display: flex; gap: var(--spacing-md); }
.checkbox-scroll { max-height: 200px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--spacing-sm); }
.checkbox-scroll label { display: block; padding: 4px 0; cursor: pointer; }
.fieldset-clean { border: none; padding: 0; margin: 0; }
.fieldset-clean legend { font-weight: 600; font-size: var(--font-size-sm); margin-bottom: var(--spacing-xs); }
.preview-errors { margin: 0.5rem 0 0 1rem; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-success { background: var(--color-success-light); color: #166534; }
.badge-danger { background: var(--color-danger-light); color: #991b1b; }
.badge-warning { background: var(--color-warning-light); color: #92400e; }
.badge-info { background: var(--color-info-light); color: #155e75; }

/* ===== Responsive: Tablet ===== */
@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
    :root {
        --spacing-lg: 1rem;
        --spacing-xl: 1.5rem;
    }

    body {
        padding-left: 0;
    }

    .navbar {
        position: sticky;
        top: 0;
        left: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        height: auto;
        padding: 0 var(--spacing-md);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        min-height: 56px;
        overflow-y: visible;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .navbar-brand {
        width: auto;
        margin-bottom: 0;
        flex: 1;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        padding: var(--spacing-sm) 0;
        gap: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        flex: 0 0 100%;
    }

    .navbar-menu.active {
        display: flex;
    }

    .navbar-menu li {
        width: 100%;
    }

    .navbar-menu a {
        display: flex;
        padding: var(--spacing-sm) var(--spacing-md);
        min-height: 44px;
        align-items: center;
        border-radius: var(--radius);
    }

    .navbar-user {
        flex-direction: row;
        align-items: center;
        margin-top: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: var(--spacing-sm);
        width: 100%;
    }

    .container {
        padding: var(--spacing-md) var(--spacing-sm);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    .card {
        padding: var(--spacing-md);
        border-radius: var(--radius);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-form {
        flex-direction: column;
    }

    .filter-form .form-group {
        width: 100%;
    }

    .filter-form .form-control {
        width: 100%;
    }

    /* Tabellen auf Mobil: horizontales Scrollen */
    .table-responsive {
        margin: 0 calc(-1 * var(--spacing-md));
        padding: 0 var(--spacing-md);
    }

    th, td {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--font-size-sm);
    }

    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .breadcrumb {
        font-size: var(--font-size-xs);
    }

    .widget::before {
        height: 2px;
    }
}

/* ===== Responsive: Small Mobile ===== */
@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .auth-container {
        padding: var(--spacing-md);
    }

    .auth-form {
        padding: var(--spacing-xl);
    }
}

/* ===== Print ===== */
@media print {
    .navbar,
    .footer,
    .breadcrumb,
    .btn,
    .filter-form,
    .navbar-toggle,
    .loading-overlay,
    .modal-overlay {
        display: none !important;
    }

    body {
        background: white;
        color: black;
        padding-left: 0;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    table {
        box-shadow: none;
    }

    .widget::before {
        display: none;
    }
}

/* ===== Nachrichten / Chat ===== */

.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 9999px;
    background: var(--color-danger);
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: 700;
    line-height: 1;
    margin-left: var(--spacing-xs);
}

.badge-muted {
    background: var(--color-border);
    color: var(--color-text-light);
}

/* Konversationsliste (Inbox) */
.conversation-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.conversation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-surface);
    text-decoration: none;
    color: var(--color-text);
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition), border-left-color var(--transition);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border-left: 3px solid transparent;
    gap: var(--spacing-md);
}

.conversation-item:hover {
    background: var(--color-primary-50);
    transform: translateX(3px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--color-primary);
}

.conversation-unread {
    background: var(--color-primary-light);
    border-left-color: var(--color-primary);
}

.conversation-unread:hover {
    background: #ccfbf1;
}

/* Avatar mit Initiale */
.conversation-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-base);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    user-select: none;
}

.conversation-unread .conversation-avatar {
    background: var(--color-primary-dark);
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-partner {
    font-weight: 600;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.conversation-preview {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--spacing-xs);
    flex-shrink: 0;
}

.conversation-time {
    font-size: var(--font-size-xs);
    color: var(--color-text-lighter);
    white-space: nowrap;
}

/* Chat-Ansicht */
.chat-card {
    display: flex;
    flex-direction: column;
    max-height: 75vh;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-height: 200px;
    max-height: 55vh;
}

.chat-bubble {
    max-width: 75%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: var(--shadow);
}

/* Mehr Abstand wenn Absender wechselt */
.chat-bubble--mine + .chat-bubble--theirs,
.chat-bubble--theirs + .chat-bubble--mine {
    margin-top: var(--spacing-lg);
}

.chat-bubble--mine {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: var(--spacing-xs);
}

.chat-bubble--theirs {
    align-self: flex-start;
    background: var(--color-border-light);
    color: var(--color-text);
    border-bottom-left-radius: var(--spacing-xs);
    border: 1px solid var(--color-border);
}

.chat-bubble-body {
    font-size: var(--font-size-base);
    line-height: 1.5;
}

.chat-bubble-meta {
    font-size: var(--font-size-xs);
    margin-top: var(--spacing-xs);
    opacity: 0.7;
}

.chat-bubble--mine .chat-bubble-meta {
    text-align: right;
}

.chat-read-indicator {
    font-size: 0.65rem;
    margin-left: 2px;
}

/* Absender-Name in Gruppen-Chats */
.chat-bubble-sender {
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: 2px;
    opacity: 0.8;
}

/* Gruppen-Avatar */
.conversation-avatar--group {
    background: var(--color-secondary, #6c757d);
    font-size: 1.1rem;
}

.group-icon {
    line-height: 1;
}

/* Mitglieder-Auswahl beim Gruppe erstellen */
.group-member-list {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    max-height: 300px;
    overflow-y: auto;
    padding: var(--spacing-xs);
}

.group-member-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.15s;
}

.group-member-item:hover {
    background: var(--color-primary-50);
}

.group-member-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.group-member-item input[type="checkbox"]:checked + .group-member-avatar {
    background: var(--color-primary-dark);
}

.group-member-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.group-member-name {
    font-size: var(--font-size-sm);
}

.group-members-panel {
    margin-bottom: var(--spacing-lg);
}

.group-members-list {
    list-style: none;
    margin: var(--spacing-sm) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.group-member-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.group-members-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs, 4px);
    flex-wrap: wrap;
}

.group-member-avatar-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Chat-Eingabe */
.chat-input-form {
    border-top: 1px solid var(--color-border);
    padding: var(--spacing-md);
}

.chat-input-wrapper {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-end;
}

.chat-input-wrapper textarea {
    flex: 1;
    resize: none;
    min-height: 2.5rem;
}

.chat-input-wrapper .btn {
    flex-shrink: 0;
}

.mb-05 {
    margin-bottom: var(--spacing-sm);
}

/* Responsive Chat */
@media (max-width: 768px) {
    .chat-bubble {
        max-width: 90%;
    }

    .chat-container {
        max-height: 50vh;
    }

    .conversation-item {
        flex-wrap: wrap;
    }

    .conversation-meta {
        flex-direction: row;
        align-items: center;
        width: 100%;
    }
}

/* ===== Dateiverwaltung ===== */

.file-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
}

.file-overview-card {
    text-decoration: none;
    color: var(--color-text);
    padding: var(--spacing-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg);
    border-left: 4px solid var(--color-primary);
    transition: transform var(--transition), box-shadow var(--transition), border-left-color var(--transition);
}

.file-overview-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--color-primary-dark);
    color: var(--color-text);
}

.file-overview-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: var(--color-primary-light);
    border-radius: var(--radius-lg);
}

.file-overview-card-body {
    flex: 1;
    min-width: 0;
}

.file-overview-card h2 {
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-lg);
    color: var(--color-text);
}

.file-overview-card-link {
    display: inline-block;
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-primary);
}

.file-overview-card:hover .file-overview-card-link {
    color: var(--color-primary-dark);
}

/* Storage-Anzeige */
.storage-info {
    padding: var(--spacing-md) var(--spacing-lg);
    border-left: 4px solid var(--color-primary);
}

.storage-bar-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.storage-bar {
    flex: 1;
    height: 10px;
    background: var(--color-border-light);
    border-radius: 9999px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
    border-radius: 9999px;
    transition: width var(--transition-slow);
}

.storage-text {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-light);
    white-space: nowrap;
}

/* Datei-Aktionen */
.file-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.file-upload-form {
    flex: 1;
    min-width: 250px;
}

.file-upload-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.file-upload-row input[type="file"] {
    flex: 1;
}

.file-upload-hint {
    font-size: var(--font-size-xs);
    margin-top: var(--spacing-xs);
}

.folder-create-form {
    margin-top: var(--spacing-sm);
}

.folder-create-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.folder-create-row input[type="text"] {
    flex: 1;
    min-width: 150px;
}

/* Ordner/Datei-Icons */
.folder-link {
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
}

.folder-link:hover {
    color: var(--color-primary);
}

.folder-icon,
.file-icon {
    margin-right: var(--spacing-xs);
}

@media (max-width: 768px) {
    .file-overview {
        grid-template-columns: 1fr;
    }

    .file-actions {
        flex-direction: column;
    }

    .file-upload-row {
        flex-direction: column;
        align-items: stretch;
    }

    .folder-create-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ===== Listen ===== */

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table th,
.list-table td {
    min-width: 100px;
    vertical-align: middle;
}

.list-row-label-header {
    min-width: 160px !important;
    width: 160px;
}

.list-row-label {
    font-weight: 600;
    white-space: nowrap;
    background: var(--color-primary-50);
    position: sticky;
    left: 0;
    z-index: 1;
}

.list-col-type {
    font-size: var(--font-size-xs);
    color: var(--color-text-lighter);
    font-weight: 400;
}

.list-action-col {
    width: 40px;
    min-width: 40px !important;
}

/* Zellen-Inputs */
.list-cell-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    border-radius: var(--radius);
    transition: border-color var(--transition), background var(--transition);
}

.list-cell-input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface);
    outline: none;
    box-shadow: var(--focus-ring);
}

.list-cell-input:hover {
    border-color: var(--color-border);
}

.list-cell-input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.list-cell--saving {
    background: var(--color-accent-light);
    transition: background 0.2s;
}

.list-cell--saved {
    background: var(--color-success-light);
    transition: background 0.3s;
}

/* Inline-Icon-Button zum Löschen */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-size-lg);
    line-height: 1;
    padding: 2px 6px;
    border-radius: var(--radius);
    transition: background var(--transition);
}

.btn-icon-danger {
    color: var(--color-danger);
}

.btn-icon-danger:hover {
    background: var(--color-danger-light);
}

/* Aktionsleiste */
.list-actions-bar {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md);
}

.list-inline-form {
    margin-bottom: var(--spacing-md);
}

.list-inline-form-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-wrap: wrap;
}

.list-inline-form-row .form-control {
    flex: 1;
    min-width: 120px;
}

.list-inline-form-row .btn {
    flex-shrink: 0;
}

/* Erstellformular: Spaltenzeilen */
.list-column-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
}

.list-column-row .form-control {
    flex: 1;
    min-width: 120px;
}

.form-row {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    white-space: nowrap;
    cursor: pointer;
}

.mt-05 {
    margin-top: var(--spacing-sm);
}

@media (max-width: 768px) {
    .list-inline-form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .list-column-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ===== Klassenbuch – Tagesansicht ===== */

.classbook-day-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.classbook-day {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--color-surface);
}

.classbook-day-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-primary-50);
    border-bottom: 2px solid var(--color-primary-light);
}

.classbook-day-weekday {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-primary-dark);
    background: var(--color-primary-light);
    border-radius: var(--radius);
    padding: 0.2rem 0.55rem;
    white-space: nowrap;
}

.classbook-day-date {
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--color-text);
}

.classbook-day-count {
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--color-text-lighter);
    white-space: nowrap;
}

.classbook-day table {
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.classbook-day th {
    background: var(--color-bg);
    font-size: var(--font-size-xs);
    padding: 0.5rem var(--spacing-md);
}

.classbook-day td {
    padding: 0.75rem var(--spacing-md);
    vertical-align: top;
}

.classbook-lesson-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: var(--font-size-xs);
    flex-shrink: 0;
}

.classbook-topic {
    font-weight: 500;
    color: var(--color-text);
}

.classbook-notes {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    margin-top: 0.15rem;
}

@media (max-width: 640px) {
    .classbook-day-header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .classbook-day-count {
        margin-left: 0;
        width: 100%;
    }
}

/* === Stundenplan === */

.timetable-layout {
    display: flex;
    gap: var(--spacing-lg);
    align-items: flex-start;
}

.timetable-grid-wrapper {
    flex: 1;
    overflow-x: auto;
}

.timetable-grid {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

.timetable-grid th,
.timetable-grid td {
    border: 1px solid var(--border-color, #dee2e6);
    padding: var(--spacing-xs, 4px);
    text-align: center;
    vertical-align: top;
}

.timetable-grid .time-col {
    width: 90px;
    min-width: 90px;
    background: var(--bg-light, #f8f9fa);
    font-size: 0.85rem;
}

.timetable-grid .day-col {
    background: var(--bg-light, #f8f9fa);
    font-weight: 600;
}

.timetable-grid .slot-cell {
    min-height: 50px;
    position: relative;
    padding-bottom: 28px;
}

.slot-entry {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light, #e3f2fd);
    border: 1px solid var(--primary-color, #1976d2);
    border-radius: 4px;
    padding: 2px 6px;
    margin: 2px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.slot-entry-readonly {
    cursor: default;
}

.slot-teacher {
    font-weight: 600;
    color: var(--primary-color, #1976d2);
}

.slot-subject {
    color: var(--text-muted, #6c757d);
    font-size: 0.75rem;
}

.slot-class {
    font-weight: 600;
}

.slot-room {
    font-size: 0.75rem;
    color: var(--text-muted, #6c757d);
}

.slot-remove {
    background: none;
    border: none;
    color: var(--danger-color, #dc3545);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    margin-left: 2px;
}

.slot-remove:hover {
    color: var(--danger-dark, #a71d2a);
}

.slot-add-btn {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: var(--success-color, #28a745);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 1rem;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.slot-add-btn:hover {
    background: var(--success-dark, #218838);
}

/* Lehrer-Sidebar */

.timetable-sidebar {
    width: 260px;
    min-width: 220px;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: var(--radius, 8px);
    padding: var(--spacing-md, 16px);
    max-height: 80vh;
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.timetable-sidebar h3 {
    margin: 0 0 var(--spacing-sm, 8px);
    font-size: 1rem;
}

.teacher-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-sm, 8px) 0 0;
}

.teacher-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-light, #eee);
    font-size: 0.85rem;
}

.teacher-item:last-child {
    border-bottom: none;
}

.teacher-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teacher-units {
    flex-shrink: 0;
    margin-left: 8px;
}

/* Badges */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    min-width: 24px;
}

.badge-success {
    background: var(--success-color, #28a745);
    color: #fff;
}

.badge-warning {
    background: var(--warning-color, #ffc107);
    color: #212529;
}

/* Radio & Checkbox Groups */

.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md, 16px);
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}

/* Page header actions */

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs, 4px);
}

/* Timetable view card */

.timetable-view-card {
    overflow-x: auto;
}

.timetable-readonly .slot-cell {
    padding-bottom: var(--spacing-xs, 4px);
}

.timetable-break-row td {
    background: var(--color-gray-100, #f5f5f5);
    text-align: center;
    padding: var(--spacing-xs, 4px);
    font-style: italic;
    color: var(--color-gray-600, #666);
    height: auto;
    min-height: 0;
}

/* Responsive */

@media (max-width: 900px) {
    .timetable-layout {
        flex-direction: column;
    }

    .timetable-sidebar {
        width: 100%;
        max-height: none;
        position: static;
    }
}

@media (max-width: 640px) {
    .page-header-actions {
        flex-wrap: wrap;
    }
}

/* === Vertretungsplan === */

.sub-day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-md, 16px);
    padding: var(--spacing-md, 16px);
}

.sub-day-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-md, 16px);
    border: 2px solid var(--border-color, #dee2e6);
    border-radius: var(--radius, 8px);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sub-day-card:hover {
    border-color: var(--primary-color, #1976d2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sub-day-today {
    border-color: var(--primary-color, #1976d2);
    background: var(--primary-light, #e3f2fd);
}

.sub-day-pending {
    border-color: var(--warning-color, #ffc107);
}

.sub-day-published {
    border-color: var(--success-color, #28a745);
}

.sub-day-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.sub-day-date {
    font-size: 0.85rem;
    color: var(--text-muted, #6c757d);
}

/* Publish bar */

.sub-publish-bar {
    padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
}

.sub-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 16px);
}

.sub-status-published {
    color: var(--success-color, #28a745);
}

.sub-status-draft {
    color: var(--text-muted, #6c757d);
}

/* Absent teachers list */

.sub-absent-list {
    padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
}

.sub-absent-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light, #eee);
}

.sub-absent-item:last-child {
    border-bottom: none;
}

/* Substitution table */

.sub-table .sub-row-cancelled {
    background: #fff3cd;
    text-decoration: line-through;
    opacity: 0.7;
}

.sub-table .sub-row-cancelled .sub-cancelled-label {
    text-decoration: none;
    font-style: italic;
    color: var(--warning-dark, #856404);
    font-weight: 600;
}

.sub-cancelled-label {
    font-style: italic;
    color: var(--warning-dark, #856404);
    font-weight: 600;
}

.sub-substitute-name {
    font-weight: 600;
    color: var(--success-color, #28a745);
}

/* Open slots table */

.sub-open-table .open-slot-row {
    background: #fff8e1;
}

.badge-info {
    background: var(--primary-color, #1976d2);
    color: #fff;
}

/* Responsive */

@media (max-width: 640px) {
    .sub-day-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .sub-status {
        flex-direction: column;
        text-align: center;
    }
}

/* ==========================================================================
   Zeugniserstellung — Template Editor & Fill-In
   ========================================================================== */

/* --- Badges --- */
.badge-draft     { background: var(--color-warning-light, #fef3c7); color: var(--color-warning, #92400e); }
.badge-published { background: var(--color-success-light, #d1fae5); color: var(--color-success, #065f46); }
.badge-final     { background: var(--color-primary-50, #e0f2f1);   color: var(--color-primary-dark, #0f766e); }

/* --- Template Card Grid (browse view) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--spacing-md);
}
.card--template {
    display: flex;
    flex-direction: column;
}
.card--template .card-body { flex: 1; padding: var(--spacing-md); }
.card--template .card-footer {
    padding: var(--spacing-sm) var(--spacing-md);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--spacing-sm); margin: var(--spacing-sm) 0 0; font-size: var(--font-size-sm); }
.meta-list dt { font-weight: 600; color: var(--color-muted); }
.meta-list dd { margin: 0; }

/* --- Editor Layout --- */
.zeugnis-editor-layout {
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    grid-template-rows: auto 1fr;
    gap: var(--spacing-md);
    min-height: 640px;
}
.zeugnis-editor-toolbar {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.toolbar-sep { color: var(--color-border); padding: 0 2px; }

/* --- Palette --- */
.zeugnis-palette {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-sm);
    overflow-y: auto;
}
.palette-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    margin: 0 0 var(--spacing-sm);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.palette-section-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-muted);
    letter-spacing: .05em;
    margin: var(--spacing-sm) 0 4px;
}
.zeugnis-palette-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px var(--spacing-xs);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 4px;
    cursor: grab;
    font-size: var(--font-size-sm);
    background: var(--color-bg);
    user-select: none;
    transition: background var(--transition, .15s), border-color var(--transition, .15s);
}
.zeugnis-palette-item:hover {
    background: var(--color-primary-50, #e0f2f1);
    border-color: var(--color-primary, #0d9488);
}
.zeugnis-palette-item:active { cursor: grabbing; }
.palette-icon { font-style: normal; flex-shrink: 0; }

/* --- Canvas wrapper --- */
.zeugnis-canvas-wrapper {
    overflow: auto;
    background: #7a7a7a;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: var(--spacing-lg);
    border-radius: var(--radius);
    min-height: 400px;
}
.zeugnis-canvas {
    position: relative;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
    flex-shrink: 0;
}
.zeugnis-canvas--grid {
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 29px, rgba(100,100,200,.18) 30px),
        repeating-linear-gradient(90deg, transparent, transparent 29px, rgba(100,100,200,.18) 30px);
    /* 30px ≈ 10mm at 3px/mm */
}
.zeugnis-page-separator {
    position: absolute;
    left: 0;
    width: 100%;
    height: 24px;
    background: #7a7a7a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: var(--font-size-xs);
    z-index: 1;
}

/* --- Canvas elements --- */
.zeugnis-element {
    position: absolute;
    box-sizing: border-box;
    border: 1px dashed transparent;
    cursor: move;
    min-width: 6px;
    min-height: 4px;
}
.zeugnis-element:hover { border-color: var(--color-primary, #0d9488); }
.zeugnis-element--selected {
    border-color: var(--color-primary, #0d9488);
    border-style: solid;
    outline: 2px solid rgba(13,148,136,.25);
    z-index: 10;
}
.zeugnis-element__preview {
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color-primary, #0d9488);
    border: 1px solid #fff;
    border-radius: 1px;
    z-index: 20;
}
.resize-handle--se { bottom: -4px; right: -4px;  cursor: se-resize; }
.resize-handle--sw { bottom: -4px; left:  -4px;  cursor: sw-resize; }
.resize-handle--ne { top:    -4px; right: -4px;  cursor: ne-resize; }
.resize-handle--nw { top:    -4px; left:  -4px;  cursor: nw-resize; }

/* --- Properties panel --- */
.zeugnis-props-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    overflow-y: auto;
    font-size: var(--font-size-sm);
}
.zeugnis-props-panel h3 {
    font-size: var(--font-size-sm);
    font-weight: 700;
    margin: 0 0 var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
}
.zeugnis-props-group { margin-bottom: var(--spacing-xs); }
.zeugnis-props-group label { display: block; font-weight: 500; margin-bottom: 2px; font-size: var(--font-size-xs); }
.zeugnis-color-picker {
    width: 36px;
    height: 28px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1px;
    cursor: pointer;
}

/* Token list */
.zeugnis-token-list { list-style: none; padding: 0; margin: 0; }
.zeugnis-token-list li {
    padding: 3px var(--spacing-xs);
    font-family: monospace;
    font-size: var(--font-size-xs);
    cursor: pointer;
    border-radius: var(--radius);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.zeugnis-token-list li:hover { background: var(--color-primary-50, #e0f2f1); }

/* Image gallery in props panel */
.image-gallery-item {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    margin: 2px;
}
.image-gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.image-gallery-item:hover { border-color: var(--color-primary, #0d9488); }

/* --- Fill-In View --- */
.zeugnis-fill-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--spacing-lg);
    align-items: start;
}
.zeugnis-fill-canvas { position: relative; }
.zeugnis-fill-sidebar { position: sticky; top: var(--spacing-md); }

.zeugnis-fill-field input[type="text"],
.zeugnis-fill-field textarea {
    border: 1px solid var(--color-primary, #0d9488);
    background: rgba(13,148,136,.05);
    border-radius: 2px;
    resize: none;
    font-size: inherit;
    padding: 1px 3px;
}
.zeugnis-fill-field input[type="text"]:focus,
.zeugnis-fill-field textarea:focus {
    outline: 2px solid rgba(13,148,136,.4);
    outline-offset: 0;
}
.zeugnis-fill-field input[type="date"] { border-radius: 2px; }
.zeugnis-fill-field--grade select {
    border: 1px solid var(--color-primary, #0d9488);
    border-radius: 2px;
    background: rgba(13,148,136,.05);
}
.zeugnis-fill-field--saved input,
.zeugnis-fill-field--saved textarea,
.zeugnis-fill-field--saved select {
    border-color: var(--color-success, #059669) !important;
}

/* Vertical button group */
.btn-group--vertical { flex-direction: column; align-items: stretch; }

/* --- Responsive --- */
@media (max-width: 1100px) {
    .zeugnis-editor-layout {
        grid-template-columns: 180px 1fr 220px;
    }
}
@media (max-width: 860px) {
    .zeugnis-editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
    }
    .zeugnis-editor-toolbar { grid-column: 1; }
    .zeugnis-fill-layout { grid-template-columns: 1fr; }
    .zeugnis-fill-sidebar { position: static; }
    .card-grid { grid-template-columns: 1fr; }
}
