:root {
    --app-header-height: 72px;
    --ink-900: #16231a;
    --ink-800: #1e2d22;
    --ink-700: #2b3b2f;
    --ink-600: #3c4d42;
    --ink-500: #4e5f55;
    --ink-400: #7a8f80;
    --ink-300: #c4d0c7;
    --ink-200: #d8e1db;
    --ink-100: #eef3ef;
    --ink-50: #f4f7f4;
    --paper: #f9fbf8;
    --accent-600: #1b5b38;
    --accent-500: #237346;
    --accent-100: #e1f1e7;
    --shadow-sm: 0 6px 16px rgba(22, 35, 26, 0.08);
    --shadow-md: 0 10px 26px rgba(22, 35, 26, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Status type colors */
    --status-new-border: #5b7fa6;
    --status-new-bg: #edf2f7;
    --status-active-border: #237346;
    --status-active-bg: #e1f1e7;
    --status-paused-border: #a68b2b;
    --status-paused-bg: #faf5e4;
    --status-completed-border: #2a7d6e;
    --status-completed-bg: #e2f3f0;
    --status-removed-border: #9f5454;
    --status-removed-bg: #faeaea;
    --status-other-border: var(--ink-400);
    --status-other-bg: var(--ink-100);

    /* Due-date urgency row colors */
    --urgency-overdue-bg:   #fdf0ec;
    --urgency-overdue-bar:  #c0533a;
    --urgency-today-bg:     #fdf6e3;
    --urgency-today-bar:    #c08a30;
    --urgency-soon-bg:      #fdfaed;
    --urgency-soon-bar:     #b09a50;
    --urgency-upcoming-bg:  #fdfced;
    --urgency-upcoming-bar: #c4c470;
    --urgency-future-bg:    #eef4fb;
    --urgency-future-bar:   #7aabcc;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: radial-gradient(circle at top, #f2fbf6 0%, #e6f0ea 45%, #d6e2da 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink-900);
    font-family: "IBM Plex Sans", "Inter", "Segoe UI", sans-serif;
    background: transparent;
}

.container {
    padding: 1.25rem;
}

.main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.tasks-pane {
    min-width: 0;
}

.side-panel {
    position: relative;
    display: none;
}

@media (min-width: 901px) {
    .main-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }

    .side-panel {
        display: block;
    }

    #panel-state.panel-closed+#page-shell .main-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    #panel-state.panel-closed+#page-shell .side-panel {
        display: none;
    }

    /* Desktop-only open: show side panel as inline column on wide screens */
    #panel-state.panel-open-desktop+#page-shell .main-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }

    #panel-state.panel-open-desktop+#page-shell .side-panel {
        display: block;
    }
}

.side-panel-content {
    position: sticky;
    top: 1rem;
}

.task-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    min-width: 560px;
    background: var(--paper);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.task-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.task-table th,
.task-table td {
    border-bottom: 1px solid var(--ink-200);
    padding: 10px 12px;
    text-align: left;
    font-size: 0.95rem;
}

.task-cell-date {
    white-space: nowrap;
}

.task-cell-priority {
    white-space: nowrap;
    text-align: center;
    width: 1%;
    padding: 10px 8px;
}

.task-priority-rank {
    font-weight: 700;
    margin-right: 0.3em;
}

.task-priority-value {
    font-size: 0.8em;
    color: var(--ink-400);
}

/* Priority edit button (pencil icon) — styled like btn-new-task */
.task-priority-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: 0.3em;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink-500);
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    vertical-align: middle;
    line-height: 0;
}

.task-priority-edit-btn svg {
    display: block;
}

.task-row:hover .task-priority-edit-btn {
    opacity: 0.7;
}

.task-priority-edit-btn:hover,
.task-priority-edit-btn:focus-visible {
    opacity: 1;
    background: var(--accent-100);
    border-color: var(--accent-500);
    color: var(--accent-600);
}

.task-priority-edit-btn:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 1px;
}

/* Touch devices: always subtly visible */
@media (hover: none) {
    .task-priority-edit-btn {
        opacity: 0.5;
    }
}

/* Priority inline input */
.task-priority-input {
    width: 5em;
    padding: 4px 6px;
    border: 1px solid var(--accent-500);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--ink-900);
    background: #fff;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
}

.task-priority-input:focus {
    outline: none;
}

/* Date display: click-to-edit affordance */
.task-date-display {
    display: block;
    cursor: pointer;
    text-decoration-style: dashed;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.task-date-display:hover {
    text-decoration-line: underline;
    text-decoration-color: var(--ink-400);
    color: var(--accent-600);
}

/* Touch devices: always show dashed underline as tap affordance */
@media (hover: none) {
    .task-date-display {
        text-decoration-line: underline;
        text-decoration-color: var(--ink-300);
    }
}

/* Date inline input */
.task-date-input {
    padding: 4px 6px;
    border: 1px solid var(--accent-500);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--ink-900);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
    max-width: 10em;
}

.task-date-input:focus {
    outline: none;
}

.task-status-select {
    width: auto;
    max-width: 100%;
    padding: 6px 28px 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ink-200);
    background: #fff;
    color: var(--ink-900);
    font-size: 0.9rem;
    font-family: inherit;
}

.task-status-select:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
    outline: none;
}

.task-table th {
    background-color: #dbe7df;
    color: var(--ink-900);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.task-table thead tr th:first-child {
    border-top-left-radius: var(--radius-md);
}

.task-table thead tr th:last-child {
    border-top-right-radius: var(--radius-md);
}

.task-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-md);
}

.task-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-md);
}

.task-table tbody tr:last-child td {
    border-bottom: none;
}

