/* Sanctum Tasks admin design layer
 * Built on Bootstrap 5.3 + Bootstrap Icons. Adds tokens, status pills,
 * priority chips, page headers, swimlanes, and the metadata rail used by
 * task detail.
 */

:root {
    --st-bg-app: #f4f6fa;
    --st-bg-surface: #ffffff;
    --st-bg-soft: #f8f9fc;
    --st-bg-elevated: #ffffff;
    --st-border-subtle: #e4e7ee;
    --st-border-strong: #cfd4de;
    --st-text-primary: #14161a;
    --st-text-secondary: #4a5260;
    --st-text-muted: #8a93a3;
    --st-accent: #2c5cff;
    --st-accent-soft: #e9efff;
    --st-accent-hover: #1f47cc;
    --st-shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.04);
    --st-shadow-md: 0 4px 12px rgba(20, 22, 26, 0.06);
    --st-radius: 10px;
    --st-radius-sm: 6px;

    /* Status palette */
    --st-status-todo: #4a5260;
    --st-status-todo-soft: #eef0f4;
    --st-status-doing: #b45309;
    --st-status-doing-soft: #fef4d6;
    --st-status-done: #15803d;
    --st-status-done-soft: #dcfce7;
    --st-status-blocked: #b91c1c;
    --st-status-blocked-soft: #fee2e2;

    /* Priority palette */
    --st-pri-low: #6b7280;
    --st-pri-low-soft: #eef0f3;
    --st-pri-normal: #2c5cff;
    --st-pri-normal-soft: #e9efff;
    --st-pri-high: #b45309;
    --st-pri-high-soft: #fef4d6;
    --st-pri-urgent: #b91c1c;
    --st-pri-urgent-soft: #fee2e2;
}

body.bg-light { background-color: var(--st-bg-app) !important; color: var(--st-text-primary); }

/* ---------- Navbar ---------- */
.admin-nav { box-shadow: var(--st-shadow-sm); }
.admin-nav .navbar-brand { letter-spacing: -0.01em; }
.admin-nav .st-nav-notif-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.4rem;
    font-size: 0.65rem;
    min-width: 1.1rem;
    padding: 0.12em 0.35em;
    line-height: 1;
}
.admin-nav .st-nav-notif-btn {
    padding: 0.15rem 0.45rem;
    line-height: 1.1;
}

/* ---------- Notifications inbox ---------- */
.list-group-item.st-notif-unread {
    background: var(--st-accent-soft);
    border-left: 3px solid var(--st-accent);
}
.admin-nav .btn-outline-light {
    border-color: rgba(255,255,255,0.25);
    font-weight: 500;
}
.admin-nav .btn-outline-light:hover { background-color: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.4); color: #fff; }
.admin-nav .navbar-text { font-size: 0.85rem; }
.admin-shell { max-width: 1400px; }

/* ---- UI Skin Lab comp bar (dev host) ---- */
:root { --comp-h: 0px; }
.st-skin-lab-active .admin-nav { top: var(--comp-h); }
.st-skin-lab-active .admin-nav { position: sticky; z-index: 1030; }
.st-skin-comp-bar {
    position: sticky;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    padding: 0.35rem 0.75rem;
    background: #111;
    color: #fff;
    font-size: 0.72rem;
    border-bottom: 2px solid #0047ff;
}
.st-skin-comp-bar__label {
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.85;
}
.st-skin-comp-bar__btn {
    border: 1px solid rgba(255,255,255,0.35);
    background: transparent;
    color: #fff;
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    font-size: inherit;
    cursor: pointer;
}
.st-skin-comp-bar__btn.is-active {
    background: #0047ff;
    border-color: #0047ff;
}
.st-skin-comp-bar__spacer { flex: 1; }
.st-skin-comp-bar__note { opacity: 0.65; font-size: 0.68rem; }

/* ---------- Breadcrumbs ---------- */
.admin-breadcrumb-nav { margin-top: -0.25rem; }
.admin-breadcrumb {
    font-size: 0.84rem;
    padding: 0.4rem 0.75rem;
    background: var(--st-bg-surface);
    border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius-sm);
    box-shadow: var(--st-shadow-sm);
    margin-bottom: 1rem !important;
}
.admin-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: var(--st-text-muted);
}
.admin-breadcrumb .breadcrumb-item a {
    color: var(--st-accent);
    text-decoration: none;
}
.admin-breadcrumb .breadcrumb-item a:hover {
    color: var(--st-accent-hover);
    text-decoration: underline;
}
.admin-breadcrumb .breadcrumb-item.active {
    color: var(--st-text-secondary);
    font-weight: 500;
}

