/* work_app — minimal, calm, AuDHD-friendly UI */
:root {
    --bg: #0e1014;
    --surface: #161922;
    --surface-2: #1d2230;
    --surface-3: #252b3b;
    --border: #2a3145;
    --text: #e6e7ea;
    --text-dim: #a4a8b3;
    --text-faint: #6b7080;
    --accent: #5da3ff;
    --accent-2: #4ad8c7;
    --danger: #ff6b6b;
    --warning: #f4b860;
    --success: #5ee2a0;
    --internal: #f4b860;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --radius: 10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* Layout shell */
.shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 56px 1fr;
    height: 100vh;
    grid-template-areas: "topbar topbar" "sidebar main";
}
.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.topbar .brand { font-weight: 600; letter-spacing: 0.3px; }
.topbar .who { color: var(--text-dim); font-size: 13px; }
.topbar .who a { color: var(--text-dim); margin-left: 12px; }

.sidebar {
    grid-area: sidebar;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 10px;
}
.sidebar .group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-faint);
    padding: 16px 12px 6px;
}
.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
}
.sidebar .nav-item:hover { background: var(--surface-2); text-decoration: none; }
.sidebar .nav-item.active { background: var(--surface-3); color: var(--text); }
.sidebar .dot {
    width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
}

/* Collapsible folder groups */
.sidebar-folder { margin-bottom: 2px; }
.sidebar-folder .folder-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 8px 12px 4px;
    cursor: pointer;
    text-align: left;
}
.sidebar-folder .folder-toggle:hover { color: var(--text); }
.sidebar-folder .folder-chevron {
    font-size: 10px;
    transition: transform 150ms ease;
    line-height: 1;
}
.sidebar-folder .folder-chevron.collapsed { transform: rotate(-90deg); }
.sidebar-folder .folder-name { flex: 1; }
.sidebar-folder .folder-count {
    background: var(--surface-3);
    color: var(--text-faint);
    border-radius: 999px;
    padding: 1px 6px;
    font-size: 10px;
}
.sidebar-folder .folder-items { padding-bottom: 2px; }
[x-cloak] { display: none !important; }

.main {
    grid-area: main;
    overflow-y: auto;
    padding: 24px 32px;
}
.main h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
.main .crumb { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }

/* Buttons */
.btn {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 120ms ease;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0c1220; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}
label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Time summary card */
.time-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}
.time-cell { display: flex; flex-direction: column; gap: 2px; }
.time-cell .label-text { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; }
.time-cell .val { font-size: 18px; font-weight: 600; }
.time-cell .compare { font-size: 12px; color: var(--text-dim); }
.time-cell .compare.over { color: var(--warning); }
.time-cell .compare.under { color: var(--success); }

/* Section + Task list */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.section.internal { border-left: 3px solid var(--internal); }
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.section-head .name { font-weight: 600; font-size: 14px; }
.section-head .meta { color: var(--text-dim); font-size: 12px; }
.section-body { padding: 4px 8px; }

