@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   Tokens — Bootstrap overrides + AllScrum palette
   ========================================================================== */
:root,
[data-bs-theme="light"] {
    --bs-body-font-family: 'Inter', sans-serif;
    --bs-font-sans-serif: 'Inter', sans-serif;
    --bs-body-font-size: 0.9375rem;
    --bs-body-line-height: 1.5;
    --bs-body-color: #0f172a;
    --bs-body-color-rgb: 15, 23, 42;
    --bs-body-bg: #f8fafc;
    --bs-body-bg-rgb: 248, 250, 252;
    --bs-primary: #1e293b;
    --bs-primary-rgb: 30, 41, 59;
    --bs-secondary-color: #64748b;
    --bs-emphasis-color: #0f172a;
    --bs-border-color: #e2e8f0;
    --bs-border-radius: 8px;
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: 12px;
    --bs-link-color: #1e293b;
    --bs-link-color-rgb: 30, 41, 59;
    --bs-link-hover-color: #0f172a;
    --bs-link-hover-color-rgb: 15, 23, 42;
    --bs-focus-ring-color: rgba(30, 41, 59, 0.25);
    --bs-box-shadow: none;
    --bs-box-shadow-sm: none;
    --bs-box-shadow-lg: none;
    --bs-box-shadow-inset: none;

    --as-ink: #0f172a;
    --as-ink-2: #334155;
    --as-muted: #64748b;
    --as-subtle: #94a3b8;
    --as-line: #e2e8f0;
    --as-line-strong: #cbd5e1;
    --as-surface: #ffffff;
    --as-column-bg: #f1f5f9;
    --as-danger: #dc2626;
    --as-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

    --as-status-backlog: #94a3b8;
    --as-status-todo: #3b82f6;
    --as-status-in_progress: #f59e0b;
    --as-status-review: #8b5cf6;
    --as-status-done: #10b981;

    --as-nav-h: 56px;
}

/* ==========================================================================
   Base
   ========================================================================== */
html,
body {
    font-family: var(--bs-body-font-family);
}

body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
}

h1, h2, h3, h4, h5, h6 {
    color: var(--as-ink);
    letter-spacing: -0.015em;
}

a {
    text-underline-offset: 2px;
}

::selection {
    background: #1e293b;
    color: #f8fafc;
}

:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-font-size: 0.875rem;
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-padding-x: 0.95rem;
    --bs-btn-border-radius: 8px;
    --bs-btn-focus-box-shadow: none;
    --bs-btn-box-shadow: none;
    box-shadow: none !important;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-sm {
    --bs-btn-padding-y: 0.3rem;
    --bs-btn-padding-x: 0.65rem;
    --bs-btn-font-size: 0.8125rem;
    --bs-btn-border-radius: 6px;
}

.btn:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #1e293b;
    --bs-btn-border-color: #1e293b;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0f172a;
    --bs-btn-hover-border-color: #0f172a;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #020617;
    --bs-btn-active-border-color: #020617;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #1e293b;
    --bs-btn-disabled-border-color: #1e293b;
}

.btn-ghost {
    --bs-btn-color: #475569;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--as-ink);
    --bs-btn-hover-bg: var(--as-line);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--as-ink);
    --bs-btn-active-bg: var(--as-line-strong);
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-color: var(--as-subtle);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: transparent;
}

.btn-quiet {
    --bs-btn-color: var(--as-ink-2);
    --bs-btn-bg: var(--as-surface);
    --bs-btn-border-color: var(--as-line);
    --bs-btn-hover-color: var(--as-ink);
    --bs-btn-hover-bg: var(--as-surface);
    --bs-btn-hover-border-color: var(--as-line-strong);
    --bs-btn-active-color: var(--as-ink);
    --bs-btn-active-bg: var(--as-column-bg);
    --bs-btn-active-border-color: var(--as-line-strong);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--as-ink-2);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    font-size: 0.9375rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background-color: var(--as-surface);
    color: var(--as-ink);
    box-shadow: none;
}

.form-control::placeholder {
    color: var(--as-subtle);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: none;
    outline: 2px solid rgba(30, 41, 59, 0.12);
    outline-offset: 0;
}

.form-error {
    min-height: 1.25rem;
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--as-danger);
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
    --bs-modal-border-radius: 12px;
    --bs-modal-inner-border-radius: 11px;
    --bs-modal-border-color: var(--as-line);
    --bs-modal-box-shadow: none;
    --bs-modal-padding: 1.25rem;
    --bs-modal-header-padding: 1.1rem 1.25rem 0.25rem;
    --bs-modal-header-border-color: transparent;
    --bs-modal-footer-border-color: transparent;
    --bs-modal-footer-gap: 0.5rem;
}

.modal-content {
    box-shadow: none;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-backdrop {
    --bs-backdrop-bg: #0f172a;
    --bs-backdrop-opacity: 0.35;
}

.btn-close:focus {
    box-shadow: none;
    outline: 2px solid var(--bs-primary);
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.app-nav {
    height: var(--as-nav-h);
    flex: 0 0 var(--as-nav-h);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1rem;
    background: var(--as-surface);
    border-bottom: 1px solid var(--as-line);
    min-width: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    font-size: 0.975rem;
    letter-spacing: -0.02em;
    color: var(--as-ink);
    text-decoration: none;
    flex-shrink: 0;
}

.brand:hover {
    color: var(--as-ink);
}

.brand-mark {
    display: block;
    width: 22px;
    height: 22px;
}

.nav-sep {
    color: var(--as-line-strong);
    font-size: 0.875rem;
}

.nav-crumb {
    font-size: 0.875rem;
    color: var(--as-muted);
    text-decoration: none;
    white-space: nowrap;
}

.nav-crumb:hover {
    color: var(--as-ink);
}

.nav-crumb-current {
    color: var(--as-ink);
    font-weight: 500;
    min-width: 0;
}

.nav-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.nav-user {
    font-size: 0.8125rem;
    color: var(--as-muted);
    max-width: 16rem;
}

/* ==========================================================================
   Landing / auth
   ========================================================================== */
.landing {
    min-height: calc(100vh - var(--as-nav-h));
    display: flex;
    align-items: center;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--as-muted);
    margin-bottom: 1rem;
}

.display-title {
    font-size: clamp(2.1rem, 4.5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.04;
    margin-bottom: 1.25rem;
}

.lead-text {
    font-size: 1.0625rem;
    color: var(--as-muted);
    max-width: 33rem;
    margin-bottom: 0;
}

.mini-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    max-width: 33rem;
    margin-top: 2.5rem;
}

.mini-col {
    background: var(--as-column-bg);
    border-radius: 10px;
    padding: 0.55rem;
}

.mini-col-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--as-muted);
    padding: 0.15rem 0.2rem 0.5rem;
}

.mini-card {
    background: var(--as-surface);
    border-radius: 6px;
    box-shadow: var(--as-card-shadow);
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--as-ink-2);
    margin-bottom: 0.4rem;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.mini-card:last-child {
    margin-bottom: 0;
}

.mini-card b {
    font-weight: 600;
    color: var(--as-subtle);
    font-variant-numeric: tabular-nums;
}

