/* Override Tailwind's .collapse { visibility: collapse } utility */
.collapse {
    visibility: visible !important;
}

/* Accordion panels (not navbar): hide until .show */
.accordion-collapse.collapse:not(.show) {
    display: none !important;
}
.accordion-collapse.collapse.show {
    display: block !important;
}

/* Navbar: collapsed behind hamburger below lg */
@media (max-width: 991.98px) {
    #navbarMenu.navbar-collapse.collapse:not(.show) {
        display: none !important;
    }
    #navbarMenu.navbar-collapse.collapse.show {
        display: block !important;
    }
}

/* Navbar: always expanded at lg+ */
@media (min-width: 992px) {
    #navbarMenu.navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
}

/* Brand colour tokens are injected from config/theme.php via App\Support\Theme */

.app-brand {
    color: var(--brand);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
}

.app-brand:hover,
.app-brand:focus {
    color: var(--brand-hover);
}

/* Settings theme picker */
.theme-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 0;
    padding: 0.7rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    background: #fff;
    cursor: pointer;
    min-width: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.theme-option:hover {
    border-color: rgba(var(--brand-rgb), 0.35);
    background: rgba(var(--brand-rgb), 0.03);
}

.theme-option.is-selected,
.theme-option:has(.theme-option-input:checked) {
    border-color: rgba(var(--brand-rgb), 0.55);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12);
    background: rgba(var(--brand-rgb), 0.05);
}

.theme-option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-option-swatch {
    flex: 0 0 1.85rem;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: var(--swatch, var(--brand));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.12);
}

.theme-option-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    width: 100%;
}

.theme-option-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.theme-option-desc {
    font-size: 0.78rem;
    color: rgba(var(--text-rgb), 0.5);
    line-height: 1.25;
}

/* Priority + Organise section palette (matches LifeArea::POSITION_COLORS 1–5) */
:root {
    --priority-high: #C0504D;
    --priority-medium: #7c4a00;
    --priority-low: #4f7fa8;
    --section-impactful: #3d5a80;
    --section-important: #2a8f84;
    --section-box: #825c43;
    --section-micro: #6b8f71;
    --section-follow-up: #6b7c8c;
    --section-default: #6c757d;
    --surface-muted: #f4f6f7;
    --surface-field: #f8fbfa;
    /* Soft reading black — use for body/primary text; muted UI uses --text-rgb opacities */
    --text: #3c4044;
    --text-rgb: 60, 64, 68;
    --surface-divider: rgba(var(--text-rgb), 0.05);
    /* Accordion section seams (Map / Organise) */
    --surface-section-divider: rgba(var(--text-rgb), 0.07);
}

body {
    color: var(--text);
}

/* Soft reading hierarchy (prefer over Bootstrap text-muted) */
.text-soft {
    color: rgba(var(--text-rgb), 0.55) !important;
}

.text-meta {
    color: rgba(var(--text-rgb), 0.45) !important;
}

/* Shared page title */
.page-title {
    color: var(--brand);
}

.empty-state {
    text-align: center;
    padding: 1.5rem 0.75rem;
    color: rgba(var(--text-rgb), 0.45);
}

.empty-state-compact {
    padding: 0.75rem 0.5rem;
}

.empty-state-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state-compact .empty-state-icon {
    font-size: 1.35rem;
    margin-bottom: 0.35rem;
}

.empty-state-message {
    font-size: 0.875rem;
    line-height: 1.35;
}

/* Help page */
.help-section {
    background: #fff;
}

.help-section-header {
    padding: 0.55rem 0.85rem;
    background: var(--surface-muted);
    color: var(--text);
    border-bottom: 1px solid var(--surface-divider);
}

.help-section-body {
    padding: 0.75rem 0.85rem;
    font-size: 0.925rem;
    line-height: 1.5;
    color: var(--text);
}

.help-section-body p {
    margin-bottom: 0.5rem;
}

.help-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: rgba(var(--text-rgb), 0.45);
}

.help-list {
    margin-bottom: 0.75rem;
    padding-left: 1.15rem;
}

.help-list li {
    margin-bottom: 0.25rem;
}

.help-note {
    font-size: 0.85rem;
    color: rgba(var(--text-rgb), 0.65);
}

.help-table {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.help-table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: rgba(var(--text-rgb), 0.45);
    border-bottom-color: var(--surface-divider);
}

