.app-shell {
    display: flex;
    height: 100dvh;
    overflow: hidden;
    background-color: var(--md-sys-color-background);
}

.nav-drawer {
    width: var(--sidebar-width);
    background-color: var(--md-sys-color-surface-container-low);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100dvh;
    overflow: hidden;
    transition: transform var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized),
                width var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
    position: relative;
    z-index: 10;
}

.nav-drawer.collapsed { width: 80px; }

.nav-drawer-header {
    display: flex;
    align-items: center;
    padding: 16px 16px 8px;
    gap: 8px;
    min-height: 64px;
}

.nav-drawer-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
    border-radius: var(--md-sys-shape-corner-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-primary);
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.nav-drawer-wordmark {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--md-sys-motion-duration-short4);
}

.nav-drawer.collapsed .nav-drawer-wordmark { opacity: 0; width: 0; }

.nav-drawer-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--md-sys-color-outline-variant) transparent;
}

.nav-drawer-content::-webkit-scrollbar { width: 4px; }
.nav-drawer-content::-webkit-scrollbar-track { background: transparent; }
.nav-drawer-content::-webkit-scrollbar-thumb { background: var(--md-sys-color-outline-variant); border-radius: 2px; }

.nav-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    padding: 12px 4px 4px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-drawer.collapsed .nav-section-label { opacity: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    border-radius: var(--md-sys-shape-corner-full);
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    transition: background-color var(--md-sys-motion-duration-short3);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 4px;
    text-decoration: none;
}

.nav-item:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); text-decoration: none; }
.nav-item:active { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); }

.nav-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-weight: 600;
}

.nav-item .nav-icon { font-size: 24px; flex-shrink: 0; }
.nav-item .nav-label { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; }
.nav-drawer.collapsed .nav-label { opacity: 0; width: 0; }

.nav-drawer-footer {
    padding: 8px 12px 16px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.workspace-group { margin-bottom: 8px; }

.workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    color: var(--md-sys-color-on-surface);
    font-size: 0.8125rem;
    font-weight: 600;
    gap: 8px;
}

.workspace-header:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }

.workspace-icon { font-size: 18px; color: var(--md-sys-color-primary); }
.workspace-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-chevron { font-size: 18px; transition: transform var(--md-sys-motion-duration-short4); color: var(--md-sys-color-on-surface-variant); }
.workspace-group.open .workspace-chevron { transform: rotate(90deg); }

.tree-children { padding-left: 12px; }

.tree-item { position: relative; }

.tree-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    transition: background-color var(--md-sys-motion-duration-short3);
    min-height: 32px;
    position: relative;
}

.tree-node:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); color: var(--md-sys-color-on-surface); }
.tree-node.active { background-color: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

.node-icon { font-size: 16px; flex-shrink: 0; }
.node-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-expand { font-size: 16px; color: var(--md-sys-color-on-surface-variant); transition: transform var(--md-sys-motion-duration-short4); }
.tree-item.expanded > .tree-node .tree-expand { transform: rotate(90deg); }

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.top-app-bar {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 64px;
    gap: 8px;
    background-color: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    flex-shrink: 0;
    z-index: 5;
}

.top-app-bar-title {
    font-size: 1.375rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-full);
    padding: 0 16px;
    height: 48px;
    gap: 8px;
    flex: 1;
    max-width: 480px;
    cursor: text;
    transition: background-color var(--md-sys-motion-duration-short3);
}

.search-bar:hover { background-color: var(--md-sys-color-surface-container-highest); }
.search-bar input { background: none; border: none; outline: none; font-family: var(--font-ui); font-size: 1rem; color: var(--md-sys-color-on-surface); flex: 1; width: 100%; }
.search-bar input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.search-bar .material-symbols-rounded { color: var(--md-sys-color-on-surface-variant); }

.avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
    background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
    color: var(--md-sys-color-on-primary);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--md-sys-color-outline-variant) transparent;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--md-sys-shape-corner-medium);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card-value { font-size: 2rem; font-weight: 700; color: var(--md-sys-color-on-surface); line-height: 1; }
