/* ==== Shared layout (header, sidebar, page title) ==== */

:root {
    --bg-colour: #f0f0f0;
    --sidebar-colour: #0f172a;
    --dashboard-colour: #ffffff;
    --text-colour: #000000;

    /* Semantic status colours. Components reference these rather than raw
    hexes so a colour vision mode can swap the whole palette in one place. */
    --status-todo-bg: #fee2e2;
    --status-todo-fg: #b91c1c;

    --status-progress-bg: #fef3c7;
    --status-progress-fg: #b45309;

    --status-done-bg: #dcfce7;
    --status-done-fg: #15803d;

    --status-info-bg: #dbeafe;
    --status-info-fg: #1d4ed8;

    --status-neutral-bg: #f1f5f9;
    --status-neutral-fg: #475569;

    --accent: #3333ff;
    --accent-strong: #2563eb;

    --danger-bg: #ffe4e4;
    --danger-fg: #aa0000;

    --priority-normal: #3b82f6;
    --priority-high: #f59e0b;
    --priority-urgent: #ef4444;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
        'Helvetica Neue', sans-serif;

    margin: 0;
    background: var(--bg-colour);
    color: var(--text-colour);
}

/* ==== Dark mode ==== */

html.dark-mode body {
    color: #f5f5f5;
}

html.dark-mode .page-title h1,
html.dark-mode .page-title p,
html.dark-mode h1,
html.dark-mode h2,
html.dark-mode label {
    color: #f5f5f5;
}

html.dark-mode button {
    background: #4d4d4d;
    color: #fff;
}

html.dark-mode button:hover {
    background: #5c5c5c;
}

html.dark-mode .add-column-button,
html.dark-mode .cancel-task-button {
    background: #4d4d4d;
    color: #fff;
    border-color: #666;
}

html.dark-mode .add-column-button:hover,
html.dark-mode .cancel-task-button:hover {
    background: #5c5c5c;
}

.user-details {
    display: flex;
    gap: 10px;
    align-items: center;
}

.circle {
    width: 35px;
    height: 35px;

    line-height: 35px;

    border-radius: 50%;

    font-size: 20px;

    color: #fff;

    text-align: center;

    background: #5533ff;
}

/* ==== Shared sidebar and top bar (_sidebar.html, _topbar.html) ==== */

.layout {
    display: flex;
    align-items: flex-start;
}

/* Fills the window and stays put while the page scrolls, so Settings and
   the signed-in user sit at the bottom. --sidebar-colour is the user's
   theme choice. */
.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex-shrink: 0;
    width: 232px;
    height: calc(100vh / var(--font-scale, 1));
    box-sizing: border-box;
    padding: 14px 12px;
    overflow-y: auto;
    background: var(--sidebar-colour);
    color: #e2e8f0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.sidebar-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #3333ff;
}

.sidebar-logo svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-group,
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-label {
    margin: 0;
    padding: 0 12px 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Not the project switcher's own links, which have their own layout. */
.sidebar a:not(.sidebar-brand):not(:where(.project-switcher a)),
.sidebar .logout-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 36px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #cbd5e1;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.sidebar a:not(.sidebar-brand):not(:where(.project-switcher a)):hover,
.sidebar .logout-button:hover,
.sidebar .logout-button:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar a.active .sidebar-icon {
    color: #8ea2ff;
}

.sidebar a:focus-visible,
.sidebar .logout-button:focus-visible {
    outline: 2px solid #8ea2ff;
    outline-offset: -2px;
}

.sidebar-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar .logout-form {
    margin: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px 2px;
}

.sidebar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(142, 162, 255, 0.2);
    color: #c7d2fe;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    overflow: hidden;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    color: #94a3b8;
    font-size: 12px;
}

.app-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* --dashboard-colour is the user's theme choice for page surfaces. */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    box-sizing: border-box;
    padding: 10px 25px;
    background: var(--dashboard-colour);
    border-bottom: 1px solid var(--kb-card-border);
    zoom: var(--font-scale, 1);
}

.topbar svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    color: var(--kb-muted);
    font-size: 13px;
}

.topbar-breadcrumb svg {
    width: 14px;
    height: 14px;
}

.topbar-breadcrumb [aria-current] {
    color: var(--text-colour);
    font-weight: 500;
}

html.dark-mode .topbar-breadcrumb [aria-current] {
    color: #f5f5f5;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 280px;
    max-width: 100%;
    height: 36px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 10px;
    border: 1px solid var(--kb-chip-border);
    border-radius: 6px;
    color: var(--kb-muted);
}

.topbar-search:focus-within {
    border-color: var(--kb-link);
    box-shadow: 0 0 0 3px var(--td-focus-ring);
}

/* The id keeps this ahead of the generic dark-mode input rule. */
.topbar-search #topbar-search {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14px;
}

html.dark-mode .topbar-search #topbar-search {
    color: #f5f5f5;
}

.topbar-shortcut {
    padding: 0 5px;
    border: 1px solid var(--kb-chip-border);
    border-radius: 4px;
    color: var(--kb-muted);
    font-family: inherit;
    font-size: 11px;
    line-height: 18px;
}

