:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef3f8;
    --text: #172033;
    --muted: #667085;
    --line: #d9e1ec;
    --accent: #2563eb;
    --accent-strong: #1e40af;
    --accent-soft: #e8f1ff;
    --success: #047857;
    --warning: #b54708;
    --ink: #0f172a;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
    --shadow-soft: 0 10px 28px rgba(16, 24, 40, 0.06);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --elevation-1: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
    --elevation-2: 0 8px 20px rgba(16, 24, 40, 0.08), 0 2px 6px rgba(16, 24, 40, 0.05);
    --elevation-3: 0 24px 56px rgba(15, 23, 42, 0.16), 0 6px 18px rgba(15, 23, 42, 0.08);

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 140ms;
    --duration-base: 220ms;
}

[data-theme="dark"] {
    --bg: #0b1120;
    --surface: #141b2d;
    --surface-soft: #1c2438;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --line: #2a3447;
    --accent: #3b82f6;
    --accent-strong: #60a5fa;
    --accent-soft: #1e293b;
    --success: #34d399;
    --warning: #fb923c;
    --ink: #f8fafc;
    --danger: #f87171;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.35);

    --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
    --elevation-2: 0 8px 20px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
    --elevation-3: 0 24px 56px rgba(0, 0, 0, 0.55), 0 6px 18px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1120;
        --surface: #141b2d;
        --surface-soft: #1c2438;
        --text: #e2e8f0;
        --muted: #94a3b8;
        --line: #2a3447;
        --accent: #3b82f6;
        --accent-strong: #60a5fa;
        --accent-soft: #1e293b;
        --success: #34d399;
        --warning: #fb923c;
        --ink: #f8fafc;
        --danger: #f87171;
        --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
        --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.35);

        --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
        --elevation-2: 0 8px 20px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
        --elevation-3: 0 24px 56px rgba(0, 0, 0, 0.55), 0 6px 18px rgba(0, 0, 0, 0.4);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, #eef4fb 0, #f7f9fc 240px, #f5f7fb 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] body {
    background:
        linear-gradient(180deg, #0d1424 0, #0b1120 240px, #0b1120 100%);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) body {
        background:
            linear-gradient(180deg, #0d1424 0, #0b1120 240px, #0b1120 100%);
    }
}

code {
    background: var(--surface-soft);
    border-radius: 6px;
    padding: 0.1rem 0.25rem;
}

