/* ===== LogiTask – Design System ===== */
:root {
    --accent: #6366f1;
    --accent-strong: #4f46e5;
    --accent-soft: rgba(99, 102, 241, 0.12);

    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f1f2f7;
    --border: #e5e7eb;
    --text: #1f2430;
    --text-muted: #6b7280;

    --prio-high: #ef4444;
    --prio-medium: #f59e0b;
    --prio-low: #10b981;

    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
    --radius: 14px;
    --radius-sm: 9px;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #171a23;
    --surface-2: #1f232f;
    --border: #2a2f3c;
    --text: #e7e9ee;
    --text-muted: #9aa1b1;
    --accent-soft: rgba(99, 102, 241, 0.2);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1:focus, h1:focus-visible { outline: none; }

/* ===== App-Layout ===== */
.app {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 750;
    padding: 6px 10px 16px;
    letter-spacing: -0.02em;
}
.brand .logo {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: #fff; border-radius: 10px; font-size: 1.1rem;
}

.nav-section { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); padding: 14px 10px 6px; font-weight: 600; }

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; border-radius: var(--radius-sm);
    color: var(--text); font-weight: 500; cursor: pointer;
    transition: background 0.15s; border: none; background: none;
    width: 100%; text-align: left; font-family: inherit; font-size: 0.92rem;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

/* ===== Login ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: var(--bg);
}
.login-card {
    width: 100%; max-width: 380px; padding: 28px;
    display: flex; flex-direction: column; gap: 14px;
}
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-error {
    background: rgba(239,68,68,0.12); color: #b91c1c;
    border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem;
}
[data-theme="dark"] .login-error { color: #fca5a5; }
.logout-form { display: contents; }

/* Versionsanzeige unten links */
.app-version {
    padding: 8px 11px 2px; font-size: 0.72rem; color: var(--text-muted);
    letter-spacing: 0.02em; cursor: default;
}

/* „＋ Neue Aufgabe“ direkt unter dem Logo */
.nav-link.new-task {
    background: var(--accent); color: #fff; font-weight: 600;
    margin-bottom: 10px; justify-content: center;
}
.nav-link.new-task:hover { background: var(--accent-strong); color: #fff; }
.nav-link.new-task.active { background: var(--accent); color: #fff; }
.nav-link .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.nav-link .count { margin-left: auto; font-size: 0.78rem; color: var(--text-muted); }

.main { padding: 26px 32px 60px; max-width: 1100px; width: 100%; }
/* Das Board nutzt die volle Breite der rechten Seite */
.main:has(.board) { max-width: none; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 22px;
}
.topbar h1 { font-size: 1.6rem; }
.topbar .sub { color: var(--text-muted); font-size: 0.9rem; margin-top: 2px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); padding: 9px 14px; border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 550; cursor: pointer;
    transition: all 0.15s; font-family: inherit;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--prio-high); border-color: transparent; background: transparent; }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }
.btn-icon { padding: 8px; }
.btn-sm { padding: 6px 10px; font-size: 0.82rem; }

/* ===== Cards / Panels ===== */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ===== Stat-Grid ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .value { font-size: 1.9rem; font-weight: 720; line-height: 1; }
.stat .label { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; }
.stat.accent .value { color: var(--accent); }
.stat.warn .value { color: var(--prio-medium); }
.stat.danger .value { color: var(--prio-high); }
.stat.ok .value { color: var(--prio-low); }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); }

/* ===== Toolbar / Filter ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.search {
    flex: 1 1 220px; min-width: 180px;
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px;
}
.search input { border: none; outline: none; background: transparent; color: var(--text); width: 100%; font-size: 0.9rem; font-family: inherit; }

select, input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="time"], input[type="datetime-local"], textarea {
    font-family: inherit; font-size: 0.9rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 11px; outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--accent); }

/* ===== Task-Liste ===== */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task {
    display: flex; align-items: flex-start; gap: 13px;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
    transition: transform 0.12s, box-shadow 0.12s;
}
.task:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,24,40,0.1); }
.task.prio-High { border-left-color: var(--prio-high); }
.task.prio-Medium { border-left-color: var(--prio-medium); }
.task.prio-Low { border-left-color: var(--prio-low); }
.task.done { opacity: 0.6; }
.task.done .task-title { text-decoration: line-through; }
.task.overdue .due { color: var(--prio-high); font-weight: 600; }
.task.dragging { opacity: 0.4; }
.task.drag-over { border-top: 2px dashed var(--accent); }

