/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --sidebar-bg: #1e1e3a;
    --sidebar-text: #c4c4d4;
    --sidebar-active: rgba(255,255,255,0.12);
    --text: #172b4d;
    --muted: #6b778c;
    --border: #dfe1e6;
    --accent: #0079bf;
    --accent-hover: #026aa7;
    --success: #61bd4f;
    --danger: #eb5a46;
    --warn: #f2d600;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', 'Sarabun', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Login Screen ─────────────────────────────────────────────────────────── */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0079bf 0%, #1e1e3a 100%);
}
.login-screen.hidden { display: none; }
.login-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-header {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    margin-bottom: 4px;
}
.login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 28px;
}
.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
}
.login-footer a { color: var(--accent); font-weight: 600; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
textarea.form-input { resize: vertical; min-height: 60px; }
select.form-input { cursor: pointer; }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; display: none; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { opacity: 0.85; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-full { width: 100%; padding: 12px; }

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}
.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative;
}
#company-switcher {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: background 0.15s;
}
#company-switcher:hover { background: var(--sidebar-active); }
#current-company-name { font-size: 15px; font-weight: 600; color: white; }
.company-arrow { font-size: 10px; opacity: 0.6; }
.company-dropdown {
    display: none;
    position: absolute;
    top: 60px;
    left: 8px;
    right: 8px;
    background: #2a2a4a;
    border-radius: var(--radius);
    padding: 4px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}
.company-dropdown-item {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--sidebar-text);
    transition: background 0.1s;
}
.company-dropdown-item:hover { background: rgba(255,255,255,0.1); }
.company-dropdown-item.active { background: var(--accent); color: white; }

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    color: var(--sidebar-text);
    transition: all 0.15s;
}
.nav-item:hover { background: var(--sidebar-active); color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; font-weight: 600; }
.nav-logout { color: var(--danger); }
.nav-logout:hover { background: rgba(235,90,70,0.15); }

/* ─── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.header-title { font-size: 18px; font-weight: 700; }
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Board view needs special layout — no scroll on content, flex column */
.section-board .kanban-container {
    height: calc(100vh - 160px);
}

.section { display: none; }
.section.active { display: block; animation: fadeIn 0.15s ease; }
.section-board.active { display: flex; flex-direction: column; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Boards Grid ──────────────────────────────────────────────────────────── */
.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.board-card {
    height: 120px;
    border-radius: var(--radius);
    padding: 16px;
    color: white;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: opacity 0.15s;
    box-shadow: var(--shadow);
}
.board-card:hover { opacity: 0.9; }
.board-card-title { font-size: 16px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.board-card-star {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.board-card-star:hover { opacity: 1; }
.board-card-star.starred { opacity: 1; }

.board-card-new {
    background: rgba(0,0,0,0.04);
    border: 2px dashed var(--border);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    height: 120px;
    border-radius: var(--radius);
    cursor: pointer;
}
.board-card-new:hover { background: rgba(0,0,0,0.08); color: var(--text); }

/* ─── Board View / Kanban ──────────────────────────────────────────────────── */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    flex-shrink: 0;
}
.board-title-text {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    min-width: 40px;
    outline: none;
}
.board-title-text:focus {
    background: rgba(255,255,255,0.3);
}

.kanban-container {
    display: flex;
    gap: 12px;
    padding: 0 16px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
}
.kanban-container::-webkit-scrollbar { height: 10px; }
.kanban-container::-webkit-scrollbar-track { background: transparent; }
.kanban-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 5px; }

/* ─── Kanban List ──────────────────────────────────────────────────────────── */
.kb-list {
    min-width: 280px;
    max-width: 280px;
    background: #ebecf0;
    border-radius: var(--radius);
    padding: 8px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
}
.kb-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 4px;
}
.kb-list-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    flex: 1;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    outline: none;
    border: 2px solid transparent;
    background: none;
}
.kb-list-title:focus { background: white; border-color: var(--accent); }
.kb-list-count { color: var(--muted); font-size: 12px; margin-left: 8px; }
.kb-list-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 16px;
}
.kb-list-menu:hover { background: rgba(0,0,0,0.08); }

.kb-cards-container {
    flex: 1;
    overflow-y: auto;
    min-height: 8px;
    padding: 2px 0;
}
.kb-cards-container::-webkit-scrollbar { width: 6px; }
.kb-cards-container::-webkit-scrollbar-track { background: transparent; }
.kb-cards-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

.kb-cards-container.drag-over { background: rgba(0,121,191,0.08); border-radius: var(--radius-sm); }

.kb-add-card-btn {
    width: 100%;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: var(--radius);
    text-align: left;
    font-size: 13px;
    font-family: inherit;
    margin-top: 4px;
    transition: background 0.1s;
}
.kb-add-card-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); }

/* Add card inline form */
.kb-add-card-form { margin-top: 4px; }
.kb-add-card-form textarea {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 54px;
    box-shadow: var(--shadow);
}
.kb-add-card-form textarea:focus { outline: none; }
.kb-add-card-actions { display: flex; gap: 6px; margin-top: 6px; }

/* New list placeholder */
.kb-add-list {
    min-width: 280px;
    max-width: 280px;
    flex-shrink: 0;
}
.kb-add-list-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.24);
    border: none;
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
    opacity: 0.8;
}
.kb-add-list-btn:hover { background: rgba(255,255,255,0.4); opacity: 1; }
.kb-add-list-form {
    background: #ebecf0;
    border-radius: var(--radius);
    padding: 8px;
}
.kb-add-list-form input {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 6px;
}
.kb-add-list-form input:focus { outline: none; }