.task-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 80ms ease;
}
.task-row:hover { background: var(--surface-3); }
.task-row.internal::before {
    content: "🔒";
    font-size: 11px;
    color: var(--internal);
    margin-right: 4px;
}
.task-row.done .task-title { color: var(--text-faint); text-decoration: line-through; }
.task-check {
    width: 18px; height: 18px;
    border: 1.5px solid var(--text-faint);
    border-radius: 50%;
    flex: 0 0 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
}
.task-check.done { background: var(--success); border-color: var(--success); color: #0c1220; }
.task-title { flex: 1; }
.task-meta {
    display: flex; align-items: center; gap: 10px;
    color: var(--text-dim); font-size: 12px;
}
.priority-tag {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11px;
}
.priority-tag.p4 { color: var(--danger); border-color: var(--danger); }
.priority-tag.p3 { color: var(--warning); border-color: var(--warning); }
.priority-tag.p2 { color: var(--accent); border-color: var(--accent); }

/* View toggle */
.view-toggle {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.view-toggle button {
    background: transparent;
    color: var(--text-dim);
    border: 0;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
}
.view-toggle button.active { background: var(--surface-3); color: var(--text); }

/* Project header bar */
.project-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Kanban */
.kanban {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 20px;
    align-items: flex-start;
}
.kanban-col {
    flex: 0 0 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: calc(100vh - 280px);
    display: flex;
    flex-direction: column;
}
.kanban-col.internal { border-left: 3px solid var(--internal); }
.kanban-col-head {
    padding: 12px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.kanban-col-head .name { font-weight: 600; font-size: 13px; }
.kanban-col-head .count { color: var(--text-faint); font-size: 12px; }
.kanban-col-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 100px;
}
.kanban-card {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: transform 100ms ease, box-shadow 100ms ease;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.kanban-card.internal { border-left: 3px solid var(--internal); }
.kanban-card.done { opacity: 0.55; }
.kanban-card.done .card-title { text-decoration: line-through; }
.kanban-card .card-title { font-size: 13px; margin-bottom: 6px; }
.kanban-card .card-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--text-dim); }
.kanban-card.sortable-ghost { opacity: 0.4; background: var(--surface-2); }
.kanban-card.sortable-chosen { cursor: grabbing; }

/* Slide-over panel */
.panel-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 50;
    display: none;
}
.panel-overlay.open { display: block; }
.panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(620px, 100vw);
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 51;
    transform: translateX(100%);
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex; flex-direction: column;
}
.panel.open { transform: translateX(0); }
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.panel-head .title { font-weight: 600; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; }
.panel-foot {
    border-top: 1px solid var(--border);
    padding: 12px 16px;
}

/* Comments */
.comment {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
}
.comment.internal { border-left: 3px solid var(--internal); }
.comment.event { background: transparent; border-style: dashed; color: var(--text-dim); }
.comment-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-dim);
}
.comment-head .author { color: var(--text); font-weight: 500; }
.comment-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attachment-chip {
    display: flex; align-items: center; gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 12px;
}
.attachment-chip .icon { color: var(--accent); }
.attachment-chip img { max-width: 60px; max-height: 60px; border-radius: 4px; }

/* Composer (drag-drop + voice) */
.composer { border-top: 1px solid var(--border); padding: 12px; background: var(--surface); border-radius: var(--radius); margin-top: 12px; }
.composer.dragover { background: var(--surface-2); border: 2px dashed var(--accent); }
.composer-row { display: flex; align-items: flex-start; gap: 8px; }
.composer textarea {
    flex: 1; background: var(--surface-2); border: 1px solid var(--border);
    min-height: 60px;
}
.composer .composer-actions { display: flex; gap: 6px; align-items: center; }
.composer .icon-btn {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid transparent;
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.composer .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.composer .icon-btn.recording { color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.composer .staged {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.composer .staged-item {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px 8px;
    font-size: 12px; display: flex; align-items: center; gap: 6px;
}
.composer .staged-item button { background: transparent; border: 0; color: var(--text-faint); cursor: pointer; }
.composer .upload-menu {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    margin-top: 8px;
    display: none;
}
.composer .upload-menu.open { display: block; }
.composer .upload-menu .menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    cursor: pointer; border-radius: var(--radius-sm);
}
.composer .upload-menu .menu-item:hover { background: var(--surface-3); }
.composer .upload-menu .menu-item .icon { width: 22px; color: var(--text-dim); }

/* Login */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 360px;
    box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 8px; font-size: 20px; }
.login-card p { color: var(--text-dim); margin: 0 0 20px; }

/* Helpers */
.flex { display: flex; }
.between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.muted { color: var(--text-dim); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.pill {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 2px 8px; font-size: 11px; color: var(--text-dim);
}
.pill.internal { color: var(--internal); border-color: var(--internal); }
.empty {
    color: var(--text-faint); padding: 24px; text-align: center; font-style: italic;
}
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-swapping { opacity: 0.4; transition: opacity 150ms ease; }

/* ───────────────────────────────────────────────────────────────────────
   UX building blocks (Fase 1) — buttons, toasts, panel forms, action menu,
   confirm dialog, list/detail primitives. Dark palette, reuses :root vars.
   ─────────────────────────────────────────────────────────────────────── */

/* Buttons — additions (existing: .btn, .btn.primary, .btn.ghost, .btn.danger) */
.btn:disabled, .btn.htmx-request { opacity: 0.55; pointer-events: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.12); }
.btn-sm { padding: 3px 8px; font-size: 12px; }

/* Icon action button (vis · rediger · slet) */
.btn-icon {
    background: none; border: 0; padding: 4px 6px; cursor: pointer;
    color: var(--text-faint); line-height: 1; border-radius: var(--radius-sm);
    font-size: 15px;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.danger:hover { color: var(--danger); }

/* Page head — list header with title + "+ Ny" */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-head h1, .page-head h2 { margin: 0; }

/* Key-value definition list (detail panels) */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; margin: 12px 0; }
.kv dt { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.kv dd { margin: 0; color: var(--text); font-size: 13px; }
.kv dd.empty { color: var(--text-faint); font-style: italic; }

/* Generic tag/chip */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-dim); font-size: 11px; font-weight: 600;
}
.tag.accent { color: var(--accent); border-color: var(--accent); }
.tag.danger { color: var(--danger); border-color: var(--danger); }
.tag.success { color: var(--success); border-color: var(--success); }