.topbar-new-task {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: 6px;
    background: var(--td-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.topbar-new-task:hover {
    background: var(--td-primary-hover);
}

.topbar a:focus-visible {
    outline: 2px solid var(--kb-link);
    outline-offset: 2px;
}

/* On narrow screens the sidebar becomes a block above the page. */
@media (max-width: 760px) {
    .layout {
        flex-direction: column;
        align-items: stretch;
    }

    .layout .sidebar {
        min-height: 0;
    }

    .sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        width: 100%;
        height: auto;
    }

    .sidebar-brand {
        flex-basis: 100%;
        padding-bottom: 8px;
    }

    .sidebar-group,
    .sidebar-footer {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-label,
    .sidebar-user {
        display: none;
    }

    .sidebar-footer {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }

    .sidebar a:not(.sidebar-brand):not(:where(.project-switcher a)),
    .sidebar .logout-button {
        width: auto;
    }

    .app-main {
        min-height: 0;
    }

    .topbar-search {
        width: 100%;
    }
}

main {
    flex: 1;
    /* Lets wide content (the board) scroll inside main instead of
       stretching the whole page. */
    min-width: 0;

    padding: 25px;
}

.page-title {
    display: flex;

    justify-content: space-between;
    align-items: center;

    margin-bottom: 20px;
}

.page-title h1 {
    font-size: 24px;

    margin: 0 0 4px 0;
}

.page-title p {
    margin: 0;

    color: #666;

    font-size: 14px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

/* Small toggle buttons that open the Sprint progress and Find tasks panels. */
.page-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #eee;
    color: #333;
    border: 1px solid #999;
}

.page-toggle-button:hover,
.page-toggle-button[aria-expanded="true"] {
    background: #e2e2f8;
}

.page-toggle-badge {
    padding: 1px 7px;
    border-radius: 999px;
    background: #3333ff;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

/* Arrow points down while closed, up while open. */
.page-toggle-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.page-toggle-button[aria-expanded="true"] .page-toggle-arrow {
    transform: rotate(180deg);
}

html.dark-mode .page-toggle-button {
    background: #4d4d4d;
    color: #fff;
    border-color: #666;
}

html.dark-mode .page-toggle-button:hover,
html.dark-mode .page-toggle-button[aria-expanded="true"] {
    background: #5c5c5c;
}

@media (prefers-reduced-motion: reduce) {
    .page-toggle-arrow { transition: none; }
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    background: #3333ff;
    color: #fff;
    cursor: pointer;
}

button:hover {
    background: #5555ff;
}

.add-column-button {
    background: #eee;
    color: #333;
    border: 1px dashed #999;
}

.sprint-no {
    background: var(--status-info-bg);
    color: var(--status-info-fg);
}

/* ==== Home page ==== */

.home-hero {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 35px;
    margin-bottom: 25px;
}

.home-hero h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
}

.home-hero p {
    margin: 0;
    color: #666;
    font-size: 15px;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.quick-link-card {
    flex: 1;
    min-width: 200px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
}

.quick-link-card:hover {
    border-color: #3333ff;
    background: #f5f5ff;
}

.quick-link-card h3 {
    margin: 0 0 8px 0;
    color: #3333ff;
}

.quick-link-card p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.sprint-overview {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px 25px;
    margin-top: 15px;
}

.sprint-overview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.sprint-overview-head h2 {
    margin: 0;
    font-size: 16px;
}

.sprint-overview-stats {
    display: flex;
    flex-wrap: wrap;
}

.overview-stat {
    flex: 1;
    min-width: 120px;
    padding: 0 20px;
    border-left: 1px solid #eee;
}

.overview-stat:first-child {
    padding-left: 0;
    border-left: none;
}

.overview-stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.overview-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #111;
}

.overview-stat-value.in-progress {
    color: var(--status-progress-fg);
}

.overview-stat-value.done {
    color: var(--status-done-fg);
}

/* ==== Board page: see "Board (kanban)" further down this file ==== */

/* ==== Create Task modal ==== */

.task-modal {
    display: none;

    position: fixed;

    z-index: 1000;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    background: rgba(0, 0, 0, 0.4);

    justify-content: center;
    align-items: center;
}

.task-modal-content {
    width: 400px;

    background: white;

    padding: 25px;

    border-radius: 8px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.task-modal-content h2 {
    margin-top: 0;
}

.task-modal-content label {
    display: block;

    font-size: 14px;

    font-weight: bold;

    margin-top: 15px;
    margin-bottom: 5px;
}

.task-modal-content input,
.task-modal-content textarea,
.task-modal-content select {
    width: 100%;

    padding: 10px;

    box-sizing: border-box;

    border: 1px solid #ccc;

    border-radius: 4px;

    font-size: 14px;
}

.task-form-buttons {
    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 20px;
}

.cancel-task-button {
    background: #ddd;
    color: #333;
}

.cancel-task-button:hover {
    background: #ccc;
}
.danger-button { background: var(--danger-fg); color: #fff; }
.danger-button:hover { background: #8a0000; }
html.dark-mode .danger-button { background: #b91c1c; color: #fff; }
html.dark-mode .danger-button:hover { background: #dc2626; }

#delete-task-button { margin-top: 18px; margin-left: 8px; }
.delete-sprint-form { margin: 12px 0 0; }

.task-error {
    color: red;

    font-size: 13px;

    min-height: 18px;
}

/* ==== Settings page ==== */

/* One card per settings area; each opens its popup. Ids aren't needed:
   two classes already outrank the generic button and dark-mode rules. */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    max-width: 960px;
}

.settings-grid .settings-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--kb-card-border);
    border-radius: 12px;
    background: var(--kb-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--kb-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-grid .settings-card:hover {
    border-color: var(--kb-card-border-hover);
    background: var(--kb-surface);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
}

.settings-grid .settings-card:focus-visible {
    outline: 2px solid var(--kb-link);
    outline-offset: 2px;
}

.settings-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--kb-link) 12%, transparent);
    color: var(--kb-link);
}

.settings-card-icon .td-icon {
    width: 20px;
    height: 20px;
}

.settings-card-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.settings-card-title {
    font-size: 15px;
    font-weight: 600;
}

.settings-card-description {
    color: var(--kb-muted);
    font-size: 13px;
    line-height: 1.4;
}

.settings-card-chevron {
    color: var(--kb-muted);
}

/* ==== Colour customisation modal ==== */

.colour-field {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-top: 15px;
}

.colour-field label {
    margin-top: 0;
    margin-bottom: 0;
}

.task-modal-content input[type="color"] {
    width: 36px;
    height: 28px;

    padding: 2px;

    cursor: pointer;
}

.task-modal-content input[type="color"]:disabled {
    opacity: 0.5;

    cursor: not-allowed;
}

.colour-preview-section {
    margin-top: 30px;
    padding-top: 18px;

    border-top: 1px dashed #ccc;
}

.colour-preview-label {
    margin: 0 0 10px;

    font-size: 12px;
    font-weight: bold;

    color: #999;

    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.colour-preview {
    display: flex;

    gap: 10px;
}

.preview-swatch {
    flex: 1;

    padding: 16px 10px;

    border: 1px solid #ccc;
    border-radius: 6px;

    text-align: center;
}

.preview-swatch p {
    margin: 0;
}

.preview-text-small {
    margin-bottom: 6px;

    font-size: 12px;
    font-weight: normal;
}

.preview-text-large {
    font-size: 18px;
    font-weight: bold;
}

.task-modal-content input.dark-mode-toggle {
    width: 15px;
    height: 15px;

    margin: 0;
    padding: 0;

    accent-color: #3333ff;

    cursor: pointer;
}

.colour-warning {
    margin-top: 20px;

    padding: 6px 10px;

    background: #fff8e1;
    border: 1px solid #f0d783;
    border-radius: 6px;

    color: #8a6100;

    font-size: 10px;
    font-weight: bold;
}

/* ==== Sprint management page ==== */

/* Sprints on the left, the Create sprint card beside them. Cards use the
   board's --kb-* colours like Home's. */
.sprints-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 24px;
    align-items: start;
    max-width: 1240px;
}

.sprints-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.sprints-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sprints-page .sprints-group h2 {
    margin: 0;
    color: var(--kb-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

html.dark-mode .sprints-page .sprints-group h2 {
    color: var(--kb-muted);
}

.sprint-card,
.create-sprint-section,
.empty-sprints {
    box-sizing: border-box;
    background: var(--kb-surface);
    border: 1px solid var(--kb-card-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--kb-text);
}

.sprint-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
}

.sprint-card.is-current {
    border-color: color-mix(in srgb, var(--kb-link) 45%, var(--kb-card-border));
}

.sprint-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sprint-card-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.sprints-page .sprint-card h3 {
    margin: 0;
    color: var(--kb-text);
    font-size: 16px;
    font-weight: 600;
}

.sprint-status {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--kb-link) 14%, transparent);
    color: var(--kb-text);
    font-size: 12px;
    font-weight: 500;
}

.sprint-status.sprint-status-active {
    background: color-mix(in srgb, var(--col-done) 18%, transparent);
}

.sprint-status.sprint-status-completed {
    background: var(--kb-hover);
    color: var(--kb-muted);
}

.sprint-card-dates {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--kb-muted);
    font-size: 13px;
}

.sprint-card-dates strong {
    color: var(--kb-text);
    font-weight: 500;
}

.sprint-card-goal {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--td-subtle);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sprint-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sprint-card-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--kb-chip-border);
    border-radius: 6px;
    color: var(--kb-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.sprint-card-links a:hover {
    background: var(--kb-hover);
}

/* Product Owner only; kept apart from the links, on the right. */
.sprint-card-links .delete-sprint-form {
    margin: 0 0 0 auto;
}

.sprint-card-links .sprint-card-delete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, #dc2626 45%, transparent);
    border-radius: 6px;
    background: transparent;
    color: #dc2626;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.sprint-card-links .sprint-card-delete:hover {
    background: color-mix(in srgb, #dc2626 10%, transparent);
}

html.dark-mode .sprint-card-links .sprint-card-delete {
    color: #f87171;
}

.sprints-page a:focus-visible {
    outline: 2px solid var(--kb-link);
    outline-offset: 2px;
}

.empty-sprints {
    padding: 24px 20px;
    border-style: dashed;
    text-align: center;
}

.empty-sprints p {
    margin: 4px 0;
}

/* Stays in view while a long list of sprints scrolls. */
.create-sprint-section {
    position: sticky;
    top: 16px;
    padding: 20px;
}

.sprints-page .create-sprint-section h2 {
    margin: 0 0 14px;
    color: var(--kb-text);
    font-size: 16px;
    font-weight: 600;
}

#create-sprint-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#sprint-create-card .td-button-primary {
    justify-content: center;
    width: 100%;
}

.sprint-errors {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, #dc2626 35%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, #dc2626 8%, var(--kb-surface));
    color: #b91c1c;
    font-size: 13px;
}

.sprint-errors p {
    margin: 0;
}

.sprint-errors p + p {
    margin-top: 4px;
}

html.dark-mode .sprint-errors {
    color: #fca5a5;
}

@media (max-width: 1000px) {
    .sprints-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The form comes first when the columns stack. */
    .create-sprint-section {
        position: static;
        order: -1;
    }
}

/* ==== Sprint Progress page ==== */

:root {
    --sp-muted: #64748b;
    --sp-line: #e9ecf1;
    --sp-green: var(--status-done-fg);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.metric {
    background: #fff;
    border: 1px solid var(--sp-line);
    border-radius: 6px;
    padding: 20px;
}

.metric-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--sp-muted);
}

.metric-value {
    font-size: 30px;
    font-weight: 800;
    margin: 10px 0 6px;
}

.metric-value.pos {
    color: var(--status-done-fg);
}

.metric-note {
    font-size: 13px;
    color: var(--sp-muted);
}

.burnup {
    background: #fff;
    border: 1px solid var(--sp-line);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.burnup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.burnup-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
}

.pill-burn {
    font-size: 12px;
    font-weight: 700;
    color: var(--status-done-fg);
    background: var(--status-done-bg);
    padding: 4px 10px;
    border-radius: 999px;
}

.burnup-meta {
    font-size: 13px;
    color: var(--sp-muted);
}

.bar {
    height: 14px;
    border-radius: 999px;
    background: #e9ebef;
    overflow: hidden;
}

.bar>span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--sp-green);
}

.progress-fill {
    width: var(--progress-width);
}

.lanes {
    background: #fff;
    border: 1px solid var(--sp-line);
    border-radius: 6px;
    overflow: hidden;
}

.lane-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.6fr;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eff1f4;
}

.lane-row:last-child {
    border-bottom: 0;
}

.lane-head {
    padding: 14px 20px;
    background: #fafbfc;
    border-bottom: 1px solid #eceef2;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--sp-muted);
}

.lane-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #94a3b8;
}

/* Same colours as the board's status columns. */
.dot.status-not-started { background: var(--col-todo); }
.dot.status-in-progress { background: var(--col-progress); }
.dot.status-on-hold { background: var(--col-hold); }
.dot.status-cancelled { background: var(--col-cancelled); }
.dot.status-done { background: var(--col-done); }

.lane-tasks {
    font-size: 14px;
    color: #475569;
}

.lane-points {
    font-size: 14px;
    font-weight: 600;
}

.lane-linked {
    font-size: 14px;
    color: var(--sp-muted);
    font-style: italic;
}

/* Login */

.login-page {
    display: grid;
    min-height: 100vh;
    margin: 0;
    place-items: center;
    background: #f0f0f0;
    color: #172033;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-panel {
    width: min(420px, calc(100% - 40px));
    box-sizing: border-box;
    padding: 36px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.12);
}

.login-brand {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    border-radius: 10px;
    place-items: center;
    background: #5533ff;
    color: #fff;
    font-weight: 700;
}

.login-product {
    margin: 0 0 24px;
    color: #475569;
    font-weight: 600;
}