pre {
    background: #101828;
    border-radius: 8px;
    color: #e4e7ec;
    max-width: 100%;
    overflow-x: auto;
    padding: 1rem;
    white-space: pre-wrap;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.ghost-button {
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    padding: 0.8rem 1rem;
}

button:hover,
.ghost-button:hover {
    background: var(--accent-strong);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 288px;
    background:
        linear-gradient(180deg, #08111f 0%, #111827 52%, #0c1220 100%);
    color: #fff;
    padding: 1.25rem;
    overflow-y: auto;
    transition: width 0.22s ease, box-shadow 0.22s ease, padding 0.22s ease;
    z-index: 30;
}

.sidebar-toggle {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.13);
    color: #d7deea;
    display: flex;
    gap: 0.55rem;
    justify-content: center;
    margin-bottom: 1rem;
    min-height: 38px;
    padding: 0.55rem 0.7rem;
    width: 100%;
}

.sidebar-toggle:hover {
    background: rgba(110, 231, 183, 0.14);
    color: #fff;
}

.sidebar-toggle span {
    white-space: nowrap;
}

.sidebar-toggle [data-sidebar-toggle-icon] {
    font-size: 1rem;
    line-height: 1;
}

.shell {
    transition: margin-left 0.22s ease;
}

html.sidebar-auto .sidebar {
    overflow-x: hidden;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
    width: 84px;
}

html.sidebar-auto .shell {
    margin-left: 84px;
}

html.sidebar-auto .sidebar:hover,
html.sidebar-auto .sidebar:focus-within {
    box-shadow: 18px 0 45px rgba(8, 17, 31, 0.24);
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    width: 288px;
}

html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .brand {
    justify-content: center;
}

html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .brand span:not(.brand-mark),
html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .sidebar-metrics,
html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .nav,
html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .sidebar-section,
html.sidebar-auto .sidebar:not(:hover):not(:focus-within) [data-sidebar-toggle-label] {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .sidebar-toggle {
    padding-left: 0;
    padding-right: 0;
}

html.sidebar-auto .sidebar .brand span:not(.brand-mark),
html.sidebar-auto .sidebar .sidebar-metrics,
html.sidebar-auto .sidebar .nav,
html.sidebar-auto .sidebar .sidebar-section,
html.sidebar-auto .sidebar [data-sidebar-toggle-label] {
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.brand {
    align-items: center;
    display: flex;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, #6ee7b7, #60a5fa);
    border-radius: 8px;
    color: #08111f;
    display: inline-flex;
    font-weight: 900;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #b7c4d7;
    margin-top: 0.15rem;
}

.logout-link {
    color: #94a3b8;
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    margin: -0.6rem 0 1.2rem;
}

.logout-link:hover {
    color: #fff;
    text-decoration: underline;
}

.sidebar-metrics {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1.2rem;
}

.sidebar-metrics article {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    display: grid;
    gap: 0.1rem;
    padding: 0.65rem 0.5rem;
}

.sidebar-metrics strong {
    font-size: 1.15rem;
    line-height: 1;
}

.sidebar-metrics span {
    color: #aebbd0;
    font-size: 0.68rem;
    font-weight: 800;
}

.nav {
    display: grid;
    gap: 0.35rem;
}

.nav a {
    border-radius: 8px;
    color: #d7deea;
    font-weight: 800;
    padding: 0.75rem 0.85rem;
}

.nav a.active,
.nav a:hover {
    background: rgba(96, 165, 250, 0.18);
    color: #fff;
    box-shadow: inset 3px 0 0 #6ee7b7;
}

.sidebar-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #d7deea;
    margin-top: 1.5rem;
    padding: 0.85rem;
}

.sidebar-section strong {
    color: #aebbd0;
    display: block;
    font-size: 0.74rem;
    letter-spacing: 0;
    margin-bottom: 0.65rem;
    text-transform: uppercase;
}

.sidebar-tree {
    display: grid;
    gap: 0.18rem;
}

.sidebar-area {
    border-radius: 8px;
}

.sidebar-area summary {
    align-items: center;
    border-radius: 8px;
    color: #d7deea;
    cursor: pointer;
    display: grid;
    gap: 0.45rem;
    grid-template-columns: auto auto minmax(0, 1fr);
    list-style: none;
    min-height: 34px;
    padding: 0.38rem 0.45rem;
}

.sidebar-area summary::-webkit-details-marker {
    display: none;
}

.sidebar-area summary:hover {
    background: rgba(110, 231, 183, 0.1);
    color: #fff;
}

.sidebar-caret {
    border-color: transparent transparent transparent #b7c4d7;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    height: 0;
    transition: transform 0.16s ease;
    width: 0;
}

.sidebar-area[open] > summary .sidebar-caret {
    transform: rotate(90deg);
}

.sidebar-area-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid color-mix(in srgb, var(--area-color, #60a5fa) 42%, rgba(255, 255, 255, 0.16));
    border-radius: 6px;
    color: color-mix(in srgb, var(--area-color, #60a5fa) 72%, #ffffff);
    display: inline-flex;
    flex: 0 0 auto;
    height: 22px;
    justify-content: center;
    line-height: 1;
    width: 22px;
}

.area-svg {
    fill: none;
    height: 14px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 14px;
}

.sidebar-subareas {
    border-left: 1px solid rgba(110, 231, 183, 0.18);
    display: grid;
    gap: 0.1rem;
    margin-left: 0.65rem;
    padding-left: 0.55rem;
}

.sidebar-area summary a,
.sidebar-area-link {
    align-items: center;
    border-radius: 8px;
    color: #b7c4d7;
    display: grid;
    font-size: 0.88rem;
    gap: 0.45rem;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 32px;
    min-width: 0;
    padding: 0.35rem 0.45rem;
}

.sidebar-area summary a {
    color: inherit;
    display: block;
    overflow: hidden;
    padding: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-area-link {
    grid-template-columns: auto minmax(0, 1fr);
}

.sidebar-area-link span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-subareas a:hover,
.sidebar-area-link:hover {
    background: rgba(110, 231, 183, 0.1);
    color: #fff;
}

.sidebar-area.is-in-path > summary,
.sidebar-area-link.is-in-path {
    background: rgba(96, 165, 250, 0.11);
    color: #fff;
}

.sidebar-area.is-current > summary,
.sidebar-area-link.is-current {
    background: rgba(110, 231, 183, 0.16);
    box-shadow: inset 3px 0 0 #6ee7b7;
    color: #fff;
}

.shell {
    margin-left: 288px;
    padding: 1.25rem 1.35rem 2rem;
}

.topbar {
    align-items: center;
    background: rgba(245, 247, 251, 0.78);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(217, 225, 236, 0.7);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 0.55rem;
    position: sticky;
    top: 0.75rem;
    z-index: 15;
}

.search {
    flex: 1;
    position: relative;
}

.search input,
.form-row input,
.form-grid input,
.form-grid select,
textarea,
.timer-panel input,
.timer-panel select {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 42px;
    padding: 0.75rem 0.85rem;
    width: 100%;
}

.search input {
    border-color: rgba(203, 213, 225, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.live-search-panel {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(217, 225, 236, 0.96);
    border-radius: 8px;
    box-shadow: 0 24px 65px rgba(16, 24, 40, 0.16);
    display: grid;
    gap: 0.7rem;
    left: 0;
    max-height: min(70vh, 560px);
    overflow: auto;
    padding: 0.85rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.45rem);
    z-index: 20;
}

.live-search-panel[hidden] {
    display: none;
}

.live-search-group {
    display: grid;
    gap: 0.4rem;
}

.live-search-group > strong {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.live-search-item {
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    display: grid;
    gap: 0.18rem;
    padding: 0.65rem;
    text-decoration: none;
}

.live-search-item:hover,
.live-search-item.is-active {
    background: #f3f7fd;
    border-color: #d7e2f1;
}

.live-search-item strong,
.live-search-item small,
.live-search-item span {
    display: block;
}

.live-search-item small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.live-search-item span,
.live-search-empty {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.live-search-footer {
    border-top: 1px solid var(--line);
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 900;
    padding-top: 0.65rem;
}

.quick-select {
    display: grid;
    gap: 0.35rem;
    grid-template-columns: minmax(0, 1fr) 36px;
}

.quick-select select {
    min-width: 0;
}

.quick-select-add {
    align-items: center;
    background: #eef6ff;
    border: 1px solid #c7dbff;
    color: var(--accent);
    display: inline-flex;
    font-size: 1rem;
    justify-content: center;
    min-height: 42px;
    padding: 0;
}

.quick-select-add:hover {
    background: #dceafe;
    color: var(--accent-strong);
}

.date-chip {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    padding: 0.75rem 0.9rem;
}

.notice {
    background: #e8f7ef;
    border: 1px solid #a9dfbf;
    border-radius: 8px;
    color: #05603a;
    font-weight: 800;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
}

.notice.warning {
    background: #fff7e6;
    border-color: #ffd38a;
    color: #93370d;
}

[data-theme="dark"] .notice {
    background: #0f2a1d;
    border-color: #1d5236;
    color: #6ee7b7;
}

[data-theme="dark"] .notice.warning {
    background: #2a1d0a;
    border-color: #5c4317;
    color: #fcd34d;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .notice {
        background: #0f2a1d;
        border-color: #1d5236;
        color: #6ee7b7;
    }

    html:not([data-theme="light"]) .notice.warning {
        background: #2a1d0a;
        border-color: #5c4317;
        color: #fcd34d;
    }
}

.quick-capture {
    border-left: 4px solid var(--accent);
}

.quick-capture textarea {
    border: 0;
    font-size: 1rem;
    min-height: 88px;
    padding: 0.25rem;
    resize: vertical;
}

.filter-panel {
    box-shadow: none;
}

.filter-row {
    align-items: end;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto auto;
}

.filter-row button,
.filter-row .ghost-button {
    min-height: 42px;
    padding: 0.65rem 0.85rem;
}

.quick-actions {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 150px 1fr 1fr auto;
    margin-top: 0.75rem;
}

.quick-actions select {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    width: 100%;
}

.page-heading {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.15rem;
}

.page-heading h1 {
    color: var(--ink);
    font-size: clamp(1.8rem, 3vw, 2.65rem);
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

.breadcrumbs {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.86rem;
    font-weight: 800;
    gap: 0.45rem;
    line-height: 1.4;
    margin: 0 0 1rem;
    overflow: visible;
}

.breadcrumbs a {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
    display: inline-flex;
    min-height: 28px;
    padding: 0.28rem 0.55rem;
}

.breadcrumbs a:hover {
    background: #eef6ff;
}

.breadcrumbs span {
    background: var(--surface-soft);
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    min-height: 28px;
    padding: 0.28rem 0.55rem;
}

.breadcrumbs a::after {
    color: var(--muted);
    content: "/";
    margin-left: 0.55rem;
    margin-right: -0.2rem;
}

.eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 0.35rem;
    text-transform: uppercase;
}

.panel,
.stat-card,
.project-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    transition: background var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.stat-card:hover,
.project-card:hover {
    box-shadow: var(--elevation-2);
    transform: translateY(-2px);
}

.panel {
    margin-bottom: 1rem;
    padding: 1.05rem;
}

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

.panel-header h2 {
    font-size: 1rem;
    margin: 0;
}

.panel-header a,
.panel-header span {
    color: var(--muted);
    font-size: 0.9rem;
}

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

.form-row.primary {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr auto;
}

details {
    margin-top: 0.85rem;
}

summary {
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.form-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 1rem;
}

.note-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
}

.project-grid {
    grid-template-columns: 1.5fr 1fr 1fr 120px;
}

.area-grid {
    grid-template-columns: 1fr 1fr 120px 140px 120px;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 0.85rem;
    font-weight: 700;
    gap: 0.35rem;
}

.full {
    margin-top: 0.85rem;
}

.stats-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.stat-card {
    padding: 1rem;
}

.stat-card span {
    color: var(--muted);
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
    margin-top: 0.45rem;
}

.stat-card.danger strong {
    color: var(--danger);
}

.content-grid,
.focus-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
}

.workspace-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-column {
    min-height: 260px;
}

.cockpit-heading span {
    color: var(--muted);
    display: block;
    font-weight: 700;
    margin-top: 0.35rem;
}

.heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.cockpit-decision,
.today-command {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.5fr) minmax(220px, 0.7fr);
    margin-bottom: 1rem;
}

.decision-card {
    background:
        linear-gradient(135deg, #0f172a, #1d3a5f);
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    color: #fff;
    display: grid;
    gap: 0.35rem;
    min-height: 150px;
    padding: 1rem;
    transition: box-shadow var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.decision-card:hover {
    box-shadow: var(--elevation-2);
    transform: translateY(-2px);
}

.today-flow {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.today-flow article {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(217, 225, 236, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 0.2rem;
    padding: 0.95rem;
}

.today-flow span,
.today-flow small {
    color: var(--muted);
    font-weight: 800;
}

.today-flow strong {
    color: var(--ink);
    font-size: 1.9rem;
    line-height: 1;
}

.decision-card span,
.decision-card small {
    color: #c7d2e4;
    font-weight: 800;
}

.decision-card strong {
    font-size: clamp(1.35rem, 2.4vw, 2.05rem);
    line-height: 1.05;
}

.decision-card .small-link {
    align-self: end;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    justify-self: start;
}

.compact-danger {
    background: linear-gradient(135deg, #7f1d1d, #b42318);
}

.compact-info {
    background: linear-gradient(135deg, #123b3a, #146c64);
}

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

.today-stack {
    display: grid;
    gap: 0.55rem;
}

.today-step {
    align-items: center;
    background: #fff;
    border: 1px solid rgba(217, 225, 236, 0.9);
    border-radius: 8px;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 18px minmax(0, 1fr);
    padding: 0.7rem;
}

.today-step:hover {
    border-color: color-mix(in srgb, var(--task-color, var(--accent)) 42%, var(--line));
    box-shadow: var(--shadow-soft);
}

.today-step-marker {
    background: var(--task-color, var(--accent));
    border-radius: 999px;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--task-color, var(--accent)) 14%, var(--surface));
    height: 10px;
    width: 10px;
}

.today-step strong,
.today-step small {
    display: block;
}

.today-step small {
    color: var(--muted);
    margin-top: 0.18rem;
}

.cockpit-span-2 {
    grid-column: span 2;
}

.actionable-row {
    color: inherit;
}

.task-list,
.compact-list,
.cards-grid {
    display: grid;
    gap: 0.75rem;
}

.task-item {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: auto 1fr auto;
    padding: 0.75rem;
}

.tasks-workspace {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1rem;
}

.task-detail-workspace {
    display: grid;
    gap: 1rem;
}

.task-detail-form {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.task-detail-main {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), #fff 180px),
        radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--task-color, var(--accent)) 12%, transparent), transparent 32%);
    border: 1px solid rgba(217, 225, 236, 0.9);
    border-left: 5px solid var(--task-color, var(--accent));
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: visible;
    padding: clamp(1rem, 3vw, 2rem);
}

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

.task-title-input {
    font-size: clamp(1.9rem, 3.2vw, 3rem);
}

.task-path-strip {
    margin-top: 0;
}

.task-detail-statusline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.85rem 0 1rem;
}

.task-detail-statusline span {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.35rem 0.55rem;
}

.task-action-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.task-action-strip button {
    background: #eef6ff;
    border: 1px solid #c7dbff;
    color: var(--accent);
    padding: 0.6rem 0.8rem;
}

.task-action-strip button:hover {
    background: #dceafe;
    color: var(--accent-strong);
}

[data-theme="dark"] .task-action-strip button {
    background: var(--accent-soft);
    border-color: var(--line);
}

[data-theme="dark"] .task-action-strip button:hover {
    background: color-mix(in srgb, var(--accent) 28%, var(--accent-soft));
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .task-action-strip button {
        background: var(--accent-soft);
        border-color: var(--line);
    }

    html:not([data-theme="light"]) .task-action-strip button:hover {
        background: color-mix(in srgb, var(--accent) 28%, var(--accent-soft));
    }
}

.context-link-card {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-left: 4px solid var(--task-color, var(--accent));
    border-radius: 8px;
    display: grid;
    gap: 0.2rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
}

.context-link-card span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.context-link-card a {
    color: var(--accent);
    font-weight: 900;
}

.task-description-block > span {
    color: var(--muted);
    display: block;
    font-size: 0.82rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.task-detail-side {
    display: grid;
    gap: 0.85rem;
    min-width: 0;
    position: sticky;
    top: 1.25rem;
}

.task-side-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(16, 24, 40, 0.06);
    display: grid;
    gap: 0.7rem;
    padding: 0.9rem;
}

.task-side-card h2 {
    font-size: 0.92rem;
    margin: 0;
}

.task-side-card label {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.task-side-card select,
.task-side-card input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 42px;
    padding: 0.7rem 0.75rem;
    width: 100%;
}

.danger-zone {
    border-color: #f4b5ad;
}

.task-board {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(5, minmax(240px, 1fr));
    overflow-x: auto;
    padding-bottom: 0.35rem;
}

.project-task-board,
.area-task-board {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.task-column {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 340px;
    padding: 0.75rem;
}

.task-column.is-drop-target {
    background: #eef6ff;
    border-color: var(--accent);
}

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

.task-column h3 {
    font-size: 0.95rem;
    margin: 0;
}

.task-column header span {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    padding: 0.2rem 0.45rem;
}

.task-card-list {
    display: grid;
    gap: 0.65rem;
}

.task-card {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--task-color, var(--accent));
    border-radius: 8px;
    padding: 0.75rem;
}

.task-card.is-dragging {
    opacity: 0.55;
}

.task-card-top {
    align-items: start;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: auto 1fr;
}

.task-card p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0.55rem 0 0;
}

.task-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.task-card-meta span {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    padding: 0.25rem 0.4rem;
}

.task-card-actions {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    margin-top: 0.75rem;
}

.task-column-empty {
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 8px;
    margin: 0;
    padding: 0.75rem;
}

.planning-rhythm {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.planning-rhythm article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1rem;
}

.planning-card-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.planning-card-head strong,
.planning-card-head span {
    display: block;
}

.planning-card-head span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    margin-top: 0.15rem;
}

.planning-card-head b {
    align-items: center;
    background: var(--surface-soft);
    border-radius: 999px;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    min-width: 34px;
    padding: 0 0.55rem;
}

.planning-list {
    display: grid;
    gap: 0.45rem;
}

.planning-list a {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    font-size: 0.9rem;
    font-weight: 800;
    gap: 0.15rem;
    padding: 0.6rem;
}

.planning-list .planning-item {
    align-items: center;
    grid-template-columns: auto 1fr;
}

.planning-list a:hover {
    border-color: #b9c8df;
}

.planning-list small {
    color: var(--muted);
    font-weight: 700;
}

.task-item strong,
.task-item small,
.compact-list strong,
.compact-list small {
    display: block;
}

.task-item small,
.compact-list small,
.project-card p {
    color: var(--muted);
    margin-top: 0.2rem;
}

.color-dot {
    background: var(--task-color, var(--accent));
    border-radius: 999px;
    height: 12px;
    width: 12px;
}

.status-pill {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0.35rem 0.55rem;
}

.compact-list article,
.project-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem;
}

.list-line {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.small-link {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 800;
}

.row-actions {
    align-items: center;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
}

.row-actions form {
    margin: 0;
}

.utility-form {
    display: none;
}

.text-danger {
    background: transparent;
    border: 0;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 800;
    min-height: auto;
    padding: 0;
}

.text-danger:hover {
    background: transparent;
    color: #7a271a;
    text-decoration: underline;
}

.text-muted-action {
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    min-height: auto;
    padding: 0;
}

.text-muted-action:hover {
    background: transparent;
    color: var(--accent);
    text-decoration: underline;
}

.note-editor {
    line-height: 1.5;
    min-height: 260px;
    resize: vertical;
}

.notes-workspace {
    display: grid;
    align-items: start;
    gap: 1.1rem;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.document-workspace {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), #ffffff 170px),
        radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.07), transparent 30%),
        radial-gradient(circle at 92% 14%, rgba(35, 116, 91, 0.08), transparent 28%);
    border: 1px solid rgba(139, 154, 176, 0.24);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(16, 24, 40, 0.09);
    min-height: calc(100vh - 2.5rem);
    overflow: hidden;
    padding: clamp(1rem, 2.4vw, 1.6rem) clamp(1rem, 3.8vw, 3rem) clamp(2rem, 5vw, 4rem);
    min-width: 0;
}

.document-top {
    align-items: start;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 0.8rem;
    min-width: 0;
}

.document-top > div:first-child {
    min-width: 0;
    width: 100%;
}

.document-title {
    background: transparent;
    border: 0;
    color: #111827;
    font-size: clamp(1.95rem, 3.4vw, 3.05rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.08;
    max-width: 100%;
    min-width: 0;
    outline: 0;
    padding: 0;
    width: 100%;
    word-break: break-word;
}

.document-title::placeholder {
    color: #b4bdca;
}

.document-title-textarea {
    display: block;
    min-height: 2.35em;
    overflow: hidden;
    resize: none;
}

.document-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    min-width: 0;
    order: -1;
    width: 100%;
}

.autosave-status {
    align-items: center;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(217, 225, 236, 0.78);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    min-height: 34px;
    padding: 0.35rem 0.7rem;
    white-space: nowrap;
}

.autosave-status[data-state="saving"],
.autosave-status[data-state="pending"] {
    color: #8a5a00;
}

.autosave-status[data-state="saved"] {
    color: #23745b;
}

.autosave-status[data-state="error"] {
    color: var(--danger);
}

.ghost-button.secondary {
    background: var(--surface-soft);
    color: var(--text);
}

.document-meta {
    background: rgba(248, 250, 252, 0.72);
    border: 1px solid rgba(217, 225, 236, 0.82);
    border-radius: 8px;
    margin: 1rem 0 1.2rem;
    padding: 0.8rem 0.9rem;
}

.document-meta summary {
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 800;
}

.document-meta .form-grid {
    margin-bottom: 0.25rem;
}

.notes-rail {
    align-self: start;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(217, 225, 236, 0.9);
    border-radius: 8px;
    box-shadow: 0 16px 45px rgba(16, 24, 40, 0.06);
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
    padding: 0.85rem;
    position: sticky;
    top: 1.25rem;
    min-width: 0;
}

.notes-rail .panel-header {
    align-items: flex-start;
    margin-bottom: 0.7rem;
}

.notes-rail .panel-header h2 {
    margin-bottom: 0.15rem;
}

.rail-switch {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    gap: 0.15rem;
    padding: 0.2rem;
}

.rail-switch a {
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    padding: 0.28rem 0.45rem;
}

.rail-switch a.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 5px 14px rgba(16, 24, 40, 0.08);
}

