* { box-sizing: border-box; }

:root {
    --bg: #f7f7f9;
    --surface: #ffffff;
    --surface-hover: #fafafb;
    --border: #e5e6eb;
    --border-strong: #d8d9e0;
    --text: #1c1d21;
    --text-muted: #6b6d76;
    --text-faint: #9a9ba3;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: #eef0ff;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warn: #d97706;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(20, 21, 30, 0.04);
    --shadow-md: 0 4px 16px rgba(20, 21, 30, 0.06);
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

body {
    font-family: var(--font);
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    font-weight: 650;
    text-decoration: none;
    color: var(--text);
    font-size: 16px;
    letter-spacing: -0.01em;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.whoami { font-size: 13px; color: var(--text-muted); }
.whoami strong { color: var(--text); font-weight: 600; }
.switch-user { font-size: 13px; color: var(--text-faint); text-decoration: none; }
.switch-user:hover { color: var(--text-muted); }
.github-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-faint);
    text-decoration: none;
    transition: all 0.15s ease;
}
.github-link:hover { color: var(--text); background: var(--surface-hover); }
.container { max-width: 1240px; margin: 0 auto; padding: 32px 28px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-faint); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.login-box, .form-box {
    max-width: 400px;
    margin: 80px auto;
    background: var(--surface);
    padding: 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}
.login-box h1, .form-box h1 { font-size: 20px; font-weight: 650; margin: 0 0 24px; letter-spacing: -0.01em; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.user-pick-btn {
    padding: 16px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}
.user-pick-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.login-form-fields, .stack-form { display: flex; flex-direction: column; gap: 16px; }
.login-form-fields label, .stack-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); }

input, select, textarea {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.error-msg { color: var(--danger); background: var(--danger-soft); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.success-msg { color: var(--success); background: var(--success-soft); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.dashboard-header h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.group-toggle { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.group-toggle a { padding: 6px 14px; text-decoration: none; color: var(--text-muted); border-radius: 6px; font-size: 13px; font-weight: 500; transition: all 0.15s ease; }
.group-toggle a.active { background: var(--accent); color: #fff; }
.group-toggle a:not(.active):hover { background: var(--surface-hover); color: var(--text); }

.board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: start;
}
.board-column { min-width: 0; }
.column-title {
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 2px;
}
.count { color: var(--text-faint); font-weight: 500; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; font-size: 11px; }
.column-cards { display: flex; flex-direction: column; gap: 10px; }
.empty-col { color: var(--text-faint); font-size: 13px; padding: 8px 2px; }

.project-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
    display: block;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.card-title { font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
.stale-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-top: 5px; flex-shrink: 0; }
.card-meta { display: flex; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; }
.owner-tag, .priority-tag, .status-tag {
    background: var(--bg);
    padding: 3px 9px;
    border-radius: 20px;
    font-weight: 500;
}
.priority-tag { position: relative; padding-left: 16px; }
.priority-tag::before { content: ''; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.progress-bar { background: var(--border); border-radius: 20px; height: 5px; margin-top: 10px; overflow: hidden; }
.progress-bar.large { height: 7px; margin-top: 14px; }
.progress-fill { background: var(--accent); height: 100%; border-radius: 20px; transition: width 0.2s ease; }
.progress-label { font-size: 11px; color: var(--text-faint); margin-top: 5px; font-weight: 500; }

.project-header { background: var(--surface); padding: 24px 28px; border-radius: var(--radius); margin-bottom: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.project-header h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.project-meta-row { display: flex; gap: 24px; margin-top: 16px; flex-wrap: wrap; }
.inline-field { display: flex; flex-direction: column; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-faint); gap: 6px; }
.inline-select { min-width: 150px; font-weight: 500; }

/* Accordion sections replacing tabs */
.accordion { display: flex; flex-direction: column; gap: 10px; }
.accordion-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-align: left;
}
.accordion-header:hover { background: var(--surface-hover); }
.accordion-header .chevron { color: var(--text-faint); transition: transform 0.2s ease; font-size: 12px; }
.accordion-section.open .accordion-header .chevron { transform: rotate(90deg); }
.accordion-header .section-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-faint);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
}
.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.accordion-section.open .accordion-body { max-height: 3000px; }
.accordion-body-inner { padding: 4px 20px 20px; border-top: 1px solid var(--border); padding-top: 16px; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.task-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--radius-sm); }
.task-item:hover { background: var(--surface-hover); }
.task-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.task-title { flex: 1; font-size: 13.5px; }
.task-title.done { text-decoration: line-through; color: var(--text-faint); }
.task-assignee-select { font-size: 12px; padding: 5px 8px; color: var(--text-muted); }
.quick-add-form { margin-top: 12px; }
.quick-add-form input { width: 100%; }
.quick-add-form input::placeholder { color: var(--text-faint); }

.doc-group { margin-bottom: 22px; }
.doc-group:last-child { margin-bottom: 0; }
.doc-group h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin: 0 0 10px; }
.upload-form { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.upload-form input[type="file"] { font-size: 12px; color: var(--text-muted); }
.doc-list { list-style: none; padding: 0; margin: 8px 0 0; }
.doc-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.doc-list li:last-child { border-bottom: none; }
.doc-list a { color: var(--accent); text-decoration: none; font-weight: 500; }
.doc-list a:hover { text-decoration: underline; }
.doc-meta { color: var(--text-faint); font-size: 11.5px; margin-left: 8px; }
.empty-doc { color: var(--text-faint); }
.todo-hint { font-size: 12px; color: var(--warn); background: #fffaf0; border: 1px solid #fde8c4; padding: 10px 12px; border-radius: var(--radius-sm); margin: 8px 0 12px; line-height: 1.5; }
.todo-hint code { background: var(--bg); padding: 1px 6px; border-radius: 4px; color: var(--text); }

#project-notes { width: 100%; min-height: 180px; resize: vertical; }
.save-hint { color: var(--text-faint); font-size: 11.5px; margin: 8px 0 0; }