.auth-panel {
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 12px;
    padding: 1.75rem;
}

.auth-panel h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.auth-panel .auth-sub {
    font-size: 0.875rem;
    color: var(--as-muted);
    margin-bottom: 1.25rem;
}

.segmented {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--as-column-bg);
    border-radius: 9px;
    margin-bottom: 1.5rem;
}

.segmented button {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0.45rem 0.5rem;
    border-radius: 7px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--as-muted);
    cursor: pointer;
}

.segmented button.active {
    background: var(--as-surface);
    color: var(--as-ink);
    outline: 1px solid var(--as-line);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--as-subtle);
    margin-top: 0.35rem;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */
.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2.5rem 1rem 4rem;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.page-sub {
    font-size: 0.875rem;
    color: var(--as-muted);
    margin: 0.25rem 0 0;
}

.create-board {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    max-width: 26rem;
}

.create-board .form-control {
    flex: 1;
    min-width: 0;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.board-tile {
    display: flex;
    flex-direction: column;
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    color: var(--as-ink);
    text-decoration: none;
    transition: border-color 0.12s ease;
    min-height: 8.5rem;
}

.board-tile:hover {
    border-color: var(--as-subtle);
    color: var(--as-ink);
}

.board-tile-name {
    font-weight: 600;
    font-size: 0.975rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.board-tile-meta {
    font-size: 0.8125rem;
    color: var(--as-muted);
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.progress-line {
    height: 4px;
    background: var(--as-line);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.65rem;
}

.progress-line span {
    display: block;
    height: 100%;
    background: var(--as-status-done);
}

.empty-state {
    border: 1px dashed var(--as-line-strong);
    border-radius: 12px;
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--as-muted);
}

.empty-state h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin: 0;
}

/* ==========================================================================
   Board
   ========================================================================== */
body.page-board {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@supports (height: 100dvh) {
    body.page-board {
        height: 100dvh;
    }
}

.board-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.board-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem 1.25rem;
    flex-wrap: wrap;
    padding: 0.9rem 1rem 0.8rem;
}

.board-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.board-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--as-muted);
    font-variant-numeric: tabular-nums;
}

.board-stats strong {
    color: var(--as-ink-2);
    font-weight: 600;
}

.board-hint {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--as-subtle);
}

.kbd {
    display: inline-block;
    min-width: 1.25rem;
    text-align: center;
    border: 1px solid var(--as-line);
    border-radius: 4px;
    padding: 0 0.3rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--as-muted);
    background: var(--as-surface);
}

.board-columns-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: auto;
    display: flex;
    gap: 1rem;
    padding: 0 1rem 1rem;
    align-items: stretch;
    scrollbar-width: thin;
    scrollbar-color: var(--as-line-strong) transparent;
}

.board-column {
    min-width: 300px;
    width: 300px;
    flex: 0 0 300px;
    max-height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--as-column-bg);
    border-radius: 12px;
    overscroll-behavior-y: contain;
    overscroll-behavior-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--as-line-strong) transparent;
}

.column-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 0.9rem 0.6rem;
    background: var(--as-column-bg);
}

.column-header h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0;
    color: var(--as-ink);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--lane-color, var(--as-status-backlog));
}

.column-count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--as-muted);
    background: var(--as-line);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-variant-numeric: tabular-nums;
}

.column-points {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--as-muted);
    font-variant-numeric: tabular-nums;
}

.task-list {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.15rem 0.65rem 0.35rem;
    min-height: 3.5rem;
}

.task-card {
    --bs-border-radius: 8px;
    position: relative;
    background: var(--as-surface);
    border: 0;
    border-radius: var(--bs-border-radius);
    box-shadow: var(--as-card-shadow);
    padding: 0.7rem 0.8rem 0.6rem;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    outline: 1px solid transparent;
    transition: outline-color 0.12s ease, opacity 0.15s ease;
}

.task-card:hover {
    outline-color: var(--as-line-strong);
}

.task-card:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 0;
}

.task-card:active {
    cursor: grabbing;
}

.task-title {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--as-ink);
    overflow-wrap: anywhere;
}

[data-done="1"] .task-title {
    color: var(--as-muted);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--as-subtle);
    min-height: 1.25rem;
}

.task-key {
    font-variant-numeric: tabular-nums;
}

.task-desc-indicator {
    display: inline-flex;
    color: var(--as-subtle);
}

.task-points {
    margin-left: auto;
    min-width: 1.5rem;
    text-align: center;
    background: var(--as-column-bg);
    color: var(--as-ink-2);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.task-card.is-pending {
    opacity: 0.55;
    cursor: progress;
}

.task-card.is-saving {
    opacity: 0.8;
}


.task-card.is-flash {
    outline: 2px solid var(--as-danger);
}

.column-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 0.35rem 0.65rem 0.65rem;
    background: var(--as-column-bg);
}

.quick-add-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    background: transparent;
    color: var(--as-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: left;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
}

.quick-add-toggle:hover {
    background: var(--as-line);
    color: var(--as-ink);
}

.quick-add textarea {
    resize: none;
    font-size: 0.875rem;
    line-height: 1.4;
    border: 0;
    box-shadow: var(--as-card-shadow);
}

.quick-add textarea:focus {
    outline: 2px solid var(--bs-primary);
}

.quick-add-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.quick-add-actions .hint {
    margin-left: auto;
    font-size: 0.6875rem;
    color: var(--as-subtle);
}

/* Points picker (edit modal) */
.points-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.points-chip {
    min-width: 2.4rem;
    border: 1px solid var(--as-line);
    background: var(--as-surface);
    color: var(--as-ink-2);
    border-radius: 8px;
    padding: 0.32rem 0.55rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.points-chip:hover {
    border-color: var(--as-line-strong);
}

.points-chip.active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

.modal-meta {
    margin-right: auto;
    font-size: 0.75rem;
    color: var(--as-subtle);
}

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-region {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    z-index: 1090;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 2rem);
}

.app-toast {
    background: var(--as-ink);
    color: #f8fafc;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.6rem 0.95rem;
    border-radius: 8px;
    pointer-events: auto;
    animation: toast-in 0.16s ease-out;
}

.app-toast.is-error {
    background: #b91c1c;
}

.app-toast.is-leaving {
    opacity: 0;
    transition: opacity 0.2s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Responsive & motion
   ========================================================================== */
@media (max-width: 575.98px) {
    .board-hint {
        display: none;
    }

    .auth-panel {
        padding: 1.25rem;
    }

    .landing {
        padding-top: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   v2 — navigation, avatars, colors
   ========================================================================== */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-left: 0.75rem;
}

.nav-link-item {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--as-muted);
    text-decoration: none;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
}

.nav-link-item:hover {
    color: var(--as-ink);
    background: var(--as-column-bg);
}

.nav-link-item.active {
    color: var(--as-ink);
    background: var(--as-column-bg);
}

.account-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    padding: 0.25rem 0.4rem 0.25rem 0.25rem;
    border-radius: 999px;
    color: var(--as-muted);
    max-width: 16rem;
}

.account-btn:hover,
.account-btn[aria-expanded="true"] {
    background: var(--as-column-bg);
    color: var(--as-ink);
}

