:root {
    --bg: #0f1115;
    --fg: #e6e7eb;
    --muted: #a9adb7;
    --panel: #141824;
    --panel-2: #161a28;
    --border: rgba(255, 255, 255, .12);
    --accent: #6ea8fe;
    --danger: #ff6b6b;
    --warning: #f5b04c;
    --ok: #30d158;
    --shadow: 0 6px 20px rgba(0, 0, 0, .35);
    --card-surface: rgba(20, 24, 36, .96);
    --card-surface-strong: rgba(32, 36, 50, .96);
    --card-border-strong: rgba(255, 255, 255, .14);
    --card-shadow-strong: 0 20px 50px rgba(0, 0, 0, .45);
    --card-highlight: rgba(110, 168, 254, .08);
}

html[data-theme="light"] {
    --bg: #f7f8fb;
    --fg: #101321;
    --muted: #5e6576;
    --panel: #ffffff;
    --panel-2: #f2f4f8;
    --border: rgba(16, 19, 33, .12);
    --accent: #3b7bfd;
    --danger: #e03131;
    --warning: #ff922b;
    --ok: #2f9e44;
    --shadow: 0 6px 16px rgba(16, 19, 33, .08);
    --card-surface: rgba(255, 255, 255, .96);
    --card-surface-strong: rgba(247, 249, 255, .98);
    --card-border-strong: rgba(16, 19, 33, .12);
    --card-shadow-strong: 0 18px 42px rgba(16, 19, 33, .14);
    --card-highlight: rgba(59, 123, 253, .1);
}

body.terminal-mode {
    --bg: #ffffff;
    --fg: #000000;
    --muted: #5f5f87;
    --panel: #ffffff;
    --panel-2: #d7d7d7;
    --border: #afafaf;
    --accent: #5f87ff;
    --danger: #ff5f5f;
    --warning: #ffd75f;
    --ok: #5fd75f;
    --shadow: none;
    --card-surface: #ffffff;
    --card-surface-strong: #ffffd7;
    --card-border-strong: #afafaf;
    --card-shadow-strong: none;
    --card-highlight: #d7d7ff;
}

html[data-theme="dark"] a,
html[data-theme="dark"] a:visited {
    color: var(--accent, #6ea8fe);
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] a:focus,
html[data-theme="dark"] a:visited:hover,
html[data-theme="dark"] a:visited:focus {
    color: #9cc4ff;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background: var(--bg);
    color: var(--fg);
}

body.modal-open {
    overflow: hidden;
}

html.terminal-active,
body.terminal-active {
    overflow: hidden;
}

body.terminal-active {
    height: 100%;
    overscroll-behavior: contain;
}

html.terminal-active .container,
body.terminal-active .container {
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 16px
}

.editor-trigger {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.editor-preview {
    min-height: 2.2rem;
    background: var(--panel-2);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: .65rem .75rem;
    color: var(--muted);
    white-space: pre-wrap;
}

.editor-preview-attachments {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.editor-preview-attachments .attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .65rem;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    font-size: .8rem;
    color: var(--muted);
}

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

.symbol-label { 
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    line-height: 1.25;
}

.symbol-label > span[aria-hidden="true"] {
    font-size: 1rem;
    margin-right: 0.35rem;
}

.symbol-label .label-hint {
    margin-left: 0.35rem;
    font-size: 0.75em;
    color: var(--muted);
}

.card.admin-actions-card {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--card-surface);
    border: 1px solid var(--card-border-strong);
    border-radius: 18px;
    box-shadow: var(--card-shadow-strong);
}

.mode-selector {
    align-items: stretch;
    gap: 0.75rem;
}

body[data-mode='user'] .mode-selector {
    display: none;
}

.mode-selector label {
    display: inline-flex;
    align-items: center;
}

.mode-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mode-links--inline {
    margin-left: auto;
    justify-content: flex-end;
    align-items: center;
    flex: 1 1 220px;
}

.mode-selector .mode-links--inline {
    margin-top: 0;
}

.mode-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--fg);
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mode-link:hover,
.mode-link:focus-visible {
    border-color: var(--accent);
    color: var(--fg);
    background: var(--panel);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.mode-link--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.mode-link--active:hover,
.mode-link--active:focus-visible {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.admin-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.admin-action-item {
    flex: 1 1 calc(33.333% - .67rem);
    display: flex;
    flex-direction: column;
    gap: .75rem;
    min-width: 220px;
}

@media (max-width: 900px) {
    .admin-action-item {
        flex: 1 1 calc(50% - .5rem);
    }
}

@media (max-width: 640px) {
    .admin-action-item {
        flex: 1 1 100%;
    }
}

.admin-action-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .9rem 1.25rem;
    font-size: 1.05rem;
}

button.admin-action-btn--secondary {
    background: linear-gradient(135deg, rgba(110, 168, 254, .22), rgba(110, 168, 254, .35));
    color: var(--fg);
    border: 0;
}

button.admin-action-btn--secondary:hover,
button.admin-action-btn--secondary:focus {
    background: linear-gradient(135deg, rgba(110, 168, 254, .32), rgba(110, 168, 254, .48));
}

.modal .modal-dialog.create-task-dialog {
    max-width: 600px;
    width: min(600px, 95vw);
}

.create-task-details {
    margin-top: .5rem;
}

.create-task-details[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .card.admin-actions-card {
        padding: 1.1rem;
    }

    .admin-action-btn {
        font-size: 1rem;
    }

    .admin-action-grid {
        gap: .75rem;
    }

    .admin-action-item {
        flex-basis: 100%;
    }
}

/* Admin/mobile tweak: tighter padding on small screens */
@media (max-width: 768px) {
    .container {
        padding: 6px 6px
    }
}

@media (max-width: 720px) {
    .container {
        max-width: none;
        width: 100%;
    }
}

h1,
h2,
h3,
h4 {
    margin: .2rem 0 1rem
}

.beta {
    font-size: .65em;
    padding: .1em .4em;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-left: .4rem;
    vertical-align: middle;
    color: var(--muted)
}

.small {
    font-size: .9rem;
    color: var(--muted)
}

.muted {
    color: var(--muted);
}

.badge {
    display: inline-block;
    font-size: .8rem;
    padding: .25rem .5rem;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted)
}

.chip-capture-active {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.chip-capture-hint {
    color: var(--accent);
}

.tag {
    display: inline-block;
    border: 1px solid var(--border);
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .8rem;
    color: var(--muted)
}

.terminal-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.terminal-countdown {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel-2);
}

.terminal-countdown-label {
    font-size: .8rem;
    color: var(--muted);
}

.terminal-countdown-value {
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
    font-weight: 600;
}

.terminal-start {
    text-align: center;
    padding: 1.5rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: var(--panel-2);
}

.terminal-pin {
    text-align: center;
    padding: 1.5rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: var(--panel-2);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.terminal-pin-body {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.terminal-pin-pad {
    display: grid;
    grid-template-columns: repeat(3, minmax(52px, 64px));
    gap: 0.5rem;
    justify-content: center;
}

.terminal-pin-pad-btn {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.5rem 0;
    min-height: 44px;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.terminal-pin-pad-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.terminal-pin-pad-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

.terminal-pin-pad-btn--zero {
    grid-column: 2;
}

.terminal-pin-icon {
    font-size: 2rem;
}

.terminal-pin-head {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: center;
}

.terminal-pin-title {
    margin: 0;
    font-size: 1.35rem;
}

.terminal-pin-user {
    color: var(--muted);
}

.terminal-pin-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}

.terminal-pin-label {
    font-size: .9rem;
    color: var(--muted);
}

.terminal-pin-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.terminal-pin-controls input {
    max-width: 200px;
}

@media (max-width: 720px) {
    .terminal-pin-body {
        flex-direction: column;
        gap: 1rem;
    }
}

.terminal-start-icon {
    font-size: 2.2rem;
    margin-bottom: .4rem;
}

.terminal-start-title {
    margin: 0;
    font-size: 1.45rem;
}

.terminal-start-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.terminal-start-manual {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
    border-width: 2px;
    padding: 0.45rem 1.1rem;
}

.terminal-start .terminal-start-manual {
    margin-top: 1.1rem;
}

.terminal-start-manual:hover,
.terminal-start-manual:focus-visible {
    background: rgba(110, 168, 254, .12);
    color: var(--accent);
}

.terminal-start-hint {
    margin: .5rem auto 1.75rem;
    max-width: 420px;
    color: var(--muted);
}

.terminal-user-placeholder {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
}

.terminal-placeholder-label {
    font-weight: 600;
}

.terminal-user-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#terminalTasks {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#terminalTasks > * {
    width: 100%;
    padding: 0;
}

@supports (display: grid) {
    #terminalTasks {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        gap: 10px;
    }

    #terminalTasks > * {
        grid-column: 1 / -1;
    }
}

.terminal-user-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.terminal-fallback {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.terminal-start-manual + .terminal-fallback {
    display: none;
}

.terminal-start-manual[aria-expanded="true"] + .terminal-fallback:not([hidden]) {
    display: flex;
}

.terminal-fallback button.is-loading {
    min-width: 112px;
}

.terminal-fallback-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 420px;
}

.terminal-fallback-label {
    font-size: .9rem;
    color: var(--muted);
}

.terminal-fallback-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.terminal-fallback-controls select {
    min-width: 220px;
    flex: 1 1 220px;
}


.terminal-scroll {
    position: fixed;
    right: 1.75rem;
    z-index: 900;
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 999px;
    border: none;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.2);
    cursor: pointer;
    font-size: 1.8rem;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.terminal-scroll:hover,
.terminal-scroll:focus-visible,
.terminal-scroll:active {
    background: var(--accent);
}

.terminal-scroll:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
}

.terminal-scroll:active {
    transform: translateY(0);
}

.terminal-scroll:focus-visible {
    outline: 3px solid rgba(110, 168, 254, 0.65);
    outline-offset: 2px;
}

.terminal-scroll--up {
    top: 2.5rem;
}

.terminal-scroll--down {
    bottom: 2.5rem;
}

.terminal-scroll[hidden] {
    display: none;
}

.terminal-user-head-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.terminal-user-status {
    white-space: nowrap;
}

