:root {
    --bg-app: #f6f7fb;
    --bg-app-grad: radial-gradient(1200px 600px at 10% -10%, rgba(99,102,241,0.10), transparent 60%),
                   radial-gradient(900px 500px at 100% 0%, rgba(139,92,246,0.08), transparent 55%);
    --bg-sidebar: #0b1020;
    --bg-sidebar-2: #0f162f;
    --bg-sidebar-hover: rgba(255,255,255,0.06);
    --bg-card: #ffffff;
    --border: #e6e8ef;
    --border-strong: #d9dce6;
    --text: #0b1020;
    --text-muted: #6b7280;
    --text-subtle: #9aa3b2;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-hover: #4f46e5;
    --accent-soft: rgba(99,102,241,0.12);
    --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --danger: #ef4444;
    --success: #10b981;
    --warn: #f59e0b;
    --col-todo: #94a3b8;
    --col-progress: #6366f1;
    --col-done: #10b981;
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.04);
    --shadow: 0 4px 10px -2px rgba(15,23,42,0.06), 0 10px 24px -6px rgba(15,23,42,0.08);
    --shadow-lg: 0 20px 40px -12px rgba(15,23,42,0.18), 0 8px 16px -8px rgba(15,23,42,0.10);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --ring: 0 0 0 3px rgba(99,102,241,0.18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-feature-settings: "cv11", "ss01";
    background: var(--bg-app);
    background-image: var(--bg-app-grad);
    background-attachment: fixed;
    color: var(--text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5 { letter-spacing: -0.02em; }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-soft); color: var(--text); }

/* ===================== BUTTONS ===================== */
.btn {
    border-radius: 10px;
    font-weight: 500;
    padding: 0.5rem 0.95rem;
    transition: transform .08s ease, box-shadow .15s ease, background-color .15s, border-color .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-sm { border-radius: 8px; padding: 0.3rem 0.65rem; }

.btn-primary {
    background: var(--accent-grad);
    border-color: transparent;
    box-shadow: 0 6px 16px -6px rgba(99,102,241,0.55);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--accent-grad);
    filter: brightness(1.05);
    border-color: transparent;
    box-shadow: 0 10px 22px -8px rgba(99,102,241,0.65);
}
.btn-primary:focus-visible { outline: none; box-shadow: var(--ring), 0 6px 16px -6px rgba(99,102,241,0.55); }

.btn-outline-primary { border-color: var(--border-strong); color: var(--accent); background: white; }
.btn-outline-primary:hover { background: var(--accent-soft); color: var(--accent-hover); border-color: transparent; }