.account-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--as-ink-2);
    max-width: 10rem;
}

.dropdown-menu {
    --bs-dropdown-border-color: var(--as-line);
    --bs-dropdown-border-radius: 10px;
    --bs-dropdown-box-shadow: none;
    --bs-dropdown-font-size: 0.875rem;
    --bs-dropdown-link-active-bg: var(--as-column-bg);
    --bs-dropdown-link-active-color: var(--as-ink);
    --bs-dropdown-link-hover-bg: var(--as-column-bg);
    --bs-dropdown-item-padding-y: 0.4rem;
    --bs-dropdown-header-color: var(--as-ink);
    padding: 0.35rem;
    min-width: 13rem;
}

.dropdown-item {
    border-radius: 6px;
}

.dropdown-header {
    font-size: 0.875rem;
    max-width: 16rem;
}

.dropdown-header .small {
    color: var(--as-muted);
}

.avatar {
    --avatar-size: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--avatar-size);
    height: var(--avatar-size);
    flex: 0 0 var(--avatar-size);
    border-radius: 50%;
    background: var(--avatar-bg, var(--as-muted));
    color: #fff;
    font-size: calc(var(--avatar-size) * 0.38);
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    user-select: none;
}

.avatar-xs { --avatar-size: 20px; }
.avatar-sm { --avatar-size: 26px; }
.avatar-lg { --avatar-size: 48px; }

.avatar-more {
    background: var(--as-line);
    color: var(--as-ink-2);
}

.avatar-pending {
    background: var(--as-column-bg);
    color: var(--as-muted);
    outline: 1px dashed var(--as-line-strong);
}

.avatar-stack {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.avatar-stack .avatar {
    outline: 2px solid var(--bs-body-bg);
}

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

.role-pill,
.source-pill {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--as-muted);
    background: var(--as-column-bg);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
}

.source-pill {
    background: transparent;
    outline: 1px solid var(--as-line);
}

.board-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex: 0 0 12px;
    background: var(--board-color, var(--as-status-todo));
}

/* Buttons: danger variants */
.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: #dc2626;
    --bs-btn-border-color: #dc2626;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #b91c1c;
    --bs-btn-hover-border-color: #b91c1c;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #991b1b;
    --bs-btn-active-border-color: #991b1b;
    --bs-btn-disabled-bg: #dc2626;
    --bs-btn-disabled-border-color: #dc2626;
}

.btn-ghost-danger {
    --bs-btn-color: #dc2626;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #b91c1c;
    --bs-btn-hover-bg: #fef2f2;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: #991b1b;
    --bs-btn-active-bg: #fee2e2;
    --bs-btn-active-border-color: transparent;
}

.btn-ghost-danger.is-armed {
    --bs-btn-color: #fff;
    --bs-btn-bg: #dc2626;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #b91c1c;
}

.icon-btn {
    --bs-btn-padding-x: 0.45rem;
    display: inline-flex;
    align-items: center;
}

.form-select-sm {
    font-size: 0.8125rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    border-radius: 6px;
}

.form-check-input:focus {
    box-shadow: none;
    outline: 2px solid rgba(30, 41, 59, 0.2);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Swatches */
.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.swatch {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 0;
    padding: 0;
    background: var(--swatch);
    cursor: pointer;
    outline: 0;
    transition: transform 0.1s ease;
}

.swatch:hover {
    transform: scale(1.08);
}

/* Selection ring: a pseudo-element, so Bootstrap's focus reset (outline: 0) can't hide it. */
.swatch::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid transparent;
    border-radius: 11px;
    pointer-events: none;
    transition: border-color 0.1s ease;
}

.swatch.active::before {
    border-color: var(--as-ink);
}

.swatch:focus-visible::before {
    border-color: var(--as-muted);
}

.swatch.active:focus-visible::before {
    border-color: var(--as-ink);
}

/* White checkmark on the selected color. */
.swatch:not(.swatch-none).active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: center / 14px 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.swatch-none {
    background: var(--as-surface);
    border: 1px dashed var(--as-line-strong);
    position: relative;
}

.swatch-none::after {
    content: '';
    position: absolute;
    left: 5px;
    right: 5px;
    top: 50%;
    height: 1.5px;
    background: var(--as-subtle);
    transform: rotate(-45deg);
}

/* ==========================================================================
   v2 — dashboard groups
   ========================================================================== */
.board-group + .board-group {
    margin-top: 2.5rem;
}

.group-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.group-title {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--as-muted);
    margin: 0;
}

.group-meta {
    font-size: 0.8125rem;
    color: var(--as-subtle);
}

.group-link {
    margin-left: auto;
    font-size: 0.8125rem;
    color: var(--as-muted);
}

.group-empty {
    font-size: 0.875rem;
    color: var(--as-subtle);
    margin: 0;
}

.board-tile {
    position: relative;
    overflow: hidden;
    padding-top: 1.2rem;
}

.board-tile::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--board-color, var(--as-line));
}

.team-tile::before {
    background: var(--as-ink);
}

.board-tile-team {
    font-size: 0.75rem;
    color: var(--as-muted);
    margin-top: 0.15rem;
}

.create-board-team {
    width: auto;
    max-width: 10rem;
}

.create-board {
    max-width: 34rem;
}

/* ==========================================================================
   v2 — settings pages
   ========================================================================== */
.page-narrow {
    max-width: 760px;
}

.settings-card {
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 12px;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.25rem;
    scroll-margin-top: 1rem;
}

.settings-card-head {
    margin-bottom: 1.1rem;
}

.settings-card-head h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.settings-card-head p {
    font-size: 0.875rem;
    color: var(--as-muted);
    margin: 0;
}

.settings-danger {
    border-color: #fecaca;
}

.settings-danger .settings-card-head h2 {
    color: #b91c1c;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.inline-form > .form-control,
.inline-form > .form-select:not(.inline-form-narrow) {
    flex: 1 1 14rem;
    min-width: 0;
}

.inline-form-narrow {
    flex: 0 0 auto;
    width: auto;
}

.subhead {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 1.5rem 0 0.25rem;
}

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

.member-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--as-line);
}

.member-row:first-child {
    border-top: 0;
}

.member-info {
    min-width: 0;
    flex: 1;
}

.member-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--as-ink);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

a.member-name:hover {
    text-decoration: underline;
}

.member-email {
    font-size: 0.8125rem;
    color: var(--as-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.member-actions .form-select-sm {
    width: auto;
}

/* ==========================================================================
   v2 — board toolbar, lanes, drag & drop
   ========================================================================== */
.board-heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.board-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 8px;
    padding: 0 0.5rem;
    height: 32px;
    color: var(--as-subtle);
}

.filter-box:focus-within {
    border-color: var(--bs-primary);
}

.filter-box input {
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 0.8125rem;
    width: 9.5rem;
    color: var(--as-ink);
}

.filter-box input::-webkit-search-cancel-button {
    cursor: pointer;
}

.assignee-filter {
    width: auto;
    max-width: 11rem;
    height: 32px;
}

.board-update-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 1rem 0.75rem;
    padding: 0.5rem 0.6rem 0.5rem 0.9rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 0.8125rem;
    color: #1e3a8a;
}

