@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #0f0f12;
    --bg-elevated: #17171c;
    --bg-card: #1e1e25;
    --border: #2a2a33;
    --text: #e8e8ec;
    --text-dim: #8a8a96;
    --accent: #8b5cf6;
    --accent-dim: #8b5cf62a;
    --accent-hover: #a37cf7;
    --danger: #f26d6d;
    --success: #5ed6a5;
    --warning: #f2b76d;
    --radius: 10px;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
}

a { color: inherit; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
}

.brand .dot {
    width: 10px; height: 10px; border-radius: 3px;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.topbar .board-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-dim);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: #fff;
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
    text-decoration: none;
    display: inline-block;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { border-color: var(--accent); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

.board-wrap {
    display: flex;
    gap: 16px;
    padding: 20px;
    overflow-x: auto;
    align-items: flex-start;
    min-height: calc(100vh - 60px);
}

.list-col {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 280px;
    flex: 0 0 280px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 10px;
}

.list-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.list-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2px 8px;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 2px;
    flex: 1;
}

.card-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: grab;
    transition: border-color .15s ease, transform .1s ease;
}
.card-item:hover { border-color: var(--accent); }
.card-item.sortable-ghost { opacity: .3; }
.card-item.dragging { transform: rotate(1.5deg); }

.card-labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.label-chip {
    height: 6px; width: 28px; border-radius: 3px;
}

.card-title { font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }

.card-meta {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

.card-meta .due.overdue { color: var(--danger); }
.card-meta .due.soon { color: var(--warning); }

.add-card-btn, .add-list-btn {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-dim);
    padding: 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12.5px;
    margin-top: 6px;
    text-align: left;
}
.add-card-btn:hover, .add-list-btn:hover { border-color: var(--accent); color: var(--accent); }

.inline-add-form {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 8px;
    margin-top: 6px;
}
.inline-add-form textarea, .inline-add-form input[type=text] {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 13px;
    resize: none;
}
.inline-add-form textarea:focus, .inline-add-form input[type=text]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}
.inline-add-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.inline-add-actions .btn {
    padding: 6px 12px;
    font-size: 12.5px;
}

.add-list-col {
    flex: 0 0 260px;
    width: 260px;
}

/* Modal carte */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: none; align-items: flex-start; justify-content: center;
    z-index: 100; padding: 40px 20px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 620px;
    padding: 22px;
}
.modal h2 {
    font-size: 17px; margin: 0 0 14px;
    background: transparent; border: none; color: var(--text);
    width: 100%; font-family: var(--font-body); font-weight: 600;
}
.modal .field { margin-bottom: 16px; }
.modal label {
    display: block; font-size: 11.5px; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-dim); margin-bottom: 6px;
    font-family: var(--font-mono);
}
.modal textarea, .modal input[type=text], .modal input[type=datetime-local], .modal select {
    width: 100%; background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); padding: 9px 10px; border-radius: 7px; font-family: var(--font-body);
    font-size: 13.5px;
}
.modal textarea { min-height: 80px; resize: vertical; }

.checklist-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.checklist-item.done { text-decoration: line-through; color: var(--text-dim); }
.checklist-progress {
    height: 5px; background: var(--bg-card); border-radius: 3px; overflow: hidden; margin: 6px 0 10px;
}
.checklist-progress-bar { height: 100%; background: var(--success); }

.comment { border-top: 1px solid var(--border); padding: 10px 0; }
.comment .meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-bottom: 3px; }

.table-users { width: 100%; border-collapse: collapse; }
.table-users th, .table-users td {
    text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.table-users th { color: var(--text-dim); font-family: var(--font-mono); font-weight: 500; font-size: 11.5px; text-transform: uppercase; }

.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; margin-top: 8px; }
.perm-grid label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; text-transform: none; color: var(--text); font-family: var(--font-body); }

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text);
    font-family: var(--font-body);
    margin-bottom: 8px;
    cursor: pointer;
}
.checkbox-inline input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }

/* ---- Checkboxes custom (remplace le rendu natif du navigateur) ---- */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background .15s ease, border-color .15s ease;
    margin: 0;
}
input[type="checkbox"]:hover { border-color: var(--accent); }
input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Upload de fichier custom (remplace le bouton natif "Choisir un fichier") ---- */
.file-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.file-upload-label {
    margin: 0;
    text-transform: none;
    font-size: 13px;
    letter-spacing: normal;
    font-family: var(--font-body);
}
.file-upload-name {
    font-size: 12.5px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.file-upload-input { display: none; }

.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 0%, #201a2e 0%, var(--bg) 60%);
}
.login-box {
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px;
    padding: 36px; width: 100%; max-width: 380px;
}
.login-box h1 { font-size: 18px; margin: 0 0 4px; }
.login-box p.sub { color: var(--text-dim); font-size: 12.5px; margin: 0 0 22px; }
.login-box input {
    width: 100%; background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px;
}
.login-box .btn { width: 100%; padding: 10px; margin-top: 4px; }
.error-msg { background: #f26d6d1f; border: 1px solid #f26d6d55; color: var(--danger); padding: 8px 10px; border-radius: 7px; font-size: 12.5px; margin-bottom: 14px; }

.empty-state { color: var(--text-dim); font-size: 13px; padding: 30px; text-align: center; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