@media (max-width: 720px) {
    .terminal-box-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .terminal-countdown {
        align-self: stretch;
        justify-content: space-between;
    }

    .terminal-user-head-info {
        align-self: stretch;
        justify-content: space-between;
    }
}

body.terminal-mode #terminalBox {
    background: var(--bg);
    color: var(--fg);
}

body.terminal-mode .terminal-box-header {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
}

body.terminal-mode .terminal-countdown {
    background: var(--panel-2);
    border-color: var(--border);
    color: var(--fg);
}

body.terminal-mode .terminal-countdown-label {
    color: var(--muted);
}

body.terminal-mode .terminal-start {
    background: var(--panel-2);
    border: 1px solid var(--border);
}

body.terminal-mode .terminal-start-manual {
    background: var(--panel);
    border-color: var(--accent);
    color: var(--accent);
}

body.terminal-mode .terminal-start-manual:hover,
body.terminal-mode .terminal-start-manual:focus-visible {
    background: var(--accent);
    color: var(--bg);
}

body.terminal-mode .terminal-start-hint,
body.terminal-mode .terminal-fallback-label {
    color: var(--muted);
}

body.terminal-mode .terminal-user-placeholder {
    background: var(--panel);
    border-color: var(--border);
}

body.terminal-mode .terminal-scroll {
    background: var(--accent);
    color: var(--bg);
    box-shadow: none;
}

body.terminal-mode .terminal-scroll:hover,
body.terminal-mode .terminal-scroll:active {
    transform: none;
    box-shadow: none;
}

body.terminal-mode .terminal-scroll:focus-visible {
    outline: 2px solid var(--border);
    outline-offset: 2px;
}

body.terminal-mode #terminalTasks .task-card {
    background: var(--panel);
    border: 2px solid var(--border);
    box-shadow: none;
}

body.terminal-mode #terminalTasks .task-card .small {
    color: var(--muted);
}

body.terminal-mode #terminalTasks .due-badge {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--muted);
}

body.terminal-mode #terminalTasks .task-card .task-actions button {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--fg);
    box-shadow: none;
}

body.terminal-mode #terminalTasks .task-card .task-actions button:hover,
body.terminal-mode #terminalTasks .task-card .task-actions button:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

body.terminal-mode #terminalTasks .task-title::before {
    border-color: var(--muted);
    background: var(--panel-2);
    box-shadow: none;
}

body.terminal-mode #terminalTasks .task-card[data-task-state="in_progress"] .task-title::before,
body.terminal-mode #terminalTasks .task-card[data-due-tone="tomorrow"]:not([data-task-state="done"]) .task-title::before {
    border-color: var(--accent);
    background: var(--accent);
}

body.terminal-mode #terminalTasks .task-card[data-task-state="done"] .task-title::before,
body.terminal-mode #terminalTasks .task-card[data-task-state="yes"] .task-title::before {
    border-color: var(--ok);
    background: var(--ok);
}

body.terminal-mode #terminalTasks .task-card[data-task-state="blocked"] .task-title::before,
body.terminal-mode #terminalTasks .task-card[data-task-state="no"] .task-title::before,
body.terminal-mode #terminalTasks .task-card[data-due-tone="overdue"]:not([data-task-state="done"]) .task-title::before {
    border-color: var(--danger);
    background: var(--danger);
}

body.terminal-mode #terminalTasks .task-card.priority .task-title::before,
body.terminal-mode #terminalTasks .task-card[data-due-tone="today"]:not([data-task-state="done"]) .task-title::before {
    border-color: var(--warning);
    background: var(--warning);
}

body.terminal-mode #terminalTasks .task-card[data-task-state="pending_approval"] .task-title::before,
body.terminal-mode #terminalTasks .task-card[data-task-state="pending"] .task-title::before,
body.terminal-mode #terminalTasks .task-card[data-task-state="todo"] .task-title::before {
    border-color: var(--muted);
    background: var(--muted);
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.task-position-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-position-control select {
    min-width: 120px;
}

.task-actions button {
    margin-top: 0 !important;
}

.task-actions button.danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

#myTasks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.task-card {
    position: relative;
    background: linear-gradient(160deg, var(--card-highlight), transparent) var(--card-surface);
    border: 1px solid var(--card-border-strong);
    border-radius: 20px;
    padding: 20px 20px 18px 72px;
    box-shadow: var(--card-shadow-strong);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.task-card.planned-task {
    background: #2b2b2b;
}

html[data-theme="light"] .task-card.planned-task {
    background: #f2f2f2;
}

.task-card.is-draggable {
    cursor: grab;
}

.task-card.dragging {
    opacity: .7;
    cursor: grabbing;
}

.task-card::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 28px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, .28);
    background: transparent;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .05);
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

html[data-theme="light"] .task-card::before {
    border-color: rgba(16, 19, 33, .2);
    box-shadow: 0 0 0 4px rgba(16, 19, 33, .06);
}

.task-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, .05));
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}

.task-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

html[data-theme="light"] .task-card:hover {
    box-shadow: 0 24px 60px rgba(16, 19, 33, .15);
}

.task-card:hover::after {
    opacity: 1;
}

body.task-detail-modal-open {
    overflow: hidden;
}

body.task-detail-modal-open::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(8, 10, 18, 0.78);
    backdrop-filter: blur(6px);
    z-index: 998;
    pointer-events: none;
}

html[data-theme="light"] body.task-detail-modal-open::before {
    background: rgba(16, 19, 33, 0.25);
}

.task-detail-overlay-hitbox {
    display: none;
}

body.task-detail-modal-open .task-detail-overlay-hitbox {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 998;
    background: transparent;
    cursor: zoom-out;
}

.task-card.admin-card.open,
.task-card.admin-card.open:hover,
.task-card.user-card.open,
.task-card.user-card.open:hover {
    position: fixed;
    top: 24px;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    width: min(1280px, calc(100vw - 64px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 32px 32px 36px 72px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .65);
    z-index: 999;
    background: linear-gradient(180deg, rgba(26, 31, 44, .92), rgba(16, 19, 33, .94));
}

.task-card.admin-card.open::before,
.task-card.user-card.open::before {
    left: 28px;
    top: 32px;
}

.task-card.admin-card.open .task-details {
    margin-top: 20px;
    gap: 18px;
}

@media (max-width: 720px) {
    .task-card.admin-card.open,
    .task-card.admin-card.open:hover,
    .task-card.user-card.open,
    .task-card.user-card.open:hover {
        top: 12px;
        bottom: 12px;
        width: min(100vw - 24px, 560px);
        padding: 24px 20px 28px 60px;
    }
}

html[data-theme="light"] .task-card.admin-card.open,
html[data-theme="light"] .task-card.admin-card.open:hover,
html[data-theme="light"] .task-card.user-card.open,
html[data-theme="light"] .task-card.user-card.open:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(241, 244, 253, .98));
    box-shadow: 0 40px 120px rgba(16, 19, 33, .35);
    color: var(--text-primary, #101321);
}

@media (min-width: 960px) {
    .task-card.admin-card.open .task-details,
    .task-card.user-card.open .task-details {
        margin-left: -56px;
        margin-bottom: -32px;
        padding: 24px 32px 36px;
        border-radius: 24px;
        flex: 1 1 auto;
    }
}

.task-card .priority-badge {
    align-self: flex-start;
    margin-bottom: -4px;
    font-size: 0.75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.task-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.task-title {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -.01em;
}

.task-title-block {
    display: flex;
    flex-direction: column;
}

.task-title-block .task-origin-label {
    margin-top: 2px;
}

.task-card .small {
    color: rgba(230, 231, 235, .72);
}

html[data-theme="light"] .task-card .small {
    color: rgba(16, 19, 33, .65);
}

.task-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.task-meta > * {
    margin-top: 2px;
}

.due-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, .12);
    letter-spacing: .02em;
}

html[data-theme="light"] .due-badge {
    background: rgba(16, 19, 33, .06);
    border-color: rgba(16, 19, 33, .08);
}

.new-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .02em;
    background: rgba(47, 158, 68, .18);
    color: #d4f8de;
    border: 1px solid rgba(47, 158, 68, .35);
}

html[data-theme="light"] .new-badge {
    background: rgba(47, 158, 68, .12);
    color: #1b8a3a;
    border-color: rgba(47, 158, 68, .35);
}

.new-badge__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #37b24d;
    box-shadow: 0 0 0 2px rgba(55, 178, 77, 0.25);
}

html[data-theme="light"] .new-badge__dot {
    background: #2f9e44;
    box-shadow: 0 0 0 2px rgba(47, 158, 68, 0.2);
}

.new-badge__text {
    line-height: 1;
}

.task-origin-label {
    display: block;
    font-size: .75rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: .02em;
    color: rgba(230, 231, 235, .72);
}

html[data-theme="light"] .task-origin-label {
    color: rgba(16, 19, 33, .65);
}

.task-origin-label--admin {
    color: rgba(230, 231, 235, .72);
}

html[data-theme="light"] .task-origin-label--admin {
    color: rgba(16, 19, 33, .65);
}

.task-origin-label--self {
    color: #d4f8de;
}

html[data-theme="light"] .task-origin-label--self {
    color: #2f9e44;
}

.task-card .task-sku {
    margin-top: 4px;
}

.task-card .task-inline-meta {
    margin-top: 4px;
}

.task-card .task-inline-meta > .small {
    display: inline-block;
    margin-right: 0.75rem;
    white-space: nowrap;
    margin-top: 0;
}

.task-card .task-inline-meta > .task-origin-label {
    display: inline-block;
    margin-right: 0.75rem;
}

.task-card .task-inline-meta > .small:last-child {
    margin-right: 0;
}

.task-card .task-inline-meta > .task-origin-label:last-child {
    margin-right: 0;
}

.task-card .task-inline-meta > .task-sku,
.task-card .task-inline-meta > .task-project-tag {
    margin-top: 0;
}

.due-badge--today,
.due-badge--tomorrow {
    background: var(--warning);
    color: #1d1d1f;
    border-color: transparent;
}

html[data-theme="light"] .due-badge--today,
html[data-theme="light"] .due-badge--tomorrow {
    background: #f5b04c;
    color: #1d1d1f;
    border-color: transparent;
}