.btn-outline-secondary { border-color: var(--border-strong); color: var(--text); background: white; }
.btn-outline-secondary:hover { background: #f3f4f8; color: var(--text); border-color: var(--border-strong); }

.btn-outline-danger { border-color: var(--border-strong); color: var(--danger); background: white; }
.btn-outline-danger:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

.btn-light { background: white; border-color: var(--border); }
.btn-light:hover { background: #f3f4f8; }

/* ===================== FORMS ===================== */
.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--border-strong);
    padding: 0.55rem 0.85rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.form-label { font-weight: 500; font-size: 0.875rem; color: var(--text); margin-bottom: 0.35rem; }

/* ===================== AUTH ===================== */
.auth-body {
    background: #0b1020;
    background-image:
        radial-gradient(900px 600px at 15% 10%, rgba(99,102,241,0.45), transparent 60%),
        radial-gradient(900px 600px at 85% 90%, rgba(139,92,246,0.45), transparent 60%),
        radial-gradient(600px 400px at 50% 50%, rgba(236,72,153,0.18), transparent 70%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
}
.auth-body::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
    pointer-events: none;
}
.auth-shell {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    max-width: 1000px;
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
}
.auth-brand {
    background: linear-gradient(145deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    color: white;
    padding: 3.25rem 2.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}
.auth-brand::after {
    content: "";
    position: absolute;
    right: -80px; top: -80px;
    width: 260px; height: 260px;
    background: radial-gradient(closest-side, rgba(139,92,246,0.55), transparent 70%);
    filter: blur(10px);
}
.brand-link {
    color: white !important;
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
    position: relative;
}
.brand-link i {
    font-size: 1.75rem;
    background: var(--accent-grad);
    width: 44px; height: 44px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: 12px;
    box-shadow: 0 10px 24px -8px rgba(99,102,241,0.6);
}
.auth-brand .tagline {
    color: rgba(255,255,255,0.75);
    font-size: 1rem;
    margin: 0;
    position: relative;
}
.auth-panel { padding: 3.25rem 2.75rem; display: flex; align-items: center; background: white; }
.auth-card { width: 100%; }
.auth-card h2 { font-weight: 700; letter-spacing: -0.03em; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-subtle);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.25rem 0;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-external {
    background: white;
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    transition: background .12s, border-color .12s, box-shadow .15s, transform .08s;
}
.btn-external + .btn-external { margin-top: 0.5rem; }
.btn-external:hover {
    background: #f8f9fc;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}
.btn-external:active { transform: translateY(1px); }
.provider-icon { width: 18px; height: 18px; }

@media (max-width: 768px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { padding: 2rem; }
    .auth-panel { padding: 2rem; }
}

/* ===================== APP SHELL ===================== */
.app-shell {
    display: grid;
    grid-template-columns: 272px 1fr;
    min-height: 100vh;
}

.app-sidebar {
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, var(--bg-sidebar-2) 100%);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.9rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: white;
    padding: 0.35rem 0.6rem 0.85rem;
}
.sidebar-brand i {
    color: white;
    font-size: 1.2rem;
    width: 36px; height: 36px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--accent-grad);
    box-shadow: 0 8px 20px -8px rgba(99,102,241,0.7);
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    color: #c7cbd6 !important;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background-color .15s, color .15s, transform .05s;
    text-decoration: none;
    position: relative;
}
.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: white !important;
}
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(139,92,246,0.18));
    color: white !important;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: -0.9rem;
    top: 10%; bottom: 10%;
    width: 3px;
    background: var(--accent-grad);
    border-radius: 0 3px 3px 0;
}
.sidebar-link i { width: 18px; font-size: 1rem; opacity: 0.9; flex-shrink: 0; }
.sidebar-link .sidebar-project-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sidebar-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    padding: 0.75rem 0.85rem 0.3rem;
    margin-top: 0.25rem;
    font-weight: 600;
}
.sidebar-add {
    color: #cbd5e1 !important;
    width: 22px; height: 22px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.sidebar-add:hover { background: var(--bg-sidebar-hover); color: white !important; }

.sidebar-projects {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow-y: auto;
    max-height: 50vh;
}
.sidebar-projects::-webkit-scrollbar { width: 6px; }
.sidebar-projects::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 999px; }

.sidebar-empty {
    font-size: 0.8rem;
    color: var(--text-subtle);
    padding: 0.25rem 0.85rem;
    margin: 0;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 0.9rem;
    margin-top: 0.25rem;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.3rem;
}
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent-grad);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
    box-shadow: 0 8px 18px -6px rgba(99,102,241,0.55);
}
.user-meta { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.user-meta .name { color: white; font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .email { color: var(--text-subtle); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer .btn-outline-light {
    border-color: rgba(255,255,255,0.12);
    color: #e2e8f0;
    font-weight: 500;
}
.sidebar-footer .btn-outline-light:hover {
    background: rgba(255,255,255,0.06);
    color: white;
    border-color: rgba(255,255,255,0.18);
}

/* ===================== MAIN ===================== */
.app-main { display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
    background: rgba(255,255,255,0.75);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    padding: 0.95rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.toast-pill {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.825rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 6px 16px -8px rgba(16,185,129,0.45);
}

.app-content { padding: 1.75rem; flex: 1; }

/* ===================== CARDS & LISTS ===================== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
    gap: 1rem;
}
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.25rem 1rem;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}
.project-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--accent-grad);
    opacity: 0;
    transition: opacity .2s ease;
}
.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}
.project-card:hover::before { opacity: 1; }
.project-card h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1.05rem;
}
.project-card h5 a { color: var(--text) !important; }
.project-card h5 a:hover { color: var(--accent) !important; }
.project-card .desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    min-height: 2.6em;
}
.project-card .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
}
.project-card .actions { display: flex; gap: 0.25rem; }

.empty-state {
    text-align: center;
    padding: 5rem 1rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3rem;
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 88px; height: 88px;
    border-radius: 24px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 1.25rem;
}

/* ===================== KANBAN BOARD ===================== */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.board-header h2 { margin: 0; font-weight: 800; letter-spacing: -0.03em; }
.board-header .desc { color: var(--text-muted); font-size: 0.925rem; margin: 0.3rem 0 0; }

.board-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(288px, 1fr);
    gap: 1rem;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
@media (max-width: 900px) {
    .kanban-board {
        grid-auto-flow: row;
        grid-auto-columns: unset;
        grid-template-columns: 1fr !important;
    }
}

.kanban-column {
    background: rgba(241,243,249,0.75);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
}
.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.15rem 0.35rem 0.8rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}
.col-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
}
.col-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }
.col-dot.todo { background: var(--col-todo); }
.col-dot.progress { background: var(--col-progress); }
.col-dot.done { background: var(--col-done); }

.col-count {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.col-actions {
    display: flex;
    gap: 0.15rem;
    opacity: 0;
    transition: opacity .15s;
}
.kanban-column:hover .col-actions { opacity: 1; }
.col-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-subtle);
    width: 26px; height: 26px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background .12s, color .12s;
}
.col-icon-btn:hover { background: white; color: var(--text); }
.col-icon-btn.delete-column:hover { color: var(--danger); }