.login-panel h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.login-introduction {
    margin: 0 0 24px;
    color: #64748b;
}

.login-error {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid var(--danger-fg);
    border-radius: 5px;
    background: #fff1f1;
    color: var(--danger-fg);
    font-size: 14px;
}

.login-notice {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid var(--status-done-fg);
    border-radius: 5px;
    background: var(--status-done-bg);
    color: var(--status-done-fg);
    font-size: 14px;
}

.resend-hint {
    margin: 10px 0 0;
    font-size: 14px;
}

.login-form button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.login-forgot {
    margin: 16px 0 0;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-form label {
    margin: 14px 0 6px;
    font-size: 14px;
    font-weight: 650;
}

.login-form input,
.login-form select {
    box-sizing: border-box;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #b8c0cc;
    border-radius: 5px;
    font: inherit;
}

.login-form input:focus,
.login-form select:focus {
    border-color: #3333ff;
    outline: 3px solid #dedcff;
}

.password-field {
    position: relative;
    display: flex;
}

.password-field input {
    padding-right: 64px;
}

.login-form .password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    margin-top: 0;
    transform: translateY(-50%);
    padding: 4px 10px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: #3333ff;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
}

.login-form .password-toggle:hover {
    background: #eeedff;
}

.login-form button {
    margin-top: 24px;
    padding: 12px 18px;
    border: 0;
    border-radius: 5px;
    background: #3333ff;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
}

.login-form button:hover {
    background: #2424d8;
}

.back-home-link {
    position: fixed;
    top: 16px;
    left: 16px;
    padding: 6px 10px;
    border-radius: 5px;
    color: #64748b;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.back-home-link:hover {
    background: #e9eaf2;
    color: #3333ff;
}

/* Front page */

.front-page-panel {
    width: min(480px, calc(100% - 40px));
    text-align: center;
}

.front-page-panel .login-brand {
    margin-right: auto;
    margin-left: auto;
}

.front-page-panel h1 {
    font-size: 26px;
    line-height: 1.3;
}

.front-page-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.front-page-button {
    flex: 1;
    box-sizing: border-box;
    padding: 12px 18px;
    border: 1px solid #3333ff;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 650;
    text-align: center;
}

.front-page-button-primary {
    background: #3333ff;
    color: #fff;
}

.front-page-button-primary:hover {
    background: #2424d8;
}

.front-page-button-secondary {
    background: #fff;
    color: #3333ff;
}

.front-page-button-secondary:hover {
    background: #eeedff;
}

@media (max-width: 420px) {
    .front-page-actions {
        flex-direction: column;
    }
}

.member-form {
    max-width: 420px;
}

/* ==== Members page ==== */

.member-notice {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 6px;

    /* Success feedback, not a task status — stays green in every colour
       mode so it doesn't follow the Done palette. */
    background: #dcfce7;
    color: #166534;
}

.member-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.member-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.member-stat-label {
    margin: 0 0 4px;
    color: #6b7280;
    font-size: 13px;
}

.member-stat-value {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.member-stat-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eff6ff;
    color: var(--accent-strong);
}