.task-sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.task-sort-link:hover,
.task-sort-link:focus {
    color: var(--accent-600);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.task-sort-link:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Due-date urgency shading — row tint + left-border accent on priority cell.
   Zebra striping is intentionally omitted: mixing meaningful color with
   arbitrary alternating color would be confusing. Row separation is instead
   provided by the bottom border on each td. */
.task-table tr[data-urgency="overdue"] {
    background-color: var(--urgency-overdue-bg);
}
.task-table tr[data-urgency="overdue"] td:first-child {
    border-left: 3px solid var(--urgency-overdue-bar);
}
.task-table tr[data-urgency="today"] {
    background-color: var(--urgency-today-bg);
}
.task-table tr[data-urgency="today"] td:first-child {
    border-left: 3px solid var(--urgency-today-bar);
}
.task-table tr[data-urgency="soon"] {
    background-color: var(--urgency-soon-bg);
}
.task-table tr[data-urgency="soon"] td:first-child {
    border-left: 3px solid var(--urgency-soon-bar);
}
.task-table tr[data-urgency="upcoming"] {
    background-color: var(--urgency-upcoming-bg);
}
.task-table tr[data-urgency="upcoming"] td:first-child {
    border-left: 3px solid var(--urgency-upcoming-bar);
}
.task-table tr[data-urgency="future"] {
    background-color: var(--urgency-future-bg);
}
.task-table tr[data-urgency="future"] td:first-child {
    border-left: 3px solid var(--urgency-future-bar);
}

/* Increase urgency border weight when user prefers higher contrast */
@media (prefers-contrast: more) {
    .task-table tr[data-urgency="overdue"] td:first-child,
    .task-table tr[data-urgency="today"] td:first-child,
    .task-table tr[data-urgency="soon"] td:first-child,
    .task-table tr[data-urgency="upcoming"] td:first-child,
    .task-table tr[data-urgency="future"] td:first-child {
        border-left-width: 4px;
    }
}

.task-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0 1rem;
}

.task-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.task-search-icon {
    position: absolute;
    left: 0.5rem;
    color: var(--ink-400);
    pointer-events: none;
}

.task-search-input {
    padding: 6px 8px 6px 1.75rem;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--ink-900);
    background: #fff;
    width: 200px;
    flex-shrink: 1;
    min-width: 120px;
}

.task-search-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
}

.task-search-input::placeholder {
    color: var(--ink-400);
}

.task-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Base filter chip (shared layout) */
.task-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}

.task-filter-chip-x {
    font-size: 0.75rem;
    opacity: 0.5;
}

.task-filter-chip:hover .task-filter-chip-x {
    opacity: 1;
}

/* Status type chip: round pill, type-colored */
.task-filter-chip--pill {
    border-radius: 999px;
    background: var(--_status-bg, var(--ink-100));
    border-color: var(--_status-border, var(--ink-400));
    color: var(--ink-900);
}

.task-filter-chip--pill:hover,
.task-filter-chip--pill:focus {
    box-shadow: 0 0 0 1px var(--_status-border, var(--ink-400));
}

.task-filter-chip--pill[data-type="new"] {
    --_status-border: var(--status-new-border);
    --_status-bg: var(--status-new-bg);
}

.task-filter-chip--pill[data-type="active"] {
    --_status-border: var(--status-active-border);
    --_status-bg: var(--status-active-bg);
}

.task-filter-chip--pill[data-type="paused"] {
    --_status-border: var(--status-paused-border);
    --_status-bg: var(--status-paused-bg);
}

.task-filter-chip--pill[data-type="completed"] {
    --_status-border: var(--status-completed-border);
    --_status-bg: var(--status-completed-bg);
}

.task-filter-chip--pill[data-type="removed"] {
    --_status-border: var(--status-removed-border);
    --_status-bg: var(--status-removed-bg);
}

.task-filter-chip--pill[data-type="other"] {
    --_status-border: var(--status-other-border);
    --_status-bg: var(--status-other-bg);
}

/* Status chip: left-border badge, type-colored */
.task-filter-chip--badge {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border: none;
    border-left: 3px solid var(--_status-border, var(--ink-400));
    background: var(--_status-bg, var(--ink-100));
    color: var(--ink-700);
}

.task-filter-chip--badge:hover,
.task-filter-chip--badge:focus {
    box-shadow: 0 0 0 1px var(--_status-border, var(--ink-400));
}

.task-filter-chip--badge[data-type="new"] {
    --_status-border: var(--status-new-border);
    --_status-bg: var(--status-new-bg);
}

.task-filter-chip--badge[data-type="active"] {
    --_status-border: var(--status-active-border);
    --_status-bg: var(--status-active-bg);
}

.task-filter-chip--badge[data-type="paused"] {
    --_status-border: var(--status-paused-border);
    --_status-bg: var(--status-paused-bg);
}

.task-filter-chip--badge[data-type="completed"] {
    --_status-border: var(--status-completed-border);
    --_status-bg: var(--status-completed-bg);
}

.task-filter-chip--badge[data-type="removed"] {
    --_status-border: var(--status-removed-border);
    --_status-bg: var(--status-removed-bg);
}

.task-filter-chip--badge[data-type="other"] {
    --_status-border: var(--status-other-border);
    --_status-bg: var(--status-other-bg);
}

/* Tag chip: wraps a TagChip component */
.task-filter-chip--tag {
    padding: 0;
    border: none;
    background: none;
}

.task-filter-chip--tag:hover .tag-chip,
.task-filter-chip--tag:focus .tag-chip {
    border-color: var(--_tag-border);
}

/* ── Tag chip component ─────────────────────────────────────────── */

.tag-chip {
    --_tag-hue: var(--tag-hue, 148);
    --_tag-bg: hsl(var(--_tag-hue) 42% 93%);
    --_tag-fg: hsl(var(--_tag-hue) 40% 28%);
    --_tag-border: hsl(var(--_tag-hue) 35% 60%);

    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 10px;
    background: var(--_tag-bg);
    border-radius: 999px;
    color: var(--_tag-fg);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: default;
    position: relative;
    transition: border-color 0.15s ease;
    line-height: 1.4;
}

.tag-chip:hover,
.tag-chip:focus-visible {
    border-color: var(--_tag-border);
    outline: none;
}

/* Hierarchy indicator icon */
.tag-chip-path-icon {
    display: inline-flex;
    align-items: center;
    color: var(--_tag-border);
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.tag-chip:hover .tag-chip-path-icon,
.tag-chip:focus-visible .tag-chip-path-icon {
    opacity: 1;
}

/* Hierarchy path tooltip (JS-positioned, appended to <body>) */
.tag-chip-tooltip {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    padding: 4px 10px;
    background: var(--ink-900);
    color: var(--paper);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}

/* Tooltip arrow (points down by default = tooltip above chip) */
.tag-chip-tooltip-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--ink-900);
}

/* Arrow flipped: points up when tooltip is below chip */
.tag-chip-tooltip-arrow--top {
    bottom: auto;
    top: -8px;
    border-top-color: transparent;
    border-bottom-color: var(--ink-900);
}

/* Tag chip variant: selectable (suggestion items) */
.tag-chip--selectable {
    cursor: pointer;
    border: 1px solid var(--ink-200);
    background: var(--paper);
    color: var(--ink-700);
    font-family: inherit;
    padding: 3px 10px;
}