.stat-card-label { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); margin-top: 4px; }

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.note-card {
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 16px;
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short3), box-shadow var(--md-sys-motion-duration-short3);
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.note-card:hover { background-color: var(--md-sys-color-surface-container-high); box-shadow: var(--md-sys-elevation-level1); border-color: var(--md-sys-color-outline-variant); }
.note-card-icon { font-size: 20px; color: var(--md-sys-color-primary); }
.note-card-title { font-size: 0.875rem; font-weight: 500; color: var(--md-sys-color-on-surface); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.note-card-meta { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); display: flex; align-items: center; gap: 4px; }

.heatmap-container {
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 20px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.heatmap-grid { display: flex; gap: 3px; }
.heatmap-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background-color: var(--md-sys-color-surface-container-high);
}
.heatmap-cell[data-level="1"] { background-color: color-mix(in srgb, var(--md-sys-color-primary) 30%, transparent); }
.heatmap-cell[data-level="2"] { background-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, transparent); }
.heatmap-cell[data-level="3"] { background-color: color-mix(in srgb, var(--md-sys-color-primary) 80%, transparent); }
.heatmap-cell[data-level="4"] { background-color: var(--md-sys-color-primary); }

.omni-search-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: scrim-in var(--md-sys-motion-duration-short4) linear;
}

.omni-search-panel {
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-extra-large);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--md-sys-elevation-level5);
    overflow: hidden;
    animation: dialog-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}

.omni-search-input-row {
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.omni-search-input-row input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-ui);
    font-size: 1.125rem;
    color: var(--md-sys-color-on-surface);
    padding: 20px 0;
}

.omni-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}

.omni-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    color: var(--md-sys-color-on-surface);
    transition: background-color var(--md-sys-motion-duration-short3);
}

.omni-result-item:hover, .omni-result-item.selected { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.omni-result-item .material-symbols-rounded { color: var(--md-sys-color-primary); }
.omni-result-title { font-weight: 500; }
.omni-result-type { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }

.context-menu {
    position: fixed;
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--md-sys-elevation-level3);
    padding: 8px 0;
    z-index: 200;
    min-width: 180px;
    animation: dialog-in var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short3);
}

.context-menu-item:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.context-menu-item.danger { color: var(--md-sys-color-error); }
.context-menu-divider { height: 1px; background-color: var(--md-sys-color-outline-variant); margin: 4px 0; }

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background-color: var(--md-sys-color-surface-container);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    z-index: 10;
}

.bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0 16px;
    border: none;
    background: none;
    font-family: var(--font-ui);
}

.bottom-nav-item.active { color: var(--md-sys-color-on-secondary-container); }

.bottom-nav-indicator {
    background-color: transparent;
    border-radius: var(--md-sys-shape-corner-full);
    padding: 4px 20px;
    min-width: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--md-sys-motion-duration-short3);
}

.bottom-nav-item.active .bottom-nav-indicator { background-color: var(--md-sys-color-secondary-container); }

.drawer-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9;
}

.install-banner {
    position: fixed;
    bottom: 88px;
    left: 16px;
    right: 16px;
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--md-sys-elevation-level3);
    z-index: 20;
    animation: snackbar-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard-decelerate);
}

@media (max-width: 599px) {
    .nav-drawer { display: none; }
    .nav-drawer.mobile-open { display: flex; position: fixed; inset: 0 auto 0 0; z-index: 10; animation: slide-in-left var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized); }
    .bottom-nav { display: flex; }
    .drawer-scrim.visible { display: block; }
    .page-content { padding-bottom: 96px; }

    @keyframes slide-in-left {
        from { transform: translateX(-100%); }
        to { transform: translateX(0); }
    }
}

@media (min-width: 600px) and (max-width: 1199px) {
    .nav-drawer { width: 80px; }
    .nav-drawer.expanded { width: var(--sidebar-width); }
    .nav-label, .nav-drawer-wordmark, .nav-section-label { display: none; }
    .nav-drawer.expanded .nav-label, .nav-drawer.expanded .nav-drawer-wordmark, .nav-drawer.expanded .nav-section-label { display: block; }
}

@media (min-width: 1200px) {
    .nav-drawer { width: var(--sidebar-width); }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: scrim-in var(--md-sys-motion-duration-medium2) linear;
}