/* Empty state */
.empty-state {
    color: var(--text-faint); padding: 28px; text-align: center;
    border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Table wrapper + base table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--text-dim); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); }

/* Consolidated panel chrome */
.panel-head .panel-close { margin-left: auto; }
body.panel-open { overflow: hidden; }

/* Slide-panel forms (slidepanel_shell) */
.panel-form { display: flex; flex-direction: column; }
.panel-form-head { margin-bottom: 14px; }
.panel-form-head h2 { margin: 0 0 2px; font-size: 18px; }
.panel-form-head .muted { font-size: 13px; }
.panel-form-body .field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.panel-form-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* Toasts */
.toasts {
    position: fixed; right: 16px; bottom: 16px; z-index: 200;
    display: flex; flex-direction: column; gap: 8px;
    max-width: min(380px, calc(100vw - 32px));
}
.msg {
    padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    box-shadow: var(--shadow); cursor: pointer; animation: toast-in 180ms ease;
}
.msg.leaving { opacity: 0; transform: translateY(6px); transition: opacity 200ms ease, transform 200ms ease; }
.msg-success { border-color: var(--success); color: var(--success); background: rgba(94, 226, 160, 0.08); }
.msg-error { border-color: var(--danger); color: var(--danger); background: rgba(255, 107, 107, 0.08); }
.msg-warning { border-color: var(--warning); color: var(--warning); background: rgba(244, 184, 96, 0.08); }
.msg-info { border-color: var(--accent); color: var(--accent); background: rgba(93, 163, 255, 0.08); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Action menu (⋯) */
.action-menu { position: relative; flex: 0 0 auto; }
.action-menu-list {
    position: absolute; right: 0; top: 100%; margin-top: 4px; z-index: 30;
    min-width: 168px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px;
}
.action-menu-item {
    display: block; width: 100%; text-align: left; background: none; border: 0;
    color: var(--text); padding: 7px 10px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px;
}
.action-menu-item:hover { background: var(--surface-3); }
.action-menu-item.danger { color: var(--danger); }
.action-menu-item.danger:hover { background: rgba(255, 107, 107, 0.12); }

/* Confirm dialog */
.confirm-overlay {
    position: fixed; inset: 0; z-index: 300; display: none;
    align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.55);
}
.confirm-overlay.open { display: flex; }
.confirm-box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; width: min(420px, 92vw);
    box-shadow: var(--shadow);
}
.confirm-msg { font-size: 14px; margin-bottom: 18px; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Checkbox rows (e.g. labels in the task form) */
.checkbox-row { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); margin: 0; }
.checkbox-inline input { width: auto; }
input[type="date"] { color-scheme: dark; }

/* Inline "+ Tilføj opgave" quick-add */
.quick-add { padding: 6px 12px; margin: 0; }
.quick-add input { background: transparent; border: 0; padding: 4px 0; font-size: 13px; color: var(--text-dim); }
.quick-add input:focus { color: var(--text); outline: none; }
.task-detail-title:hover { color: var(--accent); }