.due-badge--overdue {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

.due-badge--overdue::before {
    content: '⏰';
    margin-right: 0.35rem;
    font-size: 0.95rem;
    line-height: 1;
}

html[data-theme="light"] .due-badge--overdue {
    background: rgba(224, 49, 49, .12);
    color: var(--danger);
    border-color: rgba(224, 49, 49, .35);
}

.task-toggle {
    border: none;
    background: rgba(255, 255, 255, .05);
    color: var(--muted);
    border-radius: 16px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, box-shadow .2s ease;
}

.task-toggle:hover {
    background: rgba(255, 255, 255, .12);
    color: var(--fg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
}

html[data-theme="light"] .task-toggle {
    background: rgba(16, 19, 33, .05);
}

html[data-theme="light"] .task-toggle:hover {
    background: rgba(16, 19, 33, .12);
}

.task-toggle .chevron {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid currentColor;
    transition: transform 0.2s ease;
}

.task-card.open .task-toggle .chevron {
    transform: rotate(180deg);
}

.task-card .task-actions {
    justify-content: flex-start;
    margin-top: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    gap: 10px;
}

html[data-theme="light"] .task-card .task-actions {
    border-top-color: rgba(16, 19, 33, .08);
}

.task-card .task-actions button {
    border-radius: 999px;
    padding: 7px 16px;
    font-weight: 600;
    font-size: 0.95rem;
}

.task-card .task-actions .ghost {
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .12);
    color: var(--fg);
}

.task-card .task-actions .ghost:hover {
    background: rgba(255, 255, 255, .12);
}

.task-card .task-actions .danger {
    background: rgba(255, 107, 107, .15);
    border: 1px solid rgba(255, 107, 107, .4);
    color: #ffb3b3;
}

html[data-theme="light"] .task-card .task-actions .ghost {
    background: rgba(16, 19, 33, .05);
    border-color: rgba(16, 19, 33, .08);
    color: var(--fg);
}

html[data-theme="light"] .task-card .task-actions .ghost:hover {
    background: rgba(16, 19, 33, .12);
}

html[data-theme="light"] .task-card .task-actions .danger {
    background: rgba(224, 49, 49, .12);
    border-color: rgba(224, 49, 49, .3);
    color: #c21717;
}

.task-card.has-issue {
    border-color: rgba(255, 107, 107, .6);
    box-shadow: 0 12px 32px rgba(255, 107, 107, 0.22);
}

.task-card[data-task-state="in_progress"]::before {
    border-color: rgba(110, 168, 254, .85);
    background: rgba(110, 168, 254, .4);
    box-shadow: 0 0 0 4px rgba(110, 168, 254, .16);
}

html[data-theme="light"] .task-card[data-task-state="in_progress"]::before {
    border-color: rgba(59, 123, 253, .65);
    background: rgba(59, 123, 253, .38);
    box-shadow: 0 0 0 4px rgba(59, 123, 253, .16);
}

.task-card[data-task-state="done"]::before,
.task-card[data-task-state="yes"]::before {
    border-color: rgba(48, 209, 88, .85);
    background: rgba(48, 209, 88, .5);
    box-shadow: 0 0 0 4px rgba(48, 209, 88, .18);
}

html[data-theme="light"] .task-card[data-task-state="done"]::before,
html[data-theme="light"] .task-card[data-task-state="yes"]::before {
    border-color: rgba(47, 158, 68, .75);
    background: rgba(47, 158, 68, .42);
    box-shadow: 0 0 0 4px rgba(47, 158, 68, .2);
}

.task-card[data-task-state="blocked"]::before,
.task-card[data-task-state="no"]::before {
    border-color: rgba(255, 107, 107, .9);
    background: rgba(255, 107, 107, .55);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, .25);
}

html[data-theme="light"] .task-card[data-task-state="blocked"]::before,
html[data-theme="light"] .task-card[data-task-state="no"]::before {
    border-color: rgba(224, 49, 49, .75);
    background: rgba(224, 49, 49, .45);
    box-shadow: 0 0 0 4px rgba(224, 49, 49, .18);
}

.task-card[data-task-state="pending_approval"]::before,
.task-card[data-task-state="todo"]::before,
.task-card[data-task-state="pending"]::before {
    border-color: rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .05);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .04);
}

html[data-theme="light"] .task-card[data-task-state="pending_approval"]::before,
html[data-theme="light"] .task-card[data-task-state="todo"]::before,
html[data-theme="light"] .task-card[data-task-state="pending"]::before {
    border-color: rgba(16, 19, 33, .18);
    background: rgba(16, 19, 33, .06);
    box-shadow: 0 0 0 4px rgba(16, 19, 33, .05);
}

.task-card.priority::before {
    border-color: rgba(245, 176, 76, .9);
    background: rgba(245, 176, 76, .55);
    box-shadow: 0 0 0 4px rgba(245, 176, 76, .25);
}

html[data-theme="light"] .task-card.priority::before {
    border-color: rgba(245, 176, 76, .7);
    background: rgba(245, 176, 76, .45);
    box-shadow: 0 0 0 4px rgba(245, 176, 76, .2);
}

.task-card.admin-card.priority {
    background: linear-gradient(180deg, rgba(245, 176, 76, .28), rgba(245, 176, 76, .1)) var(--card-surface);
    border-color: rgba(245, 176, 76, .45);
    box-shadow: 0 26px 70px rgba(245, 176, 76, .28);
}

html[data-theme="light"] .task-card.admin-card.priority {
    background: linear-gradient(180deg, rgba(245, 176, 76, .22), rgba(245, 176, 76, .08)) #ffffff;
    border-color: rgba(245, 176, 76, .55);
    box-shadow: 0 24px 48px rgba(245, 176, 76, .22);
}

.task-card[data-due-tone="overdue"]:not([data-task-state="done"])::before {
    border-color: rgba(255, 107, 107, .9);
    background: rgba(255, 107, 107, .55);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, .25);
}

.task-card[data-due-tone="today"]:not([data-task-state="done"])::before {
    border-color: rgba(245, 176, 76, .9);
    background: rgba(245, 176, 76, .55);
    box-shadow: 0 0 0 4px rgba(245, 176, 76, .25);
}

.task-card[data-due-tone="tomorrow"]:not([data-task-state="done"])::before {
    border-color: rgba(110, 168, 254, .85);
    background: rgba(110, 168, 254, .4);
    box-shadow: 0 0 0 4px rgba(110, 168, 254, .16);
}

html[data-theme="light"] .task-card[data-due-tone="overdue"]:not([data-task-state="done"])::before {
    border-color: rgba(224, 49, 49, .75);
    background: rgba(224, 49, 49, .45);
    box-shadow: 0 0 0 4px rgba(224, 49, 49, .18);
}

html[data-theme="light"] .task-card[data-due-tone="today"]:not([data-task-state="done"])::before {
    border-color: rgba(245, 176, 76, .7);
    background: rgba(245, 176, 76, .45);
    box-shadow: 0 0 0 4px rgba(245, 176, 76, .2);
}

html[data-theme="light"] .task-card[data-due-tone="tomorrow"]:not([data-task-state="done"])::before {
    border-color: rgba(59, 123, 253, .6);
    background: rgba(59, 123, 253, .35);
    box-shadow: 0 0 0 4px rgba(59, 123, 253, .16);
}

.task-title-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.link-btn:hover {
    text-decoration: underline;
}

.task-details {
    display: none;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .08);
    padding: 16px 10px 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), transparent) var(--card-surface-strong);
    gap: 14px;
    margin-top: 6px;
    margin-bottom: 14px;
}

html[data-theme="light"] .task-details {
    border-color: rgba(16, 19, 33, .08);
}

.task-card.open .task-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.task-details__columns {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding-bottom: 10px;
}

.task-details__column {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.task-desc-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.task-desc-actions .danger {
    flex-shrink: 0;
}

@media (max-width: 960px) {
    .task-desc-actions {
        justify-content: flex-start;
    }
}

@media (min-width: 960px) {
    .task-details__columns {
        flex-direction: row;
        gap: 24px;
    }

    .task-details__column--main {
        flex: 1 1 50%;
    }

    .task-details__column--activity {
        flex: 1 1 50%;
    }
}

@media (min-width: 960px) {
    .task-card.user-card.open .task-details__columns,
    .task-card.admin-card.open .task-details__columns {
        flex-direction: row;
        gap: 28px;
        flex: 1 1 auto;
        align-items: stretch;
    }

    /* Desktop: Details-Bereich in der Mitarbeiter-Ansicht begrenzen, damit er nicht aus dem Viewport läuft */
    #userBox .task-card.user-card.open .task-details,
    #terminalTasks .task-card.user-card.open .task-details {
        max-height: calc(100vh - 260px);
        overflow: auto;
    }

    .task-card.user-card.open .task-details__column--main,
    .task-card.admin-card.open .task-details__column--main {
        flex: 1 1 50%;
        height: 100%;
    }

    .task-card.user-card.open .task-details__column--activity,
    .task-card.admin-card.open .task-details__column--activity {
        flex: 1 1 50%;
        height: 100%;
    }
}

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

.task-desc {
    white-space: normal;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.task-desc p,
.task-desc ul,
.task-desc ol,
.task-desc h3 {
    margin: 0 0 0.6em 0;
}

.task-desc h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.task-desc ul,
.task-desc ol {
    padding-left: 1.3em;
}

.task-desc ul:last-child,
.task-desc ol:last-child,
.task-desc p:last-child,
.task-desc h3:last-child {
    margin-bottom: 0;
}

.task-checklist-block {
    margin-top: 0.75rem;
}

.task-checklist-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
    color: var(--muted);
}

.task-checklist { 
    margin: 0;
    padding-left: 1.3em;
    list-style: disc;
}

.task-checklist li {
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.task-checklist li:last-child {
    margin-bottom: 0;
}

.task-checklist--interactive {
    list-style: none;
    padding-left: 0;
}

.task-checklist--interactive li {
    margin-bottom: 0.45rem;
}

.task-checklist--interactive li:last-child {
    margin-bottom: 0;
}

.task-checklist-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-checklist-item span {
    flex: 1;
}

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

.task-checklist-block--interactive .task-checklist-title {
    color: var(--fg);
}

.task-progress {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.task-progress__track {
    position: relative;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.task-progress__track::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.task-progress__fill {
    position: relative;
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.2s ease;
}

.task-progress__info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--muted);
}

.task-progress__count {
    font-variant-numeric: tabular-nums;
    color: var(--fg);
}

.export-section + .export-section {
    margin-top: 1.5rem;
}

.export-configurator {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.export-configurator__row {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: minmax(0, 1fr);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-2);
}

.export-configurator__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-configurator__toggle input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
}