.modal-sheet {
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 85dvh;
    overflow-y: auto;
    box-shadow: var(--md-sys-elevation-level3);
    animation: dialog-in var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
}

.modal-sheet.wide { max-width: 900px; }
.modal-sheet.fullscreen { max-width: 100%; max-height: 100dvh; border-radius: 0; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title { font-size: 1.375rem; font-weight: 500; color: var(--md-sys-color-on-surface); }

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0;
    padding: 24px;
    z-index: 50;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: var(--md-sys-elevation-level5);
    animation: sheet-up var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
}

@keyframes sheet-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.handle-bar {
    width: 32px;
    height: 4px;
    background-color: var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-full);
    margin: 0 auto 20px;
}

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], textarea, select {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small) 0 0;
    padding: 12px 16px;
    font-family: var(--font-ui);
    font-size: 1rem;
    width: 100%;
    outline: none;
    transition: border-color var(--md-sys-motion-duration-short4);
}

input:focus, textarea:focus { border-bottom: 2px solid var(--md-sys-color-primary); }

textarea { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--md-sys-color-on-surface-variant); margin-bottom: 4px; }

.list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short3);
    color: var(--md-sys-color-on-surface);
}

.list-item:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.list-item-leading { color: var(--md-sys-color-on-surface-variant); flex-shrink: 0; }
.list-item-content { flex: 1; min-width: 0; }
.list-item-headline { font-size: 1rem; }
.list-item-support { font-size: 0.875rem; color: var(--md-sys-color-on-surface-variant); }
.list-item-trailing { color: var(--md-sys-color-on-surface-variant); }

.divider { height: 1px; background-color: var(--md-sys-color-outline-variant); margin: 8px 0; }

.quick-capture-area {
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.quick-capture-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
    resize: none;
    min-height: 48px;
    max-height: 200px;
    line-height: 1.5;
    border-radius: 0;
    padding: 8px 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.quick-capture-input:focus { border-bottom-color: var(--md-sys-color-primary); }
.quick-capture-input::placeholder { color: var(--md-sys-color-on-surface-variant); }

.tag-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: var(--md-sys-shape-corner-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color var(--md-sys-motion-duration-short3), transform var(--md-sys-motion-duration-short3);
}

.color-swatch:hover, .color-swatch.selected { border-color: var(--md-sys-color-on-surface); transform: scale(1.15); }

.nav-drawer-toggle-btn {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: var(--md-sys-shape-corner-full);
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 11;
    box-shadow: var(--md-sys-elevation-level1);
}

.properties-panel {
    width: 320px;
    background-color: var(--md-sys-color-surface-container-low);
    border-left: 1px solid var(--md-sys-color-outline-variant);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
}

.properties-panel.hidden { width: 0; overflow: hidden; border: none; }

.prop-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.prop-key { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); font-weight: 500; min-width: 80px; padding-top: 4px; }
.prop-value { flex: 1; font-size: 0.875rem; color: var(--md-sys-color-on-surface); }
.prop-value input, .prop-value select { background: none; border: none; outline: none; font-family: var(--font-ui); font-size: 0.875rem; color: var(--md-sys-color-on-surface); width: 100%; padding: 4px 0; border-bottom: 1px solid transparent; }
.prop-value input:focus, .prop-value select:focus { border-bottom-color: var(--md-sys-color-primary); }

.relation-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    margin: 2px;
}

.relation-type-label { font-size: 0.6875rem; opacity: 0.7; }

.md3-tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 11px;
    font-size: .6875rem;
    font-weight: 500;
    background: color-mix(in srgb, var(--tag-color, var(--md-sys-color-primary)) 15%, transparent);
    color: var(--tag-color, var(--md-sys-color-primary));
    border: 1px solid color-mix(in srgb, var(--tag-color, var(--md-sys-color-primary)) 35%, transparent);
}

.progress-bar-wrap {
    height: 6px;
    background: var(--md-sys-color-surface-container-highest);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--md-sys-color-primary);
    border-radius: 3px;
    transition: width .4s var(--md-sys-motion-easing-standard);
}

.time-tracker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8125rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-full);
    padding: 4px 12px;
    cursor: pointer;
}
.time-tracker.running { color: var(--md-sys-color-primary); background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent); }
.time-tracker .material-symbols-rounded { font-size: 16px; }