/* ── Attachments (cards · uploader · lightbox) ─────────────────────────────── */
.att-block { margin-top: 6px; }
.att-head { font-size: 13px; color: var(--text-dim); margin: 0 0 8px; }
.att-list { display: flex; flex-direction: column; gap: 8px; }
.att-empty { font-size: 13px; padding: 6px 2px; }
.att-card {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px;
}
.att-thumb {
    flex: 0 0 auto; width: 46px; height: 46px;
    border-radius: var(--radius-sm); overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    padding: 0; cursor: pointer; color: var(--text-dim);
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-thumb-icon { cursor: default; }
.att-thumb-pdf { color: var(--danger); }
.att-ext { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; }
.att-info { flex: 1; min-width: 0; }
.att-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.att-audio { height: 30px; max-width: 220px; margin-top: 6px; display: block; }
.att-actions { flex: 0 0 auto; display: flex; gap: 4px; align-items: center; }
.att-actions .btn-icon { text-decoration: none; }

.upload-zone {
    margin-top: 10px; border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm); background: var(--surface);
    transition: background 120ms ease, border-color 120ms ease;
}
.upload-zone.dragover { border-color: var(--accent); background: var(--surface-2); }
.upload-zone-inner {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px; cursor: pointer; color: var(--text-dim); font-size: 13px;
}
.upload-zone-inner.disabled { cursor: default; }
.upload-zone-inner .upload-icon { font-size: 16px; }
.upload-zone-inner u { color: var(--accent); }
.upload-progress { height: 4px; background: var(--surface-3); border-radius: 0 0 var(--radius-sm) var(--radius-sm); overflow: hidden; }
.upload-progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 120ms linear; }

.lightbox-overlay {
    position: fixed; inset: 0; z-index: 400; display: none;
    align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.78); padding: 24px;
}
.lightbox-overlay.open { display: flex; }
.lightbox-box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    max-width: 94vw; max-height: 94vh; display: flex; flex-direction: column;
}
.lightbox-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.lightbox-name { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-body { padding: 12px; overflow: auto; display: flex; align-items: center; justify-content: center; }
.lightbox-body img { max-width: 88vw; max-height: 82vh; border-radius: var(--radius-sm); }
.lightbox-body iframe { width: 88vw; height: 82vh; border: 0; background: #fff; border-radius: var(--radius-sm); }
body.lightbox-open { overflow: hidden; }

/* ── Comment actions + inline edit ─────────────────────────────────────────── */
.comment-head-right { display: inline-flex; align-items: center; gap: 6px; }
.comment-action {
    background: transparent; border: 0; color: var(--text-faint);
    cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: var(--radius-sm);
}
.comment-action:hover { background: var(--surface-3); color: var(--text); }
.comment-action.danger:hover { color: var(--danger); }
.comment-edit-area {
    width: 100%; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); padding: 8px; font: inherit; resize: vertical;
}

/* ── People panels (workspace members · project collaborators) ─────────────── */
.people-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.person-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 10px;
}
.person-info { min-width: 0; display: flex; flex-direction: column; }
.person-name { font-size: 13px; color: var(--text); }
.person-email { font-size: 11px; }
.person-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.role-select {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-sm); padding: 4px 6px; font-size: 12px;
}
.people-add { border-top: 1px solid var(--border); padding-top: 14px; }

/* ───────────────────────────────────────────────────────────────────────
   Fase 5 — navigation, søgning, filtre, responsiv drawer, drag-reorder
   ─────────────────────────────────────────────────────────────────────── */

/* Topbar: hamburger + search trigger */
.topbar-left { display: flex; align-items: center; gap: 10px; }
.who { display: flex; align-items: center; gap: 12px; }
.topbar .who a { margin-left: 0; }
.sidebar-toggle {
    display: none; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius-sm); padding: 5px 11px;
    font-size: 16px; line-height: 1; cursor: pointer;
}
.sidebar-toggle:hover { background: var(--surface-3); }
.search-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 5px 10px; border-radius: var(--radius-sm);
    font: inherit; font-size: 12px; color: var(--text-dim); cursor: pointer;
}
.search-trigger:hover { background: var(--surface-3); color: var(--text); border-color: var(--accent); }
.search-trigger kbd {
    background: var(--surface); border: 1px solid var(--border);
    padding: 1px 6px; border-radius: 4px; font-size: 10px;
    font-family: ui-monospace, monospace; color: var(--text-dim);
}

/* Clickable breadcrumbs */
.crumb a { color: var(--text-dim); }
.crumb a:hover { color: var(--accent); }

