/* ============================================================
   E-MAIL MANAGER – DASHBOARD (App-Shell)
   Sidebar, Toolbar, E-Mail-Liste, Paginierung, Verschieben-Menü,
   Label- und Zustellstatus-Modals, Responsive, Druck
   ============================================================ */

.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: var(--z-sticky);
    transition: transform var(--transition-slow);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--toolbar-height);
    padding: 0 var(--space-5);
    border-bottom: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    text-decoration: none;
}

/* Symbol und Titel sind ein Verweis zur Grundansicht */
a.sidebar-header:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
}

a.sidebar-header:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: -2px;
}

.sidebar-header h2 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    letter-spacing: -0.01em;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-header img {
    max-height: 32px;
    max-width: 100%;
    object-fit: contain;
}

.sidebar-header .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    flex-shrink: 0;
}

.sidebar-header .brand-mark .icon {
    width: 17px;
    height: 17px;
}

/* Neue E-Mail + Suche */
.sidebar-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4) var(--space-3);
}

.btn-compose {
    flex: 1;
    min-height: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--color-primary) 70%, transparent);
}

.sidebar-icon-btn {
    width: 40px;
    height: 40px;
    min-height: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--sidebar-hover);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    flex-shrink: 0;
}

.sidebar-icon-btn:hover {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
}

/* Postfach-Auswahl */
.mailbox-select {
    padding: var(--space-2) var(--space-4) var(--space-3);
}

.mailbox-select label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mailbox-select select {
    width: 100%;
    min-height: 36px;
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--sidebar-border);
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    font-size: var(--text-sm);
    cursor: pointer;
    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='%239fb0c6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.mailbox-select select:hover,
.mailbox-select select:focus {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: var(--sidebar-active);
    outline: none;
}

.mailbox-select select option {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
}

/* Abschnitts-Überschriften in der Sidebar.
   Die ganze Seitenleiste folgt einem Spaltenraster, gemessen vom linken Rand:
   Pfeil mittig auf 15 px, Symbol mittig auf 33 px, Text ab 54 px, Zähler/Knöpfe rechts mittig 35 px vor dem Rand.
   Überschriften, Ordner, Aufgaben, Favoriten, Labels und Entwürfe halten diese Linien ein. */
.sidebar-section-header,
.favorites-header,
.labels-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) 23px var(--space-1) var(--space-3);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Blöcke mit eigenem Seitenrand: Kopfzeile bündig mit der Ordner-Überschrift */
.favorites-section > .favorites-header,
.labels-section > .labels-header {
    padding-left: 0;
    padding-right: 11px;
}

.sidebar-section-header span,
.favorites-header span,
.labels-header span {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.sidebar-section-header .icon,
.favorites-header .icon,
.labels-header .icon {
    width: 14px;
    height: 14px;
}

.sidebar-mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-mini-btn:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.sidebar-mini-btn .icon {
    width: 14px;
    height: 14px;
}

/* Scrollbarer Mittelteil */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: var(--space-3);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
}

/* Ordner */
.folder-nav {
    padding: 0 var(--space-3);
}

.folder-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 36px;
    padding: var(--space-2) var(--space-3);
    margin-bottom: 1px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    position: relative;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.folder-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.folder-item.active {
    background: var(--sidebar-active);
    color: #ffffff;
}

.folder-item.active::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-3));
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

.folder-item .folder-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    color: var(--sidebar-text-muted);
    flex-shrink: 0;
}

.folder-item .folder-icon .icon {
    width: 18px;
    height: 18px;
}

.folder-item:hover .folder-icon,
.folder-item.active .folder-icon {
    color: var(--sidebar-text);
}

.folder-item .folder-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-item .badge {
    margin-left: auto;
    min-width: 22px;
    padding: 1px var(--space-2);
    justify-content: center;
    background: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
}

.folder-item.drag-over {
    background: color-mix(in srgb, var(--color-primary) 35%, transparent);
    outline: 2px dashed var(--color-primary);
    outline-offset: -2px;
}

/* Favoriten & Labels */
.favorites-section,
.labels-section {
    padding: var(--space-2) var(--space-3) 0;
    margin-top: var(--space-2);
    border-top: 1px solid var(--sidebar-border);
}

.favorites-list,
.labels-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.favorite-item,
.label-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 34px;
    padding: var(--space-2) var(--space-3);
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.favorite-item:hover,
.label-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.favorite-item.active,
.label-item.active {
    background: var(--sidebar-active);
    color: #ffffff;
    font-weight: var(--font-medium);
}

.contact-avatar-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--font-semibold);
    color: #ffffff;
    flex-shrink: 0;
}

.favorite-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.label-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

/* Farbpunkt und Kontaktbild sitzen mittig in der Symbolspalte, der Name beginnt in der Textspalte */
.label-item .label-dot {
    margin: 0 4px;
}

.favorite-item .contact-avatar-mini {
    margin: 0 -3px;
}

.label-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.label-count {
    font-size: var(--text-2xs);
    color: var(--sidebar-text-muted);
    background: rgba(0, 0, 0, 0.25);
    padding: 1px var(--space-2);
    border-radius: var(--radius-full);
}

.sidebar-empty {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    color: var(--sidebar-text-muted);
}

/* Sidebar-Fuß: Benutzermenü */
.sidebar-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.18);
}

.footer-menu {
    position: relative;
}

.footer-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-align: left;
    transition: background var(--transition-fast);
}

.footer-toggle:hover,
.footer-toggle.open {
    background: var(--sidebar-hover);
}

.footer-toggle .avatar {
    width: 32px;
    height: 32px;
    font-size: var(--text-xs);
}

.footer-toggle .footer-user {
    flex: 1;
    min-width: 0;
}

.footer-toggle .footer-user-name {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.footer-toggle .footer-user-mail {
    display: block;
    font-size: var(--text-2xs);
    color: var(--sidebar-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.footer-toggle .toggle-arrow {
    color: var(--sidebar-text-muted);
    transition: transform var(--transition-fast);
}

.footer-toggle.open .toggle-arrow {
    transform: rotate(180deg);
}

.footer-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + var(--space-2));
    padding: var(--space-2);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-dropdown);
}

.footer-dropdown.open {
    display: block;
    animation: fadeIn var(--transition-fast);
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.dropdown-link .icon {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
}

.dropdown-link:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}

.dropdown-link.logout-link {
    color: var(--color-danger);
}

.dropdown-link.logout-link .icon {
    color: var(--color-danger);
}

.dropdown-link.logout-link:hover {
    background: var(--color-danger-bg);
}