.export-configurator__label {
    font-weight: 600;
    color: var(--fg);
}

.export-configurator__input input {
    width: 100%;
}

.export-configurator__description {
    grid-column: 1 / -1;
}

@media (min-width: 720px) {
    .export-configurator__row {
        grid-template-columns: minmax(0, 0.55fr) minmax(0, 0.45fr);
        align-items: center;
    }
    .export-configurator__description {
        grid-column: 1 / -1;
    }
}

.task-desc-block {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.task-desc-block .task-desc {
    flex: 1;
}

.task-desc--editable {
    cursor: pointer;
}

.task-desc--editable:focus-visible {
    outline: 2px solid var(--accent, #4c7ef3);
    outline-offset: 2px;
}

html[data-theme="light"] .task-desc {
    background: rgba(16, 19, 33, .04);
    border-color: rgba(16, 19, 33, .08);
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.comment-form textarea {
    display: none;
}

.comment-form .rich-editor--inline {
    margin-top: 0;
}

.comment-form .rich-editor__input {
    min-height: 120px;
}

.comment-form__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
}

.comment-form__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-form.is-collapsed .comment-form__body {
    display: none;
}

.comment-form:not(.is-collapsed) .comment-form__toggle {
    display: none;
}

.comment-actions {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-form__attachments {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comment-form__attachment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: .85rem;
    color: var(--muted);
}

.chat-actions-inline {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.chat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.chat-item {
    background: var(--panel-2);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-item[data-report-type="comment"].is-reply {
    background: transparent;
    border: 1px dashed var(--border);
    margin-left: 12px;
}

.chat-message {
    white-space: pre-wrap;
}

.chat-item.issue {
    border-left: 3px solid var(--danger);
}

.chat-attachments {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.chat-attachment {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .55rem;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    font-size: .75rem;
    color: var(--muted);
}

.chat-attachment a {
    color: inherit;
    text-decoration: none;
}

.chat-attachment a:hover {
    text-decoration: underline;
}

.comment-replies {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .35rem;
}

.chat-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

.chat-empty {
    color: var(--muted);
}

.task-history {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-history__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.task-history__title {
    font-weight: 600;
    font-size: 1rem;
}

.task-history__toggle {
    display: inline-flex;
    align-items: center;
}

.task-history__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-history__body[hidden] {
    display: none;
}

.task-history__list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

@media (min-width: 961px) {
    .task-card.user-card.open .task-details,
    .task-card.admin-card.open .task-details {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .task-card.user-card.open .task-history,
    .task-card.admin-card.open .task-history {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding-bottom: 12px;
    }

    .task-card.user-card.open .task-history__list,
    .task-card.admin-card.open .task-history__list {
        flex: 1 1 auto;
        max-height: none;
        min-height: 0;
    }
}

.task-history__item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.task-history__headline {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-history__description {
    font-weight: 600;
}

.task-history__message {
    margin-top: 0.35rem;
    line-height: 1.4;
    word-break: break-word;
}

.task-history__message--plain {
    color: var(--muted);
    font-size: 0.9rem;
}

.task-history__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--muted);
}

.task-history__badge--task {
    background: var(--panel-2);
    border-color: var(--border);
    color: var(--muted);
}

.task-history__badge--log {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.task-history__badge--comment {
    background: rgba(110, 168, 254, .2);
    border-color: rgba(110, 168, 254, .35);
    color: #d6e5ff;
}

html[data-theme="light"] .task-history__badge--comment {
    background: rgba(59, 123, 253, .14);
    border-color: rgba(59, 123, 253, .28);
    color: #2f5fb8;
}

.task-history__badge--issue {
    background: rgba(255, 107, 107, .22);
    border-color: rgba(255, 107, 107, .35);
    color: #ffd9d9;
}

html[data-theme="light"] .task-history__badge--issue {
    background: rgba(224, 49, 49, .16);
    border-color: rgba(224, 49, 49, .28);
    color: #a61e1e;
}

.task-history__timestamp {
    font-size: 0.8rem;
    color: var(--muted);
}

.task-history__attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.task-history__attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: inherit;
    text-decoration: none;
}

.task-history__attachment:hover,
.task-history__attachment:focus {
    text-decoration: underline;
}

.task-history__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.task-history__empty {
    color: var(--muted);
}

.report-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--muted);
    font-weight: 600;
}

.report-type-badge.issue {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.report-type-badge.comment {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.w-wrap {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap
}

.grid {
    display: flex;
    flex-wrap: wrap;
    margin: -6px
}

.grid > * {
    box-sizing: border-box;
    padding: 6px;
    width: 100%
}

.col-12 {
    width: 100%
}

.col-6 {
    width: 50%
}

.col-4 {
    width: 33.3333%
}

@media (max-width: 768px) {
    .col-6 {
        width: 100%
    }

    .col-4 {
        width: 100%
    }
}

@media (min-width: 769px) and (max-width: 960px) {
    .create-task-grid .col-6,
    .create-task-grid .col-4,
    .create-task-grid__media,
    .edit-task-grid .col-6,
    .edit-task-grid .col-4,
    .edit-task-grid__media {
        width: 50%;
    }
}

@media (max-width: 768px) {
    .create-task-grid .col-6,
    .create-task-grid .col-4,
    .create-task-grid__media,
    .edit-task-grid .col-6,
    .edit-task-grid .col-4,
    .edit-task-grid__media {
        width: 100%;
    }
}

@supports (display: grid) {
    .grid {
        display: grid;
        margin: 0;
        grid-template-columns: repeat(12, 1fr);
        gap: 12px;
    }

    .grid > * {
        padding: 0;
        width: auto;
    }

    .col-12 {
        width: auto;
        grid-column: span 12;
    }

    .col-6 {
        width: auto;
        grid-column: span 6;
    }

    .col-4 {
        width: auto;
        grid-column: span 4;
    }

    @media (max-width: 768px) {
        .col-6 {
            grid-column: span 12;
        }

        .col-4 {
            grid-column: span 12;
        }
    }

    @media (min-width: 769px) and (max-width: 960px) {
        .create-task-grid .col-6,
        .create-task-grid .col-4,
        .create-task-grid__media,
        .edit-task-grid .col-6,
        .edit-task-grid .col-4,
        .edit-task-grid__media {
            grid-column: span 6;
        }
    }

    @media (max-width: 768px) {
        .create-task-grid .col-6,
        .create-task-grid .col-4,
        .create-task-grid__media,
        .edit-task-grid .col-6,
        .edit-task-grid .col-4,
        .edit-task-grid__media {
            grid-column: span 12;
        }
    }
}

@media (max-width: 640px) {
    .task-actions {
        display: flex;
        flex-wrap: wrap;
        margin: -4px;
    }

    .task-actions button {
        flex: 1 1 calc(50% - 8px);
        margin: 4px;
    }

    @supports (display: grid) {
        .task-actions {
            display: grid;
            margin: 0;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }

        .task-actions button {
            flex: initial;
            margin: 0;
            width: 100%;
        }
    }
}

@media (max-width: 960px) {
    .task-card.admin-card.open,
    .task-card.admin-card.open:hover,
    .task-card.user-card.open,
    .task-card.user-card.open:hover {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-height: none;
        border-radius: 0;
        padding: 20px 16px 28px 24px;
    }

    .task-card.admin-card.open::before,
    .task-card.user-card.open::before {
        left: 20px;
        top: 24px;
    }
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow)
}

.collapsible-card {
    padding: 0;
    overflow: hidden;
}

.collapsible-card summary { 
    cursor: pointer;
    list-style: none;
    padding: 14px 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.collapsible-card summary::after {
    content: '\25BC';
    font-size: .8rem;
    transition: transform .2s ease;
}

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

.collapsible-card[open] summary {
    border-bottom: 1px solid var(--border);
}

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

.collapsible-card .collapsible-content {
    padding: 0 16px 16px;
}

.collapsible-card .collapsible-content .grid {
    margin-top: 1rem;
}

.admin-user-actions {
    margin-top: 0.75rem;
}

.summary-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-actions button {
    margin: 0;
}

.summary-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--muted);
}

.summary-count--danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

button {
    cursor: pointer;
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 600
}

button.primary {
    background: var(--accent);
    color: white
}

button.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg)
}

button.danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger)
}

button.tiny {
    padding: 4px 8px;
    font-size: .85rem;
    border-radius: 8px
}

.icon-btn {
    margin-left: .5rem;
    font-size: 1rem;
    line-height: 1;
    padding: 6px 8px
}

input,
select,
textarea {
    background: var(--panel-2);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
}

select option,
select optgroup {
    background: var(--panel);
    color: var(--fg);
}

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

.table-wrap {
    overflow: auto
}

.admin-table-container {
    margin-top: 12px;
}

.sort-mode-controls {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: .5rem
}

.sort-mode-label {
    font-weight: 600;
    color: var(--fg)
}

.sort-mode-buttons {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center
}

.sort-mode-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff
}

html[data-theme="light"] .sort-mode-btn.active {
    color: #fff
}

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

.table th,
.table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top
}

.table thead th {
    position: relative;
    user-select: none;
    cursor: pointer;
    font-weight: 700
}

.table thead th[data-sortable="false"] {
    cursor: default
}

.table thead .filters th {
    cursor: default;
    padding-top: 6px;
    padding-bottom: 6px;
    text-align: left
}

.table thead .filters th.filter-filler {
    padding-top: 0;
    padding-bottom: 0;
}

.table thead .filters .filter-hint {
    display: inline-block;
    padding: 6px 0;
    font-size: .85rem;
    color: var(--muted);
    font-style: italic;
}

/* left align filter row cells + buttons */
.table .arrow {
    font-size: .8rem;
    color: var(--muted);
    margin-left: 6px
}

.table thead th.active {
    color: var(--accent)
}

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

