/* ============================================================
   Desk - Task-Board im rk-commerce.de Design (Dark / Verdant)
   CI: Forest Green + Lime · Font: Inter
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { box-sizing: border-box; }

:root {
    color-scheme: dark;
    --bg: #0a0f0c;
    --bg-2: #0c130e;
    --surface: #111813;
    --surface-2: #141c16;
    --line: rgba(255, 255, 255, .09);
    --line-2: rgba(255, 255, 255, .14);
    --text: #f3f6f1;
    --muted: #99a39a;
    --muted-2: #727c73;
    --lime: #c5f82a;
    --lime-deep: #a6d61f;
    --lime-soft: rgba(197, 248, 42, .12);
    --forest: #1b4332;
    --leaf: #2d6a4f;
    --danger: #f87171;
    --amber: #fbbf24;
    --green: #4ade80;
    --radius: 8px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    padding: 0 16px;
    min-height: 54px;
    flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 22px; min-width: 0; flex: 1; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand-img { height: 20px; width: auto; display: block; }
.brand-desk {
    color: var(--lime);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: 1px solid rgba(197, 248, 42, .35);
    border-radius: 999px;
    padding: 2px 9px;
    background: var(--lime-soft);
}
.project-tabs { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.tab {
    --tab-color: var(--lime);
    color: var(--muted);
    text-decoration: none;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
}
.tab:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.tab.active {
    background: rgba(255, 255, 255, .07);
    color: var(--text);
    font-weight: 600;
    box-shadow: inset 0 -3px 0 var(--tab-color);
}
.tab-add { font-size: 17px; font-weight: 700; color: var(--lime); padding: 4px 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-link { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.topbar-link:hover, .topbar-link.active { color: var(--text); }
.topbar-user { color: var(--muted-2); font-size: 13px; }

/* ---------- Flash ---------- */
.flash {
    background: var(--forest);
    color: #d8f3dc;
    padding: 8px 16px;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid var(--line);
}
.flash-error { background: #3f1d1d; color: #fecaca; }

/* ---------- Board ---------- */
.content { padding: 18px; }
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.board-title {
    --project-color: var(--lime);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.board-title::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--project-color);
    box-shadow: 0 0 10px var(--project-color);
    flex-shrink: 0;
}
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }

.column {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
}
.column-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 12.5px;
    padding: 4px 6px;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.column-offen { color: var(--amber); }