.add-column-btn {
    background: rgba(255,255,255,0.6);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.add-column-btn:hover {
    background: white;
    color: var(--accent);
    border-color: var(--accent);
    border-style: solid;
    transform: translateY(-1px);
}
.add-column-btn i { font-size: 1.3rem; }

.color-swatches {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.color-swatches .swatch {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform .1s, border-color .15s, box-shadow .15s;
}
.color-swatches .swatch:hover { transform: scale(1.1); }
.color-swatches .swatch.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--text), 0 6px 14px -4px rgba(15,23,42,0.25);
}

.kanban-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 80px;
    padding: 0.1rem;
    transition: background-color .15s, outline-color .15s;
    border-radius: 10px;
}
.kanban-list.drag-over {
    background-color: var(--accent-soft);
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border-left: 3px solid transparent;
    position: relative;
    transition: box-shadow .15s, transform .1s, border-color .15s;
    overflow: hidden;
}
.task-card.has-cover { padding-top: 0.55rem; }
.task-cover {
    margin: -0.8rem -0.9rem 0.55rem;
    margin-left: calc(-0.9rem + 3px);
    height: 148px;
    background-size: cover;
    background-position: center;
    background-color: #eef1f6;
}
.task-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.task-card.dragging { opacity: 0.5; cursor: grabbing; transform: rotate(1.5deg); }
.task-card.prio-low      { border-left-color: #94a3b8; }
.task-card.prio-medium   { border-left-color: #3b82f6; }
.task-card.prio-high     { border-left-color: #f59e0b; }
.task-card.prio-critical { border-left-color: var(--danger); }

.task-title { font-weight: 600; font-size: 0.925rem; margin: 0; color: var(--text); line-height: 1.35; }
.task-desc { color: var(--text-muted); font-size: 0.8rem; margin: 0; line-height: 1.45; }

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.prio-pill {
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.prio-pill.low      { background: #eef1f6; color: #475569; }
.prio-pill.medium   { background: #dbeafe; color: #1d4ed8; }
.prio-pill.high     { background: #fef3c7; color: #92400e; }
.prio-pill.critical { background: #fee2e2; color: #991b1b; }

.task-actions {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    gap: 0.15rem;
}
.task-card:hover .task-actions { display: flex; }
.task-actions button {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 26px; height: 26px;
    border-radius: 7px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
}
.task-actions button:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.add-card-btn {
    background: transparent;
    border: 1.5px dashed var(--border-strong);
    color: var(--text-muted);
    padding: 0.55rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background .15s, color .15s, border-color .15s;
}
.add-card-btn:hover { background: white; color: var(--accent); border-color: var(--accent); border-style: solid; }

/* ===================== TAGS ===================== */
.task-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.1rem;
}
.task-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 1px rgba(0,0,0,0.15);
    letter-spacing: 0.02em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.25rem 0;
}
.tag-picker-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.25rem 0;
}
.tag-chip {
    --tag-color: #6366f1;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, box-shadow .12s;
    user-select: none;
}
.tag-chip input[type="checkbox"] { display: none; }
.tag-chip .tag-chip-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--tag-color);
}
.tag-chip:hover { border-color: var(--tag-color); }
.tag-chip.selected {
    background: var(--tag-color);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--tag-color) 60%, transparent);
}
.tag-chip.selected .tag-chip-dot { background: rgba(255,255,255,0.8); }

.new-tag-form {
    margin-top: 0.75rem;
    padding: 0.85rem;
    background: #f8f9fc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ===================== ATTACHMENTS ===================== */
.modal-attachments {
    border-top: 1px solid var(--border);
    padding: 1.25rem;
    background: white;
}
.attachments-heading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}
.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 320px;
    overflow-y: auto;
}
.attachment-item {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 0.8rem;
    padding: 0.6rem;
    background: #fafbfd;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .15s;
}
.attachment-item.is-cover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.attachment-thumb {
    display: block;
    height: 72px;
    border-radius: 8px;
    background: #eef1f6 center/cover no-repeat;
    text-decoration: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    overflow: hidden;
}
.attachment-thumb.file { background: #f1f5f9; }
.attachment-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.15rem;
}
.attachment-name {
    font-weight: 600;
    color: var(--text) !important;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.attachment-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}
