/* ============================================================
   SCHULSTUBE - Stylesheet
   ============================================================ */

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; font: inherit; }
fieldset { border: none; }
[hidden] { display: none !important; }

/* === BASE === */
html {
    font-family: var(--font-family);
    font-size: 100%;
    line-height: 1.5;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--type-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY === */
h1 { font-size: var(--type-display); font-weight: var(--weight-bold); line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: var(--type-title-1); font-weight: var(--weight-bold); line-height: 1.21; letter-spacing: -0.015em; }
h3 { font-size: var(--type-title-2); font-weight: var(--weight-semibold); line-height: 1.27; letter-spacing: -0.01em; }
h4 { font-size: var(--type-title-3); font-weight: var(--weight-semibold); line-height: 1.2; }
h5 { font-size: var(--type-headline); font-weight: var(--weight-semibold); line-height: 1.29; }
h6 { font-size: var(--type-subhead); font-weight: var(--weight-medium); line-height: 1.33; }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }
strong { font-weight: var(--weight-semibold); }
small { font-size: var(--type-footnote); color: var(--text-secondary); }
hr { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-6) 0; }

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--bg-tertiary);
    padding: 0.1em 0.3em;
    border-radius: var(--radius-xs);
}

a:not([class]) {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
a:not([class]):hover {
    color: var(--accent-primary-hover);
}

/* === APP LAYOUT === */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* === SIDEBAR (Desktop) === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    z-index: var(--z-sidebar);
    overflow-y: auto;
}

.sidebar-header {
    padding-bottom: var(--space-5);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
    font-size: var(--type-title-2);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    display: block;
    letter-spacing: -0.01em;
}

.sidebar-subtitle {
    font-size: var(--type-caption);
    color: var(--text-tertiary);
    display: block;
    margin-top: var(--space-1);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: var(--weight-medium);
    font-size: var(--type-callout);
    transition: all var(--transition-fast);
}

.sidebar-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary);
    font-weight: var(--weight-semibold);
}

.sidebar-nav-item .icon {
    flex-shrink: 0;
}

.sidebar-section-label {
    font-size: var(--type-caption);
    font-weight: var(--weight-medium);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-5) var(--space-4) var(--space-2);
}

.sidebar-footer {
    padding-top: var(--space-5);
    margin-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.sidebar-user-name {
    font-size: var(--type-subhead);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.sidebar-user-role {
    font-size: var(--type-caption);
    color: var(--text-tertiary);
}

.sidebar-dev-switch {
    margin: var(--space-xs) 0;
    padding: var(--space-xs);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    text-align: center;
}
.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* === CONTENT AREA === */
.content-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding-bottom: var(--space-8);
}

.content-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-7) var(--space-6);
}

.content-narrow {
    max-width: var(--content-narrow);
}

/* === BOTTOM NAV (Mobile) === */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    justify-content: space-around;
    padding: var(--space-2) 0 env(safe-area-inset-bottom, var(--space-2));
    z-index: var(--z-sidebar);
    height: var(--bottom-nav-height);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: var(--type-caption);
    color: var(--text-tertiary);
    padding: var(--space-2) var(--space-3);
    transition: color var(--transition-fast);
}

.bottom-nav-item.active {
    color: var(--accent-primary);
}

.bottom-nav-item .icon {
    width: 22px;
    height: 22px;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .sidebar { display: none; }
    .content-area { margin-left: 0; }
    .bottom-nav { display: flex; }
    .content-area { padding-bottom: calc(var(--bottom-nav-height) + var(--space-6)); }
    .content-container { padding: var(--space-5) var(--space-4); }
}

/* === PAGE HEADER === */
.page-header {
    margin-bottom: var(--space-6);
}

.page-header h1 { margin-bottom: var(--space-2); }

.page-subtitle {
    font-size: var(--type-subhead);
    color: var(--text-secondary);
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

/* === CARDS === */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-xs);
}

