/* Safari tinting — browser samples html/body background for chrome tint */
html,
body {
    background-color: #090c22;
}

/* Content area: restore the page gray with a small dark border on the sides */
.helios-content-wrap {
    background-color: var(--bs-secondary-bg);
    margin: 0 0rem;
    border-radius: 0 0 0.5rem 0.5rem;
    min-height: calc(100vh - 56px);
}

/* Undo toast positioning */
.undo-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
}

@media (min-width: 768px) {
    .undo-toast {
        bottom: auto;
        right: auto;
        top: 0.75rem;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
    }
}

/* Tag group headers */
.tag-group-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-top: 0.6rem;
    padding-bottom: 0.15rem;
    padding-right: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
}

.tag-group-header[data-open="false"] {
    color: var(--bs-secondary-color);
    padding-bottom: 0.6rem;
}

.tag-toggle {
    display: inline-block;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.tag-group-header[data-open="false"] .tag-toggle {
    color: var(--bs-secondary-color);
    transform: rotate(-90deg);
}

.tag-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    border-radius: 9999px;
    padding: 0 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 1.1em;
    margin-left: 0.15rem;
}

/* Tag input widget */
.todo-tag-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: 0.2rem 0.65rem;
    background: var(--bs-body-bg);
    cursor: text;
    min-height: 2.5rem;
}

.todo-tag-input:focus-within {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    border-color: var(--bs-primary);
}

.todo-tag-input--editing {
    border-color: var(--bs-warning);
}

.todo-tag-input--editing:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-warning-rgb), 0.25);
    border-color: var(--bs-warning);
}

/* Editable text segments — inline spans between pills */
.todo-text-seg {
    outline: none;
    line-height: 1.5;
    min-width: 2px;
}

.todo-text-seg.todo-input-empty::before {
    content: attr(data-placeholder);
    color: var(--bs-secondary-color);
    pointer-events: none;
}

.todo-tag-input .todo-tag-pill,
.todo-tag-input .todo-date-pill,
.todo-tag-input .todo-rec-pill,
.todo-tag-input .todo-note-pill {
    margin-left: 0.3em;
    margin-right: 0.3em;
}

/* Pills sit inline between text segments */
.todo-tag-input .todo-tag-pill,
.todo-tag-input .todo-date-pill,
.todo-tag-input .todo-rec-pill,
.todo-tag-input .todo-note-pill {
    user-select: none;
    vertical-align: middle;
}

.todo-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
    border-radius: 9999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.todo-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--bs-info-text-emphasis);
    opacity: 0.6;
}
.todo-tag-remove:hover {
    opacity: 1;
}

.todo-quick-pick-chip {
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    border: 1px solid var(--bs-border-color);
    border-radius: 9999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.7rem;
    cursor: pointer;
}
.todo-quick-pick-chip:hover {
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
    border-color: var(--bs-info-border-subtle);
}

.todo-tag-autocomplete {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 20rem;
    max-width: 24rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow);
    z-index: 200;
    padding: 0.4rem 0;
    max-height: 16rem;
    overflow-y: auto;
}

.todo-ac-heading {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    padding: 0.2rem 0.75rem 0.15rem;
}

.todo-ac-item {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--bs-body-color);
}

/* Shortcut hint badge rendered to the right of composites */
.ci-shortcut-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-left: none;
    border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0;
    user-select: none;
    white-space: nowrap;
}
.ci-shortcut-hint .ci-shortcut-key {
    cursor: help;
    opacity: 0.6;
}
.ci-shortcut-hint .ci-shortcut-key:hover {
    opacity: 1;
}
/* When composite+hint live inside an input-group, remove the composite's right radius */
.input-group .todo-tag-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.todo-ac-item:hover,
.todo-ac-item.todo-ac-selected {
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
}

/* Edit button visibility */
.todo-edit-btn {
    opacity: 0;
    transition: opacity 0.15s;
}
.todo-item:hover .todo-edit-btn {
    opacity: 1;
}

/* Due date chip — low contrast by default, accent when due */
.todo-due {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}
.todo-due--today {
    color: var(--bs-primary);
    font-weight: 600;
}
.todo-due--overdue {
    color: var(--bs-danger);
    font-weight: 600;
}
.todo-due--future {
    color: var(--bs-secondary-color);
}

