/* ============================================================
   TaskFlow Pro — CSS v2
   Full responsive, dark/light theme, mobile-first fixes
   ============================================================ */

/* ── Light theme variables ────────────────────────────────── */
:root {
    --sidebar-w: 240px;
    --topbar-h: 56px;

    --accent:       #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99,102,241,.12);

    --sidebar-bg:     #0f1117;
    --sidebar-border: #1e2130;
    --sidebar-text:   #9ca3af;
    --sidebar-active: #6366f1;

    --bg:       #f5f6fa;
    --surface:  #ffffff;
    --surface2: #f0f1f6;
    --border:   #e4e5f0;

    --text-primary:   #111827;
    --text-secondary: #6b7280;
    --text-muted:     #9ca3af;

    --topbar-bg:     #ffffff;
    --topbar-border: #e4e5f0;

    --success: #10b981;
    --warning: #f59e0b;
    --danger:  #ef4444;
    --info:    #3b82f6;

    --priority-low:    #10b981;
    --priority-medium: #f59e0b;
    --priority-high:   #ef4444;
    --priority-urgent: #7c3aed;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
    --shadow:    0 4px 16px rgba(0,0,0,.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.14);

    --transition: .2s ease;
}

/* ── Dark theme variables ─────────────────────────────────── */
[data-theme="dark"] {
    --sidebar-bg:     #09090f;
    --sidebar-border: #1a1a2e;

    --bg:       #0d0d14;
    --surface:  #13131f;
    --surface2: #1a1a2e;
    --border:   #252538;

    --text-primary:   #f0f0f8;
    --text-secondary: #9090b8;
    --text-muted:     #55557a;

    --topbar-bg:     #13131f;
    --topbar-border: #252538;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
    --shadow:    0 4px 16px rgba(0,0,0,.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background .25s, color .25s;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }

/* ── Layout ──────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar overlay (mobile backdrop) ───────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 14px; flex-shrink: 0;
}
.logo-text { font-size: 17px; font-weight: 800; color: white; letter-spacing: -.3px; }

/* Close button — only visible on mobile */
.sidebar-close-btn {
    display: none;
    color: #6b7280; font-size: 16px;
    padding: 6px 8px; border-radius: 6px;
    transition: color .2s, background .2s;
}
.sidebar-close-btn:hover { color: white; background: rgba(255,255,255,.08); }

/* Nav */
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; overflow-x: hidden; }
.nav-section  { margin-bottom: 20px; }
.nav-label {
    font-size: 10px; font-weight: 700;
    color: #4b5563; letter-spacing: 1px; text-transform: uppercase;
    padding: 0 8px; margin-bottom: 6px; display: block;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
    transition: color .2s, background .2s;
    margin-bottom: 2px;
    white-space: nowrap;
}
.nav-item:hover  { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: var(--accent); }
.nav-icon { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* Sidebar footer */
.sidebar-footer {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 12px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
    width: 32px; height: 32px;
    background: var(--accent); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 700;
    flex-shrink: 0; cursor: default;
}
.user-details { min-width: 0; }
.user-name  { display: block; font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 11px; color: #6b7280; }
.logout-btn {
    color: #6b7280; font-size: 16px;
    padding: 6px; border-radius: 6px;
    transition: color .2s, background .2s;
    flex-shrink: 0;
}
.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex; align-items: center;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 100;
    gap: 12px;
    transition: background .25s, border-color .25s;
}
.mobile-menu-btn {
    display: none;
    font-size: 18px; color: var(--text-secondary);
    padding: 6px 8px; border-radius: 6px;
    transition: background .2s, color .2s;
    flex-shrink: 0;
}
.mobile-menu-btn:hover { background: var(--surface2); color: var(--text-primary); }
.topbar-center { flex: 1; display: flex; align-items: center; }
.topbar-brand  { display: none; align-items: center; gap: 8px; }
.topbar-right  { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-user   { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--radius-sm); transition: background .2s; }
.topbar-user:hover { background: var(--surface2); }
.topbar-username { font-size: 13.5px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.user-avatar-sm {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.theme-toggle-btn {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--text-secondary);
    transition: background .2s, color .2s;
    flex-shrink: 0;
}
.theme-toggle-btn:hover { background: var(--surface2); color: var(--accent); }

/* ── Page Content ────────────────────────────────────────── */
.page-content { padding: 28px; flex: 1; }

/* ── Page header ─────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header.flex { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title    { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: background .25s, border-color .25s;
}
.card-body { padding: 20px; }
.card-header-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap; gap: 8px;
}
.card-title { font-size: 15px; font-weight: 700; }

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative; overflow: hidden;
    transition: background .25s, border-color .25s;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--accent);
}
.stat-card.green::before  { background: var(--success); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.purple::before { background: #8b5cf6; }
.stat-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 12px;
    background: var(--accent-light); color: var(--accent);
}
.stat-card.green  .stat-icon { background: rgba(16,185,129,.12);  color: var(--success); }
.stat-card.yellow .stat-icon { background: rgba(245,158,11,.12);  color: var(--warning); }
.stat-card.red    .stat-icon { background: rgba(239,68,68,.12);   color: var(--danger); }
.stat-card.purple .stat-icon { background: rgba(139,92,246,.12);  color: #8b5cf6; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600;
    transition: all .2s;
    white-space: nowrap; cursor: pointer; border: none;
    line-height: 1.4;
}
.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: rgba(239,68,68,.1); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success   { background: rgba(16,185,129,.1); color: var(--success); }
.btn-success:hover { background: var(--success); color: white; }
.btn-sm   { padding: 6px 12px; font-size: 12.5px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); line-height: 1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Form elements ───────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit;
    background: var(--surface); color: var(--text-primary);
    transition: border-color .2s, box-shadow .2s, background .25s;
    outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Color input */
input[type="color"].form-control {
    height: 40px; padding: 4px 6px; cursor: pointer;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500; margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 8px;
}
.alert-success { background: rgba(16,185,129,.1);  color: #065f46; border: 1px solid rgba(16,185,129,.2); }
.alert-danger  { background: rgba(239,68,68,.1);   color: #991b1b; border: 1px solid rgba(239,68,68,.2); }
.alert-info    { background: rgba(99,102,241,.1);  color: #3730a3; border: 1px solid rgba(99,102,241,.2); }
.alert-warning { background: rgba(245,158,11,.1);  color: #92400e; border: 1px solid rgba(245,158,11,.2); }
[data-theme="dark"] .alert-success { color: #6ee7b7; }
[data-theme="dark"] .alert-danger  { color: #fca5a5; }
[data-theme="dark"] .alert-info    { color: #a5b4fc; }
[data-theme="dark"] .alert-warning { color: #fcd34d; }

/* ── Badge / Pills ───────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 50px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.badge-low    { background: rgba(16,185,129,.12);  color: var(--priority-low); }
.badge-medium { background: rgba(245,158,11,.12);  color: var(--priority-medium); }
.badge-high   { background: rgba(239,68,68,.12);   color: var(--priority-high); }
.badge-urgent { background: rgba(124,58,237,.12);  color: var(--priority-urgent); }

.status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 50px;
    font-size: 11.5px; font-weight: 600;
}
.status-todo        { background: var(--surface2); color: var(--text-secondary); }
.status-in_progress { background: rgba(59,130,246,.12);  color: var(--info); }
.status-review      { background: rgba(245,158,11,.12);  color: var(--warning); }
.status-done        { background: rgba(16,185,129,.12);  color: var(--success); }

/* ── Projects grid ───────────────────────────────────────── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}
.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s, background .25s;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card-color { height: 5px; }
.project-card-body  { padding: 18px; }
.project-card-icon  {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 12px;
}
.project-card-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.project-card-desc {
    font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.project-card-footer {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding: 12px 18px; border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted);
}
.project-progress { height: 4px; background: var(--border); border-radius: 2px; margin: 10px 0; }
.project-progress-bar { height: 100%; border-radius: 2px; background: var(--accent); transition: width .4s; }

/* ── Kanban ──────────────────────────────────────────────── */
.kanban-wrapper {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 24px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    min-height: calc(100vh - 220px);
    align-items: flex-start;
}
.kanban-wrapper::-webkit-scrollbar { height: 6px; }
.kanban-wrapper::-webkit-scrollbar-track { background: var(--surface2); border-radius: 3px; }
.kanban-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.kanban-col {
    min-width: 285px; max-width: 305px;
    background: var(--surface2);
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column;
    border: 1px solid var(--border);
    flex-shrink: 0;
    scroll-snap-align: start;
    max-height: calc(100vh - 200px);
    transition: background .25s, border-color .25s;
}
.kanban-col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--surface2);
    position: sticky; top: 0; z-index: 10;
}
.kanban-col-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.col-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.col-dot-todo        { background: var(--text-muted); }
.col-dot-in_progress { background: var(--info); }
.col-dot-review      { background: var(--warning); }
.col-dot-done        { background: var(--success); }
.col-count {
    background: var(--border); color: var(--text-secondary);
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 50px;
}
.kanban-cards {
    padding: 10px; flex: 1; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 60px;
}
.kanban-cards.drag-over { background: var(--accent-light); border-radius: var(--radius); }

/* Kanban search bar */
.kanban-search-bar {
    padding: 12px 20px 0;
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
}
.kanban-search-input {
    flex: 1; min-width: 180px;
    padding: 8px 12px 8px 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text-primary);
    font-size: 13.5px; font-family: inherit;
    outline: none; transition: border-color .2s, box-shadow .2s;
}
.kanban-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.kanban-search-wrap { position: relative; flex: 1; min-width: 180px; }
.kanban-search-icon {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 13px; pointer-events: none;
}

/* Task card */
.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 13px 13px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow .2s, transform .2s, background .25s, border-color .25s;
    position: relative;
    -webkit-user-select: none; user-select: none;
}
.task-card:hover { box-shadow: var(--shadow); }
.task-card.dragging { opacity: .5; transform: rotate(1.5deg) scale(.98); cursor: grabbing; box-shadow: var(--shadow-lg); }
.task-card.hidden-by-search { display: none; }
.task-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.task-card-title  { font-size: 13.5px; font-weight: 600; line-height: 1.4; flex: 1; word-break: break-word; }
.task-card-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .2s; flex-shrink: 0; }
.task-card:hover .task-card-actions { opacity: 1; }
.task-card-action {
    padding: 4px 7px; border-radius: 5px; font-size: 12px;
    color: var(--text-muted); transition: color .2s, background .2s;
}
.task-card-action:hover     { color: var(--accent); background: var(--accent-light); }
.task-card-action.del:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.task-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.task-meta-item { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-muted); }
.task-meta-item.overdue { color: var(--danger); font-weight: 600; }
.task-priority-bar {
    position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    border-radius: var(--radius) 0 0 var(--radius);
}
.priority-bar-low    { background: var(--priority-low); }
.priority-bar-medium { background: var(--priority-medium); }
.priority-bar-high   { background: var(--priority-high); }
.priority-bar-urgent { background: var(--priority-urgent); }
.task-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.task-tag {
    font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 50px;
    background: var(--accent-light); color: var(--accent);
}
.task-checklist-progress { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }
.checklist-bar { flex: 1; height: 3px; background: var(--border); border-radius: 2px; }
.checklist-bar-fill { height: 100%; border-radius: 2px; background: var(--success); transition: width .3s; }

/* Add task button */
.add-task-btn {
    display: flex; align-items: center; gap: 7px;
    width: calc(100% - 20px); margin: 4px 10px 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 13px; font-weight: 500;
    transition: background .2s, color .2s;
}
.add-task-btn:hover { background: var(--border); color: var(--text-primary); }

/* ── Task Detail ─────────────────────────────────────────── */
.task-detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: flex-start;
}
.task-detail-main    { display: flex; flex-direction: column; gap: 20px; }
.task-detail-sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }

.detail-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: background .25s, border-color .25s; }
.detail-section-header {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.detail-section-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.detail-section-body  { padding: 18px; }

/* Checklist */
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--surface2); }
.checklist-item:last-child { border-bottom: none; }
.checklist-cb   { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.checklist-text { flex: 1; font-size: 14px; word-break: break-word; }
.checklist-text.done { text-decoration: line-through; color: var(--text-muted); }
.checklist-del  { color: var(--text-muted); font-size: 12px; opacity: 0; transition: opacity .2s; flex-shrink: 0; padding: 4px 6px; border-radius: 4px; }
.checklist-item:hover .checklist-del { opacity: 1; }
.checklist-del:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* Comments */
.comment-item { display: flex; gap: 10px; margin-bottom: 16px; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.comment-body   { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.comment-author { font-size: 13px; font-weight: 700; }
.comment-time   { font-size: 12px; color: var(--text-muted); }
.comment-text   { font-size: 14px; line-height: 1.6; background: var(--surface2); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) var(--radius); word-break: break-word; }

/* Attachments */
.attachment-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.attachment-icon { width: 36px; height: 36px; background: var(--accent-light); color: var(--accent); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-size { font-size: 11.5px; color: var(--text-muted); }

/* ── Members list ────────────────────────────────────────── */
.member-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--surface2); }
.member-item:last-child { border-bottom: none; }
.member-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.member-info { flex: 1; min-width: 0; }
.member-name  { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-email { font-size: 11.5px; color: var(--text-muted); }
.member-role-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 50px; background: var(--accent-light); color: var(--accent); flex-shrink: 0; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
    z-index: 1000; align-items: center; justify-content: center;
    padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 560px;
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overflow-x: hidden;
    animation: modalIn .2s ease;
    transition: background .25s;
    -webkit-overflow-scrolling: touch;
}
.modal-lg { max-width: 680px; }
@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(12px); } to { opacity:1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-title  { font-size: 16px; font-weight: 700; }
.modal-close  { font-size: 18px; color: var(--text-muted); padding: 4px 8px; border-radius: 4px; transition: color .2s, background .2s; flex-shrink: 0; }
.modal-close:hover { color: var(--text-primary); background: var(--surface2); }
.modal-body   { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 540px; }
th {
    text-align: left; font-size: 12px; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--surface2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 36px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-logo        { text-align: center; margin-bottom: 28px; }
.auth-logo-icon   { width: 48px; height: 48px; background: var(--accent); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: white; font-size: 22px; margin-bottom: 12px; }
.auth-title       { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth-subtitle    { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 28px; }
.auth-footer      { text-align: center; margin-top: 20px; font-size: 13.5px; color: var(--text-secondary); }
.auth-footer a    { color: var(--accent); font-weight: 600; }

/* ── Profile / Settings ──────────────────────────────────── */
.profile-avatar-big {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--accent); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; flex-shrink: 0;
}
.settings-section { margin-bottom: 32px; }
.settings-title   { font-size: 15px; font-weight: 700; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* ── Reports ─────────────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }
.report-bar-wrap { margin-bottom: 10px; }
.report-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.report-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.report-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 40px; margin-bottom: 14px; opacity: .4; display: block; }
.empty-state p { font-size: 15px; }

/* ── Misc helpers ────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-muted   { color: var(--text-muted) !important; }
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-sm      { font-size: 13px; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.flex         { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.w-100 { width: 100%; }
.d-none { display: none !important; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
    background: #1a1a2e; color: white;
    padding: 13px 18px; border-radius: var(--radius);
    font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    box-shadow: var(--shadow-lg);
    animation: toastIn .3s ease;
    max-width: 320px;
    pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes toastIn { from { opacity:0; transform: translateX(30px); } to { opacity:1; transform: none; } }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVIDADE COMPLETA
   Breakpoints:
   — Tablet grande  : ≤ 1200px
   — Tablet         : ≤ 1024px
   — Mobile grande  : ≤ 768px
   — Mobile médio   : ≤ 600px
   — Mobile pequeno : ≤ 480px
   — Mobile mínimo  : ≤ 360px
══════════════════════════════════════════════════════════════ */

/* ── Tablet grande (≤1200px) ─────────────────────────────── */
@media (max-width: 1200px) {
    :root { --sidebar-w: 220px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .page-content { padding: 22px; }
}

/* ── Tablet (≤1024px) ────────────────────────────────────── */
@media (max-width: 1024px) {
    :root { --sidebar-w: 200px; }

    /* Stats */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }

    /* Grids de conteúdo */
    .task-detail-layout { grid-template-columns: 1fr; }
    .task-detail-sidebar { position: static; }
    .dash-grid    { grid-template-columns: 1fr !important; }
    .profile-grid { grid-template-columns: 1fr !important; }

    /* Topbar */
    .topbar-username { display: none; }

    /* Nav labels menores */
    .nav-label { font-size: 9px; }
    .nav-item  { font-size: 13px; padding: 8px 10px; }
}

/* ── Mobile (≤768px) — sidebar off-canvas ───────────────── */
@media (max-width: 768px) {
    /* ── Sidebar: off-canvas ────────────────────── */
    :root { --sidebar-w: 270px; }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        width: var(--sidebar-w);
        /* Full height, scroll inside */
        overflow-y: auto;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-close-btn { display: flex; }

    /* ── Main: ocupa tela toda ──────────────────── */
    .main-content { margin-left: 0; width: 100%; }

    /* ── Topbar ─────────────────────────────────── */
    .mobile-menu-btn  { display: flex; }
    .topbar-brand     { display: flex; }
    .topbar-center    { justify-content: center; flex: 1; }
    .topbar-right     { gap: 4px; }
    .topbar-username  { display: none; }
    .topbar-user      { padding: 5px 6px; }
    .topbar           { padding: 0 12px; gap: 8px; }

    /* ── Page padding ───────────────────────────── */
    .page-content { padding: 14px; }

    /* ── Page header ────────────────────────────── */
    .page-header.flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .page-header.flex .btn { width: 100%; justify-content: center; }
    .page-title    { font-size: 19px; }
    .page-subtitle { font-size: 13px; }

    /* ── Stat cards ─────────────────────────────── */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 24px; }
    .stat-label { font-size: 12px; }
    .stat-icon  { width: 34px; height: 34px; font-size: 15px; margin-bottom: 8px; }

    /* ── Cards ──────────────────────────────────── */
    .card-header-bar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .card-body       { padding: 14px; }

    /* ── Forms ──────────────────────────────────── */
    .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 0; }

    /* ── Modais — slide de baixo ─────────────────── */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-width: 100%;
        max-height: 92vh;
        width: 100%;
    }
    .modal-lg { max-width: 100%; }
    @keyframes modalIn {
        from { opacity: 0; transform: translateY(40px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .modal-header { padding: 14px 16px; }
    .modal-body   { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; gap: 8px; }
    .modal-footer .btn { flex: 1; justify-content: center; }

    /* ── Tabelas: scroll horizontal ─────────────── */
    .table-wrap   { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
    table         { min-width: 480px; font-size: 13px; }
    th, td        { padding: 10px 12px; }

    /* ── Projetos ───────────────────────────────── */
    .projects-grid { grid-template-columns: 1fr; }
    .project-card-footer { flex-direction: column; align-items: flex-start; gap: 10px; }
    .project-card-footer > div { width: 100%; justify-content: flex-end; }

    /* ── Task detail ────────────────────────────── */
    .task-detail-layout { grid-template-columns: 1fr; gap: 14px; }
    .task-detail-sidebar { position: static; }

    /* ── Kanban ─────────────────────────────────── */
    .kanban-wrapper {
        gap: 10px;
        padding-bottom: 20px;
        /* Permite scroll touch suave */
        scroll-snap-type: x mandatory;
    }
    .kanban-col {
        min-width: 78vw;
        max-width: 88vw;
        scroll-snap-align: start;
        /* Altura máxima para não estourar a tela */
        max-height: calc(100vh - 180px);
    }
    .kanban-col-header { padding: 12px 14px; }
    .kanban-cards      { padding: 8px; }
    .add-task-btn      { margin: 4px 8px 8px; width: calc(100% - 16px); }

    /* Kanban search bar */
    .kanban-search-bar   { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px 0; }
    .kanban-search-wrap  { width: 100%; min-width: 0; }
    .kanban-search-bar select { width: 100%; min-width: 0; }

    /* ── Reports ────────────────────────────────── */
    .report-grid { grid-template-columns: 1fr; gap: 14px; }

    /* ── Grids de página ────────────────────────── */
    .dash-grid    { grid-template-columns: 1fr !important; }
    .profile-grid { grid-template-columns: 1fr !important; }

    /* ── Auth ───────────────────────────────────── */
    .auth-page { padding: 12px; }
    .auth-card { padding: 24px 18px; }

    /* ── Botões ─────────────────────────────────── */
    .btn    { padding: 9px 14px; font-size: 13px; }
    .btn-sm { padding: 6px 10px; font-size: 12px; }

    /* ── Toasts ─────────────────────────────────── */
    .toast-container { bottom: 14px; right: 10px; left: 10px; align-items: stretch; }
    .toast { max-width: 100%; }

    /* ── Usuários: esconde colunas pesadas ──────── */
    .users-col-tema,
    .users-col-data { display: none; }
}

/* ── Mobile médio (≤600px) ───────────────────────────────── */
@media (max-width: 600px) {
    /* Task card: ações sempre visíveis */
    .task-card-actions { opacity: 1; }

    /* Kanban coluna quase tela cheia */
    .kanban-col { min-width: 88vw; max-width: 94vw; }

    /* Checklist input + botão: empilhar */
    #newChecklistItem { font-size: 13px; }

    /* Badges menores */
    .badge { font-size: 10px; padding: 2px 7px; }
    .status-pill { font-size: 11px; padding: 2px 8px; }

    /* Profile avatar menor */
    .profile-avatar-big { width: 56px; height: 56px; font-size: 22px; }

    /* Settings: opções de tema empilhadas */
    .theme-option-row { flex-direction: column !important; }
}

/* ── Mobile pequeno (≤480px) ─────────────────────────────── */
@media (max-width: 480px) {
    /* Stats: 1 coluna */
    .stats-grid { grid-template-columns: 1fr; gap: 8px; }
    .stat-card  { padding: 14px; }
    .stat-value { font-size: 22px; }

    /* Títulos */
    .page-title  { font-size: 17px; }
    .modal-title { font-size: 15px; }
    .card-title  { font-size: 14px; }

    /* Topbar mais compacto */
    .topbar { height: 50px; padding: 0 10px; }

    /* Logo na topbar menor */
    .topbar-brand .logo-icon { width: 22px; height: 22px; font-size: 10px; }
    .topbar-brand span { font-size: 13px; }

    /* Tabela ainda menor */
    table   { min-width: 320px; font-size: 12px; }
    th, td  { padding: 8px 10px; }

    /* Auth card sem sombra lateral */
    .auth-card { padding: 20px 14px; border-radius: var(--radius); }

    /* Kanban coluna tela quase cheia */
    .kanban-col { min-width: 92vw; max-width: 96vw; }

    /* Botões: mais compactos */
    .btn    { padding: 8px 12px; font-size: 12.5px; gap: 5px; }
    .btn-sm { padding: 5px 9px;  font-size: 11.5px; }
    .btn-icon { padding: 6px; }

    /* Modal footer: empilhar */
    .modal-footer { flex-direction: column; }
    .modal-footer .btn { width: 100%; justify-content: center; }

    /* Comentário: textarea + botão */
    .comment-submit-row { flex-direction: column; gap: 8px; }
    .comment-submit-row .btn { width: 100%; justify-content: center; }

    /* Formulários */
    .form-control { font-size: 14px; padding: 9px 12px; }
    .form-label   { font-size: 12.5px; }

    /* Remover padding extra em card-body */
    .card-body { padding: 12px; }
}

/* ── Mobile mínimo (≤360px) ──────────────────────────────── */
@media (max-width: 360px) {
    :root { --topbar-h: 48px; }

    .page-content    { padding: 10px; }
    .page-title      { font-size: 15px; }
    .stats-grid      { gap: 6px; }
    .stat-card       { padding: 12px 10px; }
    .stat-value      { font-size: 20px; }
    .auth-card       { padding: 16px 12px; }
    .kanban-col      { min-width: 94vw; max-width: 98vw; }
    .task-card       { padding: 10px 10px 10px 14px; }
    .task-card-title { font-size: 12.5px; }
    .badge           { font-size: 9.5px; padding: 2px 6px; }
    table            { min-width: 280px; font-size: 11.5px; }
    th, td           { padding: 7px 8px; }
    .btn             { padding: 7px 10px; font-size: 12px; }
    .modal-header    { padding: 12px 14px; }
    .modal-body      { padding: 12px 14px; }
    .nav-item        { padding: 8px 10px; font-size: 12.5px; }
    .card-body       { padding: 10px; }
    .card-header-bar { padding: 10px 12px; }
}

/* ── Scrollbar global ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Touch: remove tap-highlight ────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }

/* ── Prevent overflow no body mobile ────────────────────── */
@media (max-width: 768px) {
    html, body { max-width: 100vw; overflow-x: hidden; }
}

/* ── Custom Alert Modal ───────────────────────────────────── */
.alert-modal {
    max-width: 480px;
}

.alert-header {
    background: linear-gradient(135deg, rgba(239,68,68,0.08) 0%, rgba(239,68,68,0.02) 100%);
    border-bottom: 1px solid rgba(239,68,68,0.1);
}

.alert-header .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-body {
    text-align: center;
    padding: 28px 22px;
}

.alert-message {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.alert-message strong {
    color: var(--danger);
    display: block;
    margin-top: 8px;
    font-size: 20px;
}

.alert-warning-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    background: rgba(239,68,68,0.05);
    padding: 14px;
    border-radius: var(--radius);
    margin-top: 12px;
    border: 1px solid rgba(239,68,68,0.1);
}

.alert-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 22px 22px;
}

/* Animation for alert modal */
@keyframes alertPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#alertIcon i {
    animation: alertPulse 0.5s ease-in-out 2;
}

/* Member list styling */
.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: all var(--transition);
}

