/* Tessellant Engage — Tessellant-web design system + kanban */

:root {
    --primary: #2b2f36;
    --secondary: #3d4351;
    --accent: #4b5563;
    --muted: #9ca3af;
    --surface: #ffffff;
    --pattern: #e5e7eb;
    --card-bg: #f9fafb;
}

[data-theme="dark"] {
    --primary: #e5e7eb;
    --secondary: #d1d5db;
    --accent: #9ca3af;
    --muted: #6b7280;
    --surface: #111317;
    --pattern: #252830;
    --card-bg: #181a24;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.8;
    color: var(--secondary);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */

h1 { font-size: 1.75rem; font-weight: 500; color: var(--primary); letter-spacing: 0.05em; line-height: 1.3; }
h2 { font-size: 1.25rem; font-weight: 600; color: var(--primary); line-height: 1.4; }
h3 { font-size: 1.0625rem; font-weight: 500; color: var(--primary); line-height: 1.5; }

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}
a:hover { border-bottom-color: var(--accent); }

/* --- Nav --- */

.nav { border-bottom: 1px solid var(--pattern); background: var(--surface); }
.nav-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 2rem;
    display: flex; align-items: center; justify-content: space-between; height: 3.5rem;
}
.nav-brand {
    display: flex; align-items: center; gap: 0.625rem;
    font-size: 0.9375rem; font-weight: 500; color: var(--primary);
    letter-spacing: 0.05em; border-bottom: none;
}
.nav-brand:hover { border-bottom: none; }
.nav-brand svg { width: 20px; height: 20px; }
.nav-breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--muted); }
.nav-breadcrumb a { color: var(--muted); border-bottom: none; }
.nav-breadcrumb a:hover { color: var(--primary); border-bottom: none; }
.nav-breadcrumb .sep { color: var(--pattern); }
.nav-user { display: flex; align-items: center; gap: 1rem; font-size: 0.8125rem; color: var(--muted); }
.nav-badge {
    font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--accent); padding: 0.25rem 0.5rem; border: 1px solid var(--pattern); border-radius: 0.25rem;
}

#theme-toggle {
    background: none; border: none; cursor: pointer; color: var(--muted);
    padding: 0.375rem; border-radius: 0.25rem; transition: color 0.2s; line-height: 0; font-size: 1.125rem;
}
#theme-toggle:hover { color: var(--accent); }

/* --- Page layout --- */