/* Scheduled-list day headers */
.scheduled-day-header {
    padding: 0.6rem 0 0.25rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 0.35rem;
}

/* Date picker / postpone palette popover */
.todo-popover {
    position: absolute;
    z-index: 300;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow);
    padding: 0.6rem;
    min-width: 20rem;
    max-width: 24rem;
}
.todo-popover input[type="text"] {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}
.todo-popover-preview {
    font-size: 0.75rem;
    color: var(--bs-primary);
    min-height: 1.2em;
    margin-bottom: 0.35rem;
}
.todo-popover-preview--invalid {
    color: var(--bs-danger);
}
.todo-popover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.3rem;
}
.todo-popover-actions button {
    flex: 0 0 auto;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 9999px;
    cursor: pointer;
    color: var(--bs-body-color);
}
.todo-popover-actions button:hover {
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
    border-color: var(--bs-info-border-subtle);
}

/* Mini calendar grid in the date picker */
.todo-mini-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-top: 0.4rem;
    font-size: 0.75rem;
}
.todo-mini-cal-cell {
    text-align: center;
    padding: 0.25rem 0;
    background: var(--bs-body-bg);
    cursor: pointer;
    border-radius: var(--bs-border-radius-sm);
    color: var(--bs-body-color);
}
.todo-mini-cal-cell.muted {
    color: var(--bs-secondary-color);
    opacity: 0.45;
}
.todo-mini-cal-cell.today {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    font-weight: 600;
}
.todo-mini-cal-cell.selected {
    background: var(--bs-primary);
    color: white;
}
.todo-mini-cal-cell:hover {
    background: var(--bs-info-bg-subtle);
}
.todo-mini-cal-header {
    font-weight: 600;
    color: var(--bs-secondary-color);
    cursor: default;
}
.todo-mini-cal-header:hover {
    background: transparent;
}

/* Linked-protocol badge on todo rows */
.todo-protocol-link {
    color: var(--bs-info);
    text-decoration: none;
    font-size: 1rem;
}
.todo-protocol-link:hover {
    color: var(--bs-info-text-emphasis);
}

/* Protocol run page */
.protocol-run-item {
    transition: background 0.15s ease;
}
.protocol-run-item.status-done,
.protocol-run-item.status-sent_to_todo {
    opacity: 0.55;
}
.protocol-run-item.is-current {
    outline: 2px solid var(--bs-primary);
    outline-offset: 1px;
}
.protocol-run-item-marker {
    width: 1.4em;
    text-align: center;
    color: var(--bs-secondary-color);
}
.protocol-run-item.status-done .protocol-run-item-marker {
    color: var(--bs-success);
}
.protocol-run-item.status-sent_to_todo .protocol-run-item-marker {
    color: var(--bs-primary);
}

/* Reuse swipe visuals for protocol run items, but with different action labels */
.protocol-run-item {
    position: relative;
    touch-action: pan-y;
    overflow: hidden;
}
.protocol-run-item[data-swipe-dir="right"]::before {
    content: "✓";
    position: absolute;
    inset: 0;
    background: var(--bs-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 1.25rem;
    font-size: 1.25rem;
    z-index: 0;
}
.protocol-run-item[data-swipe-dir="left"]::after {
    content: "→ todo";
    position: absolute;
    inset: 0;
    background: var(--bs-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1.25rem;
    font-size: 0.95rem;
    z-index: 0;
}
.protocol-run-item .card-body {
    position: relative;
    z-index: 1;
    background: var(--bs-body-bg);
}

/* Sublime-style protocol palette overlay */
.protocol-palette {
    position: fixed;
    top: 4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 28rem;
    max-width: calc(100vw - 2rem);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
    z-index: 400;
    padding: 0.5rem;
}
.protocol-palette-input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-sm);
    font-size: 0.9rem;
}
.protocol-palette-list {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0;
    max-height: 22rem;
    overflow-y: auto;
}
.protocol-palette-item {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--bs-border-radius-sm);
}
.protocol-palette-item.is-selected,
.protocol-palette-item:hover {
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
}
.protocol-palette-empty {
    padding: 0.4rem 0.6rem;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    font-style: italic;
}