.board-update-banner[hidden] {
    display: none;
}

.board-update-banner .btn {
    margin-left: auto;
}

.board-column {
    border-top: 3px solid var(--lane-color, var(--as-line-strong));
}

.column-header.is-draggable {
    cursor: grab;
}

.lane-grip {
    display: inline-flex;
    color: var(--as-subtle);
    margin-left: -0.25rem;
    opacity: 0.5;
    transition: opacity 0.12s ease;
}

.column-header:hover .lane-grip {
    opacity: 1;
}

.column-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-name-input {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    height: auto;
    min-width: 0;
    flex: 1;
}

.column-count.is-over {
    background: #fee2e2;
    color: #b91c1c;
}

.column-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--as-muted);
    margin-right: -0.3rem;
    flex-shrink: 0;
}

.column-menu-btn:hover {
    background: var(--as-line);
    color: var(--as-ink);
}

.column-points + .column-menu-btn {
    margin-left: 0.1rem;
}

.task-meta-end {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.task-meta-end .task-points {
    margin-left: 0;
}

.task-card.is-filtered-out {
    display: none;
}

/* Drag & drop — placeholder where the card will land */
.task-card.is-ghost {
    background: rgba(59, 130, 246, 0.08);
    box-shadow: none;
    outline: 2px dashed #3b82f6;
    outline-offset: -2px;
    opacity: 1;
}

.task-card.is-ghost > * {
    visibility: hidden;
}

/* Drag & drop — the card following the cursor */
.task-card.is-drag,
.board-column.is-drag {
    opacity: 1 !important;
    cursor: grabbing !important;
    rotate: 2.5deg;
    scale: 1.03;
    box-shadow: 0 18px 36px -8px rgba(15, 23, 42, 0.35), 0 2px 6px rgba(15, 23, 42, 0.12);
    outline: 2px solid var(--bs-primary);
    z-index: 2000 !important;
}

.board-column.is-drag {
    rotate: 1.5deg;
    scale: 1;
}

body.is-dragging,
body.is-dragging * {
    cursor: grabbing !important;
}

body.is-dragging-task .task-list {
    outline: 2px dashed transparent;
    outline-offset: -4px;
    border-radius: 10px;
    transition: outline-color 0.12s ease, background-color 0.12s ease;
}

body.is-dragging-task .task-list.is-drop-target {
    outline-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.05);
}

.board-column.is-ghost {
    opacity: 1;
    background: transparent;
    outline: 2px dashed #3b82f6;
    outline-offset: -2px;
}

.board-column.is-ghost > * {
    visibility: hidden;
}

.task-card.is-just-dropped {
    animation: drop-pulse 0.6s ease-out;
}

@keyframes drop-pulse {
    0% { outline: 2px solid rgba(59, 130, 246, 0.9); }
    100% { outline: 2px solid rgba(59, 130, 246, 0); }
}

/* Add lane */
.add-lane {
    flex: 0 0 260px;
    min-width: 260px;
    align-self: flex-start;
}

.add-lane-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border: 1.5px dashed var(--as-line-strong);
    background: transparent;
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
    color: var(--as-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.add-lane-btn:hover {
    border-color: var(--as-subtle);
    color: var(--as-ink);
    background: var(--as-column-bg);
}

.add-lane-form {
    background: var(--as-column-bg);
    border-radius: 12px;
    padding: 0.75rem;
}

.lane-delete-zone {
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: 10px;
    font-size: 0.875rem;
    color: #7f1d1d;
}

.lane-delete-zone[hidden] {
    display: none;
}

.confirm-text {
    font-size: 0.9rem;
    color: var(--as-ink-2);
}

.app-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-toast button {
    border: 0;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.2rem 0.55rem;
}

.mini-col {
    border-top: 3px solid var(--lane-color, var(--as-line-strong));
}

@media (max-width: 767.98px) {
    .board-tools {
        margin-left: 0;
        width: 100%;
    }

    .filter-box {
        flex: 1;
    }

    .filter-box input {
        width: 100%;
    }

    .nav-links {
        margin-left: 0.25rem;
    }

    .member-row {
        flex-wrap: wrap;
    }

    .member-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

.label-optional {
    font-weight: 400;
    color: var(--as-subtle);
}

.lane-setting {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem 0;
    border-top: 1px solid var(--as-line);
}

.lane-setting-text {
    flex: 1;
    min-width: 0;
}

.lane-setting-input {
    flex: 0 0 7rem;
    width: 7rem;
}

.lane-setting .form-switch {
    padding-top: 0.15rem;
}

.lane-setting .form-switch .form-check-input {
    width: 2.25rem;
    height: 1.25rem;
    margin-left: -2.5em;
    cursor: pointer;
}

/* ==========================================================================
   History / audit trail
   ========================================================================== */
.history-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.history-filters .form-select {
    width: auto;
    max-width: 14rem;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 12px;
}

.history-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--as-line);
}

.history-row:first-child {
    border-top: 0;
}

.history-row.is-undone .history-summary span {
    text-decoration: line-through;
    color: var(--as-subtle);
}

.history-row.is-undo {
    background: #f8fafc;
}

.history-row.is-warning {
    background: #fef2f2;
}

.history-main {
    flex: 1;
    min-width: 0;
}

.history-summary {
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--as-ink-2);
    overflow-wrap: anywhere;
}

.history-summary strong {
    color: var(--as-ink);
    font-weight: 600;
    margin-right: 0.3rem;
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--as-subtle);
}

.undone-pill {
    margin-left: 0.25rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--as-column-bg);
    color: var(--as-muted);
    font-weight: 500;
}

.history-details {
    margin-top: 0.4rem;
    font-size: 0.75rem;
}

.history-details summary {
    cursor: pointer;
    color: var(--as-muted);
    width: max-content;
}

.history-details dl {
    margin: 0.5rem 0 0;
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    gap: 0.35rem 0.75rem;
}

.history-details dt {
    color: var(--as-muted);
    font-weight: 500;
}

.history-details dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--as-ink-2);
}

.history-details pre {
    margin: 0;
    max-height: 16rem;
    overflow: auto;
    padding: 0.5rem 0.6rem;
    background: var(--as-column-bg);
    border-radius: 6px;
    font-size: 0.6875rem;
    white-space: pre-wrap;
}

.history-actions {
    flex-shrink: 0;
}

/* ==========================================================================
   Projects
   ========================================================================== */
.create-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    margin-bottom: 2rem;
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 12px;
}

.create-bar-name {
    flex: 1 1 16rem;
    min-width: 0;
}

.create-bar .form-select {
    flex: 0 1 12rem;
    width: auto;
    min-width: 0;
}

.project-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex: 0 0 14px;
    align-self: center;
    background: var(--project-color, var(--as-muted));
}

.group-head {
    align-items: center;
    flex-wrap: wrap;
}

.group-title-project {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-transform: none;
    color: var(--as-ink);
}

.group-actions {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

.board-tile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.board-tile-tags:empty {
    display: none;
}

.tile-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--as-ink-2);
    background: var(--as-column-bg);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--tag-color, var(--as-subtle));
    flex-shrink: 0;
}