/* ---------- Page header ---------- */
.page-header {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.75rem; margin-bottom: 1.5rem;
}
.page-header__title h1 {
    font-size: 1.5rem; line-height: 1.2; margin: 0; font-weight: 600; color: var(--st-text-primary);
    letter-spacing: -0.01em;
}
.page-header__title .subtitle { color: var(--st-text-muted); font-size: 0.9rem; margin-top: 0.15rem; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.page-back {
    display: inline-flex; align-items: center; gap: 0.4rem; color: var(--st-text-secondary);
    font-size: 0.85rem; text-decoration: none; padding: 0.25rem 0; margin-bottom: 0.5rem;
}
.page-back:hover { color: var(--st-text-primary); }
.page-back i { font-size: 0.75rem; }

/* ---------- Section ---------- */
.section { margin-bottom: 1.75rem; }
.section-title {
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--st-text-muted); margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.5rem;
}
.section-title .count {
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    color: var(--st-text-secondary); border-radius: 999px; padding: 0 0.5rem; font-size: 0.7rem;
}

/* ---------- Surface (subtler card) ---------- */
.surface {
    background: var(--st-bg-surface); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius); box-shadow: var(--st-shadow-sm);
}
.surface-pad { padding: 1.25rem; }
.surface-pad-sm { padding: 0.85rem 1rem; }
.surface + .surface { margin-top: 1rem; }

/* ---------- Status pill ---------- */
.status-pill {
    display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.6rem;
    border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1.2;
    border: 1px solid transparent; white-space: nowrap;
}
.status-pill::before {
    content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; border-radius: 50%;
    background: currentColor; opacity: 0.85;
}
.status-pill--todo, .status-pill--default {
    color: var(--st-status-todo); background: var(--st-status-todo-soft); border-color: rgba(74,82,96,0.18);
}
.status-pill--doing, .status-pill--in_progress, .status-pill--inprogress {
    color: var(--st-status-doing); background: var(--st-status-doing-soft); border-color: rgba(180,83,9,0.18);
}
.status-pill--done, .status-pill--complete, .status-pill--completed {
    color: var(--st-status-done); background: var(--st-status-done-soft); border-color: rgba(21,128,61,0.18);
}
.status-pill--blocked {
    color: var(--st-status-blocked); background: var(--st-status-blocked-soft); border-color: rgba(185,28,28,0.18);
}

/* ---------- Priority chip ---------- */
.priority-chip {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.5rem;
    border-radius: var(--st-radius-sm); font-size: 0.72rem; font-weight: 600; line-height: 1.2;
    border: 1px solid transparent;
}
.priority-chip i { font-size: 0.7rem; }
.priority-chip--low { color: var(--st-pri-low); background: var(--st-pri-low-soft); }
.priority-chip--normal { color: var(--st-pri-normal); background: var(--st-pri-normal-soft); }
.priority-chip--high { color: var(--st-pri-high); background: var(--st-pri-high-soft); }
.priority-chip--urgent { color: var(--st-pri-urgent); background: var(--st-pri-urgent-soft); }

/* ---------- Tag chip ---------- */
.tag-chip {
    display: inline-flex; padding: 0.1rem 0.5rem; font-size: 0.7rem; font-weight: 500;
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    color: var(--st-text-secondary); border-radius: var(--st-radius-sm);
}
.tag-chip + .tag-chip { margin-left: 0.25rem; }

/* ---------- Icon stat group (signals) ---------- */
.icon-stats { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--st-text-muted); font-size: 0.8rem; }
.icon-stats span { display: inline-flex; align-items: center; gap: 0.2rem; }
.icon-stats i { font-size: 0.85rem; }

/* ---------- Filter bar (compact) ---------- */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch;
    padding: 0.6rem; background: var(--st-bg-surface);
    border: 1px solid var(--st-border-subtle); border-radius: var(--st-radius);
    box-shadow: var(--st-shadow-sm); margin-bottom: 1rem;
}
.filter-bar .form-control, .filter-bar .form-select {
    border-radius: var(--st-radius-sm); border-color: var(--st-border-subtle);
    background: var(--st-bg-soft);
}
.filter-bar .form-control:focus, .filter-bar .form-select:focus {
    background: var(--st-bg-surface); border-color: var(--st-accent);
    box-shadow: 0 0 0 3px var(--st-accent-soft);
}
.filter-bar__search { flex: 2 1 280px; min-width: 200px; }
.filter-bar__field { flex: 1 1 140px; min-width: 130px; }
.filter-bar__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Swimlanes (status board) ---------- */
.board {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem; align-items: start;
}
.swimlane {
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius); padding: 0.85rem; min-height: 4rem;
}
.swimlane__header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--st-border-subtle);
}
.swimlane__header .status-pill { font-size: 0.78rem; }
.swimlane__count { font-size: 0.75rem; color: var(--st-text-muted); font-weight: 500; }
.swimlane__body { display: flex; flex-direction: column; gap: 0.6rem; }
.swimlane__empty { color: var(--st-text-muted); font-size: 0.82rem; padding: 0.5rem 0.25rem; }