.tag-chip--selectable:hover,
.tag-chip--selectable:focus-visible {
    background: var(--_tag-bg);
    border-color: var(--_tag-border);
    color: var(--_tag-fg);
}

.tag-chip-add-icon {
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1;
    opacity: 0.5;
}

.tag-chip--selectable:hover .tag-chip-add-icon {
    opacity: 1;
}

/* Tag chip variant: removable (selected items with × button) */
.tag-chip--removable {
    padding-right: 4px;
}

.tag-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--_tag-fg);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.tag-chip-remove:hover {
    opacity: 1;
    background: hsl(var(--_tag-hue, 148) 30% 85%);
}

/* ── Tag selector component ─────────────────────────────────────── */

.tag-selector-sections {
    margin-top: 0.5rem;
}

.tag-selector-section {
    margin-bottom: 0.5rem;
}

.tag-selector-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-500);
    margin-bottom: 0.3rem;
}

.tag-selector-selected,
.tag-selector-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 28px;
    align-items: center;
}

.tag-selector-empty {
    color: var(--ink-500);
    font-size: 0.85rem;
}

.tag-selector-search-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.tag-selector-search-row input[type="text"] {
    flex: 1;
    min-width: 0;
}

.tag-browse-btn {
    padding: 0.35rem 0.625rem;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--ink-600);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.1s, border-color 0.1s;
}

.tag-browse-btn:hover {
    background: var(--ink-100);
    border-color: var(--ink-300);
}

/* ── End tag selector ───────────────────────────────────────────── */

/* ── Task picker item ───────────────────────────────────────────── */

.task-picker-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 0.85rem;
    text-align: left;
    width: 100%;
}

.task-picker-item-main {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.task-picker-item-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.task-picker-item-main .status-badge {
    flex-shrink: 0;
    font-size: 0.75rem;
}

.task-picker-item-path {
    font-size: 0.75rem;
    color: var(--ink-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-picker-item--selectable {
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.1s, border-color 0.1s;
}

.task-picker-item--selectable:hover {
    background: var(--ink-50);
    border-color: var(--ink-300);
}

.task-picker-item--removable {
    cursor: pointer;
    font-family: inherit;
    background: var(--ink-50);
    transition: background-color 0.1s, border-color 0.1s;
}

.task-picker-item--removable:hover {
    background: var(--danger-50, hsl(0 60% 97%));
    border-color: var(--danger-300, hsl(0 50% 70%));
}

/* "×" hint shown at the trailing edge of the removable item's main row */
.task-picker-item-remove-hint {
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.35;
    color: var(--ink-600);
    pointer-events: none;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.task-picker-item--removable:hover .task-picker-item-remove-hint {
    opacity: 0.8;
    color: var(--danger-600, hsl(0 50% 40%));
}

/* Read-only panel navigation buttons */
.task-picker-item--navigable {
    cursor: pointer;
    font-family: inherit;
    color: var(--ink-700);
    transition: background-color 0.1s, border-color 0.1s;
}

.task-picker-item--navigable:hover {
    background: var(--ink-50);
    border-color: var(--ink-300);
}

/* ── Task parent selector ───────────────────────────────────────── */

.task-parent-selector-sections {
    margin-top: 0.5rem;
}

.task-parent-selector-section {
    margin-bottom: 0.5rem;
}

.task-parent-selector-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-500);
    margin-bottom: 0.3rem;
}

.task-parent-selector-selected {
    min-height: 28px;
}

.task-parent-selector-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 28px;
}

.task-parent-selector-empty {
    color: var(--ink-500);
    font-size: 0.85rem;
}

/* ── Task parent/child links in read-only panel ────────────────── */

.panel-children-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}



/* ── End task picker ────────────────────────────────────────────── */

/* ── Color picker component ─────────────────────────────────────── */

.color-picker {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
    padding: 0.25rem 0;
}

.color-picker-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    background: hsl(var(--tag-hue, 148) 42% 72%);
    cursor: pointer;
    padding: 0;
    max-width: 28px;
    justify-self: center;
    transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.color-picker-swatch:hover {
    transform: scale(1.15);
    border-color: hsl(var(--tag-hue, 148) 35% 50%);
}

.color-picker-swatch--selected {
    border-color: hsl(var(--tag-hue, 148) 40% 28%);
    box-shadow: 0 0 0 2px hsl(var(--tag-hue, 148) 42% 85%);
    transform: scale(1.15);
}

.color-picker-swatch:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

/* ── Tag color dot (used in tag list table) ────────────────────── */

.tag-color-col {
    width: 1%;
    padding: 10px 4px 10px 12px !important;
    white-space: nowrap;
}

.tag-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: hsl(var(--tag-hue, 148) 42% 72%);
    vertical-align: middle;
}

/* ── End color picker ──────────────────────────────────────────── */
/* ── End tag chip ───────────────────────────────────────────────── */

/* ── Tag tree component ────────────────────────────────────────── */

.tag-tree {
    width: 100%;
}

/* Controls bar: search input + expand/collapse buttons */
.tree-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.tree-search {
    flex: 1 1 150px;
    min-width: 0;
    padding: 0.35rem 0.625rem;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--paper);
    color: var(--ink-800);
}

.tree-control-btns {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.tree-search:focus {
    outline: none;
    border-color: var(--accent-500);
}

.tree-search::placeholder {
    color: var(--ink-400);
}

.tree-control-btn {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--ink-600);
    transition: background-color 0.1s;
}

.tree-control-btn:hover {
    background: var(--ink-100);
}

.tree-control-btn--active {
    background: var(--accent-100);
    color: var(--accent-600);
    border-color: var(--accent-500);
}

.tree-control-btn--active:hover {
    background: var(--accent-100);
}

/* Responsive card grid for root subtrees */
.tag-tree-forest {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
    align-items: start;
}

/* Each root tag is wrapped in a card */
.tag-tree-root-card {
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    padding: 0.375rem 0;
    background: var(--paper);
}

.tag-tree-root-card--filtered-out {
    display: none;
}

/* Responsive wrapping layout for category sections — small categories
   sit side-by-side while larger ones naturally take more space. */
.tag-tree-category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag-tree-category-grid>.tag-tree-category-section {
    flex: 1 1 360px;
    min-width: 0;
}

/* Category section: groups root cards under a category header */
.tag-tree-category-section {
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    background: var(--ink-100);
}