/* Recurrence badge on rows */
.todo-recurrence {
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    cursor: help;
    user-select: none;
    white-space: nowrap;
}
.todo-recurrence-label {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    margin-right: 0.15rem;
}
.todo-recurrence:hover {
    color: var(--bs-primary);
}
.todo-recurrence:hover .todo-recurrence-label {
    color: var(--bs-primary);
}

/* Repetition pill in composite input */
.todo-rec-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
    border-radius: 9999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.todo-rec-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--bs-warning-text-emphasis);
    opacity: 0.6;
}
.todo-rec-remove:hover {
    opacity: 1;
}

/* Repetition history side panel */
.todo-history-panel {
    position: fixed;
    top: 4rem;
    right: 1rem;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow);
    padding: 0.75rem 1rem;
    z-index: 350;
    max-height: calc(100vh - 6rem);
    overflow: auto;
}
.todo-history-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.4rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.todo-history-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--bs-secondary-color);
    cursor: pointer;
}
.todo-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 2px solid var(--bs-border-color);
    padding-left: 0.75rem;
}
.todo-history-entry {
    position: relative;
    padding: 0.35rem 0;
    font-size: 0.8rem;
    color: var(--bs-body-color);
}
.todo-history-entry.is-current {
    font-weight: 600;
    color: var(--bs-primary);
}
.todo-history-marker {
    position: absolute;
    left: -1rem;
    top: 0.4rem;
    color: var(--bs-border-color);
    font-size: 0.65rem;
}
.todo-history-entry.is-current .todo-history-marker {
    color: var(--bs-primary);
}
.todo-history-date,
.todo-history-done,
.todo-history-status {
    display: block;
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    margin-top: 0.1rem;
}

/* Date pill in composite input */
.todo-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    border-radius: 9999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.todo-date-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--bs-primary);
    opacity: 0.6;
}
.todo-date-remove:hover {
    opacity: 1;
}

.todo-note-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
    border-radius: 9999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.todo-note-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--bs-success-text-emphasis);
    opacity: 0.6;
}
.todo-note-remove:hover {
    opacity: 1;
}

/* Smooth list refresh */
#todo-list {
    transition: opacity 0.12s ease-out;
}
#todo-list.htmx-swapping {
    opacity: 0;
}

/* Todo swipe gestures */
.todo-item {
    position: relative;
    touch-action: pan-y;
    overflow: hidden;
}

.todo-item:hover .todo-content {
    background: var(--bs-warning-bg-subtle);
}

.todo-content {
    position: relative;
    z-index: 1;
    gap: 0.5rem;
}