/* ------------------------------------------------------------
   Hauptbereich & Toolbar
   ------------------------------------------------------------ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-bg);
    min-width: 0;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--toolbar-height);
    padding: 0 var(--space-5);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.mobile-menu-btn {
    display: none;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 560px;
    min-width: 0;
    height: 38px;
    padding-left: var(--space-3);
    border-radius: var(--radius-lg);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.search-box:focus-within {
    background: var(--color-bg-elevated);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.search-box > .icon {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 var(--space-3);
    border: none;
    background: transparent;
    font-size: var(--text-sm);
    color: var(--color-text);
}

.search-box input::placeholder {
    color: var(--color-text-muted);
}

.search-box input:focus {
    outline: none;
}

.search-box button,
.search-box .advanced-search-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 100%;
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.search-box button:hover,
.search-box .advanced-search-link:hover {
    color: var(--color-primary);
    background: var(--color-bg-hover);
}

.toolbar-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
    margin-left: auto;
}

.toolbar-actions .btn-icon.is-busy .icon {
    animation: spin 0.9s linear infinite;
}

/* Kontakt-Filter (Favorit) */
.contact-tabs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
    background: var(--color-primary-light);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.contact-tabs-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--font-medium);
    color: var(--color-text);
}

.contact-tab-btn {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.contact-tab-btn:hover {
    color: var(--color-text);
}

.contact-tab-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

/* ------------------------------------------------------------
   E-Mail-Liste
   ------------------------------------------------------------ */
.email-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--color-bg-elevated);
}

.email-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 56px;
    padding: var(--space-2) var(--space-5) var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    position: relative;
    transition: background var(--transition-fast);
}

/* Ungelesen: vier Merkmale zugleich, damit der Unterschied auf einen Blick sichtbar ist –
   getönte Zeile mit Balken links, Punkt am Absenderbild, fette Schrift, farbiges Datum.
   Gelesene Zeilen treten zurück (normale Schrift, gedämpfte Farbe). */
.email-item.unread {
    background: var(--color-unread-bg);
}

.email-item:hover {
    background: var(--color-bg-hover);
}

.email-item.selected {
    background: var(--color-primary-light);
}

.email-item.dragging {
    opacity: 0.5;
}

.email-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
}

.email-item.unread .email-sender,
.email-item.unread .email-subject {
    font-weight: var(--font-bold);
    color: var(--color-text);
}

.email-item.unread .email-date {
    font-weight: var(--font-semibold);
    color: color-mix(in srgb, var(--color-primary) 55%, var(--color-text));
}

/* Punkt am Absenderbild – wie die Markierung "neu" auf einem App-Symbol */
.email-item.unread .email-avatar {
    position: relative;
}

.email-item.unread .email-avatar::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-bg-elevated);
}

/* Auswahlzone: das Kästchen samt "toter" Fläche ringsum (volle Zeilenhöhe, bis an den linken Rand).
   Ein Klick oder Tipp knapp neben dem Kästchen wählt die E-Mail aus, statt sie zu öffnen – der Klick zum
   Öffnen beginnt erst rechts davon. */
.email-select {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    flex-shrink: 0;
    width: 40px;
    margin: calc(-1 * var(--space-2)) 0 calc(-1 * var(--space-2)) calc(-1 * var(--space-4));
    padding-left: var(--space-2);
    cursor: default;
}

