:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --header-height: 4.15rem;
    --editor-width: min(700px, 62vw);
    --canvas: #f4f3ef;
    --surface: #fffefa;
    --surface-muted: #ebeae5;
    --ink: #1d211f;
    --ink-soft: #424844;
    --ink-muted: #aaaaaa;
    --line: #d9d8d2;
    --line-strong: #c8c7c1;
    --line-soft: #e7e5df;
    --accent: #248b66;
    --accent-strong: #245f4a;
    --open: #9a5b24;
    --focus: #3b8066;
    --danger: #a5423a;
    --shadow-left: -16px 0 55px rgb(26 34 30 / 14%);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #171b19;
    --surface: #202522;
    --surface-muted: #2b312e;
    --ink: #edf1ee;
    --ink-soft: #c6cdc8;
    --ink-muted: #777777;
    --line: #3a423d;
    --line-strong: #4b554f;
    --line-soft: #303733;
    --accent: #3f8768;
    --accent-strong: #79b99e;
    --open: #dda464;
    --focus: #79b99e;
    --danger: #e17b72;
    --shadow-left: -16px 0 55px rgb(0 0 0 / 32%);
}

html[data-font-size="small"] {
    font-size: 16px;
}

html[data-font-size="medium"] {
    font-size: 18px;
}

html[data-font-size="large"] {
    font-size: 20px;
}

html[data-editor-font="monospace"] #entry-content,
html[data-editor-font="monospace"] .entry-preview {
    font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    min-width: 19rem;
    overflow: hidden;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
}

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

button,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.app-header {
    position: fixed;
    z-index: 10;
    inset: 0 0 auto;
    height: calc(var(--header-height) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--canvas) 94%, transparent);
    backdrop-filter: blur(14px);
}

.header-inner {
    display: grid;
    width: min(62rem, calc(100% - 1.5rem));
    height: var(--header-height);
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.55rem;
    margin: 0 auto;
}

.home-action {
    text-decoration: none;
}

.main-menu-anchor {
    position: relative;
}

.main-menu-popup {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.35rem);
    right: 0;
    width: 14rem;
    padding: 0.35rem;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 0.8rem;
    background: color-mix(in srgb, var(--surface) 97%, transparent);
    box-shadow: 0 14px 40px rgb(25 32 28 / 17%), 0 2px 8px rgb(25 32 28 / 7%);
    backdrop-filter: blur(16px);
    animation: menu-popup-enter 140ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.list-toolbar.is-hidden {
    display: none;
}

.entry-list.content-view {
    border-top: 0;
}

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

.summary-section {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.summary-section-header {
    display: flex;
    min-height: 2.7rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 680;
}

.summary-section-header a {
    color: inherit;
    text-decoration: none;
}

.summary-section-header a:hover {
    color: var(--accent);
}

.summary-section-header strong {
    min-width: 1.7rem;
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--ink-muted);
    font-size: 0.7rem;
    text-align: center;
}

.summary-entry-list {
    padding-inline: 0.7rem;
}

.summary-entry-list .entry-card-open {
    padding-block: 0.72rem;
}

.summary-entry-list .entry-title {
    font-size: 0.88rem;
    -webkit-line-clamp: 1;
}

.summary-entry-list .empty-state {
    padding: 1.6rem 0;
}

.stats-view,
.path-management-view {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.stats-table th,
.stats-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--line-soft);
    text-align: right;
}

.stats-table tr:last-child th,
.stats-table tr:last-child td {
    border-bottom: 0;
}