.tile-tag-team::before {
    border-radius: 50%;
    background: var(--as-ink-2);
}

.board-tile-team {
    display: none;
}

/* Lane headers are drag handles: never select their text. */
.column-header,
.column-header *:not(input) {
    user-select: none;
    -webkit-user-select: none;
}

.column-name-input {
    user-select: text;
    -webkit-user-select: text;
}

body.is-dragging,
body.is-dragging * {
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* ==========================================================================
   Task window (view / edit)
   ========================================================================== */
.task-modal .modal-dialog {
    max-width: 880px;
}

#taskForm[data-mode="view"] [data-edit-only],
#taskForm[data-mode="edit"] [data-view-only] {
    display: none !important;
}

.task-modal-header {
    gap: 0.6rem;
    padding: 1rem 1.25rem 0.5rem;
}

.task-modal-key {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--as-muted);
    font-variant-numeric: tabular-nums;
}

.lane-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--as-ink-2);
    background: var(--as-column-bg);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    max-width: 16rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-pill {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #92400e;
    background: #fef3c7;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
}

.task-modal-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.task-modal-header-actions .btn-close {
    margin: 0;
}

#taskForm[data-mode="edit"] .modal-content,
#taskForm[data-mode="edit"] {
    outline: 2px solid #fcd34d;
    outline-offset: -1px;
}

.task-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 1.75rem;
}

.task-view-title {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 0 0 1.25rem;
    overflow-wrap: anywhere;
}

.task-title-input {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.task-section + .task-section {
    margin-top: 1.75rem;
}

.task-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--as-muted);
    margin: 0 0 0.6rem;
}

.task-side {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--as-line);
}

.task-field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--as-muted);
    margin-bottom: 0.35rem;
}

.task-field-value {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    color: var(--as-ink);
    min-height: 1.5rem;
}

.task-field-muted {
    color: var(--as-subtle);
    font-size: 0.8125rem;
}

.task-field .task-points {
    margin-left: 0;
}

.task-side .points-picker {
    gap: 0.3rem;
}

.task-side .points-chip {
    min-width: 2.1rem;
    padding: 0.25rem 0.4rem;
}

.unsaved-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: -0.25rem 0 1rem;
    padding: 0.6rem 0.75rem;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    font-size: 0.875rem;
    color: #78350f;
}

.unsaved-bar[hidden] {
    display: none;
}

.unsaved-bar span {
    margin-right: auto;
}

/* Rendered description (view mode) */
.rt-view,
.rt-content {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--as-ink);
    overflow-wrap: anywhere;
}

.rt-view.is-empty {
    color: var(--as-subtle);
    font-size: 0.875rem;
    font-style: italic;
}

.rt-view > :first-child,
.rt-content > :first-child {
    margin-top: 0;
}

.rt-view > :last-child,
.rt-content > :last-child {
    margin-bottom: 0;
}

.rt-view p,
.rt-content p {
    margin: 0 0 0.65rem;
}

.rt-view h3,
.rt-content h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 1rem 0 0.4rem;
}

.rt-view h4,
.rt-content h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0.9rem 0 0.35rem;
}

.rt-view ul,
.rt-view ol,
.rt-content ul,
.rt-content ol {
    margin: 0 0 0.65rem;
    padding-left: 1.4rem;
}

.rt-view li,
.rt-content li {
    margin-bottom: 0.15rem;
}

.rt-view blockquote,
.rt-content blockquote {
    margin: 0 0 0.65rem;
    padding: 0.15rem 0 0.15rem 0.85rem;
    border-left: 3px solid var(--as-line-strong);
    color: var(--as-ink-2);
}

.rt-view a,
.rt-content a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rt-view code,
.rt-content code,
.rt-view pre,
.rt-content pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    background: var(--as-column-bg);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
}

.rt-view pre,
.rt-content pre {
    padding: 0.6rem 0.75rem;
    white-space: pre-wrap;
}

/* Editor (edit mode) */
.rt-editor {
    border: 1px solid var(--as-line);
    border-radius: 10px;
    background: var(--as-surface);
}

.rt-editor:focus-within {
    border-color: var(--bs-primary);
}

.rt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem;
    border-bottom: 1px solid var(--as-line);
    background: #fbfcfd;
    border-radius: 10px 10px 0 0;
}

.rt-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--as-ink-2);
    cursor: pointer;
}

.rt-toolbar button:hover {
    background: var(--as-column-bg);
    color: var(--as-ink);
}

.rt-toolbar button.is-active {
    background: var(--as-ink);
    color: #fff;
}

.rt-sep {
    width: 1px;
    height: 18px;
    background: var(--as-line);
    margin: 0 0.3rem;
}

.rt-linkbar {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.45rem;
    border-bottom: 1px solid var(--as-line);
    background: #f8fafc;
}

.rt-linkbar[hidden] {
    display: none;
}

.rt-linkbar input {
    flex: 1 1 14rem;
    min-width: 0;
}

.rt-linkbar input.is-invalid {
    border-color: var(--as-danger);
}

.rt-content {
    position: relative;
    min-height: 11rem;
    max-height: 22rem;
    overflow-y: auto;
    padding: 0.75rem 0.9rem;
    outline: none;
    cursor: text;
}

.rt-content.is-empty::before {
    content: attr(data-placeholder);
    position: absolute;
    left: 0.9rem;
    top: 0.75rem;
    color: var(--as-subtle);
    pointer-events: none;
}

/* Task activity (view mode) */
.task-activity {
    list-style: none;
    margin: 0;
    padding: 0;
}

.task-activity-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--as-line);
    font-size: 0.8125rem;
}

.task-activity-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.task-activity-item .avatar {
    margin-top: 0.1rem;
}

.task-activity-line {
    color: var(--as-ink-2);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.task-activity-line strong {
    color: var(--as-ink);
    font-weight: 600;
}

.task-activity-item.is-undone .task-activity-line {
    text-decoration: line-through;
    color: var(--as-subtle);
}

.task-activity-time {
    display: block;
    font-size: 0.75rem;
    color: var(--as-subtle);
}

.task-activity-empty {
    font-size: 0.8125rem;
    color: var(--as-subtle);
}

@media (max-width: 767.98px) {
    .task-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .task-side {
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid var(--as-line);
        padding-top: 1rem;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

/* Task panel tabs */
.task-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--as-line);
    margin-bottom: 1rem;
}

.task-tab {
    border: 0;
    background: transparent;
    padding: 0.45rem 0.2rem;
    margin-right: 0.9rem;
    margin-bottom: -1px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--as-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.task-tab:hover {
    color: var(--as-ink);
}

.task-tab.active {
    color: var(--as-ink);
    border-bottom-color: var(--as-ink);
}

.task-section[hidden] {
    display: none;
}

.task-section + .task-section {
    margin-top: 0;
}

.task-modal .modal-body {
    min-height: 24rem;
}

/* Full task page */
.task-page {
    max-width: 1040px;
}

.task-page-card {
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 14px;
}

.task-page-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 1rem 1.5rem 0.25rem;
}

.task-page-body {
    padding: 1rem 1.5rem 1.5rem;
}

.task-page-body .task-view-title {
    font-size: 1.75rem;
}

.task-page-body .rt-content {
    min-height: 16rem;
    max-height: none;
}

.task-page-foot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--as-line);
}