.email-checkbox {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.email-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    color: var(--color-border-strong);
    flex-shrink: 0;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.email-star .icon {
    width: 17px;
    height: 17px;
}

.email-star:hover {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.email-star.starred {
    color: var(--color-warning);
}

.email-star.starred .icon {
    fill: currentColor;
}

.email-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    color: #ffffff;
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.03em;
    flex-shrink: 0;
    user-select: none;
}

.email-sender {
    width: 190px;
    flex-shrink: 0;
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.email-subject {
    flex: 1;
    min-width: 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-labels {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
}

.label-chip {
    display: inline-block;
    max-width: 96px;
    padding: 1px var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-2xs);
    font-weight: var(--font-medium);
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-attachment {
    display: inline-flex;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.email-attachment .icon {
    width: 15px;
    height: 15px;
}

.email-date {
    width: 112px;
    flex-shrink: 0;
    text-align: right;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Aktionen erscheinen beim Überfahren rechts über dem Datum */
.email-item .email-actions {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: var(--space-1);
    padding-left: var(--space-4);
    background: linear-gradient(90deg, transparent, var(--color-bg-hover) 30%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.email-item:hover .email-actions,
.email-item:focus-within .email-actions {
    opacity: 1;
    pointer-events: auto;
}

.email-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.email-action-btn .icon {
    width: 15px;
    height: 15px;
}

.email-action-btn:hover {
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.email-action-btn.delete-btn:hover,
.email-action-btn.spam-btn:hover {
    background: var(--color-danger-bg);
    border-color: color-mix(in srgb, var(--color-danger) 40%, transparent);
    color: var(--color-danger);
}

.email-action-btn.label-btn:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Touch: Aktionen immer sichtbar */
@media (hover: none) {
    .email-item .email-actions {
        position: static;
        transform: none;
        opacity: 1;
        pointer-events: auto;
        background: none;
        padding-left: 0;
    }
}

/* Zustellstatus in der Liste (Gesendet-Ordner) */
.delivery-status {
    display: inline-flex;
    align-items: center;
    width: 26px;
    height: 26px;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.delivery-status:hover {
    background: var(--color-bg-muted);
}

.delivery-status .ds-icon {
    width: 18px;
    height: 12px;
}

.delivery-status.delivery-delivered { color: var(--color-text-secondary); }
.delivery-status.delivery-read .ds-icon,
.ds-read { color: var(--color-info); }
.ds-failed,
.delivery-status.delivery-failed,
.delivery-status.delivery-bounced { color: var(--color-danger); font-weight: var(--font-bold); }

.drag-badge {
    position: absolute;
    right: var(--space-3);
    top: var(--space-2);
    min-width: 22px;
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    text-align: center;
}

/* ------------------------------------------------------------
   Paginierung
   ------------------------------------------------------------ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-3);
    background: var(--color-bg-elevated);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.pagination:empty {
    display: none;
}

.pagination button,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-elevated);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.pagination span {
    border: none;
    color: var(--color-text-muted);
}

.pagination button:hover:not(:disabled) {
    background: var(--color-bg-hover);
    color: var(--color-text);
}

.pagination button.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .icon {
    width: 15px;
    height: 15px;
}

/* ------------------------------------------------------------
   Verschieben-Menü
   ------------------------------------------------------------ */
.move-dropdown {
    position: relative;
}

.move-dropdown-menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    padding: var(--space-2);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    display: none;
}

.move-dropdown-menu.open {
    display: block;
    animation: fadeIn var(--transition-fast);
}

.move-menu-header {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.move-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.move-menu-item:hover {
    background: var(--color-bg-hover);
}

.move-menu-item .icon {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
}

/* ------------------------------------------------------------
   Label-Modals
   ------------------------------------------------------------ */
.label-form {
    padding: var(--space-5) var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.label-form-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.label-form-row input[type="text"] {
    flex: 1;
}

.label-form-row input[type="color"] {
    width: 42px;
    height: 40px;
    padding: 3px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-bg-elevated);
    cursor: pointer;
}

.label-list-manager {
    max-height: 340px;
    overflow-y: auto;
    padding: var(--space-2) var(--space-4);
}

.label-manager-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2);
    border-radius: var(--radius-md);
}

.label-manager-item:hover {
    background: var(--color-bg-hover);
}

.label-manager-item .label-name {
    flex: 1;
    font-weight: var(--font-medium);
    color: var(--color-text);
}

.label-manager-item .label-email-count {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.label-manager-item .label-actions {
    display: flex;
    gap: var(--space-1);
}

.label-assign-list {
    max-height: 320px;
    overflow-y: auto;
    padding: var(--space-4) var(--space-4) var(--space-2);
}

.label-assign-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.label-assign-item:hover {
    background: var(--color-bg-hover);
}

.label-assign-item .label-name {
    flex: 1;
    color: var(--color-text);
}

/* ------------------------------------------------------------
   Zustellstatus-Modal
   ------------------------------------------------------------ */
.delivery-overview {
    padding: var(--space-6) var(--space-6) var(--space-4);
}

.delivery-steps {
    display: flex;
    align-items: flex-start;
}

.delivery-step {
    flex: 0 0 auto;
    width: 96px;
    text-align: center;
}

.step-dot {
    width: 14px;
    height: 14px;
    margin: 0 auto var(--space-2);
    border-radius: var(--radius-full);
    background: var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-bg-elevated);
}

.step-dot.active {
    background: var(--color-success);
}

.step-dot.failed {
    background: var(--color-danger);
}

.step-line {
    flex: 1;
    height: 2px;
    margin-top: 6px;
    background: var(--color-border);
}

.step-line.line-active {
    background: var(--color-success);
}

.step-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
}

.delivery-step.step-active .step-label {
    color: var(--color-text);
}

.step-time {
    margin-top: 2px;
    font-size: var(--text-2xs);
    color: var(--color-text-muted);
}

.delivery-section {
    padding: var(--space-3) var(--space-6);
    border-top: 1px solid var(--color-border);
}

.delivery-section-title {
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.delivery-recipient {
    font-size: var(--text-sm);
    color: var(--color-text);
    word-break: break-word;
}

.delivery-mdn-hint {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-3) var(--space-6);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--color-info-bg);
    font-size: var(--text-sm);
}

.delivery-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.delivery-event {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.delivery-event-icon {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.delivery-event-details {
    font-size: var(--text-sm);
    color: var(--color-text);
}

.delivery-event-date,
.hint-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.delivery-no-data {
    padding: var(--space-8) var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.delivery-no-data .icon {
    width: 40px;
    height: 40px;
    color: var(--color-border-strong);
    margin-bottom: var(--space-3);
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1199px) {
    .sidebar {
        width: 248px;
    }

    .email-sender {
        width: 160px;
    }
}

@media (max-width: 991px) {
    .sidebar {
        width: 228px;
    }

    .email-sender {
        width: 130px;
    }
}

@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 284px;
        transform: translateX(-100%);
        z-index: var(--z-overlay);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-overlay) - 1);
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition-base), visibility var(--transition-base);
    }

    .sidebar-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .toolbar {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-2);
    }

    .search-box .advanced-search-link {
        display: none;
    }

    /* Werkzeugleiste: Menü, Suche und Knöpfe in Daumengröße */
    .mobile-menu-btn {
        width: 44px;
        height: 44px;
    }

    .search-box {
        height: 44px;
    }

    .toolbar-actions .btn-icon {
        width: 42px;
        height: 42px;
    }

    .toolbar-actions .btn-icon .icon {
        width: 20px;
        height: 20px;
    }

    .pagination button,
    .pagination span {
        min-width: 42px;
        height: 42px;
    }

    /* Seitenleiste: höhere Zeilen, das Spaltenraster (Pfeil | Symbol | Text) bleibt */
    .btn-compose,
    .mailbox-select select {
        min-height: 44px;
    }

    .sidebar-icon-btn {
        width: 44px;
        height: 44px;
    }

    .folder-item,
    .favorite-item,
    .label-item {
        min-height: 44px;
    }

    .sidebar-mini-btn {
        width: 40px;
        height: 40px;
    }

    .sidebar-mini-btn .icon {
        width: 16px;
        height: 16px;
    }

    /* der größere Knopf bleibt mittig über der Zählerspalte */
    .sidebar-section-header {
        padding-right: 15px;
    }

    .favorites-section > .favorites-header,
    .labels-section > .labels-header {
        padding-right: 3px;
    }

    .footer-toggle {
        min-height: 48px;
    }

    .footer-dropdown .dropdown-link {
        min-height: 44px;
    }

    /* E-Mail-Liste: zwei gut lesbare Zeilen. Oben Absender und Datum, darunter der Betreff
       über die ganze Breite. Kästchen und Absenderbild stehen links mittig vor beiden Zeilen. */
    .email-list .email-item {
        display: grid;
        /* Das Datum (Tag + Uhrzeit) belegt die letzten beiden Spalten; darunter reicht der Betreff bis an den Stern */
        grid-template-columns: 52px 40px minmax(0, 1fr) auto auto auto 34px;
        grid-template-areas:
            "check avatar sender  clip    status  date    date"
            "check avatar content content content content star"
            "actions actions actions actions actions actions actions";
        gap: 0;
        align-items: center;
        padding: 11px var(--space-3) 11px var(--space-2);
        min-height: 0;
    }

    /* Auswahlzone: der ganze linke Streifen (52 px breit, volle Zeilenhöhe samt Rand) gehört zum Kästchen –
       ein Tippen daneben öffnet nicht mehr die E-Mail, sondern wählt sie aus */
    .email-list .email-select {
        grid-area: check;
        width: 52px;
        margin: -11px 0 -11px calc(-1 * var(--space-2));
        padding: 0 0 0 var(--space-2);
        align-self: stretch;
    }

    /* Auswahlkästchen: sichtbar 22 px, die Tippfläche ist die Auswahlzone */
    .email-list .email-checkbox {
        -webkit-appearance: none;
        appearance: none;
        width: 22px;
        height: 22px;
        margin: 0;
        border: 0;
        border-radius: 6px;
        background: var(--color-bg-elevated);
        box-shadow: inset 0 0 0 2px var(--color-border-strong);
    }

    .email-list .email-checkbox:checked {
        background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='5 12.5 10 17.5 19 7'/%3E%3C/svg%3E") center / 16px no-repeat;
        box-shadow: none;
    }

    .email-list .email-checkbox:focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
    }

    .email-avatar {
        grid-area: avatar;
        width: 40px;
        height: 40px;
        font-size: var(--text-xs);
    }

    .email-sender {
        grid-area: sender;
        width: auto;
        margin-left: var(--space-3);
    }

    /* am Telefon bleibt der Absender auch bei gelesenen E-Mails in voller Textfarbe (Lesbarkeit) */
    .email-item:not(.unread) .email-sender {
        color: var(--color-text);
    }

    .email-content {
        grid-area: content;
        margin-left: var(--space-3);
    }

    .email-attachment {
        grid-area: clip;
        margin-left: var(--space-2);
    }

    .email-item .delivery-status {
        grid-area: status;
        margin-left: var(--space-1);
    }

    .email-date {
        grid-area: date;
        width: auto;
        margin-left: var(--space-2);
    }

    /* Stern: 40 px Tippfläche, ohne die Zeile höher zu machen */
    .email-star {
        grid-area: star;
        justify-self: end;
        width: 40px;
        height: 40px;
        margin: -8px -10px -8px var(--space-1);
    }

    .email-star .icon {
        width: 20px;
        height: 20px;
    }

    /* Die Zeilen-Aktionen (Verschieben, Label, Spam, Löschen) erscheinen erst, wenn die E-Mail
       angehakt ist – dann als eigene Zeile mit großen Knöpfen. So bleibt der Betreff lesbar. */
    .email-item .email-actions {
        grid-area: actions;
        display: none;
        position: static;
        transform: none;
        opacity: 1;
        pointer-events: auto;
        background: none;
        justify-content: flex-end;
        gap: var(--space-2);
        padding: var(--space-2) 0 0;
    }

    .email-item:has(.email-checkbox:checked) {
        background: var(--color-primary-light);
    }

    .email-item:has(.email-checkbox:checked) .email-actions {
        display: flex;
    }

    .email-action-btn {
        width: 48px;
        height: 40px;
    }

    .email-action-btn .icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 575px) {
    .search-box {
        max-width: none;
        flex: 1 1 120px;
    }

    .search-box button {
        display: none;
    }

    .toolbar-actions {
        gap: var(--space-1);
    }

    .contact-tabs {
        width: 100%;
    }
}

/* ------------------------------------------------------------
   Druck
   ------------------------------------------------------------ */
@media print {
    .sidebar,
    .toolbar,
    .pagination,
    .modal,
    .notification,
    .toast,
    .email-actions {
        display: none !important;
    }

    .main-content {
        margin: 0;
    }
}

/* Overlay nur auf Mobilgeräten sichtbar; Fußzeile in der App-Shell über dem Inhalt schwebend */
.sidebar-overlay {
    display: none;
}

@media (max-width: 767px) {
    .sidebar-overlay {
        display: block;
    }
}

body.app-shell .app-footer {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border: none;
    background: transparent;
    pointer-events: none;
}

/* Zustell-Timeline: Ereignis-Icons farblich nach Typ */
.delivery-event-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
}