.card + .card {
    margin-top: var(--space-4);
}

.card-elevated {
    background: var(--bg-elevated);
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.card-header h3 { margin: 0; }

.card-footer {
    padding-top: var(--space-4);
    margin-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* === BUTTONS === */
.btn-primary,
.btn-secondary,
.btn-text,
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-sm);
    font-weight: var(--weight-semibold);
    font-size: var(--type-callout);
    font-family: var(--font-family);
    line-height: 1.5;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-secondary {
    background: transparent;
    color: var(--accent-primary);
    border-color: var(--border-default);
}
.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-strong);
}

.btn-text {
    background: none;
    color: var(--accent-primary);
    padding: var(--space-2) var(--space-3);
}
.btn-text:hover { background: var(--bg-tertiary); }

.btn-danger {
    background: var(--color-error);
    color: var(--text-on-accent);
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--type-footnote);
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem var(--space-3);
    border-radius: var(--radius-xs);
    font-size: var(--type-caption);
    font-weight: var(--weight-semibold);
    line-height: 1.5;
    white-space: nowrap;
}

/* Subtle subject badges */
.badge-deutsch { background: var(--subject-deutsch-bg); color: var(--subject-deutsch-text); border: 1px solid var(--subject-deutsch-border); }
.badge-mathematik { background: var(--subject-mathematik-bg); color: var(--subject-mathematik-text); border: 1px solid var(--subject-mathematik-border); }
.badge-nmg { background: var(--subject-nmg-bg); color: var(--subject-nmg-text); border: 1px solid var(--subject-nmg-border); }
.badge-bg { background: var(--subject-bg-bg); color: var(--subject-bg-text); border: 1px solid var(--subject-bg-border); }
.badge-ttg { background: var(--subject-ttg-bg); color: var(--subject-ttg-text); border: 1px solid var(--subject-ttg-border); }
.badge-musik { background: var(--subject-musik-bg); color: var(--subject-musik-text); border: 1px solid var(--subject-musik-border); }
.badge-bus { background: var(--subject-bus-bg); color: var(--subject-bus-text); border: 1px solid var(--subject-bus-border); }
.badge-mi { background: var(--subject-mi-bg); color: var(--subject-mi-text); border: 1px solid var(--subject-mi-border); }
.badge-ueberfachlich { background: var(--subject-ueberfachlich-bg); color: var(--subject-ueberfachlich-text); border: 1px solid var(--subject-ueberfachlich-border); }

.badge-projekt { background: var(--subject-bg-bg); color: var(--subject-bg-text); border: 1px solid var(--subject-bg-border); }
.badge-exkursion { background: var(--subject-nmg-bg); color: var(--subject-nmg-text); border: 1px solid var(--subject-nmg-border); }

/* Status badges */
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-error { background: var(--color-error-bg); color: var(--color-error); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }

/* === FLASH MESSAGES === */
.flash {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    font-size: var(--type-subhead);
}

.flash-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--accent-secondary);
}

.flash-error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

/* === FORM ELEMENTS === */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
    font-family: var(--font-family);
    font-size: var(--type-body);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 100%;
    transition: border-color var(--transition-fast);
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

label {
    display: block;
    font-size: var(--type-subhead);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

label > input,
label > select,
label > textarea {
    margin-top: var(--space-2);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B5E52' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-4) center;
    padding-right: var(--space-8);
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: var(--space-2);
    accent-color: var(--accent-primary);
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

/* === TABLES === */
.table-wrap {
    overflow-x: auto;
    margin-bottom: var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--type-subhead);
}

.table th {
    text-align: left;
    font-weight: var(--weight-semibold);
    font-size: var(--type-caption);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

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

.table tbody tr:hover {
    background: var(--bg-tertiary);
}

.table a {
    color: var(--accent-primary);
    text-decoration: none;
}
.table a:hover { text-decoration: underline; }

/* === STAT GRID === */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    text-align: center;
    padding: var(--space-5);
}

.stat-value {
    font-size: var(--type-display);
    font-weight: var(--weight-bold);
    line-height: 1.1;
    color: var(--text-primary);
}

.stat-label {
    font-size: var(--type-caption);
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

/* === BREADCRUMB === */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--type-subhead);
    color: var(--text-tertiary);
    margin-bottom: var(--space-5);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}