.task-page-card[data-mode="edit"] {
    outline: 2px solid #fcd34d;
    outline-offset: -1px;
}

/* Comments */
.task-comments {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--as-line);
}

.comment-count {
    font-weight: 500;
    color: var(--as-subtle);
    letter-spacing: 0;
}

.comment-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.comment-item {
    display: flex;
    gap: 0.7rem;
    padding: 0.65rem 0;
}

.comment-item + .comment-item {
    border-top: 1px solid var(--as-line);
}

.comment-item .avatar {
    margin-top: 0.1rem;
}

.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.8125rem;
}

.comment-head strong {
    color: var(--as-ink);
    font-weight: 600;
}

.comment-time,
.comment-edited {
    font-size: 0.75rem;
    color: var(--as-subtle);
}

.comment-body {
    margin-top: 0.2rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--as-ink);
    overflow-wrap: anywhere;
}

.comment-body a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.comment-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.comment-actions[hidden] {
    display: none;
}

.comment-action {
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--as-muted);
    cursor: pointer;
}

.comment-action:hover {
    color: var(--as-ink);
    text-decoration: underline;
}

.comment-action-danger:hover,
.comment-action-danger.is-armed {
    color: var(--as-danger);
}

.comment-action-danger.is-armed {
    font-weight: 600;
}

.comment-empty {
    font-size: 0.8125rem;
    color: var(--as-subtle);
    padding: 0.25rem 0 0.5rem;
}

.comment-composer {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
}

.comment-composer .avatar {
    margin-top: 0.35rem;
}

.comment-composer-main {
    flex: 1;
    min-width: 0;
}

.comment-composer textarea,
.comment-edit textarea {
    resize: none;
    font-size: 0.9rem;
    line-height: 1.5;
}

.comment-composer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

.comment-composer-actions[hidden] {
    display: none;
}

.comment-composer-actions .form-hint {
    margin-right: auto;
}

.comment-edit {
    margin-top: 0.3rem;
}

.task-comment-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--as-subtle);
    font-variant-numeric: tabular-nums;
}

/* Task key (board settings) */
.key-warning {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #78350f;
}

.key-warning ul {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
}

.key-warning li + li {
    margin-top: 0.2rem;
}

.key-input {
    flex: 0 1 10rem !important;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* Standalone auth pages (forgot / reset) */
.page-auth {
    max-width: 440px;
    padding-top: 4rem;
}

.auth-foot {
    margin: 1.1rem 0 0;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--as-muted);
}

.auth-done {
    padding: 0.9rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #14532d;
}

/* ==========================================================================
   Usability batch: nav extras, notifications, search, due dates, sprints,
   archive, my tasks, mentions, tour, share, landing demo
   ========================================================================== */
.search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 32px;
    padding: 0 0.6rem;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: var(--as-surface);
    color: var(--as-muted);
    font-size: 0.8125rem;
}

.search-trigger:hover {
    border-color: var(--as-line-strong);
    color: var(--as-ink);
}

.icon-nav-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--as-muted);
}

.icon-nav-btn:hover,
.icon-nav-btn[aria-expanded="true"] {
    background: var(--as-column-bg);
    color: var(--as-ink);
}

.notif-badge {
    position: absolute;
    top: 3px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.notif-badge[hidden] {
    display: none;
}

.notif-menu {
    width: 360px;
    max-width: calc(100vw - 24px);
    padding: 0;
}

.notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--as-line);
    font-size: 0.875rem;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem;
    max-height: 420px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.55rem 0.5rem;
    border-radius: 8px;
    color: var(--as-ink-2);
    text-decoration: none;
    font-size: 0.8125rem;
}

.notif-item:hover {
    background: var(--as-column-bg);
    color: var(--as-ink);
}

.notif-item.is-unread {
    background: rgba(59, 130, 246, 0.07);
}

.notif-item.is-unread .notif-message {
    color: var(--as-ink);
    font-weight: 500;
}

.notif-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.notif-message {
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.notif-time {
    font-size: 0.75rem;
    color: var(--as-subtle);
}

.notif-empty {
    padding: 1.25rem 0.75rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--as-subtle);
}

/* Search dialog */
.search-dialog {
    max-width: 620px;
    margin-top: 12vh;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--as-line);
    color: var(--as-subtle);
}

.search-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 1rem;
    color: var(--as-ink);
}

.search-results {
    list-style: none;
    margin: 0;
    padding: 0.35rem;
    max-height: 55vh;
    overflow-y: auto;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--as-ink);
}

.search-item.active {
    background: var(--as-column-bg);
}

.search-type {
    flex: 0 0 auto;
    min-width: 4.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--as-muted);
}

.search-type-task {
    text-transform: none;
    font-variant-numeric: tabular-nums;
    color: var(--as-ink-2);
}

.search-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-title {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-sub {
    font-size: 0.75rem;
    color: var(--as-subtle);
}

.search-empty {
    padding: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--as-subtle);
}

.search-foot {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--as-line);
    font-size: 0.75rem;
    color: var(--as-subtle);
}

/* Lane color edge on cards (inset, so cards keep zero borders) */
.task-card {
    box-shadow: inset 3px 0 0 var(--lane-color, transparent), var(--as-card-shadow);
}

/* Due dates */
.task-due {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--as-muted);
    background: var(--as-column-bg);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    white-space: nowrap;
}

.task-due[hidden] {
    display: none;
}

.task-due.is-soon {
    color: #92400e;
    background: #fef3c7;
}

.task-due.is-overdue {
    color: #b91c1c;
    background: #fee2e2;
}

.task-due.is-done {
    color: var(--as-subtle);
    text-decoration: line-through;
}

.task-field-value .task-due {
    margin-right: 0.25rem;
}

.move-to .btn {
    --bs-btn-padding-y: 0.1rem;
    --bs-btn-padding-x: 0.4rem;
    font-size: 0.75rem;
}

.move-to {
    margin-left: auto;
}

.count-pill {
    display: inline-block;
    min-width: 1.2rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--as-line);
    font-size: 0.6875rem;
    font-weight: 600;
    text-align: center;
}

/* Sprint bar + dialogs */
.sprint-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
    margin: 0 1rem 0.75rem;
    padding: 0.5rem 0.6rem 0.5rem 0.9rem;
    border: 1px solid var(--as-line);
    border-radius: 10px;
    background: var(--as-surface);
    font-size: 0.8125rem;
}

.sprint-bar.is-active {
    border-color: #c7d2fe;
}

.sprint-name {
    font-weight: 700;
    color: var(--as-ink);
}