.notes-rail .compact-list {
    gap: 0.55rem;
}

.notes-rail .compact-list article {
    background: #fff;
    border-color: rgba(217, 225, 236, 0.85);
    display: grid;
    gap: 0.65rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.notes-rail .compact-list article:hover {
    border-color: rgba(37, 99, 235, 0.38);
    box-shadow: 0 10px 26px rgba(16, 24, 40, 0.07);
    transform: translateY(-1px);
}

.notes-rail article.is-current {
    border-color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent), 0 12px 28px rgba(37, 99, 235, 0.09);
}

.note-card-link {
    color: var(--text);
    display: grid;
    gap: 0.25rem;
    text-decoration: none;
}

.note-card-link strong {
    font-size: 0.96rem;
    line-height: 1.25;
}

.note-card-link small {
    line-height: 1.45;
}

.note-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.note-card-meta span {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
    padding: 0.25rem 0.45rem;
}

.notes-rail .row-actions {
    border-top: 1px solid rgba(217, 225, 236, 0.75);
    justify-content: flex-start;
    padding-top: 0.55rem;
}

.rich-source {
    display: none;
}

.rich-editor-shell {
    background: transparent;
    border: 0;
    border-radius: 8px;
    overflow: visible;
    position: relative;
}

.rich-toolbar {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 1rem;
    padding: 0.5rem;
    position: sticky;
    top: 1rem;
    z-index: 2;
}