.page { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header p { color: var(--muted); font-size: 0.875rem; }

/* --- Cards --- */

.card {
    padding: 1.25rem 1.5rem; border: 1px solid var(--pattern); border-radius: 0.25rem;
    background: var(--card-bg); transition: border-color 0.2s;
}
.card:hover { border-color: var(--muted); }
.card-title { font-size: 0.9375rem; font-weight: 500; color: var(--primary); }
.card-meta { font-size: 0.8125rem; color: var(--muted); }

/* --- Buttons --- */

.btn {
    display: inline-flex; align-items: center; gap: 0.5rem; font-family: inherit;
    font-size: 0.8125rem; font-weight: 500; padding: 0.5rem 1rem;
    border: 1px solid var(--pattern); border-radius: 0.25rem;
    background: var(--card-bg); color: var(--primary); cursor: pointer; transition: border-color 0.2s;
}
.btn:hover { border-color: var(--muted); border-bottom-color: var(--muted); }
.btn-primary { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.btn-primary:hover { opacity: 0.9; border-color: var(--primary); }
.btn-sm { font-size: 0.75rem; padding: 0.375rem 0.75rem; }
.btn-danger { color: #ef4444; border-color: transparent; background: transparent; }
.btn-danger:hover { border-color: #fecaca; }

/* --- Tags --- */

.tag {
    display: inline-flex; align-items: center; font-size: 0.6875rem; font-weight: 500;
    color: var(--muted); padding: 0.125rem 0.375rem; background: var(--card-bg);
    border-radius: 3px; white-space: nowrap;
}
.tag-sm { font-size: 0.625rem; padding: 0.0625rem 0.25rem; }

/* Complexity tag colours */
.tag-simple { color: #16a34a; background: rgba(34,197,94,0.08); }
.tag-moderate { color: #d97706; background: rgba(245,158,11,0.08); }
.tag-complex { color: #dc2626; background: rgba(239,68,68,0.08); }
.tag-enterprise { color: #7c3aed; background: rgba(139,92,246,0.08); }

/* Column status tags */
.tag-identified { background: var(--card-bg); }
.tag-interested { color: #3b82f6; background: rgba(59,130,246,0.08); }
.tag-scoping { color: #d97706; background: rgba(245,158,11,0.08); }
.tag-in_progress { color: #ea580c; background: rgba(249,115,22,0.08); }
.tag-delivered { color: #16a34a; background: rgba(34,197,94,0.08); }
.tag-parked { color: var(--muted); background: var(--card-bg); }

/* --- Board layout --- */

.board {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(200px, 1fr);
    min-width: 100%;
    min-height: calc(100vh - 11rem);
    border-left: 1px solid var(--pattern);
}

.board-column {
    display: flex; flex-direction: column;
    border-right: 1px solid var(--pattern);
}
.board-column.collapsed { max-width: 40px; overflow: hidden; }

/* --- Column header --- */

.board-column-header {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.625rem; background: var(--surface);
    border-bottom: 1px solid var(--pattern);
}

.board-column-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
/* Status dot colours */
.dot-identified { background: #9ca3af; }
.dot-interested { background: #3b82f6; }
.dot-scoping { background: #f59e0b; }
.dot-in_progress { background: #f97316; }
.dot-delivered { background: #22c55e; }
.dot-parked { background: #6b7280; }
.dot-ai_suggested { background: #8b5cf6; }

.board-column-title { font-size: 0.8125rem; font-weight: 500; color: var(--secondary); }
.board-column-count { font-size: 0.6875rem; color: var(--muted); margin-left: auto; }

.collapse-toggle {
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: 0.8125rem; padding: 0.125rem; transition: color 0.2s; margin-left: 0.25rem;
}
.collapse-toggle:hover { color: var(--primary); }

/* --- Column body (dropzone) --- */

.board-column-body {
    flex: 1; display: flex; flex-direction: column;
    padding: 0; background: var(--surface);
}
.board-column-body:empty::after {
    content: 'Drag items here';
    display: block; padding: 2rem 1rem; text-align: center;
    font-size: 0.75rem; color: var(--muted); opacity: 0.4;
}

/* --- Kanban card --- */

.kanban-card {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0.5rem 0.625rem;
    background: var(--surface);
    border-bottom: 1px solid var(--pattern);
    cursor: pointer;
    transition: background-color 0.15s;
}
.kanban-card:hover { background: var(--card-bg); }
.kanban-card:active { cursor: grabbing; }

/* Complexity left border */
.kanban-card.complexity-simple { border-left: 3px solid #22c55e; }
.kanban-card.complexity-moderate { border-left: 3px solid #f59e0b; }
.kanban-card.complexity-complex { border-left: 3px solid #ef4444; }
.kanban-card.complexity-enterprise { border-left: 3px solid #8b5cf6; }

.kanban-card-title {
    font-size: 0.8125rem; font-weight: 500; color: var(--primary); line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.kanban-card-preview {
    font-size: 0.75rem; color: var(--muted); line-height: 1.5; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.kanban-card-meta {
    display: flex; align-items: center; gap: 0.375rem; margin-top: 2px; flex-wrap: wrap;
}
.kanban-card-hours { font-size: 0.6875rem; color: var(--muted); }
.kanban-card-notes { font-size: 0.6875rem; color: var(--muted); }

/* --- Card todo progress --- */

.kanban-card-todo-row {
    display: flex; align-items: center; gap: 0.375rem; margin-top: 2px;
}
.todo-progress-bar {
    flex: 1; height: 4px; background: var(--pattern); border-radius: 2px; overflow: hidden;
}
.todo-progress-fill {
    height: 100%; background: #22c55e; border-radius: 2px; transition: width 0.3s ease;
}
.todo-progress-count { font-size: 0.625rem; color: var(--muted); white-space: nowrap; }

/* --- Quick-add --- */

.quick-add { padding: 0.375rem 0.5rem; border-bottom: 1px solid var(--pattern); }
.quick-add input {
    width: 100%; font-family: inherit; font-size: 0.75rem;
    border: 1px dashed var(--pattern); border-radius: 3px;
    padding: 0.375rem 0.5rem; background: transparent; color: var(--secondary);
    outline: none; transition: border-color 0.2s, background-color 0.2s;
}
.quick-add input:focus { border-style: solid; border-color: var(--accent); background: var(--card-bg); }
.quick-add input::placeholder { color: var(--muted); opacity: 0.5; }

/* --- Board tabs --- */

.board-tabs {
    display: flex; align-items: center; gap: 0; margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--pattern);
}
.board-tab {
    font-family: inherit; font-size: 0.75rem; font-weight: 400; color: var(--muted);
    background: none; border: none; border-bottom: 2px solid transparent;
    padding: 0.5rem 0.75rem; cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.board-tab:hover { color: var(--primary); }
.board-tab.active { color: var(--primary); font-weight: 500; border-bottom-color: var(--primary); }

/* --- Slide-over panel --- */

.panel-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.15); z-index: 50;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.panel-overlay.open { opacity: 1; pointer-events: auto; }

.panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 90vw;
    background: var(--surface); border-left: 1px solid var(--pattern);
    z-index: 51; transform: translateX(100%); transition: transform 0.2s;
    display: flex; flex-direction: column; overflow-y: auto;
}
.panel.open { transform: translateX(0); }

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--pattern);
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.panel-body { padding: 1.25rem; flex: 1; }
.panel-footer {
    padding: 0.75rem 1.25rem; border-top: 1px solid var(--pattern);
    position: sticky; bottom: 0; background: var(--surface);
}

.panel-close {
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: 1.25rem; padding: 0.25rem; transition: color 0.2s;
}
.panel-close:hover { color: var(--primary); }

.panel-field { margin-bottom: 0.75rem; }
.panel-field label { margin-bottom: 0.25rem; }
.panel-field input, .panel-field select, .panel-field textarea { width: 100%; }
.panel-field textarea { min-height: 140px; resize: vertical; }
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }

.save-indicator {
    font-size: 0.6875rem; color: var(--muted); opacity: 0;
    transition: opacity 0.3s; margin-left: 0.5rem;
}
.save-indicator.show { opacity: 1; }

.btn-archive {
    color: #ef4444; border: none; background: transparent;
    font-family: inherit; font-size: 0.75rem; cursor: pointer;
    padding: 0.375rem 0.625rem; border-radius: 3px; transition: background-color 0.15s;
}
.btn-archive:hover { background: rgba(239,68,68,0.06); }

/* --- Collapsible panel sections --- */

.panel-section { border-top: 1px solid var(--pattern); padding-top: 0.75rem; margin-top: 1rem; }
.panel-section-header {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; user-select: none; margin-bottom: 0.5rem;
}
.panel-section-header label { cursor: pointer; margin-bottom: 0; }
.panel-section-toggle { font-size: 0.75rem; color: var(--muted); }
.panel-section-body {
    overflow: hidden; transition: max-height 0.2s ease, opacity 0.15s;
    max-height: 800px; opacity: 1;
}
.panel-section-body.collapsed { max-height: 0; opacity: 0; }

/* --- Todos / Checklist --- */

.todo-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.25rem 0; gap: 0.5rem;
}
.todo-label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8125rem; color: var(--secondary); cursor: pointer;
    text-transform: none; letter-spacing: normal; font-weight: 400; margin-bottom: 0;
}
.todo-check {
    appearance: none; -webkit-appearance: none;
    width: 16px; height: 16px; min-width: 16px;
    border: 1.5px solid var(--muted); border-radius: 50%;
    cursor: pointer; transition: all 0.15s; position: relative; background: transparent;
}
.todo-check:checked { background: #22c55e; border-color: #22c55e; }
.todo-check:checked::after {
    content: ''; position: absolute; left: 4px; top: 2px;
    width: 5px; height: 8px; border: solid white; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.todo-check:hover { border-color: var(--accent); }
.todo-done { text-decoration: line-through; color: var(--muted); opacity: 0.5; }
.todo-delete {
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: 0.8125rem; padding: 0 0.25rem; opacity: 0; transition: opacity 0.15s, color 0.15s;
}
.todo-item:hover .todo-delete { opacity: 1; }
.todo-delete:hover { color: #ef4444; }

/* --- Notes --- */

.note {
    background: var(--card-bg); border: 1px solid var(--pattern); border-radius: 3px;
    padding: 0.5rem; font-size: 0.8125rem;
}
.note-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.125rem; }
.note-author { font-weight: 500; color: var(--primary); font-size: 0.6875rem; }
.note-date { font-size: 0.6875rem; color: var(--muted); }
.note-content { color: var(--secondary); line-height: 1.5; }

.note-input-row { display: flex; gap: 0.375rem; margin-top: 0.5rem; }
.note-input-row input {
    flex: 1; font-family: inherit; font-size: 0.75rem;
    border: 1px solid var(--pattern); border-radius: 3px;
    padding: 0.375rem 0.5rem; background: var(--surface); color: var(--secondary);
    outline: none; transition: border-color 0.2s;
}
.note-input-row input:focus { border-color: var(--accent); }
.note-input-row input::placeholder { color: var(--muted); }

/* --- SortableJS --- */

.sortable-ghost { opacity: 0.3; }
.sortable-chosen { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.sortable-fallback { opacity: 0.9; box-shadow: 0 4px 12px rgba(0,0,0,0.12); border-radius: 3px; }
.sortable-drag { opacity: 0; }

/* --- Tables --- */

.table-wrap { border: 1px solid var(--pattern); border-radius: 0.25rem; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--card-bg); border-bottom: 1px solid var(--pattern); }
th { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--pattern); color: var(--secondary); }
tr:last-child td { border-bottom: none; }
tr:hover { background: var(--card-bg); }

/* --- Forms --- */

input, select, textarea {
    font-family: inherit; font-size: 0.8125rem; border: 1px solid var(--pattern); border-radius: 3px;
    padding: 0.375rem 0.5rem; background: var(--surface); color: var(--secondary);
    outline: none; transition: border-color 0.2s; width: 100%;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
label {
    display: block; font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem;
}

/* --- Utilities --- */

.text-muted { color: var(--muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: start; }
.justify-between { justify-content: space-between; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.hidden { display: none; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }

/* --- Empty state --- */

.empty-state {
    border: 1px solid var(--pattern); border-radius: 0.25rem;
    background: var(--card-bg); padding: 3rem 2rem; text-align: center; color: var(--muted);
}

/* --- Centre layout --- */

.centre-layout { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 3.5rem); }
.centre-card {
    border: 1px solid var(--pattern); border-radius: 0.25rem; background: var(--card-bg);
    padding: 3rem; max-width: 420px; width: 100%; text-align: center;
}
.centre-card h1 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.centre-card p { color: var(--muted); font-size: 0.875rem; margin-bottom: 1.5rem; }
.ms-btn {
    display: inline-flex; align-items: center; gap: 0.75rem;
    background: var(--primary); color: var(--surface); padding: 0.625rem 1.5rem;
    border-radius: 0.25rem; font-weight: 500; font-size: 0.875rem;
    border-bottom: none; transition: opacity 0.2s;
}
.ms-btn:hover { opacity: 0.9; border-bottom: none; }
.ms-btn svg { width: 18px; height: 18px; }

/* --- Responsive --- */

@media (max-width: 768px) {
    .nav-inner { padding: 0 1.5rem; }
    .page { padding: 1.5rem; }
    h1 { font-size: 1.375rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* --- Animations --- */

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeUp 0.4s ease forwards; }
@media (prefers-reduced-motion: reduce) { .animate-in { animation: none; } }
