/* ─── Stoei Log app styles. Reads Stoei Core settings only (--st-*); the
   look itself is set in theme.css. ───────────────────────────────── */

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

/* ─── Base ───────────────────────────────────────────────────── */
body {
    font-family: var(--st-font-body);
    background: var(--st-color-bg);
    color: var(--st-color-text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    transition:
        background 0.2s,
        color 0.2s;
}
.logo-font {
    font-family: var(--st-font-display);
    letter-spacing: 0.01em;
}

/* ─── Auth screen ────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--st-color-bg);
    padding: 1rem;
}
.auth-card {
    background: var(--st-color-surface);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--st-shadow-3);
}
.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(--st-color-accent-fill);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.auth-logo-name {
    font-family: var(--st-font-display);
    font-size: var(--st-text-12);
    font-weight: 700;
    color: var(--st-color-text);
    letter-spacing: 0.01em;
    line-height: 1;
}
.auth-logo-sub {
    font-size: var(--st-text-0);
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--st-color-eyebrow);
    margin-top: 0.3rem;
}
.auth-title {
    font-size: var(--st-text-7);
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--st-color-text);
}
/* Sign-in fields are kit fields (st-field); this only spaces them. */
.auth-field {
    margin-bottom: var(--st-space-4);
}
.task-edit-input:focus,
.task-edit-textarea:focus,
.modal-field input:focus,
.modal-field textarea:focus,
.settings-field input:focus {
    border-color: var(--st-color-accent);
}
/* Sign-in buttons are kit buttons (st-btn st-btn--primary); this only lays them out. */
.auth-btn {
    width: 100%;
    margin-top: var(--st-space-2);
}
.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
}
.auth-switch a {
    color: var(--st-color-accent);
    text-decoration: none;
    font-weight: 500;
}
.auth-switch a:hover {
    text-decoration: underline;
}
.auth-error {
    background: var(--st-color-bad-tint);
    border: 1px solid var(--st-color-bad-line);
    color: var(--st-color-bad);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: var(--st-text-3);
    margin-bottom: 1rem;
    display: none;
}
.auth-error.visible {
    display: block;
}
.auth-success {
    background: var(--st-color-ok-tint);
    border: 1px solid var(--st-color-line-strong);
    color: var(--st-color-ok);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: var(--st-text-3);
    margin-bottom: 1rem;
    line-height: 1.4;
}
.auth-error.visible {
    display: block;
}
.auth-trial-note {
    text-align: center;
    font-size: var(--st-text-2);
    color: var(--st-color-text-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(--st-color-sidebar);
    border-right: 1px solid var(--st-color-sidebar-line);
    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(--st-color-sidebar-line);
}
.sb-logo-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sb-logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: var(--st-color-accent-fill);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sb-logo-name {
    font-family: var(--st-font-display);
    font-size: var(--st-text-10);
    font-weight: 700;
    color: var(--st-color-on-sidebar);
    letter-spacing: 0.01em;
    line-height: 1;
}
.sb-logo-sub {
    font-size: var(--st-text-0);
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--st-color-on-sidebar-muted);
    margin-top: 0.3rem;
}
.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(--st-color-sidebar-hover);
    border: none;
    color: var(--st-color-on-sidebar);
    font-size: var(--st-text-3);
    font-weight: 500;
}
.sb-ws-btn:hover {
    background: var(--st-color-sidebar-hover);
    filter: brightness(1.1);
}
.sb-ws-menu {
    display: none;
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    top: 100%;
    background: var(--st-color-sidebar);
    border: 1px solid var(--st-color-sidebar-line);
    border-radius: 0.5rem;
    box-shadow: var(--st-shadow-2);
    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(--st-color-on-sidebar);
    font-size: var(--st-text-3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sb-ws-menu button:hover {
    background: var(--st-color-sidebar-hover);
}
.sb-ws-menu .ws-add {
    color: var(--st-color-on-sidebar);
    border-top: 1px solid var(--st-color-sidebar-line);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}
.sb-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}
.sb-section-label {
    font-size: var(--st-text-1);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--st-color-on-sidebar-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(--st-color-on-sidebar-muted);
    padding: 0.1rem 0.25rem;
    border-radius: 0.25rem;
}
.sb-section-label button:hover {
    color: var(--st-color-on-sidebar);
    background: var(--st-color-sidebar-hover);
}
.sb-divider {
    margin: 0.75rem 0;
    border: none;
    border-top: 1px solid var(--st-color-sidebar-line);
}
.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(--st-color-on-sidebar);
    font-size: var(--st-text-3);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-item:hover {
    background: var(--st-color-sidebar-hover);
}
.sb-item.active {
    background: var(--st-color-accent);
    color: var(--st-color-on-accent);
}
.sb-item.sys.active {
    background: transparent;
    color: var(--st-color-accent);
    border-left: var(--st-border-stripe) solid var(--st-color-accent-fill);
    border-radius: 0 0.5rem 0.5rem 0;
    padding-left: calc(var(--st-space-3) - var(--st-border-stripe));
}
.sb-item.active svg {
    opacity: 1;
}
.sb-item.sys.active svg,
.sb-item.active.recur svg {
    opacity: 1;
    color: var(--st-color-accent);
}
.sb-item svg {
    opacity: 0.6;
    flex-shrink: 0;
}
.sb-item.active.recur {
    background: var(--st-color-sidebar-hover);
    border-left: 3px solid var(--st-color-accent-fill);
    color: var(--st-color-on-sidebar);
}
.sb-item.sys:not(.active) {
    color: var(--st-color-on-sidebar);
}
[data-theme="dark"] .sb-item.sys.active {
    color: var(--st-color-accent);
    border-left-color: var(--st-color-accent);
}
[data-theme="dark"] .sb-item.sys.active svg {
    color: var(--st-color-accent);
}
[data-theme="dark"] .sb-item.active.recur {
    border-left-color: var(--st-color-accent);
}

/* ─── Backdrop ───────────────────────────────────────────────── */
.backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--st-color-backdrop);
    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(--st-color-sidebar-line);
    background: var(--st-color-sidebar);
}
@media (min-width: 768px) {
    .mobile-bar {
        display: none;
    }
}
.mobile-bar button {
    border: none;
    background: none;
    color: var(--st-color-on-sidebar);
    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(--st-color-accent-fill);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-bar .mb-logo-name {
    font-family: var(--st-font-display);
    font-size: var(--st-text-8);
    font-weight: 700;
    color: var(--st-color-on-sidebar);
}

/* ─── Trial banner ───────────────────────────────────────────── */
.trial-banner {
    background: var(--st-color-warn-tint);
    border-bottom: 1px solid var(--st-color-line);
    padding: 0.5rem 1.5rem;
    font-size: var(--st-text-2);
    color: var(--st-color-warn);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
[data-theme="dark"] .trial-banner {
    background: var(--st-color-warn-tint);
    border-bottom-color: var(--st-color-warn);
    color: var(--st-color-warn);
}

/* ─── Quick-add / search bar ─────────────────────────────────── */
.quick-bar {
    border-bottom: 1px solid var(--st-color-line);
    /* Thin, because the 44px kit icon buttons in it set the height */
    padding: var(--st-space-1) var(--st-space-6);
    background: var(--st-color-surface);
    position: relative;
}
.quick-bar textarea {
    width: 100%;
    resize: none;
    background: transparent;
    border: none;
    font-size: var(--st-text-4);
    font-family: inherit;
    color: var(--st-color-text);
    outline: none;
}
.quick-bar textarea::placeholder {
    color: var(--st-color-text-muted);
}
.quick-menu {
    display: none;
    position: absolute;
    left: 1.5rem;
    right: 1.5rem;
    top: 100%;
    margin-top: 0.5rem;
    background: var(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0.625rem;
    box-shadow: var(--st-shadow-2);
    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: var(--st-text-3);
    color: var(--st-color-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.quick-menu button:hover {
    background: var(--st-color-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: var(--st-text-10);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.view-header p {
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
    margin-top: 0.25rem;
}

/* ─── List cards ─────────────────────────────────────────────── */
.list-card {
    background: var(--st-color-surface);
    border: 1.5px solid var(--st-color-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(--st-color-accent-fill);
}
.list-card.reminder {
    background: var(--st-color-accent-tint);
    border-color: var(--st-color-accent-fill);
}
.list-card-body,
.task-col {
    flex: 1;
    min-width: 0;
}
.list-card-body .title {
    font-size: var(--st-text-4);
    overflow-wrap: anywhere;
}
.list-card .task-cb {
    margin-top: calc((1.40625rem - 1rem) / 2);
}
.list-card-body .sub {
    font-size: var(--st-text-1);
    color: var(--st-color-text-muted);
    margin-top: 0.125rem;
}
.list-card-body .sub .open-link {
    color: var(--st-color-accent);
}

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

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

/* ─── 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(--st-color-line);
    width: 100%;
}
.task-action-btn {
    font-size: var(--st-text-1);
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    border: 1px solid var(--st-color-line);
    background: none;
    color: var(--st-color-text-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(--st-color-text);
    border-color: var(--st-color-line-strong);
    background: var(--st-color-hover);
}
.task-action-btn.danger {
    color: var(--st-color-bad);
    border-color: var(--st-color-bad-tint);
}
.task-action-btn.danger:hover {
    background: var(--st-color-bad-tint);
    border-color: var(--st-color-bad);
}
.task-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.task-action-btn:disabled:hover {
    color: var(--st-color-text-muted);
    border-color: var(--st-color-line);
    background: none;
}
.task-box {
    background: var(--st-color-surface);
    border: 1.5px solid var(--st-color-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(--st-color-line);
}
.task-box.subtask {
    background: var(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-left: 3px solid var(--st-color-accent);
    padding: 0.5rem 0.75rem;
    margin-left: 0.75rem;
}
[data-theme="dark"] .task-box.subtask {
    background: var(--st-color-raised);
    border-left-color: var(--st-color-accent);
}
.task-box.done,
.recur-box.done {
    opacity: 0.5;
    border-color: var(--st-color-line);
}
/* Unified hover: every task surface borders brand red on hover. */
.task-box:not(.done):hover,
.recur-box:not(.done):hover {
    border-color: var(--st-color-accent-fill);
}
/* …but keep the subtask's blue left marker on hover. */
.task-box.subtask:not(.done):hover {
    border-left-color: var(--st-color-accent);
}
/* 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) * var(--st-space-8));
}
/* ─── 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) * var(--st-space-4));
    }
    .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: var(--st-text-4);
    overflow-wrap: anywhere;
    color: var(--st-color-text);
}
.task-title.subtask {
    font-size: var(--st-text-3);
}
.task-title.done {
    text-decoration: line-through;
    color: var(--st-color-text-faint);
}
.task-desc {
    font-size: var(--st-text-2);
    color: var(--st-color-text-muted);
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}
.task-edit-input {
    width: 100%;
    font-size: var(--st-text-4);
    border: 1px solid var(--st-color-line);
    border-radius: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-family: inherit;
    color: var(--st-color-text);
    background: var(--st-color-bg);
}
.task-edit-textarea {
    width: 100%;
    font-size: var(--st-text-2);
    border: 1px solid var(--st-color-line);
    border-radius: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-family: inherit;
    color: var(--st-color-text-muted);
    resize: vertical;
    margin-top: 0.375rem;
    background: var(--st-color-bg);
}
.task-badges {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: 0.375rem;
}
.badge-muted {
    background: var(--st-color-line);
    color: var(--st-color-text-muted);
}
.badge {
    font-size: var(--st-text-1);
    padding: 0.1rem 0.5rem;
    border-radius: var(--st-radius-pill);
}
.badge-blocked {
    background: var(--st-color-bad-tint);
    color: var(--st-color-bad);
    cursor: pointer;
}

@keyframes notif-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: var(--st-ring-pulse-bad-start);
    }
    50% {
        transform: scale(1.15);
        box-shadow: var(--st-ring-pulse-bad-end);
    }
}
.task-icon-btn {
    border: none;
    background: none;
    padding: 0.25rem 0.375rem;
    border-radius: 0.375rem;
    color: var(--st-color-text-muted);
    flex-shrink: 0;
}
.task-icon-btn:hover {
    background: var(--st-color-hover);
    color: var(--st-color-text);
}
.add-task-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--st-text-3);
    color: var(--st-color-text-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: var(--st-shadow-drop-above);
}
.drag-over-bottom {
    box-shadow: var(--st-shadow-drop-below);
}

/* ─── Recurring rows ─────────────────────────────────────────── */
.recur-box {
    background: var(--st-color-surface);
    border: 1.5px solid var(--st-color-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.highlight-pulse,
.task-box.highlight-pulse {
    opacity: 1 !important;
}

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--st-color-backdrop);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open {
    display: flex;
}
.modal-card {
    background: var(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0.875rem;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--st-shadow-3);
    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(--st-color-line);
    flex-shrink: 0;
}
.modal-head h3 {
    font-size: var(--st-text-4);
    font-weight: 600;
}
.modal-head button {
    border: none;
    background: none;
    color: var(--st-color-text-muted);
    padding: 0.25rem;
    border-radius: 0.25rem;
}
.modal-head button:hover {
    background: var(--st-color-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(--st-color-line);
    flex-shrink: 0;
}
.modal-field label {
    display: block;
    font-size: var(--st-text-1);
    font-weight: 500;
    color: var(--st-color-text-muted);
    margin-bottom: 0.375rem;
}
.modal-field input,
.modal-field textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--st-color-line);
    border-radius: 0.5rem;
    font-size: var(--st-text-3);
    font-family: inherit;
    color: var(--st-color-text);
    background: var(--st-color-bg);
    resize: none;
}
/* A tick box with its label beside it, in a dialog (the field rules above make every input full width). */
.modal-field-check,
.entry-field-check {
    display: flex;
    align-items: center;
    gap: var(--st-space-3);
}
.modal-field-check input[type="checkbox"] {
    width: auto;
    padding: 0;
}
.modal-field-check input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--st-color-accent);
    outline-offset: 2px;
}
.modal-field-check label {
    margin-bottom: 0;
    font-size: var(--st-text-3);
    color: var(--st-color-text);
}

/* ─── Float menu ─────────────────────────────────────────────── */
.float-menu {
    position: fixed;
    z-index: 40;
    background: var(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0.625rem;
    box-shadow: var(--st-shadow-2);
    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: var(--st-text-2);
    color: var(--st-color-text);
}
.float-menu button:hover {
    background: var(--st-color-bg);
}
.float-menu .fm-danger {
    color: var(--st-color-bad);
    border-top: 1px solid var(--st-color-line);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}
.float-menu .fm-danger:hover {
    background: var(--st-color-bad-tint);
}

/* ─── Highlight / fade ───────────────────────────────────────── */
.highlight-pulse {
    animation: hlpulse 0.85s ease-in-out 3 !important;
}
@keyframes hlpulse {
    0%,
    100% {
        box-shadow: none;
    }
    50% {
        box-shadow: var(--st-ring-pulse-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(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 480px;
    margin-bottom: 1.5rem;
}
.settings-card h2 {
    font-size: var(--st-text-5);
    font-weight: 600;
    margin-bottom: 1rem;
}
.settings-field {
    margin-bottom: 0.875rem;
}
.settings-field label {
    display: block;
    font-size: var(--st-text-2);
    color: var(--st-color-text-muted);
    margin-bottom: 0.375rem;
}
.settings-field input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--st-color-line);
    border-radius: 0.5rem;
    font-size: var(--st-text-3);
    font-family: inherit;
    background: var(--st-color-bg);
    color: var(--st-color-text);
}
/* ─── Help & About ───────────────────────────────────────────── */
.help-section {
    background: var(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 680px;
    margin-bottom: 1.5rem;
}
.help-section h2 {
    font-size: var(--st-text-5);
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--st-color-text);
}
.help-section p {
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
    line-height: 1.65;
    margin-bottom: 0.75rem;
}
.help-section ol,
.help-section ul {
    padding-left: 1.25rem;
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
    line-height: 1.8;
}
.help-section .st-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--st-color-sidebar);
    color: var(--st-color-on-accent);
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    font-size: var(--st-text-2);
    margin-top: 0.5rem;
}

/* ─── Search results ─────────────────────────────────────────── */
#searchResults {
    background: var(--st-color-surface) !important;
    border-color: var(--st-color-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(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    text-align: center;
}
.home-stat-num {
    font-size: var(--st-text-12);
    font-weight: 800;
    line-height: 1;
}
.home-stat-label {
    font-size: var(--st-text-2);
    color: var(--st-color-text-muted);
    margin-top: 0.375rem;
}
.home-card {
    background: var(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.home-card h2 {
    font-size: var(--st-text-5);
    font-weight: 700;
    color: var(--st-color-text);
    margin: 0 0 0.25rem;
}
.home-empty {
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
    padding: 0.5rem 0;
}
.home-task {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--st-color-line);
    border-radius: 0.5rem;
    margin-top: 0.375rem;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s;
}
.home-task:hover,
.home-proj:hover {
    background: var(--st-color-bg);
    border-color: var(--st-color-accent);
}
.home-proj {
    padding: 0.625rem;
    border: 1px solid var(--st-color-line);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s;
}
.home-bar {
    height: 6px;
    background: var(--st-color-bg);
    border-radius: var(--st-radius-pill);
    margin-top: 0.5rem;
    overflow: hidden;
}
.home-bar-fill {
    height: 100%;
    background: var(--st-color-accent);
    border-radius: var(--st-radius-pill);
    transition: width 0.3s;
}

/* ─── AI assistant box ───────────────────────────────────────── */
.ai-box {
    background: var(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 1rem;
    padding: 1rem 1.1rem 0.9rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--st-shadow-1);
}
.ai-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--st-text-4);
    font-weight: 700;
    color: var(--st-color-text);
    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(--st-color-accent-tint);
    font-size: var(--st-text-3);
}
.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: var(--st-text-3);
    color: var(--st-color-text-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: var(--st-text-3);
    color: var(--st-color-text-muted);
    line-height: 1.55;
}
.ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.ai-chip {
    font-size: var(--st-text-2);
    padding: 0.35rem 0.7rem;
    border-radius: var(--st-radius-pill);
    border: 1px solid var(--st-color-line);
    background: var(--st-color-bg);
    color: var(--st-color-text);
}
/* Pointer, font and hover come from the kit's .st-pill--filter (also on these chips). */
/* 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(--st-color-accent-tint);
    font-size: var(--st-text-1);
    margin-top: 0.1rem;
}
.ai-msg {
    font-size: var(--st-text-3);
    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(--st-color-accent);
    color: var(--st-color-on-accent);
    border-bottom-right-radius: 0.35rem;
}
.ai-asst {
    background: var(--st-color-bg);
    color: var(--st-color-text);
    border: 1px solid var(--st-color-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(--st-color-bg);
    border: 1px solid var(--st-color-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(--st-color-accent);
    box-shadow: var(--st-ring-field);
}
.ai-input {
    flex: 1;
    min-width: 0;
    resize: none;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: var(--st-text-4);
    line-height: 1.5;
    color: var(--st-color-text);
    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(--st-color-accent-fill);
    color: var(--st-color-on-accent);
    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(--st-color-accent-fill);
    color: var(--st-color-on-accent);
    font-family: inherit;
    font-size: var(--st-text-3);
    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: var(--st-text-1);
    color: var(--st-color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}
.ai-reset:hover {
    color: var(--st-color-text);
    text-decoration: underline;
}

/* ─── Header primary action button ───────────────────────────── */
.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--st-color-accent-fill);
    color: var(--st-color-on-accent);
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: var(--st-text-3);
    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(--st-color-line);
    color: var(--st-color-text-muted);
    border-radius: 0.5rem;
    padding: 0.3rem 0.7rem;
    font-family: inherit;
    font-size: var(--st-text-2);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition:
        border-color 0.12s,
        color 0.12s;
}
.header-add:hover {
    border-color: var(--st-color-accent-fill);
    color: var(--st-color-accent);
}
.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 + --st-* settings only, no inline styles. */
.project-header-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: var(--st-text-3);
    color: var(--st-color-accent);
    cursor: pointer;
    flex-shrink: 0;
}
.entry-filters {
    display: flex;
    flex-direction: column;
    gap: var(--st-space-3);
    margin-bottom: var(--st-space-6);
}
.entry-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--st-space-2);
}
.entry-filter-label {
    font-size: var(--st-text-1);
    color: var(--st-color-text-muted);
    min-width: 4.5rem;
}
.entry-filter-select {
    width: auto;
    max-width: 16rem;
    padding: 0.2rem 0.5rem;
    font-size: var(--st-text-3);
}
.entry {
    background: var(--st-color-surface);
    border: 1.5px solid var(--st-color-line);
    border-radius: var(--st-radius-3);
    padding: var(--st-space-4);
    margin-bottom: var(--st-space-3);
}
.entry-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--st-space-2);
    font-size: var(--st-text-1);
    color: var(--st-color-text-muted);
}
.entry-title {
    font-size: var(--st-text-5);
    font-weight: 600;
    margin: var(--st-space-2) 0 0;
    overflow-wrap: anywhere;
}
.entry-body,
.entry-why {
    font-size: var(--st-text-3);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-top: var(--st-space-2);
}
.entry-why-label {
    font-weight: 600;
}
.entry-meta,
.entry-hint {
    font-size: var(--st-text-1);
    color: var(--st-color-text-muted);
    margin-top: var(--st-space-2);
}
.entry-actions {
    margin-top: var(--st-space-3);
    display: flex;
    gap: var(--st-space-2);
}
/* Settled: grey in place. Nothing is hidden; colour alone says "no longer live". */
.entry--settled {
    background: transparent;
    color: var(--st-color-text-muted);
}
.entry--settled .entry-title {
    font-weight: 500;
    color: var(--st-color-text-muted);
}
/* System notes: the quiet exhaust of metadata changes. */
.entry--system {
    background: transparent;
    border-style: dashed;
    padding: var(--st-space-3) var(--st-space-4);
    font-size: var(--st-text-1);
    color: var(--st-color-text-muted);
}
.entry-empty {
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
    padding: var(--st-space-6) 0;
}
.entry-more {
    margin: var(--st-space-4) 0;
}
.entry-composer-types {
    display: flex;
    flex-wrap: wrap;
    gap: var(--st-space-2);
    margin-bottom: var(--st-space-4);
}
.entry-composer-error {
    font-size: var(--st-text-3);
    color: var(--st-color-bad);
    margin-top: var(--st-space-3);
}
.entry-composer-fields .modal-field {
    margin-bottom: var(--st-space-4);
}
.modal-field .st-select {
    background: var(--st-color-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(--st-color-line-strong);
    text-underline-offset: 0.2em;
}
.entry-title-link:hover {
    text-decoration-color: currentColor;
}
.entry-prior {
    margin-top: var(--st-space-4);
    padding-left: var(--st-space-4);
    border-left: 3px solid var(--st-color-line-strong);
}
.entry-prior .entry:last-child {
    margin-bottom: 0;
}
.entry-detail {
    margin-bottom: var(--st-space-6);
}
.entry-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--st-space-3);
}
.entry-section-title {
    font-size: var(--st-text-7);
    font-weight: 600;
    margin: var(--st-space-6) 0 var(--st-space-3);
}
.entry-detail .entry-section-title {
    margin-top: 0;
}
.entry-field {
    margin-top: var(--st-space-4);
}
.entry-field-label {
    display: block;
    font-size: var(--st-text-1);
    font-weight: 500;
    color: var(--st-color-text-muted);
    margin-bottom: var(--st-space-2);
}
.entry-field-check .entry-field-label {
    margin-bottom: 0;
}
/* Ink: a locked definition field reads as fixed, not as a disabled glitch. */
.entry-detail .st-input[readonly],
.entry-detail .st-select:disabled {
    background: transparent;
    border-style: dashed;
    color: var(--st-color-text-muted);
    cursor: default;
    opacity: 1;
}
.entry-action-lg {
    margin-top: var(--st-space-4);
}
.entry-fix {
    margin-top: var(--st-space-6);
    padding-top: var(--st-space-4);
    border-top: 1px solid var(--st-color-line);
}
.entry-fix-label {
    font-size: var(--st-text-3);
    margin-bottom: var(--st-space-3);
}
.entry-chain {
    list-style: none;
    padding: 0;
    margin: 0;
}
.entry-chain-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--st-space-2);
    padding: var(--st-space-3) 0;
    border-bottom: 1px solid var(--st-color-line);
    font-size: var(--st-text-3);
}
.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(--st-space-4);
    margin: var(--st-space-3) 0 var(--st-space-4);
}
.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(--st-space-3);
    list-style: none;
    margin: var(--st-space-3) 0 var(--st-space-4);
    padding: 0;
}
.milestone-count {
    display: flex;
    flex-direction: column;
    min-width: 5.5rem;
    padding: var(--st-space-3) var(--st-space-4);
    border: 1px solid var(--st-color-line);
    border-radius: var(--st-radius-1);
}
.milestone-count-number {
    font-size: var(--st-text-7);
    color: var(--st-color-text);
}
.milestone-count-label,
.autosave-note {
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
}

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