.rich-toolbar button,
.rich-toolbar select,
.rich-color-picker {
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 800;
    min-height: 34px;
    padding: 0.35rem 0.55rem;
}

.rich-color-picker {
    cursor: pointer;
    padding: 0.2rem;
    width: 40px;
}

.rich-toolbar button {
    min-width: 36px;
}

.rich-toolbar button:hover {
    background: #eaf1fb;
    border-color: #cdd9ea;
}

.secret-pending {
    background: color-mix(in srgb, var(--warning) 25%, transparent);
    border-radius: 4px;
    padding: 0 0.15rem;
}

.secret-encrypted {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.1rem 0.5rem;
}

.secret-mask {
    font-family: monospace;
    letter-spacing: 0.15em;
}

.secret-reveal {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
}

.secret-reveal:hover {
    color: var(--accent);
}

.rich-page {
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(180deg, rgba(37, 99, 235, 0.14), rgba(35, 116, 91, 0.08)) border-box;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    cursor: text;
    font-size: 1.04rem;
    line-height: 1.68;
    min-height: 62vh;
    outline: none;
    padding: clamp(1.25rem, 4vw, 3.2rem);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.rich-page:empty::before {
    color: var(--muted);
    content: attr(data-placeholder);
}

.rich-page h1,
.rich-page h2,
.rich-page h3 {
    color: #101828;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 1.1em 0 0.35em;
}

.rich-page h1 {
    font-size: 2rem;
}

.rich-page h2 {
    font-size: 1.5rem;
}

.rich-page h3 {
    font-size: 1.18rem;
}

.rich-page blockquote {
    background: #f8fafc;
    border-left: 4px solid #23745b;
    border-radius: 0 8px 8px 0;
    color: #475467;
    margin-left: 0;
    padding: 0.75rem 1rem;
}

.rich-page table {
    border-collapse: collapse;
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
    margin: 1rem 0;
    width: 100%;
}

.rich-page table td,
.rich-page table th {
    border: 1px solid var(--line);
    min-width: 80px;
    padding: 0.55rem;
}

.rich-page table tr:first-child td {
    background: #f3f6fb;
    font-weight: 800;
}

.rich-page img {
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(16, 24, 40, 0.12);
    display: block;
    height: auto;
    margin: 1rem 0;
    max-width: 100%;
}

.rich-page figure {
    margin: 1.2rem 0;
}

.rich-page figure img {
    margin: 0;
}

.rich-page figcaption {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.45rem;
}

.rich-page .embedded-file-card {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: grid;
    gap: 0.2rem;
    margin: 0.8rem 0;
    padding: 0.85rem 1rem;
    text-decoration: none;
}

.rich-page .embedded-file-card::before {
    color: var(--accent);
    content: "Arquivo anexado";
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.rich-page .embedded-file-card strong,
.rich-page .embedded-file-card span {
    display: block;
}

.rich-page .embedded-file-card span {
    color: var(--muted);
    font-size: 0.86rem;
}

.rich-page .editor-callout {
    background: linear-gradient(135deg, #eef6ff, #f7fbff);
    border: 1px solid #cfe0ff;
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    margin: 1rem 0;
    padding: 0.9rem 1rem;
}

.rich-page .editor-callout strong {
    color: var(--accent-strong);
    display: block;
    margin-bottom: 0.25rem;
}

.rich-page .editor-columns {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 1rem 0;
}

.rich-page .editor-columns > div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 110px;
    padding: 0.85rem;
}

.rich-page pre {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    color: #dbeafe;
    margin: 1rem 0;
}

.rich-page input[type="checkbox"] {
    accent-color: var(--accent);
    margin-right: 0.45rem;
    transform: translateY(1px);
}

.rich-page a {
    color: var(--accent);
    text-decoration: underline;
}

.rich-page p {
    min-height: 1.6em;
    margin: 0.45rem 0;
}

.rich-page ul,
.rich-page ol {
    padding-left: 1.35rem;
}

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

.search-results-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-form {
    margin-top: 0.85rem;
}

.danger-button {
    background: var(--danger);
    padding: 0.55rem 0.75rem;
}

.danger-button.subtle-danger {
    background: #fff1f0;
    border: 1px solid #f4b5ad;
    color: var(--danger);
}

.danger-button.subtle-danger:hover {
    background: #ffe4e0;
}

.danger-button:hover {
    background: #7a271a;
}

.cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card h3 {
    font-size: 1rem;
    margin: 0;
}

.project-card p {
    margin-bottom: 0;
}

.project-card-head {
    align-items: center;
    display: grid;
    gap: 0.6rem;
    grid-template-columns: auto 1fr auto;
}

.project-card-head .color-dot {
    background: var(--project-color, var(--accent));
}

.project-meta {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.82rem;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.project-meta span {
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 0.25rem 0.45rem;
}

.subarea-prefix {
    color: var(--muted);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.area-tree {
    display: grid;
    gap: 0.75rem;
}

.area-node {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.area-node summary {
    align-items: center;
    cursor: pointer;
    display: grid;
    gap: 0.7rem;
    grid-template-columns: auto auto 1fr auto;
    list-style: none;
    padding: 0.9rem;
}

.area-node summary::-webkit-details-marker {
    display: none;
}

.area-node-title strong,
.area-node-title small {
    display: block;
}

.area-node-title small {
    color: var(--muted);
    margin-top: 0.18rem;
}

.tree-toggle {
    border-color: transparent transparent transparent var(--muted);
    border-style: solid;
    border-width: 5px 0 5px 7px;
    height: 0;
    transition: transform 0.16s ease;
    width: 0;
}

.area-node[open] > summary .tree-toggle {
    transform: rotate(90deg);
}

.area-node-body {
    border-top: 1px solid var(--line);
    padding: 0 0.9rem 0.9rem 2.2rem;
}

.subarea-list {
    border-left: 1px solid var(--line);
    display: grid;
    gap: 0.7rem;
    margin-top: 0.85rem;
    padding-left: 1rem;
}

.subarea-list .area-node {
    background: rgba(248, 250, 252, 0.78);
}

.subarea-list .area-node summary {
    padding: 0.75rem;
}

.subarea-list .area-node-body {
    padding-left: 1.6rem;
}

.subarea-node {
    align-items: start;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0.65rem;
    grid-template-columns: auto auto 1fr;
    padding: 0.75rem;
    position: relative;
}

.tree-branch {
    border-top: 1px solid var(--line);
    height: 1px;
    margin-left: -1rem;
    margin-top: 0.45rem;
    width: 1rem;
}

.tree-empty {
    margin-bottom: 0;
    margin-top: 0.85rem;
}

.area-hub {
    display: grid;
    gap: 1rem;
}

.area-hub-hero {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), #fff 72%),
        radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--area-color, var(--accent)) 14%, transparent), transparent 34%);
    border: 1px solid var(--line);
    border-left: 5px solid var(--area-color, var(--accent));
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: clamp(1rem, 3vw, 2rem);
}

.area-hub-metrics {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 1rem 0;
}

.area-hub-metrics article {
    background: rgba(248, 250, 252, 0.86);
    border: 1px solid rgba(217, 225, 236, 0.9);
    border-radius: 8px;
    display: grid;
    gap: 0.3rem;
    padding: 0.8rem;
}

.area-hub-metrics strong {
    color: #101828;
    font-size: 1.55rem;
    line-height: 1;
}

.area-path-strip {
    align-items: center;
    background: rgba(248, 250, 252, 0.78);
    border: 1px solid rgba(217, 225, 236, 0.86);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.5rem 0 1rem;
    padding: 0.6rem;
}

.area-path-strip a {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 850;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
}

.area-path-strip .color-dot {
    background: var(--area-color, var(--task-color, var(--accent)));
}

.area-hub-metrics span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.area-relationship-strip,
.note-relationship-strip {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 1rem;
}

.area-relationship-strip article,
.note-relationship-strip article {
    background: #f8fafc;
    border: 1px solid rgba(217, 225, 236, 0.92);
    border-radius: 8px;
    display: grid;
    gap: 0.22rem;
    min-width: 0;
    padding: 0.75rem;
}

.area-relationship-strip span,
.note-relationship-strip span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.area-relationship-strip strong,
.note-relationship-strip strong {
    color: var(--text);
    font-size: 0.94rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.area-quick-grid,
.area-hub-grid {
    display: grid;
    gap: 1rem;
}

.area-quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.area-hub-grid {
    align-items: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.area-wide-panel {
    grid-column: 1 / -1;
}

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

.activity-list {
    display: grid;
    gap: 0.7rem;
}

.activity-list article {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0.7rem;
    grid-template-columns: auto 1fr;
    padding: 0.7rem;
}

.activity-list strong,
.activity-list small {
    display: block;
}

.activity-list small {
    color: var(--muted);
    margin-top: 0.15rem;
}

.projects-overview {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 260px;
    margin-bottom: 1rem;
}

.project-create-card,
.projects-summary-card,
.projects-board {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1rem;
}

.projects-summary-card {
    align-content: center;
    display: grid;
    gap: 0.35rem;
}

.projects-summary-card strong {
    font-size: 3rem;
    line-height: 1;
}

.projects-summary-card span {
    font-weight: 900;
}

.projects-summary-card small {
    color: var(--muted);
    line-height: 1.4;
}

.section-title-row {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title-row h2 {
    font-size: 1.05rem;
    margin: 0;
}

.section-title-row span {
    color: var(--muted);
    font-size: 0.9rem;
}

.project-card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card h3 small {
    color: var(--muted);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.project-card-large {
    border-top: 4px solid var(--project-color, var(--accent));
    display: grid;
    gap: 0.75rem;
    min-height: 180px;
}

.project-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.85rem 0 1rem;
}

.project-hero-meta span {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
    padding: 0.35rem 0.55rem;
}

.project-hub-overview {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1.45fr repeat(4, minmax(100px, 0.7fr));
    margin: 1rem 0;
}

.project-hub-overview article {
    background: rgba(248, 250, 252, 0.86);
    border: 1px solid rgba(217, 225, 236, 0.9);
    border-radius: 8px;
    display: grid;
    gap: 0.35rem;
    min-height: 92px;
    padding: 0.85rem;
}

.project-hub-overview strong {
    color: #101828;
    font-size: 1.75rem;
    line-height: 1;
}

.project-hub-overview span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.progress-track {
    background: #e8eef7;
    border-radius: 999px;
    height: 9px;
    overflow: hidden;
}

.progress-track span {
    background: var(--project-color, var(--accent));
    border-radius: inherit;
    display: block;
    height: 100%;
}

.project-settings {
    border-bottom: 1px solid var(--line);
    border-top: 1px solid var(--line);
    margin: 1rem 0;
    padding: 0.75rem 0;
}

.project-settings summary {
    color: var(--muted);
    font-size: 0.9rem;
}

.project-settings .project-context-row {
    margin-bottom: 0.25rem;
}

.system-map {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.system-map div {
    border-left: 3px solid var(--accent);
    padding-left: 0.75rem;
}

.system-map strong,
.system-map span {
    display: block;
}

.project-workspace {
    display: grid;
    gap: 1rem;
}

.project-hero {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 5px solid var(--project-color, var(--accent));
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: clamp(1rem, 3vw, 2rem);
}

.project-hub-hero {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), #fff 72%),
        radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--project-color, var(--accent)) 12%, transparent), transparent 34%);
    overflow: visible;
}

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

.project-title-input {
    font-size: clamp(1.9rem, 3.2vw, 3rem);
}

.project-context-row {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: 1fr 1fr 120px;
    margin: 1rem 0;
}

.project-context-row select,
.project-context-row input,
.project-description,
.mini-create input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 42px;
    padding: 0.75rem 0.85rem;
    width: 100%;
}

