/* ─── FloBox app styles — tokens from floforgelabs.com/ds/css/ffl.css ── */

/* ─── Map legacy tokens to ffl tokens ───────────────────────── */
:root,
[data-theme="dark"],
[data-theme="light"] {
    --bg: var(--ffl-bg);
    --panel: var(--ffl-panel);
    --ink: var(--ffl-ink);
    --muted: var(--ffl-muted);
    --line: var(--ffl-line);
    --accent: var(--ffl-accent);
    --accent-soft: var(--ffl-accent-soft);
    --baby-blue: var(--ffl-blue);
    --done: var(--ffl-done);
    --sb-bg: var(--ffl-sb-bg);
    --sb-text: var(--ffl-sb-text);
    --sb-text-muted: var(--ffl-sb-muted);
    --sb-hover: var(--ffl-sb-hover);
    --sb-active-bg: var(--ffl-sb-active);
    --sb-border: var(--ffl-sb-border);
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-thumb {
    background: var(--ffl-line-strong);
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--ffl-muted);
}

/* ─── Base ───────────────────────────────────────────────────── */
body {
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
    transition:
        background 0.2s,
        color 0.2s;
}
button {
    font-family: inherit;
    cursor: pointer;
}
.logo-font {
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.01em;
}

/* ─── Auth screen ────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sb-bg);
    padding: 1rem;
}
.auth-card {
    background: var(--panel);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--ffl-shadow-lg);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.auth-logo-mark {
    width: 40px;
    height: 40px;
    border-radius: 0.625rem;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.auth-logo-name {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.01em;
    line-height: 1;
}
.auth-logo-sub {
    font-size: 0.75rem;
    color: var(--muted);
}
.auth-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--ink);
}
.auth-field {
    margin-bottom: 1rem;
}
.auth-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.375rem;
}
.auth-field input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--ink);
    background: var(--bg);
    transition: border-color 0.15s;
}
.auth-field input:focus {
    outline: none;
    border-color: var(--ffl-focus);
}
.auth-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-top: 0.5rem;
    transition: opacity 0.15s;
}
.auth-btn:hover {
    opacity: 0.88;
}
.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--muted);
}
.auth-switch a {
    color: var(--ffl-link);
    text-decoration: none;
    font-weight: 500;
}
.auth-switch a:hover {
    text-decoration: underline;
}
.auth-error {
    background: var(--accent-soft);
    border: 1px solid #fca5a5;
    color: var(--accent-ink);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
}
.auth-error.visible {
    display: block;
}
.auth-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}
.auth-error.visible {
    display: block;
}
.auth-trial-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 1rem;
}

/* ─── App shell ──────────────────────────────────────────────── */
.app-wrap {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: 256px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--sb-bg);
    border-right: 1px solid var(--sb-border);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
}
@media (min-width: 768px) {
    .sidebar {
        position: static;
        transform: none;
    }
}
.sidebar.open {
    transform: translateX(0);
}
.sb-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--sb-border);
}
.sb-logo-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sb-logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sb-logo-name {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sb-text);
    letter-spacing: 0.01em;
    line-height: 1;
}
.sb-logo-sub {
    font-size: 0.7rem;
    color: var(--sb-text-muted);
    margin-top: 0.15rem;
}
.sb-ws {
    padding: 0.75rem;
    position: relative;
}
.sb-ws-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--sb-hover);
    border: none;
    color: var(--sb-text);
    font-size: 0.875rem;
    font-weight: 500;
}
.sb-ws-btn:hover {
    background: var(--ffl-sb-hover);
    filter: brightness(1.1);
}
.sb-ws-menu {
    display: none;
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    top: 100%;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: 0.5rem;
    box-shadow: var(--ffl-shadow-md);
    padding: 0.25rem;
    z-index: 50;
}
.sb-ws-menu.open {
    display: block;
}
.sb-ws-menu button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    background: none;
    color: var(--sb-text);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sb-ws-menu button:hover {
    background: var(--sb-hover);
}
.sb-ws-menu .ws-add {
    color: var(--sb-text);
    border-top: 1px solid var(--sb-border);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}