.help-table td {
    border-bottom-color: var(--surface-divider);
    vertical-align: top;
}

.help-table a,
.help-inline-link,
.help-flow a {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
}

.help-table a:hover,
.help-inline-link:hover,
.help-flow a:hover {
    text-decoration: underline;
}

.help-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
    padding: 0.65rem 0.75rem;
    background: rgba(var(--brand-rgb), 0.06);
    border-radius: 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0;
}

.help-flow-arrow {
    color: rgba(var(--text-rgb), 0.35);
    font-weight: 500;
}

/* Completed page */
.completed-month-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.15rem;
}

.completed-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: rgba(var(--text-rgb), 0.55);
    text-decoration: none;
    flex-shrink: 0;
}

.completed-nav-btn:hover,
.completed-nav-btn:focus {
    color: var(--brand);
    background: rgba(var(--brand-rgb), 0.1);
}

.completed-month-meta {
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
    line-height: 1.2;
}

.completed-month-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brand);
}

.completed-month-range {
    font-size: 0.75rem;
    color: rgba(var(--text-rgb), 0.45);
    margin-top: 0.1rem;
}

.completed-nav-current {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
}

.completed-nav-current:hover,
.completed-nav-current:focus {
    text-decoration: underline;
}

.completed-count-line {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(var(--text-rgb), 0.45);
}

.completed-week-card {
    background: #fff;
}

.completed-week-header {
    padding: 0.55rem 0.85rem;
    background: var(--surface-muted);
    color: var(--text);
    border-bottom: 1px solid var(--surface-divider);
}

.completed-week-items {
    padding: 0.15rem 0.35rem 0.25rem;
}

.completed-item {
    padding: 0.35rem 0.5rem;
    background: transparent;
    border-bottom: 1px solid var(--surface-divider);
}

.completed-item:last-child {
    border-bottom: 0;
}

.completed-item .task-row {
    align-items: center;
    gap: 0.45rem 0.55rem;
}

.completed-item-date {
    flex: 0 0 1.5rem;
    width: 1.5rem;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25;
    color: rgba(var(--text-rgb), 0.4);
}

.completed-item .task-title-text {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25;
    color: var(--text);
}

.completed-item-tags {
    flex: 0 1 auto;
    max-width: 40%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem 0.4rem;
}

.completed-item .task-actions {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin-left: auto;
}

.completed-item .task-action-btn {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.completed-section-tag {
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.2;
    text-align: right;
    white-space: nowrap;
}

.completed-section-tag.section-impactful { color: var(--section-impactful); }
.completed-section-tag.section-important { color: var(--section-important); }
.completed-section-tag.section-box { color: var(--section-box); }
.completed-section-tag.section-micro { color: var(--section-micro); }
.completed-section-tag.section-follow-up { color: var(--section-follow-up); }
.completed-section-tag.section-default { color: var(--section-default); }

.completed-section-tag.completed-unplanned-tag {
    color: rgba(var(--text-rgb), 0.45);
}

/* Shared app modals */
.modal .modal-dialog {
    margin-left: auto;
    margin-right: auto;
    max-width: 32rem;
}

.modal .modal-content {
    border: 0;
    border-radius: 0.85rem;
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.14);
}

.modal .modal-header {
    border-bottom: 0;
    padding: 1rem 1rem 0;
    align-items: flex-start;
}

.modal .modal-body {
    padding: 0.75rem 1rem 0.5rem;
}

.modal .modal-footer {
    border-top: 0;
    padding: 0.5rem 1rem 1rem;
    gap: 0.5rem;
}

.modal .modal-title {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 1.05rem;
    line-height: 1.35;
    padding-right: 0.5rem;
    font-weight: 600;
}

.modal .modal-title.text-danger {
    color: #dc3545 !important;
}

.modal .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(var(--text-rgb), 0.55);
    margin-bottom: 0.4rem;
}

.modal .form-control,
.modal .form-select {
    font-size: 1rem;
    line-height: 1.45;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(var(--brand-rgb), 0.2);
    border-radius: 0.65rem;
    background: var(--surface-field);
    box-shadow: none;
}

.modal textarea.form-control {
    resize: vertical;
    min-height: 6.5rem;
}

.modal .form-control:focus,
.modal .form-select:focus {
    border-color: rgba(var(--brand-rgb), 0.55);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.15);
    background: #fff;
}