.tag-tree-category-section--filtered-out {
    display: none;
}

.tag-tree-category-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.625rem;
}

.tag-tree-category-section--uncategorized {
    border-style: dashed;
}

.tag-tree-category-header--uncategorized {
    color: var(--ink-500);
}

.tag-tree-category-header--uncategorized .tag-tree-category-name {
    font-weight: 400;
}

/* Collapse toggle for category sections */
.tag-tree-category-toggle {
    background: none;
    border: none;
    padding: 0.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--ink-500);
    border-radius: 2px;
    transition: color 0.1s;
}

.tag-tree-category-toggle:hover {
    color: var(--ink-800);
}

.tag-tree-category-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
    transform: rotate(90deg);
}

.tag-tree-category-section--collapsed .tag-tree-category-chevron {
    transform: rotate(0deg);
}

.tag-tree-category-section--collapsed .tag-tree-category-body {
    display: none;
}

.tag-tree-category-name {
    font-weight: 600;
    font-size: 0.9375rem;
    flex: 1;
    text-align: left;
}

/* Reset button styles when category name is a <button> */
button.tag-tree-category-name {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
}

button.tag-tree-category-name:hover {
    color: var(--accent-600);
}

/* Body wraps the forest grid inside a category section */
.tag-tree-category-body {
    padding: 0 0.5rem 0.5rem;
}

/* Inside a category section the root cards use a subtler border since
   the section wrapper already provides visual grouping. */
.tag-tree-category-section .tag-tree-root-card {
    border-color: var(--ink-100);
}

/* Tree node: block container for a card row + children */
.tree-node {
    /* No visual treatment — structural only */
}

.tree-node--filtered-out {
    display: none;
}

/* The clickable row for each node */
.tree-node-card {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.625rem;
    padding-left: calc(var(--depth, 0) * 1.125rem + 0.625rem);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.1s;
    min-height: 1.75rem;
}

.tree-node-card:hover {
    background: var(--ink-100);
}

/* Expand/collapse toggle button */
.tree-toggle {
    background: none;
    border: none;
    padding: 0.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--ink-500);
    border-radius: 2px;
    transition: color 0.1s;
}

.tree-toggle:hover {
    color: var(--ink-800);
}

/* Chevron rotation: default is expanded (pointing down-ish via 90deg rotation) */
.tree-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
    transform: rotate(90deg);
}

/* When collapsed, chevron points right (no rotation) */
.tree-node--collapsed>.tree-node-card .tree-chevron {
    transform: rotate(0deg);
}

/* Hide children when collapsed */
.tree-node--collapsed>.tree-children {
    display: none;
}

/* Spacer for leaf nodes (aligns with toggle button width) */
.tree-toggle-spacer {
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
}

/* Tag color indicator dot */
.tree-node-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(var(--tag-hue, 148) 42% 72%);
    flex-shrink: 0;
}

/* Tag name */
.tree-node-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    color: var(--ink-800);
}

/* Task counts: open / total */
.tree-node-counts {
    font-size: 0.75rem;
    color: var(--ink-400);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.tree-node-count-open {
    color: var(--ink-500);
    font-weight: 500;
}

.tree-node-count-sep {
    margin: 0 0.0625rem;
}

.tree-node-count-total {
    color: var(--ink-400);
}

/* Selected state (used in modal selector mode) */
.tree-node--selected>.tree-node-card {
    background: var(--accent-100);
    outline: 2px solid var(--accent-500);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

.tree-node--selected>.tree-node-card:hover {
    background: var(--accent-100);
}

/* Empty state */
.tree-empty {
    color: var(--ink-400);
    font-size: 0.875rem;
    padding: 1rem 0;
}

/* View toggle (List / Tree switch) */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-left: auto;
}

.view-toggle-btn {
    padding: 0.3rem 0.75rem;
    border: none;
    background: var(--paper);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--ink-500);
    transition: background-color 0.1s, color 0.1s;
}

.view-toggle-btn:hover {
    background: var(--ink-100);
}

.view-toggle-btn--active {
    background: var(--accent-500);
    color: #fff;
}

.view-toggle-btn--active:hover {
    background: var(--accent-600);
}

.view-toggle-btn+.view-toggle-btn {
    border-left: 1px solid var(--ink-200);
}

/* Dialog for tag tree selector modal */
.tag-tree-dialog {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 600px;
    width: 90vw;
    height: min(70vh, 600px);
    padding: 0;
}

.tag-tree-dialog[open] {
    display: flex;
    flex-direction: column;
}

.tag-tree-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.tag-tree-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ink-100);
}

.tag-tree-dialog-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--ink-800);
}

.tag-tree-dialog-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--ink-400);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.tag-tree-dialog-close:hover {
    color: var(--ink-700);
}

.tag-tree-dialog-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Narrower columns inside the dialog */
.tag-tree-dialog-content .tag-tree-forest {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.tag-tree-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--ink-100);
}

/* ── End tag tree component ────────────────────────────────────── */

.task-filter-button {
    background: transparent;
    border: 1px solid var(--ink-200);
    color: var(--ink-700);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
}

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
    padding: 2rem 0 3rem;
}

.auth-card {
    width: min(480px, 100%);
    background: var(--paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2.5rem 2rem;
    border: 1px solid rgba(27, 91, 56, 0.12);
}

.auth-header h1 {
    margin: 0.35rem 0 0.75rem;
    font-size: 2rem;
    letter-spacing: -0.02em;
}

.auth-eyebrow {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-600);
    font-weight: 700;
}

.auth-subtitle {
    margin: 0 0 1.75rem;
    color: var(--ink-500);
    line-height: 1.5;
}

.auth-notice {
    margin: 0 0 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: #fff4dc;
    color: #8c5a12;
    border: 1px solid rgba(140, 90, 18, 0.2);
    font-size: 0.9rem;
    line-height: 1.4;
}

.auth-form-group {
    margin-bottom: 1.5rem;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-field {
    display: grid;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--ink-700);
    font-weight: 600;
}

.auth-field input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ink-200);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink-900);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    border: none;
    background: var(--accent-500);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 10px 18px rgba(35, 115, 70, 0.2);
}

.auth-button:hover {
    background: var(--accent-600);
    transform: translateY(-1px);
}

.auth-button:disabled {
    cursor: wait;
    opacity: 0.75;
    transform: none;
    box-shadow: none;
}

.auth-hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-500);
}