.sb-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}
.sb-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ffl-sb-muted);
    padding: 0 0.5rem;
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sb-section-label button {
    border: none;
    background: none;
    color: var(--sb-text-muted);
    padding: 0.1rem 0.25rem;
    border-radius: 0.25rem;
}
.sb-section-label button:hover {
    color: var(--sb-text);
    background: var(--sb-hover);
}
.sb-divider {
    margin: 0.75rem 0;
    border: none;
    border-top: 1px solid var(--sb-border);
}
.sb-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: none;
    color: var(--sb-text);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-item:hover {
    background: var(--sb-hover);
}
.sb-item.active {
    background: var(--sb-active-bg);
    color: #fff;
}
.sb-item.sys.active {
    background: transparent;
    color: var(--accent-ink);
    border-left: 3px solid var(--accent);
    border-radius: 0 0.5rem 0.5rem 0;
    padding-left: calc(0.75rem - 3px);
}
.sb-item.active svg {
    opacity: 1;
}
.sb-item.sys.active svg {
    opacity: 1;
    color: var(--accent-ink);
}
.sb-item svg {
    opacity: 0.6;
    flex-shrink: 0;
}
.sb-item.active.recur {
    background: var(--sb-hover);
    border-left: 3px solid var(--accent);
    color: var(--sb-text);
}
.sb-item.active.recur svg {
    color: var(--accent-ink);
    opacity: 1;
}
.sb-item.sys:not(.active) {
    color: var(--sb-text);
}
[data-theme="dark"] .sb-item.sys.active {
    color: var(--ffl-blue);
    border-left-color: var(--ffl-blue);
}
[data-theme="dark"] .sb-item.sys.active svg {
    color: var(--ffl-blue);
}
[data-theme="dark"] .sb-item.active.recur {
    border-left-color: var(--ffl-blue);
}

/* ─── Backdrop ───────────────────────────────────────────────── */
.backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 30;
}
.backdrop.open {
    display: block;
}

/* ─── Main ───────────────────────────────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--sb-border);
    background: var(--sb-bg);
}
@media (min-width: 768px) {
    .mobile-bar {
        display: none;
    }
}
.mobile-bar button {
    border: none;
    background: none;
    color: #cbd5e1;
    padding: 0.25rem;
    border-radius: 0.25rem;
}
.mobile-bar .mb-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mobile-bar .mb-logo-mark {
    width: 24px;
    height: 24px;
    border-radius: 0.3rem;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-bar .mb-logo-name {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sb-text);
}

/* ─── Trial banner ───────────────────────────────────────────── */
.trial-banner {
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    padding: 0.5rem 1.5rem;
    font-size: 0.8125rem;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
[data-theme="dark"] .trial-banner {
    background: #1c1000;
    border-bottom-color: #92400e;
    color: #fbbf24;
}

/* ─── Quick-add / search bar ─────────────────────────────────── */
.quick-bar {
    border-bottom: 1px solid var(--line);
    padding: 0.875rem 1.5rem;
    background: var(--panel);
    position: relative;
}
.quick-bar textarea {
    width: 100%;
    resize: none;
    background: transparent;
    border: none;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--ink);
    outline: none;
}
.quick-bar textarea::placeholder {
    color: var(--muted);
}
.quick-menu {
    display: none;
    position: absolute;
    left: 1.5rem;
    right: 1.5rem;
    top: 100%;
    margin-top: 0.5rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.625rem;
    box-shadow: var(--ffl-shadow-md);
    padding: 0.25rem;
    z-index: 30;
    max-width: 400px;
}
.quick-menu.open {
    display: block;
}
.quick-menu button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.quick-menu button:hover {
    background: var(--bg);
}

/* ─── View ───────────────────────────────────────────────────── */
.view {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}
@media (max-width: 767px) {
    .view {
        padding: 1rem;
    }
}
.view-header {
    margin-bottom: 1.5rem;
}
.view-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.view-header p {
    font-size: 0.875rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

/* ─── List cards ─────────────────────────────────────────────── */
.list-card {
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: 0.625rem;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    transition:
        opacity 0.2s,
        border-color 0.2s;
}
.list-card:hover {
    border-color: var(--accent);
}
.list-card.reminder {
    background: var(--accent-soft);
    border-color: #fca5a5;
}
.list-card-body {
    flex: 1;
    min-width: 0;
}
.list-card-body .title {
    font-size: 0.9375rem;
    overflow-wrap: anywhere;
}
.list-card .task-cb {
    margin-top: calc((1.40625rem - 1rem) / 2);
}
.list-card-body .sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.125rem;
}
.list-card-body .sub .open-link {
    color: var(--accent-ink);
}

/* ─── Section label ──────────────────────────────────────────── */
.section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.5rem;
}
.section-label.accent {
    color: var(--accent-ink);
}

/* ─── Project view ───────────────────────────────────────────── */
.project-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    color: var(--muted);
}
.project-dates input[type="date"] {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--ink);
    margin-left: 0.375rem;
}
.project-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.375rem;
    outline: none;
}
.project-name:focus {
    box-shadow: 0 1px 0 var(--accent);
}
.project-desc {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    outline: none;
    max-width: 640px;
    line-height: 1.6;
}
.project-desc:focus {
    box-shadow: 0 1px 0 var(--accent);
}