.modal .form-control::placeholder {
    color: rgba(var(--text-rgb), 0.4);
    font-size: 0.95rem;
}

.modal .modal-footer .btn {
    min-height: 2.4rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: 0.55rem;
    font-size: 0.925rem;
}

.modal .modal-footer > form {
    display: flex !important;
    flex: 1 1 0;
    margin: 0;
}

.modal .modal-footer > form .btn {
    width: 100%;
}

.modal .modal-footer .btn-light,
.modal .modal-footer .btn-secondary {
    background: #f1f3f5;
    border-color: transparent;
    color: rgba(var(--text-rgb), 0.75);
}

.modal .modal-footer .btn-light:hover,
.modal .modal-footer .btn-light:focus,
.modal .modal-footer .btn-secondary:hover,
.modal .modal-footer .btn-secondary:focus {
    background: #e6e9ec;
    border-color: transparent;
    color: var(--text);
}

.modal .modal-footer .btn-outline-danger {
    color: #c45b5b;
    border-color: rgba(196, 91, 91, 0.55);
    background: transparent;
}

.modal .modal-footer .btn-outline-danger:hover,
.modal .modal-footer .btn-outline-danger:focus {
    color: #fff;
    background: #c45b5b;
    border-color: #c45b5b;
}

.modal .modal-footer .btn-danger {
    color: #fff;
    background: #c45b5b;
    border-color: #c45b5b;
}

.modal .modal-footer .btn-danger:hover,
.modal .modal-footer .btn-danger:focus {
    color: #fff;
    background: #b04e4e;
    border-color: #b04e4e;
}

.modal .modal-body p {
    font-size: 0.95rem;
    line-height: 1.45;
}

.modal .modal-body .bg-light {
    font-size: 0.925rem;
}

.map-add-element-area {
    font-weight: 700;
}

@media (max-width: 575.98px) {
    .modal .modal-dialog {
        margin: 0.75rem auto;
        max-width: calc(100% - 1.5rem);
    }

    .modal .modal-title {
        font-size: 0.9rem;
        gap: 0.3rem;
    }

    .modal .form-control,
    .modal .form-select {
        font-size: 0.95rem;
        padding: 0.65rem 0.75rem;
    }

    .modal textarea.form-control {
        min-height: 5.75rem;
    }

    .modal .form-control::placeholder {
        font-size: 0.875rem;
    }

    .modal .modal-footer {
        flex-wrap: nowrap;
    }

    .modal .modal-footer .btn {
        min-height: 2.55rem;
        font-size: 0.9rem;
        flex: 1 1 0;
    }

    .modal .modal-footer > .btn {
        flex: 1 1 0;
    }

    .modal .modal-body p {
        font-size: 0.9rem;
    }
}