/* ─── Kanban Card ──────────────────────────────────────────────────────────── */
.kb-card {
    background: white;
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: box-shadow 0.15s, transform 0.1s;
    position: relative;
}
.kb-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.kb-card.dragging { opacity: 0.4; transform: rotate(2deg); }

.kb-card-cover {
    height: 32px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    margin: -8px -12px 8px;
}

.kb-card-labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.kb-card-label {
    height: 8px;
    width: 40px;
    border-radius: 4px;
    display: inline-block;
}

.kb-card-title { font-size: 14px; font-weight: 400; line-height: 1.4; word-break: break-word; }

.kb-card-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
}
.kb-card-badge {
    display: flex;
    align-items: center;
    gap: 3px;
}
.kb-card-badge.overdue { color: var(--danger); background: #fdf4f3; padding: 1px 6px; border-radius: 3px; }

.kb-card-members {
    display: flex;
    margin-left: auto;
}
.kb-card-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border: 2px solid white;
    margin-left: -4px;
}
.kb-card-avatar:first-child { margin-left: 0; }

/* Drop indicator */
.kb-drop-indicator {
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin: 2px 0;
}

/* ─── Card Detail Modal ────────────────────────────────────────────────────── */
.modal-card-detail {
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
}
.card-detail-cover {
    height: 80px;
    margin: -24px -24px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.card-detail-title {
    font-size: 20px;
    font-weight: 600;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
    color: var(--text);
    padding: 4px 0;
    margin-bottom: 4px;
    border-bottom: 2px solid transparent;
}
.card-detail-title:focus { outline: none; border-bottom-color: var(--accent); }
.card-detail-list-name { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.card-detail-section { margin-bottom: 20px; }
.card-detail-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-detail-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.card-detail-meta-item { min-width: 120px; }
.card-detail-meta-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }

.card-detail-labels { display: flex; gap: 6px; flex-wrap: wrap; }
.card-detail-label {
    padding: 4px 12px;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.card-detail-desc {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    color: var(--text);
    background: var(--bg);
}
.card-detail-desc:focus { outline: none; border-color: var(--accent); background: white; }

/* Comments */
.comment-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.comment-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
}
.comment-input:focus { outline: none; border-color: var(--accent); }
.comment-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-author { font-weight: 600; font-size: 13px; }
.comment-time { font-size: 11px; color: var(--muted); margin-left: 8px; }
.comment-text { font-size: 14px; margin-top: 2px; }
.comment-delete { font-size: 11px; color: var(--muted); cursor: pointer; margin-top: 2px; display: inline-block; }
.comment-delete:hover { color: var(--danger); }

/* Files */
.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}
.file-item a { font-size: 13px; font-weight: 500; flex: 1; }
.file-delete { cursor: pointer; color: var(--muted); font-size: 12px; }
.file-delete:hover { color: var(--danger); }

/* Activity */
.activity-item {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
}
.activity-item .comment-avatar { width: 28px; height: 28px; font-size: 10px; }
.activity-text { color: var(--muted); }
.activity-text strong { color: var(--text); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--muted); }

/* Card detail actions */
.card-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.card-action-btn {
    padding: 6px 12px;
    background: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    transition: background 0.1s;
}
.card-action-btn:hover { background: var(--border); }
.card-action-btn.danger { color: var(--danger); }
.card-action-btn.danger:hover { background: #fdf4f3; }

/* ─── Labels Picker ────────────────────────────────────────────────────────── */
.labels-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 0;
}
.label-option {
    width: 48px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.1s, transform 0.1s;
}
.label-option:hover { transform: scale(1.1); }
.label-option.selected { border-color: var(--text); }

/* ─── Priority Badge ──────────────────────────────────────────────────────── */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}
.priority-urgent { background: #fdf4f3; color: var(--danger); }
.priority-high { background: #fff8e1; color: #d29034; }
.priority-medium { background: #e3f2fd; color: var(--accent); }
.priority-low { background: #f1f8e9; color: #519839; }

/* ─── Color Picker ─────────────────────────────────────────────────────────── */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
    width: 40px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.1s, transform 0.1s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text); }

/* ─── Modals ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    position: relative;
    margin-bottom: 40px;
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    position: absolute;
    top: 12px;
    right: 12px;
    line-height: 1;
    z-index: 1;
}
.modal-close:hover { background: rgba(0,0,0,0.06); color: var(--text); }

/* ─── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.2s ease;
    max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Team ─────────────────────────────────────────────────────────────────── */
.team-table {
    width: 100%;
    border-collapse: collapse;
}
.team-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}
.team-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.role-owner { background: #fef3c7; color: #92400e; }
.role-admin { background: #dbeafe; color: #1e40af; }
.role-editor { background: #d1fae5; color: #065f46; }
.role-viewer { background: #f3f4f6; color: #6b7280; }

/* Invite link display */
.invite-link-box {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius);
    font-size: 13px;
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 8px;
}
.invite-link-box input {
    flex: 1;
    border: none;
    background: none;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
}

/* ─── Dashboard ────────────────────────────────────────────────────────────── */
.dashboard-welcome {
    margin-bottom: 32px;
}
.dashboard-welcome h2 {
    font-size: 24px;
    margin-bottom: 4px;
}
.dashboard-welcome p {
    color: var(--muted);
}
.dashboard-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 16px; margin-bottom: 16px; }

/* ─── Loading ──────────────────────────────────────────────────────────────── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--muted);
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .kb-list { min-width: 260px; max-width: 260px; }
    .boards-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .modal { margin: 0 12px; }
    .content { padding: 16px; }
}