.delivery-event-icon .icon {
    width: 14px;
    height: 14px;
}

.delivery-event-delivered .delivery-event-icon { background: var(--color-success-bg); color: var(--color-success); }
.delivery-event-displayed .delivery-event-icon { background: var(--color-info-bg); color: var(--color-info); }
.delivery-event-delayed .delivery-event-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.delivery-event-bounced .delivery-event-icon,
.delivery-event-failed .delivery-event-icon,
.delivery-event-error .delivery-event-icon { background: var(--color-danger-bg); color: var(--color-danger); }

/* ------------------------------------------------------------
   Zeitraumfilter unter der Toolbar
   ------------------------------------------------------------ */
.toolbar-actions .btn-icon.open,
.toolbar-actions .btn-icon.active {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-active-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 100%;
    height: 32px;
    padding: 0 var(--space-1) 0 var(--space-3);
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    white-space: nowrap;
}

.filter-active-chip .icon {
    width: 14px;
    height: 14px;
}

.filter-active-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    color: inherit;
    transition: background var(--transition-fast);
}

.filter-active-chip button:hover {
    background: color-mix(in srgb, var(--color-primary) 18%, transparent);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    padding: var(--space-3) var(--space-5);
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.filter-quick {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-chip {
    padding: var(--space-1) var(--space-3);
    min-height: 32px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-strong);
    background: var(--color-bg-elevated);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    transition: all var(--transition-fast);
}

.filter-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.filter-range {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.filter-range label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
}

.filter-range .form-control {
    width: 150px;
    min-height: 34px;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-sm);
}

.filter-range .btn-sm {
    min-height: 34px;
}

@media (max-width: 767px) {
    .filter-bar {
        padding: var(--space-3);
        gap: var(--space-3);
    }

    .filter-range {
        width: 100%;
    }

    .filter-range .form-control {
        flex: 1 1 120px;
        width: auto;
    }

    .filter-range .btn-sm {
        flex: 1 1 45%;
    }

    .filter-active-chip {
        order: 5;
        flex-basis: 100%;
        justify-content: space-between;
    }
}

/* ------------------------------------------------------------
   Hinweise auf ungelesene E-Mails in anderen Postfächern
   ------------------------------------------------------------ */
.mailbox-alerts {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: var(--space-2);
}

.mailbox-alerts:empty {
    display: none;
}

.mailbox-alert {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-primary) 22%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-primary) 45%, transparent);
    color: var(--sidebar-text);
    font-size: var(--text-sm);
    text-align: left;
    transition: background var(--transition-fast);
}

.mailbox-alert:hover {
    background: color-mix(in srgb, var(--color-primary) 35%, transparent);
}

