/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0d1117;
    --bg2:       #161b22;
    --bg3:       #21262d;
    --border:    #30363d;
    --text:      #e6edf3;
    --text-muted:#8b949e;
    --accent:    #58a6ff;
    --accent2:   #1f6feb;
    --success:   #3fb950;
    --warning:   #d29922;
    --danger:    #f85149;
    --purple:    #bc8cff;
    --col-w:     280px;
    --sidebar-w: 240px;
    --radius:    6px;
    --radius-lg: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}

.sidebar-logo svg { color: var(--accent); }

.sidebar-section {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    padding: 4px 12px 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
    text-decoration: none;
    font-size: 13.5px;
}

.sidebar-item:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.sidebar-item.active { background: var(--accent2); color: #fff; }
.sidebar-item .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: 56px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.content { padding: 24px; flex: 1; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent2);
    border-color: var(--accent2);
    color: #fff;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
}

/* Status badges */
.badge-backlog  { background: rgba(139,148,158,.15); color: var(--text-muted); border: 1px solid rgba(139,148,158,.3); }
.badge-todo     { background: rgba(88,166,255,.1); color: #79c0ff; border: 1px solid rgba(88,166,255,.3); }
.badge-in_progress { background: rgba(210,153,34,.12); color: #e3b341; border: 1px solid rgba(210,153,34,.3); }
.badge-in_review   { background: rgba(188,140,255,.12); color: #d2a8ff; border: 1px solid rgba(188,140,255,.3); }
.badge-done     { background: rgba(63,185,80,.1); color: #56d364; border: 1px solid rgba(63,185,80,.3); }

/* Priority badges */
.badge-critical { background: rgba(248,81,73,.15); color: #f85149; border: 1px solid rgba(248,81,73,.3); }
.badge-high     { background: rgba(248,81,73,.08); color: #ff7b72; border: 1px solid rgba(248,81,73,.2); }
.badge-medium   { background: rgba(210,153,34,.1); color: #e3b341; border: 1px solid rgba(210,153,34,.25); }
.badge-low      { background: rgba(63,185,80,.08); color: #56d364; border: 1px solid rgba(63,185,80,.2); }

/* ── Dashboard ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.project-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color .2s;
    text-decoration: none !important;
    color: var(--text) !important;
    display: block;
}

.project-card:hover { border-color: var(--accent); }

.project-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.project-dot {
    width: 14px; height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.project-card-title {
    font-weight: 600;
    font-size: 15px;
}

.project-card-key {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg3);
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: auto;
}

.project-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.project-progress {
    margin-bottom: 10px;
}

.progress-bar-bg {
    background: var(--bg3);
    border-radius: 4px;
    height: 5px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--success);
    transition: width .3s;
}

.progress-stats {
    display: flex;
    gap: 12px;
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ── Kanban Board ──────────────────────────────────────────── */
.board-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    align-items: flex-start;
}

.board-column {
    min-width: var(--col-w);
    width: var(--col-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.column-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg2);
    z-index: 10;
}

.column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
}

.column-count {
    background: var(--bg3);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.column-indicator {
    width: 3px;
    height: 14px;
    border-radius: 2px;
}

.column-body {
    padding: 10px;
    flex: 1;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Task cards */
.task-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, opacity .2s;
    user-select: none;
}

.task-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent2);
}

.task-card.dragging {
    opacity: 0.5;
    border-color: var(--accent);
}

.task-card.drag-over {
    box-shadow: 0 4px 12px rgba(88,166,255,.25);
}

.task-title {
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
    color: var(--text);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.task-assignee {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-left: auto;
}

.avatar {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.task-due {
    font-size: 11px;
    color: var(--text-muted);
}

.task-due.overdue { color: var(--danger); }

.add-task-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .15s;
    margin-top: 4px;
}

.add-task-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(88,166,255,.05);
}

/* Column colors */
.col-backlog  { background: var(--text-muted); }
.col-todo     { background: #79c0ff; }
.col-progress { background: #e3b341; }
.col-review   { background: #d2a8ff; }
.col-done     { background: #56d364; }

/* Sortable ghost */
.sortable-ghost {
    opacity: 0.3;
    background: rgba(88,166,255,.1);
    border: 2px dashed var(--accent);
}

/* ── List View ─────────────────────────────────────────────── */
.list-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select, .filter-input {
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 13px;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.task-table {
    width: 100%;
    border-collapse: collapse;
}

.task-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.task-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(48,54,61,.5);
    font-size: 13.5px;
    vertical-align: middle;
}

.task-table tr:hover td { background: rgba(255,255,255,.02); }

.task-table tr:last-child td { border-bottom: none; }

.task-row-title {
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
}
.task-row-title:hover { color: var(--accent); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.modal-header-info { flex: 1; }

.modal-key {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.modal-title-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    outline: none;
    line-height: 1.3;
}

.modal-title-input:focus {
    background: var(--bg3);
    border-radius: var(--radius);
    padding: 4px 8px;
    margin: -4px -8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius);
}
.modal-close:hover { background: var(--bg3); color: var(--text); }

.modal-body {
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 24px;
}

.modal-desc-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}

.modal-desc {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    outline: none;
}

.modal-desc:focus { border-color: var(--accent); }

.modal-sidebar-field {
    margin-bottom: 16px;
}

.modal-sidebar-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}

.modal-select, .modal-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
}

.modal-select:focus, .modal-input:focus { border-color: var(--accent); }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Comments */
.comments-section {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 4px;
}

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.comment-body {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.comment-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.comment-meta strong { color: var(--text); }

.comment-text { font-size: 13.5px; line-height: 1.5; }

.comment-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.comment-form input[type="text"],
.comment-form textarea {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    resize: none;
}

.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--accent); }

/* ── Form for new project/task ─────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-input, .form-select, .form-textarea {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
}

.form-textarea { resize: vertical; min-height: 80px; }

/* ── View switcher ─────────────────────────────────────────── */
.view-switcher {
    display: flex;
    gap: 2px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
}

.view-btn {
    padding: 5px 12px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
}

.view-btn.active { background: var(--bg2); color: var(--text); }
.view-btn:hover:not(.active) { color: var(--text); }

/* ── Misc ──────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-desc { font-size: 13.5px; margin-bottom: 20px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.recent-tasks-table { width: 100%; }

.recent-tasks-table td {
    padding: 9px 0;
    border-bottom: 1px solid rgba(48,54,61,.5);
    font-size: 13px;
}

.recent-tasks-table tr:last-child td { border-bottom: none; }

.hidden { display: none !important; }

/* Notification toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 13.5px;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    animation: slideUp .2s ease;
}

@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── Categories ────────────────────────────────────────────── */
.cat-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: .2px;
}

.task-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 7px;
}

/* Category picker in modal */
.cat-picker-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.cat-pick-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.45;
    transition: opacity .15s, border-color .15s;
    user-select: none;
}

.cat-pick-badge:hover { opacity: 0.75; }
.cat-pick-badge.selected { opacity: 1; border-color: rgba(255,255,255,.4); }

.cat-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
}
.cat-new-btn:hover { border-color: var(--accent); color: var(--accent); }

.cat-inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px;
}

.cat-inline-form input[type="text"] {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 12px;
    outline: none;
    width: 100px;
}

.cat-inline-form input[type="color"] {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}

.cat-inline-confirm {
    background: none;
    border: none;
    color: var(--success);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
}

.cat-inline-cancel {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
}

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