/* Project-view filter bar */
.filter-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px;
}
.filter-bar form { display: contents; }
.filter-bar .filter-label-text {
    font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em;
}
.filter-bar select {
    width: auto; padding: 5px 8px; font-size: 12px; background: var(--surface-2);
}
.filter-bar .filter-clear {
    background: none; border: 0; color: var(--text-dim); cursor: pointer;
    font-size: 12px; text-decoration: underline; padding: 4px;
}
.filter-bar .filter-clear:hover { color: var(--text); }

/* Drag handles (sections in list view, projects in sidebar) */
.section-drag, .project-drag {
    cursor: grab; color: var(--text-faint); user-select: none; line-height: 1;
}
.section-drag { font-size: 14px; padding: 0 6px 0 0; }
.project-drag { font-size: 11px; padding: 0 2px; opacity: 0; transition: opacity 120ms ease; }
.nav-item:hover .project-drag { opacity: 1; }
.section-drag:hover, .project-drag:hover { color: var(--text); }
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { cursor: grabbing; }

/* Cmd+K search modal */
.search-modal {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
    display: none; z-index: 250; padding-top: 10vh;
    justify-content: center; align-items: flex-start;
}
.search-modal.open { display: flex; }
.search-modal-box {
    width: 640px; max-width: 92vw; max-height: 75vh;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; display: flex; flex-direction: column;
}
.search-input-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.search-input-icon { font-size: 18px; color: var(--text-faint); }
#search-input {
    flex: 1; border: 0; outline: none; background: transparent;
    font-size: 15px; padding: 0; color: var(--text);
}
#search-input:focus { border: 0; outline: none; }
.search-spinner { font-size: 16px; }
.search-kbd, .search-footer kbd {
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 2px 6px; border-radius: 4px; font-size: 10px;
    font-family: ui-monospace, monospace; color: var(--text-faint);
}
#search-results { overflow-y: auto; flex: 1; padding: 6px 0; min-height: 80px; }
.search-meta {
    padding: 8px 16px 2px; font-size: 11px; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.search-group-title {
    font-size: 10px; text-transform: uppercase; color: var(--accent);
    letter-spacing: 0.08em; padding: 10px 16px 4px; font-weight: 700;
}
.search-result {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 16px; text-decoration: none; color: var(--text);
    border-left: 3px solid transparent;
}
.search-result:hover, .search-result:focus,
.search-result:first-of-type {
    background: var(--surface-2); border-left-color: var(--accent); text-decoration: none;
}
.search-icon { font-size: 16px; flex: 0 0 22px; text-align: center; }
.search-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.search-label { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-sub { color: var(--text-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-type-chip {
    font-size: 10px; padding: 2px 8px; border-radius: 999px;
    background: var(--surface-3); color: var(--text-dim); flex: 0 0 auto;
}
.search-empty, .search-hint { padding: 22px 16px; text-align: center; color: var(--text-faint); font-size: 13px; }
.search-footer {
    display: flex; gap: 16px; align-items: center;
    padding: 9px 16px; border-top: 1px solid var(--border);
    font-size: 11px; color: var(--text-faint); background: var(--surface-2);
}
.search-footer .muted { margin-left: auto; }
body.search-open { overflow: hidden; }

/* Drawer + backdrop are inert ≥960px; the backdrop never shows on desktop. */
.sidebar-backdrop { display: none; }

@media (max-width: 959px) {
    .shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
    .sidebar {
        position: fixed; top: 56px; bottom: 0; left: 0; width: 280px; z-index: 60;
        transform: translateX(-100%);
        transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 56px 0 0 0; background: rgba(0, 0, 0, 0.5); z-index: 55; }
    .sidebar-backdrop.open { display: block; }
    .sidebar-toggle { display: inline-flex; align-items: center; }
    .main { padding: 16px; }
    .panel { width: 100vw; border-left: 0; }
    .search-trigger-label { display: none; }
}

@media (max-width: 600px) {
    .who-name { display: none; }
    .search-trigger kbd { display: none; }
    .search-modal-box { width: 96vw; max-height: 86vh; }
    .search-modal { padding-top: 4vh; }
}

/* Error pages (404/403/500) */
.error-card { text-align: center; }
.error-card h1 { font-size: 20px; margin: 0 0 8px; }
.error-card p { margin: 0 0 20px; }
.error-code {
    font-size: 52px; font-weight: 700; line-height: 1;
    color: var(--text-faint); letter-spacing: 1px; margin-bottom: 10px;
}