/* ─── Task rows ──────────────────────────────────────────────── */
/* Action bar inside an open task */
.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px dashed var(--line);
    width: 100%;
}
.task-action-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    border: 1px solid var(--line);
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    transition:
        color 0.12s,
        border-color 0.12s,
        background 0.12s;
    white-space: nowrap;
}
.task-action-btn:hover {
    color: var(--ink);
    border-color: var(--line-strong);
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .task-action-btn:hover {
    background: rgba(255, 255, 255, 0.07);
}
.task-action-btn.danger {
    color: var(--accent-ink);
    border-color: var(--accent-soft);
}
.task-action-btn.danger:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.task-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.task-action-btn:disabled:hover {
    color: var(--muted);
    border-color: var(--line);
    background: none;
}
.task-box {
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: 0.625rem;
    padding: 0.625rem 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    transition:
        opacity 0.2s,
        border-color 0.2s;
}
.task-box.has-desc {
    align-items: flex-start;
}

/* ─── Control alignment ──────────────────────────────────────────
   No description → box centers everything (clean single line).
   Has description → top-align, and nudge controls onto the first line. */
.task-box .task-cb {
    margin-top: calc((1.40625rem - 1rem) / 2);
} /* 16px checkbox */
.task-box.subtask .task-cb {
    margin-top: calc((1.3125rem - 1rem) / 2);
} /* .875rem titles */
.task-grip {
    display: flex;
    align-items: center;
    cursor: move;
}
.task-box .task-grip {
    height: 1.40625rem;
}
.task-grip:active {
    cursor: move;
}
.dragging,
.dragging * {
    cursor: move !important;
}
.task-box .task-icon-btn {
    margin-top: -0.0625rem;
} /* 23px buttons */
.task-box:not(.done):not(.subtask) {
    border-color: var(--line);
}
.task-box.subtask {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--ffl-blue);
    padding: 0.5rem 0.75rem;
    margin-left: 0.75rem;
}
[data-theme="dark"] .task-box.subtask {
    background: var(--ffl-panel-raised);
    border-left-color: var(--ffl-blue);
}
.task-box.done {
    opacity: 0.5;
    border-color: var(--line);
}
/* Unified hover: every task surface borders brand red on hover. */
.task-box:not(.done):hover,
.recur-box:not(.done):hover {
    border-color: var(--accent);
}
/* …but keep the subtask's blue left marker on hover. */
.task-box.subtask:not(.done):hover {
    border-left-color: var(--ffl-blue);
}
.task-col {
    flex: 1;
    min-width: 0;
}
/* Task-tree indentation is CSS-driven (via the --depth var set in taskRow) so it can
   flex down on narrow screens instead of the old flat depth*40px inline margin. */
.task-node {
    margin-left: calc(var(--depth, 0) * 40px);
}
/* ─── Mobile task rows ───────────────────────────────────────────
   On phones the row was cramped: a flat 40px-per-level indent, desktop
   gaps/padding, and 5–6 controls left almost no room for the title. Halve
   the indent, tighten spacing, and give the content column priority. */
@media (max-width: 600px) {
    .task-node {
        margin-left: calc(var(--depth, 0) * 14px);
    }
    .task-box {
        gap: 0.375rem;
        padding: 0.625rem 0.5625rem;
    }
    .task-box.subtask {
        margin-left: 0.25rem;
        padding: 0.5rem 0.5625rem;
    }
    .task-actions {
        gap: 0.3125rem;
    }
    /* Drag-reorder is unreliable on touch; reclaim the grip's width for content. */
    .task-grip {
        display: none;
    }
    /* A subtask-less task's chevron is just a hidden placeholder for desktop alignment;
       collapse it on mobile so the title column matches the (good-looking) standalone rows. */
    .task-chev-empty {
        display: none;
    }
}
.task-title {
    font-size: 0.9375rem;
    overflow-wrap: anywhere;
    color: var(--ink);
}
.task-title.subtask {
    font-size: 0.875rem;
}
.task-title.done {
    text-decoration: line-through;
    color: var(--done);
}
.task-desc {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}
.task-edit-input {
    width: 100%;
    font-size: 0.9375rem;
    border: 1px solid var(--line);
    border-radius: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-family: inherit;
    color: var(--ink);
    background: var(--bg);
}
.task-edit-input:focus {
    outline: none;
    border-color: var(--ffl-focus);
}
.task-edit-textarea {
    width: 100%;
    font-size: 0.8125rem;
    border: 1px solid var(--line);
    border-radius: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-family: inherit;
    color: var(--muted);
    resize: vertical;
    margin-top: 0.375rem;
    background: var(--bg);
}
.task-edit-textarea:focus {
    outline: none;
    border-color: var(--ffl-focus);
}
.task-edit-btns {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.375rem;
}
.task-edit-btns button {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
}
.btn-save {
    background: var(--accent);
    color: #fff;
}
.btn-cancel {
    color: var(--muted);
    background: var(--bg);
}
.task-badges {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: 0.375rem;
}
.badge-muted {
    background: var(--line);
    color: var(--muted);
}
.badge {
    font-size: 0.6875rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}