.project-description {
    line-height: 1.5;
    resize: vertical;
}

.project-sections {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.project-hub-grid {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
}

.project-focus-panel,
.project-context-panel,
.project-files-panel,
.project-tasks-panel,
.project-notes-panel {
    min-width: 0;
}

.project-tasks-panel {
    grid-column: 1;
}

.project-notes-panel {
    grid-column: 2;
    grid-row: span 2;
}

.focus-task {
    align-items: start;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--task-color, var(--accent));
    border-radius: 8px;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: auto 1fr auto;
    margin-bottom: 0.85rem;
    padding: 0.9rem;
}

.focus-task strong,
.focus-task small {
    display: block;
}

.focus-task small {
    color: var(--muted);
    margin-top: 0.25rem;
}

.attachment-panel {
    background: rgba(248, 250, 252, 0.82);
    border: 1px solid rgba(217, 225, 236, 0.92);
    border-radius: 8px;
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
    padding: 1rem;
}

.related-panel {
    background:
        linear-gradient(135deg, rgba(232, 241, 255, 0.9), rgba(255, 255, 255, 0.94));
    border: 1px solid rgba(199, 219, 255, 0.92);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 0.85rem;
    margin: 1rem 0;
    padding: 1rem;
}

.related-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.related-grid article {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(217, 225, 236, 0.82);
    border-radius: 8px;
    display: grid;
    gap: 0.45rem;
    min-height: 120px;
    padding: 0.75rem;
}

.related-grid article > strong {
    color: var(--accent-strong);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.related-grid a {
    border-radius: 8px;
    display: grid;
    gap: 0.1rem;
    padding: 0.45rem;
}

.related-grid a:hover {
    background: var(--accent-soft);
}

.related-grid span,
.related-grid small,
.related-grid p {
    display: block;
}

.related-grid small,
.related-grid p {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0;
}

.file-upload-row {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.file-upload-row select,
.file-upload-row input[type="file"] {
    min-width: 0;
}

.file-upload-row input[type="file"] {
    background: #fff;
    border: 1px dashed #c8d3e3;
    border-radius: 8px;
    color: var(--muted);
    min-height: 42px;
    padding: 0.6rem;
    width: 100%;
}

.file-library-link-row {
    border-top: 1px solid rgba(217, 225, 236, 0.82);
    padding-top: 0.75rem;
}

.attachment-list {
    display: grid;
    gap: 0.65rem;
}

.attachment-item {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    padding: 0.65rem;
}

.attachment-item strong,
.attachment-item small {
    display: block;
}

.attachment-item small {
    color: var(--muted);
    margin-top: 0.18rem;
}

.attachment-thumb,
.attachment-icon {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    display: flex;
    font-size: 0.72rem;
    font-weight: 900;
    height: 54px;
    justify-content: center;
    overflow: hidden;
    text-align: center;
    width: 54px;
}

.attachment-thumb img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.attachment-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

.time-total-card {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--task-color, var(--accent)) 12%, var(--surface)), var(--surface));
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0.2rem;
    padding: 0.85rem;
}