.member-item:hover {
    background: var(--surface2);
    transform: translateX(2px);
}

.member-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    font-size: 14px;
}

.member-email {
    font-size: 12px;
    color: var(--text-muted);
}

.member-role-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    flex-shrink: 0;
}





/* ── Dashboard Grid Responsivo ─────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

/* Tablet (≤1024px) */
@media (max-width: 1024px) {
  .dash-grid {
    grid-template-columns: 1fr 320px;
    gap: 20px;
  }
}

/* Mobile (≤768px) */
@media (max-width: 768px) {
  .dash-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Os projetos vêm primeiro no mobile (mais importante) */
  .dash-grid > :first-child {
    order: 2;
  }
  .dash-grid > :last-child {
    order: 1;
  }
}

/* Mobile pequeno (≤480px) */
@media (max-width: 480px) {
  .dash-grid {
    gap: 16px;
  }
}

/* ── Melhorias para tabela em mobile ───────────────────────── */
@media (max-width: 768px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table-wrap table {
    min-width: 550px;
  }
}

/* ── Ajustes para os links dos projetos ────────────────────── */
.project-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}

.project-item-link:hover {
  background: var(--surface2);
}

/* ── Garantir que não haja overflow no mobile ──────────────── */
@media (max-width: 768px) {
  .main-content,
  .page-content,
  .dash-grid,
  .card,
  .card-body {
    overflow-x: hidden;
    max-width: 100%;
  }
}