.badge-due {
    background: #eef2ff;
    color: #4338ca;
}
.badge-blocked {
    background: var(--accent-soft);
    color: var(--accent-ink);
    cursor: pointer;
}
.badge-tickler {
    background: #f0fdf4;
    color: #15803d;
}
.badge-baby-blue {
    background: var(--ffl-blue-soft);
    color: var(--ffl-blue-text);
}
[data-theme="dark"] .badge-due {
    background: #1e1b4b;
    color: #a5b4fc;
}
[data-theme="dark"] .badge-tickler {
    background: #052e16;
    color: #4ade80;
}

@keyframes notif-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(196, 30, 30, 0.4);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 4px rgba(196, 30, 30, 0);
    }
}
.task-icon-btn {
    border: none;
    background: none;
    padding: 0.25rem 0.375rem;
    border-radius: 0.375rem;
    color: var(--muted);
    flex-shrink: 0;
}
.task-icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--ink);
}
[data-theme="dark"] .task-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}
.add-task-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
    background: none;
    border: none;
    margin-top: 0.75rem;
    padding: 0.25rem 0;
}
.add-task-btn:hover {
    opacity: 0.7;
}

/* ─── Drag ───────────────────────────────────────────────────── */
.dragging {
    opacity: 0.35;
}
.drag-over-top {
    box-shadow: 0 -2px 0 var(--accent);
}
.drag-over-bottom {
    box-shadow: 0 2px 0 var(--accent);
}

/* ─── Recurring rows ─────────────────────────────────────────── */
.recur-box {
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: 0.625rem;
    padding: 0.625rem 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    transition:
        opacity 0.2s,
        border-color 0.2s;
}
.recur-box.done {
    opacity: 0.5;
    border-color: var(--line);
}
.recur-box.highlight-pulse,
.task-box.highlight-pulse {
    opacity: 1 !important;
}
.recur-status {
    font-size: 0.6875rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    flex-shrink: 0;
}
.recur-status.due {
    background: var(--accent-soft);
    color: var(--accent-ink);
}
.recur-status.done {
    background: #f0fdf4;
    color: #15803d;
}
[data-theme="dark"] .recur-status.done {
    background: #052e16;
    color: #4ade80;
}

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 18, 0.38);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}
.modal-overlay.open {
    display: flex;
}
.modal-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.875rem;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ffl-shadow-lg);
    animation: modal-in 0.2s ease;
}
@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.modal-head h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}
.modal-head button {
    border: none;
    background: none;
    color: var(--muted);
    padding: 0.25rem;
    border-radius: 0.25rem;
}
.modal-head button:hover {
    background: var(--bg);
}
.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}
.modal-foot button {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    opacity: 0.88;
}
.btn-ghost {
    color: var(--muted);
    background: none;
}
.btn-ghost:hover {
    background: var(--bg);
}
.btn-danger {
    color: var(--accent-ink);
    background: none;
}
.btn-danger:hover {
    background: var(--accent-soft);
}
.modal-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.375rem;
}
.modal-field input,
.modal-field textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--ink);
    background: var(--bg);
    resize: none;
}
.modal-field input:focus,
.modal-field textarea:focus {
    outline: none;
    border-color: var(--ffl-focus);
}

/* A tick box with its label beside it, in a dialog (the field rules above make every input full width). */
.modal-field-check {
    display: flex;
    align-items: center;
    gap: var(--ffl-space-sm);
}
.modal-field-check input[type="checkbox"] {
    width: auto;
    padding: 0;
}
.modal-field-check input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--ffl-focus);
    outline-offset: 2px;
}
.modal-field-check label {
    margin-bottom: 0;
    font-size: var(--ffl-text-sm);
    color: var(--ink);
}

/* ─── Float menu ─────────────────────────────────────────────── */
.float-menu {
    position: fixed;
    z-index: 40;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.625rem;
    box-shadow: var(--ffl-shadow-md);
    padding: 0.25rem;
    width: 192px;
}
.float-menu button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    background: none;
    font-size: 0.8125rem;
    color: var(--ink);
}
.float-menu button:hover {
    background: var(--bg);
}
.float-menu .fm-danger {
    color: var(--accent-ink);
    border-top: 1px solid var(--line);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}
.float-menu .fm-danger:hover {
    background: var(--accent-soft);
}