.table-plain th,
.table-plain td {
    padding: 8px;
    border-bottom: 1px solid var(--border)
}

.table-plain th {
    text-align: left;
}

.table-actions {
    margin-top: 0;
    justify-content: flex-start;
}

.table.responsive-mobile {
    border-collapse: separate;
    border-spacing: 0;
}

.table.responsive-mobile thead {
    display: block;
    margin-bottom: 12px;
}

.table.responsive-mobile thead tr {
    display: none;
}

.table.responsive-mobile thead tr.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.table.responsive-mobile thead tr.filters th {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.table.responsive-mobile thead tr.filters th.filter-filler {
    display: none;
}

.table.responsive-mobile thead tr.filters select,
.table.responsive-mobile thead tr.filters input {
    width: 100%;
}

.table.responsive-mobile tbody {
    display: grid;
    gap: 16px;
}

.table.responsive-mobile tbody tr {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.table.responsive-mobile tbody tr td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    border: 0;
    padding: 0;
}

.table.responsive-mobile tbody tr td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.table.responsive-mobile tbody tr td.actions {
    gap: 8px;
}

.table.responsive-mobile tbody tr td.actions::before {
    margin-bottom: 4px;
}

.table.responsive-mobile tbody tr td.actions .task-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
}

.table.responsive-mobile tbody tr td.actions .task-actions button {
    margin-top: 0 !important;
}

tr.task-row.is-draggable {
    cursor: grab;
}

tr.task-row.dragging {
    opacity: .7;
    cursor: grabbing;
}

tr.task-row.has-issue > td {
    border-left: 3px solid var(--danger);
    background: rgba(255, 107, 107, 0.08);
}

tr.task-row.planned-task > td {
    background: rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] tr.task-row.planned-task > td {
    background: #f2f2f2;
}

.task-group-row td {
    font-weight: 600;
    padding-top: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.task-details-row td {
    background: var(--panel-2);
    border-radius: 12px;
    padding: 16px;
}

.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 2000;
    overflow-y: auto;
}

.modal .box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    padding: 16px;
    box-shadow: var(--shadow)
}

.modal .box.box--edit-task {
    max-width: min(960px, 96vw);
}

@media (min-width: 1200px) {
    .modal .box.box--edit-task {
        max-width: 1040px;
    }
}

.modal .modal-dialog {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(480px, 100%);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1;
    max-height: 640px;
}

.modal .modal-header,
.modal .modal-footer {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--panel);
}

.modal .modal-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.modal .modal-body {
    padding: 0 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-height: 720px) {
    .modal .modal-dialog {
        max-height: calc(100vh - 32px);
    }
}

@media (max-width: 640px) {
    .modal {
        align-items: flex-start;
        padding: 12px 8px;
    }

    .modal .modal-dialog {
        width: 100%;
        margin-top: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
        max-height: none;
    }
}

.rich-editor-modal {
    width: min(540px, 100%);
}

.rich-editor {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    position: relative;
}

.rich-editor--inline {
    margin-top: .5rem;
}

.rich-editor--inline .rich-editor__input {
    min-height: 160px;
}

.rich-editor__toolbar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    position: absolute;
    top: .65rem;
    left: .75rem;
    right: .75rem;
    padding: .5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: var(--shadow);
    z-index: 2;
}

.rich-editor__toolbar[role="toolbar"] {
    gap: .35rem;
}

.rich-editor--active .rich-editor__toolbar {
    display: flex;
}

.rich-editor__toolbar-group {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}

.rich-editor__toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 .2rem;
    border-radius: 999px;
}

button.rich-editor__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--fg);
    font-size: .9rem;
    font-weight: 600;
    transition: background .15s ease, border-color .15s ease;
}

button.rich-editor__btn:hover,
button.rich-editor__btn:focus {
    background: var(--panel);
    border-color: var(--accent);
}

button.rich-editor__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.rich-editor__icon {
    pointer-events: none;
    line-height: 1;
}

.rich-editor__icon--bold {
    font-weight: 800;
}

.rich-editor__icon--italic {
    font-style: italic;
}

.rich-editor__icon--underline {
    text-decoration: underline;
}

.rich-editor__icon--heading {
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .02em;
}

.rich-editor__icon--bullet {
    font-size: 1.1rem;
}

.rich-editor__icon--numbered {
    font-size: .85rem;
    font-weight: 700;
}

.rich-editor__icon--break {
    font-size: 1.2rem;
}

.rich-editor__toolbar-action {
    margin-left: auto;
}

.rich-editor__input {
    min-height: 200px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .9rem;
    background: var(--panel-2);
    color: var(--fg);
    line-height: 1.5;
    overflow-y: auto;
    white-space: pre-wrap;
    transition: padding-top .15s ease;
}

.rich-editor--active .rich-editor__input {
    padding-top: 3.6rem;
}

@media (max-width: 768px) {
    .rich-editor__toolbar {
        position: static;
        margin-bottom: .25rem;
    }

    .rich-editor--active .rich-editor__input {
        padding-top: .9rem;
    }
}

.rich-editor__input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.rich-editor__input[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.rich-editor__attachments {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.rich-editor__attachment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
}

.rich-editor__attachment span {
    font-size: .85rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rich-editor__attachment button {
    flex-shrink: 0;
}

.modal .modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

.modal .modal-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 0;
}

.task {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px
}

.task.done {
    opacity: .65
}

.back {
    margin-bottom: 10px
}

/* Admin mobile table adjustments */
#taskTable.responsive-mobile thead tr#headRow {
    display: none
}

#taskTable.responsive-mobile {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%
}

/* HIER IST DIE KORREKTUR FÜR DIE LIGHTBOX */
#taskTable.responsive-mobile .task-photo-thumb {
    position: relative;
    z-index: 2;
}

/* Screen clock: only show in fullscreen on #screenBox */
#screenBox {
    font-size: 1.25rem;
}

#screenBox .row {
    gap: 1rem;
}

#screenBox select,
#screenBox button {
    font-size: 1rem;
}

#screenBox .table {
    font-size: 1.35rem;
}

#screenBox .table th,
#screenBox .table td {
    padding: 1rem 1.2rem;
    line-height: 1.4;
}

#screenBox .table td.screen-due {
    font-weight: 600;
}

#screenBox .table td.screen-due--overdue {
    color: var(--danger);
}

#screenBox .table td.screen-due--today {
    color: var(--warning);
}

#screenBox .table td.screen-due--tomorrow {
    color: var(--accent);
}

#screenBox tr.has-issue td {
    background: rgba(255, 107, 107, 0.12);
    border-left: 4px solid var(--danger);
}

#screenBox .clock {
    display: none;
    font-weight: 700;
    font-variant-numeric: tabular-nums
}

#screenBox:fullscreen .clock {
    display: inline-block;
    margin-right: 8px
}

#userBox #myTasks,
#terminalUserArea #terminalTasks {
    width: 100%;
}

#terminalUserArea #terminalTasks {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.user-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)), var(--card-surface);
    border: 1px solid var(--card-border-strong);
    border-radius: 16px;
    box-shadow: var(--card-shadow-strong, var(--shadow));
    backdrop-filter: blur(10px);
}

.user-toolbar__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.user-toolbar__identity {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-avatar {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(110, 168, 254, 0.25), rgba(255, 255, 255, 0.04));
    color: var(--fg);
    font-size: 1.1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.user-toolbar__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.user-toolbar__name-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.user-toolbar__options {
    position: relative;
    flex: 0 0 auto;
}

.user-toolbar__options-trigger {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    cursor: pointer;
    user-select: none;
}

.user-toolbar__options-trigger::-webkit-details-marker {
    display: none;
}

.user-toolbar__options[open] .user-toolbar__options-trigger {
    border-color: var(--accent);
}

.user-toolbar__options-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.user-toolbar__options-menu .ghost {
    white-space: nowrap;
}

.user-toolbar__label {
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.01em;
}

.user-toolbar__name {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-toolbar__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--muted);
}

.user-toolbar__actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.user-action-btn .user-action-btn__icon {
    font-size: 1.05rem;
    line-height: 1;
}

.user-action-btn .user-action-btn__label {
    white-space: nowrap;
}

.user-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.user-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.user-action-btn:focus-visible {
    outline: 3px solid rgba(110, 168, 254, 0.3);
    outline-offset: 2px;
}

.user-action-btn.ghost {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
}

.user-action-btn.ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-action-btn.ghost:active {
    background: rgba(255, 255, 255, 0.07);
}

.user-action-btn.primary {
    font-weight: 600;
    padding-inline: 1rem;
}

.user-action-btn.primary:hover {
    filter: brightness(1.05);
}

.user-action-btn.primary:active {
    filter: brightness(0.97);
}

.user-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1.25rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.user-filter-bar[hidden] {
    display: none;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-row--primary .filter-control {
    flex: 1 1 230px;
}

.filter-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.filter-control input[type="search"],
.filter-control select {
    border: 0;
    padding: 0.35rem 0.1rem;
    min-height: 40px;
    width: 100%;
    background: transparent;
}

.filter-control input[type="search"]:focus,
.filter-control select:focus {
    outline: none;
}

.filter-icon {
    font-size: 0.95rem;
    color: var(--muted);
}

.filter-row--toggles {
    gap: 10px;
}

.filter-pill-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    color: var(--fg);
    box-shadow: var(--shadow);
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
}

.filter-pill.is-active {
    background: var(--card-highlight);
    border-color: var(--accent);
    color: var(--fg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.filter-pill:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pill-icon {
    font-size: 1rem;
}

.user-sort-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 0.35rem 0.4rem 0.65rem;
}

.user-sort-controls .sort-mode-label {
    font-weight: 600;
    color: var(--fg);
}

.sort-mode-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sort-mode-buttons .sort-mode-btn {
    min-height: 40px;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--fg);
    box-shadow: var(--shadow);
}

.sort-mode-buttons .sort-mode-btn[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.sort-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    line-height: 1;
}

.sort-mode-icon svg {
    width: 1rem;
    height: 1rem;
    display: block;
}

.sort-mode-btn--filter {
    min-width: 40px;
    padding: 0.45rem;
}

.sort-mode-btn--toggle {
    min-width: 40px;
    padding: 0.45rem;
}