.toggle-list-item {
    list-style: none;
}
.toggle-list-trigger {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    padding: 2px 0;
}
.toggle-list-trigger .toggle-arrow {
    flex-shrink: 0;
    font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
    transition: transform .15s;
    margin-top: 2px;
}
.toggle-list-item.open > .toggle-list-trigger .toggle-arrow { transform: rotate(90deg); }
.toggle-list-body { padding-left: 22px; display: none; }
.toggle-list-item.open > .toggle-list-body { display: block; }

.inline-comment {
    border-left: 3px solid var(--md-sys-color-tertiary);
    background: color-mix(in srgb, var(--md-sys-color-tertiary) 6%, transparent);
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: .875rem;
}
.inline-comment-author { font-weight: 600; font-size: .75rem; color: var(--md-sys-color-tertiary); margin-bottom: 4px; }

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-large);
    box-shadow: var(--md-sys-elevation-level3);
    z-index: 200;
    overflow: hidden;
}
.user-menu-header {
    padding: 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.user-menu-name { font-weight: 600; color: var(--md-sys-color-on-surface); }
.user-menu-email { font-size: .8125rem; color: var(--md-sys-color-on-surface-variant); margin-top: 2px; }

.storage-bar { padding: 0 4px; }
.storage-label { display: flex; justify-content: space-between; font-size: .75rem; color: var(--md-sys-color-on-surface-variant); margin-bottom: 6px; }

.switch { position: relative; display: inline-block; width: 52px; height: 32px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
    position: absolute; inset: 0;
    background: var(--md-sys-color-surface-container-highest);
    border-radius: 16px;
    border: 2px solid var(--md-sys-color-outline);
    transition: background .2s, border-color .2s;
    cursor: pointer;
}
.switch-track::after {
    content: '';
    position: absolute;
    left: 4px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    background: var(--md-sys-color-outline);
    border-radius: 50%;
    transition: transform .2s, width .2s, height .2s, background .2s;
}
.switch input:checked + .switch-track { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
.switch input:checked + .switch-track::after { transform: translateX(20px) translateY(-50%); background: var(--md-sys-color-on-primary); width: 24px; height: 24px; left: 2px; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.settings-card { background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-corner-large); padding: 20px; }
.settings-card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 16px; font-size: .9375rem; }

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--md-sys-color-surface-container-low);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    z-index: 20;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner { display: flex; justify-content: space-around; padding: 4px 0; }
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 16px; min-width: 64px;
    background: none; border: none; cursor: pointer; font-family: var(--font-ui);
    font-size: .625rem; font-weight: 500; color: var(--md-sys-color-on-surface-variant);
    border-radius: var(--md-sys-shape-corner-small);
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--md-sys-color-on-secondary-container); }
.bottom-nav-indicator {
    width: 64px; height: 32px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.bottom-nav-item.active .bottom-nav-indicator { background: var(--md-sys-color-secondary-container); }
.bottom-nav-item .material-symbols-rounded { font-size: 22px; }

.drawer-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 9;
}
.drawer-scrim.visible { display: block; }

@media (max-width: 599px) {
    .nav-drawer {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        z-index: 10;
        transition: transform var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
    }
    .nav-drawer.mobile-open { transform: translateX(0); }
    .bottom-nav { display: block; }
    #menuToggleBtn { display: flex !important; }
    .md3-fab { bottom: 88px; right: 16px; }
    .page-content { padding: 16px; padding-bottom: 100px; }
    .md3-snackbar-container { bottom: 88px; }
    .recent-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .modal-sheet { padding: 20px 16px; border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0; align-self: flex-end; max-height: 92dvh; }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .top-app-bar { padding: 0 8px; }
    .search-bar { max-width: none; }
}