.time-total-card span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.time-total-card strong {
    color: var(--text);
    font-size: 1.45rem;
    line-height: 1.1;
}

.project-context-cards {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-context-cards span {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    display: grid;
    font-size: 0.8rem;
    gap: 0.2rem;
    padding: 0.75rem;
}

.project-context-cards strong {
    color: var(--text);
    font-size: 0.95rem;
}

.mini-create {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: 1fr auto;
    margin-bottom: 1rem;
}

.system-map span {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 0.85rem;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

td small {
    color: var(--muted);
    display: block;
    margin-top: 0.25rem;
}

.row-color {
    border-radius: 999px;
    display: inline-block;
    height: 10px;
    margin-right: 0.4rem;
    width: 10px;
}

.small-button {
    font-size: 0.85rem;
    padding: 0.5rem 0.65rem;
}

.done-label,
.empty {
    color: var(--muted);
}

.is-complete {
    opacity: 0.55;
}

.setup-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1rem;
}

.setup-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 760px;
    padding: 1.25rem;
    width: 100%;
}

.setup-card h1 {
    margin-top: 0;
}

.login-card {
    max-width: 380px;
}

.login-form {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.login-form label {
    color: var(--muted);
    display: grid;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 0.35rem;
}

.login-form input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 42px;
    padding: 0.75rem 0.85rem;
}

.login-form button {
    margin-top: 0.4rem;
    min-height: 44px;
}

.timer-panel {
    align-self: start;
}

.timer-panel form,
.focus-target-grid {
    display: grid;
    gap: 0.9rem;
}

.focus-target-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timer-panel label {
    color: var(--muted);
    display: grid;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 0.35rem;
}

.timer {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    margin: 1.5rem 0;
    text-align: center;
}

.focus-elapsed {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    margin: -0.9rem 0 0.2rem;
    text-align: center;
}

.focus-elapsed strong {
    color: var(--text);
}

.timer-actions {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, 1fr);
}

.focus-session-list {
    display: grid;
    gap: 0.75rem;
}

.focus-session-list article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem;
}

.focus-session-list article > div {
    align-items: center;
    display: grid;
    gap: 0.65rem;
    grid-template-columns: auto 1fr;
}

.focus-session-list strong,
.focus-session-list small {
    display: block;
}

.focus-session-list small {
    color: var(--muted);
}

.focus-session-list b {
    color: var(--accent);
    font-size: 1.35rem;
}

.focus-suggestions {
    grid-column: 1 / -1;
}

.slash-command-menu {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(16, 24, 40, 0.16);
    display: grid;
    gap: 0.25rem;
    left: clamp(1rem, 4vw, 3rem);
    max-width: 280px;
    padding: 0.4rem;
    position: absolute;
    top: 78px;
    z-index: 12;
}

.slash-command-menu[hidden] {
    display: none;
}

.slash-command-menu button {
    background: transparent;
    color: var(--text);
    display: grid;
    gap: 0.12rem;
    justify-items: start;
    padding: 0.55rem 0.65rem;
    text-align: left;
}

.slash-command-menu button:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.slash-command-menu span {
    color: var(--muted);
    font-size: 0.78rem;
}

.agenda-grid,
.files-grid {
    display: grid;
    gap: 1rem;
}

.agenda-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.agenda-day {
    min-height: 180px;
}

.files-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.file-library-panel {
    margin-bottom: 1rem;
}

.file-library-upload {
    align-items: end;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(190px, 1fr) minmax(220px, 1.2fr) auto;
}

.file-library-upload label {
    color: var(--muted);
    display: grid;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 0.35rem;
}

.file-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.75rem;
    overflow: hidden;
    padding: 0.75rem;
}

.file-card[hidden] {
    display: none;
}

.file-card-thumb,
.file-card-icon {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    display: flex;
    font-weight: 900;
    justify-content: center;
    min-height: 120px;
    overflow: hidden;
}

.file-card-icon {
    color: var(--accent-strong);
    font-size: 1.25rem;
    letter-spacing: 0;
}

.file-card-thumb img {
    display: block;
    height: 160px;
    object-fit: cover;
    width: 100%;
}

.file-card strong,
.file-card small,
.file-card span {
    display: block;
}

.file-type-pill {
    background: var(--accent-soft);
    border: 1px solid #c7dbff;
    border-radius: 999px;
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 900;
    justify-self: start;
    margin-bottom: 0.35rem;
    padding: 0.2rem 0.45rem;
    width: fit-content;
}

.file-card small,
.file-card span {
    color: var(--muted);
    font-size: 0.84rem;
    margin-top: 0.2rem;
}

.file-card-link-form {
    border-top: 1px solid rgba(217, 225, 236, 0.82);
    display: grid;
    gap: 0.5rem;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-top: 0.65rem;
}

.file-card-link-form select {
    min-width: 0;
}

.file-card-link-form button,
.file-delete-button {
    min-height: 38px;
    padding: 0.55rem 0.75rem;
}

.file-delete-button {
    background: #fff1f0;
    border: 1px solid #fecdca;
    color: var(--danger);
    width: 100%;
}

.file-delete-button:hover {
    background: #fee4e2;
    color: var(--danger);
}

.mobile-nav-toggle {
    display: none;
}

.mobile-nav-backdrop {
    display: none;
}

@media (max-width: 980px) {
    .mobile-nav-toggle {
        align-items: center;
        background: #111827;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: var(--radius-sm);
        color: #fff;
        display: flex;
        height: 42px;
        justify-content: center;
        left: 1rem;
        position: fixed;
        top: 1rem;
        width: 42px;
        z-index: 31;
    }

    .mobile-nav-backdrop {
        background: rgba(8, 17, 31, 0.55);
        inset: 0;
        opacity: 0;
        pointer-events: none;
        position: fixed;
        transition: opacity var(--duration-base) var(--ease-out);
        z-index: 25;
    }

    html.mobile-nav-open .mobile-nav-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        height: 100vh;
        inset: 0 auto 0 0;
        max-width: 85vw;
        position: fixed;
        transform: translateX(-100%);
        transition: transform var(--duration-base) var(--ease-out);
        width: 288px;
    }

    html.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    html.sidebar-auto .sidebar {
        box-shadow: none;
        overflow-x: visible;
        padding: 1.25rem;
        width: 288px;
    }

    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .brand span:not(.brand-mark),
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .sidebar-metrics,
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .nav,
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .sidebar-section,
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) [data-sidebar-toggle-label] {
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
    }

    html.mobile-nav-open .sidebar {
        padding-top: 4.5rem;
    }

    .shell {
        margin-left: 0;
        padding-top: 4.5rem;
    }

    [data-sidebar-toggle] {
        display: none;
    }

    .form-grid,
    .quick-actions,
    .filter-row,
    .file-library-upload,
    .stats-grid,
    .agenda-grid,
    .today-command,
    .today-flow,
    .cockpit-decision,
    .cockpit-grid,
    .related-grid,
    .rich-page .editor-columns,
    .workspace-grid,
    .system-map,
    .planning-rhythm,
    .task-detail-form,
    .task-detail-hero,
    .area-hub-metrics,
    .area-relationship-strip,
    .note-relationship-strip,
    .area-quick-grid,
    .area-hub-grid,
    .review-grid,
    .project-sections,
    .project-hub-grid,
    .project-hub-overview,
    .project-context-row,
    .projects-overview,
    .project-card-grid,
    .search-results-grid,
    .content-grid,
    .focus-layout,
    .focus-target-grid,
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .cockpit-span-2 {
        grid-column: auto;
    }

    .notes-rail {
        max-height: none;
        position: static;
    }
}