/* ─── Highlight / fade ───────────────────────────────────────── */
.highlight-pulse {
    animation: hlpulse 0.85s ease-in-out 3 !important;
}
@keyframes hlpulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 var(--accent);
    }
    50% {
        box-shadow: 0 0 0 4px var(--accent);
    }
}
.fade-in {
    animation: fi 0.2s ease both;
}
@keyframes fi {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ─── Settings ───────────────────────────────────────────────── */

.settings-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 480px;
    margin-bottom: 1.5rem;
}
.settings-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.settings-field {
    margin-bottom: 0.875rem;
}
.settings-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.375rem;
}
.settings-field input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--ink);
}
.settings-field input:focus {
    outline: none;
    border-color: var(--ffl-focus);
}

/* ─── Help & About ───────────────────────────────────────────── */
.help-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 680px;
    margin-bottom: 1.5rem;
}
.help-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--ink);
}
.help-section p {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.65;
    margin-bottom: 0.75rem;
}
.help-section ol,
.help-section ul {
    padding-left: 1.25rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.8;
}
.help-section .ffl-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--sb-bg);
    color: #fff;
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ─── Search results ─────────────────────────────────────────── */
#searchResults {
    background: var(--panel) !important;
    border-color: var(--line) !important;
}

/* ─── Home dashboard ─────────────────────────────────────────── */
.home-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
@media (max-width: 600px) {
    .home-stats {
        grid-template-columns: 1fr;
    }
}
.home-stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    text-align: center;
}
.home-stat-num {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
}
.home-stat-label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.375rem;
}
.home-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.home-card h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 0.25rem;
}
.home-empty {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 0.5rem 0;
}
.home-task {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    margin-top: 0.375rem;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s;
}
.home-task:hover {
    background: var(--bg);
    border-color: var(--ffl-blue);
}
.home-proj {
    padding: 0.625rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s;
}
.home-proj:hover {
    background: var(--bg);
    border-color: var(--ffl-blue);
}
.home-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 999px;
    margin-top: 0.5rem;
    overflow: hidden;
}
.home-bar-fill {
    height: 100%;
    background: var(--ffl-blue);
    border-radius: 999px;
    transition: width 0.3s;
}

/* ─── AI assistant box ───────────────────────────────────────── */
.ai-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1rem 1.1rem 0.9rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.ai-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.75rem;
}
.ai-spark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--ffl-blue-soft);
    font-size: 0.9rem;
}
.ai-log {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
    padding-right: 0.15rem;
}
.ai-hint {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
    padding: 0.25rem 0;
}
/* Empty state */
.ai-empty {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.25rem 0 0.5rem;
}
.ai-empty-text {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.55;
}
.ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.ai-chip {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
    font-family: inherit;
    transition:
        border-color 0.12s,
        background 0.12s,
        color 0.12s;
}
.ai-chip:hover {
    border-color: var(--ffl-blue);
    background: var(--ffl-blue-soft);
    color: var(--ffl-blue-text);
}
/* Conversation rows */
.ai-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.ai-row-user {
    justify-content: flex-end;
}
.ai-row-asst {
    justify-content: flex-start;
}
.ai-avatar {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--ffl-blue-soft);
    font-size: 0.78rem;
    margin-top: 0.1rem;
}
.ai-msg {
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.55rem 0.8rem;
    border-radius: 1rem;
    max-width: 85%;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    animation: aiFade 0.18s ease;
}
.ai-user {
    background: var(--ffl-blue);
    color: #fff;
    border-bottom-right-radius: 0.35rem;
}
.ai-asst {
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    border-bottom-left-radius: 0.35rem;
}
@keyframes aiFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.ai-thinking {
    opacity: 0.7;
    font-style: italic;
}
/* Composer — textarea + circular send button in one rounded pill */
.ai-composer {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 0.4rem 0.4rem 0.4rem 0.85rem;
    transition:
        border-color 0.12s,
        box-shadow 0.12s;
}
.ai-composer:focus-within {
    border-color: var(--ffl-blue);
    box-shadow: 0 0 0 3px var(--ffl-blue-soft);
}
.ai-input {
    flex: 1;
    min-width: 0;
    resize: none;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--ink);
    outline: none;
    padding: 0.3rem 0;
    max-height: 160px;
    overflow-y: auto;
}
.ai-send-btn {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: var(--ffl-red);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        filter 0.12s,
        transform 0.05s;
}
.ai-send-btn:hover {
    filter: brightness(1.08);
}
.ai-send-btn:active {
    transform: scale(0.94);
}
/* Text CTA button kept for the no-key "Add your API key" state */
.ai-send {
    align-self: flex-start;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    background: var(--ffl-red);
    color: #fff;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.ai-send:hover {
    filter: brightness(1.05);
}
.ai-footer {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.6rem;
}
.ai-reset {
    font-size: 0.75rem;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}
.ai-reset:hover {
    color: var(--ink);
    text-decoration: underline;
}

/* ─── Header primary action button ───────────────────────────── */
.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--ffl-red);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: filter 0.12s;
}
.header-action-btn:hover {
    filter: brightness(1.05);
}
.header-action-btn svg {
    width: 16px;
    height: 16px;
}
/* Muted header action — sits next to the title (global FloForge page-header
   pattern). Subtle by default; brand-red only on hover. Replaces the loud
   .header-action-btn in viewHeader(). */