.auth-message {
    margin: 0;
    font-size: 0.85rem;
    color: var(--accent-600);
}

.auth-message.error {
    color: #9f2b2b;
}

.auth-accordion {
    border-top: 1px solid var(--ink-200);
    padding-top: 1.25rem;
}

.auth-accordion summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-700);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.auth-accordion summary::-webkit-details-marker {
    display: none;
}

.auth-accordion summary::after {
    content: "+";
    font-size: 1.2rem;
    color: var(--accent-600);
}

.auth-accordion[open] summary::after {
    content: "-";
}

.auth-accordion .auth-form {
    margin-top: 1rem;
}

/* Session-expired dialog — shown when an HTMX request fails due to an
   expired session. Uses the native <dialog> element for built-in backdrop
   and focus trapping, consistent with the tag-tree dialog pattern. */
.session-expired-dialog {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 420px;
    width: 90vw;
    padding: 0;
}

.session-expired-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.session-expired-content {
    padding: 2rem 2rem 1.75rem;
}

.session-expired-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: var(--ink-900);
    letter-spacing: -0.01em;
}

.session-expired-message {
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink-600);
}

.session-expired-actions {
    display: flex;
    gap: 0.75rem;
}

.session-expired-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: none;
    background: var(--accent-500);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.session-expired-login:hover {
    background: var(--accent-600);
}

.session-expired-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--ink-200);
    background: var(--paper);
    color: var(--ink-700);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.session-expired-dismiss:hover {
    border-color: var(--ink-300);
    background: var(--ink-100);
}

.settings-container {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.settings-card {
    width: min(520px, 100%);
    background: var(--paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    border: 1px solid var(--ink-200);
}

.settings-card h2 {
    margin-top: 0;
}

.settings-subtitle {
    color: var(--ink-500);
    margin: 0 0 1.5rem;
}

.settings-form {
    display: grid;
    gap: 1rem;
}

.settings-field {
    display: grid;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--ink-700);
}

.settings-field input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ink-200);
    font-size: 0.95rem;
    font-family: inherit;
}

.settings-field input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
}

@media (max-width: 600px) {
    .auth-shell {
        padding: 1.5rem 0 2.5rem;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .auth-header h1 {
        font-size: 1.75rem;
    }
}

.task-filter-button:hover {
    border-color: var(--accent-500);
    color: var(--accent-600);
    background: var(--accent-100);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--ink-200);
    background: var(--paper);
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-toggle {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-700);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-toggle:hover {
    background: var(--accent-100);
    border-color: var(--accent-500);
}

.nav-menu {
    position: fixed;
    top: var(--app-header-height);
    left: 0;
    z-index: 60;
    width: 100%;
    pointer-events: auto;
}

.nav-menu-backdrop {
    position: fixed;
    inset: var(--app-header-height) 0 0 0;
    background: transparent;
    z-index: 0;
}

.nav-menu-panel {
    width: min(260px, 85vw);
    margin: 0.75rem;
    padding: 1rem;
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.nav-menu-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
    margin-bottom: 0.75rem;
}

.nav-menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-menu-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ink-200);
    background: var(--ink-100);
    color: var(--ink-700);
    font-weight: 600;
    cursor: pointer;
}

.nav-menu-link:hover {
    background: var(--accent-100);
    border-color: var(--accent-500);
}

.nav-menu-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-menu summary::after {
    content: "▾";
    font-size: 0.75rem;
    color: var(--ink-500);
    margin-left: 0.25rem;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    min-width: 160px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 40;
}

.user-menu-link {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    color: var(--ink-700);
    text-decoration: none;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.user-menu-link:hover {
    background: var(--ink-100);
}

.user-menu-button {
    width: 100%;
}

.username {
    font-weight: 600;
    color: var(--ink-900);
}

.current-mode {
    font-size: 0.85rem;
    color: var(--ink-500);
}

.panel-toggle {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--ink-700);
}

.panel-toggle:hover {
    background: var(--ink-100);
}

.panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 40;
}

.panel-card {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
}

/* ── Quick-create overlay ─────────────────────────────────────── */
.quick-create-overlay:empty {
    display: none;
}

.quick-create-overlay {
    animation: qcSlideIn 0.2s ease;
}

/* Hide the panel card underneath while a quick-create form is active
   so the underlying content doesn't peek through on any screen size.
   Form state in the hidden card is preserved in the DOM.
   Toggled via hx-on::after-swap on the overlay element. */
.panel-card--hidden {
    display: none;
}

@keyframes qcSlideIn {
    from {
        opacity: 0;
        transform: translateX(2rem);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.panel-shell {
    color: var(--ink-500);
    text-align: center;
    font-style: italic;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.panel-title {
    font-weight: 600;
    color: var(--ink-900);
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-close {
    background: transparent;
    border: none;
    color: var(--ink-500);
    cursor: pointer;
}

.panel-close:hover {
    color: var(--ink-900);
}

.panel-section {
    margin-bottom: 1rem;
}

.panel-section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-500);
    margin-bottom: 0.4rem;
}

/* Filter tab toggle */
.filter-tabs {
    display: flex;
    border-bottom: 1px solid var(--ink-200);
    margin-bottom: 0.75rem;
    gap: 0;
}

.filter-tab {
    flex: 1;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ink-500);
    cursor: pointer;
    text-align: center;
    transition: color 0.15s, border-color 0.15s;
}

.filter-tab:hover {
    color: var(--ink-700);
}

.filter-tab.active {
    color: var(--ink-900);
    border-bottom-color: var(--accent, var(--ink-900));
    font-weight: 600;
}

.filter-tab-panel--hidden {
    display: none;
}

/* Toggle pill controls */
.toggle-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.toggle-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-full, 999px);
    color: var(--ink-600);
    background: var(--paper);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
}

.toggle-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.toggle-pill:hover {
    border-color: var(--ink-400);
    color: var(--ink-800);
}

.toggle-pill--active {
    background: var(--_status-bg, var(--ink-100));
    border-color: var(--_status-border, var(--ink-400));
    color: var(--ink-900);
    font-weight: 500;
}

.toggle-pill[data-type="new"] {
    --_status-border: var(--status-new-border);
    --_status-bg: var(--status-new-bg);
}

.toggle-pill[data-type="active"] {
    --_status-border: var(--status-active-border);
    --_status-bg: var(--status-active-bg);
}

.toggle-pill[data-type="paused"] {
    --_status-border: var(--status-paused-border);
    --_status-bg: var(--status-paused-bg);
}