@media (min-width: 600px) and (max-width: 1023px) {
    .nav-drawer {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 72px;
        z-index: 10;
        transition: width var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
    }
    .nav-drawer.tablet-expanded { width: var(--sidebar-width); }
    .nav-drawer.mobile-open { width: var(--sidebar-width); }
    .nav-label, .nav-drawer-wordmark, .nav-section-label { opacity: 0; width: 0; overflow: hidden; transition: opacity .2s, width .2s; white-space: nowrap; }
    .nav-drawer.tablet-expanded .nav-label,
    .nav-drawer.tablet-expanded .nav-drawer-wordmark,
    .nav-drawer.tablet-expanded .nav-section-label,
    .nav-drawer.mobile-open .nav-label,
    .nav-drawer.mobile-open .nav-drawer-wordmark,
    .nav-drawer.mobile-open .nav-section-label { opacity: 1; width: auto; }
    .main-content { margin-left: 72px; }
    .nav-drawer.tablet-expanded ~ .main-content,
    .nav-drawer.mobile-open ~ .main-content { margin-left: var(--sidebar-width); }
    .bottom-nav { display: block; }
    .md3-fab { bottom: 88px; }
    #menuToggleBtn { display: flex !important; }
    .nav-item { justify-content: center; padding: 0 8px; }
    .nav-drawer.tablet-expanded .nav-item,
    .nav-drawer.mobile-open .nav-item { justify-content: flex-start; padding: 0 16px; }
    .nav-drawer-content { padding: 8px 4px; }
    .nav-drawer.tablet-expanded .nav-drawer-content,
    .nav-drawer.mobile-open .nav-drawer-content { padding: 8px 12px; }
    .recent-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .md3-snackbar-container { bottom: 88px; }
    .page-content { padding-bottom: 100px; }
}

@media (min-width: 1024px) {
    .nav-drawer { position: relative; transform: none !important; width: var(--sidebar-width) !important; }
    .main-content { margin-left: 0 !important; }
    .bottom-nav { display: none; }
    .md3-fab { bottom: 24px; }
}

@media (hover: none) and (pointer: coarse) {
    .nav-item { min-height: 48px; }
    .md3-btn { min-height: 44px; }
    .md3-btn-icon { width: 44px; height: 44px; }
    .list-item { min-height: 48px; }
    .tree-node { min-height: 40px; }
    .heatmap-cell { width: 14px; height: 14px; }
    input, textarea, select { font-size: 16px; }
}

@media (min-width: 600px) and (max-width: 1023px) and (orientation: landscape) {
    .bottom-nav { display: none; }
    .md3-fab { bottom: 24px; }
    .nav-drawer { width: 72px; }
    .main-content { margin-left: 72px; }
    .page-content { padding-bottom: 24px; }
}

/* ── Modal actions ─────────────────────────────────────── */
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    flex-wrap: wrap;
}

.modal-actions .spacer { flex: 1; }

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.form-row > * { flex: 1; }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    gap: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.empty-state .material-symbols-rounded {
    font-size: 48px;
    opacity: 0.4;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.empty-state-body {
    font-size: 0.875rem;
    max-width: 320px;
    line-height: 1.5;
}

/* ── Tooltip ───────────────────────────────────────────── */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
}

.tooltip-text {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    font-size: 0.75rem;
    line-height: 1.25rem;
    padding: 4px 8px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short3);
    z-index: 999;
}

.tooltip-wrapper:hover .tooltip-text { opacity: 1; }

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short3);
    z-index: 999;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Cover image ───────────────────────────────────────── */
.note-cover {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 0;
    flex-shrink: 0;
}

.note-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.note-cover-actions {
    position: absolute;
    bottom: 12px;
    right: 16px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short3);
}

.note-cover:hover .note-cover-actions { opacity: 1; }

.note-cover-btn {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    color: #fff;
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    padding: 6px 12px;
    font-size: 0.8125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    transition: background var(--md-sys-motion-duration-short3);
}

.note-cover-btn:hover { background: rgba(0,0,0,0.7); }

.note-cover-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-primary-container);
    font-size: 48px;
    flex-shrink: 0;
}

/* ── Focus mode ────────────────────────────────────────── */
.focus-mode .nav-drawer,
.focus-mode .top-app-bar,
.focus-mode .editor-toolbar,
.focus-mode .properties-panel {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--md-sys-motion-duration-medium2);
}

.focus-mode .main-content { margin-left: 0 !important; }

.focus-mode .editor-content-area {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 40px;
}

.focus-mode-exit {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short3);
}