.sprint-goal {
    color: var(--as-ink-2);
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sprint-meta {
    color: var(--as-muted);
    font-variant-numeric: tabular-nums;
}

.sprint-meta.is-late {
    color: #b91c1c;
    font-weight: 600;
}

.sprint-progress {
    flex: 0 0 120px;
    height: 6px;
    border-radius: 3px;
    background: var(--as-line);
    overflow: hidden;
}

.sprint-progress span {
    display: block;
    height: 100%;
    background: var(--as-status-done);
}

.sprint-actions {
    margin-left: auto;
    display: flex;
    gap: 0.35rem;
}

.sprint-pick {
    list-style: none;
    margin: 0.4rem 0 0.75rem;
    padding: 0;
    max-height: 18rem;
    overflow-y: auto;
    border: 1px solid var(--as-line);
    border-radius: 10px;
}

.sprint-pick li + li {
    border-top: 1px solid var(--as-line);
}

.sprint-pick label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.sprint-pick .form-check-input {
    margin: 0;
    flex-shrink: 0;
}

.sprint-pick-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sprint-pick .comment-empty {
    padding: 0.75rem;
}

.sprint-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sprint-summary > div {
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--as-column-bg);
    display: flex;
    flex-direction: column;
}

.sprint-summary strong {
    font-size: 1.25rem;
    color: var(--as-ink);
    font-variant-numeric: tabular-nums;
}

.sprint-summary span {
    font-size: 0.75rem;
    color: var(--as-muted);
}

.role-pill.is-live {
    background: #dcfce7;
    color: #166534;
}

.burndown-wrap {
    margin-top: 0.5rem;
}

.burndown {
    width: 100%;
    height: auto;
    display: block;
}

.bd-axis {
    stroke: var(--as-line-strong);
    stroke-width: 1;
}

.bd-ideal {
    stroke: var(--as-subtle);
    stroke-width: 1.5;
    stroke-dasharray: 5 5;
}

.bd-actual {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.bd-dot {
    fill: #3b82f6;
}

.bd-label {
    font-size: 11px;
    fill: var(--as-muted);
}

.legend {
    display: inline-block;
    width: 16px;
    height: 0;
    vertical-align: middle;
    margin-right: 0.2rem;
}

.legend-ideal {
    border-top: 2px dashed var(--as-subtle);
}

.legend-actual {
    border-top: 3px solid #3b82f6;
}

/* Archive + my tasks */
.archive-filter {
    max-width: 22rem;
}

.archive-key {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--as-muted);
    min-width: 3.5rem;
}

.member-row[hidden] {
    display: none;
}

.my-task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 12px;
}

.my-task-list li + li {
    border-top: 1px solid var(--as-line);
}

.my-task {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    padding: 0.7rem 0.9rem;
    color: var(--as-ink);
    text-decoration: none;
}

.my-task:hover {
    background: var(--as-column-bg);
    color: var(--as-ink);
}

.my-task .task-key {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--as-muted);
    min-width: 3.5rem;
}

.my-task-title {
    flex: 1 1 14rem;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.my-task-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Mentions */
.mention {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
    padding: 0 0.15rem;
    font-weight: 500;
}

.mention-menu {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 20;
    min-width: 14rem;
    margin: 0.25rem 0 0;
    padding: 0.25rem;
    list-style: none;
    background: var(--as-surface);
    border: 1px solid var(--as-line);
    border-radius: 10px;
}

.mention-menu[hidden] {
    display: none;
}

.mention-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
}

.mention-option.active,
.mention-option:hover {
    background: var(--as-column-bg);
}

/* First-run tour */
.tour-tip {
    position: fixed;
    z-index: 1080;
    width: 290px;
    padding: 0.9rem 1rem 0.75rem;
    background: var(--as-ink);
    color: #f8fafc;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.45;
}

.tour-tip p {
    margin: 0 0 0.6rem;
}

.tour-foot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.tour-foot span {
    margin-right: auto;
}

.tour-foot .btn-ghost {
    --bs-btn-color: #cbd5e1;
    --bs-btn-hover-bg: rgba(255, 255, 255, 0.1);
    --bs-btn-hover-color: #fff;
}

.tour-foot .btn-primary {
    --bs-btn-bg: #f8fafc;
    --bs-btn-color: #0f172a;
    --bs-btn-border-color: #f8fafc;
    --bs-btn-hover-bg: #e2e8f0;
    --bs-btn-hover-color: #0f172a;
    --bs-btn-hover-border-color: #e2e8f0;
}

.tour-highlight {
    outline: 2px solid #3b82f6 !important;
    outline-offset: 3px;
    border-radius: 8px;
}

/* Share page */
.share-cta {
    font-size: 0.8125rem;
    color: var(--as-muted);
}

.task-card.is-readonly {
    cursor: pointer;
}

/* Landing demo */
.demo-board {
    margin-top: 2.25rem;
    max-width: 33rem;
}

.demo-hint {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--as-muted);
    margin: 0 0 0.6rem;
}

.demo-hint.is-success {
    color: #15803d;
}

.demo-board .mini-board {
    margin-top: 0;
}

.mini-list {
    min-height: 2.6rem;
}

.mini-card {
    cursor: grab;
    user-select: none;
}

.mini-card.is-ghost {
    opacity: 0.4;
}

.mini-card.is-drag {
    opacity: 1 !important;
    rotate: 2deg;
    box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.3);
}

.mini-count {
    margin-left: auto;
    font-weight: 600;
    color: var(--as-subtle);
}

/* Touch devices: larger tap targets, no hover-only affordances */
@media (hover: none) {
    .task-card {
        padding: 0.8rem 0.85rem 0.7rem;
    }

    .lane-grip {
        opacity: 1;
    }

    .column-menu-btn,
    .quick-add-toggle {
        min-height: 36px;
    }
}

@media (max-width: 575.98px) {
    .board-column {
        min-width: 85vw;
        flex-basis: 85vw;
    }

    .sprint-actions {
        margin-left: 0;
    }

    .sprint-summary {
        grid-template-columns: 1fr;
    }

    .nav-links .nav-link-item {
        padding: 0.35rem 0.4rem;
    }
}

/* ==========================================================================
   Dark mode (follows the system setting)
   ========================================================================== */
[data-bs-theme="dark"] {
    --bs-body-color: #e2e8f0;
    --bs-body-color-rgb: 226, 232, 240;
    --bs-body-bg: #0b1120;
    --bs-body-bg-rgb: 11, 17, 32;
    --bs-primary: #e2e8f0;
    --bs-primary-rgb: 226, 232, 240;
    --bs-border-color: #263244;
    --bs-secondary-color: #94a3b8;
    --bs-emphasis-color: #f8fafc;
    --bs-link-color: #93c5fd;
    --bs-link-color-rgb: 147, 197, 253;
    --bs-link-hover-color: #bfdbfe;
    --bs-link-hover-color-rgb: 191, 219, 254;

    --as-ink: #f1f5f9;
    --as-ink-2: #cbd5e1;
    --as-muted: #94a3b8;
    --as-subtle: #64748b;
    --as-line: #243042;
    --as-line-strong: #334155;
    --as-surface: #131c2e;
    --as-column-bg: #0f1726;
    --as-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color: #0f172a;
    --bs-btn-bg: #e2e8f0;
    --bs-btn-border-color: #e2e8f0;
    --bs-btn-hover-color: #0f172a;
    --bs-btn-hover-bg: #f8fafc;
    --bs-btn-hover-border-color: #f8fafc;
    --bs-btn-active-color: #0f172a;
    --bs-btn-active-bg: #cbd5e1;
    --bs-btn-active-border-color: #cbd5e1;
    --bs-btn-disabled-color: #0f172a;
    --bs-btn-disabled-bg: #e2e8f0;
    --bs-btn-disabled-border-color: #e2e8f0;
}