.btn-brand {
    background-color: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.btn-brand:hover,
.btn-brand:focus {
    background-color: var(--brand-hover);
    color: #fff;
    border-color: var(--brand-hover);
}

.priority-filter-btn.is-active {
    background-color: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.priority-filter-btn.is-active .priority-icon-high,
.priority-filter-btn.is-active .priority-icon-medium,
.priority-filter-btn.is-active .priority-icon-low {
    color: #fff;
}

/* Soft separators; kill Bootstrap's darker inset/focus accordion shadows on click.
   Per-item shadow-sm + zero gap stacks into a dark band that flashes under the
   header as the panel opens — keep one outer shadow on the accordion instead.
   Map + Organise share the same section-divider weight. */
.map-areas-list,
#tasksAccordion {
    --bs-accordion-border-color: var(--surface-section-divider);
    --bs-accordion-btn-focus-box-shadow: none;
    --bs-list-group-border-color: var(--surface-divider);
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    overflow: hidden;
}

.accordion-button.tasks-section-header,
.accordion-button.map-section-toggle {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

/* Shared section header type:
   Dashboard step titles, Map/Organise accordion, Now/Completed/Help/Recur headers */
.home-flow-title,
.accordion-button.tasks-section-header,
.accordion-button.map-section-toggle,
.now-section-header,
.completed-week-header,
.help-section-header,
.recur-section-header {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.35;
}

.accordion-button.tasks-section-header {
    background-color: var(--surface-muted);
    background-image: none;
    box-shadow: none !important;
    color: var(--text);
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-radius 0.15s ease;
}

.accordion-button.tasks-section-header:hover,
.accordion-button.tasks-section-header:focus,
.accordion-button.tasks-section-header:focus-visible,
.accordion-button.tasks-section-header:active {
    z-index: auto;
    box-shadow: none !important;
    outline: none;
}

.accordion-button.tasks-section-header:not(.collapsed) {
    background-color: var(--surface-muted);
    background-image: none;
    color: var(--text);
    box-shadow: none !important;
}

.accordion-button.tasks-section-header::after {
    margin-left: 0.35rem;
}

.tasks-section-icon {
    color: var(--section-color);
}

.tasks-section-priority-counts {
    margin-left: auto;
    margin-right: 0.35rem;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .accordion-button.tasks-section-header::after {
        margin-left: 0.5rem;
    }

    .tasks-section-priority-counts {
        margin-right: 0.85rem;
    }
}

.priority-count-high,
.priority-count-medium,
.priority-count-low {
    background-color: transparent;
    border: 1px solid currentColor;
    font-weight: 400;
}

.priority-count-high { color: var(--priority-high); }
.priority-count-medium { color: var(--priority-medium); }
.priority-count-low { color: var(--priority-low); }

/* Organise task rows: title wraps; actions stay on one line */
.task-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.5rem 0.65rem;
}

.task-title {
    flex: 1 1 0;
    min-width: 0;
}

.task-title-text {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.task-source-icon {
    cursor: help;
    outline: none;
}

.map-linked-work-trigger {
    border: 0;
    background: transparent;
    padding: 0.35rem;
    margin: -0.35rem -0.15rem -0.35rem 0;
    color: var(--brand);
    line-height: 1;
    cursor: pointer;
    vertical-align: baseline;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.map-linked-work-trigger:focus {
    outline: none;
}

.map-linked-work-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.map-linked-work-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.35rem 0;
}

.map-linked-work-item + .map-linked-work-item {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.map-linked-work-item-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.84rem;
    line-height: 1.35;
    color: var(--text);
}

.map-linked-work-item-meta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.05rem;
}

.map-linked-work-tag {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
}

.map-linked-work-tag.section-impactful { color: var(--section-impactful); }
.map-linked-work-tag.section-important { color: var(--section-important); }
.map-linked-work-tag.section-box { color: var(--section-box); }
.map-linked-work-tag.section-micro { color: var(--section-micro); }
.map-linked-work-tag.section-follow-up { color: var(--section-follow-up); }
.map-linked-work-tag.section-default { color: var(--section-default); }

.map-linked-work-now {
    font-size: 0.72rem;
    color: var(--brand);
}

.map-linked-work-more {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.75rem;
    color: rgba(var(--text-rgb), 0.5);
}

.popover.map-linked-work-popover {
    max-width: min(19rem, calc(100vw - 2rem));
    border: 0;
    box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.12);
}

.popover.map-linked-work-popover .popover-body {
    padding: 0.55rem 0.7rem;
    line-height: 1.35;
}

.task-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