.breadcrumb a:hover { color: var(--accent-primary); }

.breadcrumb .separator {
    color: var(--text-tertiary);
}

/* === ACCORDION (details/summary) === */
.accordion {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.accordion summary {
    padding: var(--space-4) var(--space-5);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.accordion summary::-webkit-details-marker { display: none; }

.accordion summary::after {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239C8E80' stroke-width='1.75'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.accordion[open] summary::after {
    transform: rotate(180deg);
}

.accordion > :not(summary) {
    padding: 0 var(--space-5) var(--space-5);
}

/* Nested accordion (competencies) */
.accordion .accordion {
    border-color: var(--border-subtle);
    box-shadow: none;
}

/* === COMPETENCY ITEMS === */
.comp-item {
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid var(--border-default);
    margin-bottom: var(--space-2);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.comp-item-covered {
    border-left-color: var(--color-success);
    background: var(--color-success-bg);
}

.comp-item-open {
    border-left-color: var(--border-default);
    opacity: 0.7;
}

.comp-code {
    font-family: var(--font-mono);
    font-size: var(--type-caption);
    background: var(--bg-tertiary);
    padding: 0.1em 0.4em;
    border-radius: var(--radius-xs);
    margin-right: var(--space-2);
    font-weight: var(--weight-medium);
}

/* === COMPETENCY TAGS (selected in form) === */
.comp-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--accent-primary);
    color: var(--text-on-accent);
    border-radius: var(--radius-xs);
    font-size: var(--type-caption);
}

.comp-tag button {
    background: none;
    border: none;
    color: var(--text-on-accent);
    cursor: pointer;
    padding: 0;
    font-size: var(--type-subhead);
    line-height: 1;
    margin: 0;
    width: auto;
    opacity: 0.8;
}
.comp-tag button:hover { opacity: 1; }

/* Competency search results */
#competency-results label {
    display: block;
    padding: var(--space-3) var(--space-4);
    font-size: var(--type-subhead);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: background var(--transition-fast);
}

#competency-results label:hover {
    background: var(--bg-tertiary);
}

#selected-competencies {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

/* === ENTRY META === */
.entry-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.entry-meta dt {
    font-weight: var(--weight-semibold);
    font-size: var(--type-caption);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.entry-meta dd {
    margin: 0 0 var(--space-3);
    font-size: var(--type-subhead);
}

/* === ATTACHMENT GRID === */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.attachment-card {
    text-align: center;
}

.attachment-card img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
}

.attachment-card small {
    display: block;
    margin-top: var(--space-2);
    word-break: break-all;
    color: var(--text-secondary);
}

/* === DEADLINE WARNING === */
.deadline-warning {
    color: var(--color-error);
    font-weight: var(--weight-bold);
}

/* === LOGIN PAGE === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-5);
}

.login-card {
    width: min(400px, 100%);
}

.login-card h1 {
    text-align: center;
    margin-bottom: var(--space-6);
}

.login-footer {
    text-align: center;
    margin-top: var(--space-5);
    font-size: var(--type-caption);
    color: var(--text-tertiary);
}

/* === ERROR PAGE === */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-5);
}

.error-code {
    font-size: 4rem;
    font-weight: var(--weight-bold);
    color: var(--text-tertiary);
    line-height: 1;
    margin-bottom: var(--space-4);
}

/* === ICON === */
.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* === UTILITIES === */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-small { font-size: var(--type-footnote); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-4); }
.flex-center { display: flex; align-items: center; gap: var(--space-3); }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: var(--space-2); }
.gap-md { gap: var(--space-4); }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-3); }
.mb-md { margin-bottom: var(--space-5); }
.mb-lg { margin-bottom: var(--space-7); }
.mt-md { margin-top: var(--space-5); }