.sort-mode-btn--filter[aria-expanded="true"] {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.sort-mode-btn--toggle[aria-expanded="true"] {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.sort-mode-toggle-panel[hidden] {
    display: none !important;
}

html[data-theme="dark"] .sort-mode-buttons .sort-mode-btn[aria-pressed="true"] {
    color: #0b1020;
}

html.no-flex-gap .user-filter-bar .filter-row > * + * {
    margin-left: 8px;
}

@media (min-width: 961px) {
    #userBox #myTasks {
        width: 62%;
        margin-left: auto;
        margin-right: auto;
        padding: 0 10px;
        gap: 26px;
    }

    #terminalUserArea #terminalTasks {
        padding: 0 10px;
        gap: 26px;
    }

    #userBox .task-card,
    #terminalTasks .task-card {
        padding: 28px 28px 24px 90px;
    }

    #userBox .task-card::before,
    #terminalTasks .task-card::before {
        left: 36px;
        top: 34px;
    }
}

@media (max-width: 768px) {
    .user-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-toolbar__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .user-toolbar__actions .user-action-btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .user-toolbar__status {
        order: 3;
    }
}

.admin-task-cards {
    display: none;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}

.admin-task-group {
    background: transparent;
    border: none;
    border-radius: 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.admin-card-group {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    margin: 0 0 6px 12px;
    color: var(--muted);
}

.admin-group-tasks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px 12px;
}

@media (max-width: 640px) {
    .task-detail-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .task-detail-meta > div:first-child {
        grid-column: 1 / -1;
    }

    .task-detail-meta > div:last-child:nth-child(even) {
        grid-column: 1 / -1;
    }
}

.comment-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    line-height: 1;
    font-family: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

.issue-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    border: none;
    cursor: pointer;
    line-height: 1;
    font-family: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    font-size: 0;
}

.comment-pill:hover,
.issue-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.comment-pill:focus-visible,
.issue-pill:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.comment-pill__icon {
    width: 14px;
    height: 14px;
}

.comment-pill__icon path {
    fill: currentColor;
}

.comment-pill__count {
    font-size: 0.75rem;
    font-weight: 700;
}

.issue-pill__icon {
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.task-card .comment-pill {
    margin-left: 4px;
}

.task-details__column--main .task-photo-thumb {
    max-width: 220px;
    border-radius: 10px;
}

@media (max-width: 900px) {
    .admin-task-cards {
        display: flex;
    }
}

@media (max-width: 720px) {
    .container {
        padding: 6px 6px;
    }

    h1 {
        font-size: 1.75rem;
    }

    #admin-nav {
        gap: 6px;
    }

    #admin-nav .nav-btn {
        flex: 1 1 calc(50% - 6px);
        padding: 6px 10px;
        font-size: 0.95rem;
    }

    button {
        padding: 6px 10px;
        font-size: 0.95rem;
        border-radius: 8px;
    }

    button.tiny {
        padding: 3px 6px;
        font-size: 0.8rem;
    }

    .task-card {
        padding: 16px 16px 14px 62px;
        border-radius: 18px;
        gap: 12px;
    }

    .task-card::before {
        left: 24px;
        top: 30px;
        width: 16px;
        height: 16px;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
    }

    html[data-theme="light"] .task-card::before {
        box-shadow: 0 0 0 3px rgba(16, 19, 33, .05);
    }

    .task-card .task-title {
        font-size: 1rem;
    }

    .task-meta {
        flex-wrap: wrap;
        gap: 6px;
    }

    .task-actions {
        gap: 6px;
    }

    .task-actions button {
        padding: 6px 10px;
    }

    .task-card .task-actions button {
        padding: 6px 14px;
    }

    #myTasks,
    #terminalTasks {
        gap: 20px;
    }
}

/* === NEUE/VERBESSERTE STYLES AB HIER === */

/* Markierung für überfällige Aufgaben */
.overdue {
    color: var(--danger) !important;
    font-weight: 600;
}

/* Markierung für priorisierte Aufgaben in der Admin-Tabelle */
tr.priority-task {
    background-color: rgba(245, 197, 66, 0.15);
    border-left: 3px solid #f5c542;
}

html[data-theme="light"] tr.priority-task {
    background-color: rgba(245, 197, 66, 0.1);
}

/* Stil für den Prioritäts-Stern-Button */
.priority-icon {
    font-size: 1.2rem;
    color: var(--muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.priority-icon:hover {
    transform: scale(1.2);
}

.priority-icon.is-priority {
    color: #f5c542;
}

/* Thumbnails in der Tabelle und Mitarbeiter-Ansicht */
.task-photo-thumb {
    max-width: 60px;
    max-height: 60px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
    margin-top: 8px;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.task-photo-thumb:hover {
    transform: scale(2.5);
    z-index: 10;
    position: relative;
}

.task-card.open .task-photo-thumb {
    max-width: 240px;
    max-height: 180px;
    width: 100%;
    height: auto;
    border-radius: 10px;
}

/* Badge für Priorität in der Mitarbeiter-Ansicht */
.priority-badge {
    display: inline-block;
    font-size: .8rem;
    padding: .25rem .6rem;
    background: #f5c542;
    border-radius: 999px;
    color: #111;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ZEITPLANER STYLES */
.planner-wrapper {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    font-size: 0.85rem;
    overflow: hidden;
}

#scheduler-container {
    position: relative;
    display: grid;
    grid-template-columns: 150px 1fr;
}

.planner-header {
    grid-column: 2 / -1;
    position: relative;
    height: 40px;
    border-bottom: 1px solid var(--border);
    background-color: var(--panel-2);
}

.planner-time-axis {
    display: flex;
    height: 100%;
    position: relative;
}

.planner-hour-tick {
    flex-grow: 1;
    flex-basis: 0;
    border-left: 1px solid var(--border);
    padding-left: 4px;
    color: var(--muted);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
}

.planner-depts-axis {
    grid-column: 1;
    grid-row: 2 / auto;
}

.planner-dept-label {
    height: 60px;
    padding: 8px;
    font-weight: 600;
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background-color: var(--panel-2);
    display: flex;
    align-items: center;
}

.planner-grid-area {
    grid-column: 2;
    grid-row: 2 / auto;
    position: relative;
    background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
    background-size: calc(100% / var(--total-hours, 10)) 100%;
}

.planner-dept-row {
    position: relative;
    height: 60px;
    border-top: 1px solid var(--border);
}

.planner-task-block {
    position: absolute;
    top: 5px;
    bottom: 5px;
    background-color: var(--accent);
    color: white;
    border-radius: 6px;
    padding: 4px 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

.planner-task-block:hover {
    z-index: 11;
    filter: brightness(1.2);
}

/* Stile für Drag & Drop Liste im Modal */
.sortable-list {
    list-style: none;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.sortable-list li {
    padding: 10px 12px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--border);
    cursor: grab;
    user-select: none;
}

.sortable-list li:last-child {
    border-bottom: none;
}

.sortable-list li.dragging {
    opacity: 0.5;
    background: var(--accent);
}


/* =========== NEU: Lightbox & Mobile Mitarbeiter-Ansicht =========== */

/* 1. Stile für die Bilder-Lightbox */
.modal#imageLightbox {
    background: rgba(0, 0, 0, 0.85);
    z-index: 1050;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 4px;
    animation-name: zoom;
    animation-duration: 0.3s;
}

@keyframes zoom {
    from {
        transform: scale(0.8)
    }

    to {
        transform: scale(1)
    }
}

.close-lightbox {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-lightbox:hover,
.close-lightbox:focus {
    color: #bbb;
    text-decoration: none;
}


/* 2. Bessere mobile Formatierung für die Mitarbeiter-Ansicht */
@media (max-width: 960px) {
    #userBox .task-card,
    #terminalTasks .task-card {
        padding: 18px 16px;
    }

    #userBox #myTasks,
    #terminalUserArea #terminalTasks {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    #userBox .task-card .task-actions,
    #terminalTasks .task-card .task-actions {
        flex-direction: column;
        gap: 6px;
    }

    #userBox .task-card .task-actions button,
    #terminalTasks .task-card .task-actions button {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }

    #userBox .task-actions,
    #terminalTasks .task-actions {
        flex-direction: column;
        gap: 6px;
    }

    #userBox .task-actions button,
    #terminalTasks .task-actions button {
        width: 100%;
    }

    #userBox .grid,
    #terminalUserArea .grid {
        display: block;
    }

    #userBox .task-card::before,
    #terminalTasks .task-card::before {
        display: none;
    }

    #userBox .task-title,
    #terminalTasks .task-title {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    #userBox .task-title::before,
    #terminalTasks .task-title::before {
        content: '';
        display: inline-flex;
        width: 18px;
        height: 18px;
        border-radius: 999px;
        border: 3px solid rgba(255, 255, 255, .28);
        background: transparent;
        box-shadow: 0 0 0 4px rgba(255, 255, 255, .05);
        flex-shrink: 0;
    }

    html[data-theme="light"] #userBox .task-title::before,
    html[data-theme="light"] #terminalTasks .task-title::before {
        border-color: rgba(16, 19, 33, .2);
        box-shadow: 0 0 0 4px rgba(16, 19, 33, .06);
    }

    #userBox .task-card[data-task-state="in_progress"] .task-title::before,
    #terminalTasks .task-card[data-task-state="in_progress"] .task-title::before {
        border-color: rgba(110, 168, 254, .85);
        background: rgba(110, 168, 254, .4);
        box-shadow: 0 0 0 4px rgba(110, 168, 254, .16);
    }

    html[data-theme="light"] #userBox .task-card[data-task-state="in_progress"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="in_progress"] .task-title::before {
        border-color: rgba(59, 123, 253, .65);
        background: rgba(59, 123, 253, .38);
        box-shadow: 0 0 0 4px rgba(59, 123, 253, .16);
    }

    #userBox .task-card[data-task-state="done"] .task-title::before,
    #userBox .task-card[data-task-state="yes"] .task-title::before,
    #terminalTasks .task-card[data-task-state="done"] .task-title::before,
    #terminalTasks .task-card[data-task-state="yes"] .task-title::before {
        border-color: rgba(48, 209, 88, .85);
        background: rgba(48, 209, 88, .5);
        box-shadow: 0 0 0 4px rgba(48, 209, 88, .18);
    }

    html[data-theme="light"] #userBox .task-card[data-task-state="done"] .task-title::before,
    html[data-theme="light"] #userBox .task-card[data-task-state="yes"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="done"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="yes"] .task-title::before {
        border-color: rgba(47, 158, 68, .75);
        background: rgba(47, 158, 68, .42);
        box-shadow: 0 0 0 4px rgba(47, 158, 68, .2);
    }

    #userBox .task-card[data-task-state="blocked"] .task-title::before,
    #userBox .task-card[data-task-state="no"] .task-title::before,
    #terminalTasks .task-card[data-task-state="blocked"] .task-title::before,
    #terminalTasks .task-card[data-task-state="no"] .task-title::before {
        border-color: rgba(255, 107, 107, .9);
        background: rgba(255, 107, 107, .55);
        box-shadow: 0 0 0 4px rgba(255, 107, 107, .25);
    }

    html[data-theme="light"] #userBox .task-card[data-task-state="blocked"] .task-title::before,
    html[data-theme="light"] #userBox .task-card[data-task-state="no"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="blocked"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="no"] .task-title::before {
        border-color: rgba(224, 49, 49, .75);
        background: rgba(224, 49, 49, .45);
        box-shadow: 0 0 0 4px rgba(224, 49, 49, .18);
    }

    #userBox .task-card[data-task-state="pending_approval"] .task-title::before,
    #userBox .task-card[data-task-state="todo"] .task-title::before,
    #userBox .task-card[data-task-state="pending"] .task-title::before,
    #terminalTasks .task-card[data-task-state="pending_approval"] .task-title::before,
    #terminalTasks .task-card[data-task-state="todo"] .task-title::before,
    #terminalTasks .task-card[data-task-state="pending"] .task-title::before {
        border-color: rgba(255, 255, 255, .28);
        background: rgba(255, 255, 255, .05);
        box-shadow: 0 0 0 4px rgba(255, 255, 255, .04);
    }

    html[data-theme="light"] #userBox .task-card[data-task-state="pending_approval"] .task-title::before,
    html[data-theme="light"] #userBox .task-card[data-task-state="todo"] .task-title::before,
    html[data-theme="light"] #userBox .task-card[data-task-state="pending"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="pending_approval"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="todo"] .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-task-state="pending"] .task-title::before {
        border-color: rgba(16, 19, 33, .18);
        background: rgba(16, 19, 33, .06);
        box-shadow: 0 0 0 4px rgba(16, 19, 33, .05);
    }

    #userBox .task-card.priority .task-title::before,
    #terminalTasks .task-card.priority .task-title::before {
        border-color: rgba(245, 176, 76, .9);
        background: rgba(245, 176, 76, .55);
        box-shadow: 0 0 0 4px rgba(245, 176, 76, .25);
    }

    html[data-theme="light"] #userBox .task-card.priority .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card.priority .task-title::before {
        border-color: rgba(245, 176, 76, .7);
        background: rgba(245, 176, 76, .45);
        box-shadow: 0 0 0 4px rgba(245, 176, 76, .2);
    }

    #userBox .task-card[data-due-tone="overdue"]:not([data-task-state="done"]) .task-title::before,
    #terminalTasks .task-card[data-due-tone="overdue"]:not([data-task-state="done"]) .task-title::before {
        border-color: rgba(255, 107, 107, .9);
        background: rgba(255, 107, 107, .55);
        box-shadow: 0 0 0 4px rgba(255, 107, 107, .25);
    }

    #userBox .task-card[data-due-tone="today"]:not([data-task-state="done"]) .task-title::before,
    #terminalTasks .task-card[data-due-tone="today"]:not([data-task-state="done"]) .task-title::before {
        border-color: rgba(245, 176, 76, .9);
        background: rgba(245, 176, 76, .55);
        box-shadow: 0 0 0 4px rgba(245, 176, 76, .25);
    }

    #userBox .task-card[data-due-tone="tomorrow"]:not([data-task-state="done"]) .task-title::before,
    #terminalTasks .task-card[data-due-tone="tomorrow"]:not([data-task-state="done"]) .task-title::before {
        border-color: rgba(110, 168, 254, .85);
        background: rgba(110, 168, 254, .4);
        box-shadow: 0 0 0 4px rgba(110, 168, 254, .16);
    }

    html[data-theme="light"] #userBox .task-card[data-due-tone="overdue"]:not([data-task-state="done"]) .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-due-tone="overdue"]:not([data-task-state="done"]) .task-title::before {
        border-color: rgba(224, 49, 49, .75);
        background: rgba(224, 49, 49, .45);
        box-shadow: 0 0 0 4px rgba(224, 49, 49, .18);
    }

    html[data-theme="light"] #userBox .task-card[data-due-tone="today"]:not([data-task-state="done"]) .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-due-tone="today"]:not([data-task-state="done"]) .task-title::before {
        border-color: rgba(245, 176, 76, .7);
        background: rgba(245, 176, 76, .45);
        box-shadow: 0 0 0 4px rgba(245, 176, 76, .2);
    }

    html[data-theme="light"] #userBox .task-card[data-due-tone="tomorrow"]:not([data-task-state="done"]) .task-title::before,
    html[data-theme="light"] #terminalTasks .task-card[data-due-tone="tomorrow"]:not([data-task-state="done"]) .task-title::before {
        border-color: rgba(59, 123, 253, .6);
        background: rgba(59, 123, 253, .35);
        box-shadow: 0 0 0 4px rgba(59, 123, 253, .16);
    }
}