.mailbox-alert .icon {
    width: 15px;
    height: 15px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.mailbox-alert-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mailbox-alert .badge {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
}

/* Offene Aufgaben: Verweis zu den Aufgaben, in der Warnfarbe abgesetzt von den Postfach-Hinweisen */
a.mailbox-alert {
    text-decoration: none;
}

.mailbox-alert-tasks {
    background: color-mix(in srgb, var(--color-warning) 22%, transparent);
    border-color: color-mix(in srgb, var(--color-warning) 55%, transparent);
    font-weight: var(--font-medium);
}

.mailbox-alert-tasks:hover {
    background: color-mix(in srgb, var(--color-warning) 34%, transparent);
    color: var(--sidebar-text);
}

.mailbox-alert-tasks .icon {
    color: var(--color-warning);
}

.mailbox-alert .alert-go,
.mobile-alert .alert-go {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* Smartphone: dieselben Hinweise über der E-Mail-Liste (die Seitenleiste ist dort hinter dem Menü verborgen) */
.mobile-alerts {
    display: none;
}

@media (max-width: 767px) {
    .mobile-alerts {
        display: flex;
        gap: var(--space-2);
        padding: var(--space-2) var(--space-3);
        overflow-x: auto;
        background: var(--color-bg-elevated);
        border-bottom: 1px solid var(--color-border);
        flex-shrink: 0;
        scrollbar-width: none;
    }

    .mobile-alerts[hidden] {
        display: none;
    }

    .mobile-alerts::-webkit-scrollbar {
        display: none;
    }

    .mobile-alert {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        flex-shrink: 0;
        max-width: 100%;
        min-height: 40px;
        padding: 0 var(--space-3);
        border: 1px solid var(--color-border-strong);
        border-radius: var(--radius-full);
        background: var(--color-bg-subtle);
        color: var(--color-text);
        font-size: var(--text-sm);
        font-weight: var(--font-medium);
        text-decoration: none;
        white-space: nowrap;
    }

    .mobile-alert > .icon:first-child {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
        color: var(--color-primary);
    }

    .mobile-alert-name {
        min-width: 0;
        max-width: 55vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-alert .badge {
        background: var(--color-primary);
        color: var(--color-text-inverse);
        font-size: var(--text-2xs);
        font-weight: var(--font-semibold);
    }

    .mobile-alert-tasks {
        border-color: color-mix(in srgb, var(--color-warning) 60%, transparent);
        background: var(--color-warning-bg);
        color: var(--color-text);
    }

    .mobile-alert-tasks > .icon:first-child {
        color: var(--color-warning);
    }

    /* Punkt am Menü-Knopf, solange in der Seitenleiste ein Hinweis wartet */
    .mobile-menu-btn {
        position: relative;
    }

    .mobile-menu-btn.has-alerts::after {
        content: '';
        position: absolute;
        top: 7px;
        right: 7px;
        width: 10px;
        height: 10px;
        border-radius: var(--radius-full);
        background: var(--color-warning);
        box-shadow: 0 0 0 2px var(--color-bg-elevated);
    }
}

/* ------------------------------------------------------------
   Entwürfe in der Seitenleiste
   ------------------------------------------------------------ */
.sidebar-count {
    font-size: var(--text-2xs);
    color: var(--sidebar-text-muted);
    background: rgba(0, 0, 0, 0.25);
    padding: 1px var(--space-2);
    border-radius: var(--radius-full);
    text-transform: none;
    letter-spacing: 0;
}

.draft-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "title delete" "meta delete";
    column-gap: var(--space-2);
    /* links eingerückt bis zur Textspalte der Seitenleiste */
    padding: var(--space-2) var(--space-3) var(--space-2) 42px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.draft-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.draft-title {
    grid-area: title;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-meta {
    grid-area: meta;
    font-size: var(--text-2xs);
    color: var(--sidebar-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-delete {
    grid-area: delete;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.draft-item:hover .draft-delete,
.draft-delete:focus-visible {
    opacity: 1;
}

.draft-delete:hover {
    background: var(--color-danger);
    color: #ffffff;
}

.draft-delete .icon {
    width: 13px;
    height: 13px;
}

@media (hover: none) {
    .draft-delete {
        opacity: 1;
    }
}

/* ------------------------------------------------------------
   Aufgaben-Bereich in der Seitenleiste + Kennzeichen in der E-Mail-Liste
   ------------------------------------------------------------ */
.tickets-section .favorites-list {
    padding: 0;
}

.tickets-section .ticket-nav-item {
    min-height: 34px;
}

.tickets-section .badge.badge-muted {
    background: var(--color-warning);
    color: #1f1300;
}

.email-ticket-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    padding: 1px var(--space-2);
    border-radius: var(--radius-full);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    text-decoration: none;
    font-family: var(--font-mono, monospace);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.email-ticket-chip .icon {
    width: 12px;
    height: 12px;
}

.email-ticket-chip:hover {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.email-ticket-chip.is-question {
    border-color: var(--color-warning);
    color: var(--color-warning);
}

.email-ticket-chip.is-done {
    border-color: var(--color-success);
    color: var(--color-success);
}

/* ------------------------------------------------------------
   Ordner-Hierarchie in der Seitenleiste, Verschieben-Menü je Zeile
   ------------------------------------------------------------ */
.folder-item.folder-child {
    padding-left: calc(var(--space-3) + var(--folder-level, 0) * 16px);
}

/* Der Aufklapp-Pfeil steht in der Pfeilspalte links vom Ordnersymbol und verschiebt
   weder Symbol noch Namen – Ordner mit und ohne Unterordner bleiben in einer Linie. */
.folder-toggle {
    position: absolute;
    left: calc(var(--folder-level, 0) * 16px - 6px);
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.folder-toggle .icon {
    width: 12px;
    height: 12px;
    transition: transform var(--transition-fast);
}

.folder-toggle:hover {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
}

.folder-toggle.is-collapsed .icon {
    transform: rotate(-90deg);
}

/* Touch: größere Trefferfläche für den kleinen Pfeil */
@media (hover: none) {
    .folder-toggle::after {
        content: '';
        position: absolute;
        inset: -12px -6px -12px -8px;
    }
}

.move-menu-item {
    padding-left: calc(var(--space-3) + var(--folder-level, 0) * 14px);
}

.row-move-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: 240px;
    z-index: var(--z-overlay);
}

.email-action-btn.move-btn:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Kalender in der Seitenleiste: nächste Termine mit kurzer Zeitangabe */
.calendar-section .calendar-nav-item .folder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-nav-when {
    margin-left: auto;
    flex-shrink: 0;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Seitenleiste: aufklappbare Blöcke
   ------------------------------------------------------------ */
.sidebar-collapse {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    min-width: 0;
    min-height: 26px;
    margin: -2px 0 -2px -6px;
    padding: 2px 4px 2px 3px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: left;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.sidebar-collapse:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
}

.sidebar-collapse:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: 1px;
}

.sidebar-collapse .sidebar-collapse-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.sidebar-collapse[aria-expanded="false"] .sidebar-collapse-icon {
    transform: rotate(-90deg);
}

/* Zähler im Kopf nur zeigen, solange der Block zugeklappt ist */
.sidebar-collapse .sidebar-collapse-badge {
    margin-left: auto;
    letter-spacing: 0;
}

.sidebar-collapse[aria-expanded="true"] .sidebar-collapse-badge {
    display: none;
}

/* Zugeklappte Blöcke bekommen unten etwas Luft */
.sidebar-section-header:has(.sidebar-collapse[aria-expanded="false"]),
.favorites-header:has(.sidebar-collapse[aria-expanded="false"]),
.labels-header:has(.sidebar-collapse[aria-expanded="false"]) {
    padding-bottom: var(--space-2);
}

/* ------------------------------------------------------------
   Terminbereich im unteren Drittel (nur Notebook/Desktop)
   ------------------------------------------------------------ */
.dash-cal {
    display: none;
}

@media (min-width: 992px) and (min-height: 620px) {
    .dash-cal {
        --cal-own: var(--color-primary);
        --cal-invite: var(--color-success);
        --cal-pending: var(--color-warning);
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        border-top: 1px solid var(--color-border-strong);
        background: var(--color-bg-elevated);
    }

    .dash-cal-header {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        min-height: 44px;
        padding: 0 var(--space-4);
        border-bottom: 1px solid var(--color-border);
        background: var(--color-bg-subtle);
    }

    .dash-cal.is-collapsed .dash-cal-header {
        border-bottom: 0;
    }

    .dash-cal-toggle {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        min-height: 32px;
        padding: 0 var(--space-2);
        margin-left: calc(var(--space-2) * -1);
        border: 0;
        border-radius: var(--radius-sm);
        background: none;
        color: var(--color-text);
        font: inherit;
        font-size: var(--text-base);
        font-weight: var(--font-semibold);
        cursor: pointer;
    }

    .dash-cal-toggle:hover {
        background: var(--color-bg-hover);
    }

    .dash-cal-toggle .icon {
        width: 16px;
        height: 16px;
        color: var(--color-primary);
    }

    .dash-cal-toggle .dash-cal-chevron {
        width: 14px;
        height: 14px;
        color: var(--color-text-muted);
        transition: transform var(--transition-fast);
    }

    .dash-cal-toggle[aria-expanded="false"] .dash-cal-chevron {
        transform: rotate(-90deg);
    }

    .dash-cal-summary {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: var(--text-sm);
        color: var(--color-text-secondary);
    }

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

    .dash-cal-body {
        display: grid;
        grid-template-columns: 248px minmax(0, 1.15fr) minmax(0, 1fr);
        height: clamp(230px, 31vh, 320px);
    }

    .dash-cal-body > * {
        min-width: 0;
        min-height: 0;
        padding: var(--space-3) var(--space-4);
    }

    .dash-cal-body > * + * {
        border-left: 1px solid var(--color-border);
    }

    /* Monat */
    .dash-cal-month {
        display: flex;
        flex-direction: column;
    }

    .dash-cal-month-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-1);
        margin-bottom: var(--space-1);
    }

    .dash-cal-month-label {
        flex: 1;
        min-height: 28px;
        border: 0;
        border-radius: var(--radius-sm);
        background: none;
        color: var(--color-text);
        font: inherit;
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        cursor: pointer;
    }

    .dash-cal-month-label:hover {
        background: var(--color-bg-hover);
    }

    .dash-cal-weekdays,
    .dash-cal-grid {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .dash-cal-weekdays {
        font-size: 10px;
        font-weight: var(--font-semibold);
        color: var(--color-text-muted);
        text-align: center;
        text-transform: uppercase;
    }

    .dash-cal-grid {
        flex: 1;
        grid-auto-rows: minmax(0, 1fr);
        gap: 1px;
        margin-top: 2px;
    }

    .dash-cal-cell {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 0;
        padding: 0;
        border: 0;
        border-radius: var(--radius-sm);
        background: none;
        color: var(--color-text);
        font: inherit;
        font-size: var(--text-xs);
        font-variant-numeric: tabular-nums;
        cursor: pointer;
    }

    .dash-cal-cell:hover {
        background: var(--color-bg-hover);
    }

    .dash-cal-cell.is-other {
        color: var(--color-text-muted);
        opacity: 0.55;
    }

    .dash-cal-cell.is-today {
        background: var(--color-primary);
        color: var(--color-text-inverse);
        font-weight: var(--font-semibold);
    }

    .dash-cal-cell.is-selected {
        box-shadow: inset 0 0 0 2px var(--color-primary);
    }

    .dash-cal-cell.is-today.is-selected {
        box-shadow: inset 0 0 0 2px var(--color-primary), inset 0 0 0 3px var(--color-bg-elevated);
    }

    .dash-cal-cell i {
        position: absolute;
        bottom: 2px;
        left: 50%;
        width: 4px;
        height: 4px;
        margin-left: -2px;
        border-radius: var(--radius-full);
        background: var(--cal-own);
    }

    .dash-cal-cell i.is-invite { background: var(--cal-invite); }
    .dash-cal-cell i.is-pending { background: var(--cal-pending); }
    .dash-cal-cell.is-today i { background: var(--color-text-inverse); }

    /* Tag und Seitenspalte */
    .dash-cal-day,
    .dash-cal-side {
        display: flex;
        flex-direction: column;
    }

    .dash-cal-side {
        overflow-y: auto;
    }

    .dash-cal-title {
        margin: 0 0 var(--space-2);
        font-size: var(--text-2xs);
        font-weight: var(--font-semibold);
        color: var(--color-text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .dash-cal-side .dash-cal-title:not(:first-child) {
        margin-top: var(--space-3);
    }

    .dash-cal-day .dash-cal-events {
        flex: 1;
        overflow-y: auto;
        margin: 0 calc(var(--space-2) * -1);
    }

    .dash-cal-event {
        display: grid;
        grid-template-columns: 74px 3px minmax(0, 1fr);
        align-items: center;
        gap: var(--space-2);
        min-height: 34px;
        padding: 4px var(--space-2);
        border-radius: var(--radius-sm);
        color: var(--color-text);
        text-decoration: none;
    }

    .dash-cal-event:hover {
        background: var(--color-bg-hover);
    }

    .dash-cal-time {
        font-size: var(--text-xs);
        font-weight: var(--font-semibold);
        font-variant-numeric: tabular-nums;
        color: var(--color-text-secondary);
        white-space: nowrap;
    }

    .dash-cal-bar {
        align-self: stretch;
        border-radius: var(--radius-full);
        background: var(--cal-own);
    }

    .dash-cal-event.is-invite .dash-cal-bar { background: var(--cal-invite); }
    .dash-cal-event.is-pending .dash-cal-bar { background: var(--cal-pending); }
    .dash-cal-event.is-cancelled .dash-cal-bar { background: var(--color-text-muted); }
    .dash-cal-event.is-cancelled .dash-cal-name { text-decoration: line-through; color: var(--color-text-muted); }

    .dash-cal-text {
        display: flex;
        align-items: baseline;
        gap: var(--space-2);
        min-width: 0;
    }

    .dash-cal-name {
        font-size: var(--text-sm);
        font-weight: var(--font-medium);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dash-cal-loc {
        flex-shrink: 2;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: var(--text-xs);
        color: var(--color-text-muted);
    }

    .dash-cal-flag {
        flex-shrink: 0;
        padding: 0 6px;
        border-radius: var(--radius-full);
        background: var(--color-warning-bg);
        color: var(--color-warning);
        font-size: 10px;
        font-weight: var(--font-semibold);
        white-space: nowrap;
    }

    .dash-cal-flag.is-danger {
        background: var(--color-danger-bg);
        color: var(--color-danger);
    }

    .dash-cal-empty {
        margin: 0;
        padding: var(--space-2) 0;
        font-size: var(--text-sm);
        color: var(--color-text-muted);
    }

    /* Schnelleintrag */
    .dash-cal-quick {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 104px auto;
        gap: var(--space-2);
        margin-top: var(--space-2);
        padding-top: var(--space-2);
        border-top: 1px solid var(--color-border);
    }

    .dash-cal-quick .form-control {
        min-height: 32px;
        padding-block: 4px;
        font-size: var(--text-sm);
    }

    /* Offene Einladungen */
    .dash-cal-invite {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        padding: 4px 0;
    }

    .dash-cal-invite-info {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        color: var(--color-text);
        text-decoration: none;
    }

    .dash-cal-invite-info:hover .dash-cal-name {
        text-decoration: underline;
    }

    .dash-cal-respond {
        display: inline-flex;
        gap: 4px;
        flex-shrink: 0;
    }

    .dash-cal-respond button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        padding: 0;
        border: 1px solid var(--color-border-strong);
        border-radius: var(--radius-sm);
        background: var(--color-bg-elevated);
        color: var(--color-text-secondary);
        cursor: pointer;
    }

    .dash-cal-respond button .icon {
        width: 15px;
        height: 15px;
    }

    .dash-cal-respond button:disabled {
        opacity: 0.5;
        cursor: default;
    }

    .dash-cal-respond .is-accept { border-color: var(--color-success); color: var(--color-success); }
    .dash-cal-respond .is-decline { border-color: var(--color-danger); color: var(--color-danger); }
    .dash-cal-respond .is-accept:hover:not(:disabled) { background: var(--color-success); color: var(--color-text-inverse); }
    .dash-cal-respond .is-decline:hover:not(:disabled) { background: var(--color-danger); color: var(--color-text-inverse); }
    .dash-cal-respond .is-tentative:hover:not(:disabled) { background: var(--color-bg-muted); }

    .dash-cal-side .dash-cal-event {
        margin: 0 calc(var(--space-2) * -1);
        grid-template-columns: 92px 3px minmax(0, 1fr);
    }
}

/* Schmale Notebooks: Seitenspalte entfällt, Monat und Tag bleiben */
@media (min-width: 992px) and (max-width: 1199px) and (min-height: 620px) {
    .dash-cal-body {
        grid-template-columns: 232px minmax(0, 1fr);
    }

    .dash-cal-side {
        display: none;
    }
}

@media print {
    .dash-cal {
        display: none;
    }
}

/* Zähler "Heute" im Kalender-Menü: neutral statt Warnfarbe */
.calendar-section .badge.badge-muted {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
}

/* Fortschritt eines laufenden Abrufs (Erstabruf großer Postfächer läuft in Etappen) */
.sync-progress {
    position: fixed;
    top: 72px;
    right: var(--space-5);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: min(460px, calc(100vw - 2 * var(--space-4)));
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.sync-progress-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--color-primary);
    animation: spin 1.2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .sync-progress-icon {
        animation: none;
    }
}

/* Smartphone: kleine Pille unten in der Mitte, damit sie nichts verdeckt */
@media (max-width: 767px) {
    .sync-progress {
        top: auto;
        right: auto;
        left: 50%;
        bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
        transform: translateX(-50%);
        max-width: calc(100vw - 2 * var(--space-4));
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-xs);
        border-left-width: 1px;
        border-radius: var(--radius-full);
        text-align: center;
    }
}

/* Werkzeugleiste: "Papierkorb leeren" / "Spam-Ordner leeren" (nur in diesen Ordnern sichtbar) */
.toolbar-empty-folder {
    white-space: nowrap;
    color: var(--color-danger);
}

.toolbar-empty-folder[hidden] {
    display: none;
}

.toolbar-empty-folder .label-short {
    display: none;
}

@media (max-width: 767px) {
    /* am Smartphone die Kurzform – nur das Symbol wäre vom Löschen-Knopf daneben nicht zu unterscheiden */
    .toolbar-empty-folder .label-long {
        display: none;
    }

    .toolbar-empty-folder .label-short {
        display: inline;
    }

    /* Seitenleiste am Smartphone: Kopfzeilen und Entwürfe in Daumengröße
       (steht am Dateiende, weil die Grundregeln dieser Elemente erst nach dem großen Smartphone-Block kommen) */
    .draft-item {
        min-height: 48px;
        align-content: center;
    }

    .draft-delete {
        width: 36px;
        height: 36px;
    }

    .sidebar-collapse {
        min-height: 40px;
    }

    .tickets-section .ticket-nav-item {
        min-height: 44px;
    }
}

/* ------------------------------------------------------------
   Vorschaubereich rechts (Notebook/Desktop, zuschaltbar) – assets/js/reading-pane.js
   Die angeklickte E-Mail erscheint neben der Liste; darunter 1200 px Fensterbreite gibt es ihn nicht.
   ------------------------------------------------------------ */
.reading-pane-toggle,
.reading-pane,
.reading-pane-resizer {
    display: none;
}

@media (min-width: 1200px) {
    .reading-pane-toggle {
        display: inline-flex;
    }

    .reading-pane-toggle[aria-pressed="true"] {
        color: var(--color-primary);
        background: var(--color-primary-light);
        border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
    }

    .reading-pane:not([hidden]) {
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        width: var(--reading-pane-width, clamp(380px, 36vw, 720px));
        min-width: 0;
        background: var(--color-bg);
        overflow: hidden;
    }

    .reading-pane iframe {
        flex: 1;
        width: 100%;
        min-height: 0;
        border: 0;
        background: var(--color-bg);
    }

    .reading-pane iframe[hidden] {
        display: none;
    }

    .reading-pane-empty {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        padding: var(--space-8) var(--space-6);
        text-align: center;
        color: var(--color-text-muted);
    }

    .reading-pane-empty[hidden] {
        display: none;
    }

    .reading-pane-empty .icon {
        width: 48px;
        height: 48px;
        margin-bottom: var(--space-2);
        color: var(--color-border-strong);
    }

    .reading-pane-empty h3 {
        font-size: var(--text-lg);
        color: var(--color-text);
    }

    .reading-pane-empty p {
        max-width: 320px;
        font-size: var(--text-sm);
    }

    .reading-pane-hint {
        font-size: var(--text-xs) !important;
    }

    /* Trenner: zugleich der Griff zum Verstellen der Breite */
    .reading-pane-resizer:not([hidden]) {
        display: block;
        flex-shrink: 0;
        width: 7px;
        margin: 0 -3px;
        position: relative;
        z-index: 2;
        cursor: col-resize;
        touch-action: none;
    }

    .reading-pane-resizer::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 3px;
        width: 1px;
        background: var(--color-border-strong);
        transition: background var(--transition-fast), width var(--transition-fast), left var(--transition-fast);
    }

    .reading-pane-resizer:hover::before,
    .reading-pane-resizer:focus-visible::before,
    body.is-resizing-pane .reading-pane-resizer::before {
        left: 2px;
        width: 3px;
        background: var(--color-primary);
    }

    .reading-pane-resizer:focus-visible {
        outline: none;
    }

    /* Während des Ziehens darf der Rahmen die Mausbewegung nicht schlucken */
    body.is-resizing-pane {
        cursor: col-resize;
        user-select: none;
    }

    body.is-resizing-pane .reading-pane iframe {
        pointer-events: none;
    }

    /* Die in der Vorschau geöffnete E-Mail in der Liste */
    .email-item.is-open,
    .email-item.is-open:hover {
        background: var(--color-primary-light);
        box-shadow: inset 4px 0 0 var(--color-primary);
    }

    /* Die Liste ist mit Vorschau schmaler: Absenderspalte und Abstände straffen */
    body.has-reading-pane .email-sender {
        width: 150px;
    }

    body.has-reading-pane .email-item {
        gap: var(--space-2);
        padding-right: var(--space-4);
    }

    body.has-reading-pane .toolbar {
        padding: 0 var(--space-4);
    }
}

@media print {
    .reading-pane,
    .reading-pane-resizer {
        display: none !important;
    }
}

/* Mit Vorschau ist der Hauptbereich schmal: Terminbereich zweispaltig (Monat + Tag) wie auf kleinen Notebooks */
@media (min-width: 1200px) and (max-width: 1699px) {
    body.has-reading-pane .dash-cal-body {
        grid-template-columns: 232px minmax(0, 1fr);
    }

    body.has-reading-pane .dash-cal-side {
        display: none;
    }
}

/* Nach der Rückkehr aus der E-Mail-Ansicht: die zuletzt geöffnete E-Mail kurz hervorheben */
.email-item.is-returned {
    animation: email-returned 3s ease-out;
}

@keyframes email-returned {
    0%, 60% { box-shadow: inset 4px 0 0 var(--color-primary), inset 0 0 0 999px color-mix(in srgb, var(--color-primary) 12%, transparent); }
    100% { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
    .email-item.is-returned {
        animation: none;
        box-shadow: inset 4px 0 0 var(--color-primary);
    }
}

/* ------------------------------------------------------------
   Zeitversand: Hinweis "geplante E-Mail nicht gesendet" und Liste "Geplant" in der Seitenleiste
   ------------------------------------------------------------ */
.mailbox-alert-scheduled {
    background: color-mix(in srgb, var(--color-danger) 20%, transparent);
    border-color: color-mix(in srgb, var(--color-danger) 50%, transparent);
    font-weight: var(--font-medium);
}

.mailbox-alert-scheduled:hover {
    background: color-mix(in srgb, var(--color-danger) 30%, transparent);
    color: var(--sidebar-text);
}

.mailbox-alert-scheduled .icon {
    color: var(--color-danger);
}

@media (max-width: 767px) {
    .mobile-alert-scheduled {
        border-color: color-mix(in srgb, var(--color-danger) 55%, transparent);
        background: var(--color-danger-bg);
        color: var(--color-text);
    }

    .mobile-alert-scheduled > .icon:first-child {
        color: var(--color-danger);
    }
}

.scheduled-item {
    grid-template-areas: "title" "meta";
    grid-template-columns: 1fr;
}

.scheduled-item.is-failed .draft-meta {
    color: var(--color-danger);
}

.scheduled-section .sidebar-empty {
    display: block;
    text-decoration: none;
}

/* ------------------------------------------------------------
   Vorlesen auf diesem Gerät (Seitenleiste) – assets/js/readaloud.js
   ------------------------------------------------------------ */
.readaloud-section .favorites-header {
    padding-right: 11px;
}

.readaloud-section .switch {
    width: 34px;
    height: 20px;
}

.readaloud-section .switch .slider::before {
    width: 14px;
    height: 14px;
}

.readaloud-section .switch input:checked + .slider::before {
    transform: translateX(14px);
}

.readaloud-body {
    padding: 0 0 var(--space-2) 42px;
}

.readaloud-status {
    margin-bottom: var(--space-2);
    font-size: var(--text-2xs);
    line-height: 1.4;
    color: var(--sidebar-text-muted);
}

.readaloud-status.is-on {
    color: var(--sidebar-text);
}

.readaloud-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.readaloud-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--sidebar-text-muted);
    font: inherit;
    font-size: var(--text-2xs);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.readaloud-btn:hover:not(:disabled) {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.readaloud-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.readaloud-btn .icon {
    width: 12px;
    height: 12px;
}

@media (max-width: 767px) {
    .readaloud-section .switch {
        width: 42px;
        height: 24px;
    }

    .readaloud-section .switch .slider::before {
        width: 18px;
        height: 18px;
    }

    .readaloud-section .switch input:checked + .slider::before {
        transform: translateX(18px);
    }

    .readaloud-status {
        font-size: var(--text-xs);
    }

    .readaloud-btn {
        min-height: 44px;
        padding: 8px 12px;
        font-size: var(--text-sm);
    }

    .readaloud-btn .icon {
        width: 16px;
        height: 16px;
    }
}

/* Vorlesen: Sprachbefehle (Mikrofon) */
.readaloud-voice {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: var(--text-2xs);
    color: var(--sidebar-text-muted);
    cursor: pointer;
}

.readaloud-voice input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .readaloud-voice {
        min-height: 44px;
        font-size: var(--text-sm);
    }

    .readaloud-voice input {
        width: 22px;
        height: 22px;
    }
}
