:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1a202c;
    --text-muted: #718096;
    --primary: #4299e1;
    --primary-hover: #3182ce;
    --danger: #e53e3e;
    --low: #48bb78;
    --medium: #ecc94b;
    --high: #ed8936;
    --urgent: #e53e3e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }

/* Navbar */
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.nav-left { display: flex; align-items: center; gap: 0.5rem; }
.nav-separator { color: var(--text-muted); font-size: 1.1rem; }
.nav-project { font-weight: 500; font-size: 0.95rem; color: var(--primary); text-decoration: none; }
.nav-project:hover { text-decoration: underline; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-user { color: var(--text-muted); font-size: 0.875rem; }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* Buttons */
.btn { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.875rem; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--text-muted); padding: 0 0.25rem; }
.btn-icon:hover { color: var(--danger); }

/* Auth */
.auth-card { max-width: 400px; margin: 4rem auto; background: var(--surface); padding: 2rem; border-radius: 8px; border: 1px solid var(--border); }
.auth-card h2 { margin-bottom: 1.5rem; }
.auth-link { margin-top: 1rem; text-align: center; font-size: 0.875rem; color: var(--text-muted); }
.auth-link a { color: var(--primary); }

/* Forms */
label { display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem; margin-top: 0.75rem; }
input, textarea, select { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.875rem; font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(66,153,225,0.15); }
.form-card { max-width: 600px; margin: 2rem auto; background: var(--surface); padding: 2rem; border-radius: 8px; border: 1px solid var(--border); }
.form-card h2 { margin-bottom: 1rem; }
.form-card .btn-primary { margin-top: 1rem; }
.form-hint { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: var(--text-muted); }
.checkbox-group { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; font-weight: 400; cursor: pointer; margin: 0; }
.checkbox-label input[type="checkbox"] { width: auto; }

/* Alert */
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fff5f5; color: var(--danger); border: 1px solid #fed7d7; }

/* Board */
.board-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.board-header h1 { font-size: 1.5rem; }
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; min-height: 70vh; }
.column { background: var(--bg); border-radius: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; }
.column-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.column-header h3 { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.badge { background: var(--border); color: var(--text-muted); font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; }
.card-list { flex: 1; padding: 0.5rem; min-height: 100px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem; margin-bottom: 0.5rem; cursor: grab; position: relative; }
.card:hover { box-shadow: 0 2px 4px rgba(0,0,0,0.06); }
.card-priority { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 6px 0 0 6px; }
.priority-low { background: var(--low); }
.priority-medium { background: var(--medium); }
.priority-high { background: var(--high); }
.priority-urgent { background: var(--urgent); }
.card-top { display: flex; align-items: start; justify-content: space-between; gap: 0.25rem; }
.card-title { font-size: 0.875rem; font-weight: 500; text-decoration: none; color: var(--text); display: block; padding-left: 0.5rem; flex: 1; }
.card-actions { display: flex; gap: 0.1rem; opacity: 0; transition: opacity 0.15s; }
.card:hover .card-actions { opacity: 1; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; padding-left: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }

/* User bubbles */
.user-bubble { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; color: white; white-space: nowrap; }
.user-color-0 { background: #4299e1; }
.user-color-1 { background: #48bb78; }
.user-color-2 { background: #ed8936; }
.user-color-3 { background: #9f7aea; }
.user-color-4 { background: #e53e3e; }
.user-color-5 { background: #38b2ac; }
.user-color-6 { background: #d69e2e; }
.user-color-7 { background: #e84393; }
.card-footer { margin-top: 0.5rem; padding-left: 0.5rem; }
.btn-comments { font-size: 0.7rem; padding: 0.15rem 0.5rem; border: 1px solid var(--primary); border-radius: 4px; color: var(--primary); text-decoration: none; display: inline-block; }
.btn-comments:hover { background: var(--primary); color: white; }

/* Sortable ghost */
.sortable-ghost { opacity: 0.4; }

/* Task detail */
.task-detail { max-width: 800px; margin: 0 auto; background: var(--surface); padding: 2rem; border-radius: 8px; border: 1px solid var(--border); }
.task-header { display: flex; align-items: start; justify-content: space-between; margin-bottom: 1.5rem; }
.task-header h1 { font-size: 1.5rem; }
.task-actions { display: flex; gap: 0.5rem; }
.task-meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; font-size: 0.875rem; }
.priority-text { font-weight: 600; }
.priority-text.priority-low { color: var(--low); }
.priority-text.priority-medium { color: var(--medium); }
.priority-text.priority-high { color: var(--high); }
.priority-text.priority-urgent { color: var(--urgent); }
.task-description { margin-bottom: 1.5rem; }
.task-description h3 { margin-bottom: 0.5rem; }

/* Comments */
.comments-section { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.comments-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.comments-section h3 { margin-bottom: 0; }
.hidden { display: none; }
.comment { padding: 0.75rem; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 0.5rem; }
.comment-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; font-size: 0.8rem; }
.comment-date { color: var(--text-muted); }
.comment-body { font-size: 0.875rem; }
.comments-section form { margin-top: 1rem; }
.comments-section textarea { margin-bottom: 0.5rem; }

/* Calendar timeline */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.cal-month-title { font-size: 1.25rem; min-width: 200px; text-align: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; padding: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.cal-legend-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; }
.cal-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-header-cell { background: var(--surface); padding: 0.5rem; text-align: center; font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
.cal-day { background: var(--surface); min-height: 80px; padding: 0.4rem; cursor: pointer; transition: background 0.15s; }
.cal-day:hover { background: #edf2f7; }
.cal-day-outside { opacity: 0.35; }
.cal-day-today { background: #ebf8ff; }
.cal-day-today:hover { background: #bee3f8; }
.cal-day-selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-day-number { font-size: 0.8rem; font-weight: 500; margin-bottom: 0.3rem; color: var(--text-muted); }
.cal-day-bars { display: flex; flex-direction: column; gap: 2px; }
.cal-bar { height: 5px; border-radius: 3px; }
.status-badge { font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; color: white; }
.status-todo { background: #a0aec0; }
.status-in_progress { background: var(--primary); }
.status-review { background: #9f7aea; }
.status-done { background: var(--low); }
.day-detail { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin-top: 1rem; }
.day-detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.day-detail-header h3 { font-size: 1rem; }
.day-detail-task { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.day-detail-task:last-child { border-bottom: none; }
.day-detail-task-title { font-size: 0.875rem; font-weight: 500; text-decoration: none; color: var(--text); }
.day-detail-task-title:hover { color: var(--primary); }
.text-muted { color: var(--text-muted); }

/* Project cards */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; transition: box-shadow 0.15s; }
.project-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.project-card-header { display: flex; align-items: start; justify-content: space-between; margin-bottom: 0.5rem; }
.project-card-title { font-size: 1.1rem; font-weight: 600; color: var(--text); text-decoration: none; }
.project-card-title:hover { color: var(--primary); }
.project-card-desc { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.project-card-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }
.project-card-members { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }

/* Responsive */
@media (max-width: 900px) {
    .board { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .board { grid-template-columns: 1fr; }
}