.member-table-wrap {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.member-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.member-table th {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.member-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.member-table tbody tr:last-child td {
    border-bottom: 0;
}

.member-identity {
    display: flex;
    gap: 12px;
    align-items: center;
}

.member-avatar {
    display: inline-flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

/* Avatar colours, picked per member by auth_service.AVATAR_COLOUR_COUNT. */
.avatar-0 { background: #2563eb; }
.avatar-1 { background: #f97316; }
.avatar-2 { background: #22c55e; }
.avatar-3 { background: #8b5cf6; }
.avatar-4 { background: #ec4899; }
.avatar-5 { background: #0ea5e9; }
.avatar-6 { background: #eab308; }
.avatar-7 { background: #ef4444; }

.member-name {
    margin: 0;
    font-weight: 600;
}

.member-username {
    margin: 2px 0 0;
    color: #6b7280;
    font-size: 12px;
}

.member-you {
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.member-muted {
    color: #6b7280;
}





.member-empty {
    color: #6b7280;
    text-align: center;
}

.add-member {
    margin-top: 24px;
}

.add-member summary {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 5px;
    background: #3333ff;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.add-member summary::-webkit-details-marker {
    display: none;
}

.add-member[open] summary {
    margin-bottom: 16px;
}

html.dark-mode .member-stat,
html.dark-mode .member-table-wrap {
    background: var(--bg-colour);
    border-color: #555;
}

html.dark-mode .member-table th {
    background: #2e2e2e;
    border-color: #555;
}

html.dark-mode .member-table td {
    border-color: #444;
}

html.dark-mode .member-stat-label,
html.dark-mode .member-username,
html.dark-mode .member-muted,
html.dark-mode .member-table th {
    color: #cbd5e1;
}

/* ==== Members page: actions menu & edit panel ==== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.member-actions-cell {
    width: 1%;
    text-align: right;
}

.member-actions {
    position: relative;
    display: inline-block;
}

.member-actions summary {
    padding: 2px 10px;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    list-style: none;
}

.member-actions summary::-webkit-details-marker {
    display: none;
}

.member-actions summary:hover,
.member-actions[open] summary {
    background: #f3f4f6;
}

.member-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 10;
    min-width: 150px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    text-align: left;
}

.member-menu a,
.member-menu button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 5px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
}

.member-menu form {
    margin: 0;
}

.member-menu a:hover,
.member-menu button:hover {
    background: #f3f4f6;
}

.member-menu button.danger {
    color: var(--danger-fg);
}

.edit-member {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.edit-member h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.edit-member-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

.edit-member-buttons button {
    margin-top: 0;
}

.edit-member-cancel {
    color: #3333ff;
    font-weight: 600;
    text-decoration: none;
}

/* Wide screens: let the actions menu overflow the table. Narrow screens:
   scroll the table sideways and open the menu inline instead. */
@media (min-width: 761px) {
    .member-table-wrap {
        overflow: visible;
    }

    .member-table thead th:first-child {
        border-top-left-radius: 10px;
    }

    .member-table thead th:last-child {
        border-top-right-radius: 10px;
    }
}

@media (max-width: 760px) {
    .member-menu {
        position: static;
        margin-top: 4px;
        box-shadow: none;
    }
}

html.dark-mode .member-menu,
html.dark-mode .edit-member {
    background: var(--bg-colour);
    border-color: #555;
}

html.dark-mode .member-actions summary {
    color: #cbd5e1;
}

html.dark-mode .member-actions summary:hover,
html.dark-mode .member-actions[open] summary,
html.dark-mode .member-menu a:hover,
html.dark-mode .member-menu button:hover {
    background: #3a3a3a;
}

html.dark-mode .member-menu button {
    background: none;
}

html.dark-mode .member-menu button.danger {
    color: #f87171;
}

/* ==== Dark mode: card boxes & form fields ==== */

html.dark-mode .home-hero,
html.dark-mode .quick-link-card,
html.dark-mode .sprint-overview,
html.dark-mode .task-modal-content,
html.dark-mode .metric,
html.dark-mode .burnup,
html.dark-mode .lanes,
html.dark-mode .lane-head {
    background: var(--bg-colour);
    border-color: #555;
}

html.dark-mode .quick-link-card:hover {
    background: #3a3a3a;
}

html.dark-mode input:not([type="color"]),
html.dark-mode textarea,
html.dark-mode select {
    background: var(--bg-colour);
    color: #f5f5f5;
    border-color: #555;
}

html.dark-mode .home-hero p,
html.dark-mode .quick-link-card p,
html.dark-mode .overview-stat-label,
html.dark-mode .overview-stat-value:not(.in-progress):not(.done),
html.dark-mode .metric-label,
html.dark-mode .metric-note,
html.dark-mode .burnup-meta,
html.dark-mode .lane-tasks,
html.dark-mode .lane-linked,
html.dark-mode .lane-head {
    color: #f5f5f5;
}

/* ==== Calendar View ==== */

.calendar-controls {
    display: flex;

    justify-content: space-between;
    align-items: center;

    margin-bottom: 16px;
}

.calendar-month-nav {
    display: flex;

    align-items: center;

    gap: 12px;
}

.calendar-month-label {
    font-size: 20px;

    margin: 0;

    min-width: 180px;
}

.calendar-nav-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    background: #fff;

    border: 1px solid #ddd;
    border-radius: 6px;

    color: #334155;

    text-decoration: none;

    font-size: 18px;
    line-height: 1;
}

.calendar-nav-button:hover {
    background: #f1f5f9;
}

.calendar-view-pill {
    background: var(--status-info-bg);

    color: var(--status-info-fg);

    padding: 6px 16px;

    border-radius: 999px;

    font-size: 14px;
}

.calendar-grid {
    display: grid;

    grid-template-columns: repeat(7, 1fr);

    background: #fff;

    border: 1px solid #ddd;
    border-radius: 8px;

    overflow: hidden;
}

.calendar-weekday {
    padding: 12px;

    font-size: 13px;

    color: #64748b;

    border-bottom: 1px solid #ddd;
}

.calendar-day {
    min-height: 90px;

    padding: 10px;

    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* The seven weekday headers are also grid children, so day cells in the
   Sunday column land on children 14, 21, 28 ... i.e. every 7th. */
.calendar-day:nth-child(7n) {
    border-right: none;
}

/* Today: a filled circle on the date rather than a shaded cell. */
.calendar-day-head {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.calendar-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    box-sizing: border-box;
    padding: 0 6px;
    border-radius: 999px;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
}

.calendar-day.today .calendar-day-number {
    background: #3333ff;
    color: #fff;
    font-weight: 600;
}

.calendar-day.outside-month .calendar-day-number {
    color: #cbd5e1;
}

/* Each sprint milestone and task is its own chip, stacked with a gap. */
.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.calendar-event {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.35;
}

.calendar-event .td-icon {
    width: 13px;
    height: 13px;
    margin-top: 1px;
}

/* Starts are green, ends amber, so a sprint's span reads at a glance. */
.calendar-event.sprint {
    font-weight: 600;
}

.calendar-event.sprint-start {
    background: color-mix(in srgb, var(--col-done) 16%, transparent);
    color: var(--status-done-fg);
}

.calendar-event.sprint-end {
    background: color-mix(in srgb, var(--col-testing) 18%, transparent);
    color: var(--status-progress-fg);
}

.calendar-task {
    border: 1px solid var(--kb-card-border);
    background: var(--kb-card-bg);
    color: var(--kb-text);
    text-decoration: none;
}

.calendar-task:hover {
    border-color: var(--kb-card-border-hover);
    background: var(--kb-surface);
}

.calendar-task:focus-visible {
    outline: 2px solid var(--kb-link);
    outline-offset: 1px;
}

.calendar-task-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    margin-top: 5px;
    border-radius: 50%;
}

.calendar-task-title {
    display: -webkit-box;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.calendar-task.is-finished .calendar-task-title {
    color: var(--kb-muted);
    text-decoration: line-through;
}

/* Just the flag: its colour gives the priority; the text is for screen readers. */
.calendar-event .priority-tag.calendar-priority {
    flex-shrink: 0;
    margin: 1px 0 0;
    padding: 0;
    border: 0;
    font-size: 12px;
}

/* ---- Dark mode ---- */

html.dark-mode .calendar-grid,
html.dark-mode .calendar-nav-button {
    background: #2a2a2a;
    border-color: #444;
}

html.dark-mode .calendar-nav-button {
    color: #f5f5f5;
}

html.dark-mode .calendar-nav-button:hover {
    background: #3a3a3a;
}

html.dark-mode .calendar-weekday {
    color: #aaa;

    border-bottom-color: #444;
}

html.dark-mode .calendar-day {
    border-right-color: #3a3a3a;
    border-bottom-color: #3a3a3a;
}

html.dark-mode .calendar-day-number {
    color: #e5e5e5;
}

html.dark-mode .calendar-day.today .calendar-day-number {
    color: #fff;
}

html.dark-mode .calendar-day.outside-month .calendar-day-number {
    color: #666;
}

html.dark-mode .calendar-event.sprint-start {
    color: var(--status-done-fg);
}

html.dark-mode .calendar-event.sprint-end {
    color: var(--status-progress-fg);
}

.priority-tag {
    --flag-colour: var(--priority-normal);

    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid #d4d4d8;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
    white-space: nowrap;
    color: inherit;
}

.priority-tag.priority-high {
    --flag-colour: var(--priority-high);
}
.priority-tag.priority-urgent {
    --flag-colour: var(--priority-urgent);
}

.priority-flag {
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    background: var(--flag-colour);
    -webkit-mask: var(--flag-icon) center / contain no-repeat;
    mask: var(--flag-icon) center / contain no-repeat;
}

:root {
    --flag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 2v20h2v-8h6l1 2h7V4h-7l-1-2z'/%3E%3C/svg%3E");
}

html.dark-mode .priority-tag {
    border-color: #666;
}

/* ==== Account settings ==== */

.task-success {
    color: #166534;
    font-size: 13px;
    min-height: 18px;
}

.task-modal-content input:disabled {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

html.dark-mode .task-success {
    color: #86efac;
}

html.dark-mode .task-modal-content input:disabled {
    background: #3a3a3a;
    color: #aaa;
}
/* ==== Activity History page ==== */

.activity-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.activity-filter {
    display: flex;
    flex: 1 1 170px;
    flex-direction: column;
    gap: 6px;
}

.activity-filter label {
    color: #6b7280;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.activity-filter select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-size: 14px;
}

.activity-filter-buttons {
    display: flex;
    gap: 8px;
}

/* Same height as the shared 38px dropdowns beside it. */
.activity-clear {
    display: inline-flex;
    align-items: center;
    height: 38px;
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f3f4f6;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.activity-clear:hover {
    background: #e5e7eb;
}

.activity-log {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.activity-log-title {
    margin: 0;
    padding: 12px 18px;
    border-bottom: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.activity-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 18px;
    border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar-none {
    background: #9ca3af;
}

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-headline,
.activity-detail {
    margin: 0;
    font-size: 14px;
}

.activity-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
    margin-top: 5px;
}

.activity-target {
    color: var(--status-info-fg);
    overflow-wrap: anywhere;
}

.activity-change {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.activity-field {
    color: #6b7280;
    font-size: 12px;
}

.activity-pill {
    padding: 2px 7px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #374151;
    font-size: 12px;
}

.activity-pill-new {
    background: var(--status-info-bg);
    color: var(--status-info-fg);
    font-weight: 600;
}

.activity-pill.priority-high {
    background: var(--status-progress-bg);
    color: var(--status-progress-fg);
}

.activity-pill.priority-urgent {
    background: var(--status-todo-bg);
    color: var(--status-todo-fg);
}

.activity-arrow {
    color: #9ca3af;
}

.activity-time {
    flex-shrink: 0;
    color: #9ca3af;
    font-size: 13px;
    white-space: nowrap;
}

.activity-clock {
    color: #4b5563;
}

.activity-empty {
    margin: 0;
    padding: 28px 18px;
    color: #6b7280;
    text-align: center;
}

@media (max-width: 760px) {
    .activity-item {
        flex-wrap: wrap;
    }

    .activity-time {
        order: -1;
        width: 100%;
    }
}

html.dark-mode .activity-filters,
html.dark-mode .activity-log {
    background: var(--bg-colour);
    border-color: #555;
}

html.dark-mode .activity-log-title,
html.dark-mode .activity-item {
    border-color: #444;
}

html.dark-mode .activity-filter label,
html.dark-mode .activity-log-title,
html.dark-mode .activity-field,
html.dark-mode .activity-empty {
    color: #aaa;
}

html.dark-mode .activity-clear,
html.dark-mode .activity-pill {
    background: #3a3a3a;
    border-color: #555;
    color: #e5e5e5;
}

html.dark-mode .activity-pill-new,
html.dark-mode .activity-target {
    color: #93c5fd;
}

html.dark-mode .activity-pill-new {
    background: #1e3a5f;
}

html.dark-mode .activity-clock {
    color: #ccc;
}

/* ==== Two-factor authentication ==== */

.two-factor-status,
.two-factor-help {
    margin: 8px 0;
    font-size: 14px;
}

.two-factor-qr {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

/* White background so the code stays scannable in dark mode. */
.two-factor-qr svg {
    width: 200px;
    height: 200px;
    padding: 8px;
    background: #fff;
}

.two-factor-secret {
    word-break: break-all;
    font-size: 13px;
}

html.dark-mode .two-factor-status,
html.dark-mode .two-factor-help {
    color: #f5f5f5;
}

/* ==== Board sprint summary bar ==== */



main {
    zoom: var(--font-scale, 1);
}

.sidebar {
    zoom: var(--font-scale, 1);
    /* zoom also multiplies heights, so divide by the scale to keep the
       sidebar exactly the height of the viewport instead of overflowing it. */
    min-height: calc(100vh / var(--font-scale, 1));
}

.font-size-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.font-size-slider-row input[type="range"] {
    flex: 1;
    padding: 0;
    cursor: pointer;
}

.font-size-slider-row span {
    font-size: 12px;
    color: #6b7280;
}

.font-size-value {
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
}

.font-size-preview {
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed #999;
    border-radius: 6px;
    overflow-wrap: anywhere;
}

.font-size-preview-title {
    margin: 0 0 6px;
    font-weight: bold;
}

.font-size-preview-body {
    margin: 0;
}

html.dark-mode .font-size-slider-row span {
    color: #aaa;
}
/* ==== Board (kanban) ==== */

:root {
    --kb-card-bg: #ffffff;
    --kb-card-border: #e3e4e8;
    --kb-card-border-hover: #c6c9d0;
    --kb-text: #292d34;
    --kb-muted: #646a73;
    --kb-chip-border: #e3e4e8;
    --kb-surface: #ffffff;
    --kb-hover: rgba(15, 23, 42, 0.06);
    --kb-link: #4466ff;
}

html.dark-mode {
    --kb-card-bg: #262626;
    --kb-card-border: #3a3a3a;
    --kb-card-border-hover: #555;
    --kb-text: #f1f1f1;
    --kb-muted: #a3a3a3;
    --kb-chip-border: #444;
    --kb-surface: #1c1c1c;
    --kb-hover: rgba(255, 255, 255, 0.08);
    --kb-link: #8ea2ff;
}

/* Columns stay on one row; once they no longer fit, the board scrolls
   sideways instead of wrapping onto a new row. */
#board {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding-bottom: 10px;
    overflow-x: auto;
}

/* Each column is a softly tinted panel that grows with its cards,
   like ClickUp's board groups. */
.column {
    --column-accent: var(--col-todo);

    display: flex;
    flex-direction: column;
    flex: 0 0 272px;
    width: 272px;
    max-height: calc(100vh / var(--font-scale, 1) - 110px);
    box-sizing: border-box;
    padding: 0 0 4px;
    background: color-mix(in srgb, var(--column-accent) 9%, var(--kb-surface));
    border-radius: 10px;
    transition: background 0.15s ease;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 8px 8px 8px 8px;
}

.column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    font-size: 12px;
}

.column-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 3px 8px 3px 6px;
    border-radius: 5px;
    background: var(--column-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 16px;
    text-transform: uppercase;
}

.column-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status ring, like ClickUp's status icon. */
.column-dot {
    flex-shrink: 0;
    width: 11px;
    height: 11px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 1.5px var(--column-accent), inset 0 0 0 4px currentColor;
}

/* The neutral Backlog column uses an outlined pill instead. */
.column.column-neutral .column-status-pill {
    background: var(--kb-surface);
    color: var(--kb-text);
    box-shadow: inset 0 0 0 1px var(--kb-card-border);
}

.column.column-neutral .column-dot {
    border-style: dashed;
    border-color: var(--kb-muted);
    box-shadow: none;
}

.column .count {
    color: var(--column-accent);
    font-size: 13px;
    font-weight: 600;
}

.column.column-neutral .count {
    color: var(--kb-muted);
}

html.dark-mode .column .column-title {
    color: inherit;
}

.column-points {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--kb-muted);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.column-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.column-header:hover .column-points,
.column-header:hover .column-actions,
.column-header:focus-within .column-actions {
    opacity: 1;
}

.column .column-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    color: var(--column-accent);
    border: none;
    border-radius: 5px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.column.column-neutral .column-actions button {
    color: var(--kb-muted);
}

.column .column-actions button:hover {
    background: var(--kb-hover);
}

.column .column-actions .delete-column-button:hover {
    color: #dc2626;
}

.column-collapse-toggle svg {
    width: 15px;
    height: 15px;
}

.column .tasks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px;
}

.column:not(.is-empty) .tasks {
    padding-bottom: 6px;
}

.column .column-add-task-footer {
    display: flex;
    align-items: center;
    margin: 0 4px;
    padding: 8px;
    background: transparent;
    color: var(--column-accent);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.column.column-neutral .column-add-task-footer {
    color: var(--kb-muted);
}

.column .column-add-task-footer:hover {
    background: var(--kb-hover);
}

/* Drag & drop */
.column.drag-over {
    background: color-mix(in srgb, var(--column-accent) 18%, var(--kb-surface));
    outline: 2px dashed var(--column-accent);
    outline-offset: -2px;
}

/* Collapsed columns shrink to a slim vertical pill with the count
   underneath; click anywhere on one to expand it again. */
.column.collapsed {
    flex: 0 0 30px;
    width: 30px;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.column.collapsed + .column.collapsed {
    margin-left: -2px;
}

.column.collapsed .column-header {
    flex-direction: column;
    padding: 0;
}

.column.collapsed .column-title {
    flex-direction: column;
    gap: 10px;
}

.column.collapsed .column-status-pill {
    padding: 7px 3px 9px;
    writing-mode: vertical-rl;
    max-height: 60vh;
}

.column.collapsed .count {
    writing-mode: vertical-rl;
}

.column.collapsed .column-points,
.column.collapsed .column-actions,
.column.collapsed .tasks,
.column.collapsed .column-add-task-footer {
    display: none;
}

.column.collapsed:hover .column-status-pill {
    filter: brightness(1.08);
}

.column.collapsed.drag-over {
    background: color-mix(in srgb, var(--column-accent) 18%, var(--kb-surface));
}

/* Task cards */
.task {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    padding: 10px 12px;
    background: var(--kb-card-bg);
    border: 1px solid var(--kb-card-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--kb-text);
    font-size: 14px;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.task:hover {
    border-color: var(--kb-card-border-hover);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
}

.task:active {
    cursor: grabbing;
}

.task.dragging {
    opacity: 0.45;
    transform: rotate(2deg);
}

.task-title {
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.task.task-done .task-title {
    color: var(--kb-muted);
}

.task-description {
    display: -webkit-box;
    margin: -2px 0 0;
    overflow: hidden;
    color: var(--kb-muted);
    font-size: 13px;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-sprint-tag {
    align-self: flex-start;
    max-width: 100%;
    overflow: hidden;
    padding: 2px 7px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--kb-link) 12%, transparent);
    color: var(--kb-link);
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Bordered chips for weight, due date and priority. */
.task-weight,
.task-due,
.task-meta .priority-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    box-sizing: border-box;
    padding: 0 7px;
    border: 1px solid var(--kb-chip-border);
    border-radius: 5px;
    background: transparent;
    color: var(--kb-muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.task-meta .priority-tag {
    color: var(--kb-text);
}

.task-due::before {
    content: "";
    width: 12px;
    height: 12px;
    background: currentColor;
    -webkit-mask: var(--calendar-icon) center / contain no-repeat;
    mask: var(--calendar-icon) center / contain no-repeat;
}

:root {
    --calendar-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2V2h-2v2H9V2zm-2 8h14v10H5z'/%3E%3C/svg%3E");
}

.task-due.task-due-soon {
    color: #c2410c;
}

.task-due.task-due-overdue {
    color: #dc2626;
}

html.dark-mode .task-due.task-due-soon {
    color: #fb923c;
}

html.dark-mode .task-due.task-due-overdue {
    color: #f87171;
}

.task-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: hsl(var(--avatar-hue, 230), 60%, 50%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.task-avatar.task-avatar-empty {
    background: transparent;
    border: 1.5px dashed var(--kb-card-border-hover);
    box-sizing: border-box;
}

/* "View details" floats in the card's top-right corner on hover/focus. */
.task .view-task-button {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 7px;
    background: var(--kb-card-bg);
    color: var(--kb-link);
    border: 1px solid var(--kb-chip-border);
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.task:hover .view-task-button,
.task .view-task-button:focus-visible {
    opacity: 1;
}

.task .view-task-button:hover {
    background: var(--kb-card-bg);
    border-color: var(--kb-link);
}

@media (hover: none) {
    .column-points,
    .column-actions,
    .task .view-task-button {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .column,
    .task {
        transition: none;
    }
}

/* Several assignees overlap on a card; the ring keeps them apart. */
.task-avatar-stack {
    display: inline-flex;
    align-items: center;
}

.task-avatar-stack .task-avatar {
    box-shadow: 0 0 0 2px var(--kb-card-bg);
}

.task-avatar-stack .task-avatar + .task-avatar {
    margin-left: -6px;
}

.task-avatar.task-avatar-more {
    background: var(--kb-chip-border);
    color: var(--kb-text);
}

/* ==== Task modals and board panels ==== */

/* The board's modals and its Sprint progress / Find tasks panels share one
   look, built on the board's --kb-* colours so they match the cards. :is()
   of their ids keeps these rules ahead of the generic dark-mode form and
   button rules. */
:root {
    --td-subtle: #f6f7f9;
    --td-primary: #3333ff;
    --td-primary-hover: #5555ff;
    --td-focus-ring: color-mix(in srgb, var(--kb-link) 35%, transparent);
    --td-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

html.dark-mode {
    --td-subtle: #262626;
}

html.dark-mode :is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) {
    color-scheme: dark;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) [hidden] {
    display: none !important;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-content {
    display: flex;
    flex-direction: column;
    width: min(560px, calc((100vw - 32px) / var(--font-scale, 1)));
    max-height: calc((100vh - 48px) / var(--font-scale, 1));
    box-sizing: border-box;
    padding: 0;
    overflow: hidden;
    background: var(--kb-surface);
    border: 1px solid var(--kb-card-border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    color: var(--kb-text);
    font-size: 14px;
    line-height: 1.45;
    zoom: var(--font-scale, 1);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-content-narrow {
    width: min(440px, calc((100vw - 32px) / var(--font-scale, 1)));
}

.td-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* -- Header -- */

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 20px 16px 24px;
    border-bottom: 1px solid var(--kb-card-border);
}

.task-details-heading {
    flex: 1;
    min-width: 0;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) h2 {
    margin: 0;
    color: var(--kb-text);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.task-details-subtitle {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--kb-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--kb-chip-border);
    border-radius: 6px;
    background: transparent;
    color: var(--kb-muted);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-close:hover {
    background: var(--kb-hover);
    color: var(--kb-text);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-error {
    margin: 12px 24px 0;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-error:empty {
    min-height: 0;
    margin: 0;
}

/* -- Panels: a scrolling body above a fixed footer -- */

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.task-details-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    padding: 20px 24px;
    overflow-y: auto;
}

.task-details-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--kb-card-border);
}

.task-details-footer-note {
    margin-right: auto;
    color: var(--kb-muted);
    font-size: 12px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button-primary {
    border: 1px solid var(--td-primary);
    background: var(--td-primary);
    color: #fff;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button-primary:hover {
    border-color: var(--td-primary-hover);
    background: var(--td-primary-hover);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button-secondary {
    border: 1px solid var(--kb-chip-border);
    background: var(--kb-surface);
    color: var(--kb-text);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button-secondary:hover {
    background: var(--kb-hover);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button-ghost {
    border: 1px solid transparent;
    background: transparent;
    color: var(--kb-muted);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button-ghost:hover {
    background: var(--kb-hover);
    color: var(--kb-text);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-button:disabled {
    opacity: 0.6;
    cursor: default;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) button:focus-visible {
    outline: 2px solid var(--kb-link);
    outline-offset: 2px;
}

/* -- Details view -- */

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-fields {
    display: grid;
    grid-template-columns: 136px minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    row-gap: 2px;
    margin: 0;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-fields dt {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    color: var(--kb-muted);
    font-weight: 400;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-fields dd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    margin: 0;
    overflow-wrap: anywhere;
}

.task-details-empty,
.task-details-muted {
    color: var(--kb-muted);
}

.task-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 9px;
    border-radius: 5px;
    background: color-mix(in srgb, var(--status-colour) 15%, transparent);
    color: var(--kb-text);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.task-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-colour);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .priority-tag {
    height: 24px;
    box-sizing: border-box;
    padding: 0 9px;
    border-color: var(--kb-chip-border);
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
}

.task-assignee-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.task-assignee-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    box-sizing: border-box;
    padding: 0 10px 0 3px;
    border: 1px solid var(--kb-chip-border);
    border-radius: 999px;
    font-size: 13px;
}

.task-details-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-section-title {
    margin: 0;
    padding: 0;
    color: var(--kb-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.task-details-description {
    margin: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--td-subtle);
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.task-details-meta {
    margin: 0;
    color: var(--kb-muted);
    font-size: 12px;
}

.task-details-meta:empty {
    display: none;
}

/* -- Edit form -- */

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-field-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.td-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-field label {
    display: block;
    margin: 0;
    color: var(--kb-text);
    font-size: 13px;
    font-weight: 500;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-hint {
    margin: 0;
    color: var(--kb-muted);
    font-size: 12px;
    font-weight: 400;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-field + .td-hint,
:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-field-row + .td-hint {
    margin-top: -12px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) input:not([type="checkbox"]),
:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) textarea,
:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) select {
    width: 100%;
    height: 38px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid var(--kb-chip-border);
    border-radius: 6px;
    background: var(--kb-surface);
    color: var(--kb-text);
    font: inherit;
    font-size: 14px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) select {
    padding-right: 32px;
    background-image: var(--td-chevron);
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) select:disabled {
    opacity: 0.6;
    cursor: default;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) textarea {
    height: auto;
    min-height: 96px;
    padding: 9px 10px;
    line-height: 1.5;
    resize: vertical;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) input:focus,
:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) textarea:focus,
:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) select:focus {
    border-color: var(--kb-link);
    outline: none;
    box-shadow: 0 0 0 3px var(--td-focus-ring);
}

/* -- Assign: search and a checklist of team members -- */

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-search {
    position: relative;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-search .td-icon {
    position: absolute;
    top: 50%;
    left: 11px;
    color: var(--kb-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal, #task-query-panel, #sprint-overview-bar, #sprint-create-card, #activity-filters, #sprint-progress-picker, #burndown-project-form, #burndown-sprint-form) .td-search input {
    padding-left: 34px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .assignee-options {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .assignee-options legend {
    margin-bottom: 8px;
}

.assignee-option-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .assignee-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--kb-text);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .assignee-option:hover {
    background: var(--kb-hover);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .assignee-option:has(input:checked) {
    background: color-mix(in srgb, var(--kb-link) 10%, transparent);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .assignee-option input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--td-primary);
}

:is(#task-details-modal, #task-modal, #column-modal, #account-modal) .assignee-option .task-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.assignee-option-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 520px) {
    :is(#task-details-modal, #task-modal, #column-modal, #account-modal) .task-details-fields {
        grid-template-columns: 112px minmax(0, 1fr);
    }

    :is(#task-details-modal, #task-modal, #column-modal, #account-modal) .td-field-row,
    :is(#task-details-modal, #task-modal, #column-modal, #account-modal) .td-field-row-3 {
        grid-template-columns: 1fr;
    }
}

/* -- Board panels: Sprint progress and Find tasks -- */

:is(#task-query-panel, #sprint-overview-bar) {
    margin-bottom: 16px;
    padding: 0;
    overflow: hidden;
    background: var(--kb-surface);
    border: 1px solid var(--kb-card-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--kb-text);
    font-size: 14px;
    line-height: 1.45;
}

#task-query-panel .board-panel-head {
    padding: 18px 20px 0;
}

#task-query-panel h2 {
    margin: 0;
    color: var(--kb-text);
    font-size: 16px;
    font-weight: 600;
}

#task-query-panel .board-panel-hint {
    margin: 4px 0 0;
    color: var(--kb-muted);
    font-size: 13px;
}

#task-query-panel .task-query-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px 18px;
}

.task-query-search-row {
    display: flex;
    gap: 8px;
}

.task-query-search-row .td-search {
    flex: 1;
    min-width: 0;
}

/* Filters and stat tiles wrap to the space the board actually has, which
   the sidebar narrows independently of the window. */
.task-query-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

#task-query-panel .board-panel-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--kb-card-border);
    background: var(--td-subtle);
}

#task-query-panel .task-query-scope-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--kb-muted);
    font-size: 12px;
    font-weight: 400;
}

#task-query-panel .task-query-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
}

#task-query-panel .task-query-actions .td-button {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

#sprint-overview-bar {
    padding: 16px 20px 18px;
}

.board-sprint-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

#sprint-overview-bar .board-sprint-select {
    width: auto;
    height: 34px;
    border-color: transparent;
    background-color: transparent;
    font-size: 16px;
    font-weight: 600;
}

#sprint-overview-bar .board-sprint-select:hover {
    border-color: var(--kb-chip-border);
}

.board-sprint-status {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--kb-link) 14%, transparent);
    color: var(--kb-text);
    font-size: 12px;
    font-weight: 500;
}

.board-sprint-dates {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--kb-muted);
    font-size: 13px;
}

.board-sprint-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: var(--kb-link);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.board-sprint-link:hover {
    text-decoration: underline;
}

.board-sprint-link .td-icon {
    width: 14px;
    height: 14px;
}

/* One tile per status, in the same colours as the board columns. */
.board-sprint-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.board-sprint-stat {
    --stat-colour: var(--col-todo);

    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--kb-card-border);
    border-radius: 8px;
}

.board-sprint-stat.in-progress { --stat-colour: var(--col-progress); }
.board-sprint-stat.on-hold { --stat-colour: var(--col-hold); }
.board-sprint-stat.cancelled { --stat-colour: var(--col-cancelled); }
.board-sprint-stat.done { --stat-colour: var(--col-done); }

.board-sprint-stat dt {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--kb-muted);
    font-size: 12px;
}

.board-sprint-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--stat-colour);
}

.board-sprint-stat dd {
    margin: 0;
    color: var(--kb-text);
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.board-sprint-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--kb-hover);
}

.board-sprint-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--col-done);
}

.board-sprint-pct {
    margin: 8px 0 0;
    color: var(--kb-muted);
    font-size: 12px;
}


/* -- Account popup sections -- */

.account-body {
    gap: 0;
    padding-top: 4px;
}

.account-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 0;
}

.account-section + .account-section {
    border-top: 1px solid var(--kb-card-border);
}

.account-section-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
}

#account-modal .account-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 12px;
}

/* account.js swaps these messages between task-error and task-success. */
#account-modal .account-actions p {
    flex: 1;
    min-height: 0;
    margin: 0;
    font-size: 13px;
}

#account-modal input:disabled {
    background: var(--td-subtle);
    color: var(--kb-muted);
    cursor: not-allowed;
}

:is(#account-modal, #task-details-modal) .td-button-danger {
    border: 1px solid color-mix(in srgb, #dc2626 45%, transparent);
    background: transparent;
    color: #dc2626;
}

/* Delete sits apart from Assign and Edit, on the left of the footer. */
#task-details-modal .task-details-delete {
    margin: 0 auto 0 0;
}

/* Clients get no actions, so the empty footer goes too. */
html[data-client="true"] #task-details-view .task-details-footer {
    display: none;
}

:is(#account-modal, #task-details-modal) .td-button-danger:hover {
    background: color-mix(in srgb, #dc2626 10%, transparent);
}

html.dark-mode :is(#account-modal, #task-details-modal) .td-button-danger {
    color: #f87171;
}

.account-2fa-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--td-subtle);
}

.account-2fa-icon {
    display: inline-flex;
    color: var(--kb-muted);
}

.account-2fa-status.is-on .account-2fa-icon {
    color: #16a34a;
}

#account-modal .two-factor-status {
    flex: 1;
    min-width: 200px;
    margin: 0;
    color: var(--kb-text);
    font-size: 13px;
}

.account-2fa-steps {
    margin: 0;
    padding-left: 20px;
    color: var(--kb-text);
    font-size: 13px;
    line-height: 1.6;
}

.account-2fa-setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

#account-modal .two-factor-qr {
    margin: 0;
}

#account-modal .two-factor-qr svg {
    width: 160px;
    height: 160px;
    border: 1px solid var(--kb-card-border);
    border-radius: 8px;
}

.account-2fa-manual {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

#account-modal .two-factor-secret {
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--td-subtle);
    color: var(--kb-text);
    font-size: 13px;
    letter-spacing: 0.04em;
}

#account-modal .account-code-field {
    max-width: 200px;
}

/* Sprint Progress: the sprint picker, using the shared dropdown style. */
.sprint-progress-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
}