/* ---------- Task card (board view + mobile) ---------- */
.task-card {
    display: block; background: var(--st-bg-surface); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius-sm); padding: 0.7rem 0.85rem; text-decoration: none;
    color: inherit; box-shadow: var(--st-shadow-sm); transition: border-color 120ms, box-shadow 120ms, transform 120ms;
}
/* Anchor for Bootstrap .stretched-link on inner title links */
.task-card--interactive { position: relative; }
.task-card:hover { border-color: var(--st-border-strong); box-shadow: var(--st-shadow-md); color: inherit; }
.task-card__title { font-weight: 600; color: var(--st-text-primary); margin-bottom: 0.35rem; line-height: 1.3; }
.task-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--st-text-muted); }
.task-card__meta a { color: var(--st-text-secondary); text-decoration: none; }
.task-card__meta a:hover { color: var(--st-accent); text-decoration: underline; }
.task-card__footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; }
.task-card__assignee { font-size: 0.72rem; color: var(--st-text-secondary); }
.task-card__assignee i { color: var(--st-text-muted); }

/* Inline edit dropdown inside a task card */
.task-card .form-select-sm.js-autosave {
    background: transparent; border: 1px dashed transparent; padding: 0 0.25rem; height: auto;
    font-size: 0.75rem; font-weight: 600; color: inherit;
    -webkit-appearance: none; appearance: none; cursor: pointer;
}
.task-card .form-select-sm.js-autosave:hover, .task-card .form-select-sm.js-autosave:focus {
    border-color: var(--st-border-subtle); background: var(--st-bg-soft); box-shadow: none;
}

/* ---------- Flat list view ---------- */
.task-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.task-table thead th {
    text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--st-text-muted); padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--st-border-subtle);
    background: var(--st-bg-soft); font-weight: 600;
}
.task-table thead th:first-child { border-top-left-radius: var(--st-radius); }
.task-table thead th:last-child { border-top-right-radius: var(--st-radius); text-align: right; }
.task-table tbody td {
    padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--st-border-subtle); vertical-align: middle;
    background: var(--st-bg-surface);
}
.task-table tbody tr:last-child td { border-bottom: 0; }
.task-table tbody tr:hover td { background: var(--st-bg-soft); }
.task-table .task-title-cell a { color: var(--st-text-primary); font-weight: 500; text-decoration: none; }
.task-table .task-title-cell a:hover { color: var(--st-accent); }
.task-table .task-actions { text-align: right; white-space: nowrap; }
.task-table .form-select-sm.js-autosave {
    border: 1px dashed transparent; background: transparent; min-width: 110px; cursor: pointer;
}
.task-table .form-select-sm.js-autosave:hover, .task-table .form-select-sm.js-autosave:focus {
    border-color: var(--st-border-subtle); background: var(--st-bg-soft); box-shadow: none;
}

/* ---------- Metadata rail (task detail right column) ---------- */
.metadata-rail {
    display: flex; flex-direction: column; gap: 0.5rem;
    background: var(--st-bg-surface); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius); padding: 1rem; box-shadow: var(--st-shadow-sm);
    position: sticky; top: 1rem;
}
.metadata-rail__row {
    display: grid; grid-template-columns: 84px 1fr; align-items: start; gap: 0.5rem;
    padding: 0.4rem 0; border-bottom: 1px solid var(--st-border-subtle);
}
.metadata-rail__row:last-child { border-bottom: 0; }
.metadata-rail__row label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--st-text-muted);
    margin: 0.4rem 0 0; font-weight: 600;
}
.metadata-rail__row .form-select, .metadata-rail__row .form-control {
    border-color: var(--st-border-subtle); background: var(--st-bg-soft); font-size: 0.88rem;
}
.metadata-rail__row .form-select:focus, .metadata-rail__row .form-control:focus {
    background: var(--st-bg-surface); border-color: var(--st-accent); box-shadow: 0 0 0 3px var(--st-accent-soft);
}
.metadata-rail__value { font-size: 0.88rem; color: var(--st-text-primary); padding: 0.4rem 0; }