.check {
    width: 22px; height: 22px; border-radius: 6px; flex: none; margin-top: 2px;
    border: 2px solid var(--border); cursor: pointer; display: grid; place-items: center;
    background: var(--surface); color: transparent; transition: all 0.15s; padding: 0;
}
.check:hover { border-color: var(--accent); }
.check.checked { background: var(--prio-low); border-color: var(--prio-low); color: #fff; }
.check.inprogress { border-color: var(--prio-medium); color: var(--prio-medium); }

.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 0.98rem; cursor: pointer; }
.task-desc { color: var(--text-muted); font-size: 0.86rem; margin-top: 3px; white-space: pre-wrap; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 9px; }

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.76rem; padding: 3px 9px; border-radius: 99px;
    background: var(--surface-2); color: var(--text-muted); font-weight: 550;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.tag { background: var(--accent-soft); color: var(--accent-strong); }
.chip.prio-High { background: rgba(239,68,68,0.12); color: var(--prio-high); }
.chip.prio-Medium { background: rgba(245,158,11,0.14); color: #b45309; }
.chip.prio-Low { background: rgba(16,185,129,0.14); color: #047857; }
.chip.state-Open { background: var(--surface-2); color: var(--text-muted); }
.chip.state-Evaluate { background: rgba(139,92,246,0.14); color: #7c3aed; }
.chip.state-Waiting { background: rgba(100,116,139,0.16); color: #475569; }
.chip.state-InProgress { background: rgba(245,158,11,0.14); color: #b45309; }
.chip.state-Testing { background: rgba(14,165,233,0.14); color: #0369a1; }
.chip.state-ReadyToShip { background: rgba(20,184,166,0.16); color: #0f766e; }
.chip.state-Done { background: rgba(16,185,129,0.14); color: #047857; }
.chip.billable { background: rgba(16,185,129,0.14); color: #047857; font-weight: 650; }

/* ===== Board (Kanban): zwei Zeilen à drei Spalten ===== */
.board-rows { display: flex; flex-direction: column; gap: 14px; }
.board {
    display: grid;
    grid-template-columns: repeat(3, minmax(215px, 1fr));
    gap: 12px;
    overflow-x: auto;
    align-items: start;
}
.board-col {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    display: flex; flex-direction: column; gap: 8px;
    min-height: 140px;
}
.board-col.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 6px; }
.board-col-head .count { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.board-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: grab;
    box-shadow: var(--shadow);
}
.board-card:hover { border-color: var(--accent); }
.board-card.dragging { opacity: 0.4; }
.board-card.prio-High { border-left-color: var(--prio-high); }
.board-card.prio-Medium { border-left-color: var(--prio-medium); }
.board-card.prio-Low { border-left-color: var(--prio-low); }
.board-card-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
@media (max-width: 900px) {
    .board { grid-template-columns: repeat(3, 215px); }
}

/* ===== Checklisten ===== */
.check-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.check-item input[type="checkbox"] { width: 18px; height: 18px; flex: none; }
.check-item.done span.check-title { text-decoration: line-through; color: var(--text-muted); }
.check-item .check-title { flex: 1; }
.list-pill { border: 1px solid var(--border); background: var(--surface); border-radius: 99px;
    padding: 7px 14px; cursor: pointer; font-size: 0.88rem; font-weight: 550; color: var(--text); font-family: inherit; }
.list-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.done-toggle {
    border: none; background: transparent; color: var(--text-muted);
    font-weight: 600; font-size: 0.85rem; text-align: left; cursor: pointer;
    font-family: inherit; display: flex; gap: 6px; align-items: center;
    padding: 8px 2px 2px;
}
.done-toggle:hover { color: var(--text); }

.task-actions { display: flex; gap: 2px; flex: none; }
.drag-handle { cursor: grab; color: var(--text-muted); padding: 4px; user-select: none; font-size: 1.1rem; }
.drag-handle:active { cursor: grabbing; }

.mini-progress { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--text-muted); }
.mini-progress .bar { width: 60px; height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.mini-progress .bar > span { display: block; height: 100%; background: var(--prio-low); }

/* ===== Empty state ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty .big { font-size: 2.6rem; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(10, 12, 18, 0.5);
    display: grid; place-items: center; padding: 20px; z-index: 50;
    backdrop-filter: blur(3px);
}
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-head { display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 15px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input, .field select, .field textarea { width: 100%; }
.field textarea { resize: vertical; min-height: 60px; }
.validation { color: var(--prio-high); font-size: 0.8rem; }

.subtask-row { display: flex; align-items: center; gap: 8px; }
.subtask-row input[type="text"] { flex: 1; width: auto; }
.subtask-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin: 0; }

/* ===== Aufgeräumter Editor (TickTick-Stil) ===== */
.editor-modal { max-width: 640px; }
.editor-form { min-width: 0; flex: 1; }

/* Zeiterfassung als ausklappbarer Seitenbereich (kein Popup) */
.editor-modal.with-time { max-width: 1010px; display: flex; align-items: stretch; }
.editor-timepane {
    width: 360px; flex: none; border-left: 1px solid var(--border);
    display: flex; flex-direction: column; background: var(--surface-2);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.timepane-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px 6px;
}
.timepane-head h3 { font-size: 0.95rem; margin: 0; }
.timepane-body {
    display: flex; flex-direction: column; gap: 10px;
    padding: 4px 14px 14px; overflow-y: auto;
}
.time-sums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-sums .stat { padding: 10px; }

/* ===== Kundenauswahl mit Autovervollständigung ===== */
.customer-pick { position: relative; display: inline-flex; }
.customer-input { display: inline-flex; align-items: center; gap: 5px; }
.customer-input input {
    border: none; outline: none; background: transparent;
    font: inherit; color: inherit; width: 130px; padding: 0;
}
.customer-input input::placeholder { color: var(--text-muted); }
.customer-input .clear {
    border: none; background: transparent; cursor: pointer;
    color: var(--text-muted); padding: 0 2px; font-size: 0.8rem;
}
.customer-input .clear:hover { color: var(--text); }
.customer-pop {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
    min-width: 220px; max-height: 240px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.16);
    display: flex; flex-direction: column; padding: 4px;
}
.customer-option {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border: none; background: transparent; cursor: pointer; text-align: left;
    padding: 8px 10px; border-radius: 7px; font-size: 0.88rem; color: var(--text);
}
.customer-option:hover, .customer-option.active { background: var(--accent-soft); }

/* ⏱-Button: Blazor-Element ÜBER der rechten Toolbar-Ecke des Editors –
   unabhängig vom Toast-UI-DOM, damit ihn kein internes Re-Render entfernt.
   Das padding-right reserviert den Platz in der Toolbar darunter. */
.toastui-editor-defaultUI-toolbar { padding-right: 48px; }
.desc-wrap { position: relative; }
.desc-time-btn {
    position: absolute; top: 7px; right: 8px; z-index: 5;
    width: 32px; height: 32px; border: none; border-radius: 6px;
    background: transparent; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text);
}
.desc-time-btn:hover { background: var(--surface-2); }

@media (max-width: 1010px) {
    .editor-modal.with-time { flex-direction: column; }
    .editor-timepane { width: auto; border-left: none; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
}
.editor-top {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px 4px;
}
.editor-date {
    display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted);
    border: none; background: transparent; cursor: pointer; font-size: 0.85rem;
    padding: 4px 6px; border-radius: 8px;
}
.editor-date:hover { background: var(--surface-2); color: var(--text); }
.editor-date .placeholder { opacity: 0.7; }

/* Prioritäts-Flaggen: jede Stufe hat ihre eigene Farbe (hoch=rot, mittel=orange, niedrig=grün) */
.prio-flags { margin-left: auto; display: inline-flex; gap: 2px; }
.prio-flags .flag {
    border: none; background: transparent; cursor: pointer; font-size: 1.05rem;
    padding: 4px 6px; border-radius: 8px; opacity: 0.35; line-height: 1;
    transition: opacity 0.12s, background 0.12s;
}
.prio-flags .flag.high { color: #ef4444; }
.prio-flags .flag.medium { color: #f59e0b; }
.prio-flags .flag.low { color: #10b981; }
.prio-flags .flag:hover { opacity: 0.8; background: var(--surface-2); }
.prio-flags .flag.on { opacity: 1; }
.prio-flags .flag.high.on { background: rgba(239,68,68,0.14); }
.prio-flags .flag.medium.on { background: rgba(245,158,11,0.16); }
.prio-flags .flag.low.on { background: rgba(16,185,129,0.16); }

/* ===== Fälligkeits-Picker (2 Monate, Kalenderwochen, Uhrzeit) ===== */
.datepick { position: relative; display: inline-flex; }
.datepick-backdrop { position: fixed; inset: 0; z-index: 60; }
.datepick-pop {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 61;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.18); padding: 12px; min-width: 480px;
}
.datepick-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.datepick-months { display: flex; gap: 16px; }
.datepick-month { flex: 1; }
.datepick-title { text-align: center; font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }
.datepick-grid { border-collapse: collapse; width: 100%; }
.datepick-grid th {
    font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
    padding: 2px; text-align: center;
}
.datepick-grid th.kw, .datepick-grid td.kw {
    color: var(--text-muted); font-size: 0.68rem; text-align: center;
    border-right: 1px solid var(--border); padding-right: 6px; width: 26px;
}
.datepick-grid td { padding: 1px; text-align: center; }
.datepick-grid .day {
    width: 30px; height: 28px; border: none; background: transparent; cursor: pointer;
    border-radius: 8px; font-size: 0.8rem; color: var(--text);
}
.datepick-grid .day:hover { background: var(--surface-2); }
.datepick-grid .day.other { opacity: 0.3; }
.datepick-grid .day.today { outline: 1px solid var(--accent); }
.datepick-grid .day.selected { background: var(--accent); color: #fff; }
.datepick-foot {
    display: flex; align-items: center; gap: 8px; margin-top: 10px;
    border-top: 1px solid var(--border); padding-top: 10px;
}
.datepick-time { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.datepick-time input { padding: 4px 8px; font-size: 0.85rem; }
@media (max-width: 640px) {
    .datepick-pop { min-width: 260px; max-width: calc(100vw - 32px); }
    .datepick-months { flex-direction: column; }
}

.editor-body { padding: 0 20px 8px; display: flex; flex-direction: column; gap: 8px; }
.editor-title {
    width: 100%; border: none; outline: none; background: transparent;
    font-size: 1.25rem; font-weight: 700; color: var(--text);
    padding: 6px 0; font-family: inherit;
}
.editor-title::placeholder { color: var(--text-muted); font-weight: 600; }
.editor-desc {
    width: 100%; border: none; outline: none; background: transparent;
    color: var(--text); font-size: 0.93rem; line-height: 1.55;
    resize: vertical; min-height: 130px; font-family: inherit; padding: 2px 0;
}
.editor-desc:focus { border: none; }

.md-toolbar {
    display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); padding: 4px 6px; width: fit-content;
}
.md-toolbar button {
    border: none; background: transparent; color: var(--text);
    min-width: 30px; height: 28px; border-radius: 7px; cursor: pointer;
    font-size: 0.85rem; font-family: inherit; padding: 0 6px;
}
.md-toolbar button:hover { background: var(--surface); }
.md-toolbar .sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

#task-desc-editor .toastui-editor-defaultUI { border-radius: 10px; border-color: var(--border); }
#task-desc-editor .toastui-editor-defaultUI-toolbar { border-radius: 10px 10px 0 0; }

.editor-subtasks { display: flex; flex-direction: column; gap: 4px; }
.editor-subtasks .subtask-row input[type="text"] {
    border: none; background: transparent; padding: 5px 4px;
}
.editor-subtasks .subtask-row input[type="text"]:focus { border-bottom: 1px solid var(--accent); border-radius: 0; }
.editor-subtasks .subtask-row .btn { opacity: 0; }
.editor-subtasks .subtask-row:hover .btn { opacity: 1; }

.editor-meta {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    padding: 10px 20px; border-top: 1px solid var(--border);
}
.meta-chip {
    border: 1px solid var(--border); background: var(--surface-2);
    color: var(--text); border-radius: 99px; padding: 5px 11px;
    font-size: 0.8rem; font-family: inherit; cursor: pointer; max-width: 170px;
}
.meta-chip:hover { border-color: var(--accent); }
.meta-chip.toggle { color: var(--text-muted); }
.meta-chip.toggle.on { background: rgba(16,185,129,0.14); color: #047857; border-color: rgba(16,185,129,0.4); font-weight: 600; }
.meta-chip.tags-input { min-width: 120px; flex: 1; cursor: text; }

/* ===== Markdown-Anzeige in Karten ===== */
.md { overflow-wrap: anywhere; }
.md p { margin: 0 0 4px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { font-size: 1rem; margin: 6px 0 3px; color: var(--text); }
.md ul, .md ol { margin: 2px 0 4px; padding-left: 20px; }
.md li { margin: 1px 0; }
.md blockquote { margin: 4px 0; padding: 2px 10px; border-left: 3px solid var(--accent); color: var(--text-muted); }
.md code { background: var(--surface-2); border-radius: 5px; padding: 1px 5px; font-size: 0.85em; }
.md a { text-decoration: underline; }
.md input[type="checkbox"] { margin-right: 5px; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ===== E-Mail-Dropzone ===== */
.dropzone {
    position: relative; display: block;
    border: 2px dashed var(--border); border-radius: var(--radius-sm);
    padding: 18px; text-align: center; color: var(--text-muted);
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover:not(.disabled) { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.disabled { opacity: 0.5; cursor: not-allowed; }
.dropzone input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.dropzone.disabled input[type="file"] { cursor: not-allowed; }
.dropzone .dz-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ===== Toasts ===== */
.toast-host { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
    padding: 12px 16px; box-shadow: var(--shadow); min-width: 240px; max-width: 340px;
    display: flex; align-items: center; gap: 10px; animation: slideIn 0.2s ease;
}
.toast.Success { border-left-color: var(--prio-low); }
.toast.Warning { border-left-color: var(--prio-medium); }
.toast.Error { border-left-color: var(--prio-high); }
.toast .close { margin-left: auto; cursor: pointer; color: var(--text-muted); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Blazor Fehler-UI ===== */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: #fef2f2; color: #991b1b; border-top: 1px solid #fecaca;
    padding: 12px 20px; box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
#blazor-error-ui a { color: #991b1b; text-decoration: underline; margin-left: 8px; }

/* ===== Theme toggle ===== */
.theme-toggle { margin-top: auto; }

/* ===== Kategorie-Verwaltung ===== */
.cat-manage { display: flex; flex-direction: column; gap: 10px; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.cat-row .swatch { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.cat-row input[type="color"] { width: 34px; height: 34px; padding: 2px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }

/* ===== Responsive ===== */
.menu-btn { display: none; }
.scrim { display: none; }
@media (max-width: 820px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 40; left: 0; top: 0; width: 260px;
        transform: translateX(-100%); transition: transform 0.2s;
    }
    .sidebar.open { transform: none; box-shadow: var(--shadow); }
    .menu-btn { display: inline-flex; }
    .main { padding: 18px; }
    .field-row { grid-template-columns: 1fr; }
    .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 39; }
}