.header-add {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 0.5rem;
    padding: 0.3rem 0.7rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition:
        border-color 0.12s,
        color 0.12s;
}
.header-add:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
}
.header-add svg {
    width: 15px;
    height: 15px;
}
/* ─── Settings pages: JS masonry columns ─────────────────────── */
/* Hide the view until masonry has placed the cards, so the un-packed
   stack is never painted (kills the entry flash). offsetHeight still
   measures correctly under visibility:hidden. */
#view.masonry-pending {
    visibility: hidden;
}
.masonry-cols {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    margin-top: 0.25rem;
}
.masonry-cols > div {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.masonry-cols .settings-card {
    max-width: none;
    width: 100%;
    margin-bottom: 0;
}
/* Drag handle — keep the grab cursor visible over the icon */
.task-grip svg {
    pointer-events: none;
}
.task-grip {
    cursor: move;
}
.task-grip:active {
    cursor: move;
}

/* ─── Log (timeline entries) ─────────────────────────────────────
   New FB2 surface: classes + --ffl-* tokens only, no inline styles. */
.project-header-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: var(--ffl-text-sm);
    color: var(--accent-ink);
    cursor: pointer;
    flex-shrink: 0;
}
.entry-filters {
    display: flex;
    flex-direction: column;
    gap: var(--ffl-space-sm);
    margin-bottom: var(--ffl-space-lg);
}
.entry-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ffl-space-xs);
}
.entry-filter-label {
    font-size: var(--ffl-text-xs);
    color: var(--ffl-muted);
    min-width: 4.5rem;
}
.entry-filter-select {
    width: auto;
    max-width: 16rem;
    padding: 0.2rem 0.5rem;
    font-size: var(--ffl-text-sm);
}
.entry {
    background: var(--ffl-panel);
    border: 1.5px solid var(--ffl-line);
    border-radius: var(--ffl-r-lg);
    padding: var(--ffl-space-md);
    margin-bottom: var(--ffl-space-sm);
}
.entry-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ffl-space-xs);
    font-size: var(--ffl-text-xs);
    color: var(--ffl-muted);
}
.entry-title {
    font-size: var(--ffl-text-base);
    font-weight: 600;
    margin: var(--ffl-space-xs) 0 0;
    overflow-wrap: anywhere;
}
.entry-body,
.entry-why {
    font-size: var(--ffl-text-sm);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-top: var(--ffl-space-xs);
}
.entry-why-label {
    font-weight: 600;
}
.entry-meta {
    font-size: var(--ffl-text-xs);
    color: var(--ffl-muted);
    margin-top: var(--ffl-space-xs);
}
.entry-actions {
    margin-top: var(--ffl-space-sm);
    display: flex;
    gap: var(--ffl-space-xs);
}
.entry-action {
    font-size: var(--ffl-text-xs);
    padding: 0.2rem 0.625rem;
}
/* Settled: grey in place. Nothing is hidden; colour alone says "no longer live". */
.entry--settled {
    background: transparent;
    color: var(--ffl-muted);
}
.entry--settled .entry-title {
    font-weight: 500;
    color: var(--ffl-muted);
}
/* System notes: the quiet exhaust of metadata changes. */
.entry--system {
    background: transparent;
    border-style: dashed;
    padding: var(--ffl-space-sm) var(--ffl-space-md);
    font-size: var(--ffl-text-xs);
    color: var(--ffl-muted);
}
.entry-empty {
    font-size: var(--ffl-text-sm);
    color: var(--ffl-muted);
    padding: var(--ffl-space-lg) 0;
}
.entry-more {
    margin: var(--ffl-space-md) 0;
}
.entry-composer-types {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ffl-space-xs);
    margin-bottom: var(--ffl-space-md);
}
.entry-composer-error {
    font-size: var(--ffl-text-sm);
    color: var(--ffl-red-text);
    margin-top: var(--ffl-space-sm);
}
.entry-hint {
    font-size: var(--ffl-text-xs);
    color: var(--ffl-muted);
    margin-top: var(--ffl-space-xs);
}
.entry-composer-fields .modal-field {
    margin-bottom: var(--ffl-space-md);
}
.modal-field .ffl-select {
    background: var(--bg);
}