.focus-mode:hover .focus-mode-exit { opacity: 1; }

/* ── Keyframe animations ───────────────────────────────── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse-scale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-in-right {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-in-up {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.spin { animation: spin 1s linear infinite; }

/* ── Loading states ────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
        var(--md-sys-color-surface-container) 25%,
        var(--md-sys-color-surface-container-high) 50%,
        var(--md-sys-color-surface-container) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--md-sys-shape-corner-small);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line { height: 16px; margin-bottom: 8px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-title { height: 24px; margin-bottom: 12px; width: 70%; }

/* ── Compact density ───────────────────────────────────── */
[data-density="compact"] .nav-item { min-height: 36px; padding: 0 12px; }
[data-density="compact"] .list-item { min-height: 40px; padding: 8px 16px; }
[data-density="compact"] .tree-node { min-height: 28px; padding: 2px 4px; }
[data-density="compact"] .md3-btn { height: 32px; padding: 0 16px; font-size: 0.8125rem; }
[data-density="compact"] .modal-sheet { padding: 16px; }
[data-density="compact"] .modal-actions { margin-top: 16px; padding-top: 12px; }
[data-density="compact"] .card { padding: 12px; }
[data-density="compact"] .settings-card { padding: 14px; }
[data-density="compact"] .page-content { padding: 12px; }
[data-density="compact"] .form-field { gap: 2px; }
[data-density="compact"] input, [data-density="compact"] textarea, [data-density="compact"] select { padding: 8px 12px; }

[data-density="comfortable"] .nav-item { min-height: 48px; }
[data-density="comfortable"] .list-item { min-height: 52px; }
[data-density="comfortable"] .md3-btn { height: 44px; }
[data-density="comfortable"] .modal-sheet { padding: 32px; }
[data-density="comfortable"] input, [data-density="comfortable"] textarea { padding: 14px 18px; }

/* ── Accent color overrides ────────────────────────────── */
[data-accent="blue"] {
    --md-sys-color-primary: #1a73e8;
    --md-sys-color-primary-container: #d3e3fd;
    --md-sys-color-on-primary: #fff;
    --md-sys-color-on-primary-container: #041e49;
}

[data-accent="green"] {
    --md-sys-color-primary: #1e8e3e;
    --md-sys-color-primary-container: #c8e6c9;
    --md-sys-color-on-primary: #fff;
    --md-sys-color-on-primary-container: #0a3318;
}

[data-accent="red"] {
    --md-sys-color-primary: #d93025;
    --md-sys-color-primary-container: #fce8e6;
    --md-sys-color-on-primary: #fff;
    --md-sys-color-on-primary-container: #410002;
}

[data-accent="orange"] {
    --md-sys-color-primary: #e8710a;
    --md-sys-color-primary-container: #fce8d5;
    --md-sys-color-on-primary: #fff;
    --md-sys-color-on-primary-container: #4a1e00;
}

[data-accent="purple"] {
    --md-sys-color-primary: #7c4dff;
    --md-sys-color-primary-container: #e8ddff;
    --md-sys-color-on-primary: #fff;
    --md-sys-color-on-primary-container: #210065;
}

[data-accent="pink"] {
    --md-sys-color-primary: #e91e8c;
    --md-sys-color-primary-container: #fde8f3;
    --md-sys-color-on-primary: #fff;
    --md-sys-color-on-primary-container: #4a0028;
}

[data-accent="teal"] {
    --md-sys-color-primary: #00796b;
    --md-sys-color-primary-container: #b2dfdb;
    --md-sys-color-on-primary: #fff;
    --md-sys-color-on-primary-container: #00201e;
}

/* ── Safe area / notch support ─────────────────────────── */
.top-app-bar {
    padding-top: env(safe-area-inset-top);
}

.nav-drawer {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
}

.bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
}

.md3-snackbar-container {
    margin-bottom: env(safe-area-inset-bottom);
}

@supports (padding: max(0px)) {
    .top-app-bar { padding-top: max(env(safe-area-inset-top), 0px); }
    .bottom-nav { padding-bottom: max(env(safe-area-inset-bottom), 0px); }
    .nav-drawer { padding-top: max(env(safe-area-inset-top), 0px); }
}