/* Shared compact action buttons */
.task-action-btn {
    font-size: 0.8rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-action-btn.dropdown-toggle::after {
    display: none;
}

/* Inline rank prefix (map, organise, now) */
.inline-rank {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    opacity: 0.55;
    margin-right: 0.2rem;
}

.task-item.priority-high,
.task-item.priority-medium,
.task-item.priority-low {
    background-color: transparent;
}

.task-item.priority-high .task-rank-badge {
    color: var(--priority-high);
    opacity: 1;
}

.task-item.priority-medium .task-rank-badge {
    color: var(--priority-medium);
    opacity: 1;
}

.task-item.priority-low .task-rank-badge {
    color: var(--priority-low);
    opacity: 1;
}

.priority-group-header {
    padding: 0.45rem 0.75rem 0.2rem !important;
    background: var(--surface-muted);
    pointer-events: none;
}

.priority-group-label {
    font-size: 0.925rem;
    font-weight: 400;
    line-height: 1.35;
}

.priority-group-high .priority-group-label {
    color: var(--priority-high);
}

.priority-group-medium .priority-group-label {
    color: var(--priority-medium);
}

.priority-group-low .priority-group-label {
    color: var(--priority-low);
}

.task-drag-handle-spacer {
    display: inline-block;
    width: 1.1rem;
    flex-shrink: 0;
}

.task-item-reorder-blocked {
    animation: task-reorder-shake 0.45s ease;
}

@keyframes task-reorder-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.task-move-btn {
    color: rgba(var(--text-rgb), 0.45);
    border-color: transparent;
    background: transparent;
}

.task-move-btn:hover,
.task-move-btn:focus,
.task-move-btn:active,
.task-move-btn.show {
    color: rgba(var(--text-rgb), 0.7);
    border-color: transparent;
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none;
}

/* Now page — aligned with Map / Organise */

.now-alert-slim {
    padding: 0.35rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.3;
    border-radius: 0.375rem;
}

.now-alert-slim .bi {
    font-size: 0.85rem;
}

.now-section-header {
    padding: 0.55rem 0.85rem;
    background: var(--surface-muted);
    color: var(--text);
    border-bottom: 1px solid var(--surface-divider);
}

.now-section-count {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: rgba(var(--text-rgb), 0.45);
}

.now-inline-link {
    color: var(--brand);
}

/* Recur page — aligned with Now / Organise */
.recur-section-header {
    padding: 0.55rem 0.85rem;
    background: var(--surface-muted);
    color: var(--text);
    border-bottom: 1px solid var(--surface-divider);
}

.recur-section-count {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: rgba(var(--text-rgb), 0.45);
}

.recur-item {
    padding: 0.45rem 0.75rem;
    background: #fff;
}

.recur-item .task-row {
    align-items: center;
    gap: 0.25rem 0.45rem;
}

.recur-item .task-action-btn {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}

.recur-item .task-title-text {
    flex: 0 1 auto;
    min-width: 0;
}

.recur-due {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: rgba(var(--text-rgb), 0.5);
    min-width: 1.35rem;
    text-align: right;
}

.recur-type-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}

.recur-type-personal {
    color: #a65d3f;
    background: #e8e2d9;
}

.recur-type-work {
    color: #4a5560;
    background: #d8d9de;
}

.recur-item-desc {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.8rem;
    line-height: 1.35;
    color: rgba(var(--text-rgb), 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Shared labeled fields (auth, Recur create, Settings) */
.app-form .form-label,
.auth-form .form-label,
.recur-create-card .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(var(--text-rgb), 0.55);
    margin-bottom: 0.4rem;
}

.app-form .form-control,
.app-form .form-select,
.auth-form .form-control,
.auth-form .form-select,
.recur-create-card .form-control,
.recur-create-card .form-select {
    font-size: 1rem;
    line-height: 1.45;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(var(--brand-rgb), 0.2);
    border-radius: 0.65rem;
    background: var(--surface-field);
    box-shadow: none;
}

.app-form .form-control:focus,
.app-form .form-select:focus,
.auth-form .form-control:focus,
.auth-form .form-select:focus,
.recur-create-card .form-control:focus,
.recur-create-card .form-select:focus {
    border-color: rgba(var(--brand-rgb), 0.55);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.15);
    background: #fff;
}

.auth-form .form-text {
    font-size: 0.8rem;
    color: rgba(var(--text-rgb), 0.5);
}

.auth-form .form-check-label {
    color: var(--text);
    font-size: 0.925rem;
}

.auth-inline-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(var(--text-rgb), 0.5);
    text-decoration: none;
}

.auth-inline-link:hover,
.auth-inline-link:focus {
    color: var(--brand);
    text-decoration: underline;
}

.auth-card {
    background: #fff;
}

.recur-create-card {
    background: #fff;
}

.map-areas-list {
    display: flex;
    flex-direction: column;
}

.map-area {
    overflow: hidden;
    margin-bottom: 0;
    border-bottom: 1px solid var(--surface-section-divider) !important;
    box-shadow: none !important;
}

.map-area:last-child {
    border-bottom: 0 !important;
}

.map-area .accordion-collapse,
.map-area .accordion-body {
    overflow: visible;
}

.map-section-header {
    display: flex;
    align-items: stretch;
    background-color: var(--surface-muted);
}

.map-section-header:has(.map-section-toggle:not(.collapsed)) {
    background-image: none;
}

.accordion-button.map-section-toggle {
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    flex: 1 1 auto;
    width: auto;
}

.accordion-button.map-section-toggle:focus {
    box-shadow: none;
    border-color: transparent;
}

.accordion-button.map-section-toggle:not(.collapsed) {
    background-color: transparent;
    background-image: none;
    color: var(--text);
    box-shadow: none;
}

