:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    --school-color: #10b981;
    --school-bg: rgba(16, 185, 129, 0.15);
    --work-color: #3b82f6;
    --work-bg: rgba(59, 130, 246, 0.15);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

/* Dynamic Background Gradients */
.bg-gradient-1 {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.3) 0%, rgba(15, 23, 42, 0) 70%);
    filter: blur(80px);
    z-index: -1;
    animation: float1 20s infinite alternate ease-in-out;
}

.bg-gradient-2 {
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, rgba(15, 23, 42, 0) 70%);
    filter: blur(80px);
    z-index: -1;
    animation: float2 15s infinite alternate ease-in-out;
}

@keyframes float1 {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(5%, 10%);
    }
}

@keyframes float2 {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-10%, -5%);
    }
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: var(--glass-shadow);
}

.app-container {
    display: flex;
    height: 100vh;
    padding: 24px;
    gap: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Sidebar */
.sidebar {
    width: 280px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-links li a:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.nav-links li.active a {
    color: var(--text-main);
    background: rgba(79, 70, 229, 0.2);
    border: 1px solid rgba(79, 70, 229, 0.3);
}

.sidebar-settings-btn {
    width: 100%;
    justify-content: flex-start;
    margin-top: 8px;
    margin-bottom: 18px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-info .role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.actions {
    display: flex;
    gap: 12px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.primary-btn:hover {
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.content-scroll {
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding-bottom: 40px;
}

/* Custom Scrollbar */
.content-scroll::-webkit-scrollbar {
    width: 6px;
}

.content-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.content-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.content-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.stat-card {
    padding: 24px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.school-icon {
    background: var(--school-bg);
    color: var(--school-color);
}

.work-icon {
    background: var(--work-bg);
    color: var(--work-color);
}

.status-icon {
    background: rgba(236, 72, 153, 0.15);
    color: var(--secondary);
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.text-gradient {
    background: linear-gradient(90deg, #f8fafc, var(--text-muted));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-trend {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-trend.positive {
    color: var(--school-color);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
}

/* Entries List */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#dashboardView .entries-container {
    margin-top: 28px;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.filter-pills {
    display: flex;
    gap: 8px;
}

.pill {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.2s;
}

.pill:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pill.active {
    background: rgba(79, 70, 229, 0.4);
    border-color: rgba(99, 102, 241, 0.8);
    color: #f8fafc;
}

.pill.school:hover {
    border-color: var(--school-color);
    color: var(--school-color);
}

.pill.work:hover {
    border-color: var(--work-color);
    color: var(--work-color);
}

.days-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.day-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.day-header {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.day-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.day-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.day-hours {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.day-content {
    display: flex;
    flex-direction: column;
}

.entry-item {
    display: flex;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    transition: background 0.2s;
}

.entry-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.entry-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.school-entry::before {
    background-color: var(--school-color);
}

.work-entry::before {
    background-color: var(--work-color);
}

.entry-time {
    width: 120px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.entry-details {
    flex-grow: 1;
}

.entry-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.tag {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.school-tag {
    background: var(--school-bg);
    color: var(--school-color);
}

.work-tag {
    background: var(--work-bg);
    color: var(--work-color);
}

.entry-desc {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.entry-desc a {
    color: var(--work-color);
}

.entry-duration {
    font-weight: 600;
    color: var(--text-muted);
}

.day-actions {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.01);
}

.icon-text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 0;
    font-size: 0.9rem;
}

.icon-text-btn:hover {
    color: var(--text-main);
    transform: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(3, 8, 20, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

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

.auth-card {
    width: min(460px, 100%);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.auth-card h2 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-actions {
    display: flex;
    gap: 10px;
}

.modal {
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.settings-modal {
    max-width: 560px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-body {
    padding: 40px 24px;
    text-align: center;
}

.settings-modal .modal-body {
    padding: 24px;
    text-align: left;
    overflow-y: auto;
}

.settings-tabs {
    display: flex;
    gap: 8px;
    padding: 6px;
    margin-bottom: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.18);
}

.settings-tab-btn {
    flex: 1;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.settings-tab-btn.active {
    color: var(--text-main);
    border-color: rgba(79, 70, 229, 0.4);
    background: rgba(79, 70, 229, 0.25);
}

.settings-panel {
    display: block;
}

.integration-accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.integration-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.18);
    padding: 10px 12px;
}

.integration-item summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

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

.integration-item[open] summary {
    margin-bottom: 12px;
}

.settings-account-box {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.18);
}

.settings-account-box h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.settings-account-box p {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.settings-log {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.settings-log h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.settings-log-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 140px;
    overflow-y: auto;
}

.settings-log-item {
    font-size: 0.85rem;
    line-height: 1.35;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.settings-log-item.success {
    border-left: 3px solid #10b981;
}

.settings-log-item.error {
    border-left: 3px solid #ef4444;
}

.settings-log-item.empty {
    color: var(--text-muted);
}

.sync-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.sync-animation p {
    font-weight: 500;
    font-size: 1.1rem;
}

.sub-text {
    color: var(--text-muted);
    font-size: 0.9rem !important;
}

.sync-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sync-success.hidden {
    display: none;
}

.sync-success h3 {
    color: var(--school-color);
    font-size: 1.2rem;
}

.sync-success p {
    color: var(--text-muted);
}

/* Settings Form */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.form-actions {
    margin-top: 16px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
}

.settings-message {
    margin-top: 8px;
    font-size: 0.9rem;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Berichtsheft Template */
.berichtsheft-template {
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
}

.editor-actions {
    max-width: 900px;
    margin: 0 auto 14px auto;
    display: flex;
    justify-content: flex-end;
}

.bh-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.bh-header-row td {
    padding: 20px 24px;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.95rem;
    line-height: 1.8;
}

.bh-header-row strong {
    font-size: 1.1rem;
}

.bh-label {
    border-right: 1px solid var(--border-color);
    vertical-align: top;
}

.bh-label:last-child {
    border-right: none;
}

.bh-section-header {
    padding: 10px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(79, 70, 229, 0.1);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.bh-cell {
    padding: 4px;
    border-bottom: 1px solid var(--border-color);
}

.bh-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 12px 20px;
    resize: vertical;
    min-height: 80px;
}

.bh-textarea:focus {
    outline: none;
    background: rgba(79, 70, 229, 0.05);
}

.bh-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.bh-inline-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--text-muted);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 2px 4px;
    width: 200px;
}

.bh-inline-input:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.bh-footer-row td {
    border-top: 2px solid var(--border-color);
}

.bh-sign-cell {
    padding: 16px 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-right: 1px solid var(--border-color);
    vertical-align: bottom;
    height: 100px;
}

.bh-sign-cell:last-child {
    border-right: none;
}

/* Editor-first UX overrides */
body {
    overflow: auto;
    min-height: 100vh;
}

.editor-first-layout {
    display: block;
    max-width: 1500px;
}

.main-content {
    width: 100%;
    gap: 16px;
}

.top-bar {
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-cluster {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-cluster h1 {
    font-size: 1.2rem;
    line-height: 1.2;
}

.brand-cluster p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.toolbar-cluster {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    margin-left: auto;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.editor-pane {
    min-width: 0;
}

.editor-taskbar {
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    padding: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.entries-sidepanel {
    border-radius: var(--radius-lg);
    padding: 20px;
    position: sticky;
    top: 0;
    max-height: calc(100vh - 120px);
    overflow: auto;
}

.entries-sidepanel .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
}

.entries-sidepanel .section-header h2 {
    font-size: 1rem;
}

.entries-sidepanel .days-list {
    gap: 12px;
}

.entries-sidepanel .day-header {
    padding: 12px 14px;
}

.entries-sidepanel .entry-item {
    padding: 12px 14px;
}

.entries-sidepanel .entry-time {
    width: 72px;
    font-size: 0.82rem;
}

.entries-sidepanel .entry-title {
    font-size: 0.95rem;
}

.entries-sidepanel .entry-desc {
    font-size: 0.85rem;
}

.entries-sidepanel .entry-duration {
    font-size: 0.8rem;
}

.day-actions {
    display: none;
}

.berichtsheft-template {
    max-width: none;
}

.bh-section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.inline-ai-btn {
    padding: 8px 12px;
    font-size: 0.84rem;
    white-space: nowrap;
}

#dashboardView,
#weekView,
.sidebar {
    display: none !important;
}
/* Entries toggle button & collapsible */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.entries-toggle-btn {
    display: flex;
    flex-shrink: 0;
    min-width: 32px;
}

.entries-toggle-btn svg {
    transition: transform 0.3s ease;
}

.entries-toggle-btn.collapsed svg {
    transform: rotate(-90deg);
}

@media (max-width: 1150px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .entries-sidepanel {
        position: static;
        max-height: none;
    }

    .toolbar-cluster {
        align-items: flex-start;
        width: 100%;
    }

    /* Show toggle button on tablet and below */
    .entries-toggle-btn {
        display: flex;
    }

    /* Collapsible entries */
    .entries-collapsible {
        max-height: 2000px;
        overflow: hidden;
        transition: max-height 0.4s ease, opacity 0.3s ease;
        opacity: 1;
    }

    .entries-collapsible.collapsed {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
    }

    .filter-pills.collapsed {
        display: none;
    }
}

@media (max-width: 760px) {
    .app-container {
        padding: 8px;
    }

    .top-bar {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .brand-cluster h1 {
        font-size: 1rem;
    }

    .brand-cluster p {
        font-size: 0.75rem;
    }

    .toolbar-cluster {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .date-selector {
        width: 100%;
        justify-content: space-between;
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    .actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .actions .btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    .actions .btn span {
        display: none;
    }

    .actions .btn svg {
        flex-shrink: 0;
    }

    .actions .btn::after {
        font-size: 0.75rem;
        font-weight: 600;
    }

    #syncWebUntisBtn::after { content: "Sync"; }
    #exportPdfBtn::after { content: "PDF"; }
    #settingsBtn { font-size: 0.78rem; padding: 10px 14px; }

    /* Entries sidepanel — collapsible on mobile */
    .entries-sidepanel {
        padding: 12px;
        border-radius: var(--radius-md);
    }

    .entries-sidepanel .section-header {
        gap: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    .entries-sidepanel .section-header h2 {
        font-size: 1rem;
    }

    .entries-toggle-btn {
        display: flex !important;
        flex-shrink: 0;
        min-width: 32px;
        background: rgba(255, 255, 255, 0.1);
    }

    .filter-pills {
        gap: 4px;
    }

    .pill {
        padding: 4px 10px;
        font-size: 0.78rem;
    }

    .entries-sidepanel .day-header {
        padding: 8px 10px;
    }

    .entries-sidepanel .day-name {
        font-size: 0.88rem;
    }

    .entries-sidepanel .entry-item {
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .entries-sidepanel .entry-time {
        width: auto;
        font-size: 0.78rem;
    }

    .entries-sidepanel .entry-title {
        font-size: 0.85rem;
        gap: 6px;
    }

    .entries-sidepanel .entry-desc {
        font-size: 0.78rem;
    }

    .entries-sidepanel .entry-duration {
        font-size: 0.75rem;
    }

    .tag {
        font-size: 0.65rem;
        padding: 1px 6px;
    }

    /* Editor taskbar */
    .editor-taskbar {
        padding: 8px;
        gap: 6px;
    }

    .editor-taskbar .btn {
        width: 100%;
        justify-content: center;
        font-size: 0.82rem;
        padding: 10px 12px;
    }

    /* Berichtsheft template mobile */
    .bh-header-row td {
        display: block;
        width: 100% !important;
        border-right: none;
        padding: 12px 14px;
    }

    .bh-header-row td:last-child {
        border-top: 1px solid var(--border-color);
    }

    .bh-inline-input {
        width: 100%;
        max-width: 200px;
    }

    .bh-section-header {
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    .bh-textarea {
        padding: 10px 14px;
        font-size: 0.88rem;
        min-height: 60px;
    }

    .bh-sign-cell {
        padding: 12px 14px;
        height: 70px;
        font-size: 0.78rem;
    }

    .bh-section-header-with-action {
        flex-direction: column;
        align-items: flex-start;
    }

    .inline-ai-btn {
        width: 100%;
        justify-content: center;
    }

    /* Auth overlay */
    .auth-card {
        margin: 12px;
        padding: 20px !important;
    }

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

    .auth-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Settings modal */
    .settings-modal-body {
        padding: 12px;
    }

    .settings-tab-bar {
        flex-direction: column;
    }
}

/* Extra-small screens (narrow phones) */
@media (max-width: 400px) {
    .app-container {
        padding: 4px;
    }

    .top-bar {
        padding: 10px;
    }

    .brand-cluster {
        gap: 8px;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
    }

    .logo-icon svg {
        width: 18px;
        height: 18px;
    }

    .brand-cluster h1 {
        font-size: 0.9rem;
    }

    .bh-header-row td {
        padding: 10px 12px;
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .bh-header-row strong {
        font-size: 0.95rem;
    }
}

/* ================================== */
/* Print Styles (PDF Export)          */
/* ================================== */
@media print {
    /* Hide everything except the Berichtsheft */
    body {
        background: white !important;
        color: black !important;
        overflow: visible !important;
    }

    .bg-gradient-1,
    .bg-gradient-2,
    .top-bar,
    .entries-sidepanel,
    .editor-taskbar,
    .editor-actions,
    .auth-overlay,
    .settings-modal-overlay {
        display: none !important;
    }

    .app-container,
    .main-content,
    .content-scroll,
    .workspace-grid,
    .editor-pane {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        overflow: visible !important;
        height: auto !important;
    }

    .berichtsheft-template {
        background: white !important;
        border: 2px solid black !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        border-radius: 0 !important;
        max-width: none !important;
        page-break-inside: avoid;
    }

    .bh-table {
        border: 1px solid black;
    }

    .bh-table td {
        border: 1px solid #333 !important;
        color: black !important;
    }

    .bh-header-row td {
        border-bottom: 2px solid black !important;
    }

    .bh-section-header {
        background: #f0f0f0 !important;
        color: black !important;
        border-color: #333 !important;
    }

    .bh-textarea {
        color: black !important;
        border: none !important;
        padding: 8px 12px !important;
        font-size: 11pt !important;
        resize: none !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .bh-inline-input {
        color: black !important;
        border-bottom: 1px solid #999 !important;
        font-size: 11pt !important;
    }

    .bh-sign-cell {
        color: #333 !important;
        border-color: #333 !important;
        height: 80px !important;
    }

    .bh-footer-row td {
        border-top: 2px solid black !important;
    }

    @page {
        size: A4;
        margin: 15mm;
    }
}