/* ─── Today: entry-tasks + Context strip ─────────────────────── */
.today-entries {
    margin-top: var(--st-space-7);
}
.entry-today-cb {
    width: 1rem;
    height: 1rem;
    accent-color: var(--st-color-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(--st-space-7);
}
.today-context-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--st-space-3);
    width: 100%;
    padding: var(--st-space-2) 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--st-color-line);
    font: inherit;
    font-size: var(--st-text-3);
    color: var(--st-color-text-muted);
    text-align: left;
    cursor: pointer;
}
.today-context-line:hover .today-context-title {
    text-decoration: underline;
}
.today-context-title {
    color: var(--st-color-text);
}

/* ─── Search ─────────────────────────────────────────────────── */
.search-form {
    margin-bottom: var(--st-space-4);
}
.search-group {
    margin-bottom: var(--st-space-6);
}
.search-group[hidden] {
    display: none;
}
.search-mark {
    background: var(--st-color-accent-tint);
    color: var(--st-color-accent);
    border-radius: var(--st-radius-1);
    padding: 0 0.1em;
}
.search-local-hit {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--st-space-3);
    width: 100%;
    padding: var(--st-space-3) 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--st-color-line);
    font: inherit;
    font-size: var(--st-text-3);
    color: var(--st-color-text);
    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(--st-color-surface);
    border: 1px solid var(--st-color-line);
    border-radius: 0 0 var(--st-radius-3) var(--st-radius-3);
    box-shadow: var(--st-shadow-2);
}
/* "See all results" stays visible however long the list is. */
.search-pop-group--footer {
    position: sticky;
    bottom: 0;
    background: var(--st-color-surface);
    border-top: 1px solid var(--st-color-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(--st-space-3) var(--st-space-4) var(--st-space-2);
    font-size: var(--st-text-1);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--st-color-text-muted);
}
.search-opt {
    display: flex;
    align-items: center;
    gap: var(--st-space-3);
    padding: var(--st-space-3) var(--st-space-4);
    border-bottom: 1px solid var(--st-color-line);
    cursor: pointer;
}
.search-opt .st-badge {
    flex-shrink: 0;
}
.search-opt.is-active {
    background: var(--st-color-raised);
    outline: 2px solid var(--st-color-accent);
    outline-offset: -2px;
}
.search-opt-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.search-opt-title {
    font-size: var(--st-text-3);
    font-weight: 500;
    overflow-wrap: anywhere;
}
.search-opt-sub {
    font-size: var(--st-text-1);
    color: var(--st-color-text-muted);
}
.search-note {
    padding: var(--st-space-3) var(--st-space-4);
    font-size: var(--st-text-3);
    color: var(--st-color-text-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(--st-space-3);
    padding: var(--st-space-3) var(--st-space-4);
    margin-bottom: var(--st-space-4);
    border-radius: var(--st-radius-3);
    font-size: var(--st-text-3);
}
/* 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(--st-space-3) var(--st-space-4);
}
.autosave-row .st-select {
    width: auto;
    min-width: 8rem;
}
/* A member's role: a compact select inside a member row. */
.role-select {
    width: auto;
    padding: var(--st-space-2) var(--st-space-3);
    font-size: var(--st-text-3);
}
.autosave-note--ok {
    color: var(--st-color-ok);
}
.autosave-note--error {
    color: var(--st-color-bad);
}
/* Over the workspace's active-project limit: a warning, never a block. */
.modal-intro {
    margin-bottom: var(--st-space-4);
}
/* 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(--st-color-ok);
}
.entry--event-reopened {
    border-left-color: var(--st-color-accent);
}
.entry-warning {
    background: var(--st-color-warn-tint);
    color: var(--st-color-warn);
    border-radius: var(--st-radius-1);
    padding: var(--st-space-3) var(--st-space-4);
    margin-bottom: var(--st-space-4);
    font-size: var(--st-text-3);
}
.entry-warning-title {
    font-weight: 600;
}
.entry-warning-list {
    margin: var(--st-space-2) 0 var(--st-space-3) var(--st-space-6);
}

/* 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(--st-space-4);
    margin-bottom: var(--st-space-4);
}

/* Top bar: reload, bell and light/dark switch are kit icon buttons, in a quiet colour */
.top-icon-btn,
.top-theme-switch {
    color: var(--st-color-text-muted);
}
.top-bell {
    position: relative;   /* holds the unread count badge */
}

/* Light/dark switch, top-right of the login screen */
.auth-theme-switch {
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top));
    right: max(0.75rem, env(safe-area-inset-right));
    color: var(--st-color-text-soft);
    z-index: 5;
}