@media (min-width: 701px) and (max-width: 980px) {
    .sidebar {
        position: fixed;
        width: 288px;
    }

    .shell {
        margin-left: 288px;
    }

    .nav {
        grid-template-columns: 1fr;
    }

    .notes-workspace {
        gap: 0.85rem;
        grid-template-columns: minmax(0, 1fr) minmax(172px, 210px);
    }

    .task-detail-form {
        gap: 0.85rem;
        grid-template-columns: minmax(0, 1fr) minmax(200px, 230px);
    }

    .notes-rail {
        grid-column: 2;
        grid-row: 1;
        max-height: calc(100vh - 2.5rem);
        position: sticky;
    }

    .document-workspace {
        grid-column: 1;
        grid-row: 1;
    }

    .document-workspace {
        padding: 1rem;
    }

    .document-top {
        grid-template-columns: 1fr;
    }

    .task-detail-hero {
        grid-template-columns: 1fr;
    }

    .document-actions {
        justify-content: flex-start;
    }

    .document-actions button,
    .document-actions .ghost-button {
        padding: 0.55rem 0.68rem;
    }

    .autosave-status {
        order: -1;
        width: 100%;
    }

    .rich-page {
        padding: 1.25rem;
    }
}

@media (max-width: 640px) {
    .shell {
        padding: 1rem;
        padding-top: 4.5rem;
    }

    .sidebar {
        padding: 1rem;
    }

    .topbar,
    .page-heading,
    .document-top,
    .project-hero-top {
        align-items: stretch;
        flex-direction: column;
    }

    .project-hero-top {
        grid-template-columns: 1fr;
    }

    .mini-create {
        grid-template-columns: 1fr;
    }

    .form-row.primary,
    .timer-actions {
        grid-template-columns: 1fr;
    }

    .timer {
        font-size: 3rem;
    }

    .document-top {
        grid-template-columns: 1fr;
    }

    .document-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    html.sidebar-auto .sidebar {
        box-shadow: none;
        overflow-x: visible;
        padding: 1rem;
        position: static;
        width: auto;
    }

    html.sidebar-auto .shell {
        margin-left: 0;
    }

    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .brand span:not(.brand-mark),
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .sidebar-metrics,
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .nav,
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) .sidebar-section,
    html.sidebar-auto .sidebar:not(:hover):not(:focus-within) [data-sidebar-toggle-label] {
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
    }

    .notes-workspace {
        grid-template-columns: 1fr;
    }

    .notes-rail {
        max-height: none;
        position: static;
    }
}

/* === Modernizacao: toasts, dialogo de confirmacao, painel deslizante === */

.toast-stack {
    display: grid;
    gap: var(--space-2);
    max-width: min(360px, calc(100vw - 2rem));
    position: fixed;
    right: var(--space-5);
    top: var(--space-5);
    z-index: 80;
}

.toast {
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: var(--elevation-2);
    color: var(--text);
    display: flex;
    font-size: 0.88rem;
    font-weight: 700;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    animation: toast-in var(--duration-base) var(--ease-out);
}

.toast.is-leaving {
    animation: toast-out var(--duration-base) var(--ease-out) forwards;
}

.toast span {
    flex: 1;
}

.toast button {
    background: transparent;
    color: var(--muted);
    font-weight: 900;
    min-height: auto;
    padding: 0;
}

.toast button:hover {
    background: transparent;
    color: var(--text);
}

.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-danger { border-left-color: var(--danger); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

@keyframes toast-out {
    from { opacity: 1; transform: none; }
    to { opacity: 0; transform: translateX(12px); }
}

.confirm-dialog {
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-md);
    box-shadow: var(--elevation-3);
    color: var(--text);
    max-width: min(380px, calc(100vw - 2.5rem));
    padding: var(--space-5);
}

.confirm-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.confirm-dialog p {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 var(--space-4);
}

.confirm-dialog-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

.task-panel-backdrop {
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity var(--duration-base) var(--ease-out);
    z-index: 39;
}

.task-panel {
    background: var(--surface);
    bottom: 0;
    box-shadow: var(--elevation-3);
    max-width: 92vw;
    overflow-y: auto;
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(100%);
    transition: transform var(--duration-base) var(--ease-out);
    width: 560px;
    z-index: 40;
}

body.task-panel-open .task-panel-backdrop {
    opacity: 1;
    pointer-events: auto;
}

body.task-panel-open .task-panel {
    transform: translateX(0);
}

.task-panel:empty {
    box-shadow: none;
}

.task-panel-close {
    background: var(--surface-soft);
    border-radius: var(--radius-pill);
    color: var(--muted);
    font-weight: 900;
    height: 36px;
    min-height: auto;
    padding: 0;
    width: 36px;
}

.task-panel-close:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.task-panel .task-detail-workspace {
    padding: 0 1.5rem 2rem;
}

.task-panel .task-panel-header {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin: 0 -1.5rem 1rem;
    padding: 1.1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.task-panel .task-panel-header .breadcrumbs {
    flex-wrap: wrap;
    min-width: 0;
}

.task-panel .task-panel-close {
    flex-shrink: 0;
}

.task-panel .task-detail-form {
    grid-template-columns: 1fr;
}

.task-panel .task-title-input {
    font-size: 1.6rem;
}

.task-panel .task-detail-side {
    position: static;
    top: auto;
}

.task-panel .related-grid {
    grid-template-columns: 1fr;
}

.task-panel .related-grid a,
.task-panel .related-grid small,
.task-panel .related-grid p {
    overflow-wrap: anywhere;
}

.task-card {
    transition: box-shadow var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), opacity var(--duration-base) var(--ease-out);
}

.task-card:hover {
    box-shadow: var(--elevation-2);
    transform: translateY(-2px);
}

.task-card.htmx-swapping {
    opacity: 0;
    transform: scale(0.96);
}

.task-card.htmx-added {
    animation: task-card-in var(--duration-base) var(--ease-out);
}