@media (max-width: 960px) {
    #terminalTasks {
        gap: 20px;
    }

    #terminalTasks .task-card .task-actions {
        flex-direction: column;
        gap: 6px;
    }

    #terminalTasks .task-actions button {
        width: 100%;
    }
}

/* Stile für Bildvorschau & Löschen-Button */
.preview-container {
    position: relative;
    display: none;
    margin-top: 8px;
    width: 100%;
}

.preview-container img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 50vh;
    border-radius: 6px;
    object-fit: contain;
}

.delete-preview {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.attachment-edit-btn {
    position: absolute;
    left: 8px;
    bottom: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.attachment-edit-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.preview-container.file-preview {
    display: none;
    padding: 0.6rem 0.75rem;
    background: var(--panel-2);
    border-radius: 8px;
    border: 1px dashed var(--border);
    align-items: center;
    gap: 0.75rem;
}

.preview-container.file-preview .delete-preview {
    position: static;
    width: 28px;
    height: 28px;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.preview-container.file-preview .delete-preview:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: transparent;
}

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-word;
}

.file-name::before {
    content: '📎';
    margin-right: 0.4rem;
}

.image-markup-modal-box {
    width: min(900px, 94vw);
}

.image-markup-toolbar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.image-markup-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.image-markup-canvas-wrap {
    margin-top: 0.8rem;
    max-height: 65vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

#imageMarkupCanvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    cursor: crosshair;
}

.file-drop-zone {
    position: relative;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--panel-2);
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.file-drop-zone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-drop-zone__hint {
    pointer-events: none;
    font-size: 0.9rem;
}

.file-drop-zone--split {
    padding: 0;
    min-height: 110px;
}

.file-drop-zone--split .file-drop-zone__split-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 110px;
}

.file-drop-zone__split-action {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem;
    text-align: center;
}

.file-drop-zone__split-action + .file-drop-zone__split-action {
    border-left: 1px dashed var(--border);
}

.file-drop-zone__split-title {
    font-weight: 700;
    color: var(--fg);
}

.file-drop-zone__split-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
}


.file-drop-zone--split .file-drop-zone__input {
    display: none;
}

.file-drop-zone__split-action {
    cursor: pointer;
}

.file-drop-zone__split-action:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.file-drop-zone__camera-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 640px) {
    .file-drop-zone--split .file-drop-zone__split-actions {
        grid-template-columns: 1fr;
    }

    .file-drop-zone__split-action + .file-drop-zone__split-action {
        border-left: 0;
        border-top: 1px dashed var(--border);
    }
}

.file-drop-zone:focus-within {
    border-color: var(--primary);
    color: var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.file-drop-zone.is-dragover {
    border-color: var(--primary);
    background: rgba(66, 133, 244, 0.08);
    color: var(--primary);
}

.attachment-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.task-attachments {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.task-attachments .attachment-indicator {
    font-size: 0.85rem;
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.attachment-link:hover {
    text-decoration: underline;
}

.quick-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: stretch;
}

.quick-filter-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.15rem;
    flex: 1 1 180px;
    min-width: 0;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.quick-filter-btn[disabled] {
    cursor: not-allowed;
    opacity: .5;
}

.quick-filter-btn.is-active {
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px rgba(110, 168, 254, .25);
}

.quick-filter-btn--danger {
    border-color: var(--danger);
    color: var(--danger);
}

.quick-filter-btn--success {
    border-color: var(--ok);
    color: var(--ok);
}

.quick-filter-btn--info {
    border-color: var(--accent);
    color: var(--accent);
}

.quick-filter-btn--danger.is-active {
    background: var(--danger);
    color: #fff;
}

.quick-filter-btn--success.is-active {
    background: var(--ok);
    color: #fff;
}

.quick-filter-btn--info.is-active {
    background: var(--accent);
    color: #fff;
}

.quick-filter-label {
    font-size: .85rem;
    text-align: center;
}

.quick-filter-count {
    font-size: 1.1rem;
    line-height: 1;
}

@media (max-width: 720px) {
    .quick-filter-btn {
        flex-basis: 100%;
    }
}

.quick-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.quick-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-width: 0;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--fg);
    font-weight: 600;
    cursor: pointer;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .04);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.quick-filter-btn:hover {
    background: var(--panel-2);
}

.quick-filter-btn[disabled] {
    cursor: not-allowed;
    opacity: .5;
}

.quick-filter-btn.is-active {
    transform: translateY(-1px);
    border-color: var(--accent);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .35);
}

.quick-filter-btn--danger .quick-filter-count,
.quick-filter-btn--danger.is-active .quick-filter-count {
    color: var(--danger);
}

.quick-filter-btn--info .quick-filter-count,
.quick-filter-btn--info.is-active .quick-filter-count {
    color: var(--accent);
}