/* ─── Log entry detail + chains ──────────────────────────────── */
.entry-title-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--ffl-line-strong);
    text-underline-offset: 0.2em;
}
.entry-title-link:hover {
    text-decoration-color: currentColor;
}
.entry-prior {
    margin-top: var(--ffl-space-md);
    padding-left: var(--ffl-space-md);
    border-left: 3px solid var(--ffl-line-strong);
}
.entry-prior .entry:last-child {
    margin-bottom: 0;
}
.entry-detail {
    margin-bottom: var(--ffl-space-lg);
}
.entry-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ffl-space-sm);
}
.entry-section-title {
    font-size: var(--ffl-text-lg);
    font-weight: 600;
    margin: var(--ffl-space-lg) 0 var(--ffl-space-sm);
}
.entry-detail .entry-section-title {
    margin-top: 0;
}
.entry-field {
    margin-top: var(--ffl-space-md);
}
.entry-field-label {
    display: block;
    font-size: var(--ffl-text-xs);
    font-weight: 500;
    color: var(--ffl-muted);
    margin-bottom: var(--ffl-space-xs);
}
.entry-field-check {
    display: flex;
    align-items: center;
    gap: var(--ffl-space-sm);
}
.entry-field-check .entry-field-label {
    margin-bottom: 0;
}
/* Ink: a locked definition field reads as fixed, not as a disabled glitch. */
.entry-detail .ffl-input[readonly],
.entry-detail .ffl-select:disabled {
    background: transparent;
    border-style: dashed;
    color: var(--ffl-muted);
    cursor: default;
    opacity: 1;
}
.entry-btn {
    font-family: inherit;
    font-size: var(--ffl-text-sm);
    padding: 0.5rem 1rem;
    border-radius: var(--ffl-r-md);
    border: 1px solid transparent;
    cursor: pointer;
}
.entry-btn.btn-ghost {
    border-color: var(--ffl-line-strong);
    color: var(--ffl-ink);
}
.entry-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.entry-action-lg {
    margin-top: var(--ffl-space-md);
}
.entry-fix {
    margin-top: var(--ffl-space-lg);
    padding-top: var(--ffl-space-md);
    border-top: 1px solid var(--ffl-line);
}
.entry-fix-label {
    font-size: var(--ffl-text-sm);
    margin-bottom: var(--ffl-space-sm);
}
.entry-chain {
    list-style: none;
    padding: 0;
    margin: 0;
}
.entry-chain-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ffl-space-xs);
    padding: var(--ffl-space-sm) 0;
    border-bottom: 1px solid var(--ffl-line);
    font-size: var(--ffl-text-sm);
}
.entry-chain-item:last-child {
    border-bottom: none;
}

/* Parked or later entry: the promote action under the page header. */
.entry-promote {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ffl-space-md);
    margin: var(--ffl-space-sm) 0 var(--ffl-space-md);
}
.entry-promote .entry-hint {
    margin: 0;
}

/* Milestone page: what is tagged to it, one count per status. */
.milestone-counts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ffl-space-sm);
    list-style: none;
    margin: var(--ffl-space-sm) 0 var(--ffl-space-md);
    padding: 0;
}
.milestone-count {
    display: flex;
    flex-direction: column;
    min-width: 5.5rem;
    padding: var(--ffl-space-sm) var(--ffl-space-md);
    border: 1px solid var(--ffl-line);
    border-radius: var(--ffl-r-md);
}
.milestone-count-number {
    font-size: var(--ffl-text-lg);
    color: var(--ffl-ink);
}
.milestone-count-label {
    font-size: var(--ffl-text-sm);
    color: var(--ffl-muted);
}

/* Confirmation shown right beside the control that was used, so it is never off-screen. */
.entry-status {
    font-size: var(--ffl-text-sm);
    color: var(--ffl-badge-green-text);
    margin-top: var(--ffl-space-xs);
    min-height: 1.25em;
}

/* ─── Today: entry-tasks + Context strip ─────────────────────── */
.today-entries {
    margin-top: var(--ffl-space-xl);
}
.entry-today-cb {
    width: 1rem;
    height: 1rem;
    accent-color: var(--ffl-accent);
    flex-shrink: 0;
}
.entry-today-gone {
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.3s, transform 0.3s;
}
/* Quiet by design: smaller and lighter than the task lists above, so Today stays a to-do page. */
.today-context {
    margin-top: var(--ffl-space-xl);
}
.today-context-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--ffl-space-sm);
    width: 100%;
    padding: var(--ffl-space-xs) 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--ffl-line);
    font: inherit;
    font-size: var(--ffl-text-sm);
    color: var(--ffl-muted);
    text-align: left;
    cursor: pointer;
}
.today-context-line:hover .today-context-title {
    text-decoration: underline;
}
.today-context-title {
    color: var(--ffl-ink);
}