[data-bs-theme="dark"] .app-toast {
    background: #1e293b;
    color: #f1f5f9;
    outline: 1px solid #334155;
}

[data-bs-theme="dark"] .app-toast.is-error {
    background: #7f1d1d;
}

[data-bs-theme="dark"] .tour-tip {
    background: #1e293b;
    outline: 1px solid #334155;
}

[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu {
    background: var(--as-surface);
}

[data-bs-theme="dark"] .modal-backdrop {
    --bs-backdrop-opacity: 0.6;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--as-column-bg);
    border-color: var(--as-line-strong);
    color: var(--as-ink);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #94a3b8;
    outline-color: rgba(148, 163, 184, 0.25);
}

[data-bs-theme="dark"] .rt-toolbar,
[data-bs-theme="dark"] .rt-linkbar,
[data-bs-theme="dark"] .history-row.is-undo {
    background: var(--as-column-bg);
}

[data-bs-theme="dark"] .rt-toolbar button.is-active,
[data-bs-theme="dark"] .points-chip.active {
    background: #e2e8f0;
    border-color: #e2e8f0;
    color: #0f172a;
}

[data-bs-theme="dark"] .board-update-banner {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    color: #bfdbfe;
}

[data-bs-theme="dark"] .key-warning,
[data-bs-theme="dark"] .unsaved-bar {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fde68a;
}

[data-bs-theme="dark"] .lane-delete-zone,
[data-bs-theme="dark"] .history-row.is-warning {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

[data-bs-theme="dark"] .auth-done {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

[data-bs-theme="dark"] .settings-danger {
    border-color: rgba(239, 68, 68, 0.4);
}

[data-bs-theme="dark"] .settings-danger .settings-card-head h2 {
    color: #fca5a5;
}

[data-bs-theme="dark"] .task-due.is-soon {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.18);
}

[data-bs-theme="dark"] .task-due.is-overdue {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.2);
}

[data-bs-theme="dark"] .column-count.is-over {
    background: rgba(239, 68, 68, 0.2);
    color: #fecaca;
}

[data-bs-theme="dark"] .mention {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.18);
}

[data-bs-theme="dark"] .role-pill.is-live {
    background: rgba(34, 197, 94, 0.18);
    color: #bbf7d0;
}

[data-bs-theme="dark"] .mode-pill {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
}

[data-bs-theme="dark"] .rt-view a,
[data-bs-theme="dark"] .rt-content a,
[data-bs-theme="dark"] .comment-body a {
    color: #93c5fd;
}

[data-bs-theme="dark"] .task-card.is-ghost,
[data-bs-theme="dark"] .board-column.is-ghost {
    background: rgba(59, 130, 246, 0.12);
}

[data-bs-theme="dark"] .swatch.active::before {
    border-color: #f1f5f9;
}

[data-bs-theme="dark"] .btn-ghost-danger {
    --bs-btn-color: #f87171;
    --bs-btn-hover-bg: rgba(239, 68, 68, 0.15);
    --bs-btn-hover-color: #fca5a5;
}

[data-bs-theme="dark"] ::selection {
    background: #e2e8f0;
    color: #0f172a;
}

/* Theme switch */
.theme-menu {
    padding: 0.25rem 0.5rem 0.35rem;
}

.theme-menu-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--as-muted);
    margin: 0 0 0.35rem 0.15rem;
}

.theme-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--as-column-bg);
    border-radius: 9px;
}

.theme-switch button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 0;
    background: transparent;
    padding: 0.35rem 0.6rem;
    border-radius: 7px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--as-muted);
    cursor: pointer;
}

.theme-switch button:hover {
    color: var(--as-ink);
}

.theme-switch button.active {
    background: var(--as-surface);
    color: var(--as-ink);
    outline: 1px solid var(--as-line);
}

.theme-menu .theme-switch {
    display: flex;
}

.theme-menu .theme-switch button {
    flex: 1;
    justify-content: center;
    padding: 0.35rem 0.4rem;
}

/* Ctrl/Cmd-hover quick actions on cards */
.card-quick {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    gap: 4px;
    z-index: 3;
}

.card-quick button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--as-line);
    background: var(--as-surface);
    color: var(--as-ink-2);
    border-radius: 6px;
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.card-quick button:hover {
    border-color: var(--as-line-strong);
    color: var(--as-ink);
}

.card-quick button.is-danger {
    color: #b91c1c;
}

.card-quick button.is-danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

body.quick-mode .task-card:not(.is-pending):hover .card-quick {
    display: flex;
}

body.quick-mode .task-card:not(.is-pending):hover {
    outline: 1px dashed var(--as-line-strong);
    cursor: default;
}

[data-bs-theme="dark"] .card-quick button.is-danger {
    color: #f87171;
}

[data-bs-theme="dark"] .card-quick button.is-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Preferences (account settings) */
.pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--as-line);
}

.pref-row:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.pref-row > div:first-child {
    flex: 1 1 18rem;
    min-width: 0;
}

.pref-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--as-ink);
}

.app-toast button {
    font-variant-numeric: tabular-nums;
    min-width: 4.6rem;
}

/* Dashboard: settings shortcut on board tiles */
.board-tile-wrap {
    position: relative;
    display: flex;
}

.board-tile-wrap > .board-tile {
    flex: 1;
    min-width: 0;
    padding-right: 2.6rem;
}

.tile-settings {
    position: absolute;
    top: 0.75rem;
    right: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    color: var(--as-muted);
    opacity: 0;
    transition: opacity 0.12s ease, background-color 0.12s ease;
}

.board-tile-wrap:hover .tile-settings,
.tile-settings:focus-visible {
    opacity: 1;
}

.tile-settings:hover {
    background: var(--as-column-bg);
    color: var(--as-ink);
}

@media (hover: none) {
    .tile-settings {
        opacity: 1;
    }
}

/* Two-factor sign-in */
.tfa-steps {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.9rem;
}

.tfa-steps > li + li {
    margin-top: 1.1rem;
}

.tfa-qr {
    width: 196px;
    height: 196px;
    margin: 0.75rem 0 0.5rem;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--as-line);
    border-radius: 10px;
}

.tfa-qr svg {
    width: 100%;
    height: 100%;
    display: block;
}

.tfa-secret {
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    word-break: break-all;
}

.tfa-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.tfa-form .form-control {
    flex: 1 1 10rem;
    min-width: 0;
}

.pref-row .tfa-form {
    margin-top: 0;
}

.tfa-code-input {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.tfa-codes {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    border-radius: 10px;
    font-size: 0.875rem;
    color: #78350f;
}

.tfa-codes[hidden] {
    display: none;
}

.tfa-code-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 1.5rem;
    margin: 0 0 0.9rem;
    padding-left: 1.4rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    color: var(--as-ink);
}

[data-bs-theme="dark"] .tfa-codes {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fde68a;
}