@keyframes task-card-in {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.status-pill[style*="--pill-color"] {
    background: color-mix(in srgb, var(--pill-color) 16%, var(--surface));
    color: color-mix(in srgb, var(--pill-color) 65%, var(--ink));
}

[data-task-panel].htmx-request {
    opacity: 0.7;
}

.task-column {
    border-top: 3px solid var(--column-accent, var(--line));
}

.task-card-meta span:first-child {
    background: color-mix(in srgb, var(--task-color, var(--accent)) 14%, var(--surface-soft));
    color: color-mix(in srgb, var(--task-color, var(--accent)) 70%, var(--ink));
    font-weight: 800;
}

.task-column-empty {
    color: var(--muted);
    text-align: center;
}

@media (max-width: 700px) {
    .task-panel {
        width: 100vw;
    }

    .toast-stack {
        left: var(--space-4);
        right: var(--space-4);
    }

    .task-panel-close {
        height: 44px;
        width: 44px;
    }

    .task-card-actions {
        flex-wrap: wrap;
    }

    .task-card-actions .small-link,
    .task-card-actions .small-button,
    .task-card-actions .text-danger {
        min-height: 40px;
        align-items: center;
        display: inline-flex;
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }

    .row-actions {
        gap: 0.9rem;
    }

    .task-action-strip button {
        min-height: 44px;
    }

    .task-board {
        gap: 0.65rem;
        grid-auto-columns: 86vw;
        grid-auto-flow: column;
        grid-template-columns: none;
        scroll-snap-type: x mandatory;
    }

    .task-column {
        scroll-snap-align: start;
    }
}

/* === Modo escuro: ajustes de superficie/texto para componentes que ainda fixavam cor clara === */

[data-theme="dark"] .form-grid select,
[data-theme="dark"] textarea,
[data-theme="dark"] .timer-panel input,
[data-theme="dark"] .timer-panel select,
[data-theme="dark"] .live-search-panel,
[data-theme="dark"] .topbar,
[data-theme="dark"] .search input,
[data-theme="dark"] .date-chip,
[data-theme="dark"] .breadcrumbs a,
[data-theme="dark"] .today-flow article,
[data-theme="dark"] .today-step,
[data-theme="dark"] .task-side-card,
[data-theme="dark"] .task-side-card select,
[data-theme="dark"] .task-side-card input,
[data-theme="dark"] .task-card,
[data-theme="dark"] .task-column-empty,
[data-theme="dark"] .planning-rhythm article,
[data-theme="dark"] .autosave-status,
[data-theme="dark"] .notes-rail,
[data-theme="dark"] .rail-switch a.active,
[data-theme="dark"] .notes-rail .compact-list article,
[data-theme="dark"] .area-path-strip a,
[data-theme="dark"] .project-hero,
[data-theme="dark"] .project-context-row select,
[data-theme="dark"] .project-context-row input,
[data-theme="dark"] .project-description,
[data-theme="dark"] .mini-create input,
[data-theme="dark"] .focus-task,
[data-theme="dark"] .related-grid article,
[data-theme="dark"] .file-upload-row input[type="file"],
[data-theme="dark"] .attachment-item,
[data-theme="dark"] .focus-session-list article,
[data-theme="dark"] .slash-command-menu,
[data-theme="dark"] .file-card,
[data-theme="dark"] .rich-page {
    background: var(--surface);
    border-color: var(--line);
}

[data-theme="dark"] .search input {
    box-shadow: none;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .search input {
        box-shadow: none;
    }

    html:not([data-theme="light"]) .form-grid select,
    html:not([data-theme="light"]) textarea,
    html:not([data-theme="light"]) .timer-panel input,
    html:not([data-theme="light"]) .timer-panel select,
    html:not([data-theme="light"]) .live-search-panel,
    html:not([data-theme="light"]) .topbar,
    html:not([data-theme="light"]) .search input,
    html:not([data-theme="light"]) .date-chip,
    html:not([data-theme="light"]) .breadcrumbs a,
    html:not([data-theme="light"]) .today-flow article,
    html:not([data-theme="light"]) .today-step,
    html:not([data-theme="light"]) .task-side-card,
    html:not([data-theme="light"]) .task-side-card select,
    html:not([data-theme="light"]) .task-side-card input,
    html:not([data-theme="light"]) .task-card,
    html:not([data-theme="light"]) .task-column-empty,
    html:not([data-theme="light"]) .planning-rhythm article,
    html:not([data-theme="light"]) .autosave-status,
    html:not([data-theme="light"]) .notes-rail,
    html:not([data-theme="light"]) .rail-switch a.active,
    html:not([data-theme="light"]) .notes-rail .compact-list article,
    html:not([data-theme="light"]) .area-path-strip a,
    html:not([data-theme="light"]) .project-hero,
    html:not([data-theme="light"]) .project-context-row select,
    html:not([data-theme="light"]) .project-context-row input,
    html:not([data-theme="light"]) .project-description,
    html:not([data-theme="light"]) .mini-create input,
    html:not([data-theme="light"]) .focus-task,
    html:not([data-theme="light"]) .related-grid article,
    html:not([data-theme="light"]) .file-upload-row input[type="file"],
    html:not([data-theme="light"]) .attachment-item,
    html:not([data-theme="light"]) .focus-session-list article,
    html:not([data-theme="light"]) .slash-command-menu,
    html:not([data-theme="light"]) .file-card,
    html:not([data-theme="light"]) .rich-page {
        background: var(--surface);
        border-color: var(--line);
    }
}

[data-theme="dark"] .task-detail-main {
    background:
        linear-gradient(180deg, var(--surface-soft), var(--surface) 180px),
        radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--task-color, var(--accent)) 16%, transparent), transparent 32%);
    border-color: var(--line);
}

[data-theme="dark"] .document-workspace {
    background:
        linear-gradient(180deg, var(--surface-soft), var(--surface) 170px),
        radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.16), transparent 30%),
        radial-gradient(circle at 92% 14%, rgba(35, 116, 91, 0.18), transparent 28%);
    border-color: var(--line);
}

[data-theme="dark"] .area-hub-hero {
    background:
        linear-gradient(180deg, var(--surface-soft), var(--surface) 72%),
        radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--area-color, var(--accent)) 18%, transparent), transparent 34%);
    border-color: var(--line);
}

[data-theme="dark"] .project-hero {
    background: var(--surface);
}

[data-theme="dark"] .project-hub-hero {
    background:
        linear-gradient(180deg, var(--surface-soft), var(--surface) 72%),
        radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--project-color, var(--accent)) 16%, transparent), transparent 34%);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .task-detail-main {
        background:
            linear-gradient(180deg, var(--surface-soft), var(--surface) 180px),
            radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--task-color, var(--accent)) 16%, transparent), transparent 32%);
        border-color: var(--line);
    }

    html:not([data-theme="light"]) .document-workspace {
        background:
            linear-gradient(180deg, var(--surface-soft), var(--surface) 170px),
            radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.16), transparent 30%),
            radial-gradient(circle at 92% 14%, rgba(35, 116, 91, 0.18), transparent 28%);
        border-color: var(--line);
    }

    html:not([data-theme="light"]) .area-hub-hero {
        background:
            linear-gradient(180deg, var(--surface-soft), var(--surface) 72%),
            radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--area-color, var(--accent)) 18%, transparent), transparent 34%);
        border-color: var(--line);
    }

    html:not([data-theme="light"]) .project-hero {
        background: var(--surface);
    }

    html:not([data-theme="light"]) .project-hub-hero {
        background:
            linear-gradient(180deg, var(--surface-soft), var(--surface) 72%),
            radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--project-color, var(--accent)) 16%, transparent), transparent 34%);
    }
}

[data-theme="dark"] .document-title,
[data-theme="dark"] .form-grid select,
[data-theme="dark"] textarea,
[data-theme="dark"] .timer-panel input,
[data-theme="dark"] .timer-panel select {
    color: var(--text);
}

[data-theme="dark"] .document-title::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--muted);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .document-title,
    html:not([data-theme="light"]) .form-grid select,
    html:not([data-theme="light"]) textarea,
    html:not([data-theme="light"]) .timer-panel input,
    html:not([data-theme="light"]) .timer-panel select {
        color: var(--text);
    }

    html:not([data-theme="light"]) .document-title::placeholder,
    html:not([data-theme="light"]) textarea::placeholder {
        color: var(--muted);
    }
}

[data-theme="dark"] .context-link-card,
[data-theme="dark"] .task-column,
[data-theme="dark"] .document-meta,
[data-theme="dark"] .rich-toolbar button,
[data-theme="dark"] .rich-toolbar select,
[data-theme="dark"] .rich-color-picker,
[data-theme="dark"] .rich-page blockquote,
[data-theme="dark"] .rich-page .embedded-file-card,
[data-theme="dark"] .rich-page .editor-columns > div,
[data-theme="dark"] .subarea-list .area-node,
[data-theme="dark"] .area-hub-metrics article,
[data-theme="dark"] .area-path-strip,
[data-theme="dark"] .area-relationship-strip article,
[data-theme="dark"] .note-relationship-strip article,
[data-theme="dark"] .project-hub-overview article,
[data-theme="dark"] .attachment-panel {
    background: var(--surface-soft);
    border-color: var(--line);
}

[data-theme="dark"] .rich-toolbar button:hover {
    background: var(--accent-soft);
    border-color: var(--line);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .context-link-card,
    html:not([data-theme="light"]) .task-column,
    html:not([data-theme="light"]) .document-meta,
    html:not([data-theme="light"]) .rich-toolbar button,
    html:not([data-theme="light"]) .rich-toolbar select,
    html:not([data-theme="light"]) .rich-color-picker,
    html:not([data-theme="light"]) .rich-page blockquote,
    html:not([data-theme="light"]) .rich-page .embedded-file-card,
    html:not([data-theme="light"]) .rich-page .editor-columns > div,
    html:not([data-theme="light"]) .subarea-list .area-node,
    html:not([data-theme="light"]) .area-hub-metrics article,
    html:not([data-theme="light"]) .area-path-strip,
    html:not([data-theme="light"]) .area-relationship-strip article,
    html:not([data-theme="light"]) .note-relationship-strip article,
    html:not([data-theme="light"]) .project-hub-overview article,
    html:not([data-theme="light"]) .attachment-panel {
        background: var(--surface-soft);
        border-color: var(--line);
    }

    html:not([data-theme="light"]) .rich-toolbar button:hover {
        background: var(--accent-soft);
        border-color: var(--line);
    }
}