.att-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 7px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.att-action:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.att-action.danger:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

/* ===================== COMMENTS ===================== */
.modal-comments {
    border-top: 1px solid var(--border);
    padding: 1.25rem 1.25rem 1.5rem;
    background: #fafbfd;
}
.comments-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.comments-count {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
}
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.25rem;
    margin-bottom: 1rem;
}
.comment-item {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
}
.comment-item .avatar {
    width: 32px; height: 32px;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.comment-body {
    flex: 1;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
}
.comment-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}
.comment-author { font-weight: 600; color: var(--text); }
.comment-time { font-size: 0.72rem; }
.comment-delete {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-subtle);
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}
.comment-delete:hover { background: #fee2e2; color: var(--danger); }
.comment-body p { margin: 0; font-size: 0.9rem; line-height: 1.45; white-space: pre-wrap; }

.comment-composer textarea {
    border-radius: 10px;
    resize: vertical;
}

/* ===================== QUILL ===================== */
.quill-wrap .ql-toolbar {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-color: var(--border-strong);
    background: #fafbfd;
}
.quill-wrap .ql-container {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    border-color: var(--border-strong);
    font-family: inherit;
    font-size: 0.95rem;
    min-height: 140px;
}
.quill-wrap .ql-editor { min-height: 140px; }

/* ===================== NOTIFICATIONS ===================== */
.notifications-wrap { position: relative; }
.notif-btn {
    position: relative;
    background: white;
    border: 1px solid var(--border);
    width: 38px; height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.notif-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px white;
}
.notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 360px;
    max-width: calc(100vw - 2rem);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 50;
}
.notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
}
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background .1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f8f9fc; color: var(--text); }
.notif-item.unread { background: #fafbff; }
.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border);
    margin-top: 7px;
    flex-shrink: 0;
}
.notif-item.unread .notif-dot { background: var(--accent); }
.notif-msg { font-size: 0.88rem; line-height: 1.35; }
.notif-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ===================== BG PICKER ===================== */
.bg-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 0.5rem;
}
.bg-swatch {
    height: 44px;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    transition: transform .1s, border-color .15s, box-shadow .15s;
}
.bg-swatch:hover { transform: translateY(-1px); }
.bg-swatch.selected {
    border-color: var(--text);
    box-shadow: 0 0 0 2px white inset, 0 6px 14px -4px rgba(15,23,42,0.25);
}

/* ===================== MEMBERS ===================== */
.members-grid {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 2rem;
    align-items: flex-start;
}
@media (max-width: 900px) { .members-grid { grid-template-columns: 1fr; } }

.member-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.member-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: box-shadow .15s, transform .1s;
}
.member-row:hover { box-shadow: var(--shadow-sm); }
.member-row .avatar { width: 40px; height: 40px; font-size: 1rem; }
.member-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.member-meta .name { font-weight: 600; color: var(--text); }
.member-meta .email { color: var(--text-muted); font-size: 0.85rem; }
.member-role {
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #eef1f6;
    color: var(--text-muted);
}
.member-role.owner {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

/* ===================== FORMS ===================== */
.form-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.85rem;
    max-width: 580px;
    box-shadow: var(--shadow-sm);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed;
        left: -288px;
        width: 272px;
        transition: left 0.22s ease;
        z-index: 100;
    }
    .app-sidebar.open { left: 0; box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
    .app-content { padding: 1rem; }
    .app-topbar { padding: 0.8rem 1rem; }
}