#sprint-progress-picker label {
    margin: 0;
    color: var(--kb-muted);
    font-size: 13px;
    font-weight: 500;
}

#sprint-progress-picker select {
    width: auto;
    min-width: 200px;
}



/* ==== Colour vision modes ==== */

/* Dark mode keeps the same roles, re-tinted for a dark surface. */
html.dark-mode {
    --danger-fg: #fca5a5;

    --status-todo-bg: #4c1d1d;
    --status-todo-fg: #fca5a5;

    --status-progress-bg: #4a3509;
    --status-progress-fg: #fcd34d;

    --status-done-bg: #14361f;
    --status-done-fg: #86efac;

    --status-info-bg: #1e3a5f;
    --status-info-fg: #93c5fd;

    --status-neutral-bg: #3a3a3a;
    --status-neutral-fg: #cbd5e1;
}

/* Red-green (deuteranopia and protanopia).
   The default palette's real failure is To Do (red) against In Progress
   (amber): under simulation they differ by only dE 5.8, so they read as the
   same colour. Purple / orange / blue lifts the closest pair to dE 27.8. */
:root[data-colour-mode="deuteranopia"] {
    --status-todo-bg: #f6e4ef;
    --status-todo-fg: #8b3a68;

    --status-progress-bg: #fdeccd;
    --status-progress-fg: #8a5000;

    --status-done-bg: #dde9f6;
    --status-done-fg: #0b4f7a;

    --status-info-bg: #e6f2fb;
    --status-info-fg: #1a5f87;

    --danger-bg: #f6e4ef;
    --danger-fg: #8b3a68;

    --priority-normal: #0072b2;
    --priority-high: #e69f00;
    --priority-urgent: #cc79a7;
}