/* Stoei wordmark: italic serif */
.auth-logo-name, .sb-logo-name, .mb-logo-name {
    font-family: var(--st-font-display);
    font-style: italic;
    font-weight: 500;
    letter-spacing: -0.01em;
}
.mb-logo-app {
    font-family: var(--st-font-body);
    font-style: normal;
    font-size: var(--st-text-0);
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.75;
}

/* Page titles in the Stoei serif */
.view-header h1, .project-name {
    font-family: var(--st-font-display);
    font-weight: 500;
    font-size: var(--st-text-12);
    letter-spacing: -0.015em;
    line-height: 1.15;
}

/* ─── Maintenance page ───────────────────────────────────────── */
.maint {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--st-space-7);
    text-align: center;
}
.maint-mark {
    width: var(--st-space-9);
    height: var(--st-space-9);
    background: var(--st-color-accent-fill);
    border-radius: var(--st-radius-card);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--st-space-4);
}
.maint h1 {
    font-family: var(--st-font-display);
    font-style: italic;
    font-weight: var(--st-weight-heading);
    font-size: var(--st-text-14);
    margin: 0 0 var(--st-space-3);
}
.maint p {
    color: var(--st-color-text-muted);
    max-width: 25rem;
    margin: 0 auto;
}

/* ─── Moved from the page head (were inline in index.php) ────── */
/* Sidebar flyout menus stay within the viewport (scroll if long) instead of
   dropping off-screen. */