/* ---------- Activity / collaboration (legacy) ---------- */
.activity-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.activity-list li {
    display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.88rem; color: var(--st-text-primary);
    padding: 0.5rem 0.65rem; background: var(--st-bg-soft); border-radius: var(--st-radius-sm);
}
.activity-list li strong { color: var(--st-text-primary); margin-right: 0.25rem; }
.activity-list .text-muted { color: var(--st-text-muted) !important; }

/* ---------- Task header chips (replaces the single subtitle string) ---------- */
.task-header__title { min-width: 0; flex: 1 1 360px; }
.task-title-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.task-title { font-size: 1.5rem; line-height: 1.2; margin: 0; font-weight: 600; color: var(--st-text-primary); letter-spacing: -0.01em; }
.task-title-rename {
    color: var(--st-text-muted); padding: 0.1rem 0.35rem; border-radius: var(--st-radius-sm);
    line-height: 1; text-decoration: none;
}
.task-title-rename:hover { color: var(--st-accent); background: var(--st-accent-soft); }
.task-header__chips {
    display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem;
    color: var(--st-text-muted);
}
.meta-chip {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem;
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    color: var(--st-text-secondary); border-radius: 999px; font-size: 0.78rem;
    line-height: 1.4;
}
.meta-chip i { font-size: 0.78rem; opacity: 0.85; }
.meta-chip--link { color: var(--st-accent); text-decoration: none; }
.meta-chip--link:hover { color: var(--st-accent-hover); border-color: var(--st-accent); background: var(--st-accent-soft); }
.meta-chip--warn { color: #92400e; background: #fef3c7; border-color: #fcd34d; }
.task-header__actions { gap: 0.5rem; }

/* ---------- Section title row (title + right-side action button) ---------- */
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.section-title-row .section-title { margin-bottom: 0; }
.section-title-row--with-help { align-items: flex-start; }

/* Inline doc help (?): links to /admin/documentation.php#anchor */
.st-doc-help {
    color: var(--st-text-muted, #6c757d);
    text-decoration: none;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.st-doc-help:hover {
    color: var(--bs-primary);
}

/* Rendered in-app user guide */
.documentation-content { max-width: 52rem; }
.documentation-content.markdown-body h2 { margin-top: 1.75rem; padding-top: 0.35rem; border-top: 1px solid var(--st-border-subtle, rgba(0,0,0,0.08)); }
.documentation-content.markdown-body h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }

/* ---------- Description body ---------- */
.description-body {
    color: var(--st-text-primary); font-size: 0.95rem; line-height: 1.5;
    white-space: normal; word-wrap: break-word;
}

/* ---------- Avatars ---------- */
.st-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
    user-select: none; flex-shrink: 0;
}
.st-avatar--xs { width: 1.3rem; height: 1.3rem; font-size: 0.6rem; }

/* ---------- Discussion thread ---------- */
.comment-thread {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 0.85rem;
}
.comment-item {
    display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.65rem;
    align-items: flex-start;
}
.comment-avatar-col { display: flex; justify-content: center; padding-top: 0.1rem; }
.comment-body-col {
    background: var(--st-bg-surface); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius); padding: 0.6rem 0.85rem;
    box-shadow: var(--st-shadow-sm); position: relative;
}
.comment-item--mine .comment-body-col {
    background: var(--st-accent-soft);
    border-color: rgba(44, 92, 255, 0.2);
}
.comment-meta {
    display: flex; align-items: baseline; gap: 0.5rem;
    margin-bottom: 0.25rem; flex-wrap: wrap;
}
.comment-author { font-weight: 600; color: var(--st-text-primary); font-size: 0.88rem; }
.comment-time { color: var(--st-text-muted); font-size: 0.75rem; }
.comment-body {
    font-size: 0.92rem; line-height: 1.5; color: var(--st-text-primary);
    word-wrap: break-word;
}
.comment-body a { color: var(--st-accent); text-decoration: underline; }
.comment-body a:hover { color: var(--st-accent-hover); }

/* ---------- Comment composer ---------- */
.comment-composer {
    border-top: 1px solid var(--st-border-subtle);
    padding-top: 1rem; margin-top: 0.25rem;
}
.comment-composer__row {
    display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.65rem;
    align-items: flex-start;
}
.comment-composer__main { display: flex; flex-direction: column; gap: 0.5rem; }
.comment-composer textarea.form-control {
    border-color: var(--st-border-subtle); background: var(--st-bg-soft);
    font-size: 0.92rem; line-height: 1.5; resize: vertical;
}
.comment-composer textarea.form-control:focus {
    background: var(--st-bg-surface); border-color: var(--st-accent);
    box-shadow: 0 0 0 3px var(--st-accent-soft);
}
.comment-composer__actions {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;
}