.toggle-pill[data-type="completed"] {
    --_status-border: var(--status-completed-border);
    --_status-bg: var(--status-completed-bg);
}

.toggle-pill[data-type="removed"] {
    --_status-border: var(--status-removed-border);
    --_status-bg: var(--status-removed-bg);
}

.toggle-pill[data-type="other"] {
    --_status-border: var(--status-other-border);
    --_status-bg: var(--status-other-bg);
}

/* Smaller toggle pill variant (used in date filter presets) */
.toggle-pill--sm {
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
}

/* ── Date filter sections ──────────────────────────────────────── */

.date-filter-sections {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.date-filter-section {
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    background: var(--paper);
}

.date-filter-section--active {
    border-color: var(--accent-500);
}

.date-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.625rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-700);
    list-style: none;
    user-select: none;
}

.date-filter-summary::-webkit-details-marker {
    display: none;
}

.date-filter-summary::after {
    content: "+";
    font-size: 1rem;
    color: var(--ink-400);
    transition: color 0.1s;
}

.date-filter-section[open]>.date-filter-summary::after {
    content: "\2212";
    /* minus sign */
}

.date-filter-label {
    flex: 1;
}

.date-filter-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-500);
    margin-right: 0.4rem;
}

.date-filter-body {
    padding: 0 0.625rem 0.5rem;
}

/* Date filter tabs (Quick / Custom / Range) */
.date-filter-tabs {
    display: flex;
    border-bottom: 1px solid var(--ink-200);
    margin-bottom: 0.5rem;
    gap: 0;
}

.date-filter-tab {
    flex: 1;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ink-500);
    cursor: pointer;
    text-align: center;
    transition: color 0.15s, border-color 0.15s;
}

.date-filter-tab:hover {
    color: var(--ink-700);
}

.date-filter-tab.active {
    color: var(--ink-900);
    border-bottom-color: var(--accent-500);
    font-weight: 600;
}

.date-filter-tab-panel--hidden {
    display: none;
}

/* Preset groups */
.date-filter-presets .toggle-pill-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.date-filter-presets .toggle-pill {
    justify-content: center;
}

.date-filter-preset-group {
    margin-bottom: 0.4rem;
}

.date-filter-preset-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-400);
    margin-bottom: 0.2rem;
}

/* Hide radio inputs inside preset pills */
.date-filter-presets input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Custom relative filter */

/* Direction toggle row: pills expand to fill width */
.date-filter-custom-direction {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

/* Days input row */
.date-filter-custom-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.date-filter-custom-label,
.date-filter-custom-dir-label {
    font-size: 0.8rem;
    color: var(--ink-500);
    white-space: nowrap;
}

.date-filter-custom-dir-label {
    min-width: 2.5em;
}

.date-filter-custom-input {
    width: 5em;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--ink-900);
    background: #fff;
    text-align: center;
}

.date-filter-custom-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
}

/* Hide radio inputs inside custom direction pills */
.date-filter-custom input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Expand pill to fill available space */
.toggle-pill--expand {
    flex: 1;
    justify-content: center;
    text-align: center;
}

/* Range date inputs */
.date-filter-range-fields {
    display: flex;
    gap: 0.5rem;
}

.date-filter-range-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.date-filter-range-label {
    font-size: 0.75rem;
    color: var(--ink-500);
    font-weight: 500;
}

.date-filter-range-input {
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--ink-900);
    background: #fff;
    width: 100%;
}

.date-filter-range-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(27, 91, 56, 0.15);
}

/* Clear button within a date filter section */
.date-filter-clear {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0;
    border: none;
    background: none;
    font-size: 0.75rem;
    color: var(--ink-500);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.date-filter-clear:hover {
    color: var(--ink-700);
}

/* ── End date filter sections ──────────────────────────────────── */

/* Date chip (filter bar) */
.task-filter-chip--date {
    border-radius: 999px;
    background: var(--ink-100);
    border-color: var(--ink-400);
    color: var(--ink-900);
}

.task-filter-chip--date:hover,
.task-filter-chip--date:focus {
    box-shadow: 0 0 0 1px var(--ink-400);
}

/* Search chip (filter bar) */
.task-filter-chip--search {
    border-radius: 999px;
    background: var(--ink-100);
    border-color: var(--ink-400);
    color: var(--ink-900);
}

.task-filter-chip--search:hover,
.task-filter-chip--search:focus {
    box-shadow: 0 0 0 1px var(--ink-400);
}

.panel-text {
    color: var(--ink-700);
}

.panel-list {
    margin: 0;
    padding-left: 1rem;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.panel-action {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--ink-700);
}

.panel-action:hover {
    background: var(--accent-100);
    border-color: var(--accent-500);
}

.panel-action.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.task-row {
    cursor: pointer;
}

.task-row:hover td {
    background-color: rgba(35, 115, 70, 0.08);
}

.task-name-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
}

.task-name {
    word-break: break-word;
}

/* Inline parent / child-count annotations beside the task name */
.task-hierarchy-info {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--ink-400);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Full text variant (default) */
.task-hierarchy-full {
    display: contents;
    /* transparent wrapper — children join parent flex */
}

.task-hierarchy-parent {
    max-width: 30ch;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-hierarchy-parent::before {
    content: "← ";
}

.task-hierarchy-sep::before {
    content: "·";
    color: var(--ink-300);
}

.task-hierarchy-children {
    font-variant-numeric: tabular-nums;
}

/* Compact icon variant (hidden by default, shown on narrow screens) */
.task-hierarchy-compact {
    display: none;
}

.task-hierarchy-icon-parent,
.task-hierarchy-icon-children {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-variant-numeric: tabular-nums;
}

/* ── Tag list component (read-only chip collection) ─────────────── */

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Task-row variant: inline with the task name, smaller chips */
.tag-list.task-tags {
    display: inline-flex;
    gap: 0.25rem;
}

.task-tags .tag-chip {
    font-size: 0.75rem;
    padding: 1px 7px;
    line-height: 1.3;
}



.mode-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 50;
    min-width: 200px;
}

.mode-menu-panel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.mode-menu-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--ink-700);
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--ink-200);
}

.mode-option {
    width: 100%;
    text-align: left;
    background: var(--ink-100);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
}

.mode-option:hover {
    background: var(--accent-100);
}

.mode-current {
    color: var(--ink-500);
    font-size: 0.8rem;
}