.w-full { width: 100%; }
.block { display: block; }

/* === DARK MODE TOGGLE === */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: all var(--transition-fast);
}
.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* === WEEK PLANNER === */

.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.week-title {
    text-align: center;
    font-size: var(--type-title-3);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    transition: background 0.15s;
}
.week-title:hover { background: var(--color-bg-secondary); }
.week-title svg { opacity: 0.4; vertical-align: -1px; margin-left: 2px; }

/* --- Kalender-Overlay --- */
.cal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.3);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 12vh;
}
.cal-popup {
    background: var(--color-bg); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
    width: 320px; max-width: 90vw;
}
.cal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-sm);
}
.cal-month-label {
    font-weight: var(--weight-semibold);
    font-size: var(--type-headline);
}
.cal-nav {
    background: none; border: none; cursor: pointer;
    padding: var(--space-xs); border-radius: var(--radius-sm);
    color: var(--color-text);
    display: flex; align-items: center;
}
.cal-nav:hover { background: var(--color-bg-secondary); }

.cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-xs);
    font-weight: var(--weight-medium);
}
.cal-days {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; gap: 2px;
}
.cal-day {
    padding: 6px 0; border-radius: var(--radius-sm);
    cursor: pointer; font-size: var(--text-sm);
    transition: background 0.1s;
}
.cal-day:hover { background: var(--color-bg-secondary); }
.cal-day--empty { cursor: default; }
.cal-day--empty:hover { background: none; }
.cal-day--today {
    font-weight: var(--weight-bold);
    color: var(--color-accent);
}
.cal-day--active {
    background: var(--color-accent);
    color: #fff;
    font-weight: var(--weight-semibold);
}
.cal-day--active:hover { background: var(--color-accent-hover); }
.cal-day--weekend { opacity: 0.4; }
.cal-footer {
    text-align: center; margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
}

.planner-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

@media (max-width: 1024px) {
    .planner-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}

.planner-day {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.planner-day--holiday {
    opacity: 0.5;
    background: var(--bg-tertiary);
}

.planner-day-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
}

.planner-day-name {
    font-weight: var(--weight-semibold);
    font-size: var(--type-subhead);
    display: block;
}

.planner-day-date {
    font-size: var(--type-caption);
    color: var(--text-tertiary);
}

.planner-entries {
    flex: 1;
    padding: var(--space-2);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.planner-entry {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: var(--type-footnote);
    transition: box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.planner-entry:hover {
    box-shadow: var(--shadow-sm);
}

.planner-entry--done {
    opacity: 0.6;
}

.planner-entry--done .planner-entry-title {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.planner-entry--ghost {
    opacity: 0.4;
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.planner-entry--chosen {
    box-shadow: var(--shadow-md);
}

.planner-entry-handle {
    cursor: grab;
    color: var(--text-tertiary);
    flex-shrink: 0;
    padding: 2px 0;
}

.planner-entry-handle:active {
    cursor: grabbing;
}

.planner-entry-check {
    background: none;
    border: none;
    padding: 2px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    cursor: pointer;
    line-height: 1;
}

.planner-entry--done .planner-entry-check {
    color: var(--color-success, #5E7B5A);
}

.planner-check-empty {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-xs);
}

.planner-entry-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.planner-entry-title {
    font-weight: var(--weight-medium);
    line-height: 1.3;
    word-break: break-word;
}

.planner-entry-actions {
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.planner-entry:hover .planner-entry-actions {
    opacity: 1;
}

.planner-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    margin: var(--space-2);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: var(--type-caption);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.planner-add-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.planner-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.planner-entry .badge {
    padding: 0 var(--space-2);
    font-size: var(--type-caption-small);
    line-height: 1.6;
}

.planner-holiday-label {
    display: block;
    font-size: var(--type-caption-small);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

/* === DATEIABLAGE === */

/* Kachel-Grid (Level 1 + Level 2) */
.file-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.file-tiles--subjects {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-4);
}

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

/* Einzelne Kachel */
.file-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--space-3);
    padding: var(--space-7) var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-default);
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
}

.file-tile:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.file-tile-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--accent-primary-subtle);
    color: var(--accent-primary);
}

