/* TaskSurf — Base styles */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #eff6ff;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --bg: #f8fafc;
    --card-bg: #fff;
    --input-bg: #fff;
    --hover-bg: #f8fafc;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --code-bg: #f1f5f9;
    --pre-bg: #0f172a;
    --pre-text: #e2e8f0;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* ── Nav ── */
.nav { background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 0 1rem; position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 52px; }
.nav-brand { text-decoration: none; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 0.5rem; }
.nav-emblem { width: 26px; height: 26px; border-radius: 6px; }
.nav-brand-text { color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link { text-decoration: none; color: var(--text-muted); font-size: 0.8125rem; font-weight: 500; padding: 0.375rem 0.625rem; border-radius: var(--radius-sm); transition: all 0.15s; }
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-link-active { color: var(--primary); background: var(--primary-light); }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 0.6875rem; font-weight: 600; margin-left: 4px; line-height: 1; }

/* Workspace switcher */
.workspace-switcher { position: relative; display: flex; align-items: center; }
.ws-trigger {
    appearance: none; -webkit-appearance: none;
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: var(--card-bg); border: 1px solid var(--border);
    padding: 0.3125rem 0.5rem 0.3125rem 0.375rem;
    border-radius: var(--radius-sm); cursor: pointer;
    font-family: var(--font); font-size: 0.8125rem;
    color: var(--text); transition: all 0.15s;
    line-height: 1.4; height: 32px;
}
.ws-trigger:hover { border-color: var(--border-hover); background: var(--hover-bg); }
.ws-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ws-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 4px;
    font-size: 0.625rem; font-weight: 700; color: #fff;
    flex-shrink: 0; text-transform: uppercase; line-height: 1;
}
.ws-avatar-sm { width: 24px; height: 24px; border-radius: 5px; font-size: 0.6875rem; }
.ws-color-0 { background: #3b82f6; }
.ws-color-1 { background: #8b5cf6; }
.ws-color-2 { background: #06b6d4; }
.ws-color-3 { background: #f59e0b; }
.ws-color-4 { background: #ef4444; }
.ws-color-5 { background: #10b981; }
.ws-trigger-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.ws-chevron { color: var(--text-muted); flex-shrink: 0; transition: transform 0.2s; }
.ws-open .ws-chevron { transform: rotate(180deg); }
.ws-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0;
    min-width: 260px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 101; padding: 0.25rem;
    opacity: 0; transform: translateY(-4px) scale(0.97);
    pointer-events: none; visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0.15s;
}
.ws-dropdown.ws-open {
    opacity: 1; transform: translateY(0) scale(1);
    pointer-events: auto; visibility: visible;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}
.ws-dropdown form { margin: 0; }
.ws-dropdown-header {
    padding: 0.5rem 0.625rem 0.375rem; font-size: 0.6875rem;
    font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.ws-option {
    appearance: none; -webkit-appearance: none;
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 0.5rem 0.625rem;
    background: none; border: none;
    border-radius: var(--radius-sm); cursor: pointer;
    font-family: var(--font); font-size: 0.8125rem;
    color: var(--text); text-decoration: none;
    transition: background 0.1s; text-align: left; line-height: 1.4;
}
.ws-option:hover { background: var(--hover-bg); }
.ws-option:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ws-option-active { background: var(--primary-light); }
.ws-option-active:hover { background: var(--primary-light); }
.ws-option-left { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.ws-option-info { display: flex; flex-direction: column; min-width: 0; gap: 0.0625rem; }
.ws-option-name { font-size: 0.8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-option-meta { font-size: 0.6875rem; color: var(--text-muted); line-height: 1.2; }
.ws-check { color: var(--primary); flex-shrink: 0; }
.ws-divider { height: 1px; background: var(--border); margin: 0.25rem; }
.ws-footer-link {
    appearance: none; -webkit-appearance: none;
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.625rem; width: 100%;
    border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 0.8125rem; font-weight: 500;
    color: var(--text-muted); text-decoration: none;
    transition: all 0.1s; background: none; border: none; cursor: pointer;
}
.ws-footer-link:hover { background: var(--hover-bg); color: var(--text); }
.ws-footer-link svg { flex-shrink: 0; }

/* Mobile nav toggle */
.nav-toggle { display: none; background: none; border: none; padding: 0.25rem; cursor: pointer; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--text); margin: 3px 0; border-radius: 1px; transition: all 0.2s; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; padding: 0.5rem 0.875rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8125rem; font-weight: 500; cursor: pointer; text-decoration: none; background: var(--card-bg); color: var(--text-secondary); transition: all 0.15s; line-height: 1.4; white-space: nowrap; }
.btn:hover { background: var(--bg); border-color: var(--border-hover); color: var(--text); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 0.375rem; flex-wrap: wrap; }

/* ── Forms ── */
.form-group { margin-bottom: 0.875rem; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.25rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8125rem; font-family: var(--font); color: var(--text); background: var(--input-bg); transition: border-color 0.15s, box-shadow 0.15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-row { display: flex; gap: 0.75rem; }
.form-row .form-group { flex: 1; }
.form-inline { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* ── Alerts ── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.8125rem; line-height: 1.5; }
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Auth pages ── */
.auth-page { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 52px); padding: 2rem; }
.auth-card { background: var(--card-bg); padding: 2rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.375rem; margin-bottom: 1.25rem; letter-spacing: -0.01em; }
.auth-switch { text-align: center; margin-top: 1.25rem; font-size: 0.8125rem; color: var(--text-muted); }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ── Page layouts ── */
.page { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.page-header .text-muted { margin-top: 0.25rem; }
.page-narrow { max-width: 700px; }

/* ── Dashboard ── */
.dashboard { max-width: 800px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.dashboard-header { margin-bottom: 1.5rem; }
.dashboard-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.workspace-section { margin-bottom: 2rem; }
.workspace-section h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.75rem; }
.workspace-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.workspace-card { display: flex; align-items: center; justify-content: space-between; padding: 0.875rem 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color 0.15s; }
.workspace-card:hover { border-color: var(--border-hover); }
.workspace-card.selected { border-color: var(--primary); background: var(--primary-light); }
.workspace-info h3 { font-size: 0.9375rem; font-weight: 600; }
.create-team-form { display: flex; gap: 0.5rem; }
.create-team-form input { flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8125rem; }

/* Dashboard workspace rows */
.ws-rows { display: flex; flex-direction: column; }
.ws-row { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.ws-row:last-child { border-bottom: none; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em; text-transform: capitalize; white-space: nowrap; }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* Status badges */
.badge-status-backlog { background: #f1f5f9; color: #475569; }
.badge-status-in_progress { background: #dbeafe; color: #1d4ed8; }
.badge-status-in_review { background: var(--purple-light); color: var(--purple); }
.badge-status-blocked { background: var(--danger-light); color: #b91c1c; }
.badge-status-completed { background: var(--success-light); color: #15803d; }

/* Priority badges */
.badge-priority-urgent { background: var(--danger-light); color: #b91c1c; }
.badge-priority-high { background: #fff7ed; color: #c2410c; }
.badge-priority-medium { background: var(--warning-light); color: #b45309; }
.badge-priority-low { background: #f1f5f9; color: #475569; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.table th, .table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.8125rem; }
.table th { font-weight: 600; color: var(--text-muted); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--hover-bg); padding: 0.5rem 0.75rem; white-space: nowrap; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: var(--hover-bg); }
.table tbody tr:last-child td { border-bottom: none; }
.table a { text-decoration: none; color: var(--text); font-weight: 500; }
.table a:hover { color: var(--primary); }

/* Column sizing */
.table .col-id { width: 80px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.table .col-name { }
.table .col-status { width: 110px; }
.table .col-priority { width: 90px; }
.table .col-type { width: 80px; }
.table .col-assignee { width: 130px; }
.table .col-points { width: 50px; text-align: center; }

/* Clickable table rows */
.table-clickable tbody tr { cursor: pointer; }
.table-clickable tbody tr:hover { background: var(--primary-light); }
.table-clickable tbody tr:active { background: var(--primary-light); }

/* ── Cards ── */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; }
.card + .card { margin-top: 0.75rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.card-header h3, .card-header h2 { font-size: 0.9375rem; font-weight: 600; }

/* ── Tasks page ── */
.tasks-page { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.tasks-header { margin-bottom: 1.25rem; }
.tasks-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }

.create-task-section { margin-bottom: 1.25rem; }
.create-task-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.create-task-form input[type="text"] { flex: 1; min-width: 200px; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8125rem; }
.create-task-form input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.create-task-form select { padding: 0.5rem 0.625rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8125rem; background: var(--input-bg); color: var(--text-secondary); }

.task-filters { display: flex; gap: 0.375rem; margin-bottom: 1rem; flex-wrap: wrap; }

.empty-state { padding: 3rem 1rem; text-align: center; }
.empty-state p { color: var(--text-muted); font-size: 0.875rem; }

/* ── Task detail ── */
.task-detail-page { max-width: 800px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.task-detail-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.task-id { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 0.02em; }
.task-detail-header h1 { font-size: 1.375rem; font-weight: 700; margin-top: 0.25rem; letter-spacing: -0.01em; line-height: 1.3; }
.task-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }

.task-section { margin-bottom: 1.5rem; }
.task-section h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.625rem; }

.task-description { margin-bottom: 1.5rem; }
.task-description h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.task-description p { font-size: 0.875rem; line-height: 1.7; color: var(--text-secondary); }

/* Status change buttons */
.task-actions { margin-bottom: 1.5rem; }
.task-actions h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.625rem; }
.status-buttons { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.status-buttons form { display: inline; }

/* Edit section */
.task-edit { margin-bottom: 1.5rem; padding: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.task-edit h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.task-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.task-edit-full { grid-column: 1 / -1; }

/* Timer */
.timer-section { margin-bottom: 1.5rem; padding: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.timer-section h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.625rem; }
.timer-active { display: flex; align-items: center; gap: 0.75rem; }
.timer-dot { width: 8px; height: 8px; background: var(--danger); border-radius: 50%; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Time in status */
.time-tracking { margin-bottom: 1.5rem; }
.time-tracking h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.625rem; }
.time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.time-item { padding: 0.75rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: center; }
.time-label { display: block; font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem; }
.time-value { display: block; font-size: 1rem; font-weight: 700; color: var(--text); font-family: var(--font-mono); }

/* Comments */
.comments-section { margin-bottom: 1.5rem; }
.comments-section h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.comment { padding: 0.75rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.comment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.comment-header strong { font-size: 0.8125rem; }
.comment-header .text-muted { font-size: 0.75rem; }
.comment p { font-size: 0.8125rem; line-height: 1.6; color: var(--text-secondary); }
.comment-form { margin-top: 0.75rem; }
.comment-form textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8125rem; font-family: var(--font); resize: vertical; margin-bottom: 0.5rem; }
.comment-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* Activity */
.activity-section { margin-bottom: 1.5rem; }
.activity-section h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.activity-item { display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.8125rem; line-height: 1.5; }
.activity-item:last-child { border-bottom: none; }

/* Danger zone */
.danger-zone { margin-top: 2rem; padding: 1rem; border: 1px solid #fecaca; border-radius: var(--radius-sm); background: var(--danger-light); }
.danger-zone h3 { font-size: 0.8125rem; font-weight: 600; color: #b91c1c; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.625rem; }

/* ── Standups ── */
.standups-page { max-width: 700px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.standups-header { margin-bottom: 1.25rem; }
.standups-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.date-nav { display: flex; gap: 0.375rem; margin-bottom: 1.25rem; }
.standup-form { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1.5rem; }
.standup-form h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.standup-list { margin-top: 1.5rem; }
.standup-list h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.standup-card { padding: 0.875rem 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.standup-own { border-left: 3px solid var(--primary); }
.standup-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.standup-meta strong { font-size: 0.8125rem; }
.standup-meta .text-muted { font-size: 0.75rem; }
.standup-card p { font-size: 0.8125rem; line-height: 1.6; color: var(--text-secondary); }
.standup-links { margin-top: 0.5rem; padding-left: 1rem; list-style: disc; }
.standup-links li { font-size: 0.8125rem; }
.standup-links a { word-break: break-all; }

/* ── Knowledge ── */
.knowledge-page { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.knowledge-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.knowledge-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.knowledge-edit { max-width: 800px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.knowledge-edit h1 { font-size: 1.375rem; font-weight: 700; margin-bottom: 1.25rem; }
.knowledge-view { max-width: 800px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.knowledge-view-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.knowledge-view-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.knowledge-content { font-size: 0.9375rem; line-height: 1.75; }
.knowledge-content h1, .knowledge-content h2, .knowledge-content h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; }
.knowledge-content p { margin-bottom: 0.75rem; }
.knowledge-content code { background: var(--code-bg); padding: 0.125rem 0.375rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.85em; }
.knowledge-content pre { background: var(--pre-bg); color: var(--pre-text); padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: 0.75rem; }
.knowledge-content pre code { background: none; padding: 0; color: inherit; }
.knowledge-content ul, .knowledge-content ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }

/* ── Notifications ── */
.notifications-page { max-width: 700px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.notifications-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.notifications-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 0.5rem; }
.notification-list { display: flex; flex-direction: column; gap: 0.5rem; }
.notification-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 0.875rem 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.notification-unread { border-left: 3px solid var(--primary); background: var(--primary-light); }
.notification-content strong { display: block; font-size: 0.8125rem; margin-bottom: 0.25rem; }
.notification-content p { font-size: 0.8125rem; margin-bottom: 0.25rem; }
.notification-time { font-size: 0.75rem; }
.notification-actions { display: flex; gap: 0.375rem; flex-shrink: 0; align-items: flex-start; }

/* ── Team page ── */
.team-page { max-width: 800px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.team-header { margin-bottom: 1.5rem; }
.team-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.team-settings { margin-bottom: 1.5rem; padding: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.team-settings h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.members-section { margin-bottom: 1.5rem; }
.members-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.invite-section { margin-bottom: 1.5rem; }
.invite-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.invite-form { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.invite-form .form-group { margin-bottom: 0; }
.pending-invites-section { margin-bottom: 1.5rem; }
.pending-invites-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }

/* ── Legal pages ── */
.legal-page { max-width: 700px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.legal-page h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.legal-page h2 { font-size: 1.125rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.legal-page p { margin-bottom: 0.75rem; font-size: 0.9375rem; line-height: 1.7; }

/* ── Utility ── */
.text-muted { color: var(--text-muted); font-size: 0.8125rem; }
.text-sm { font-size: 0.8125rem; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Kanban Board ── */
.board-page { padding: 0.75rem 1rem 2rem; }
.board-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; gap: 0.75rem; flex-wrap: wrap; }
.board-toolbar-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.view-toggle { display: flex; gap: 2px; background: var(--border); border-radius: var(--radius-sm); padding: 2px; }
.view-toggle .btn { border: none; border-radius: calc(var(--radius-sm) - 2px); }
.filter-select { padding: 0.3125rem 0.625rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.75rem; background: var(--input-bg); color: var(--text-secondary); cursor: pointer; }

.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; height: calc(100vh - 130px); }
.kanban-column { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow-sm); }
.kanban-column-over { outline: 2px solid var(--primary); outline-offset: -2px; }
.kanban-column-header { display: flex; align-items: center; justify-content: space-between; padding: 0.625rem 0.75rem; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; border-radius: var(--radius) var(--radius) 0 0; flex-shrink: 0; }
.kanban-header-backlog { background: #f1f5f9; color: #475569; border-bottom: 3px solid #94a3b8; }
.kanban-header-progress { background: #dbeafe; color: #1d4ed8; border-bottom: 3px solid #3b82f6; }
.kanban-header-review { background: #f5f3ff; color: #7c3aed; border-bottom: 3px solid #8b5cf6; }
.kanban-header-blocked { background: #fef2f2; color: #b91c1c; border-bottom: 3px solid #ef4444; }
.kanban-header-done { background: #f0fdf4; color: #15803d; border-bottom: 3px solid #22c55e; }
.kanban-count { font-size: 0.6875rem; font-weight: 700; opacity: 0.7; }
.kanban-cards { display: flex; flex-direction: column; gap: 0.375rem; flex: 1; overflow-y: auto; padding: 0.5rem; }

.kanban-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.625rem 0.75rem; cursor: grab; transition: box-shadow 0.15s, transform 0.1s; }
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transform: translateY(0); }
.kanban-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.25rem; }
.kanban-card-id { font-size: 0.625rem; font-weight: 600; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 0.02em; }
.kanban-card-name { font-size: 0.8125rem; font-weight: 500; color: var(--text); line-height: 1.4; word-break: break-word; }
.kanban-card-assignee { font-size: 0.6875rem; color: var(--text-muted); margin-top: 0.375rem; }

/* ── Fibonacci Layout ── */
.fib-page { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 52px); }
.fib-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; gap: 0.75rem; flex-wrap: wrap; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.fib-toolbar-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.fib-mobile { display: none; flex: 1; overflow-y: auto; }
.fib-section-header { position: sticky; top: 0; z-index: 10; padding: 0.375rem 1rem; font-size: 0.75rem; font-weight: 600; }
.fib-header-progress { background: var(--primary); color: #fff; }
.fib-header-todo { background: var(--hover-bg); color: var(--text-muted); border-bottom: 1px solid var(--border); }
.fib-header-done { background: var(--hover-bg); color: var(--text-muted); border-bottom: 1px solid var(--border); }
.fib-section-cards { }
.fib-bg-progress { background: var(--primary-light); }

.fib-desktop { display: grid; grid-template-columns: 61.8fr 38.2fr; flex: 1; min-height: 0; }

.fib-col-left { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.fib-col-right { display: flex; flex-direction: column; min-height: 0; }
.fib-right-top { border-bottom: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; flex: 1; }
.fib-right-bottom { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.fib-col-header { padding: 0.5rem 1rem; font-size: 0.75rem; font-weight: 600; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.fib-col-scroll { flex: 1; overflow-y: auto; }

.fib-card { display: block; padding: 0.625rem 1rem; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); transition: background 0.1s; }
.fib-card-row .fib-card { border-bottom: none; }
.fib-card:hover { background: var(--hover-bg); }
.fib-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.125rem; }
.fib-card-id { font-size: 0.625rem; font-weight: 600; color: var(--text-muted); font-family: var(--font-mono); }
.fib-card-name { font-size: 0.8125rem; font-weight: 500; line-height: 1.35; }
.fib-card-assignee { font-size: 0.6875rem; color: var(--text-muted); margin-top: 0.125rem; }
.fib-card-row { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.fib-card-grow { flex: 1; min-width: 0; }
.fib-start-form { flex-shrink: 0; padding: 0 0.75rem; }
.fib-empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.8125rem; }

/* ── Theme toggle ── */
.theme-toggle { background: none; border: none; cursor: pointer; padding: 0.375rem 0.5rem; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 1rem; line-height: 1; transition: color 0.15s; }
.theme-toggle:hover { color: var(--text); }

/* ── Billing page ── */
.billing-page { max-width: 800px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.billing-header { margin-bottom: 1.5rem; }
.billing-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.billing-current { margin-bottom: 2rem; padding: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.billing-current h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.plan-card { padding: 1.25rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; transition: border-color 0.15s, box-shadow 0.15s; }
.plan-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow); }
.plan-card-active { border-color: var(--primary); background: var(--primary-light); }
.plan-card h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.25rem; }
.plan-price { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin: 0.5rem 0; }
.plan-price span { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); }
.plan-features { list-style: none; text-align: left; margin: 1rem 0; font-size: 0.8125rem; }
.plan-features li { padding: 0.25rem 0; color: var(--text-secondary); }
.plan-features li::before { content: "✓ "; color: var(--success); font-weight: 600; }

/* ── Dark Mode ── */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f172a;
        --card-bg: #1e293b;
        --input-bg: #1e293b;
        --hover-bg: #1e293b;
        --text: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border: #334155;
        --border-hover: #475569;
        --primary-light: #172554;
        --danger-light: #450a0a;
        --success-light: #052e16;
        --warning-light: #451a03;
        --purple-light: #2e1065;
        --code-bg: #334155;
        --pre-bg: #020617;
        --pre-text: #e2e8f0;
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
        --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
    }
    :root:not([data-theme="light"]) .kanban-header-backlog { background: #1e293b; color: #94a3b8; border-color: #64748b; }
    :root:not([data-theme="light"]) .kanban-header-progress { background: #172554; color: #60a5fa; border-color: #3b82f6; }
    :root:not([data-theme="light"]) .kanban-header-review { background: #2e1065; color: #a78bfa; border-color: #8b5cf6; }
    :root:not([data-theme="light"]) .kanban-header-blocked { background: #450a0a; color: #fca5a5; border-color: #ef4444; }
    :root:not([data-theme="light"]) .kanban-header-done { background: #052e16; color: #86efac; border-color: #22c55e; }
    :root:not([data-theme="light"]) .fib-header-progress { background: var(--primary); }
    :root:not([data-theme="light"]) .badge-status-backlog { background: #334155; color: #94a3b8; }
    :root:not([data-theme="light"]) .badge-status-in_progress { background: #1e3a5f; color: #60a5fa; }
    :root:not([data-theme="light"]) .badge-priority-high { background: #431407; color: #fb923c; }
    :root:not([data-theme="light"]) .badge-priority-medium { background: #451a03; color: #fbbf24; }
    :root:not([data-theme="light"]) .badge-priority-low { background: #334155; color: #94a3b8; }
    :root:not([data-theme="light"]) .alert-error { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
    :root:not([data-theme="light"]) .alert-success { background: #052e16; color: #86efac; border-color: #166534; }
    :root:not([data-theme="light"]) .alert-info { background: #172554; color: #93c5fd; border-color: #1e40af; }
    :root:not([data-theme="light"]) .danger-zone { background: #450a0a; border-color: #7f1d1d; }
    :root:not([data-theme="light"]) .danger-zone h3 { color: #fca5a5; }
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --input-bg: #1e293b;
    --hover-bg: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-hover: #475569;
    --primary-light: #172554;
    --danger-light: #450a0a;
    --success-light: #052e16;
    --warning-light: #451a03;
    --purple-light: #2e1065;
    --code-bg: #334155;
    --pre-bg: #020617;
    --pre-text: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
}
[data-theme="dark"] .kanban-header-backlog { background: #1e293b; color: #94a3b8; border-color: #64748b; }
[data-theme="dark"] .kanban-header-progress { background: #172554; color: #60a5fa; border-color: #3b82f6; }
[data-theme="dark"] .kanban-header-review { background: #2e1065; color: #a78bfa; border-color: #8b5cf6; }
[data-theme="dark"] .kanban-header-blocked { background: #450a0a; color: #fca5a5; border-color: #ef4444; }
[data-theme="dark"] .kanban-header-done { background: #052e16; color: #86efac; border-color: #22c55e; }
[data-theme="dark"] .fib-header-progress { background: var(--primary); }
[data-theme="dark"] .badge-status-backlog { background: #334155; color: #94a3b8; }
[data-theme="dark"] .badge-status-in_progress { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .badge-priority-high { background: #431407; color: #fb923c; }
[data-theme="dark"] .badge-priority-medium { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .badge-priority-low { background: #334155; color: #94a3b8; }
[data-theme="dark"] .alert-error { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .alert-success { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .alert-info { background: #172554; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .danger-zone { background: #450a0a; border-color: #7f1d1d; }
[data-theme="dark"] .danger-zone h3 { color: #fca5a5; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .nav-toggle { display: flex; flex-direction: column; justify-content: center; }
    .nav-links { display: none; position: absolute; top: 52px; right: 0; width: 180px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); flex-direction: column; padding: 0.25rem; box-shadow: var(--shadow); z-index: 99; margin-top: 0.25rem; margin-right: 0.5rem; }
    .nav-links.open { display: flex; }
    .nav-link { padding: 0.375rem 0.625rem; font-size: 0.8125rem; }
    .workspace-switcher { margin-left: auto; margin-right: 0.375rem; }
    .ws-trigger-name { max-width: 100px; }
    .ws-dropdown { position: fixed; right: 0.5rem; left: auto; min-width: 260px; top: 56px; max-width: calc(100vw - 1rem); }

    .tasks-page, .dashboard, .team-page, .legal-page, .standups-page,
    .knowledge-page, .knowledge-edit, .knowledge-view, .notifications-page,
    .task-detail-page, .billing-page { padding: 1rem 1rem 2rem; }

    .kanban { grid-template-columns: 1fr; height: auto; max-height: calc(100vh - 120px); overflow-y: auto; gap: 0.375rem; padding: 0 0.5rem 1rem; }
    .kanban-column { min-height: 0; }
    .kanban-cards { max-height: 200px; }
    .kanban-column-header { border-radius: var(--radius-sm); }

    .fib-desktop { display: none; }
    .fib-mobile { display: block; }
    .fib-page { height: auto; }

    .create-task-form { flex-direction: column; }
    .create-task-form input[type="text"] { min-width: auto; }

    .time-grid { grid-template-columns: repeat(2, 1fr); }
    .task-edit-grid { grid-template-columns: 1fr; }

    .table { font-size: 0.75rem; }
    .table th, .table td { padding: 0.375rem 0.5rem; }
    .table .col-type, .table .col-points { display: none; }
    .table .col-id { width: 64px; font-size: 0.6875rem; }
    .table .col-assignee { width: 90px; }

    .notification-card { flex-direction: column; }
    .notification-actions { align-self: flex-start; }

    .knowledge-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

    .invite-form { flex-direction: column; align-items: stretch; }
}

/* Share link */
.share-link-section { margin-bottom: 1.5rem; }
.share-link-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; display: block; }
.share-link-row { display: flex; gap: 0.5rem; }
.share-link-input { flex: 1; font-size: 0.8125rem; padding: 0.375rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--code-bg); color: var(--text-secondary); }

@media (max-width: 480px) {
    .task-filters { gap: 0.25rem; }
    .task-filters .btn { padding: 0.25rem 0.5rem; font-size: 0.6875rem; }
    .status-buttons { flex-direction: column; }
    .status-buttons form { display: block; }
    .status-buttons .btn { width: 100%; }
}