.column-in_bearbeitung { color: var(--lime); }
.column-erledigt { color: var(--green); }
.column-count {
    background: rgba(255, 255, 255, .07);
    border-radius: 999px;
    padding: 1px 9px;
    font-size: 12px;
    color: var(--muted);
}
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.column-body.drag-over { outline: 2px dashed var(--lime); outline-offset: 2px; border-radius: 6px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
}
.card:hover { border-color: rgba(197, 248, 42, .5); transform: translateY(-1px); }
.card.dragging { opacity: .5; }
.card-title { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tag {
    --tag-color: #99a39a;
    background: color-mix(in srgb, var(--tag-color) 16%, var(--surface));
    color: color-mix(in srgb, var(--tag-color) 85%, white);
    border: 1px solid color-mix(in srgb, var(--tag-color) 45%, transparent);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.due { font-variant-numeric: tabular-nums; }
.due-today { color: var(--amber); font-weight: 600; }
.due-overdue { color: var(--danger); font-weight: 600; }
.meta-chip { font-size: 12px; }
.avatars { margin-left: auto; display: inline-flex; flex-shrink: 0; }
.avatars .avatar + .avatar { margin-left: -7px; }
.avatar {
    background: var(--lime);
    border: 2px solid var(--surface);
    color: #0a0f0c;
    border-radius: 999px;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.btn-add-task {
    background: transparent;
    border: 1px dashed var(--line-2);
    color: var(--muted);
    padding: 7px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    font-family: inherit;
}
.btn-add-task:hover { background: var(--lime-soft); color: var(--lime); border-color: rgba(197, 248, 42, .4); }

/* ---------- Buttons / Forms ---------- */
.btn {
    font: inherit;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background .2s, transform .15s;
}
.btn-primary { background: var(--lime); color: #0a0f0c; box-shadow: 0 6px 22px rgba(197, 248, 42, .18); }
.btn-primary:hover { background: #d4ff45; transform: translateY(-1px); }
.btn-ghost { background: rgba(255, 255, 255, .04); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .09); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(248, 113, 113, .35); }
.btn-danger:hover { background: rgba(248, 113, 113, .12); }
.btn-icon { background: transparent; border: none; color: var(--muted-2); cursor: pointer; padding: 4px 6px; border-radius: 4px; }
.btn-icon:hover { background: rgba(248, 113, 113, .15); color: var(--danger); }
.btn-block { width: 100%; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="file"], select, textarea {
    font: inherit;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    background: rgba(255, 255, 255, .04);
    color: var(--text);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(197, 248, 42, .35); border-color: var(--lime-deep); }
select option { background: var(--surface); color: var(--text); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { font-weight: 400; color: var(--text); }
.form-row { display: flex; gap: 12px; align-items: end; }
.form-row > label { flex: 1; }
@media (max-width: 600px) { .form-row { flex-direction: column; align-items: stretch; } }
input[type="color"] { width: 60px; height: 38px; padding: 2px; border: 1px solid var(--line-2); border-radius: 6px; background: rgba(255, 255, 255, .04); }

/* ---------- Dialog ---------- */
.dialog {
    border: 1px solid var(--line-2);
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
    padding: 20px;
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    background: var(--surface);
    color: var(--text);
}
.dialog-small { width: min(380px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .65); }
.dialog h2 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.dialog-form { display: flex; flex-direction: column; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.dialog-actions-split { justify-content: space-between; }
.dialog-actions-split > div { display: flex; gap: 8px; }
.hint { color: var(--muted-2); font-size: 13px; margin: 4px 0; }

.user-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.user-check { flex-direction: row; align-items: center; cursor: pointer; font-weight: 400; }
.user-check input { display: none; }
.user-pill {
    border: 1px solid var(--line-2);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    color: var(--muted);
    transition: color .15s, background .15s, border-color .15s;
}
.user-check input:checked + .user-pill {
    background: var(--lime-soft);
    color: var(--lime);
    border-color: rgba(197, 248, 42, .45);
    font-weight: 600;
}

.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag-check { flex-direction: row; align-items: center; gap: 4px; cursor: pointer; font-weight: 400; }
.tag-check input { display: none; }
.tag-check .tag { opacity: .4; }
.tag-check input:checked + .tag { opacity: 1; outline: 2px solid var(--tag-color); }

/* ---------- Anhänge ---------- */
.attachments { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.attachments h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.attachment-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.attachment-link { color: var(--lime); text-decoration: none; font-size: 14px; word-break: break-all; }
.attachment-link:hover { text-decoration: underline; }
.attachment-path { color: var(--text); cursor: copy; }
.attachment-add { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Verlauf ---------- */
.history { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.history h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.history-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.history-list li { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.history-time { color: var(--muted-2); font-variant-numeric: tabular-nums; margin-right: 6px; }
.history-user { color: var(--lime); font-weight: 600; margin-right: 6px; }
.history-text { color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap { display: flex; justify-content: center; padding: 10vh 16px; }
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 32px;
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-logo { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-logo img { height: 24px; width: auto; }
.login-sub { margin: -4px 0 8px; text-align: center; color: var(--muted-2); font-size: 14px; }

/* ---------- Tabellen / Seiten ---------- */
.page-narrow { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-narrow h1, .page-narrow h2 { font-weight: 700; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.table tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.stack-form { background: var(--surface); border: 1px solid var(--line); padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.stack-form .form-row { width: 100%; }
.project-delete { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }

.empty-state { text-align: center; padding: 12vh 16px; color: var(--muted); }
.empty-state h1 { color: var(--text); }