.file-tile--info .file-tile-icon {
    background: var(--color-info-bg);
    color: var(--color-info);
}
.file-tile--success .file-tile-icon {
    background: var(--color-success-bg);
    color: var(--color-success);
}
.file-tile--warning .file-tile-icon {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.file-tile-label {
    font-size: var(--type-headline);
    font-weight: var(--weight-semibold);
    margin: 0;
}

.file-tile-count {
    font-size: var(--type-caption);
    color: var(--text-tertiary);
}

/* Subject-Kachel */
.file-tile--subject {
    padding: var(--space-5) var(--space-4);
    background: var(--tile-bg, var(--bg-elevated));
    color: var(--tile-text, var(--text-primary));
    border-color: var(--tile-border, var(--border-subtle));
    gap: var(--space-2);
}

.file-tile--subject:hover {
    filter: brightness(0.97);
    transform: translateY(-1px);
}

.file-tile--subject .file-tile-label {
    font-size: var(--type-body);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--type-footnote);
    color: var(--text-tertiary);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--accent-primary);
    text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb-sep {
    color: var(--text-tertiary);
    user-select: none;
}

/* Dateibrowser Actions */
.file-browser-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

/* Ordner-Liste */
.folder-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
    text-decoration: none;
    color: var(--text-primary);
}

.folder-item:hover {
    background: var(--bg-tertiary);
}

.folder-item-icon {
    color: var(--color-warning);
    flex-shrink: 0;
}

.folder-item-name {
    flex: 1;
    font-weight: var(--weight-medium);
}

.folder-item-meta {
    font-size: var(--type-caption);
    color: var(--text-tertiary);
}

.folder-item-actions {
    display: flex;
    gap: var(--space-2);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.folder-item:hover .folder-item-actions {
    opacity: 1;
}

/* Datei-Zeile */
.file-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.file-row:hover {
    background: var(--bg-tertiary);
}

.file-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: var(--weight-bold);
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.file-type-pdf  { background: #B5493A; }
.file-type-docx { background: #2B579A; }
.file-type-xlsx { background: #217346; }
.file-type-txt  { background: var(--text-secondary); }
.file-type-img  { background: var(--accent-secondary); }

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

.file-row-name {
    font-weight: var(--weight-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-row-name a {
    color: var(--text-primary);
    text-decoration: none;
}

.file-row-name a:hover { color: var(--accent-primary); }

.file-row-meta {
    font-size: var(--type-caption);
    color: var(--text-tertiary);
    display: flex;
    gap: var(--space-3);
}

.file-row-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.file-row-actions a,
.file-row-actions button {
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.file-row-actions a:hover,
.file-row-actions button:hover {
    color: var(--accent-primary);
}

/* Vorschau */
.file-preview-container {
    max-width: 100%;
    margin: var(--space-5) 0;
}

.file-preview-container canvas,
.file-preview-container img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.file-preview-docx {
    background: var(--bg-elevated);
    padding: var(--space-6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    max-height: 80vh;
    overflow-y: auto;
}

.pdf-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

/* Upload-Bereich */
.upload-area {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-5);
    text-align: center;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    margin-bottom: var(--space-5);
}

.upload-area:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-subtle);
    color: var(--accent-primary);
}

/* Ordner-Form (inline) */
.folder-form-inline {
    display: flex;
    gap: var(--space-3);
    align-items: end;
    margin-bottom: var(--space-5);
}

.folder-form-inline input[type="text"] {
    flex: 1;
    max-width: 300px;
}

/* Notiz-Formular */
.note-form {
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    margin-bottom: var(--space-4);
}

.note-form-header {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.note-name-input {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--type-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
}

.note-form-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.note-content-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--type-body);
    font-family: var(--font-mono);
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.note-name-input:focus,
.note-content-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Leerer Zustand */
.file-empty {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--text-tertiary);
}

.file-empty-icon {
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

/* === EINSTELLUNGEN === */

.settings-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--type-title-3);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-weight: var(--weight-medium);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.font-mono {
    font-family: var(--font-mono);
    font-size: var(--type-caption);
}

/* === INSPEKTIONEN === */

/* Zwei-Spalten-Layout */
.inspection-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-6);
    align-items: start;
}

@media (max-width: 900px) {
    .inspection-layout {
        grid-template-columns: 1fr;
    }
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--type-title-3);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

/* Protokoll-Karte */
.inspection-card .inspection-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.inspection-actions .btn-text.btn-sm {
    font-size: var(--type-caption);
    padding: var(--space-1) var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

/* Export-Buttons in Einzelansicht */
.inspection-export-buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--type-subhead);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

/* Datei-Panel (rechte Spalte) */
.inspection-files {
    position: sticky;
    top: var(--space-4);
}

.inspection-upload-form {
    margin-bottom: var(--space-4);
}

.upload-area.compact {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    color: var(--text-secondary);
    font-size: var(--type-subhead);
}

.upload-area.compact:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.file-empty.compact {
    padding: var(--space-5) var(--space-3);
    text-align: center;
}

/* Datei-Liste (kompakt) */
.inspection-file-list .file-row.compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--space-2);
}