/* ---------- Inline edit affordance ---------- */
.js-inline-edit-form { width: 100%; }
.btn-link.js-inline-edit-toggle, .btn-link.js-inline-edit-cancel {
    color: var(--st-text-muted); text-decoration: none; padding: 0.1rem 0.35rem;
    font-size: 0.82rem;
}
.btn-link.js-inline-edit-toggle:hover { color: var(--st-accent); }

/* ---------- Attachments list ---------- */
.attachment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.9rem; }
.attachment-list li { display: flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.65rem; background: var(--st-bg-soft); border-radius: var(--st-radius-sm); }
.attachment-list a { color: var(--st-text-primary); text-decoration: none; font-weight: 500; }
.attachment-list a:hover { color: var(--st-accent); }

/* ---------- Watcher list (in metadata rail) ---------- */
.metadata-rail__row--block { grid-template-columns: 1fr; }
.metadata-rail__row--block label { margin-bottom: 0.4rem; }
.watcher-list { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; }
.watcher-chip {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.55rem 0.15rem 0.2rem;
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    border-radius: 999px; font-size: 0.78rem; color: var(--st-text-secondary);
}
.watcher-chip span { line-height: 1; }

/* ---------- Markdown rendered content (description + comments) ---------- */
.markdown-body { color: var(--st-text-primary); line-height: 1.55; word-wrap: break-word; }
.markdown-body p { margin: 0 0 0.6rem 0; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin: 1em 0 0.4em 0; line-height: 1.25; font-weight: 600; color: var(--st-text-primary);
}
.markdown-body h1 { font-size: 1.3rem; }
.markdown-body h2 { font-size: 1.15rem; }
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { font-size: 0.95rem; }
.markdown-body ul, .markdown-body ol { margin: 0 0 0.6rem 1.4rem; padding: 0; }
.markdown-body li { margin: 0.15rem 0; }
.markdown-body li > p { margin: 0; }
.markdown-body code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    border-radius: 4px; padding: 0 0.3rem; font-size: 0.85em; color: var(--st-text-primary);
}
.markdown-body pre {
    margin: 0.6rem 0; padding: 0.75rem 0.9rem;
    background: #0f1115; color: #e7eaf0;
    border-radius: var(--st-radius-sm); border: 1px solid #1c2028;
    overflow-x: auto; font-size: 0.82rem; line-height: 1.5;
}
.markdown-body pre code { background: transparent; border: 0; padding: 0; color: inherit; font-size: inherit; }
.markdown-body blockquote {
    margin: 0.6rem 0; padding: 0.4rem 0.85rem;
    border-left: 3px solid var(--st-border-strong); background: var(--st-bg-soft);
    color: var(--st-text-secondary); border-radius: 0 var(--st-radius-sm) var(--st-radius-sm) 0;
}
.markdown-body hr { border: 0; border-top: 1px solid var(--st-border-subtle); margin: 0.85rem 0; }
.markdown-body a { color: var(--st-accent); }
.markdown-body a:hover { color: var(--st-accent-hover); }
.markdown-body img { max-width: 100%; border-radius: var(--st-radius-sm); }
.markdown-body table { border-collapse: collapse; margin: 0.6rem 0; font-size: 0.88rem; }
.markdown-body th, .markdown-body td { border: 1px solid var(--st-border-subtle); padding: 0.35rem 0.55rem; }
.markdown-body th { background: var(--st-bg-soft); font-weight: 600; }

/* Mermaid diagrams (fenced ```mermaid in documents / task bodies) */
.markdown-body .st-mermaid-diagram,
.markdown-body .mermaid {
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--st-bg-soft);
    border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius-sm);
    overflow-x: auto;
    text-align: center;
}
.markdown-body .st-mermaid-diagram svg,
.markdown-body .mermaid svg {
    max-width: 100%;
    height: auto;
}
.markdown-body pre code.language-mermaid {
    display: block;
    white-space: pre;
}

.comment-body.markdown-body { font-size: 0.92rem; }
.comment-body.markdown-body p:last-child { margin-bottom: 0; }

/* ---------- Comment timestamp display ---------- */
.comment-time { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; align-items: baseline; }
.comment-time__abs { color: var(--st-text-muted); font-size: 0.75rem; }
.comment-time__rel { color: var(--st-text-muted); font-size: 0.72rem; opacity: 0.8; }
.meta-chip__sub { color: var(--st-text-muted); font-size: 0.72rem; opacity: 0.85; margin-left: 0.1rem; }