/* ── Print styles ──────────────────────────────────────── */
@media print {
    .nav-drawer,
    .top-app-bar,
    .bottom-nav,
    .md3-fab,
    .editor-toolbar,
    .properties-panel,
    .modal-overlay,
    .md3-snackbar-container,
    .context-menu,
    .install-banner,
    .notifications-panel { display: none !important; }

    .app-shell { display: block; height: auto; }
    .main-content { margin: 0 !important; height: auto !important; overflow: visible !important; }
    .page-content { padding: 0 !important; }

    .editor-content-wrapper {
        max-width: 100%;
        padding: 0;
    }

    #editorContent {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    a { color: inherit; text-decoration: underline; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }

    .page-break { break-before: page; }

    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ── Drag and drop indicators ──────────────────────────── */
.drag-over {
    outline: 2px dashed var(--md-sys-color-primary);
    outline-offset: 2px;
    background-color: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
    border-radius: var(--md-sys-shape-corner-small);
}

.drag-ghost {
    opacity: 0.5;
    transform: rotate(2deg);
}

.drop-zone-line {
    height: 2px;
    background-color: var(--md-sys-color-primary);
    border-radius: 1px;
    margin: 2px 8px;
    animation: fade-in 0.1s ease;
}

/* ── Selection states ──────────────────────────────────── */
.selectable { user-select: none; cursor: pointer; }
.selectable.selected {
    background-color: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
    outline: 2px solid color-mix(in srgb, var(--md-sys-color-primary) 60%, transparent);
    outline-offset: -2px;
    border-radius: var(--md-sys-shape-corner-small);
}

.selection-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    border-radius: var(--md-sys-shape-corner-full);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--md-sys-elevation-level3);
    z-index: 30;
    font-size: 0.875rem;
    animation: slide-in-up .2s var(--md-sys-motion-easing-emphasized);
}

/* ── Inline editing ────────────────────────────────────── */
.inline-edit {
    border: 1px solid transparent;
    border-radius: var(--md-sys-shape-corner-extra-small);
    padding: 2px 4px;
    transition: border-color var(--md-sys-motion-duration-short3), background var(--md-sys-motion-duration-short3);
    cursor: text;
    outline: none;
}

.inline-edit:hover {
    border-color: var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
}

.inline-edit:focus {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface);
    cursor: text;
}

/* ── Status badges ─────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge.todo { background: color-mix(in srgb, var(--md-sys-color-outline) 15%, transparent); color: var(--md-sys-color-on-surface-variant); }
.status-badge.in_progress { background: color-mix(in srgb, #f59e0b 20%, transparent); color: #92400e; }
.status-badge.in_review { background: color-mix(in srgb, #3b82f6 20%, transparent); color: #1e3a5f; }
.status-badge.done { background: color-mix(in srgb, #10b981 20%, transparent); color: #064e3b; }
.status-badge.blocked { background: color-mix(in srgb, var(--md-sys-color-error) 20%, transparent); color: var(--md-sys-color-error); }
.status-badge.cancelled { background: color-mix(in srgb, var(--md-sys-color-outline) 10%, transparent); color: var(--md-sys-color-on-surface-variant); text-decoration: line-through; }

[data-theme="dark"] .status-badge.in_progress { color: #fcd34d; }
[data-theme="dark"] .status-badge.in_review { color: #93c5fd; }
[data-theme="dark"] .status-badge.done { color: #6ee7b7; }

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.priority-badge.urgent { color: var(--md-sys-color-error); }
.priority-badge.high { color: #f59e0b; }
.priority-badge.medium { color: #3b82f6; }
.priority-badge.low { color: var(--md-sys-color-on-surface-variant); }

/* ── Split view ────────────────────────────────────────── */
.split-view {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.split-pane {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.split-divider {
    width: 4px;
    background-color: var(--md-sys-color-outline-variant);
    cursor: col-resize;
    flex-shrink: 0;
    transition: background-color var(--md-sys-motion-duration-short3);
}

.split-divider:hover,
.split-divider:active { background-color: var(--md-sys-color-primary); }

/* ── Scrollbar styling (global) ────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--md-sys-color-outline-variant) transparent;
}

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: 3px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--md-sys-color-outline); }

/* ── Progress bars ─────────────────────────────────────── */
.progress-bar-track {
    height: 4px;
    background-color: var(--md-sys-color-surface-container-highest);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--md-sys-color-primary);
    border-radius: 2px;
    transition: width var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}

.progress-bar-fill.success { background-color: #10b981; }
.progress-bar-fill.warning { background-color: #f59e0b; }
.progress-bar-fill.error { background-color: var(--md-sys-color-error); }

/* ── Chip group ────────────────────────────────────────── */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.md3-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-family: var(--font-ui);
    transition: background var(--md-sys-motion-duration-short3), color var(--md-sys-motion-duration-short3);
    -webkit-tap-highlight-color: transparent;
}

.md3-chip:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.md3-chip.selected {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

.md3-chip .material-symbols-rounded { font-size: 18px; }

/* ── File/attachment list ──────────────────────────────── */
.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-surface-container);
    cursor: pointer;
    transition: background var(--md-sys-motion-duration-short3);
}

.attachment-item:hover { background: var(--md-sys-color-surface-container-high); }

.attachment-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attachment-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-size {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    flex-shrink: 0;
}

/* ── Color picker swatches ─────────────────────────────── */
.color-swatch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: var(--md-sys-shape-corner-full);
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform var(--md-sys-motion-duration-short3), border-color var(--md-sys-motion-duration-short3);
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--md-sys-color-on-surface); transform: scale(1.1); }