.stats-table thead th {
    color: var(--ink-muted);
    font-size: 0.68rem;
    font-weight: 680;
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

.stats-sort-button {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: flex-end;
    gap: 0.28rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}

.stats-table th:first-child .stats-sort-button {
    justify-content: flex-start;
}

.stats-sort-button:hover,
.stats-sort-button:focus-visible,
.stats-table th[aria-sort] .stats-sort-button {
    color: var(--accent);
}

.stats-sort-button svg {
    width: 0.72rem;
    height: 0.72rem;
    opacity: 0;
    transition: transform 140ms ease, opacity 140ms ease;
}

.stats-table th[aria-sort] .stats-sort-button svg {
    opacity: 1;
}

.stats-table th[aria-sort="ascending"] .stats-sort-button svg {
    transform: rotate(180deg);
}

.stats-table th:first-child {
    width: 100%;
    text-align: left;
}

.stats-table tbody th {
    font-weight: 580;
}

.stats-table a {
    display: block;
    padding-left: calc(var(--path-depth, 0) * 0.85rem);
    color: var(--ink);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.stats-table a:hover {
    color: var(--accent);
}

.path-management-item {
    border-bottom: 1px solid var(--line-soft);
}

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

.path-management-item summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    min-height: 3.2rem;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem 0.55rem calc(0.7rem + var(--path-depth, 0) * 0.85rem);
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.path-management-item summary::-webkit-details-marker {
    display: none;
}

.path-management-item summary > svg:first-child {
    width: 1rem;
    height: 1rem;
    color: var(--ink-muted);
}

.path-management-item summary span {
    overflow: hidden;
    font-size: 0.84rem;
    font-weight: 590;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-management-item summary small {
    color: var(--ink-muted);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.path-management-chevron {
    width: 0.9rem;
    height: 0.9rem;
    transition: transform 130ms ease;
}

.path-management-item[open] .path-management-chevron {
    transform: rotate(90deg);
}

.path-management-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    padding: 0.15rem 0.7rem 0.75rem calc(2.25rem + var(--path-depth, 0) * 0.85rem);
}

.path-management-form input {
    width: 100%;
    min-height: 2.45rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.82rem;
}

.path-management-form button {
    min-height: 2.45rem;
    padding-inline: 0.8rem;
    border: 0;
    border-radius: 0.55rem;
    background: var(--accent);
    color: white;
    font-weight: 650;
    cursor: pointer;
}

.main-menu-popup[hidden] {
    display: none;
}

.main-menu-item {
    display: flex;
    width: 100%;
    min-height: 2.65rem;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 400;
    text-align: left;
    text-decoration: none;
}

.main-menu-form {
    margin: 0;
}

.main-menu-form .main-menu-item {
    appearance: none;
}

.main-menu-separator {
    height: 1px;
    margin: 0.3rem 0.55rem;
    background: color-mix(in srgb, var(--line) 72%, transparent);
}

.main-menu-item:hover,
.main-menu-item.is-active {
    background: var(--surface-muted);
    color: var(--accent);
}

.main-menu-item svg {
    width: 1rem;
    height: 1rem;
}

.protected-marker {
    display: inline-flex;
    color: var(--accent);
}

.protected-marker svg {
    width: 0.82rem;
    height: 0.82rem;
}

.auth-page {
    min-height: 100dvh;
    background: var(--canvas);
}

.auth-shell {
    display: grid;
    min-height: 100dvh;
    padding: max(1.25rem, env(safe-area-inset-top)) max(1.1rem, env(safe-area-inset-right))
             max(1.25rem, env(safe-area-inset-bottom)) max(1.1rem, env(safe-area-inset-left));
    place-items: center;
}

.auth-card {
    width: min(100%, 23rem);
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 18px 55px rgb(25 32 28 / 10%);
}

.auth-brand {
    margin-bottom: 2rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.08em;
}

.auth-card h1 {
    margin: 0 0 1.25rem;
    font-size: 1.35rem;
    letter-spacing: -0.025em;
}

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

.auth-form input[type="password"] {
    width: 100%;
    height: 3rem;
    padding: 0 0.85rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.7rem;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

.auth-form input[type="password"]:focus-visible {
    border-color: var(--accent);
    outline: 3px solid color-mix(in srgb, var(--accent) 18%, transparent);
    outline-offset: 1px;
}

.auth-trust {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.auth-submit {
    min-height: 2.8rem;
    border-radius: 0.7rem;
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.auth-error,
.auth-message {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.88rem;
    line-height: 1.5;
}

.auth-error {
    color: var(--danger);
}

.auth-command {
    display: block;
    margin-top: 1rem;
    padding: 0.8rem;
    overflow-wrap: anywhere;
    border-radius: 0.6rem;
    background: var(--surface-muted);
    color: var(--ink);
    font-size: 0.78rem;
}

.search {
    display: flex;
    min-width: 0;
    height: 2.85rem;
    align-items: center;
    padding: 0 0.8rem;
    border: 1px solid var(--line);
    border-radius: 0.78rem;
    background: var(--surface);
}

.search:focus-within {
    border-color: color-mix(in srgb, var(--focus) 60%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent);
}

.search > svg {
    flex: 0 0 auto;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--ink-muted);
}

.search input {
    min-width: 0;
    height: 100%;
    flex: 1;
    padding: 0 0.65rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: 0.94rem;
}

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

.search input::-webkit-search-cancel-button {
    display: none;
}

.clear-search,
.icon-action,
.add-action,
.entry-card,
.editor-icon-action,
.menu-links button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.menu-link {
    display: block;
    min-height: 2.85rem;
    padding: 0.75rem 0.55rem;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0.45rem;
    color: var(--ink);
    text-decoration: none;
}

.menu-link:hover,
.menu-link.is-active {
    color: var(--accent);
}

.menu-link.is-active {
    font-weight: 720;
}

.path-menu-link {
    min-height: 2.35rem;
    padding-block: 0.55rem;
    padding-left: calc(0.55rem + var(--path-depth) * 1rem);
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.path-rename {
    display: flex;
    gap: 0.35rem;
    margin-top: 1rem;
}

.path-rename input {
    min-width: 0;
    height: 2.6rem;
    flex: 1;
    padding: 0 0.65rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    background: var(--surface);
}

.path-rename button {
    padding: 0 0.75rem;
    border: 0;
    border-radius: 0.55rem;
    background: var(--surface-muted);
    color: var(--accent);
    cursor: pointer;
}

.clear-search,
.icon-action {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: var(--ink-soft);
}

.clear-search {
    width: 2rem;
    height: 2rem;
}

.clear-search svg {
    width: 0.95rem;
    height: 0.95rem;
}

.icon-action {
    width: 2.75rem;
    height: 2.75rem;
}

.icon-action svg {
    width: 1.25rem;
    height: 1.25rem;
}

.clear-search:hover,
.icon-action:hover,
.editor-icon-action:hover:not(:disabled) {
    background: var(--surface-muted);
}

.add-action {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    place-items: center;
}

.add-action:hover {
    background: var(--accent-strong);
}

.add-action svg {
    width: 1.05rem;
    height: 1.05rem;
}

.app-content {
    position: fixed;
    inset: calc(var(--header-height) + env(safe-area-inset-top)) 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.content-inner {
    width: min(48rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0.8rem 0 max(4rem, env(safe-area-inset-bottom));
}

.list-toolbar {
    display: flex;
    min-width: 0;
    min-height: 2.7rem;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.scope-switcher {
    display: inline-flex;
    min-width: 0;
    max-width: 100%;
    min-height: 2.15rem;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0 -0.45rem;
    padding: 0.35rem 0.5rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 680;
    text-align: left;
}

.scope-switcher:hover {
    background: var(--surface-muted);
}

.scope-switcher span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scope-switcher svg {
    width: 0.95rem;
    height: 0.95rem;
    flex: 0 0 auto;
}

.scope-switcher .scope-chevron {
    width: 0.8rem;
    height: 0.8rem;
    color: var(--ink-muted);
}

.list-filter-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.1rem;
    margin-left: auto;
}

body.has-selection .list-filter-actions {
    display: none;
}

.quick-filter-toggle {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--ink-muted);
    text-decoration: none;
}

.quick-filter-toggle:hover {
    background: var(--surface-muted);
}

.quick-filter-toggle[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    color: var(--accent);
}

.quick-filter-toggle svg {
    width: 1.05rem;
    height: 1.05rem;
}

.browse-control {
    position: relative;
    flex: 0 0 auto;
}

body.has-selection .browse-control {
    display: none;
}

.browse-trigger {
    position: relative;
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    place-items: center;
}

.browse-trigger:hover,
.browse-trigger[aria-expanded="true"] {
    background: var(--surface-muted);
}

.browse-trigger.is-active {
    color: var(--accent);
}

.browse-trigger svg {
    width: 1.05rem;
    height: 1.05rem;
}

.browse-active-marker {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    width: 0.32rem;
    height: 0.32rem;
    border: 1px solid var(--canvas);
    border-radius: 50%;
    background: var(--accent);
}

.browse-popup {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.35rem);
    right: 0;
    width: min(20rem, calc(100vw - 1.2rem));
    padding: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 0.85rem;
    background: color-mix(in srgb, var(--surface) 98%, transparent);
    box-shadow: 0 16px 45px rgb(25 32 28 / 18%), 0 2px 8px rgb(25 32 28 / 8%);
    backdrop-filter: blur(16px);
    animation: menu-popup-enter 140ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.browse-popup[hidden] {
    display: none;
}

.browse-field {
    display: grid;
    min-width: 0;
    gap: 0.28rem;
    margin-bottom: 0.65rem;
}

.browse-field > span:first-child,
.browse-field > label {
    color: var(--ink-muted);
    font-size: 0.68rem;
    font-weight: 680;
}

.browse-field select,
.browse-field input {
    width: 100%;
    min-width: 0;
    height: 2.45rem;
    padding: 0 0.6rem;
    border: 1px solid var(--line);
    border-radius: 0.58rem;
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.82rem;
}

.browse-field select:focus-visible,
.browse-field input:focus-visible {
    border-color: color-mix(in srgb, var(--focus) 65%, var(--line));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 17%, transparent);
}

.browse-sort-row,
.browse-date-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.browse-view-choice {
    margin: 0 0 0.55rem;
    padding: 0;
    border: 0;
}

.browse-view-choice legend {
    margin-bottom: 0.28rem;
    color: var(--ink-muted);
    font-size: 0.68rem;
    font-weight: 680;
}

.browse-view-choice > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
    padding: 0.2rem;
    border-radius: 0.65rem;
    background: var(--surface-muted);
}

.browse-view-choice label {
    min-width: 0;
    cursor: pointer;
}

.browse-view-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.browse-view-choice span {
    display: flex;
    min-height: 2.15rem;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    color: var(--ink-muted);
    font-size: 0.76rem;
}

.browse-view-choice input:checked + span {
    border-color: color-mix(in srgb, var(--line) 82%, transparent);
    background: var(--surface);
    box-shadow: 0 1px 3px rgb(24 31 27 / 10%);
    color: var(--accent);
}

.browse-view-choice input:focus-visible + span {
    outline: 2px solid color-mix(in srgb, var(--focus) 52%, transparent);
    outline-offset: 1px;
}

.browse-view-choice svg {
    width: 0.95rem;
    height: 0.95rem;
}

.browse-date-label {
    display: flex;
    min-width: 0;
    height: 1.2rem;
    align-items: center;
    justify-content: space-between;
}

.browse-date-label button {
    display: grid;
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    place-items: center;
}

.browse-date-label button:hover,
.browse-date-label button:focus-visible {
    outline: 0;
    background: var(--surface-muted);
    color: var(--ink);
}

.browse-date-label button svg {
    width: 0.72rem;
    height: 0.72rem;
}

.browse-toggle {
    display: flex;
    min-height: 2.35rem;
    align-items: center;
    gap: 0.55rem;
    margin: -0.05rem 0 0.55rem;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 650;
}

.browse-toggle input {
    position: relative;
    width: 2.15rem;
    height: 1.25rem;
    flex: 0 0 auto;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    appearance: none;
    background: var(--surface-muted);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}

.browse-toggle input::after {
    position: absolute;
    top: 0.14rem;
    left: 0.14rem;
    width: 0.83rem;
    height: 0.83rem;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 3px rgb(24 31 27 / 20%);
    content: "";
    transition: transform 120ms ease;
}

.browse-toggle input:checked {
    border-color: var(--accent);
    background: var(--accent);
}

.browse-toggle input:checked::after {
    transform: translateX(0.9rem);
}

.browse-toggle input:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--focus) 58%, transparent);
    outline-offset: 2px;
}

.browse-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.browse-actions a,
.browse-actions button {
    min-height: 2.3rem;
    padding: 0 0.75rem;
    border: 0;
    border-radius: 0.55rem;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 680;
    text-decoration: none;
}

.browse-actions a {
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: var(--ink-muted);
}

.browse-actions button {
    background: var(--accent);
    color: white;
}

.browse-actions a:hover {
    background: var(--surface-muted);
    color: var(--ink);
}

.browse-actions button:hover {
    background: var(--accent-strong);
}

.selection-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.1rem;
    margin-left: auto;
}

.selection-actions[hidden] {
    display: none;
}

.selection-count {
    min-width: 1.5rem;
    color: var(--ink-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.selection-action {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    place-items: center;
}

.selection-action:hover {
    background: var(--surface-muted);
}

.selection-action:disabled {
    cursor: default;
    opacity: 0.38;
}

.selection-action.is-danger {
    color: #a5423a;
}

.restore-action {
    color: var(--accent);
}

.selection-action svg {
    width: 1.05rem;
    height: 1.05rem;
}

.entry-list {
    border-top: 1px solid var(--line);
}

.entry-list.sticky-notes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
    align-items: start;
    gap: 0.75rem;
    border-top: 0;
}

.sticky-notes .empty-state {
    grid-column: 1 / -1;
}

.sticky-notes .entry-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    cursor: grab;
    user-select: none;
}

.sticky-notes .entry-card:active {
    cursor: grabbing;
}

.sticky-notes .entry-card.sticky-sort-chosen {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
    box-shadow: 0 9px 24px rgb(25 32 28 / 14%);
}

.sticky-notes .entry-card.sticky-sort-ghost {
    opacity: 0.32;
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.entry-card.sticky-sort-drag,
.entry-card.sortable-fallback {
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 0.8rem;
    background: var(--surface);
    opacity: 1;
    cursor: grabbing;
    transform: rotate(0.35deg);
    box-shadow: 0 14px 34px rgb(25 32 28 / 20%);
}

.is-sorting-sticky .sticky-notes .entry-card:not(.sticky-sort-chosen, .sticky-sort-ghost) {
    transition: transform 170ms cubic-bezier(0.2, 0, 0, 1);
}

.sticky-notes .entry-card:hover,
.sticky-notes .entry-card.is-active {
    border-color: var(--line-strong);
    border-radius: 0.8rem;
    background: var(--surface);
    box-shadow: 0 5px 16px rgb(25 32 28 / 8%);
}

.sticky-notes .entry-card.is-selected,
.sticky-notes .entry-card.is-selected:hover {
    border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
    border-radius: 0.8rem;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    box-shadow: inset 3px 0 0 var(--accent);
}

.sticky-notes .entry-card-open {
    padding: 0.95rem 0.9rem 0.65rem;
}

.sticky-notes .entry-card-toggles {
    bottom: 0.65rem;
    right: 0.5rem;
    gap: 0.05rem;
}

.sticky-notes .entry-card-toggle {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.45rem;
}

.sticky-notes .entry-card-toggle svg {
    width: 0.95rem;
    height: 0.95rem;
}

.sticky-notes .entry-continuation {
    margin-top: 0.48rem;
    -webkit-line-clamp: 6;
}

.sticky-notes .entry-meta {
    min-height: 1.85rem;
    padding-right: 3.9rem;
    margin-top: 0.75rem;
}

.entry-card {
    position: relative;
    width: 100%;
    border-bottom: 1px solid var(--line);
    text-align: left;
    touch-action: pan-y;
    -webkit-touch-callout: none;
}

.entry-card-open {
    display: block;
    width: 100%;
    padding: 1.05rem 0.15rem 0.55rem;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.entry-card-toggles {
    position: absolute;
    bottom: 0.55rem;
    right: 0.15rem;
    display: flex;
    gap: 0.1rem;
}

.entry-card-toggle {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    touch-action: manipulation;
}

.entry-card-toggle:hover:not(:disabled) {
    background: var(--surface-muted);
}

.entry-card-toggle[aria-pressed="true"] {
    /*
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    */
    color: var(--accent);
}

.entry-pin[aria-pressed="true"] svg {
    fill: currentColor;
}

.entry-open[aria-pressed="true"] svg circle,
.mode-action[aria-pressed="true"] svg circle,
.quick-open-filter[aria-pressed="true"] svg circle {
    fill: currentColor;
}

.entry-open[aria-pressed="true"] svg path,
.mode-action[aria-pressed="true"] svg path,
.quick-open-filter[aria-pressed="true"] svg path {
    stroke: var(--surface);
}

.entry-card-toggle:disabled {
    cursor: default;
    opacity: 0.65;
}

.entry-card-toggle svg {
    width: 1.05rem;
    height: 1.05rem;
}

.entry-card:hover,
.entry-card.is-active {
    border-radius: 0.7rem;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.entry-card.is-selected,
.entry-card.is-selected:hover {
    border-radius: 0.2rem;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    box-shadow: inset 3px 0 0 var(--accent);
}

.entry-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink);
    font-size: 0.96rem;
    font-weight: 610;
    line-height: 1.38;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.entry-continuation {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 0.24rem;
    color: var(--ink-soft);
    font-size: 0.86rem;
    line-height: 1.42;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.entry-title mark,
.entry-continuation mark {
    border-radius: 0.16em;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: inherit;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.entry-meta {
    display: flex;
    min-width: 0;
    min-height: 2.25rem;
    align-items: center;
    gap: 0.42rem;
    padding-right: 4.9rem;
    margin-top: 0.55rem;
    color: var(--ink-muted);
    font-size: 0.68rem;
    white-space: nowrap;
}

.entry-location {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-changed,
.entry-meta-separator,
.protected-marker {
    flex: 0 0 auto;
}

.meta-separator::before {
    content: "·";
}

.relation-count {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.relation-count svg {
    width: 0.75rem;
    height: 0.75rem;
}

.empty-state {
    padding: 3rem 0;
    color: var(--ink-muted);
    font-size: 0.85rem;
    text-align: center;
}

.menu-dialog,
.path-switcher-dialog,
.confirm-dialog,
.history-dialog,
.files-dialog,
.rename-file-dialog,
.delete-file-dialog,
.created-date-dialog,
.settings-dialog {
    width: min(23rem, calc(100vw - 2rem));
    max-width: none;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 1.05rem;
    background: var(--surface);
    box-shadow: 0 20px 70px rgb(26 34 30 / 20%);
    color: var(--ink);
}

.history-dialog {
    height: min(42rem, calc(100dvh - 2rem));
}

.files-dialog {
    width: min(40rem, calc(100vw - 2rem));
    height: min(44rem, calc(100dvh - 2rem));
}

.menu-dialog[open],
.path-switcher-dialog[open],
.confirm-dialog[open],
.history-dialog[open],
.files-dialog[open],
.rename-file-dialog[open],
.delete-file-dialog[open],
.created-date-dialog[open],
.settings-dialog[open] {
    animation: modal-enter 160ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.menu-dialog::backdrop,
.path-switcher-dialog::backdrop,
.confirm-dialog::backdrop,
.history-dialog::backdrop,
.files-dialog::backdrop,
.rename-file-dialog::backdrop,
.delete-file-dialog::backdrop,
.created-date-dialog::backdrop,
.settings-dialog::backdrop {
    background: rgb(21 27 24 / 10%);
    backdrop-filter: blur(1px);
    animation: backdrop-enter 160ms ease-out both;
}

.confirm-sheet {
    padding: 1.15rem;
}

.confirm-sheet h2 {
    margin: 0;
    font-size: 1rem;
}

.confirm-sheet p {
    margin: 0.65rem 0 1.1rem;
    color: var(--ink-soft);
    font-size: 0.85rem;
    line-height: 1.45;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
}

.confirm-actions button {
    min-height: 2.4rem;
    padding: 0 0.8rem;
    border: 0;
    border-radius: 0.55rem;
    background: var(--surface-muted);
    color: var(--ink-soft);
    cursor: pointer;
    font-weight: 680;
}

.confirm-actions button.is-danger {
    background: #a5423a;
    color: white;
}

.files-sheet {
    display: grid;
    height: 100%;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    padding: 0.75rem;
    overflow: hidden;
}

.files-header {
    padding-left: 0.2rem;
}

.file-drop-zone {
    display: grid;
    min-height: 7.2rem;
    margin-top: 0.45rem;
    place-items: center;
    align-content: center;
    gap: 0.25rem;
    border: 1px dashed color-mix(in srgb, var(--ink-muted) 55%, var(--line));
    border-radius: 0.8rem;
    background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
    color: var(--ink-muted);
    cursor: pointer;
    text-align: center;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.file-drop-zone:hover,
.file-drop-zone:focus-visible,
.file-drop-zone.is-dragover {
    border-color: var(--accent);
    outline: 0;
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    color: var(--accent);
}

.file-drop-zone.is-busy {
    pointer-events: none;
    opacity: 0.6;
}

.file-drop-zone > svg {
    width: 1.45rem;
    height: 1.45rem;
}

.file-drop-zone strong {
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.file-drop-zone span {
    font-size: 0.7rem;
}

.files-status {
    margin: 0.55rem 0 0;
    color: var(--ink-muted);
    font-size: 0.72rem;
}

.files-status:empty {
    display: none;
}

.file-list {
    min-height: 0;
    margin-top: 0.55rem;
    border-top: 1px solid var(--line-soft);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.file-item {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr) auto;
    min-height: 4.1rem;
    align-items: center;
    gap: 0.65rem;
    padding: 0.42rem 0.25rem;
    border-bottom: 1px solid var(--line-soft);
}

.file-thumbnail {
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    place-items: center;
    overflow: hidden;
    border-radius: 0.55rem;
    background: var(--surface-muted);
    color: var(--ink-muted);
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-thumbnail svg {
    width: 1.25rem;
    height: 1.25rem;
}

.file-details {
    display: grid;
    min-width: 0;
    gap: 0.18rem;
}

.file-name {
    overflow: hidden;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 680;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name:hover {
    color: var(--accent);
}

.file-size {
    color: var(--ink-muted);
    font-size: 0.68rem;
}

.file-actions {
    display: flex;
    gap: 0.15rem;
}

.file-actions button {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
}

.file-actions button:hover {
    background: var(--surface-muted);
    color: var(--ink);
}

.file-actions button.is-danger:hover {
    background: color-mix(in srgb, #a5423a 9%, transparent);
    color: #a5423a;
}

.file-actions svg {
    width: 1rem;
    height: 1rem;
}

.file-list-empty {
    margin: 0;
    padding: 2rem 0.25rem;
    color: var(--ink-muted);
    font-size: 0.78rem;
    text-align: center;
}

.rename-file-sheet {
    padding: 1.15rem;
}

.rename-file-sheet h2 {
    margin: 0 0 0.8rem;
    font-size: 1rem;
}

.rename-file-sheet input {
    width: 100%;
    min-height: 2.7rem;
    padding: 0 0.7rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.86rem;
}

.rename-file-sheet input:focus {
    border-color: color-mix(in srgb, var(--accent) 68%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.rename-file-sheet .confirm-actions {
    margin-top: 0.85rem;
}

.created-date-sheet {
    padding: 1.15rem;
}

.created-date-sheet h2 {
    margin: 0 0 0.9rem;
    font-size: 1rem;
}

.created-date-sheet label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--ink-muted);
    font-size: 0.72rem;
}

.created-date-sheet input {
    width: 100%;
    min-width: 0;
    min-height: 2.7rem;
    padding: 0 0.65rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.86rem;
}

.created-date-sheet input:focus {
    border-color: color-mix(in srgb, var(--accent) 68%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.created-date-error {
    min-height: 1.1rem;
    margin: 0.4rem 0 0.45rem;
    color: #a5423a;
    font-size: 0.72rem;
}

.settings-sheet {
    padding: 0.75rem;
}

.settings-header {
    padding-left: 0.35rem;
}

.settings-group {
    min-width: 0;
    margin: 0.55rem 0 0;
    padding: 0;
    border: 0;
}

.settings-group legend {
    margin-bottom: 0.35rem;
    color: var(--ink-muted);
    font-size: 0.7rem;
    font-weight: 680;
}

.settings-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
    padding: 0.25rem;
    border-radius: 0.65rem;
    background: var(--surface-muted);
}

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

.settings-options label {
    min-width: 0;
    cursor: pointer;
}

.settings-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-options span {
    display: grid;
    min-height: 2.25rem;
    place-items: center;
    padding: 0 0.35rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    color: var(--ink-soft);
    font-size: 0.76rem;
    text-align: center;
}

.settings-options input:checked + span {
    border-color: color-mix(in srgb, var(--line) 82%, transparent);
    background: var(--surface);
    box-shadow: 0 1px 4px rgb(24 31 27 / 10%);
    color: var(--accent);
    font-weight: 720;
}

.settings-options input:focus-visible + span {
    outline: 2px solid color-mix(in srgb, var(--focus) 45%, transparent);
    outline-offset: 1px;
}

.settings-footer {
    display: flex;
    justify-content: flex-start;
    margin-top: 0.85rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line-soft);
}

.settings-footer button {
    min-height: 2.2rem;
    padding: 0 0.45rem;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 0.72rem;
}

.settings-footer button:hover {
    color: var(--accent);
}

.path-switcher-dialog {
    max-height: min(34rem, calc(100dvh - 2rem));
}

.path-switcher-sheet {
    padding: 0.75rem;
}

.path-switcher-header {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.45rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line);
}

.path-switcher-header > .icon-action {
    flex: 0 0 auto;
    margin-left: auto;
}

.path-switcher-scopes {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
}

.path-switcher-scopes::-webkit-scrollbar {
    display: none;
}

.path-switcher-scope {
    color: var(--ink-soft);
    font-size: 0.86rem;
    font-weight: 400;
    text-decoration: none;
}

.path-switcher-scope + .path-switcher-scope::before {
    content: "|";
    padding: 0 0.55rem;
    color: var(--line-strong);
    font-weight: 400;
}

.path-switcher-scope:hover,
.path-switcher-scope.is-active {
    color: var(--accent);
}

.path-switcher-scope.is-active {
    font-weight: 760;
}

.path-switcher-links {
    max-height: min(28rem, calc(100dvh - 7rem));
    margin-top: 0.55rem;
    overflow-y: auto;
}

.path-switcher-link {
    display: block;
    min-height: 2.55rem;
    padding: 0.68rem 0.7rem;
    padding-left: calc(0.7rem + var(--path-depth, 0) * 0.7rem);
    border-radius: 0.55rem;
    color: var(--ink-soft);
    font-size: 0.86rem;
    text-decoration: none;
}

.path-switcher-link:hover {
    background: var(--surface-muted);
}

.path-switcher-link.is-active {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-weight: 720;
}

.menu-sheet {
    padding: 1rem;
}

.history-sheet {
    display: grid;
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0.75rem;
    overflow: hidden;
}

.history-list {
    margin-top: 0.65rem;
    border-top: 1px solid var(--line-soft);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.history-item {
    display: block;
    width: 100%;
    padding: 0.8rem 0.55rem;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}

.history-item:hover {
    background: var(--surface-muted);
}

.history-item time,
.history-empty {
    color: var(--ink-muted);
    font-size: 0.7rem;
}

.history-item-preview {
    display: -webkit-box;
    overflow: hidden;
    margin: 0.35rem 0 0;
    font-size: 0.84rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.history-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding-left: 0;
}

.history-header h2 {
    overflow: hidden;
    padding-inline: 0.45rem;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-accept {
    color: var(--accent);
}

.history-preview {
    min-height: 0;
    padding: 0.8rem 0.65rem max(1rem, env(safe-area-inset-bottom));
}

.history-empty {
    padding: 1.5rem 0.55rem;
}

.menu-header,
.editor-header {
    display: flex;
    align-items: center;
}

.menu-header {
    min-height: 2.75rem;
    justify-content: space-between;
    padding-left: 0.55rem;
}

.menu-header h2 {
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: -0.025em;
}

.menu-links {
    margin-top: 0.65rem;
    border-top: 1px solid var(--line-soft);
}

.menu-links button {
    display: block;
    width: 100%;
    min-height: 2.85rem;
    padding: 0.55rem;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0.45rem;
    text-align: left;
}

.menu-links button:hover,
.menu-links button.is-active {
    color: var(--accent);
}

.menu-links button.is-active {
    font-weight: 720;
}

.menu-secondary {
    margin-top: 1rem;
}

.editor-dialog {
    position: fixed;
    z-index: 40;
    inset: 0 0 0 auto;
    width: var(--editor-width);
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    box-shadow: var(--shadow-left);
    color: var(--ink);
    overflow: hidden;
}

.editor-dialog[open] {
    display: block;
    animation: editor-enter 190ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.editor-dialog.is-editor-swap[open] {
    animation: none;
}

.editor-dialog.is-expanded,
.editor-dialog.is-centered {
    width: 100vw;
}

.editor-dialog.is-centered {
    background: var(--canvas);
}

.editor-dialog.is-centered .editor {
    width: min(700px, 100%);
    margin-inline: auto;
    border-inline: 1px solid var(--line);
    background: var(--surface);
}

.editor {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
}

.editor-body {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.editor-header {
    min-width: 0;
    min-height: 3.15rem;
    gap: 0.3rem;
    padding: 0.3rem 0.45rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.editor-toolbar {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 0.22rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.editor-toolbar::-webkit-scrollbar {
    display: none;
}

.editor-more-control {
    position: relative;
    flex: 0 0 auto;
}

.editor-more-menu {
    position: absolute;
    z-index: 70;
    top: calc(100% + 0.35rem);
    right: 0;
    width: 14.5rem;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--surface);
    box-shadow: 0 14px 38px rgb(26 34 30 / 18%);
}

.editor-more-menu button {
    display: flex;
    width: 100%;
    min-height: 2.6rem;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.65rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    text-align: left;
}

.editor-more-menu button:hover,
.editor-more-menu button:focus-visible {
    outline: 0;
    background: var(--surface-muted);
    color: var(--ink);
}

.editor-more-menu svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.editor-icon-action {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 0.55rem;
    color: var(--ink-muted);
}

.editor-archive-action {
    display: inline-flex;
    height: 2.25rem;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.55rem;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    color: var(--accent);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 720;
}

.editor-archive-action:hover {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

.editor-archive-action svg {
    width: 0.9rem;
    height: 0.9rem;
}

.editor-icon-action svg {
    width: 1.05rem;
    height: 1.05rem;
}

.editor-icon-action:disabled {
    cursor: default;
    opacity: 0.28;
}

.editor-toggle-action[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    color: var(--accent);
}

.draft-status {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    color: var(--ink-muted);
    font-size: 0.68rem;
    padding-inline: 0.25rem;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-field {
    max-width: min(16rem, 42vw);
    flex: 0 0 auto;
}

.path-badge {
    display: inline-flex;
    max-width: 100%;
    height: 2.25rem;
    align-items: center;
    gap: 0.38rem;
    padding: 0 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
}

.path-badge:hover,
.path-badge[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.path-badge span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-badge svg {
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 auto;
}

.path-badge .path-badge-chevron {
    width: 0.72rem;
    height: 0.72rem;
    color: var(--ink-muted);
}

.autocomplete-popup {
    position: fixed;
    z-index: 90;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0.4rem;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 0.85rem;
    background: color-mix(in srgb, var(--surface) 97%, transparent);
    box-shadow: 0 16px 45px rgb(25 32 28 / 18%), 0 2px 8px rgb(25 32 28 / 8%);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.autocomplete-popup[hidden] {
    display: none;
}

.autocomplete-filter-row {
    display: flex;
    min-width: 0;
    height: 2.65rem;
    align-items: center;
    margin-bottom: 0.3rem;
    border: 1px solid var(--line);
    border-radius: 0.62rem;
    background: var(--surface);
}

.autocomplete-filter-row:focus-within {
    border-color: color-mix(in srgb, var(--focus) 65%, var(--line));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 17%, transparent);
}

.autocomplete-filter {
    min-width: 0;
    height: 100%;
    flex: 1;
    padding: 0 0.65rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: 0.86rem;
}

.autocomplete-filter:focus-visible {
    border: 0;
    box-shadow: none;
}

.autocomplete-add {
    display: grid;
    width: 2.5rem;
    height: 100%;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0 0.58rem 0.58rem 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    place-items: center;
}

.autocomplete-add:hover:not(:disabled) {
    background: var(--surface-muted);
}

.autocomplete-add:disabled {
    cursor: default;
    opacity: 0.25;
}

.autocomplete-add svg,
.autocomplete-option-check {
    width: 1rem;
    height: 1rem;
}

.autocomplete-listbox {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.autocomplete-option {
    display: flex;
    width: 100%;
    min-height: 2.65rem;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 0.82rem;
    text-align: left;
}

.autocomplete-option:hover,
.autocomplete-option.is-active {
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
    color: var(--ink);
}

.autocomplete-option[aria-selected="true"] {
    color: var(--accent);
    font-weight: 690;
}

.autocomplete-option-value {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-option mark {
    background: transparent;
    color: var(--accent);
    font-weight: 760;
}

.autocomplete-option-check {
    flex: 0 0 auto;
    color: var(--accent);
}

.autocomplete-empty {
    padding: 0.75rem 0.65rem;
    color: var(--ink-muted);
    font-size: 0.78rem;
}

@keyframes editor-enter {
    from {
        opacity: 0.65;
        transform: translateX(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes editor-enter-mobile {
    from {
        opacity: 0.72;
        transform: translateY(0.45rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes menu-popup-enter {
    from {
        opacity: 0;
        transform: translateY(-0.2rem) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: translateY(0.25rem) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes sheet-enter {
    from {
        opacity: 0.5;
        transform: translateY(0.65rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes backdrop-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

#entry-content {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 1rem 1.2rem max(2rem, env(safe-area-inset-bottom));
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    /*
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    */
    font-size: 1rem;
    line-height: 1.65;
    overflow-y: auto;
    overscroll-behavior: contain;
    resize: none;
    scroll-padding-block: 1rem 3rem;
    tab-size: 4;
}

#entry-content::placeholder {
    color: #999d98;
}

#entry-content[hidden] {
    display: none;
}

.entry-preview {
    height: 100%;
    padding: 1rem 1.35rem max(2rem, env(safe-area-inset-bottom));
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.65;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-wrap: anywhere;
    overscroll-behavior: contain;
}

.entry-preview[hidden] {
    display: none;
}

.entry-preview:focus-visible {
    outline: none;
}

.entry-preview.is-empty::before {
    color: var(--ink-muted);
    content: "Nothing to preview";
}

.entry-preview p {
    margin: 0 0 1em;
}

.entry-preview > :first-child {
    margin-top: 0;
}

.entry-preview > :last-child {
    margin-bottom: 0;
}

.entry-preview h1,
.entry-preview h2,
.entry-preview h3,
.entry-preview h4,
.entry-preview h5,
.entry-preview h6 {
    margin: 1.35em 0 0.55em;
    font-weight: 680;
    line-height: 1.25;
}

.entry-preview h1 {
    font-size: 1.55rem;
}

.entry-preview h2 {
    font-size: 1.3rem;
}

.entry-preview h3 {
    font-size: 1.12rem;
}

.entry-preview h4,
.entry-preview h5,
.entry-preview h6 {
    font-size: 1rem;
}

.entry-preview ul,
.entry-preview ol {
    margin: 0.2em 0 1em;
    padding-left: 1.55em;
}

.entry-preview li {
    padding-left: 0.18em;
}

.entry-preview li + li {
    margin-top: 0.02em;
}

.entry-preview li::marker {
    color: var(--accent);
    font-weight: 720;
}

.entry-preview a {
    color: var(--accent);
    text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
}

.entry-preview a:hover {
    text-decoration-color: currentColor;
}

.entry-preview strong {
    font-weight: 720;
}

.entry-preview mark {
    border-radius: 0.2em;
    background: color-mix(in srgb, #f0c75e 36%, transparent);
    box-decoration-break: clone;
    color: inherit;
    padding: 0.04em 0.16em;
    -webkit-box-decoration-break: clone;
}

.entry-preview blockquote {
    margin: 0.3em 0 1em;
    padding: 0.15em 0 0.15em 1em;
    border-left: 3px solid color-mix(in srgb, var(--accent) 48%, var(--line));
    color: var(--ink-soft);
}

.entry-preview blockquote > :last-child {
    margin-bottom: 0;
}

.entry-preview code {
    border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
    border-radius: 0.32em;
    background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
    padding: 0.08em 0.32em;
    font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 0.88em;
}

.entry-preview pre {
    overflow-x: auto;
    margin: 0.3em 0 1em;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: var(--surface-muted);
    padding: 0.9rem 1rem;
    line-height: 1.48;
    -webkit-overflow-scrolling: touch;
}

.entry-preview pre code {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    font-size: 0.84rem;
}

.entry-preview hr {
    margin: 1.4em 0;
    border: 0;
    border-top: 1px solid var(--line-strong);
}

.entry-preview img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0.5em auto 1em;
    border-radius: 0.65rem;
}

.entry-preview table {
    width: 100%;
    margin: 0.3em 0 1em;
    border-collapse: collapse;
    font-size: 0.92em;
}

.entry-preview th,
.entry-preview td {
    padding: 0.45em 0.6em;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--focus) 72%, transparent);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--focus) 65%, var(--line));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 17%, transparent);
}

.search input:focus-visible,
#entry-content:focus-visible {
    outline: none;
    box-shadow: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 64rem) {
    body.has-side-editor:not(.has-sticky-overlay-editor) .app-header {
        right: var(--editor-width);
    }

    body.has-side-editor:not(.has-sticky-overlay-editor) .app-content {
        right: var(--editor-width);
    }

    body.has-side-editor:not(.has-sticky-overlay-editor) .content-inner {
        width: min(42rem, calc(100% - 2rem));
    }
}

@media (max-width: 63.99rem) {
    .editor-dialog,
    .editor-dialog.is-expanded,
    .editor-dialog.is-centered {
        top: var(--editor-viewport-top, 0px);
        left: var(--editor-viewport-left, 0px);
        width: var(--editor-viewport-width, 100vw);
        height: var(--editor-viewport-height, 100dvh);
        max-width: var(--editor-viewport-width, 100vw);
        max-height: var(--editor-viewport-height, 100dvh);
        border: 0;
        box-shadow: none;
        animation-name: editor-enter-mobile;
    }

    .editor-dialog.is-centered {
        background: var(--surface);
    }

    .editor-dialog.is-centered .editor {
        width: 100%;
        border-inline: 0;
    }

    .expand-action {
        display: none;
    }

    body.has-side-editor .app-content {
        visibility: hidden;
    }
}

@media (max-width: 35rem) {
    :root {
        --header-height: 3.65rem;
    }

    .header-inner {
        width: calc(100% - 0.75rem);
        gap: 0.3rem;
    }

    .search {
        height: 2.55rem;
        padding-inline: 0.65rem;
    }

    .search input {
        padding-inline: 0.5rem;
        font-size: max(16px, 1rem);
    }

    .add-action {
        width: 2.6rem;
        height: 2.6rem;
        min-height: 2.6rem;
        justify-content: center;
        padding: 0;
    }

    .icon-action {
        width: 2.6rem;
        height: 2.6rem;
    }

    .content-inner {
        width: calc(100% - 1.2rem);
        padding-top: 0.35rem;
    }

    .summary-view {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .summary-section,
    .stats-view,
    .path-management-view {
        border-radius: 0.75rem;
    }

    .stats-table th,
    .stats-table td {
        padding: 0.68rem 0.5rem;
    }

    .path-management-form {
        padding-left: 0.7rem;
    }

    .entry-card-open {
        padding-block: 0.9rem;
    }

    .entry-card:hover,
    .entry-card.is-active {
        padding-inline: 0.15rem;
        background: transparent;
    }

    .entry-card.is-selected,
    .entry-card.is-selected:hover {
        background: color-mix(in srgb, var(--accent) 10%, var(--surface));
        box-shadow: inset 3px 0 0 var(--accent);
    }

    .menu-dialog,
    .path-switcher-dialog,
    .confirm-dialog,
    .rename-file-dialog,
    .delete-file-dialog,
    .created-date-dialog,
    .settings-dialog {
        width: 100vw;
        max-width: none;
        margin: auto 0 0;
        border: 0;
        border-radius: 1rem 1rem 0 0;
    }

    .menu-dialog[open],
    .path-switcher-dialog[open],
    .confirm-dialog[open],
    .rename-file-dialog[open],
    .delete-file-dialog[open],
    .created-date-dialog[open],
    .settings-dialog[open] {
        animation-name: sheet-enter;
    }

    .history-dialog,
    .files-dialog {
        width: calc(100vw - 1rem);
        height: calc(100dvh - 1rem);
    }

    .file-drop-zone {
        min-height: 6.2rem;
    }

    .file-item {
        grid-template-columns: 3rem minmax(0, 1fr) auto;
        gap: 0.5rem;
    }

    .file-thumbnail {
        width: 3rem;
        height: 3rem;
    }

    .menu-sheet {
        padding: 0.85rem 0.85rem max(1rem, env(safe-area-inset-bottom));
    }

    .path-switcher-sheet {
        padding: 0.7rem 0.7rem max(0.85rem, env(safe-area-inset-bottom));
    }

    .editor-header {
        min-height: calc(3.15rem + env(safe-area-inset-top));
        padding-top: max(0.3rem, env(safe-area-inset-top));
    }

    .path-field {
        width: min(12rem, 48vw);
    }

    .autocomplete-filter {
        font-size: max(16px, 1rem);
    }

    .autocomplete-option {
        min-height: 2.9rem;
        font-size: 0.88rem;
    }

    #entry-content {
        padding-inline: 0.9rem;
        font-size: max(16px, 1rem);
    }

    .entry-preview {
        padding-inline: 1rem;
        font-size: max(16px, 1rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