.mode-close {
    margin-top: 0.25rem;
    background: transparent;
    border: none;
    color: var(--ink-500);
    cursor: pointer;
    text-align: right;
}

.mode-close:hover {
    color: var(--ink-900);
}

/* Task actions bar */
.tasks-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.btn-new-task {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-700);
}

.btn-new-task:hover {
    background: var(--accent-100);
}

.content-pane {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Tasks content area - normal styling */
.tasks-content {
    width: 100%;
    max-width: none;
    margin: 0;
    position: relative;
}

/* Tasks shell - dashed border when no tasks */
.tasks-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    text-align: center;
    color: var(--ink-500);
    font-style: italic;
    position: relative;
}

.form-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    background: #fff;
    box-sizing: border-box;
    font-size: 0.95rem;
    color: var(--ink-900);
    font-family: inherit;
}

.form-input:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(221, 107, 54, 0.2);
    outline: none;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--ink-700);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    background: #fff;
    box-sizing: border-box;
    font-size: 0.95rem;
    color: var(--ink-900);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(221, 107, 54, 0.2);
    outline: none;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--ink-700);
    font-size: 0.9rem;
}

/* Status filter list (By Status tab) */
.status-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.status-filter-toggle {
    display: block;
    cursor: pointer;
    user-select: none;
    opacity: 0.65;
    transition: opacity 0.08s;
}

.status-filter-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.status-filter-toggle .status-badge {
    width: 100%;
}

.status-filter-toggle:hover {
    opacity: 0.85;
}

.status-filter-toggle--active {
    opacity: 1;
}

.status-filter-toggle--active .status-badge {
    box-shadow: 0 0 0 1px var(--_status-border);
}

/* Status badge component */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-left: 3px solid var(--_status-border);
    background: var(--_status-bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
    color: var(--ink-700);
    line-height: 1.3;
}

.status-badge-name {
    font-weight: 500;
}

.status-badge-order {
    font-size: 0.75rem;
    color: var(--ink-400);
    font-weight: 400;
}

.status-badge[data-type="new"] {
    --_status-border: var(--status-new-border);
    --_status-bg: var(--status-new-bg);
}

.status-badge[data-type="active"] {
    --_status-border: var(--status-active-border);
    --_status-bg: var(--status-active-bg);
}

.status-badge[data-type="paused"] {
    --_status-border: var(--status-paused-border);
    --_status-bg: var(--status-paused-bg);
}

.status-badge[data-type="completed"] {
    --_status-border: var(--status-completed-border);
    --_status-bg: var(--status-completed-bg);
}

.status-badge[data-type="removed"] {
    --_status-border: var(--status-removed-border);
    --_status-bg: var(--status-removed-bg);
}

.status-badge[data-type="other"] {
    --_status-border: var(--status-other-border);
    --_status-bg: var(--status-other-bg);
}

.form-error {
    color: #a3251f;
    background: #fdecea;
    border: 1px solid #f1b8b1;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.btn-primary {
    background: var(--accent-500);
    border: 1px solid var(--accent-600);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-600);
}

.btn-secondary {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--ink-700);
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--ink-100);
}

/* Toast notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #f3fbf5;
    border: 1px solid #4aa36f;
    border-left: 4px solid #4aa36f;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    min-width: 300px;
    cursor: pointer;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.error {
    background: #fdecea;
    border-color: #e07c72;
    border-left-color: #e07c72;
}

.toast.info {
    background: #edf4ff;
    border-color: #5b8bd6;
    border-left-color: #5b8bd6;
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .side-panel {
        display: block;
        position: fixed;
        top: var(--app-header-height);
        right: 0;
        height: calc(100vh - var(--app-header-height));
        width: 320px;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 50;
    }

    .side-panel-content {
        position: static;
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--paper);
        padding: 1rem;
    }

    #panel-state.panel-open+#page-shell .side-panel {
        transform: translateX(0);
    }

    #panel-state.panel-open+#page-shell .panel-backdrop {
        display: block;
    }
}

@media (max-width: 700px) {
    .side-panel {
        width: 100%;
        height: auto;
        max-height: calc(100vh - var(--app-header-height));
        top: auto;
        bottom: 0;
        transform: translateY(100%);
    }

    .side-panel-content {
        height: auto;
        max-height: calc(100vh - var(--app-header-height));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #panel-state.panel-open+#page-shell .side-panel {
        transform: translateY(0);
    }

    /* Mobile task table: hide Start/End Date, tighten spacing */
    .container {
        padding: 0.75rem;
    }

    .task-table {
        min-width: 0;
    }

    .task-table th:nth-child(n+5),
    .task-table td:nth-child(n+5) {
        display: none;
    }

    .task-table th,
    .task-table td {
        padding: 8px 8px;
        font-size: 0.9rem;
    }

    /* Compact priority column: rank only, short header */
    .task-priority-value,
    .task-priority-edit-btn {
        display: none;
    }

    .task-priority-rank {
        margin-right: 0;
    }

    .task-cell-priority {
        padding: 8px 4px;
    }

    .task-table thead th:first-child .task-sort-label {
        font-size: 0;
    }

    .task-table thead th:first-child .task-sort-label::before {
        content: "#";
        font-size: 0.9rem;
        font-weight: 600;
    }

    /* Constrain status dropdown width */
    .task-status-select {
        max-width: 6.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 4px 20px 4px 6px;
        font-size: 0.85rem;
    }

    /* Border radius on the last visible column (4th) */
    .task-table thead tr th:nth-child(4) {
        border-top-right-radius: var(--radius-md);
    }

    .task-table tbody tr:last-child td:nth-child(4) {
        border-bottom-right-radius: var(--radius-md);
    }

    /* Swap hierarchy indicator to compact icon-only mode */
    .task-hierarchy-full {
        display: none;
    }

    .task-hierarchy-compact {
        display: contents;
    }
}

/* ── Loading bar (cold-start indicator) ───────────────────────────── */

#loading-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
}

#loading-bar.loading-bar--active {
    opacity: 1;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--accent-500) 40%,
            var(--accent-500) 60%,
            transparent 100%);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: loading-bar-slide 1.2s ease-in-out infinite;
}

#loading-bar.loading-bar--finishing {
    opacity: 0;
    background: var(--accent-500);
    background-size: 100% 100%;
    animation: loading-bar-finish 0.3s ease-out forwards;
}

@keyframes loading-bar-slide {
    0% {
        background-position: -40% 0;
    }

    100% {
        background-position: 140% 0;
    }
}