/* ── Version history list ──────────────────────────────── */
.revision-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: background var(--md-sys-motion-duration-short3);
    border-radius: var(--md-sys-shape-corner-extra-small);
    padding-inline: 8px;
}

.revision-item:hover { background: var(--md-sys-color-surface-container); }
.revision-item:last-child { border-bottom: none; }

.revision-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    flex-shrink: 0;
}

.revision-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.revision-time { font-size: 0.875rem; font-weight: 500; color: var(--md-sys-color-on-surface); }
.revision-author { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }

/* ── Mention / tag chips inline ────────────────────────── */
.mention-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 15%, transparent);
    color: var(--md-sys-color-primary);
    border-radius: var(--md-sys-shape-corner-full);
    padding: 0 6px;
    font-size: 0.875em;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.mention-chip:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 25%, transparent); }

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

/* ── Notification badge ────────────────────────────────── */
.notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--md-sys-color-error);
    border: 1.5px solid var(--md-sys-color-surface-container-low);
}

.notif-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 1.5px solid var(--md-sys-color-surface-container-low);
}

/* ── Overlay close target ──────────────────────────────── */
.modal-overlay:focus-visible { outline: none; }
.modal-sheet:focus { outline: none; }
.modal-sheet [tabindex="-1"]:focus { outline: none; }

/* ── Ripple effect ─────────────────────────────────────── */
.ripple-host { position: relative; overflow: hidden; }

.ripple {
    position: absolute;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.12;
    transform: scale(0);
    animation: ripple-out 600ms linear;
    pointer-events: none;
}

@keyframes ripple-out {
    to { transform: scale(4); opacity: 0; }
}

/* ── Input row / icon-left inputs ──────────────────────── */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .material-symbols-rounded {
    position: absolute;
    left: 12px;
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
    font-size: 20px;
}

.input-with-icon input { padding-left: 44px; }

/* ── Divider ───────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: 8px 0;
}

.divider-vertical {
    width: 1px;
    background: var(--md-sys-color-outline-variant);
    align-self: stretch;
    margin: 0 4px;
}

/* ── Floating action button variants ──────────────────────*/
.md3-fab-small {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-medium);
}

.md3-fab-large {
    width: 96px;
    height: 96px;
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.md3-fab-extended {
    width: auto;
    padding: 0 20px;
    gap: 8px;
    white-space: nowrap;
}

/* ── Utility classes ───────────────────────────────────── */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.visually-hidden { visibility: hidden; }
.pointer { cursor: pointer; }
.no-select { user-select: none; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--md-sys-color-on-surface-variant); }
.text-primary { color: var(--md-sys-color-primary); }
.text-error { color: var(--md-sys-color-error); }
.text-success { color: #10b981; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