.inspection-file-list .file-row.compact:last-child {
    border-bottom: none;
}

.file-row-main {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    flex: 1;
}

.file-row-main .file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.file-row-main .file-name {
    font-size: var(--type-subhead);
    font-weight: var(--weight-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-row-main .file-meta {
    font-size: var(--type-caption);
    color: var(--text-tertiary);
}

.file-row-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.file-row-actions a {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.file-row-actions a:hover {
    color: var(--accent-primary);
}

.btn-icon {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.btn-icon:hover {
    color: var(--danger, #c44);
}

/* Meta-Grid (Einzelansicht) */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.meta-grid dt {
    font-weight: var(--weight-semibold);
    font-size: var(--type-caption);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}

.meta-grid dd {
    margin: 0;
    font-size: var(--type-subhead);
}

/* === PRINT === */
@media print {
    .sidebar,
    .bottom-nav,
    .no-print,
    .btn-primary,
    .btn-secondary,
    .btn-text,
    .btn-danger,
    .theme-toggle {
        display: none !important;
    }

    .content-area {
        margin-left: 0 !important;
    }

    body {
        font-size: 11pt;
        background: white;
        color: black;
    }

    .card, .card-elevated {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    h1 { font-size: 18pt; }
    h2 { font-size: 14pt; }
    h3 { font-size: 12pt; }
}

/* ============================================================
   DASHBOARD (Rollenbasiert)
   ============================================================ */

/* --- Greeting --- */
.dash-greeting { margin-bottom: var(--space-lg); }
.dash-greeting h1 { font-weight: 500; font-size: 1.5rem; }

/* --- Sections --- */
.dash-section { margin-bottom: var(--space-xl); }
.dash-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.dash-section-header h2 { font-size: 1.1rem; font-weight: 600; }

/* --- Entry List (Familie) --- */
.dash-entries {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.dash-entry {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    transition: background 0.15s, opacity 0.15s;
}

.dash-entry--done {
    opacity: 0.55;
}
.dash-entry--done .dash-entry-title {
    text-decoration: line-through;
    color: var(--color-text-tertiary);
}

/* Check Button */
.dash-entry-check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    padding: 0;
    border-radius: 50%;
    color: var(--color-text-secondary);
    transition: color 0.15s, background 0.15s;
}
.dash-entry-check:hover {
    background: var(--color-bg-hover);
}

.dash-check-empty {
    display: block;
    width: 22px;
    height: 22px;
    border: 2px solid var(--color-border-strong);
    border-radius: 50%;
}

.dash-check-done {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-accent);
    color: white;
}

/* Entry Content */
.dash-entry-content {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
    min-width: 0;
}
.dash-entry-title {
    font-weight: 450;
}

/* Preview (frei-Tag Vorschau) */
.dash-entry--preview {
    padding: var(--space-xs) var(--space-md);
    border: none;
    background: none;
    gap: var(--space-xs);
}
.dash-entries--preview {
    gap: 2px;
}

/* Free Day Card */
.dash-free-day {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
}
.dash-free-day h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-xs);
}

/* Empty State */
.dash-empty {
    text-align: center;
    padding: var(--space-lg);
}
.dash-empty .btn-primary { margin-top: var(--space-sm); }

/* Week Progress Bar (Familie) */
.dash-week-bar {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.dash-week-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* --- Week Grid (Begleitung) --- */
.dash-week-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-sm);
}

.dash-week-day {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: var(--space-sm);
    min-height: 80px;
}
.dash-week-day--today {
    border-color: var(--color-accent);
    border-width: 2px;
}
.dash-week-day--holiday {
    opacity: 0.5;
}
.dash-week-day-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-xs);
}