@keyframes loading-bar-finish {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Filter Sets Bar */
.filter-sets-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    margin-left: 16px;
}

.filter-sets-quick {
    display: flex;
    flex: 1;
    gap: 6px;
    overflow: hidden;
    min-width: 0;
    mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
}


.filter-sets-btn {
    padding: 6px 12px;
    border: 1px solid var(--ink-200);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-700);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.filter-sets-btn:hover {
    background: var(--ink-50);
    border-color: var(--ink-300);
}

.filter-sets-btn.is-active {
    font-weight: 600;
    border-bottom: 2px solid var(--accent-500);
}


.filter-sets-more {
    position: relative;
    flex-shrink: 0;
}

.filter-sets-more-btn {
    padding: 6px 12px;
    border: 1px solid var(--ink-300);
    background: var(--ink-50);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-600);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    margin-left: 8px;
}

.filter-sets-more-btn:hover {
    background: var(--ink-100);
    border-color: var(--ink-400);
    color: var(--ink-800);
}

.filter-sets-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: auto;
    min-width: 220px;
    max-width: 280px;
    background: white;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 100;
    display: none;
}

.filter-sets-dropdown.open {
    display: block;
}

/* Filter Sets Menu */
.filter-sets-menu {
    padding: 8px 0;
}

.filter-sets-menu-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-500);
    border-bottom: 1px solid var(--ink-100);
    margin-bottom: 8px;
}

.filter-sets-menu-section {
    padding: 0 8px;
    margin-bottom: 8px;
}

.filter-sets-menu-section-title {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-sets-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink-700);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
    border: none;
    background: none;
    font-family: inherit;
}

.filter-sets-menu-item:hover {
    background: var(--ink-50);
}

.filter-sets-menu-item.is-active {
    font-weight: 600;
    color: var(--accent-600);
}

.filter-sets-menu-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-sets-menu-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--ink-100);
    border-radius: var(--radius-sm);
    color: var(--ink-600);
    margin-left: 8px;
    flex-shrink: 0;
}

.filter-sets-menu-divider {
    height: 1px;
    background: var(--ink-100);
    margin: 8px 0;
}

.filter-sets-save-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 0 8px 8px 8px;
    background: var(--accent-500);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.filter-sets-save-action:hover {
    background: var(--accent-600);
}

.filter-sets-save-action svg {
    flex-shrink: 0;
}

/* Filter Sets Management Page */
.filter-sets-manage {
    padding: 24px;
    max-width: 800px;
}

.filter-sets-manage .page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--ink-900);
    margin-bottom: 8px;
}

.filter-sets-manage .page-subtitle {
    font-size: 14px;
    color: var(--ink-500);
    margin-bottom: 24px;
}

/* Opening view setting */
.filter-sets-opening-view {
    margin-bottom: 28px;
}

.filter-sets-opening-view-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.filter-sets-opening-view-select {
    display: block;
    width: 100%;
    max-width: 320px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--ink-800);
    background: white;
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.filter-sets-opening-view-select:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px var(--accent-100);
}

.filter-sets-opening-view-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--ink-400);
}

.filter-sets-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-sets-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease;
}

.filter-sets-manage-item:hover {
    border-color: var(--ink-300);
}

.filter-sets-manage-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-sets-manage-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-800);
}

/* Favorite star toggle */
.fs-favorite-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--ink-300);
    transition: color 0.15s ease, transform 0.1s ease;
}

.fs-favorite-btn:hover {
    color: var(--accent-500);
    transform: scale(1.15);
}

.fs-favorite-btn.is-favorite {
    color: var(--accent-500);
}

.filter-sets-manage-actions-inline {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-sets-manage-link {
    font-size: 13px;
    color: var(--accent-600);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.filter-sets-manage-link:hover {
    background: var(--accent-100);
    color: var(--accent-600);
}

/* ··· row menu */
.fs-row-menu {
    position: relative;
}

.fs-row-menu-btn {
    list-style: none;
    padding: 5px 8px;
    font-size: 16px;
    letter-spacing: 1px;
    color: var(--ink-400);
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.fs-row-menu-btn::-webkit-details-marker {
    display: none;
}

.fs-row-menu-btn:hover {
    background: var(--ink-100);
    color: var(--ink-600);
}

.fs-row-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 100;
    min-width: 180px;
    background: white;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fs-row-menu-action {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--ink-700);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.fs-row-menu-action:hover {
    background: var(--ink-50);
}

.fs-row-menu-action-danger {
    color: #d73a3a;
}

.fs-row-menu-action-danger:hover {
    background: #fdecea;
}

.fs-row-menu-note {
    display: block;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--ink-400);
    font-style: italic;
}

.filter-sets-menu-actions {
    padding: 8px 16px;
}

.filter-sets-menu-action {
    font-size: 13px;
    color: var(--accent-600);
    text-decoration: none;
}

.filter-sets-menu-action:hover {
    color: var(--accent-600);
    text-decoration: underline;
}

.filter-set-save-actions {
    margin-top: 1.5rem;
}

.btn-danger {
    background: #fdecea;
    border: 1px solid #e07c72;
    color: #d73a3a;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-danger:hover {
    background: #fce8e6;
    border-color: #d73a3a;
}

/* Panel Options for Filter Set Forms */
.panel-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-options .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-700);
    cursor: pointer;
    line-height: 1.4;
}

.panel-options .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent-500);
    flex-shrink: 0;
}

.panel-options .checkbox-label span {
    flex: 1;
}

/* Filter Set Summary Box */
.filter-set-summary-box {
    padding: 12px 16px;
    background: var(--ink-50);
    border-left: 4px solid var(--accent-500);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--ink-700);
    line-height: 1.5;
}

/* Confirmation Modal */
.confirmation-dialog {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 420px;
    width: 90vw;
    padding: 0;
}

.confirmation-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.confirmation-content {
    padding: 2rem 2rem 1.75rem;
}

.confirmation-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: var(--ink-900);
    letter-spacing: -0.01em;
}

.confirmation-message {
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink-600);
}

.confirmation-actions {
    display: flex;
    gap: 0.75rem;
}

.confirmation-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--ink-200);
    background: var(--paper);
    color: var(--ink-700);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.confirmation-cancel:hover {
    border-color: var(--ink-300);
    background: var(--ink-100);
}

.confirmation-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: none;
    background: var(--danger-500, hsl(0 50% 50%));
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.confirmation-confirm:hover {
    background: var(--danger-600, hsl(0 50% 40%));
}