html.dark-mode[data-colour-mode="deuteranopia"] {
    --status-todo-bg: #3d1f33;
    --status-todo-fg: #f0a8d6;

    --status-progress-bg: #43300a;
    --status-progress-fg: #fbbf24;

    --status-done-bg: #12334d;
    --status-done-fg: #93c5fd;

    --status-info-bg: #10303f;
    --status-info-fg: #7dd3fc;
}

/* Blue-yellow (tritanopia). Red and green survive this one, so only the
   amber needs replacing: magenta lifts the closest pair from dE 17.4 to 30.4. */
:root[data-colour-mode="tritanopia"] {
    --status-progress-bg: #fae3f5;
    --status-progress-fg: #86198f;

    --priority-high: #a21caf;
}

html.dark-mode[data-colour-mode="tritanopia"] {
    --status-progress-bg: #3f1038;
    --status-progress-fg: #f0abfc;
}

.colour-vision-intro {
    margin: 0 0 14px 0;

    color: #475569;

    font-size: 13px;
    line-height: 1.5;
}

.task-modal-content label.colour-vision-option {
    display: grid;

    grid-template-columns: auto 1fr;

    align-items: start;

    gap: 2px 10px;

    padding: 10px 12px;

    border: 1px solid #ddd;
    border-radius: 8px;

    margin-bottom: 8px;

    cursor: pointer;
}