.dash-week-entries {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: var(--space-xs);
}

.dash-week-entry {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}
.dash-week-entry--done { opacity: 0.5; }

.dash-week-check {
    display: inline-flex;
    width: 14px;
    flex-shrink: 0;
    color: var(--color-accent);
}

/* --- LP21 Grid (Begleitung) --- */
.dash-lp21-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-sm);
}
.dash-lp21-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: var(--space-sm) var(--space-md);
}
.dash-lp21-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
}

/* Inspection Preview */
.dash-inspection {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    color: var(--color-text-secondary);
}
.dash-inspection .icon { flex-shrink: 0; margin-top: 2px; }

/* Small Badge */
.badge-sm { font-size: 0.7rem; padding: 1px 6px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .dash-week-grid {
        grid-template-columns: 1fr;
    }
    .dash-week-day { min-height: auto; }
    .dash-lp21-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === TICKETSYSTEM === */

/* Ticket-Filter */
.ticket-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.ticket-filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.ticket-filter-label {
    font-size: var(--text-sm);
    color: var(--clr-text-secondary);
    min-width: 4rem;
}

.ticket-filter-btn {
    display: inline-block;
    padding: var(--space-2xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--clr-text-secondary);
    background: var(--clr-bg-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ticket-filter-btn:hover {
    background: var(--clr-bg-tertiary);
    color: var(--clr-text-primary);
}

.ticket-filter-btn.active {
    background: var(--clr-accent);
    color: #fff;
}

/* Ticket-Liste */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.ticket-card {
    display: block;
    background: var(--clr-bg-card);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    text-decoration: none;
    color: var(--clr-text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ticket-card:hover {
    border-color: var(--clr-accent);
    box-shadow: var(--shadow-sm);
}

.ticket-card--compact {
    padding: var(--space-sm) var(--space-md);
}

.ticket-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
    flex-wrap: wrap;
}

.ticket-card-title {
    font-weight: 500;
    margin-bottom: var(--space-2xs);
}

.ticket-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
    font-size: var(--text-sm);
    color: var(--clr-text-tertiary);
}

.ticket-card-meta .icon { vertical-align: -2px; }

/* Status-Badges */
.badge-status-offen {
    background: rgba(var(--clr-warning-rgb, 194, 120, 50), 0.15);
    color: var(--clr-bg, #C27832);
}
[data-theme="dark"] .badge-status-offen {
    background: rgba(194, 120, 50, 0.2);
    color: #e0a060;
}

.badge-status-in_bearbeitung {
    background: rgba(var(--clr-info-rgb, 91, 126, 149), 0.15);
    color: var(--clr-mathematik, #5B7E95);
}
[data-theme="dark"] .badge-status-in_bearbeitung {
    background: rgba(91, 126, 149, 0.2);
    color: #8bb0cc;
}

.badge-status-erledigt {
    background: rgba(var(--clr-success-rgb, 94, 123, 90), 0.15);
    color: var(--clr-nmg, #5E7B5A);
}
[data-theme="dark"] .badge-status-erledigt {
    background: rgba(94, 123, 90, 0.2);
    color: #8eb08a;
}

/* Ticket-Einzelansicht */
.ticket-detail {
    margin-bottom: var(--space-xl);
}

.ticket-detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
}

.ticket-detail-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin: 0 0 var(--space-xs);
}

.ticket-detail-meta {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--clr-text-secondary);
    margin-bottom: var(--space-md);
}

.ticket-detail-body {
    line-height: 1.7;
    color: var(--clr-text-primary);
}

/* Status-Dropdown */
.ticket-status-form {
    display: flex;
    align-items: center;
}

.ticket-status-select {
    padding: var(--space-2xs) var(--space-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-border);
    background: var(--clr-bg-card);
    font-size: var(--text-sm);
    font-family: inherit;
    cursor: pointer;
    color: var(--clr-text-primary);
}

.ticket-status-select.status-offen { border-color: #C27832; }
.ticket-status-select.status-in_bearbeitung { border-color: var(--clr-mathematik); }
.ticket-status-select.status-erledigt { border-color: var(--clr-nmg); }

/* Kommentare */
.comment-section {
    border-top: 1px solid var(--clr-border);
    padding-top: var(--space-lg);
}

.comment-section h2 {
    margin-bottom: var(--space-md);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.comment-item {
    padding: var(--space-md);
    background: var(--clr-bg-secondary);
    border-radius: var(--radius-md);
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.comment-author {
    font-weight: 500;
    font-size: var(--text-sm);
}

.comment-date {
    font-size: var(--text-xs);
    color: var(--clr-text-tertiary);
}

.comment-content {
    line-height: 1.6;
}

/* System-Kommentare */
.comment-system {
    background: transparent;
    padding: var(--space-xs) var(--space-md);
    border-left: 2px solid var(--clr-border);
}

.comment-system-content {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--clr-text-tertiary);
    font-style: italic;
}

.comment-system-content .icon {
    flex-shrink: 0;
    opacity: 0.5;
}

/* Kommentar-Formular */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.comment-form textarea {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-base);
    background: var(--clr-bg-card);
    color: var(--clr-text-primary);
    resize: vertical;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--clr-accent);
}

.comment-form .btn-primary {
    align-self: flex-end;
}

/* Logbuch */
.logbook-timeline {
    display: flex;
    flex-direction: column;
}

.logbook-month {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--clr-text-primary);
    padding: var(--space-md) 0 var(--space-xs);
    border-bottom: 1px solid var(--clr-border);
    margin-bottom: var(--space-sm);
}

.logbook-entry {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--clr-bg-tertiary);
}

.logbook-entry-date {
    flex-shrink: 0;
    width: 3.5rem;
    font-size: var(--text-sm);
    color: var(--clr-text-tertiary);
    font-weight: 500;
}

.logbook-entry-content {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
    font-size: var(--text-sm);
}

.logbook-entry-title {
    font-weight: 500;
    color: var(--clr-text-primary);
    text-decoration: none;
}

.logbook-entry-title:hover {
    color: var(--clr-accent);
}

.logbook-entry-author {
    margin-left: auto;
}

.logbook-entry--comment {
    padding-left: var(--space-md);
    opacity: 0.8;
}

@media (max-width: 768px) {
    .ticket-filter-group {
        flex-wrap: wrap;
    }
    .logbook-entry {
        flex-direction: column;
        gap: var(--space-2xs);
    }
    .logbook-entry-date {
        width: auto;
    }
    .logbook-entry-author {
        margin-left: 0;
    }
}