/* ─── Search ─────────────────────────────────────────────────── */
.search-form {
    margin-bottom: var(--ffl-space-md);
}
.search-group {
    margin-bottom: var(--ffl-space-lg);
}
.search-group[hidden] {
    display: none;
}
.search-mark {
    background: var(--ffl-blue-soft);
    color: var(--ffl-blue-text);
    border-radius: var(--ffl-r-sm);
    padding: 0 0.1em;
}
.search-local-hit {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--ffl-space-sm);
    width: 100%;
    padding: var(--ffl-space-sm) 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--ffl-line);
    font: inherit;
    font-size: var(--ffl-text-sm);
    color: var(--ffl-ink);
    text-align: left;
    cursor: pointer;
}
.search-local-hit:hover .search-local-title {
    text-decoration: underline;
}

/* ─── The search bar's dropdown (combobox listbox) ───────────── */
.search-pop {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 100;
    max-height: min(32rem, 70vh);
    overflow-y: auto;
    background: var(--ffl-panel);
    border: 1px solid var(--ffl-line);
    border-radius: 0 0 var(--ffl-r-lg) var(--ffl-r-lg);
    box-shadow: var(--ffl-shadow-md);
}
/* "See all results" stays visible however long the list is. */
.search-pop-group--footer {
    position: sticky;
    bottom: 0;
    background: var(--ffl-panel);
    border-top: 1px solid var(--ffl-line);
}
.search-pop-group--footer .search-opt {
    border-bottom: none;
}
/* The app draws its own clear button (with a name); hide the browser's second one. */
#searchInput::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}
.search-pop[hidden] {
    display: none;
}
.search-group-label {
    padding: var(--ffl-space-sm) var(--ffl-space-md) var(--ffl-space-xs);
    font-size: var(--ffl-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ffl-muted);
}
.search-opt {
    display: flex;
    align-items: center;
    gap: var(--ffl-space-sm);
    padding: var(--ffl-space-sm) var(--ffl-space-md);
    border-bottom: 1px solid var(--ffl-line);
    cursor: pointer;
}
.search-opt .ffl-badge {
    flex-shrink: 0;
}
.search-opt.is-active {
    background: var(--ffl-panel-raised);
    outline: 2px solid var(--ffl-focus);
    outline-offset: -2px;
}
.search-opt-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.search-opt-title {
    font-size: var(--ffl-text-sm);
    font-weight: 500;
    overflow-wrap: anywhere;
}
.search-opt-sub {
    font-size: var(--ffl-text-xs);
    color: var(--ffl-muted);
}
.search-note {
    padding: var(--ffl-space-sm) var(--ffl-space-md);
    font-size: var(--ffl-text-sm);
    color: var(--ffl-muted);
}
/* Text for screen readers only (live-region announcements). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Declared project completion ────────────────────────────── */
.project-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ffl-space-sm);
    padding: var(--ffl-space-sm) var(--ffl-space-md);
    margin-bottom: var(--ffl-space-md);
    border-radius: var(--ffl-r-lg);
    font-size: var(--ffl-text-sm);
}
.project-state--complete {
    background: var(--ffl-badge-green-bg);
    color: var(--ffl-badge-green-text);
}
/* Save-on-change settings: the control with its "Saving… / Saved / error" note right beside it. */
.autosave-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ffl-space-sm) var(--ffl-space-md);
}
.autosave-row .ffl-select {
    width: auto;
    min-width: 8rem;
}
/* A member's role: a compact select inside a member row. */
.role-select {
    width: auto;
    padding: var(--ffl-space-xs) var(--ffl-space-sm);
    font-size: var(--ffl-text-sm);
}
.autosave-note {
    font-size: var(--ffl-text-sm);
    color: var(--ffl-muted);
}
.autosave-note--ok {
    color: var(--ffl-badge-green-text);
}
.autosave-note--error {
    color: var(--ffl-red-text);
}
/* Over the workspace's active-project limit: a warning, never a block. */
.project-state--over {
    background: var(--ffl-badge-amber-bg);
    color: var(--ffl-badge-amber-text);
}
.modal-intro {
    margin-bottom: var(--ffl-space-md);
}
/* A completion or reopening is a fact in the stream: prominent, never greyed. */
.entry--event {
    border-left-width: 4px;
}
.entry--event-completed {
    border-left-color: var(--ffl-badge-green-text);
}
.entry--event-reopened {
    border-left-color: var(--ffl-blue);
}
.entry-warning {
    background: var(--ffl-badge-amber-bg);
    color: var(--ffl-badge-amber-text);
    border-radius: var(--ffl-r-md);
    padding: var(--ffl-space-sm) var(--ffl-space-md);
    margin-bottom: var(--ffl-space-md);
    font-size: var(--ffl-text-sm);
}
.entry-warning-title {
    font-weight: 600;
}
.entry-warning-list {
    margin: var(--ffl-space-xs) 0 var(--ffl-space-sm) var(--ffl-space-lg);
}

/* Links under a project's Log header (Search this project, Mark complete): a horizontal row. */
.project-links {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--ffl-space-md);
    margin-bottom: var(--ffl-space-md);
}