.colour-vision-option input[type="radio"] {
    grid-row: span 2;
    width: auto;
    padding: 0;
    margin: 2px 0 0 0;
}

.colour-vision-name {
    font-weight: bold;
}

.colour-vision-hint {
    color: #64748b;
    font-weight: normal;
    font-size: 12px;
}

html.dark-mode .colour-vision-option {
    border-color: #444;
}

html.dark-mode .colour-vision-intro,
html.dark-mode .colour-vision-hint {
    color: #aaa;
}
/* Sidebar-footer project switcher shared by the board and reporting pages. */
@media (min-width: 701px) {
    .sidebar { display: flex; flex-direction: column; }
}
.project-switcher {
    position: sticky;
    bottom: 0;
    z-index: 20;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto;
    padding: 10px 8px 12px;
    background: var(--sidebar-colour);
    text-align: left;
}
.project-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(203, 213, 225, .18);
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    color: #f8fafc;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.project-switcher-toggle:hover,
.project-switcher-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, .12); }
.project-switcher-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.project-switcher-badge {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--accent-strong);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.project-switcher-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.project-switcher-name {
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.project-switcher-sub { color: #94a3b8; font-size: 11px; }
.project-switcher-chevron { flex: none; color: #94a3b8; font-size: 14px; }
.project-switcher-menu {
    position: absolute;
    bottom: calc(100% - 4px);
    left: 8px;
    width: 260px;
    max-height: min(480px, calc(100vh - 120px));
    overflow-y: auto;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .28);
}
.project-switcher-menu[hidden] { display: none; }
.project-switcher-heading {
    margin: 2px 4px 10px;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.project-switcher-list { margin: 0; padding: 0; list-style: none; }
.sidebar .project-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-left: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #0f172a;
    font-size: 14px;
    font-weight: normal;
}
.sidebar .project-option:hover,
.sidebar .project-option:focus-visible { background: #f1f5f9; color: #0f172a; }
.sidebar .project-option.is-current {
    border: 1.5px solid var(--accent-strong);
    background: #eff6ff;
}
.project-option-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-option-name { font-weight: 600; overflow-wrap: anywhere; }
.project-option-check {
    display: grid;
    place-items: center;
    flex: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    color: var(--accent-strong);
    font-size: 10px;
    font-weight: 700;
}
.project-option-role { color: #64748b; font-size: 12px; }
.project-option-members { display: flex; align-items: center; gap: 6px; color: #94a3b8; font-size: 11px; }
.project-avatars { display: flex; }
.project-avatar {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-left: -4px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    background: #8b5cf6;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
}
.project-avatar:first-child { margin-left: 0; }
.project-avatar-2 { background: #22c55e; }
.project-avatar-3 { background: #f59e0b; }
.project-avatar-more { background: #64748b; }
.sidebar .project-switcher-create {
    display: block;
    margin-top: 8px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 600;
}
.sidebar .project-switcher-create:hover,
.sidebar .project-switcher-create:focus-visible { background: #eff6ff; color: var(--accent-strong); }
.project-switcher-toggle.is-empty .project-switcher-badge { background: #475569; }
.project-switcher-toggle.is-empty .project-switcher-name { color: #cbd5e1; font-weight: 500; }
.project-switcher-empty { margin: 4px 4px 8px; color: #64748b; font-size: 13px; }
.project-switcher-deselect { margin: 8px 0 0; }
.project-switcher-deselect button {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.project-switcher-deselect button:hover,
.project-switcher-deselect button:focus-visible { background: #f1f5f9; color: #0f172a; }
.project-switcher-delete { margin-top: 8px; font-size: 13px; }
.project-switcher-delete summary {
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: var(--danger-fg);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.project-switcher-delete summary::-webkit-details-marker { display: none; }
.project-switcher-delete summary:hover,
.project-switcher-delete summary:focus-visible { background: #fef2f2; }
.project-switcher-delete-form { display: grid; gap: 6px; padding: 8px 4px 0; }
.project-switcher-delete-form p { margin: 0; color: #64748b; }
.project-switcher-delete-form input[name="confirm_name"] {
    padding: 7px 9px;
    border: 1px solid #b8c0cc;
    border-radius: 6px;
    font: inherit;
}
.project-switcher-delete-form button {
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.project-switcher-delete-form button:disabled { opacity: 0.5; cursor: not-allowed; }
html.dark-mode .project-switcher-delete summary { border-color: #333; color: #fca5a5; }
html.dark-mode .project-switcher-delete summary:hover,
html.dark-mode .project-switcher-delete summary:focus-visible { background: #2a1a1a; }
html.dark-mode .project-switcher-delete-form p { color: #aaa; }
html.dark-mode .project-switcher-delete-form input[name="confirm_name"] { border-color: #444; background: #262626; color: #f5f5f5; }
html.dark-mode .project-switcher-deselect button { border-color: #333; background: #262626; color: #ddd; }
html.dark-mode .project-switcher-menu { border-color: #333; background: #1f1f1f; color: #f5f5f5; }
html.dark-mode .sidebar .project-option { color: #f5f5f5; }
html.dark-mode .sidebar .project-option:hover,
html.dark-mode .sidebar .project-option:focus-visible { background: #2a2a2a; color: #fff; }
html.dark-mode .sidebar .project-option.is-current { background: #1e2a44; }
html.dark-mode .project-option-role { color: #aaa; }
html.dark-mode .project-avatar { border-color: #1f1f1f; }
html.dark-mode .sidebar .project-switcher-create { border-color: #333; background: #262626; color: #93c5fd; }
.project-empty { padding: 16px; line-height: 1.5; }
.project-message { max-width: 720px; margin: 4rem auto; padding: 24px; line-height: 1.6; }
.project-list { list-style: none; padding: 0; margin: 0; }
.project-panel {
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #8491a4;
    border-radius: 10px;
    background: var(--dashboard-colour);
    overflow-wrap: anywhere;
}
.project-panel h2 { margin-top: 0; }
.project-panel a, .project-message a { color: var(--kb-link); }
.project-panel p { line-height: 1.6; }
.project-create-form { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.project-create-form input:not([type="hidden"]) {
    box-sizing: border-box; width: 100%; max-width: 520px;
    padding: 10px; font: inherit; color: inherit;
    background: var(--dashboard-colour); border: 1px solid #8491a4; border-radius: 6px;
}
.project-create-form button { padding: 10px 18px; font: inherit; cursor: pointer; }
.project-notice { padding: 12px; border-left: 4px solid currentColor; line-height: 1.6; }
@media (max-width: 700px) {
    .project-switcher { position: relative; padding: 8px; }
    .project-switcher-menu { top: calc(100% - 4px); bottom: auto; width: calc(100% - 16px); }
    .project-directory .layout { flex-direction: column; }
    .project-directory .sidebar {
        width: auto; min-height: auto; height: auto;
        display: flex; flex-wrap: wrap; padding: 8px;
    }
    .project-directory .sidebar a, .project-directory .sidebar .logout-form { margin: 0; }
    .project-directory main { padding: 20px 16px; min-width: 0; }
}


/* ==== Non-colour cues for the colour vision modes ====

   Colour alone shouldn't carry meaning. The badges already have text
   labels, so these add a texture to the progress bars and a shape to the
   status badges: the three states stay distinguishable in a greyscale
   print, a screenshot, or for anyone whose mode isn't one of the two we
   offer. Only applied when a colour vision mode is active, so the default
   theme is visually unchanged. */

html[data-colour-mode="deuteranopia"] .bar > span,
html[data-colour-mode="tritanopia"] .bar > span,
html[data-colour-mode="deuteranopia"] .board-sprint-progress-fill,
html[data-colour-mode="tritanopia"] .board-sprint-progress-fill {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.35) 0,
        rgba(255, 255, 255, 0.35) 4px,
        transparent 4px,
        transparent 8px
    );
}

html[data-colour-mode="deuteranopia"] .calendar-badge.badge-high::before,
html[data-colour-mode="tritanopia"] .calendar-badge.badge-high::before,
html[data-colour-mode="deuteranopia"] .calendar-column-badge.column-to-do::before,
html[data-colour-mode="tritanopia"] .calendar-column-badge.column-to-do::before {
    content: "\25CF\00a0";
}

html[data-colour-mode="deuteranopia"] .calendar-badge.badge-medium::before,
html[data-colour-mode="tritanopia"] .calendar-badge.badge-medium::before,
html[data-colour-mode="deuteranopia"] .calendar-column-badge.column-in-progress::before,
html[data-colour-mode="tritanopia"] .calendar-column-badge.column-in-progress::before {
    content: "\25D0\00a0";
}

html[data-colour-mode="deuteranopia"] .calendar-badge.badge-done::before,
html[data-colour-mode="tritanopia"] .calendar-badge.badge-done::before,
html[data-colour-mode="deuteranopia"] .calendar-column-badge.column-done::before,
html[data-colour-mode="tritanopia"] .calendar-column-badge.column-done::before {
    content: "\2713\00a0";
}


/* ==== Board column accents ====

   board.js sets --column-accent inline per column, so the value has to be
   a variable reference rather than a hex or the colour vision modes can't
   reach it. The defaults below are the original colours, so nothing
   changes unless a mode is active.

   The mode palettes separate by lightness, not hue: under dichromacy red,
   amber and green collapse onto one axis, so hue alone can't tell five
   statuses apart. Worst pair goes from dE 8.7 to 25.3 (deuteranopia) and
   4.2 to 31.6 (tritanopia), and every value clears 4.5:1 against the
   pill's white text — two of the originals did not. */

:root {
    --col-todo: #87909e;
    --col-progress: #4466ff;
    --col-review: #a855f7;
    --col-testing: #f59e0b;
    --col-hold: #e5484d;
    --col-cancelled: #0f9d8a;
    --col-done: #22c55e;
    --col-alt-1: #0ea5e9;
    --col-alt-2: #ec4899;
    --col-alt-3: #f97316;
    --col-alt-4: #14b8a6;
    --col-alt-5: #8b5cf6;
    --col-alt-6: #eab308;
    --col-alt-7: #ef4444;
}

:root[data-colour-mode="deuteranopia"] {
    --col-todo: #7b6f6f;
    --col-progress: #001a8f;
    --col-review: #df0c91;
    --col-testing: #704700;
    --col-hold: #d64000;
    --col-cancelled: #292929;
    --col-done: #1d6a72;
    --col-alt-1: #2010e8;
    --col-alt-2: #a830b8;
    --col-alt-3: #000810;
    --col-alt-4: #607838;
    --col-alt-5: #2010e8;
    --col-alt-6: #a830b8;
    --col-alt-7: #000810;
}

:root[data-colour-mode="tritanopia"] {
    --col-todo: #816a6a;
    --col-progress: #c20081;
    --col-review: #0000ff;
    --col-testing: #521800;
    --col-hold: #df2d20;
    --col-cancelled: #292929;
    --col-done: #008547;
    --col-alt-1: #286860;
    --col-alt-2: #100828;
    --col-alt-3: #2808f8;
    --col-alt-4: #604858;
    --col-alt-5: #286860;
    --col-alt-6: #100828;
    --col-alt-7: #2808f8;
}


/* ==== Progress bar motion ====

   The board bar's width is rewritten by refreshSprintOverview on every
   drag, so a transition turns a jump into a visible change. The sprint
   progress page renders its width server-side and never changes it, so
   that one grows once on load instead.

   Both are suppressed under prefers-reduced-motion. */

.bar > span,
.board-sprint-progress-fill {
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar > span {
    animation: progress-grow 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes progress-grow {
    from { width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .bar > span,
    .board-sprint-progress-fill {
        transition: none;
        animation: none;
    }
}


/* ==== Client accounts ====

   A client sees a read-only board. The server already refuses these
   actions and strips assignee details from its responses; this stops the
   page offering controls that cannot work.

   Done in CSS rather than by removing the markup, because board.js binds
   these elements at load and rebuilds the per-column buttons on every
   render — a missing element would be a null reference, and a one-time
   removal would miss everything drawn afterwards. */

html[data-client="true"] .add-task-button,
html[data-client="true"] #add-column-button,
html[data-client="true"] .column-add-task-button,
html[data-client="true"] .column-add-task-footer,
html[data-client="true"] #assign-task-button,
html[data-client="true"] #assignment-form,
html[data-client="true"] #edit-task-button,
html[data-client="true"] #delete-task-button,
html[data-client="true"] .delete-column-button,
html[data-client="true"] .task-avatar,
html[data-client="true"] .task-avatar-stack {
    display: none !important;
}

/* The assignee filter and the Assignee row in task details have nothing
   to show once names are stripped server-side. */
html[data-client="true"] label[for="filter-assignee"],
html[data-client="true"] #filter-assignee,
html[data-client="true"] .td-field:has(#filter-assignee) {
    display: none;
}

html[data-client="true"] .task-weight,
html[data-client="true"] #task-details-weight,
html[data-client="true"] #task-details-weight-label,
html[data-client="true"] #task-details-assignee,
html[data-client="true"] #task-details-assignee-label,
html[data-client="true"] #task-details-assignees,
html[data-client="true"] #task-details-assignees-label {
    display: none !important;
}

/* ==== Action feedback toasts ==== */

.toast-host {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2000;               /* above the modals (1000) */
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;        /* only the toasts themselves take clicks */
}

.toast-region {
    display: flex;
    flex-direction: column;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 12px 8px 12px 14px;
    border: 1px solid currentColor;
    border-left-width: 5px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
    font-size: 14px;
    line-height: 1.4;
    animation: toast-in 0.18s ease-out;
}

.toast-success { background: var(--status-done-bg); color: var(--status-done-fg); }
.toast-error   { background: var(--status-todo-bg); color: var(--status-todo-fg); }

.toast-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.toast-message { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.toast .toast-dismiss {
    flex: none;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.toast .toast-dismiss:hover { background: rgba(0, 0, 0, 0.1); }
.toast .toast-dismiss:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
html.dark-mode .toast .toast-dismiss:hover { background: rgba(255, 255, 255, 0.15); }

.toast-leaving { opacity: 0; transition: opacity 0.15s ease; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
    .toast { animation: none; }
    .toast-leaving { transition: none; }
}
/* ==== "Pick a project" popup ==== */
.pick-project-dialog {
    max-width: 420px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}
.pick-project-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.pick-project-dialog h2 { margin: 0 0 8px; font-size: 20px; }
.pick-project-dialog p { margin: 0 0 20px; line-height: 1.5; color: #475569; }
.pick-project-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pick-project-actions button {
    padding: 9px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.pick-project-actions .pick-project-open,
.pick-project-actions .add-member-submit { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }
.add-member-dialog { width: min(420px, calc(100vw - 32px)); box-sizing: border-box; }
.add-member-dialog .project-create-form input:not([type="hidden"]) { max-width: none; background: transparent; }
.add-member-dialog .pick-project-actions { align-self: stretch; margin-top: 8px; }
html.dark-mode .pick-project-dialog { border-color: #333; background: #1f1f1f; color: #f5f5f5; }
html.dark-mode .pick-project-dialog p { color: #bbb; }
html.dark-mode .pick-project-actions button { border-color: #444; background: #262626; color: #f5f5f5; }
html.dark-mode .pick-project-actions .pick-project-open,
html.dark-mode .pick-project-actions .add-member-submit { border-color: #3b82f6; background: #2563eb; color: #fff; }
.home-pick-project { margin-bottom: 24px; }

.member-search { display: grid; gap: 6px; max-width: 420px; margin: 0 0 16px; }
.member-search label { font-weight: 600; }
.member-search input {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #b8c0cc;
    border-radius: 6px;
    font: inherit;
}
.member-search input:focus { border-color: #3333ff; outline: 3px solid #dedcff; }
.member-search p { margin: 0; min-height: 1.2em; }
html.dark-mode .member-search input { border-color: #444; background: #262626; color: #f5f5f5; }

.account-delete-warning { margin: 0 0 12px; color: #64748b; line-height: 1.5; }
html.dark-mode .account-delete-warning { color: #aaa; }

.project-switcher-search {
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 8px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    font-size: 13px;
}
.project-switcher-search:focus { border-color: var(--accent-strong); outline: 2px solid #dbeafe; }
.project-switcher-list li[hidden] { display: none; }
html.dark-mode .project-switcher-search { border-color: #444; background: #262626; color: #f5f5f5; }

/* The switcher inside the shared sidebar: the menu fits the sidebar's width
   (the sidebar scrolls, so a wider menu would be clipped) and its links
   aren't underlined like page links. */
.sidebar .project-switcher-menu {
    left: 0;
    width: 100%;
}

.sidebar .project-switcher a {
    text-decoration: none;
}