.sb-ws-menu { max-height: 60vh; overflow-y: auto; }
/* Pulsing dot for an actively-timed task / the timer HUD. */
@keyframes flobox-pulse { 0%,100%{ opacity:1; transform:scale(1); } 50%{ opacity:.35; transform:scale(.7); } }
/* Project due-date line under the title. Plain when no urgency is set. */
.project-due { display:inline-flex; align-items:center; gap:.35rem; font-size:var(--st-text-2); font-weight:700; color:var(--st-color-text-muted); margin:.1rem 0 .5rem; }
.project-due .due-label { font-weight:600; }
/* Urgent due date — a dark pill that "shakes" once when the project is opened. */
.project-due.urgent { background:var(--st-color-text); color:var(--st-color-bg); padding:.3rem .8rem; border-radius:var(--st-radius-pill); box-shadow:var(--st-shadow-2); }
.project-due.urgent.shake { animation:flobox-due-shake .65s cubic-bezier(.36,.07,.19,.97) 1; }
@keyframes flobox-due-shake {
  0%,100% { transform:translateX(0) rotate(0); }
  12% { transform:translateX(-5px) rotate(-2deg); }
  26% { transform:translateX(5px) rotate(2deg); }
  40% { transform:translateX(-4px) rotate(-1.5deg); }
  54% { transform:translateX(4px) rotate(1.5deg); }
  68% { transform:translateX(-2px) rotate(-.5deg); }
  82% { transform:translateX(2px) rotate(.5deg); }
}
/* Notification cards: brand-red hover border, matching task rows. */
.notif-card { background: var(--st-color-surface); border: 1px solid var(--st-color-line); border-radius: .625rem; padding: .875rem 1rem; margin-bottom: .5rem; display: flex; align-items: flex-start; gap: .75rem; transition: border-color .2s; }
.notif-card:hover { border-color: var(--st-color-accent-fill); }
/* Focus mode — a per-task spotlight. Sits above page chrome (sidebar z40) but BELOW
   the modal overlay (z50), so task-action modals still open on top. Clicks outside the
   lifted task land on the dim backdrop, which does nothing — only the focus icon / Esc
   exit (per spec). */
#focusBackdrop { position: fixed; inset: 0; background: var(--st-color-focus-backdrop); z-index: 45; animation: flobox-focus-fade .15s ease; }
/* Animate the container (created once) — NOT the child, which is re-created on every
   render (the boot restore fires several), which would replay the pop and flash. */
#focusStage { position: fixed; inset: 0; z-index: 46; display: flex; padding: 1rem; overflow: auto; pointer-events: none; animation: flobox-focus-pop .18s ease; }
/* margin:auto centres the lifted task both axes and degrades gracefully (scrolls,
   never clips the top) when the task is taller than the viewport. !important so it beats
   inline row margins (e.g. shared rows set margin-bottom, which otherwise pins it low). */
#focusStage > * { margin: auto !important; width: min(680px, 94vw); pointer-events: auto; }
#focusStage .task-box { box-shadow: var(--st-shadow-3); }
.task-icon-btn.focus-on { color: var(--st-color-accent); }
@keyframes flobox-focus-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes flobox-focus-pop { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