.todo-item[data-swipe-dir="right"]::before {
    content: "✓";
    position: absolute;
    inset: 0;
    background: var(--bs-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 1.25rem;
    font-size: 1.25rem;
    z-index: 0;
}

.todo-item[data-swipe-dir="left"]::after {
    content: "⏸";
    position: absolute;
    inset: 0;
    background: var(--bs-secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1.25rem;
    font-size: 1.25rem;
    z-index: 0;
}

/* ── Assignee pills (input) ──────────────────────────────────────────── */
.todo-assignee-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
    background: #0d9488;
    color: #fff;
    border-radius: 999px;
    padding: 0 0.55em;
    font-size: 0.78em;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}

.todo-assignee-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0;
    font-size: 0.9em;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.todo-assignee-remove:hover {
    color: #fff;
}

/* Assignee display on todo list rows */
.todo-assignees {
    font-size: 0.72rem;
    color: #0d9488;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 8em;
}

/* Small badge used in protocol item lists */
.todo-assignee-pill-sm {
    background-color: #0d9488;
    color: #fff;
    font-size: 0.68rem;
}

/* ── Unified space header — stars + nebula + Martian horizon ─────────────── */
/* Planet sits on the element background (below animated star pseudo-layers). */
/* 60% vertical keeps the planet centre at the nav/subnav boundary so the    */
/* disc spans both rows; the subnav shade darkens it slightly in row 2.       */
.helios-header {
    background-color: #04081a;
    background-image: url("mars-planet.svg");
    background-repeat: no-repeat;
    background-position: calc(100% + 100px) 15%;
    background-size: 260px 260px;
    position: relative;
}

.helios-header::before,
.helios-header::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* Layer 1 — nebula glow + bright/medium/dim white stars                      */
/* Nebula glows centred in the upper (navbar) third: y ≈ 28% of combined hdr */
.helios-header::before {
    background-image:
        radial-gradient(
            ellipse 50% 300% at 78% 28%,
            rgba(110, 55, 210, 0.13) 0%,
            transparent 100%
        ),
        radial-gradient(
            ellipse 35% 250% at 18% 28%,
            rgba(35, 75, 200, 0.09) 0%,
            transparent 100%
        ),
        /* bright (1 px) */
        radial-gradient(circle at 8% 30%, #fff 0%, #fff 1px, transparent 1px),
        radial-gradient(
            circle at 23% 65%,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(255, 255, 255, 0.9) 1px,
            transparent 1px
        ),
        radial-gradient(circle at 41% 20%, #fff 0%, #fff 1px, transparent 1px),
        radial-gradient(
            circle at 57% 78%,
            rgba(255, 255, 255, 0.85) 0%,
            rgba(255, 255, 255, 0.85) 1px,
            transparent 1px
        ),
        radial-gradient(circle at 69% 40%, #fff 0%, #fff 1px, transparent 1px),
        radial-gradient(
            circle at 82% 15%,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(255, 255, 255, 0.9) 1px,
            transparent 1px
        ),
        radial-gradient(
            circle at 91% 60%,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(255, 255, 255, 0.95) 1px,
            transparent 1px
        ),
        radial-gradient(
            circle at 35% 85%,
            rgba(255, 255, 255, 0.85) 0%,
            rgba(255, 255, 255, 0.85) 1px,
            transparent 1px
        ),
        radial-gradient(circle at 76% 35%, #fff 0%, #fff 1px, transparent 1px),
        radial-gradient(
            circle at 14% 75%,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(255, 255, 255, 0.9) 1px,
            transparent 1px
        ),
        /* medium (.6 px) */
        radial-gradient(
                circle at 3% 50%,
                rgba(255, 255, 255, 0.72) 0%,
                rgba(255, 255, 255, 0.72) 0.6px,
                transparent 0.6px
            ),
        radial-gradient(
            circle at 16% 20%,
            rgba(255, 255, 255, 0.68) 0%,
            rgba(255, 255, 255, 0.68) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 27% 45%,
            rgba(255, 255, 255, 0.78) 0%,
            rgba(255, 255, 255, 0.78) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 38% 90%,
            rgba(255, 255, 255, 0.62) 0%,
            rgba(255, 255, 255, 0.62) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 45% 10%,
            rgba(255, 255, 255, 0.72) 0%,
            rgba(255, 255, 255, 0.72) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 52% 60%,
            rgba(255, 255, 255, 0.68) 0%,
            rgba(255, 255, 255, 0.68) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 61% 30%,
            rgba(255, 255, 255, 0.78) 0%,
            rgba(255, 255, 255, 0.78) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 72% 80%,
            rgba(255, 255, 255, 0.62) 0%,
            rgba(255, 255, 255, 0.62) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 83% 55%,
            rgba(255, 255, 255, 0.72) 0%,
            rgba(255, 255, 255, 0.72) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 94% 25%,
            rgba(255, 255, 255, 0.68) 0%,
            rgba(255, 255, 255, 0.68) 0.6px,
            transparent 0.6px
        ),
        /* dim (.4 px) */
        radial-gradient(
                circle at 1% 40%,
                rgba(255, 255, 255, 0.42) 0%,
                rgba(255, 255, 255, 0.42) 0.4px,
                transparent 0.4px
            ),
        radial-gradient(
            circle at 7% 10%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 13% 55%,
            rgba(255, 255, 255, 0.48) 0%,
            rgba(255, 255, 255, 0.48) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 21% 80%,
            rgba(255, 255, 255, 0.33) 0%,
            rgba(255, 255, 255, 0.33) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 31% 30%,
            rgba(255, 255, 255, 0.43) 0%,
            rgba(255, 255, 255, 0.43) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 36% 60%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 43% 75%,
            rgba(255, 255, 255, 0.48) 0%,
            rgba(255, 255, 255, 0.48) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 50% 15%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 58% 45%,
            rgba(255, 255, 255, 0.43) 0%,
            rgba(255, 255, 255, 0.43) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 66% 20%,
            rgba(255, 255, 255, 0.33) 0%,
            rgba(255, 255, 255, 0.33) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 73% 65%,
            rgba(255, 255, 255, 0.48) 0%,
            rgba(255, 255, 255, 0.48) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 80% 30%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 89% 85%,
            rgba(255, 255, 255, 0.43) 0%,
            rgba(255, 255, 255, 0.43) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 97% 50%,
            rgba(255, 255, 255, 0.33) 0%,
            rgba(255, 255, 255, 0.33) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 4% 25%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 17% 70%,
            rgba(255, 255, 255, 0.43) 0%,
            rgba(255, 255, 255, 0.43) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 25% 50%,
            rgba(255, 255, 255, 0.33) 0%,
            rgba(255, 255, 255, 0.33) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 33% 10%,
            rgba(255, 255, 255, 0.48) 0%,
            rgba(255, 255, 255, 0.48) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 40% 40%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 53% 85%,
            rgba(255, 255, 255, 0.43) 0%,
            rgba(255, 255, 255, 0.43) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 62% 55%,
            rgba(255, 255, 255, 0.33) 0%,
            rgba(255, 255, 255, 0.33) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 70% 10%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 77% 75%,
            rgba(255, 255, 255, 0.48) 0%,
            rgba(255, 255, 255, 0.48) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 85% 45%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 92% 15%,
            rgba(255, 255, 255, 0.33) 0%,
            rgba(255, 255, 255, 0.33) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 9% 95%,
            rgba(255, 255, 255, 0.43) 0%,
            rgba(255, 255, 255, 0.43) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 26% 5%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 44% 95%,
            rgba(255, 255, 255, 0.33) 0%,
            rgba(255, 255, 255, 0.33) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 68% 5%,
            rgba(255, 255, 255, 0.43) 0%,
            rgba(255, 255, 255, 0.43) 0.4px,
            transparent 0.4px
        ),
        radial-gradient(
            circle at 86% 95%,
            rgba(255, 255, 255, 0.38) 0%,
            rgba(255, 255, 255, 0.38) 0.4px,
            transparent 0.4px
        );
    animation: helios-twinkle-a 4s ease-in-out infinite alternate;
}

/* Layer 2 — secondary medium stars + warm/cool tinted stars */
.helios-header::after {
    background-image:
        radial-gradient(
            circle at 11% 40%,
            rgba(255, 255, 255, 0.78) 0%,
            rgba(255, 255, 255, 0.78) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 29% 15%,
            rgba(255, 255, 255, 0.68) 0%,
            rgba(255, 255, 255, 0.68) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 48% 70%,
            rgba(255, 255, 255, 0.73) 0%,
            rgba(255, 255, 255, 0.73) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 64% 50%,
            rgba(255, 255, 255, 0.63) 0%,
            rgba(255, 255, 255, 0.63) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 78% 90%,
            rgba(255, 255, 255, 0.78) 0%,
            rgba(255, 255, 255, 0.78) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 87% 40%,
            rgba(255, 255, 255, 0.68) 0%,
            rgba(255, 255, 255, 0.68) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 6% 65%,
            rgba(255, 255, 255, 0.73) 0%,
            rgba(255, 255, 255, 0.73) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 19% 35%,
            rgba(255, 255, 255, 0.63) 0%,
            rgba(255, 255, 255, 0.63) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 55% 25%,
            rgba(255, 255, 255, 0.78) 0%,
            rgba(255, 255, 255, 0.78) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 96% 70%,
            rgba(255, 255, 255, 0.68) 0%,
            rgba(255, 255, 255, 0.68) 0.6px,
            transparent 0.6px
        ),
        /* tinted — cool blue */
        radial-gradient(
                circle at 34% 55%,
                rgba(200, 220, 255, 0.78) 0%,
                rgba(200, 220, 255, 0.78) 0.6px,
                transparent 0.6px
            ),
        radial-gradient(
            circle at 74% 20%,
            rgba(210, 225, 255, 0.75) 0%,
            rgba(210, 225, 255, 0.75) 0.6px,
            transparent 0.6px
        ),
        radial-gradient(
            circle at 22% 92%,
            rgba(220, 235, 255, 0.7) 0%,
            rgba(220, 235, 255, 0.7) 0.6px,
            transparent 0.6px
        ),
        /* tinted — warm amber/orange */
        radial-gradient(
                circle at 60% 85%,
                rgba(255, 225, 200, 0.7) 0%,
                rgba(255, 225, 200, 0.7) 0.6px,
                transparent 0.6px
            ),
        radial-gradient(
            circle at 50% 95%,
            rgba(255, 230, 210, 0.65) 0%,
            rgba(255, 230, 210, 0.65) 0.6px,
            transparent 0.6px
        ),
        /* tinted — rose */
        radial-gradient(
                circle at 90% 55%,
                rgba(255, 210, 230, 0.65) 0%,
                rgba(255, 210, 230, 0.65) 0.6px,
                transparent 0.6px
            );
    animation: helios-twinkle-b 6s ease-in-out infinite alternate-reverse;
}

@keyframes helios-twinkle-a {
    from {
        opacity: 0.82;
    }
    to {
        opacity: 1;
    }
}

@keyframes helios-twinkle-b {
    from {
        opacity: 1;
    }
    to {
        opacity: 0.75;
    }
}

@media (prefers-reduced-motion: reduce) {
    .helios-header::before,
    .helios-header::after {
        animation: none;
    }
}

/* Navbar sits transparently inside the header — stars show through */
.navbar.navbar-dark {
    background-color: transparent !important;
    position: relative;
}

.navbar.navbar-dark .container-fluid {
    position: relative;
    z-index: 1;
}

/* ── Martian horizon secondary bar ──────────────────────────────────────── */
/* Planet lives on .helios-header background and shows through here.        */
/* Shade overlay dims row 2 slightly for visual distinction.                */
.helios-subnav {
    position: relative;
    z-index: 1;
    background-color: transparent;
    background-image: linear-gradient(
        hat rgba(255, 255, 255, 0.1),
        rgba(0, 0, 0, 0)
    );
    border-bottom: 1px solid rgba(255, 197, 0, 0.3);
}

.helios-subnav .px-3 {
    position: relative;
    z-index: 1;
}

/* Nav tabs — legible against dark space / Mars glow */
.helios-subnav .nav-tabs {
    border-bottom: none;
}

.helios-subnav .nav-tabs .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid transparent;
    border-bottom-width: 2px;
    transition:
        color 0.15s ease,
        border-color 0.15s ease;
}

.helios-subnav .nav-tabs .nav-link:hover {
    color: rgba(255, 255, 255, 0.95);
    border-color: transparent;
    border-bottom-color: rgba(255, 197, 0, 0.45);
}

.helios-subnav .nav-tabs .nav-link.active {
    color: #fff;
    background-color: transparent;
    border-color: transparent;
    border-bottom: 2px solid rgb(255, 197, 0);
    font-weight: 600;
}

/* Badges inside task sub-nav — golden to match the atmosphere */
.helios-subnav .nav-tabs .nav-link .badge {
    background-color: rgba(255, 197, 0, 0.85) !important;
    color: #1a0800 !important;
}

.helios-subnav .nav-tabs .nav-link.active .badge {
    background-color: rgb(255, 197, 0) !important;
    color: #1a0800 !important;
}

/* Standalone page title (login, account, etc.) */
.helios-subnav h4 {
    color: #fff;
}

/* --- Attachment icon & hover preview strip --- */
.todo-attachment-thumbs {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.todo-attachment-thumb {
    width: 2rem;
    height: 2rem;
    object-fit: cover;
    border-radius: 0.2rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- Drag-and-drop visual feedback --- */
.todo-item--drag-over .todo-content {
    background-color: color-mix(
        in srgb,
        var(--bs-primary) 10%,
        transparent
    ) !important;
    box-shadow: inset 0 0 0 2px var(--bs-primary) !important;
    border-radius: var(--bs-border-radius);
}

.todo-item--uploading .todo-content {
    opacity: 0.6;
}

/* --- Attachment pill in edit form --- */
.todo-attachment-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
    border-radius: 9999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: middle;
    margin: 0 0.3em;
    user-select: none;
}

.todo-attachment-pill img {
    width: 1.2rem;
    height: 1.2rem;
    object-fit: cover;
    border-radius: 0.2rem;
}

.todo-attachment-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--bs-warning-text-emphasis);
    opacity: 0.6;
}

.todo-attachment-remove:hover {
    opacity: 1;
}