/* ---------- Recurrence builder ---------- */
.recurrence-trigger { text-align: left; white-space: normal; }
.rr-weekday-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rr-weekday {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.55rem; border: 1px solid var(--st-border-subtle);
    border-radius: 999px; background: var(--st-bg-surface);
    font-size: 0.82rem; cursor: pointer; user-select: none;
    transition: background 120ms, border-color 120ms;
}
.rr-weekday input { margin: 0; }
.rr-weekday:has(input:checked) { background: var(--st-accent-soft); border-color: var(--st-accent); color: var(--st-accent-hover); font-weight: 600; }
.rr-end-grid { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.5rem; }
.rr-end-row {
    display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
    padding: 0.45rem 0.6rem; border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius-sm); background: var(--st-bg-surface);
    font-size: 0.9rem;
}
.rr-end-row:has(input[type=radio]:checked) { border-color: var(--st-accent); background: var(--st-accent-soft); }
.rr-end-row input[type=radio] { margin: 0; }
.rr-end-row .form-control { width: auto; max-width: 8rem; }
.rr-summary {
    margin-top: 1rem; padding: 0.7rem 0.85rem;
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius-sm);
}
.rr-summary__label {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--st-text-muted); font-weight: 600; margin-bottom: 0.2rem;
}
.rr-summary__text { font-weight: 500; color: var(--st-text-primary); }

/* ---------- Mobile tweaks for the task page ---------- */
@media (max-width: 767.98px) {
    .task-header__chips { gap: 0.25rem; }
    .meta-chip { font-size: 0.74rem; }
    .comment-item, .comment-composer__row { grid-template-columns: 1.8rem 1fr; gap: 0.5rem; }
    .st-avatar { width: 1.7rem; height: 1.7rem; font-size: 0.65rem; }
}

/* ---------- Tabbar (project workspace) ---------- */
.tabbar {
    display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--st-border-subtle);
    margin-bottom: 1.25rem;
}
.tabbar a {
    padding: 0.55rem 0.9rem; color: var(--st-text-secondary); text-decoration: none;
    border-bottom: 2px solid transparent; font-weight: 500; font-size: 0.92rem;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.tabbar a:hover { color: var(--st-text-primary); }
.tabbar a.active {
    color: var(--st-accent); border-bottom-color: var(--st-accent); font-weight: 600;
}
.tabbar a .count {
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    color: var(--st-text-muted); border-radius: 999px; padding: 0 0.45rem; font-size: 0.7rem;
}

/* ---------- Toast for autosave ---------- */
.st-toast-host {
    position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 1080;
    display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-end;
    pointer-events: none;
}
.st-toast {
    background: #14161a; color: #fff; padding: 0.55rem 0.9rem; border-radius: var(--st-radius-sm);
    font-size: 0.85rem; box-shadow: var(--st-shadow-md); display: inline-flex; align-items: center; gap: 0.5rem;
    opacity: 0; transform: translateY(8px); transition: opacity 160ms, transform 160ms;
}
.st-toast.is-visible { opacity: 1; transform: translateY(0); }
.st-toast--err { background: var(--st-pri-urgent); }
.st-toast i { font-size: 0.95rem; }

/* ---------- Helpers ---------- */
.fine-print { color: var(--st-text-muted); font-size: 0.78rem; }
.empty-hint {
    color: var(--st-text-muted); font-size: 0.85rem; padding: 0.65rem 0;
    border: 1px dashed var(--st-border-subtle); border-radius: var(--st-radius-sm);
    text-align: center;
}
.kbd-shortcut {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    border-radius: 4px; padding: 1px 5px; font-size: 0.72rem; color: var(--st-text-secondary);
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 767.98px) {
    .page-header { align-items: flex-start; }
    .metadata-rail { position: static; }
    .filter-bar { padding: 0.5rem; }
    .filter-bar__field, .filter-bar__search, .filter-bar__actions { flex: 1 1 100%; }
    .filter-bar__actions .btn { flex: 1 1 0; }
    .task-table { font-size: 0.85rem; }
}

/* Hide table view on small viewports, show cards instead */
.task-list-cards { display: none; }
@media (max-width: 767.98px) {
    .task-list-table { display: none; }
    .task-list-cards { display: flex; flex-direction: column; gap: 0.5rem; }
}

/* ---------- Basecamp-style nested to-do lists ---------- */
.todolist-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
.todolist-toolbar .section-title { margin-bottom: 0; }
.todolist-toolbar__new {
    display: flex; gap: 0.5rem; align-items: center;
    background: var(--st-bg-surface); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius-sm); padding: 0.35rem 0.45rem;
}
.todolist-toolbar__new .form-control { min-width: 200px; }