.accordion-button.map-section-toggle::after {
    flex-shrink: 0;
    margin-left: 0.35rem;
}

.map-section-icon {
    color: var(--section-color);
}

.map-section-name-group {
    flex: 1 1 auto;
    min-width: 0;
}

.map-section-label {
    flex-shrink: 1;
    min-width: 0;
    text-align: left;
}

.map-inline-add-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(var(--text-rgb), 0.45);
    background: none;
    border: none;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    user-select: none;
    transition: color 0.15s;
}

.map-inline-add-btn:hover,
.map-inline-add-btn:focus {
    color: var(--brand);
}

.map-area-drag {
    margin-right: 0.15rem;
    color: rgba(var(--text-rgb), 0.4);
}

.map-area-empty-section .accordion-button.map-section-toggle {
    cursor: default;
}

.map-area-empty-section .accordion-button.map-section-toggle::after {
    display: none;
}

.map-section-delete-form {
    display: flex;
    align-items: center;
    margin: 0;
    padding-right: 0.65rem;
    flex-shrink: 0;
}

.map-section-delete-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: rgba(var(--text-rgb), 0.35);
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.map-section-delete-btn:hover,
.map-section-delete-btn:focus {
    color: #dc3545;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: none;
}

/* Add Life Area picker */
.map-area-preview {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.5rem;
    background-color: var(--surface-muted);
    color: var(--text);
    font-weight: 600;
}

.map-area-preview-icon {
    font-size: 1.05rem;
    color: var(--section-color);
}

.map-area-preview-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-picker-grid {
    display: grid;
    gap: 0.45rem;
}

.map-icon-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.map-picker-option {
    appearance: none;
    border: 1.5px solid transparent;
    border-radius: 0.55rem;
    background: var(--surface-muted);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.map-picker-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.2rem 0.55rem rgba(0, 0, 0, 0.08);
}

.map-picker-option.is-selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.18);
}

.map-icon-option {
    color: rgba(var(--text-rgb), 0.72);
    font-size: 1.05rem;
}

.map-icon-option.is-selected {
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand);
}

@media (max-width: 575.98px) {
    .map-icon-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Continuous list rows inside Map / Organise / Now / Recur (not separate cards) */
.element-sortable > .list-group-item,
.task-sortable > .list-group-item,
.now-sortable > .list-group-item,
.recur-list > .list-group-item {
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--surface-divider) !important;
}

.element-sortable > .list-group-item:last-child,
.task-sortable > .list-group-item:last-child,
.now-sortable > .list-group-item:last-child,
.recur-list > .list-group-item:last-child {
    border-bottom: 0 !important;
}

/* Organise accordion: continuous sections, soft dividers, no stacked card shadows */
#tasksAccordion > .accordion-item {
    overflow: hidden;
    margin-bottom: 0;
    border-bottom: 1px solid var(--surface-section-divider) !important;
    box-shadow: none !important;
}

#tasksAccordion > .accordion-item:last-child {
    border-bottom: 0 !important;
}

#tasksAccordion > .accordion-item > .accordion-collapse,
#tasksAccordion > .accordion-item > .accordion-collapse > .accordion-body {
    overflow: visible;
}

#tasksAccordion .accordion-body {
    border-top: 1px solid var(--surface-section-divider);
}

/* Compact list rows (map elements, organise tasks, now items) */
.map-element-item,
.task-item,
.now-item {
    padding: 0.45rem 0.75rem;
}

.map-element-item .task-row,
.task-item .task-row,
.now-item .task-row {
    align-items: center;
    gap: 0.25rem 0.45rem;
}

.map-element-item .task-action-btn,
.task-item .task-action-btn,
.now-item .task-action-btn {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}

.map-element-item .element-drag-handle,
.task-item .task-drag-handle,
.now-item .now-drag-handle {
    font-size: 0.85rem;
    margin-right: 0.1rem !important;
}

/* Shared item title scale (list rows + Dashboard step subtitles) */
.map-element-item .task-title-text,
.task-item .task-title-text,
.now-item .task-title-text,
.completed-item .task-title-text,
.recur-item .task-title-text,
.home-flow-desc {
    font-size: 0.925rem;
    line-height: 1.35;
}

.map-element-item,
.now-item {
    background: #fff;
}

