/* Tasq — feuille de styles */
:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-soft: #64748b;
    --text-faint: #94a3b8;
    --primary: #4f46e5;
    --primary-soft: #eef2ff;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warn: #d97706;
    --ok: #16a34a;
    --ok-soft: #f0fdf4;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.18);
    --shadow-sm: 0 1px 2px rgba(15,23,42,.08);
    --sidebar: 256px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* ---------- AUTH (login / setup) ---------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, #312e81, #0f172a);
}
.auth-card {
    background: var(--surface);
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);
}
.auth-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 26px; font-weight: 800; letter-spacing: -.5px;
    margin-bottom: 6px;
}
.auth-logo .mark {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; display: grid; place-items: center; font-size: 20px;
}
.auth-sub { color: var(--text-soft); margin: 0 0 24px; font-size: 14px; }

/* ---------- FORM ELEMENTS ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-soft); }
.input, .select, .textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.textarea { resize: vertical; min-height: 80px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-weight: 600; font-size: 14px; transition: .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-danger { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.err {
    background: var(--danger-soft); color: var(--danger);
    border: 1px solid #fecaca; padding: 9px 12px; border-radius: var(--radius-sm);
    font-size: 13.5px; margin-bottom: 14px;
}

/* ---------- LAYOUT ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar); flex-shrink: 0;
    background: #0f172a; color: #cbd5e1;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 16px; font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -.4px;
}
.sidebar .brand .mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: grid; place-items: center; font-size: 17px;
}
.nav { padding: 8px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #64748b; padding: 14px 12px 6px; font-weight: 700; }
.nav-item {
    display: flex; align-items: center; gap: 11px; width: 100%;
    padding: 9px 12px; border-radius: 9px; border: none; background: transparent;
    color: #cbd5e1; font-size: 14.5px; font-weight: 500; text-align: left; transition: .12s;
}
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; flex-shrink: 0; }
.nav-item .count {
    margin-left: auto; font-size: 12px; background: rgba(255,255,255,.12);
    padding: 1px 8px; border-radius: 20px; font-weight: 600;
}
.nav-item .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sidebar-foot { padding: 14px; border-top: 1px solid #1e293b; font-size: 13px; }
.sidebar-foot .who { color: #94a3b8; margin-bottom: 8px; display:flex; align-items:center; gap:8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.3px; }
.topbar .spacer { flex: 1; }
.search { position: relative; }
.search input { width: 280px; padding-left: 34px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.content { padding: 24px 28px 64px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------- STAT CARDS ---------- */
.stats { 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-sm);
}
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.stat .k { font-size: 13px; color: var(--text-soft); margin-top: 6px; }
.stat.alert .v { color: var(--danger); }

/* ---------- FILTER BAR ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    padding: 6px 13px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-soft);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }

/* ---------- TASK TABLE ---------- */
.table-wrap {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow-x: auto;
}
.task-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.task-table thead th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-faint); font-weight: 700; padding: 12px 14px; white-space: nowrap;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.task-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.task-table tbody tr:last-child td { border-bottom: none; }
.trow { cursor: pointer; transition: background .12s; }
.trow:hover { background: var(--surface-2); }
.col-date { white-space: nowrap; width: 1%; }
.col-date .d-date { display: block; font-weight: 600; }
.col-date .d-time { display: block; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.col-task { min-width: 220px; }
.col-task .t-title { font-weight: 600; word-break: break-word; }
.col-task .t-notes { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.col-dur { white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-act { white-space: nowrap; width: 1%; text-align: right; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-weight: 600; font-size: 12px; }
.tag .dot { width: 8px; height: 8px; border-radius: 50%; }
.tag-client { background: var(--surface-2); border: 1px solid var(--border); }
.tag-project { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); }
.tag-type { background: #f5f3ff; border: 1px solid #ddd6fe; color: #6d28d9; }
.tag-soft { background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; }
.tag-dur { background: #ecfeff; border: 1px solid #cffafe; color: #0e7490; }
.tag-date { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-faint); }
.icon-btn {
    width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent;
    color: var(--text-faint); display: grid; place-items: center; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.del:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- LIST (clients / projets) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.entity {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px;
}
.entity.arch { opacity: .6; }
.entity .head { display: flex; align-items: center; gap: 10px; }
.entity .swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.entity .nm { font-weight: 700; font-size: 16px; flex: 1; }
.entity .sub { color: var(--text-soft); font-size: 13px; }
.entity .foot { display: flex; gap: 6px; margin-top: 10px; }

/* ---------- EMPTY ---------- */
.empty { text-align: center; padding: 64px 20px; color: var(--text-soft); }
.empty .big { font-size: 44px; margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; color: var(--text); }

/* ---------- MODAL ---------- */
.modal-bg {
    position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px);
    display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
    background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px;
    box-shadow: 0 30px 60px -15px rgba(0,0,0,.4); max-height: 92vh; overflow-y: auto;
    animation: pop .15s;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 20px 22px 0; }
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 22px 22px; }

/* ---------- MISC ---------- */
.section-head { display: flex; align-items: center; margin-bottom: 16px; }
.section-head .spacer { flex: 1; }
.muted { color: var(--text-soft); }
.hint { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }
.toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: #fff; padding: 11px 18px; border-radius: 10px;
    font-size: 14px; font-weight: 500; box-shadow: var(--shadow); z-index: 200; animation: pop .15s;
}
.toast.err { background: var(--danger); }
.menu-toggle { display: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 820px) {
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
        transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.4);
    }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: grid; }
    .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
    .search input { width: 150px; }
    .content { padding: 18px 16px 64px; }
    .topbar { padding: 14px 16px; }
}