.quick-filter-btn--success .quick-filter-count,
.quick-filter-btn--success.is-active .quick-filter-count {
    color: var(--ok);
}

/* Ensure active quick filters keep their counters legible on filled backgrounds */
.quick-filter-btn--danger.is-active .quick-filter-count,
.quick-filter-btn--info.is-active .quick-filter-count,
.quick-filter-btn--success.is-active .quick-filter-count {
    color: #fff;
}

.quick-filter-label {
    font-size: .85rem;
    white-space: nowrap;
}

.quick-filter-count {
    font-size: .95rem;
    font-weight: 700;
    line-height: 1;
}

@media (max-width: 720px) {
    .quick-filter-row {
        gap: 0.35rem;
    }

    .quick-filter-btn {
        flex: 1 1 100%;
        justify-content: space-between;
    }
}

.highlight-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.highlight-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0.4rem;
    border-bottom: 1px solid var(--border);
}

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

.highlight-item .details {
    flex: 1;
}

.highlight-item .title {
    font-weight: 600;
}

.highlight-item .meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.highlight-item .actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
}

.highlight-item .actions .tiny,
.highlight-item .actions .ghost,
.highlight-item .actions .danger {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
}

.info-notice {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-highlight);
    color: var(--fg);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.info-notice__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.info-notice__text {
    flex: 1;
}

.info-notice__link {
    margin-left: auto;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: none;
}

.info-notice__link:hover,
.info-notice__link:focus {
    text-decoration: underline;
}

.info-card {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}

.info-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.info-message {
    margin-top: 0.6rem;
    line-height: 1.5;
}

.stacked-item > .info-message:first-child {
    margin-top: 0;
}

.info-message + .info-meta {
    display: block;
    margin-top: 0.6rem;
}

.info-message p {
    margin: 0.45rem 0;
}

.info-message ul,
.info-message ol {
    margin: 0.45rem 0 0.45rem 1.25rem;
    padding-left: 1.25rem;
}

.info-message a {
    color: var(--accent);
    text-decoration: underline;
}

.info-targets {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

.info-admin-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
}

.info-meta-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.info-admin-footer .info-targets {
    margin-top: 0;
}

.info-admin-actions {
    display: inline-flex;
    gap: 0.5rem;
}

.stacked-list {
    display: grid;
    gap: 0.75rem;
}

.stacked-item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.stacked-title {
    font-weight: 600;
}

.stacked-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.log-feed {
    max-height: 65vh;
    overflow-y: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
}

.log-entry {
    display: flex;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    font-weight: 600;
    min-width: 130px;
    color: var(--muted);
}

.log-text {
    flex: 1;
    font-size: 0.95rem;
}

.log-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.log-empty-hint {
    padding: 1rem;
    text-align: center;
    color: var(--muted);
}

.log-load-more {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.log-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.log-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.log-jump-btn {
    padding: 0.25rem 0.6rem;
}

@media (max-width: 640px) {
    h1 {
        font-size: 1.85rem;
    }

    button {
        padding: 6px 10px;
        font-size: .95rem;
        border-radius: 9px;
    }

    button.tiny {
        padding: 4px 6px;
        font-size: .8rem;
        border-radius: 7px;
    }

    .task-card {
        padding: 16px 16px 14px 64px;
        border-radius: 12px;
    }

    .task-card::before {
        left: 24px;
        top: 20px;
    }

    #myTasks,
    #terminalTasks {
        gap: 26px;
    }

    #myTasks .task-card,
    #terminalTasks .task-card,
    .task-card[data-task-id] {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }

    .task-card .task-actions button {
        padding: 5px 10px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .task-title {
        font-size: 1rem;
    }
}

html.no-flex-gap .row {
    margin: -5px;
}

html.no-flex-gap .row > * {
    margin: 5px;
}

html.no-flex-gap .mode-links {
    margin: -0.25rem;
}

html.no-flex-gap .mode-links > * {
    margin: 0.25rem;
}

html.no-flex-gap .admin-action-grid {
    margin: -0.5rem;
}

html.no-flex-gap .admin-action-grid > .admin-action-item {
    margin: 0.5rem;
    flex: 1 1 calc(50% - 1rem);
}

html.no-flex-gap .editor-trigger > * + * {
    margin-top: .35rem;
}

html.no-flex-gap .editor-preview-attachments > * + * {
    margin-top: .35rem;
}

html.no-flex-gap .admin-action-item > * + * {
    margin-top: .75rem;
}

html.no-flex-gap .comment-form > * + * {
    margin-top: 8px;
}

html.no-flex-gap .comment-form__body > * + * {
    margin-top: 10px;
}

html.no-flex-gap .chat > * + * {
    margin-top: 8px;
}

html.no-flex-gap .terminal-user-area > * + * {
    margin-top: 1.5rem;
}

html.no-flex-gap #terminalTasks > * + * {
    margin-top: 14px;
}

html.no-flex-gap .terminal-user-placeholder > * + * {
    margin-top: .4rem;
}

html.no-flex-gap #myTasks > * + *,
html.no-flex-gap .task-card > * + * {
    margin-top: 14px;
}

@media (min-width: 961px) {
    html.no-flex-gap #userBox #myTasks > * + *,
    html.no-flex-gap #terminalUserArea #terminalTasks > * + * {
        margin-top: 26px;
    }
}

html.no-flex-gap .task-card.open .task-details > * + * {
    margin-top: 14px;
}

html.no-flex-gap .task-card.admin-card.open .task-details > * + * {
    margin-top: 18px;
}

html.no-flex-gap .task-details__columns {
    display: flex;
}

html.no-flex-gap .task-card.open .task-details__columns > * + * {
    margin-top: 16px;
}

html.no-flex-gap .task-card.open .task-details__column > * + * {
    margin-top: 14px;
}

html.no-flex-gap .task-desc-actions > * + * {
    margin-left: 8px;
}

@media (min-width: 960px) {
    html.no-flex-gap .task-card.open .task-details__columns {
        flex-direction: row;
        flex: 1 1 auto;
        align-items: stretch;
    }

    html.no-flex-gap .task-card.open .task-details__columns > * + * {
        margin-top: 0;
        margin-left: 24px;
    }
}

html.no-flex-gap .editor-preview-attachments .attachment-chip > * + * {
    margin-left: .35rem;
}

html.no-flex-gap .terminal-box-header {
    margin: 0 -0.5rem 1.5rem;
}

html.no-flex-gap .terminal-box-header > * {
    margin: 0.5rem;
}

html.no-flex-gap .terminal-countdown > * + * {
    margin-left: .6rem;
}

html.no-flex-gap .terminal-user-head {
    margin: -0.5rem;
}

html.no-flex-gap .terminal-user-head > * {
    margin: 0.5rem;
}

html.no-flex-gap .task-meta {
    margin: -4px;
}

html.no-flex-gap .task-meta > * {
    margin: 4px;
}

html.no-flex-gap .task-header {
    margin: 0 -6px;
}

html.no-flex-gap .task-header > * {
    margin: 0 6px;
}

html.no-flex-gap .task-actions {
    margin: 10px -4px 0;
}

html.no-flex-gap .task-actions > * {
    margin: 4px;
}

html.no-flex-gap .task-position-control > * + * {
    margin-left: 6px;
}

html.no-flex-gap .task-title-cell > * + * {
    margin-left: 6px;
}

html.no-flex-gap .comment-form__toggle > * + * {
    margin-left: 6px;
}

html.no-flex-gap .comment-actions > * + *,
html.no-flex-gap .chat-actions-inline > * + * {
    margin-left: 8px;
}

html.no-flex-gap .task-desc-block {
    margin: 0 -0.375rem;
}

html.no-flex-gap .task-desc-block > * {
    margin: 0 0.375rem;
}

html.no-flex-gap .chat-item > * + * {
    margin-top: 6px;
}

html.no-flex-gap .chat-attachments > * + * {
    margin-top: .25rem;
}

html.no-flex-gap .chat-attachment > * + * {
    margin-left: .35rem;
}

html.no-flex-gap .comment-replies > * + * {
    margin-top: .5rem;
}

html.no-flex-gap .task-history > * + * {
    margin-top: .5rem;
}

html.no-flex-gap .task-history__list > * + * {
    margin-top: .5rem;
}

html.no-flex-gap .task-history__item > * + * {
    margin-top: .35rem;
}

html.no-flex-gap .task-history__headline {
    margin: 0 -0.25rem;
}

html.no-flex-gap .task-history__headline > * {
    margin: 0 0.25rem;
}

html.no-flex-gap .task-history__badge > * + * {
    margin-left: .35rem;
}

html.no-flex-gap .summary-actions > * + * {
    margin-left: .5rem;
}

.chip-multi-select {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.chip-multi-select__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 2.2rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-2);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chip-multi-select:focus-within .chip-multi-select__chips {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.3);
}

.chip-multi-select__placeholder {
    color: var(--muted);
    font-size: 0.9rem;
}

.chip-multi-select__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    font-size: 0.85rem;
}

.chip-multi-select__chip-label {
    white-space: nowrap;
}

.chip-multi-select__chip-remove {
    border: none;
    background: none;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.chip-multi-select__chip-remove:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.chip-multi-select__search {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--fg);
}

.chip-multi-select__search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.25);
}

.chip-multi-select__options-wrapper {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chip-multi-select--collapsed .chip-multi-select__options-wrapper {
    display: none;
}

.chip-multi-select--collapsed:focus-within .chip-multi-select__options-wrapper {
    display: flex;
}

.chip-multi-select__options {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.chip-multi-select__option {
    padding: 0.45rem 0.65rem;
}

.chip-multi-select__option-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    color: var(--fg);
}

.chip-multi-select__option input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}

.chip-multi-select__option.is-selected {
    background: var(--card-highlight);
}

.chip-multi-select__no-results,
.chip-multi-select__empty {
    border-top: 1px solid var(--border);
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.chip-multi-select--disabled {
    opacity: 0.6;
}

.chip-multi-select--disabled .chip-multi-select__chip-remove {
    cursor: not-allowed;
}

@supports (-webkit-touch-callout: none) {
    input,
    select,
    textarea,
    .rich-editor__input {
        font-size: 16px;
    }
}