.map-element-item.sortable-ghost,
.task-item.sortable-ghost,
.now-item.sortable-ghost,
.life-area-item.sortable-ghost,
.element-item.sortable-ghost {
    opacity: 0.45;
}

.map-element-item.sortable-chosen,
.task-item.sortable-chosen,
.now-item.sortable-chosen,
.life-area-item.sortable-chosen,
.element-item.sortable-chosen {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}

.map-element-item.sortable-drag,
.element-item.sortable-drag,
.task-item.sortable-drag,
.now-item.sortable-drag {
    background: #fff !important;
}

/* Map / shared drag handles */
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--text-rgb), 0.45);
    cursor: grab;
    touch-action: none;
    user-select: none;
    line-height: 1;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle i {
    font-size: 1.1rem;
}

/* Shared ••• overflow menu (map, organise) */
.item-overflow-menu {
    position: static;
}

.item-overflow-btn {
    color: rgba(var(--text-rgb), 0.4);
    border-color: transparent;
    background: transparent;
}

.item-overflow-btn:hover,
.item-overflow-btn:focus,
.item-overflow-btn:active,
.item-overflow-btn.show {
    color: rgba(var(--text-rgb), 0.7);
    border-color: transparent;
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none;
}

.item-overflow-dropdown {
    z-index: 1060;
    min-width: 8rem;
}

.item-overflow-dropdown-wide {
    min-width: 220px;
}

.section-icon-impactful { color: var(--section-impactful); }
.section-icon-important { color: var(--section-important); }
.section-icon-box { color: var(--section-box); }
.section-icon-micro { color: var(--section-micro); }
.section-icon-follow-up { color: var(--section-follow-up); }

.priority-icon-high { color: var(--priority-high); }
.priority-icon-medium { color: var(--priority-medium); }
.priority-icon-low { color: var(--priority-low); }

/* Home / dashboard */
.home-flow-card {
    background: var(--surface-muted);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0;
    overflow: hidden;
}

.home-flow-step {
    --home-flow-pad-x: 1.15rem;
    --home-flow-pad-y: 0.85rem;
    --home-flow-icon-size: 3rem;
    --home-flow-line-left: calc(var(--home-flow-pad-x) + (var(--home-flow-icon-size) / 2) - 1px);

    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: var(--home-flow-pad-y) var(--home-flow-pad-x);
    color: inherit;
    text-decoration: none;
    min-height: 3.25rem;
    transition: background-color 0.15s ease;
}

/* Connector segments live inside each step so hover fill is edge-to-edge
   while the line still paints above the hover background. */
.home-flow-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: var(--home-flow-line-left);
    top: calc(var(--home-flow-pad-y) + var(--home-flow-icon-size));
    bottom: 0;
    width: 2px;
    background: rgba(var(--brand-rgb), 0.18);
    pointer-events: none;
    z-index: 1;
}

.home-flow-step:not(:first-child)::after {
    content: '';
    position: absolute;
    left: var(--home-flow-line-left);
    top: 0;
    height: var(--home-flow-pad-y);
    width: 2px;
    background: rgba(var(--brand-rgb), 0.18);
    pointer-events: none;
    z-index: 1;
}

.home-flow-step:hover,
.home-flow-step:focus {
    background: #fff;
    color: inherit;
}

.home-flow-icon {
    position: relative;
    z-index: 2;
    flex: 0 0 var(--home-flow-icon-size);
    width: var(--home-flow-icon-size);
    height: var(--home-flow-icon-size);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    background: var(--brand);
}

.home-flow-copy {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.home-flow-title {
    color: var(--brand);
}

.home-flow-desc {
    color: rgba(var(--text-rgb), 0.55);
}

.home-flow-chevron {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    font-size: 0.85rem;
    color: rgba(var(--text-rgb), 0.25);
}

.home-helpers-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
}

.home-helper-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(var(--text-rgb), 0.5);
    text-decoration: none;
}

.home-helper-link:hover,
.home-helper-link:focus {
    color: var(--brand);
    text-decoration: underline;
}

.home-helper-link.is-current {
    color: var(--brand);
}

.home-helper-sep {
    color: rgba(var(--text-rgb), 0.25);
    font-size: 0.85rem;
    line-height: 1;
}

.site-footer {
    position: relative;
    bottom: 0;
    width: 100%;
}

.nav-logout-btn {
    border: none;
    background: none;
}
