:root {
    color-scheme: light;
    --bg: #f7f7f8;
    --panel: #ffffff;
    --panel-2: #f1f2f4;
    --text: #202124;
    --muted: #6b7280;
    --line: #e2e5ea;
    --accent: #52525b;
    --accent-2: #2f80ed;
    --danger: #d94a4a;
    --shadow: 0 18px 50px rgba(30, 26, 18, .12);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #151515;
    --panel: #1f1f1d;
    --panel-2: #2a2926;
    --text: #f4f1e8;
    --muted: #a6a197;
    --line: #34332f;
    --accent: #d4d4d8;
    --accent-2: #64a9ff;
    --danger: #ff6b6b;
    --shadow: 0 20px 60px rgba(0, 0, 0, .38);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

body.resizing-columns {
    cursor: col-resize;
    user-select: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.app {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-right: 1px solid var(--line);
    background: var(--panel);
    padding: 18px;
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-head span,
.muted {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.brand-mark,
.project-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--project, var(--panel-2));
    color: #fff;
    font-weight: 800;
}

.brand-mark {
    --project: #52525b;
}

.project-new,
.add-row,
.button,
.icon-button,
.tab {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.project-new:hover,
.add-row:hover,
.button:hover,
.icon-button:hover,
.tab:hover {
    border-color: var(--accent);
}

.project-new {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    color: var(--muted);
}

.project-new i {
    color: var(--accent-2);
}

.project-list {
    display: grid;
    gap: 6px;
    overflow: auto;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
}

.project-item.active,
.project-item:hover {
    background: var(--panel-2);
    color: var(--text);
}

.project-dot {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 7px;
    background: var(--project, #52525b);
    color: #fff;
    font-size: 12px;
}

.sidebar-foot {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
}

.workspace {
    min-width: 0;
    padding: 22px 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 68px;
}

.project-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    overflow-wrap: anywhere;
    font-size: 28px;
    line-height: 1.15;
}

h2 {
    font-size: 20px;
}

.project-title p {
    margin-top: 6px;
    color: var(--muted);
}

.topbar-actions,
.view-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--muted);
    padding: 0 10px;
    font-weight: 700;
    cursor: pointer;
}

.project-toggle input {
    accent-color: var(--accent-2);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    font-weight: 700;
}

.button.primary {
    border-color: var(--accent-2);
    background: var(--accent-2);
    color: #fff;
}

.button.ghost {
    background: var(--panel-2);
}

.button.danger {
    color: var(--danger);
}

.view-tabs {
    margin: 18px 0 8px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 12px;
    color: var(--muted);
}

.tab.active {
    background: var(--panel-2);
    color: var(--text);
    font-weight: 700;
}

.table-wrap {
    overflow-x: auto;
    border-top: 1px solid var(--line);
}

.task-table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
    table-layout: fixed;
    border: 1px solid var(--line);
}

.col-drag {
    width: 34px;
}

.col-title {
    width: 62%;
}

.col-capture {
    width: 130px;
}

.col-status,
.col-responsive {
    width: 150px;
}

.col-type {
    width: 220px;
}

.col-due {
    width: 150px;
}

.col-open {
    width: 48px;
}

th,
td {
    border: 1px solid var(--line);
    padding: 7px 8px;
    text-align: left;
    vertical-align: middle;
}

th {
    position: relative;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    height: 32px;
    white-space: nowrap;
}

.col-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    z-index: 2;
    width: 8px;
    height: 100%;
    border-radius: 0;
    cursor: col-resize;
}

.col-resizer:hover,
body.resizing-columns .col-resizer {
    background: var(--accent-2);
}

.hide-due-date .col-due,
.hide-due-date .task-table th:nth-child(7),
.hide-due-date .task-table td:nth-child(7) {
    display: none;
}

.drag-cell {
    text-align: center;
}

.drag-handle {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    letter-spacing: -1px;
}

.drag-handle:hover {
    background: var(--panel-2);
    color: var(--text);
}

tr.dragging {
    opacity: .52;
}

tr.dragging td {
    border-bottom-color: var(--accent-2);
}

.task-title-input,
.drawer-title,
.drawer textarea,
.drawer input,
.drawer select,
.modal input {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    outline: none;
}

.task-title-input {
    min-height: 30px;
    padding: 4px 6px;
    font-weight: 700;
}

.cell-editor {
    min-height: 30px;
    width: 100%;
    outline: none;
    padding: 4px 6px;
    border: 1px solid transparent;
}

.task-title-editor {
    font-weight: 750;
}

.cell-editor:focus {
    border-color: var(--accent-2);
    background: var(--panel-2);
}