.todo-list {
    background: var(--st-bg-surface); border: 1px solid var(--st-border-subtle);
    border-radius: var(--st-radius); padding: 1rem 1.1rem; margin-bottom: 1rem;
    box-shadow: var(--st-shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.04));
}
.todo-list__header {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    border-bottom: 1px solid var(--st-border-subtle);
    padding-bottom: 0.55rem; margin-bottom: 0.65rem;
}
.todo-list__title { display: flex; align-items: center; gap: 0.5rem; }
.todo-list__title i { color: var(--st-accent); }
.todo-list__progress { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.todo-list__progress-pill {
    background: var(--st-bg-soft); border: 1px solid var(--st-border-subtle);
    color: var(--st-text-secondary); border-radius: 999px;
    padding: 0.1rem 0.55rem; font-size: 0.74rem; font-weight: 500;
}
.todo-list__empty { margin: 0.25rem 0 0.5rem 0; }
.todo-list--unfiled { border-style: dashed; }

.todo-list__items {
    list-style: none; padding: 0; margin: 0 0 0.5rem 0;
    display: flex; flex-direction: column; gap: 0.15rem;
}
.todo-row {
    display: flex; gap: 0.65rem; align-items: flex-start;
    padding: 0.4rem 0.25rem; border-radius: var(--st-radius-sm);
    border-bottom: 1px solid transparent;
}
.todo-row + .todo-row { border-top: 1px solid var(--st-border-subtle); }
.todo-row:hover { background: var(--st-bg-soft); }
.todo-row__check { margin: 0; padding-top: 0.1rem; }
.todo-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.todo-row__title {
    color: var(--st-text-primary); text-decoration: none; font-weight: 500;
    line-height: 1.3; word-break: break-word;
}
.todo-row__title:hover { color: var(--st-accent); text-decoration: underline; }
.todo-row__meta {
    display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
    font-size: 0.78rem; color: var(--st-text-muted);
}
.todo-row__meta .priority-chip { font-size: 0.7rem; }
.todo-row__assignee, .todo-row__due { display: inline-flex; align-items: center; gap: 0.25rem; }
.todo-row--done .todo-row__title {
    color: var(--st-text-muted); text-decoration: line-through;
}
.todo-row--done .todo-row__meta { opacity: 0.7; }

.todo-checkbox {
    width: 1.15rem; height: 1.15rem; border-radius: 50%;
    border: 1.5px solid var(--st-border-strong, #94a3b8);
    background: var(--st-bg-surface); padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; transition: background 100ms, border-color 100ms;
    cursor: pointer;
}
.todo-checkbox:hover { border-color: var(--st-accent); }
.todo-checkbox:disabled { cursor: not-allowed; opacity: 0.5; }
.todo-checkbox i { font-size: 0.78rem; line-height: 1; }
.todo-checkbox--done { background: var(--st-accent, #2563eb); border-color: var(--st-accent, #2563eb); }
.todo-checkbox--done:hover { background: var(--st-text-primary); border-color: var(--st-text-primary); }

.todo-list__add {
    display: flex; align-items: center; gap: 0.5rem;
    margin-top: 0.4rem; padding: 0.35rem 0.4rem;
    border: 1px dashed var(--st-border-subtle); border-radius: var(--st-radius-sm);
}
.todo-list__add:focus-within { border-color: var(--st-accent); }
.todo-list__add-input {
    flex: 1; border: 0; background: transparent; padding: 0.25rem 0.25rem;
    font-size: 0.92rem; color: var(--st-text-primary); outline: none;
}
.todo-list__add-input::placeholder { color: var(--st-text-muted); }

@media (max-width: 575.98px) {
    .todolist-toolbar { align-items: stretch; }
    .todolist-toolbar__new { width: 100%; }
    .todolist-toolbar__new .form-control { min-width: 0; flex: 1; }
}

/* @username mention autocomplete -------------------------------------- */
.st-mention-menu {
    position: absolute;
    z-index: 2000;
    background: var(--st-bg-surface);
    border: 1px solid var(--st-border-soft, #e2e6ee);
    border-radius: 0.5rem;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.12);
    min-width: 200px;
    max-width: 360px;
    max-height: 240px;
    overflow-y: auto;
    padding: 0.25rem;
}
.st-mention-item {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    padding: 0.4rem 0.55rem;
    border-radius: 0.35rem;
    text-align: left;
    color: var(--st-text-primary);
    cursor: pointer;
}
.st-mention-item:hover,
.st-mention-item.is-active {
    background: var(--st-bg-soft, #f1f4f9);
}
.st-mention-handle {
    font-weight: 600;
    color: var(--st-accent, #3b5bdb);
}
.st-mention-tag {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--st-text-muted, #6b7280);
    border: 1px solid var(--st-border-soft, #e2e6ee);
    border-radius: 0.25rem;
    padding: 0.05rem 0.35rem;
}
.st-mention-tag--client {
    color: #92400e;
    border-color: #fcd34d;
    background: #fffbeb;
}
.st-mention-tag--admin {
    color: #5b21b6;
    border-color: #ddd6fe;
    background: #f5f3ff;
}
.st-mention-empty {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    color: var(--st-text-muted, #6b7280);
}

/* Rendered mentions in markdown bodies */
.markdown-body .mention,
a.mention {
    display: inline;
    color: var(--st-accent, #3b5bdb);
    background: rgba(59, 91, 219, 0.08);
    border-radius: 0.25rem;
    padding: 0 0.2rem;
    text-decoration: none;
    font-weight: 600;
}
a.mention:hover { background: rgba(59, 91, 219, 0.15); }

/* Task image upload (admin view) --------------------------------------- */
.st-image-upload { max-width: 100%; }
.st-image-upload__zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.25rem; padding: 1rem 1.25rem; border: 2px dashed var(--st-border-soft, #d8dee9);
    border-radius: 0.65rem; background: var(--st-bg-soft, #f8f9fc);
    cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.st-image-upload__zone:hover,
.st-image-upload__zone:focus-within { border-color: var(--st-accent, #3b5bdb); background: rgba(59,91,219,0.04); }
.st-image-upload__zone.is-dragover { border-color: var(--st-accent, #3b5bdb); background: rgba(59,91,219,0.09); }
.st-image-upload__icon { font-size: 1.5rem; color: var(--st-accent, #3b5bdb); }
.st-image-upload__title { font-weight: 600; font-size: 0.98rem; }
.st-image-upload__hint { font-size: 0.8rem; color: var(--st-text-muted, #64748b); max-width: 36rem; }
.st-image-upload__status { margin-top: 0.5rem; font-size: 0.85rem; }

.attachment-list { list-style: none; padding: 0; margin: 0; }
.attachment-list__row {
    display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.65rem 0;
    border-top: 1px solid var(--st-border-soft, #e8ecf3);
}
.attachment-list__row:first-child { border-top: 0; }
.attachment-list__thumb {
    flex-shrink: 0; width: 56px; height: 56px; border-radius: 0.4rem;
    overflow: hidden; border: 1px solid var(--st-border-soft, #e8ecf3); background: var(--st-bg-soft, #f4f6fa);
    display: flex; align-items: center; justify-content: center;
}
.attachment-list__thumb img {
    width: 100%; height: 100%; object-fit: cover;
}
.attachment-list__thumb--file { cursor: default; }
.attachment-list__main { min-width: 0; flex: 1; }
.attachment-list__title { font-weight: 600; word-break: break-word; font-size: 0.93rem; }
.attachment-list__meta span + span::before { content: " · "; }

/* Home (/) — projects first, master task view below --------------------- */
.st-home-project-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 7.5rem;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.st-home-project-card:hover {
    color: inherit;
    border-color: var(--st-accent, #3b5bdb);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.st-home-project-card__desc {
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (max-width: 575.98px) {
    .st-home-projects__toolbar { flex-direction: column; align-items: flex-start; }
}

/* ---------- Activity timeline (Basecamp-style feed) ---------- */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.activity-feed__item {
    display: grid;
    grid-template-columns: 2.35rem 1fr;
    gap: 0.75rem;
    align-items: flex-start;
    position: relative;
}
.activity-feed__icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    background: var(--st-bg-soft, #f1f5f9);
    border: 1px solid var(--st-border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--st-accent, #3b5bdb);
    font-size: 1rem;
    flex-shrink: 0;
}
.activity-feed__summary {
    font-weight: 500;
    color: var(--st-text-primary);
    line-height: 1.35;
}
.activity-feed__summary:hover {
    color: var(--st-accent);
}
.activity-feed__meta { margin-top: 0.2rem; }
.activity-feed--compact .activity-feed__item {
    margin-bottom: 0.35rem;
}
.activity-feed--compact .activity-feed__icon {
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
}