.task-description-preview {
    overflow: hidden;
    max-width: 100%;
    margin: 0 6px 2px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.task-title-input:focus,
.drawer textarea:focus,
.drawer input:focus,
.drawer select:focus,
.modal input:focus {
    border-color: var(--accent-2);
    background: var(--panel);
}

.select-lite {
    width: 100%;
    min-width: 0;
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    padding: 0 8px;
}

.date-cell-input {
    width: 100%;
    min-height: 30px;
    border: 0;
    background: transparent;
    color: var(--text);
    outline: none;
    padding: 0 6px;
}

.date-cell-input:focus {
    background: var(--panel-2);
    box-shadow: inset 0 0 0 1px var(--accent-2);
}

.property-cell {
    display: flex;
    align-items: center;
    min-height: 30px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    padding: 3px 4px;
}

.property-cell:hover,
.property-cell:focus {
    background: var(--panel-2);
    outline: 1px solid var(--accent-2);
    outline-offset: -1px;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill-list.compact {
    gap: 4px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 220px;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 5px;
    background: var(--pill, #6b7280);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.pill.mini {
    max-width: 100%;
    min-height: 22px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

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

.capture-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 48px;
}

.capture-drop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 102px;
    height: 30px;
    border: 1px dashed var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.capture-drop.active,
.capture-drop:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
}

.thumb {
    width: 48px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    object-fit: cover;
}

.add-row {
    width: 100%;
    min-height: 38px;
    margin-top: -1px;
    border-radius: 0;
    color: var(--muted);
    text-align: left;
    padding: 0 10px;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 21;
    width: min(520px, 100vw);
    height: 100vh;
    border-left: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    transform: translateX(100%);
    transition: transform .2s ease;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: rgba(0, 0, 0, .22);
}

.drawer-backdrop.open {
    display: block;
}

.drawer-head {
    display: flex;
    justify-content: flex-end;
    padding: 14px;
}

.drawer-body {
    display: grid;
    gap: 14px;
    padding: 0 22px 28px;
}

.drawer-title {
    min-height: 46px;
    padding: 7px 10px;
    background: var(--panel-2);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
}

.drawer-summary {
    min-height: 92px;
    resize: vertical;
    padding: 10px;
    background: var(--panel-2);
    line-height: 1.45;
}

.field-grid {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 6px;
}

.field label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.drawer textarea {
    min-height: 92px;
    resize: vertical;
    padding: 10px;
    background: var(--panel-2);
}

.drawer input,
.drawer select {
    min-height: 38px;
    padding: 0 10px;
    background: var(--panel-2);
}

.drawer-captures {
    display: grid;
    gap: 10px;
}

.drawer-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    max-width: 100%;
    border: 1px solid color-mix(in srgb, var(--pill, #6b7280) 45%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--pill, #6b7280) 22%, var(--panel-2));
    color: var(--text);
    cursor: pointer;
    padding: 0 11px;
    font-weight: 750;
}

.choice-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-pill span {
    overflow: hidden;
    max-width: 190px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.choice-pill:has(input:checked) {
    border-color: var(--pill, #6b7280);
    background: var(--pill, #6b7280);
    color: #fff;
}

.choice-pill:has(input:checked)::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 50%;
    background: currentColor;
}

.capture-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    place-items: center;
    min-height: 120px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: var(--panel-2);
    cursor: pointer;
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.attachment {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.attachment img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.attachment button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    cursor: pointer;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .42);
}

.modal.hidden,
.hidden {
    display: none !important;
}

.modal-panel {
    width: min(980px, 100%);
    max-height: min(760px, 92vh);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 18px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.properties-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.project-panel {
    width: min(620px, 100%);
}

.project-editor {
    display: grid;
    gap: 14px;
}

.project-editor .field span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.project-editor input,
.project-editor textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    outline: none;
    padding: 10px;
}

.project-editor textarea {
    min-height: 90px;
    resize: vertical;
}

.icon-picker,
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-picker button,
.color-picker button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
}

.icon-picker button.active,
.icon-picker button:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
}

.color-picker button {
    background: var(--swatch);
}

.color-picker button.active {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

.property-group {
    display: grid;
    align-content: start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.option-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
}

.option-row input[type="color"] {
    width: 38px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.option-row input[type="text"] {
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
}

.board {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 14px;
    align-items: start;
}

.board-column {
    min-height: 240px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 10px;
}

.board-column h3 {
    margin: 0 0 10px;
    font-size: 14px;
}

.board-card {
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    padding: 10px;
    cursor: pointer;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 50;
    max-width: min(420px, calc(100vw - 30px));
    transform: translate(-50%, 16px);
    opacity: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow);
    padding: 10px 12px;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.row-menu {
    position: fixed;
    z-index: 60;
    min-width: 190px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 6px;
}

.row-menu button {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--danger);
    text-align: left;
    cursor: pointer;
    padding: 0 10px;
    font-weight: 750;
}

.row-menu button:hover {
    background: rgba(217, 74, 74, .12);
}

.property-popover {
    position: fixed;
    z-index: 80;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    color: var(--text);
    padding: 0;
}

.property-popover-head {
    display: grid;
    gap: 3px;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
}

.property-popover-head span {
    color: var(--muted);
    font-size: 12px;
}

.selected-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 38px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 7px 12px;
}

.property-search {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    padding: 8px 12px;
}

.property-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    outline: none;
}

.option-list {
    display: grid;
    max-height: 260px;
    overflow: auto;
    padding: 6px;
}

.option-item,
.option-create {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    padding: 0 8px;
}

.option-item:hover,
.option-item.selected,
.option-create:hover {
    background: var(--panel-2);
}

.option-item > i,
.option-create > i {
    color: var(--muted);
}

.option-create {
    width: calc(100% - 12px);
    margin: 0 6px 6px;
    border-top: 1px solid var(--line);
    color: var(--accent-2);
    font-weight: 750;
}

.auth-page,
.setup-page {
    display: grid;
    place-items: center;
    padding: 22px;
}

.auth-shell,
.setup-card {
    width: min(430px, 100%);
}

.auth-panel,
.setup-card {
    display: grid;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 24px;
}

.auth-form {
    display: grid;
    gap: 12px;
}

.auth-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

.auth-form input {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    padding: 0 12px;
}

.alert {
    border: 1px solid rgba(217, 74, 74, .4);
    border-radius: 8px;
    background: rgba(217, 74, 74, .12);
    color: var(--danger);
    padding: 10px 12px;
}

.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        z-index: 25;
        transform: translateX(-100%);
        transition: transform .2s ease;
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .workspace {
        padding: 12px;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        min-height: auto;
    }

    .project-title {
        align-items: flex-start;
    }

    h1 {
        font-size: 22px;
    }

    .topbar-actions,
    .view-tabs {
        width: 100%;
        overflow-x: visible;
        padding-bottom: 2px;
    }

    .topbar-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .view-tabs {
        flex-wrap: wrap;
    }

    .topbar-actions .button,
    .project-toggle {
        width: 100%;
        min-width: 0;
    }

    .view-tabs .tab {
        flex: 1 1 150px;
    }

    .mobile-only {
        display: grid;
    }

    .properties-grid,
    .board {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        overflow: visible;
        border-top: 0;
    }

    .task-table,
    .task-table tbody,
    .task-table tr,
    .task-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .task-table {
        table-layout: auto;
    }

    .task-table thead,
    .task-table colgroup {
        display: none;
    }

    .task-table tr {
        margin-bottom: 10px;
        border: 1px solid var(--line);
        border-radius: 0;
        background: var(--panel);
        overflow: hidden;
    }

    .task-table td {
        display: grid;
        grid-template-columns: minmax(92px, 32%) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        min-height: 42px;
        border: 1px solid var(--line);
        padding: 9px 10px;
    }

    .task-table td:last-child {
        border-bottom: 1px solid var(--line);
    }

    .task-table td::before {
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
    }

    .task-table td:nth-child(1)::before {
        content: "Ordre";
    }

    .task-table td:nth-child(2)::before {
        content: "Tache";
    }

    .task-table td:nth-child(3)::before {
        content: "Capture";
    }

    .task-table td:nth-child(4)::before {
        content: "Etat";
    }

    .task-table td:nth-child(5)::before {
        content: "Responsive";
    }

    .task-table td:nth-child(6)::before {
        content: "Type";
    }

    .task-table td:nth-child(7)::before {
        content: "Echeance";
    }

    .task-table td:nth-child(8)::before {
        content: "Details";
    }

    .hide-due-date .task-table td:nth-child(7) {
        display: none;
    }

    .drag-cell {
        text-align: left;
    }

    .select-lite,
    .task-title-input,
    .cell-editor,
    .property-cell,
    .date-cell-input {
        min-width: 0;
        width: 100%;
    }

    .property-popover {
        left: 10px !important;
        right: 10px;
        width: auto !important;
        max-width: none;
    }

    .capture-cell,
    .pill-list {
        min-width: 0;
    }

    .drawer {
        width: 100vw;
        border-left: 0;
    }

    .drawer-body {
        padding: 0 14px 22px;
    }

    .drawer-title {
        font-size: 20px;
    }

    .modal {
        padding: 10px;
    }

    .modal-panel {
        max-height: 94vh;
        padding: 14px;
    }
}
