:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7fb;
    color: #1d2433;
    --surface: #ffffff;
    --surface-muted: #f7f8fb;
    --border: #e1e5ec;
    --border-strong: #cfd5df;
    --text-muted: #687386;
    --accent: #4f63d9;
    --accent-soft: #eef0ff;
    --danger: #b42318;
    --success: #238636;
    --tag: #94DE60;
    --sidebar: #171b2a;
    --sidebar-text: #dfe4f1;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f5f7fb; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.page-container {
    width: min(92%, 42rem);
    margin: 4rem auto;
}

.form-card, .note-card {
    padding: 1.5rem;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 0.3rem 1.2rem rgb(0 0 0 / 8%);
}

form { display: grid; gap: 0.75rem; }
input, textarea, select, button {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.72rem 0.8rem;
    background: #fff;
    color: inherit;
}
button { cursor: pointer; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
    outline: 3px solid rgb(79 99 217 / 22%);
    outline-offset: 1px;
    border-color: var(--accent);
}

.form-error {
    padding: 0.75rem;
    border-radius: 8px;
    background: #fff0f0;
    color: #8a1c1c;
}

.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;
}

.workspace-body { overflow: hidden; }
.notes-workspace {
    display: grid;
    grid-template-columns: 15.5rem minmax(17rem, 22rem) minmax(32rem, 1fr);
    width: 100vw;
    height: 100vh;
    min-height: 42rem;
    background: var(--surface);
}

.app-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.2rem 1rem;
    overflow-y: auto;
    background: var(--sidebar);
    color: var(--sidebar-text);
}
.brand-block { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.25rem; }
.brand-block > div:last-child { display: grid; gap: 0.1rem; min-width: 0; }
.brand-block strong { font-size: 0.98rem; }
.brand-block span { color: #8f99ae; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; }
.brand-mark {
    display: grid;
    width: 2.1rem;
    height: 2.1rem;
    place-items: center;
    border-radius: 0.65rem;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}
.primary-action {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 2.55rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.7rem;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}
.sidebar-nav { display: grid; gap: 0.15rem; margin-top: 1rem; }
.sidebar-nav a, .sidebar-links a {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.58rem 0.68rem;
    border-radius: 0.55rem;
    color: #b8c0d2;
    text-decoration: none;
    font-size: 0.9rem;
}
.sidebar-nav a:hover, .sidebar-links a:hover, .sidebar-nav a.active, .sidebar-links a.active {
    background: #262c40;
    color: #fff;
}
.sidebar-section { margin-top: 1.35rem; }
.sidebar-heading {
    display: flex;
    justify-content: space-between;
    padding: 0 0.65rem 0.45rem;
    color: #7f899f;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.sidebar-links { display: grid; gap: 0.12rem; }
.sidebar-empty { margin: 0; padding: 0.4rem 0.65rem; color: #717b91; font-size: 0.82rem; }
.notebook-creator { margin-top: 0.35rem; }
.notebook-creator summary { padding: 0.45rem 0.65rem; color: #9aa5bb; cursor: pointer; font-size: 0.82rem; }
.notebook-creator form { grid-template-columns: 1fr auto; gap: 0.4rem; padding: 0.45rem 0.2rem; }
.notebook-creator input, .notebook-creator button { min-width: 0; padding: 0.55rem; border-color: #39415a; background: #202638; color: #fff; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0 0.45rem; }
.tag-cloud a { padding: 0.28rem 0.5rem; border-radius: 999px; background: #252b3e; color: #9fa9bd; font-size: 0.75rem; text-decoration: none; }
.tag-cloud a.active, .tag-cloud a:hover { background: #3a4466; color: #fff; }
.sidebar-logout { margin-top: auto; padding-top: 1.2rem; }
.sidebar-logout button { border-color: #333a50; background: transparent; color: #aeb7ca; }

.note-list-pane {
    display: flex;
    min-width: 0;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface-muted);
}
.search-form { padding: 1rem 1rem 0.45rem; }
.search-form input { width: 100%; border-color: var(--border); background: #fff; }
.list-header { display: flex; align-items: center; justify-content: space-between; padding: 0.45rem 1rem 0.85rem; }
.list-header h1 { margin: 0; font-size: 1.12rem; }
.list-header span { color: var(--text-muted); font-size: 0.75rem; }
.note-list { overflow-y: auto; border-top: 1px solid var(--border); }
.note-list-item {
    display: block;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}
.note-list-item:hover { background: #fff; }
.note-list-item.selected { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.note-list-title-row { display: flex; align-items: center; gap: 0.45rem; }
.note-list-title-row h2 {
    overflow: hidden;
    min-width: 0;
    margin: 0;
    font-size: 0.97rem;
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pin-indicator { color: var(--accent); font-size: 0.62rem; }
.note-excerpt {
    display: -webkit-box;
    overflow: hidden;
    margin: 0.42rem 0 0.6rem;
    color: #5d6778;
    font-size: 0.82rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.note-list-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; color: #8a93a2; font-size: 0.68rem; }
.note-list-meta span:not(:last-child)::after { content: "·"; margin-left: 0.45rem; }
.list-empty { padding: 2rem 1.2rem; color: var(--text-muted); text-align: center; }
.list-empty a { color: var(--accent); }

.editor-pane {
    position: relative;
    min-width: 0;
    overflow-y: auto;
    padding: 1.35rem clamp(1.2rem, 3vw, 3.2rem) 2.2rem;
    background: #fff;
}
.editor-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 62rem; margin: 0 auto 1rem; }
.editor-header h2 { overflow: hidden; margin: 0.12rem 0 0; font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow { color: var(--text-muted); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.editor-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; flex-wrap: wrap; }
.editor-header-actions form { display: block; }
.icon-button {
    display: inline-flex;
    width: auto;
    min-height: 2rem;
    align-items: center;
    padding: 0.4rem 0.62rem;
    border: 1px solid var(--border);
    background: #fff;
    color: #4c5668;
    font-size: 0.76rem;
    text-decoration: none;
}
.save-status { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.save-status[data-state="saved"] { color: var(--success); }
.save-status[data-state="error"] { color: var(--danger); }
.save-status[data-state="warning"] { color: #9a6700; }
.note-editor-form { display: grid; max-width: 62rem; margin: 0 auto; gap: 0; }
.editor-title {
    width: 100%;
    padding: 0.45rem 0 0.8rem;
    border: 0;
    border-radius: 0;
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    font-weight: 760;
    letter-spacing: -0.03em;
}
.editor-title:focus { outline: 0; }
.editor-metadata {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1fr) minmax(12rem, 1.5fr) 7rem;
    gap: 0.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}
.editor-metadata input, .editor-metadata select { min-width: 0; padding: 0.55rem 0.65rem; border-color: var(--border); font-size: 0.78rem; }
.markdown-toolbar { display: flex; flex-wrap: wrap; gap: 0.28rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.markdown-toolbar button { width: auto; min-height: 1.9rem; padding: 0.35rem 0.55rem; border-color: var(--border); background: #fff; color: #4d5769; font-size: 0.75rem; }
.editor-body {
    width: 100%;
    min-height: calc(100vh - 18rem);
    resize: vertical;
    padding: 1.2rem 0;
    border: 0;
    border-radius: 0;
    color: #222a38;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.7;
}
.editor-body:focus { outline: 0; }
.markdown-preview { min-height: calc(100vh - 18rem); padding: 1.2rem 0; }
.editor-footer { display: flex; justify-content: flex-end; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.save-button { width: auto; border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 700; }
.editor-delete-form { display: flex; max-width: 62rem; justify-content: flex-end; margin: 0.4rem auto 0; }
.text-danger-button { width: auto; padding: 0.35rem 0; border: 0; background: transparent; color: var(--danger); font-size: 0.76rem; }
.editor-error { max-width: 62rem; margin: 0 auto 1rem; }
.editor-empty { display: grid; height: 100%; place-content: center; justify-items: center; color: var(--text-muted); text-align: center; }
.editor-empty h2 { margin-bottom: 0; color: #354052; }
.editor-empty .primary-action { margin-top: 0.6rem; }
.empty-icon { font-size: 2.2rem; color: #aab2c0; }
.rendered-note { max-width: 62rem; margin: 0 auto; }
.rendered-note-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.rendered-note-meta span, .note-chip { padding: 0.3rem 0.55rem; border-radius: 999px; background: #eef1f5; color: #5d6879; font-size: 0.75rem; }
.trash-actions { display: flex; max-width: 62rem; gap: 0.6rem; margin: 1.2rem auto; }
.trash-actions form { display: block; }
.danger-button { width: auto; border-color: #f0c4c0; background: #fff5f4; color: var(--danger); }
.muted { color: var(--text-muted); font-size: 0.78rem; }

.markdown-body { overflow-wrap: anywhere; line-height: 1.7; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1.2em 0 0.45em; line-height: 1.25; }
.markdown-body p { margin: 0.75em 0; }
.markdown-body pre { overflow-x: auto; padding: 1rem; border-radius: 8px; background: #151923; color: #e9edf5; }
.markdown-body code { padding: 0.12rem 0.28rem; border-radius: 0.3rem; background: #eef1f5; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body blockquote { margin: 1rem 0; padding: 0.1rem 0 0.1rem 1rem; border-left: 3px solid var(--accent); color: #596375; }
.markdown-body a { color: var(--accent); }
.task-list { padding-left: 0; list-style: none; }
.task-item { display: flex; gap: 0.45rem; align-items: flex-start; }
.task-item input { width: auto; margin-top: 0.35rem; }

.note-title { overflow: hidden; margin: 0; font-size: 1.5rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.note-submission { margin: 0.35rem 0 0; color: #6b7075; font-size: 0.875rem; }
.note-topic-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.note-tags { color: var(--tag); }
.note-separator { margin: 1rem 0; border: 0; border-top: 1px solid #d9dcdf; }
.public-note-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.public-note-nav { margin: 0; }
.public-note-viewer { display: grid; justify-items: end; gap: 0.12rem; line-height: 1.2; }
.public-note-viewer strong { font-size: 0.95rem; }
.public-note-viewer span { color: var(--text-muted); font-size: 0.78rem; }

@media (max-width: 1050px) {
    .notes-workspace { grid-template-columns: 13.5rem 19rem minmax(25rem, 1fr); }
    .editor-metadata { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 780px) {
    .workspace-body { overflow: auto; }
    .notes-workspace { display: block; width: 100%; height: auto; min-height: 100vh; }
    .app-sidebar { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: auto 1fr auto; align-items: center; padding: 0.7rem; overflow: visible; }
    .brand-block { margin: 0; }
    .brand-block > div:last-child, .sidebar-nav, .sidebar-section, .sidebar-logout { display: none; }
    .app-sidebar .primary-action { grid-column: 3; min-height: 2.2rem; padding: 0.5rem 0.7rem; }
    .note-list-pane { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--border); }
    .editor-pane { min-height: 58vh; padding: 1rem; }
    .editor-header { align-items: flex-start; }
    .editor-header-actions { justify-content: flex-start; }
    .editor-metadata { grid-template-columns: 1fr; }
    .editor-body, .markdown-preview { min-height: 50vh; }
}

/* Alpha18 knowledge-management workspace and modal editor */
.workspace-body {
    min-width: 20rem;
    overflow: auto;
    background: #f3f5f9;
}
.notes-workspace {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    width: 100%;
    min-height: 100vh;
    height: auto;
    background: #f3f5f9;
}
.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
}
.notes-dashboard {
    min-width: 0;
    padding: clamp(1rem, 2.5vw, 2.5rem);
}
.dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin: 0 auto 1.5rem;
    max-width: 92rem;
}
.dashboard-header h1 {
    margin: 0.15rem 0 0;
    font-size: clamp(1.55rem, 2.7vw, 2.25rem);
    letter-spacing: -0.025em;
}
.dashboard-header p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.84rem;
}
.dashboard-header .search-form {
    width: min(100%, 28rem);
    padding: 0;
}
.dashboard-header .search-form input {
    width: 100%;
    min-height: 2.75rem;
    border-color: var(--border);
    background: #fff;
    box-shadow: 0 0.2rem 0.7rem rgb(23 31 54 / 5%);
}
.note-groups {
    display: grid;
    max-width: 92rem;
    margin: 0 auto;
    gap: 2rem;
}
.note-group {
    min-width: 0;
}
.note-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.note-group-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 780;
    letter-spacing: 0.01em;
}
.note-group-header span {
    display: inline-grid;
    min-width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    border-radius: 999px;
    background: #e7eaf1;
    color: #667085;
    font-size: 0.72rem;
    font-weight: 700;
}
.note-group-action {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}
.note-group-action:hover { text-decoration: underline; }
.note-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
    gap: 1rem;
}
.note-card-tile {
    display: flex;
    height: 16.5rem;
    min-width: 0;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: inherit;
    box-shadow: 0 0.22rem 0.8rem rgb(25 35 55 / 6%);
    text-decoration: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.note-card-tile:hover {
    border-color: #b8c0d4;
    box-shadow: 0 0.6rem 1.4rem rgb(25 35 55 / 11%);
    transform: translateY(-2px);
}
.note-card-tile:focus-visible {
    outline: 3px solid rgb(79 99 217 / 25%);
    outline-offset: 2px;
}
.note-card-topline {
    display: flex;
    min-height: 1.6rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.note-card-tile h3 {
    display: -webkit-box;
    overflow: hidden;
    margin: 0.65rem 0 0;
    font-size: 1.02rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.note-card-excerpt {
    display: -webkit-box;
    overflow: hidden;
    min-height: 4.25rem;
    margin: 0.55rem 0 0;
    color: #5f6979;
    font-size: 0.82rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}
.note-card-classification {
    display: grid;
    margin-top: auto;
    gap: 0.5rem;
}
.note-card-tile footer {
    display: flex;
    min-height: 1.4rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding-top: 0.65rem;
    border-top: 1px solid #edf0f4;
    color: #8992a2;
    font-size: 0.67rem;
}
.pin-badge {
    padding: 0.26rem 0.48rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 750;
}
.notebook-chip {
    display: inline-flex;
    max-width: 11rem;
    align-items: center;
    overflow: hidden;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    background: #eef1f5;
    color: #596476;
    font-size: 0.7rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.muted-chip { color: #8a93a1; }
.topic-badge {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    padding: 0.3rem 0.55rem;
    border: 1px solid #c8d8ff;
    border-radius: 6px;
    background: #edf4ff;
    color: #2457a7;
    font-size: 0.7rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topic-empty {
    border-color: #e2e5ea;
    background: #f7f8fa;
    color: #8a93a1;
}
.card-tags,
.rendered-note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.tag-chip {
    display: inline-flex;
    max-width: 9rem;
    overflow: hidden;
    padding: 0.26rem 0.5rem;
    border: 1px solid #c9e8bc;
    border-radius: 999px;
    background: #eff9ea;
    color: #397322;
    font-size: 0.68rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tag-more { color: #527945; }
.dashboard-empty {
    display: grid;
    min-height: 55vh;
    place-content: center;
    justify-items: center;
    color: var(--text-muted);
    text-align: center;
}
.dashboard-empty h2 { color: #354052; }
.dashboard-empty .primary-action { margin-top: 0.5rem; }

.note-modal-backdrop {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: grid;
    place-items: center;
    padding: clamp(0.75rem, 2.5vw, 2rem);
    background: rgb(17 23 38 / 48%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.note-modal {
    --editor-text-color: #222a38;
    --editor-placeholder-color: #7b8494;
    --editor-background-color: #ffffff;
    display: flex;
    width: min(72rem, 100%);
    max-height: min(90vh, 58rem);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: 14px;
    background: var(--editor-background-color);
    box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 28%);
}
.note-modal.is-expanded {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
}
.modal-shell-header {
    display: flex;
    min-height: 4.15rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #f9fafc;
}
.modal-shell-header h2 {
    overflow: hidden;
    max-width: 48rem;
    margin: 0.12rem 0 0;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-shell-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.modal-icon-button {
    display: inline-grid;
    width: 2.25rem;
    height: 2.25rem;
    min-height: 0;
    place-items: center;
    padding: 0;
    border-color: var(--border);
    background: #fff;
    color: #536071;
    font-weight: 750;
}
.modal-close-button {
    font-size: 1.35rem;
    line-height: 1;
}
.modal-scroll-region {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 1.15rem clamp(1rem, 3vw, 2.6rem) 1.7rem;
    background: var(--editor-background-color);
}
.editor-appearance {
    display: grid;
    grid-template-columns: repeat(4, minmax(8rem, 1fr)) auto;
    align-items: end;
    gap: 0.75rem;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #f4f6fa;
}
.editor-appearance[hidden] { display: none; }
.editor-appearance label {
    display: grid;
    gap: 0.3rem;
    color: #5e6879;
    font-size: 0.72rem;
    font-weight: 700;
}
.editor-appearance input[type="color"] {
    width: 100%;
    height: 2.3rem;
    padding: 0.2rem;
}
.editor-appearance select,
.editor-appearance button {
    min-height: 2.3rem;
    padding: 0.45rem 0.6rem;
}
.editor-header {
    max-width: 66rem;
}
.editor-header h3 {
    overflow: hidden;
    margin: 0.12rem 0 0;
    font-size: 1.05rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.note-editor-form,
.editor-delete-form,
.rendered-note,
.trash-actions,
.editor-error {
    max-width: 66rem;
}
.editor-title,
.editor-body {
    color: var(--editor-text-color);
    background: var(--editor-background-color);
}
.editor-title::placeholder,
.editor-body::placeholder,
.editor-metadata input::placeholder {
    color: var(--editor-placeholder-color);
    opacity: 1;
}
.editor-metadata {
    grid-template-columns: minmax(9rem, 0.9fr) minmax(10rem, 1fr) minmax(15rem, 1.6fr) minmax(7rem, 0.65fr);
    align-items: stretch;
    gap: 0.7rem;
}
.metadata-field {
    display: grid;
    min-width: 0;
    gap: 0.32rem;
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8f9fb;
}
.metadata-field > span {
    font-size: 0.68rem;
    font-weight: 780;
    letter-spacing: 0.02em;
}
.metadata-field input,
.metadata-field select {
    width: 100%;
    padding: 0.45rem 0.5rem;
    border: 0;
    background: #fff;
}
.topic-field {
    border-color: #c9d9ff;
    background: #f1f6ff;
}
.topic-field > span { color: #2457a7; }
.tags-field {
    border-color: #c9e8bc;
    background: #f3faef;
}
.tags-field > span { color: #397322; }
.editor-body {
    min-height: 27rem;
    padding: 1.25rem 0.35rem;
}
.markdown-preview {
    min-height: 27rem;
    color: var(--editor-text-color);
    background: var(--editor-background-color);
}
.code-block {
    position: relative;
    margin: 1rem 0;
    padding-top: 2.1rem !important;
}
.code-language {
    position: absolute;
    top: 0.45rem;
    right: 0.65rem;
    color: #aab5c8;
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.note-modal.code-theme-light .markdown-body pre {
    background: #eef2f7;
    color: #243044;
}
.note-modal.code-theme-light .code-language { color: #657085; }
.syntax-comment { color: #7f8b9f; font-style: italic; }
.syntax-string { color: #d18b47; }
.syntax-keyword { color: #9b7bdc; font-weight: 650; }
.syntax-number { color: #5da7d6; }
.syntax-property { color: #65b5a6; }
.syntax-tag { color: #d97883; }
.note-modal.code-theme-light .syntax-comment { color: #768196; }
.note-modal.code-theme-light .syntax-string { color: #a65a1b; }
.note-modal.code-theme-light .syntax-keyword { color: #6546a8; }
.note-modal.code-theme-light .syntax-number { color: #176b9b; }
.note-modal.code-theme-light .syntax-property { color: #167366; }
.note-modal.code-theme-light .syntax-tag { color: #a62939; }

.unsaved-dialog {
    width: min(92vw, 28rem);
    padding: 1.4rem;
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: #202738;
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 28%);
}
.unsaved-dialog::backdrop {
    background: rgb(9 13 24 / 45%);
    backdrop-filter: blur(2px);
}
.unsaved-dialog h2 {
    margin: 0;
    font-size: 1.15rem;
}
.unsaved-dialog p {
    color: var(--text-muted);
    font-size: 0.84rem;
}
.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-top: 1.1rem;
}
.dialog-actions button { width: 100%; }
.dialog-hint {
    margin-bottom: 0;
    text-align: center;
    font-size: 0.7rem !important;
}

@media (max-width: 1000px) {
    .notes-workspace { grid-template-columns: 13.5rem minmax(0, 1fr); }
    .editor-appearance { grid-template-columns: repeat(2, minmax(8rem, 1fr)); }
    .editor-metadata { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .notes-workspace { display: block; }
    .app-sidebar {
        position: sticky;
        z-index: 10;
        display: grid;
        height: auto;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        padding: 0.7rem;
        overflow: visible;
    }
    .brand-block { margin: 0; }
    .brand-block > div:last-child,
    .sidebar-nav,
    .sidebar-section,
    .sidebar-logout { display: none; }
    .app-sidebar .primary-action {
        grid-column: 3;
        min-height: 2.2rem;
        padding: 0.5rem 0.7rem;
    }
    .notes-dashboard { padding: 1rem; }
    .dashboard-header {
        align-items: stretch;
        flex-direction: column;
    }
    .dashboard-header .search-form { width: 100%; }
    .note-card-grid { grid-template-columns: 1fr; }
    .note-card-tile { height: 15.5rem; }
    .note-modal-backdrop {
        align-items: stretch;
        padding: 0;
    }
    .note-modal {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
    .modal-shell-header { padding-left: 0.85rem; }
    .modal-scroll-region { padding: 1rem; }
    .editor-appearance { grid-template-columns: 1fr 1fr; }
    .editor-metadata { grid-template-columns: 1fr; }
    .editor-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .editor-header-actions { justify-content: flex-start; }
    .editor-body,
    .markdown-preview { min-height: 55vh; }
}

@media (prefers-reduced-motion: reduce) {
    .note-card-tile { transition: none; }
}
.note-modal-backdrop.is-expanded { padding: 0; }

/* Alpha18 knowledge-management workspace */
.dashboard-header-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}
.header-action {
    display: inline-flex;
    min-height: 2.55rem;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--surface-color);
    color: var(--text-color);
    font: inherit;
    font-size: 0.82rem;
    text-decoration: none;
    cursor: pointer;
}
.header-action:hover { border-color: var(--accent-color); color: var(--accent-color); }
.sidebar-tools { margin-top: auto; }

.note-card-wrap {
    position: relative;
    min-width: 0;
}
.note-card-wrap .note-card-tile { width: 100%; }
.note-select-control {
    position: absolute;
    z-index: 3;
    top: 0.75rem;
    right: 0.75rem;
    display: grid;
    width: 1.35rem;
    height: 1.35rem;
    place-items: center;
    border-radius: 0.4rem;
    background: color-mix(in srgb, var(--surface-color) 88%, transparent);
    opacity: 0;
    transition: opacity 120ms ease;
}
.note-card-wrap:hover .note-select-control,
.note-select-control:focus-within,
.note-select-control:has(input:checked) { opacity: 1; }
.note-select-control input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent-color); }
.card-knowledge-indicators {
    display: flex;
    min-height: 1.2rem;
    flex-wrap: wrap;
    gap: 0.65rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}
.bulk-toolbar {
    position: sticky;
    z-index: 8;
    top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.8rem;
    border: 1px solid var(--accent-color);
    border-radius: 0.9rem;
    background: var(--surface-color);
    box-shadow: 0 0.65rem 1.8rem rgba(27, 39, 61, 0.12);
}
.bulk-toolbar[hidden] { display: none; }
.bulk-toolbar label { display: grid; gap: 0.25rem; font-size: 0.72rem; color: var(--text-muted); }
.bulk-toolbar select,
.bulk-toolbar input { min-height: 2.35rem; border: 1px solid var(--border-color); border-radius: 0.6rem; padding: 0.45rem 0.6rem; background: var(--surface-color); color: var(--text-color); }
.text-button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }

.editor-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0 1.15rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
}
.editor-tabs button {
    padding: 0.75rem 0.9rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
}
.editor-tabs button.active { border-bottom-color: var(--accent-color); color: var(--accent-color); font-weight: 700; }
.editor-tabs button span { margin-left: 0.25rem; font-size: 0.7rem; }
.editor-tab-panel.is-hidden { display: none; }
.editor-knowledge-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 1.25rem;
}
.editor-main-column { min-width: 0; }
.knowledge-side-panel {
    display: grid;
    align-content: start;
    gap: 0.9rem;
}
.knowledge-side-panel > section {
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: var(--surface-muted);
}
.knowledge-side-panel h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
}
.side-panel-link,
.side-panel-action {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0;
    color: var(--text-color);
    font-size: 0.78rem;
    text-decoration: none;
}
.side-panel-link + .side-panel-link { border-top: 1px solid var(--border-color); }
.side-panel-link span { color: var(--text-muted); font-size: 0.68rem; }
.side-panel-action { color: var(--accent-color); font-weight: 700; }
.attachment-upload { display: grid; gap: 0.45rem; margin-bottom: 0.7rem; }
.attachment-upload input { width: 100%; font-size: 0.72rem; }
.attachment-upload button { justify-self: start; }
.attachment-list { display: grid; gap: 0.65rem; }
.attachment-list article { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0.55rem; align-items: center; }
.attachment-list article > div { min-width: 0; display: grid; }
.attachment-list img { width: 3rem; height: 3rem; object-fit: cover; border-radius: 0.5rem; }
.attachment-list a { overflow: hidden; color: var(--text-color); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.attachment-list span { color: var(--text-muted); font-size: 0.65rem; }
.attachment-list form { grid-column: 2; }

.save-status[data-state="warning"] { color: #b42318; font-weight: 800; }
.save-status[data-state="error"] { color: #b42318; font-weight: 800; }
.save-status[data-state="saving"] { color: var(--accent-color); font-weight: 700; }
.save-status[data-state="saved"] { color: #24724b; }

.wiki-link-suggestions {
    display: grid;
    max-height: 12rem;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 0 0 0.7rem 0.7rem;
    background: var(--surface-color);
}
.wiki-link-suggestions[hidden] { display: none; }
.wiki-link-suggestions button { padding: 0.55rem 0.7rem; border: 0; border-bottom: 1px solid var(--border-color); background: transparent; color: var(--text-color); text-align: left; cursor: pointer; }
.wiki-link-suggestions button:hover { background: var(--accent-soft); }
.internal-link { color: var(--accent-color); font-weight: 650; text-decoration: none; }
.internal-link.unresolved { border-bottom: 1px dashed #b42318; color: #b42318; }

.code-block {
    margin: 1rem 0;
    overflow: hidden;
    border: 1px solid #2d3440;
    border-radius: 0.75rem;
    background: #10141b;
    color: #e7edf6;
}
.code-block-header {
    display: flex;
    min-height: 2.25rem;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.35rem 0 0.8rem;
    border-bottom: 1px solid #2d3440;
    background: #171d26;
}
.code-language { color: #aeb9c8; font: 700 0.68rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: lowercase; }
.code-copy-button {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: #d9e3ef;
    font: inherit;
    font-size: 0.7rem;
    cursor: pointer;
}
.code-copy-button:hover { background: #283140; }
.code-copy-button.copied { color: #7ee2a8; }
.code-block pre { margin: 0; overflow-x: auto; padding: 0.9rem; background: transparent; }
.code-block code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.78rem; white-space: pre; }
.code-theme-light .code-block { border-color: #cfd6df; background: #f6f8fb; color: #1e2937; }
.code-theme-light .code-block-header { border-color: #cfd6df; background: #e9edf3; }
.code-theme-light .code-language,
.code-theme-light .code-copy-button { color: #475569; }
.syntax-comment { color: #7f8c9d; }
.syntax-string { color: #9ce2a8; }
.syntax-keyword { color: #8cb4ff; }
.syntax-number { color: #f3b77d; }
.syntax-property { color: #d7a7ff; }
.syntax-tag { color: #ff9d9d; }

.preview-shell { max-width: 62rem; margin: 0 auto; }
.history-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; }
.revision-list { display: grid; align-content: start; gap: 0.35rem; }
.revision-list h3 { margin: 0 0 0.5rem; }
.revision-list a { display: grid; gap: 0.15rem; padding: 0.65rem; border: 1px solid var(--border-color); border-radius: 0.65rem; color: var(--text-color); text-decoration: none; }
.revision-list a.active { border-color: var(--accent-color); background: var(--accent-soft); }
.revision-list span { color: var(--text-muted); font-size: 0.68rem; }
.revision-comparison header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.comparison-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.comparison-columns article { min-width: 0; }
.comparison-columns pre { min-height: 20rem; max-height: 55vh; overflow: auto; padding: 0.8rem; border: 1px solid var(--border-color); border-radius: 0.7rem; background: var(--surface-muted); white-space: pre-wrap; }
.history-empty { display: grid; min-height: 18rem; place-content: center; text-align: center; }
.note-modal.focus-mode .knowledge-side-panel,
.note-modal.focus-mode .editor-metadata,
.note-modal.focus-mode .editor-header-actions,
.note-modal.focus-mode .editor-delete-form { display: none; }
.note-modal.focus-mode .editor-knowledge-layout { grid-template-columns: 1fr; }
.note-modal.focus-mode .editor-main-column { max-width: 62rem; margin: 0 auto; width: 100%; }

.command-palette {
    width: min(34rem, calc(100% - 2rem));
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-color);
    color: var(--text-color);
    box-shadow: 0 1rem 3rem rgba(12, 24, 46, 0.25);
}
.command-palette::backdrop { background: rgba(20, 29, 43, 0.38); backdrop-filter: blur(3px); }
.command-palette header { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-color); }
.command-palette h2 { margin: 0; font-size: 1rem; }
.command-palette header button { border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; }
.command-palette > input { width: calc(100% - 2rem); margin: 0.8rem 1rem; padding: 0.7rem; border: 1px solid var(--border-color); border-radius: 0.65rem; }
.command-list { display: grid; padding: 0 0.65rem 0.65rem; }
.command-list button { display: flex; justify-content: space-between; padding: 0.7rem; border: 0; border-radius: 0.55rem; background: transparent; color: var(--text-color); text-align: left; cursor: pointer; }
.command-list button:hover { background: var(--accent-soft); }
kbd { padding: 0.1rem 0.35rem; border: 1px solid var(--border-color); border-radius: 0.3rem; background: var(--surface-muted); color: var(--text-muted); font-size: 0.65rem; }

.tool-page-body { min-height: 100vh; background: var(--page-background); color: var(--text-color); }
.tool-page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border-color); background: var(--surface-color); }
.tool-page-header a { color: var(--accent-color); text-decoration: none; }
.tool-page-header > div { display: grid; text-align: right; }
.tool-page-header span { color: var(--text-muted); font-size: 0.72rem; }
.tool-page { width: min(74rem, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.narrow-tool-page { max-width: 42rem; }
.tool-page-intro { margin-bottom: 1.25rem; }
.tool-page-intro h1 { margin: 0.2rem 0; }
.tool-page-intro p { color: var(--text-muted); }
.tool-grid { display: grid; grid-template-columns: minmax(18rem, 0.8fr) minmax(20rem, 1.2fr); gap: 1rem; align-items: start; }
.tool-card { padding: 1rem; border: 1px solid var(--border-color); border-radius: 0.9rem; background: var(--surface-color); }
.template-form { display: grid; gap: 0.75rem; }
.template-form label,
.import-form label,
.invitation-form label { display: grid; gap: 0.3rem; font-size: 0.78rem; font-weight: 700; }
.template-form input,
.template-form select,
.template-form textarea,
.import-form input,
.invitation-form input { width: 100%; padding: 0.65rem; border: 1px solid var(--border-color); border-radius: 0.6rem; background: var(--surface-color); color: var(--text-color); font: inherit; font-weight: 400; }
.template-list,
.invitation-list { display: grid; gap: 0.8rem; }
.template-card pre { max-height: 12rem; overflow: auto; white-space: pre-wrap; color: var(--text-muted); }
.template-actions,
.invitation-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.form-success { padding: 0.75rem; border: 1px solid #80c59d; border-radius: 0.65rem; background: #eaf8ef; color: #175b35; }
.import-form,
.invitation-form { display: grid; gap: 0.8rem; }
.invitation-row > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.invitation-row p { color: var(--text-muted); font-size: 0.75rem; }
.status-badge { padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; }
.status-pending { background: #fff2cc; color: #765600; }
.status-accepted { background: #dcf7e6; color: #17613a; }
.status-expired { background: #eef0f4; color: #596273; }
.status-revoked { background: #fde6e3; color: #9d2c22; }

@media (max-width: 1050px) {
    .editor-knowledge-layout { grid-template-columns: 1fr; }
    .knowledge-side-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .history-layout { grid-template-columns: 12rem minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .dashboard-header-controls { align-items: stretch; flex-direction: column; }
    .dashboard-header-controls .search-form { width: 100%; }
    .bulk-toolbar { position: static; align-items: stretch; flex-direction: column; }
    .knowledge-side-panel { grid-template-columns: 1fr; }
    .history-layout,
    .comparison-columns,
    .tool-grid { grid-template-columns: 1fr; }
    .revision-list { max-height: 14rem; overflow-y: auto; }
    .editor-tabs { overflow-x: auto; }
    .note-select-control { opacity: 1; }
}

/* Alpha18 code-block header owns label and copy-button placement. */
.code-block { padding-top: 0 !important; }
.code-block-header .code-language {
    position: static;
    inset: auto;
    margin: 0;
    letter-spacing: 0.04em;
}

/* Alpha18-r1 interface refinement */
.dashboard-header-controls {
    min-width: min(100%, 28rem);
}
.dashboard-header-controls .search-form {
    margin-left: auto;
}

.note-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}
.note-card-tile {
    height: 19.5rem;
    padding: 1.1rem;
}
.note-card-tile h3 {
    min-height: 2.85rem;
    margin-top: 0.7rem;
    color: #202a3b;
    font-size: 1.08rem;
    font-weight: 820;
    line-height: 1.32;
}
.note-card-excerpt {
    min-height: 4.2rem;
    -webkit-line-clamp: 3;
}
.card-knowledge-indicators {
    min-height: 1.15rem;
}

.editor-command-bar {
    display: flex;
    min-height: 3.45rem;
    align-items: stretch;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1rem 0 1.15rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
}
.editor-command-bar .editor-tabs {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
}
.editor-primary-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
}
.editor-primary-actions form {
    display: flex;
    margin: 0;
}
.editor-save-button,
.editor-trash-button {
    min-height: 2.25rem;
    padding: 0.45rem 0.78rem;
    border-radius: 0.55rem;
    font-size: 0.76rem;
}
.editor-trash-button {
    border-color: #e9b5b1;
    background: #fff3f2;
    color: #b42318;
    font-weight: 720;
}
.editor-footer,
.editor-delete-form {
    display: none;
}

.modal-shell-header {
    min-height: 3.85rem;
    padding-right: 0.85rem;
}
.modal-shell-actions {
    gap: 0.45rem;
}
.modal-icon-button {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.62rem;
}
.modal-icon-button svg {
    width: 1.12rem;
    height: 1.12rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mode-icon-button[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--accent-color) 45%, var(--border-color));
    background: var(--accent-soft);
    color: var(--accent-color);
}
.restore-window-icon {
    display: none;
}
#modal-expand[aria-pressed="true"] .expand-window-icon {
    display: none;
}
#modal-expand[aria-pressed="true"] .restore-window-icon {
    display: block;
}

.modal-scroll-region {
    padding-right: 0.65rem;
    padding-left: clamp(1rem, 2.3vw, 2.15rem);
}
.editor-knowledge-layout {
    grid-template-columns: minmax(0, 1fr) 19rem;
    gap: 0.85rem;
}
.knowledge-side-panel {
    margin-right: 0;
}
.knowledge-side-panel > section {
    border-radius: 0.75rem;
    background: #f6f7fa;
}

.attachment-upload {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    margin-bottom: 0.8rem;
}
.attachment-file-input {
    position: absolute;
    width: 1px !important;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}
.attachment-picker-button {
    justify-self: start;
    min-height: 2.15rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.55rem;
    background: #fff;
    color: var(--text-color);
    font-weight: 700;
    cursor: pointer;
}
.attachment-picker-button:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.attachment-picker-button:disabled {
    cursor: wait;
    opacity: 0.65;
}
.attachment-upload-status {
    min-width: 0;
    color: var(--text-muted);
    font-size: 0.7rem;
}
.attachment-upload-status[data-state="success"] {
    color: #24724b;
    font-weight: 700;
}
.attachment-upload-status[data-state="error"] {
    color: #b42318;
    font-weight: 700;
}

@media (max-width: 1180px) {
    .note-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .editor-knowledge-layout { grid-template-columns: minmax(0, 1fr) 17rem; }
}
@media (max-width: 760px) {
    .note-card-grid { grid-template-columns: 1fr; }
    .note-card-tile { height: 19.5rem; }
    .editor-command-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 0;
        padding: 0 0.75rem 0.7rem;
    }
    .editor-primary-actions {
        justify-content: flex-end;
        padding-top: 0.55rem;
        border-top: 1px solid var(--border-color);
    }
    .editor-primary-actions .save-status { margin-right: auto; }
    .modal-scroll-region { padding-right: 0.75rem; padding-left: 0.75rem; }
}
@media (max-width: 1050px) {
    .editor-knowledge-layout { grid-template-columns: 1fr; }
    .knowledge-side-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .knowledge-side-panel { grid-template-columns: 1fr; }
}

/* Alpha18-r2 corrected editor layout, based on the approved reference */
.note-modal {
    width: min(72rem, 100%);
    max-height: min(92vh, 58rem);
}
.modal-shell-header {
    min-height: 3.9rem;
    padding: 0.8rem 0.9rem 0.8rem 1.25rem;
}
.modal-shell-header > .eyebrow {
    color: #657084;
    font-size: 0.72rem;
    font-weight: 820;
}
.modal-shell-actions {
    gap: 0.42rem;
}
.modal-icon-button {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.58rem;
    color: #536071;
}
.modal-close-button {
    font-size: 1.25rem;
    font-weight: 700;
}

.editor-command-bar {
    min-height: 3.55rem;
    align-items: center;
    padding: 0 1rem 0 1.15rem;
}
.editor-command-bar .editor-tabs {
    flex: 0 0 auto;
}
.editor-primary-actions {
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 0;
}
.editor-note-actions,
.editor-commit-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.editor-note-actions {
    margin-left: auto;
}
.editor-commit-actions {
    margin-left: clamp(1rem, 4vw, 4rem);
}
.editor-note-actions form,
.editor-commit-actions form {
    display: flex;
    margin: 0;
}
.compact-action-button {
    display: inline-flex;
    min-height: 2.15rem;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.62rem;
    border: 1px solid var(--border);
    border-radius: 0.48rem;
    background: #fff;
    color: #526075;
    font-size: 0.72rem;
    line-height: 1;
    text-decoration: none;
}
.compact-action-button:hover {
    border-color: #aeb8cb;
    color: #263247;
}
.editor-save-button,
.editor-trash-button {
    min-height: 2.25rem;
    padding: 0.48rem 0.82rem;
    border-radius: 0.48rem;
    font-size: 0.76rem;
}
.editor-trash-button {
    border-color: #df4d4d;
    background: #df4d4d;
    color: #fff;
}
.editor-trash-button:hover {
    border-color: #c93c3c;
    background: #c93c3c;
}

.modal-scroll-region {
    padding: 1.05rem 0.45rem 1.5rem 1.25rem;
}
.editor-knowledge-layout {
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 1rem;
}
.editor-main-column {
    padding-right: 0.1rem;
}
.knowledge-side-panel {
    margin-right: 0;
    padding-right: 0.3rem;
}
.knowledge-side-panel > section {
    border: 0;
    border-radius: 0.72rem;
    background: #f6f7fa;
}
.note-editor-form {
    max-width: none;
}
.editor-title {
    padding-top: 0.25rem;
    font-size: clamp(1.8rem, 3vw, 2.35rem);
}
.editor-body {
    min-height: 27rem;
}

.attachment-upload {
    display: block;
    margin-bottom: 0.75rem;
}
.attachment-upload-control {
    display: flex;
    min-width: 0;
    min-height: 2.45rem;
    align-items: center;
    gap: 0.45rem;
    padding: 0.28rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    background: #fff;
}
.attachment-picker-button {
    min-height: 1.8rem;
    padding: 0.32rem 0.58rem;
    border-radius: 0.38rem;
    font-size: 0.7rem;
}
.attachment-upload-status {
    overflow: hidden;
    min-width: 0;
    flex: 1;
    color: #667085;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-list article {
    position: relative;
    grid-template-columns: 3rem minmax(0, 1fr);
    min-height: 3.5rem;
    padding: 0.35rem 1.75rem 0.35rem 0.35rem;
    border: 1px solid #e2e6ed;
    border-radius: 0.6rem;
    background: #fff;
}
.attachment-list article.attachment-item-no-preview > div {
    grid-column: 1 / -1;
}
.attachment-list article > div {
    padding-right: 0.2rem;
}
.attachment-list form.attachment-remove-form {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    display: block;
    margin: 0;
}
.attachment-remove-button {
    display: inline-grid;
    width: 1.35rem;
    height: 1.35rem;
    min-height: 0;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: #d92d20;
    font-size: 1.05rem;
    font-weight: 850;
    line-height: 1;
}
.attachment-remove-button:hover,
.attachment-remove-button:focus-visible {
    background: #fff0ef;
    color: #b42318;
}
.attachment-remove-button:disabled {
    cursor: wait;
    opacity: 0.55;
}

@media (max-width: 1050px) {
    .editor-primary-actions {
        flex-wrap: wrap;
        row-gap: 0.35rem;
    }
    .editor-commit-actions {
        margin-left: 0.8rem;
    }
}
@media (max-width: 820px) {
    .editor-command-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 0;
        padding: 0 0.75rem 0.7rem;
    }
    .editor-primary-actions {
        justify-content: space-between;
        padding-top: 0.55rem;
        border-top: 1px solid var(--border);
    }
    .editor-note-actions {
        margin-left: 0;
        flex-wrap: wrap;
    }
    .editor-commit-actions {
        margin-left: auto;
    }
    .editor-knowledge-layout {
        grid-template-columns: 1fr;
    }
    .knowledge-side-panel {
        grid-template-columns: 1fr;
        padding-right: 0;
    }
}

/* Alpha18-r4 compact template library */
.template-workspace-shell { grid-template-columns: 15.5rem minmax(0, 1fr); }
.template-dashboard { min-width: 0; padding: 1.1rem clamp(1rem, 2.5vw, 2.5rem) 3rem; }
.template-dashboard .tool-page-header {
    width: min(88rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0 0 0.9rem;
    border-bottom: 0;
    background: transparent;
}
.back-to-notes-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    background: var(--surface-color);
    color: var(--text-color) !important;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 0.15rem 0.45rem rgba(12, 24, 46, 0.05);
}
.back-to-notes-button:hover { border-color: var(--accent-color); background: var(--accent-soft); }
.back-to-notes-button > span:first-child { color: var(--accent-color); font-size: 1rem; }
.tool-account { display: grid; text-align: right; }
.template-library-page { width: min(88rem, calc(100% - 2rem)); padding-top: 1.35rem; }
.template-page-heading,
.template-section-heading,
.template-form-actions,
.selected-template-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.template-page-heading { margin-bottom: 1rem; }
.template-page-heading h1 { margin: 0.18rem 0; }
.template-page-heading p,
.template-section-heading p,
.template-library-heading p,
.selected-template-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.template-count-badge {
    flex: 0 0 auto;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
}
.template-library-shell {
    display: grid;
    grid-template-columns: 19rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.template-library-column,
.template-create-card,
.selected-template-card {
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
    background: var(--surface-color);
    box-shadow: 0 0.25rem 0.8rem rgba(12, 24, 46, 0.04);
}
.template-library-column {
    display: grid;
    gap: 1rem;
    padding: 0.85rem;
}
.template-library-section { display: grid; gap: 0.65rem; }
.template-library-section + .template-library-section {
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
}
.template-library-heading h2,
.template-section-heading h2,
.selected-template-header h2 {
    margin: 0 0 0.18rem;
    font-size: 1rem;
}
.template-library-list { display: grid; grid-template-columns: 1fr; gap: 0.55rem; }
.template-library-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 4.6rem;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--surface-muted);
    color: var(--text-color);
    text-decoration: none;
}
.template-library-item:hover {
    border-color: var(--accent-color);
    background: var(--accent-soft);
}
.template-library-item.is-selected {
    border-color: var(--accent-color);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent-color);
}
.template-library-icon {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.6rem;
    background: var(--accent-soft);
    color: var(--accent-color);
    font-size: 0.78rem;
    font-weight: 800;
}
.template-library-icon.saved { background: #edf8f1; color: #267044; }
.template-library-copy { display: grid; gap: 0.25rem; min-width: 0; }
.template-library-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.84rem;
}
.template-library-copy span {
    overflow: hidden;
    color: var(--text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
}
.template-library-status {
    padding: 0.25rem 0.42rem;
    border-radius: 999px;
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 700;
}
.template-library-empty {
    display: grid;
    gap: 0.25rem;
    padding: 0.8rem;
    border: 1px dashed #bec8d7;
    border-radius: 0.75rem;
    background: var(--surface-muted);
}
.template-library-empty strong { font-size: 0.8rem; }
.template-library-empty span { color: var(--text-muted); font-size: 0.7rem; line-height: 1.4; }
.template-content-column { display: grid; grid-template-columns: 1fr; gap: 1rem; min-width: 0; }
.template-create-card,
.selected-template-card { padding: 0.95rem; }
.template-section-heading { margin-bottom: 0.75rem; }
.compact-template-form { display: grid; gap: 0.65rem; }
.template-form-row { display: grid; gap: 0.65rem; }
.template-form-row-primary { grid-template-columns: 1fr 1fr; }
.template-form-row-meta { grid-template-columns: 1fr 1.25fr 1fr 0.75fr; }
.compact-template-form label { color: var(--text-color); }
.compact-template-form input,
.compact-template-form select,
.compact-template-form textarea {
    border: 1px solid #cbd3df;
    background: #fbfcfe;
    box-shadow: inset 0 1px 2px rgba(12, 24, 46, 0.03);
}
.compact-template-form input:focus,
.compact-template-form select:focus,
.compact-template-form textarea:focus {
    border-color: var(--accent-color);
    outline: 2px solid var(--accent-soft);
    outline-offset: 1px;
}
.template-body-field textarea { min-height: 11rem; resize: vertical; }
.template-form-actions { padding-top: 0.1rem; }
.template-form-actions > span { color: var(--text-muted); font-size: 0.7rem; }
.selected-template-card { display: grid; gap: 0.85rem; }
.selected-template-header { align-items: flex-start; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-color); }
.selected-template-title-group { display: flex; align-items: flex-start; gap: 0.7rem; min-width: 0; }
.selected-template-title-group > div { min-width: 0; }
.selected-template-title-group h2 { margin-top: 0.12rem; }
.selected-template-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.55rem; }
.selected-template-actions form { margin: 0; }
.selected-template-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}
.template-readonly-field,
.selected-template-body {
    display: grid;
    gap: 0.35rem;
    padding: 0.7rem;
    border: 1px solid #cbd3df;
    border-radius: 0.65rem;
    background: #fbfcfe;
}
.template-readonly-field > span,
.selected-template-body > span {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}
.template-readonly-field strong { font-size: 0.8rem; overflow-wrap: anywhere; }
.selected-template-body pre {
    min-height: 17rem;
    max-height: 30rem;
    margin: 0;
    padding: 0.8rem;
    border: 1px solid #d6dce6;
    border-radius: 0.55rem;
    background: var(--surface-color);
    color: var(--text-color);
    overflow: auto;
    white-space: pre-wrap;
    font-size: 0.76rem;
    line-height: 1.55;
}
.template-selection-empty {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    min-height: 20rem;
    align-content: center;
    padding: 2rem 1rem;
    border: 1px dashed #bec8d7;
    border-radius: 0.8rem;
    background: var(--surface-muted);
    text-align: center;
}
.template-selection-empty h2 { margin: 0.25rem 0 0; }
.template-selection-empty p { max-width: 22rem; margin: 0; color: var(--text-muted); font-size: 0.78rem; }
.template-empty-icon {
    display: grid;
    place-items: center;
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-color);
    font-size: 1.4rem;
}
.secondary-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.15rem;
    padding: 0.42rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.55rem;
    background: var(--surface-color);
    color: var(--text-color);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.secondary-action-button:hover { border-color: var(--accent-color); color: var(--accent-color); }
.secondary-action-button.is-added,
.secondary-action-button:disabled { border-color: #b8d8c3; background: #edf8f1; color: #267044; cursor: default; }
@media (max-width: 1080px) {
    .template-library-shell { grid-template-columns: 16.5rem minmax(0, 1fr); }
    .selected-template-fields { grid-template-columns: 1fr 1fr; }
    .template-form-row-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
    .template-library-shell { grid-template-columns: 1fr; }
    .template-library-column { grid-template-columns: 1fr 1fr; align-items: start; }
    .template-library-section + .template-library-section { padding-top: 0; padding-left: 0.9rem; border-top: 0; border-left: 1px solid var(--border-color); }
}
@media (max-width: 700px) {
    .template-library-page { width: min(100% - 1rem, 88rem); }
    .template-page-heading,
    .template-section-heading,
    .template-form-actions,
    .selected-template-header { align-items: flex-start; flex-direction: column; }
    .template-count-badge { align-self: flex-start; }
    .template-library-column { grid-template-columns: 1fr; }
    .template-library-section + .template-library-section { padding-top: 0.9rem; padding-left: 0; border-top: 1px solid var(--border-color); border-left: 0; }
    .template-form-row-primary,
    .template-form-row-meta,
    .selected-template-fields { grid-template-columns: 1fr; }
    .selected-template-actions { justify-content: flex-start; }
}
.template-library-copy strong { white-space: normal; line-height: 1.25; }
.selected-template-actions a.save-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.15rem;
    padding: 0.42rem 0.7rem;
    border: 1px solid var(--accent);
    border-radius: 0.55rem;
    text-decoration: none;
}

/* Alpha18-r6: one-time account-registration completion page. */
.account-created-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgb(255 255 255 / 78%), transparent 34rem),
        #f4f6fa;
}

.account-created-page {
    display: grid;
    width: 100%;
    min-height: 100vh;
    place-items: start center;
    padding: clamp(3.75rem, 8vh, 6rem) 1.25rem 2rem;
}

.account-created-card {
    display: grid;
    width: min(100%, 39rem);
    gap: 1rem;
    padding: clamp(1.6rem, 4vw, 2.25rem);
    border: 1px solid #e5e9f0;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 0.65rem 1.8rem rgb(24 34 55 / 9%);
}

.account-created-icon {
    display: grid;
    width: 2.65rem;
    height: 2.65rem;
    place-items: center;
    border-radius: 999px;
    background: #edf8f1;
    color: #267044;
    font-size: 1.35rem;
    font-weight: 800;
}

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

.account-created-card h1 {
    margin: 0;
    color: #172033;
    font-size: clamp(1.75rem, 4vw, 2.15rem);
    line-height: 1.15;
}

.account-created-message {
    margin: 0.7rem 0 0;
    color: #4f5b6d;
    line-height: 1.6;
}

.account-created-status {
    padding: 0.8rem 0.9rem;
    border: 1px solid #dfe4ec;
    border-radius: 0.65rem;
    background: #f8f9fc;
    color: #596579;
    font-size: 0.88rem;
}

.account-created-status strong {
    color: #202a3d;
    font-variant-numeric: tabular-nums;
}

.account-created-action {
    display: inline-flex;
    width: fit-content;
    min-height: 2.55rem;
    align-items: center;
    justify-content: center;
    padding: 0.68rem 1rem;
    border: 1px solid var(--accent);
    border-radius: 0.65rem;
    background: var(--accent);
    color: #fff;
    font-weight: 750;
    text-decoration: none;
}

.account-created-action:hover {
    filter: brightness(0.97);
}

.account-created-noscript {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.account-created-noscript a {
    color: var(--accent);
}

@media (max-width: 34rem) {
    .account-created-page {
        padding-top: 2rem;
    }

    .account-created-card {
        padding: 1.35rem;
    }

    .account-created-action {
        width: 100%;
    }
}

/* Member-visible public notes stay visually distinct from the owner's editable notes. */
.shared-public-note-card .note-card-tile {
    border-color: #cad8ff;
    background: #fbfcff;
}
.shared-public-note-card .notebook-chip,
.public-identity-chip {
    background: #edf4ff;
    color: #2457a7;
}

/* Authentication verification recovery and progressive resend cooldowns. */
.verification-card { max-width: 42rem; }
.form-notice {
    padding: 0.75rem;
    border-radius: 8px;
    background: #edf8f1;
    color: #267044;
}
.verification-status,
.verification-attempts,
.verification-cooldown,
.verification-lockout { margin: 0.75rem 0; }
.verification-status.is-warning,
.verification-lockout {
    padding: 0.75rem;
    border-radius: 8px;
    background: #fff7e8;
    color: #7a4b00;
}
.verification-recovery {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.verification-recovery form { margin-top: 0.55rem; }
.secondary-button {
    width: 100%;
    border-color: var(--border-strong);
    background: var(--surface-muted);
}
.secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}
.verification-cooldown {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Alpha18-r15 profile, public-member discovery, and three-card sidebar refinement */
.refined-sidebar {
    gap: 0.8rem;
    padding: 0.85rem;
}
.sidebar-card {
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem;
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 12px;
}
.sidebar-card-user { background: linear-gradient(180deg, rgb(79 99 217 / 18%), rgb(79 99 217 / 7%)); }
.sidebar-card-public { background: linear-gradient(180deg, rgb(46 139 116 / 18%), rgb(46 139 116 / 7%)); }
.sidebar-card-tools { background: linear-gradient(180deg, rgb(154 90 199 / 17%), rgb(154 90 199 / 7%)); }
.sidebar-card-title {
    color: #aeb8cf;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.sidebar-profile-button {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.35rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}
.sidebar-avatar-wrap {
    position: relative;
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
}
.sidebar-avatar {
    width: 2rem;
    height: 2rem;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 50%;
    object-fit: cover;
    transition: filter 150ms ease, opacity 150ms ease;
}
.sidebar-avatar-edit {
    position: absolute;
    right: -0.35rem;
    top: 50%;
    display: grid;
    width: 1.05rem;
    height: 1.05rem;
    place-items: center;
    border-radius: 50%;
    background: #f8fafc;
    color: #354052;
    font-size: 0.65rem;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 150ms ease;
}
.sidebar-profile-button:hover .sidebar-avatar { filter: brightness(0.58); }
.sidebar-profile-button:hover .sidebar-avatar-edit,
.sidebar-profile-button:focus-visible .sidebar-avatar-edit { opacity: 1; }
.sidebar-profile-copy { display: grid; min-width: 0; gap: 0.08rem; }
.sidebar-profile-copy strong { font-size: 0.88rem; }
.sidebar-profile-copy span {
    overflow: hidden;
    color: #aeb8cf;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-subsection { display: grid; gap: 0.35rem; padding-top: 0.35rem; border-top: 1px solid rgb(255 255 255 / 7%); }
.refined-sidebar .sidebar-nav { margin-top: 0; }
.refined-sidebar .sidebar-logout { margin-top: 0.2rem; padding-top: 0.55rem; }
.refined-sidebar .sidebar-logout button { min-height: 2.1rem; }

.note-group-meta { display: flex; align-items: center; gap: 0.6rem; }
.user-note-groups { padding-bottom: 2rem; }
.public-member-discovery {
    max-width: 92rem;
    margin: 2.2rem auto 0;
    padding-top: 1.4rem;
    border-top: 4px solid #38a27d;
}
.public-member-discovery-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.public-member-discovery-header h2 { margin: 0.15rem 0 0; font-size: 1.15rem; }
.public-member-discovery-header > span { color: var(--text-muted); font-size: 0.78rem; }
.public-member-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(7.5rem, 1fr));
    gap: 0.75rem;
}
.public-member-card {
    display: grid;
    min-width: 0;
    justify-items: center;
    gap: 0.42rem;
    padding: 0.75rem 0.55rem;
    border: 1px solid #dce5e1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 0.2rem 0.65rem rgb(25 35 55 / 5%);
    text-align: center;
}
.public-member-card strong {
    width: 100%;
    overflow: hidden;
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.public-member-card img {
    width: 60px;
    height: 60px;
    border: 2px solid #e6ece9;
    border-radius: 50%;
    object-fit: cover;
}
.public-member-card span { color: #737d8d; font-size: 0.67rem; line-height: 1.25; }
.public-member-card a {
    margin-top: 0.15rem;
    color: #26785f;
    font-size: 0.72rem;
    font-weight: 800;
    text-decoration: none;
}
.public-member-card a:hover { text-decoration: underline; }

.note-card-excerpt {
    min-height: 1.65rem;
    max-height: 1.65rem;
    -webkit-line-clamp: 1;
}
.note-card-classification { min-height: 4.2rem; align-content: start; }
.note-card-classification .topic-badge { justify-self: start; min-height: 1.75rem; }
.card-tags { min-height: 1.75rem; }

.profile-dialog {
    width: min(92vw, 34rem);
    max-height: 88vh;
    padding: 1.25rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1.4rem 4rem rgb(17 24 39 / 24%);
}
.profile-dialog::backdrop { background: rgb(15 23 42 / 48%); }
.profile-dialog > header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.profile-dialog h2 { margin: 0.15rem 0 0; }
.profile-dialog-close { width: 2.1rem; height: 2.1rem; padding: 0; border-radius: 50%; }
.profile-avatar-editor { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.profile-avatar-editor img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; }
.profile-avatar-editor div { display: grid; gap: 0.2rem; }
.profile-avatar-editor span { color: var(--text-muted); font-size: 0.75rem; }
.profile-avatar-form, .profile-details-form, .profile-reset-form { margin-top: 0.85rem; }
.profile-details-form label, .profile-avatar-form label { display: grid; gap: 0.35rem; }
.profile-details-form small { color: var(--text-muted); font-size: 0.72rem; line-height: 1.35; }
.profile-details-form input[readonly] { background: #f3f4f6; color: #667085; }
.form-notice { padding: 0.75rem; border-radius: 8px; background: #eaf7ef; color: #216e3a; }

.public-member-body .page-container { width: min(92%, 92rem); margin: 2rem auto 4rem; }
.public-member-profile-heading { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 2rem; }
.public-member-profile-heading h1 { margin: 0.1rem 0; }
.public-member-profile-heading p { margin: 0; color: var(--text-muted); }
.public-member-heading-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.public-member-note-groups { max-width: none; }

@media (max-width: 1180px) {
    .public-member-grid { grid-template-columns: repeat(5, minmax(7.5rem, 1fr)); }
}
@media (max-width: 900px) {
    .public-member-grid { grid-template-columns: repeat(3, minmax(7.5rem, 1fr)); }
}
@media (max-width: 640px) {
    .public-member-grid { grid-template-columns: repeat(2, minmax(7.5rem, 1fr)); }
}

/* Alpha18-r15: reserve one clean row for the note-body preview. */
.note-card-excerpt {
    display: block;
    height: 1.5rem;
    min-height: 1.5rem;
    max-height: 1.5rem;
    overflow: hidden;
    line-height: 1.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    -webkit-line-clamp: unset;
}


/* Alpha18-r21: compact unified sidebar with clear section boundaries. */
.compact-sidebar-shell {
    gap: 0;
    height: calc(100vh - 0.9rem);
    margin: 0.45rem;
    padding: 0.58rem;
    border: 1px solid rgb(143 157 203 / 28%);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgb(39 47 77 / 28%), rgb(18 23 39 / 15%)),
        var(--sidebar);
    box-shadow:
        0 0.75rem 2rem rgb(5 9 20 / 18%),
        inset 0 1px 0 rgb(255 255 255 / 4%);
}
.compact-sidebar-shell .sidebar-card {
    gap: 0.42rem;
    padding: 0.58rem 0.42rem;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.compact-sidebar-shell .sidebar-card + .sidebar-card {
    border-top: 1px solid rgb(162 174 215 / 15%);
}
.compact-sidebar-shell .sidebar-card-title {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    color: #98a6c3;
    font-size: 0.64rem;
    letter-spacing: 0.09em;
}
.compact-sidebar-shell .sidebar-card-title::before {
    width: 0.18rem;
    height: 0.72rem;
    border-radius: 999px;
    background: #7185dc;
    content: "";
}
.compact-sidebar-shell .sidebar-card-public .sidebar-card-title::before { background: #45b893; }
.compact-sidebar-shell .sidebar-card-tools .sidebar-card-title::before { background: #aa78d4; }
.compact-sidebar-shell .sidebar-profile-button {
    gap: 0.52rem;
    padding: 0.2rem 0.3rem;
}
.compact-sidebar-shell .sidebar-avatar-wrap,
.compact-sidebar-shell .sidebar-avatar {
    width: 1.8rem;
    height: 1.8rem;
}
.compact-sidebar-shell .sidebar-avatar-wrap { flex-basis: 1.8rem; }
.compact-sidebar-shell .sidebar-profile-copy strong { font-size: 0.82rem; }
.compact-sidebar-shell .sidebar-profile-copy span { font-size: 0.7rem; }
.compact-sidebar-shell .primary-action {
    min-height: 2.18rem;
    padding: 0.46rem 0.66rem;
    border-radius: 0.58rem;
    font-size: 0.82rem;
}
.compact-sidebar-shell .sidebar-nav {
    gap: 0.04rem;
    margin-top: 0.12rem;
}
.compact-sidebar-shell .sidebar-nav a,
.compact-sidebar-shell .sidebar-links a {
    align-items: center;
    min-height: 1.95rem;
    padding: 0.38rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.48rem;
    font-size: 0.82rem;
    line-height: 1.2;
}
.compact-sidebar-shell .sidebar-nav a:hover,
.compact-sidebar-shell .sidebar-links a:hover {
    border-color: rgb(137 153 205 / 18%);
    background: rgb(70 82 124 / 22%);
}
.compact-sidebar-shell .sidebar-nav a.active,
.compact-sidebar-shell .sidebar-links a.active {
    border-color: rgb(126 145 218 / 24%);
    background: rgb(77 92 148 / 28%);
    box-shadow: inset 2px 0 0 #8296ec;
}
.compact-sidebar-shell .sidebar-subsection {
    gap: 0.22rem;
    margin-top: 0.14rem;
    padding-top: 0.46rem;
    border-top-color: rgb(162 174 215 / 12%);
}
.compact-sidebar-shell .sidebar-heading {
    padding: 0 0.48rem 0.22rem;
    color: #8795b3;
    font-size: 0.64rem;
}
.compact-sidebar-shell .sidebar-empty {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
}
.compact-sidebar-shell .notebook-creator { margin-top: 0.08rem; }
.compact-sidebar-shell .notebook-creator summary {
    padding: 0.34rem 0.5rem;
    border-radius: 0.45rem;
    color: #9ca9c5;
    font-size: 0.76rem;
}
.compact-sidebar-shell .notebook-creator summary:hover {
    background: rgb(70 82 124 / 18%);
    color: #eef2ff;
}
.compact-sidebar-shell .notebook-creator form { padding: 0.35rem 0.1rem 0.1rem; }
.compact-sidebar-shell .notebook-creator input,
.compact-sidebar-shell .notebook-creator button { padding: 0.46rem; }
.compact-sidebar-shell .tag-cloud {
    gap: 0.24rem;
    padding: 0 0.28rem 0.06rem;
}
.compact-sidebar-shell .tag-cloud a {
    padding: 0.2rem 0.4rem;
    border: 1px solid rgb(138 151 194 / 9%);
    background: rgb(49 58 88 / 72%);
    font-size: 0.69rem;
}
.compact-sidebar-shell .sidebar-card-public {
    background: linear-gradient(90deg, rgb(48 154 121 / 8%), transparent 78%);
}
.compact-sidebar-shell .public-notes-link.active {
    border-color: rgb(69 184 147 / 26%);
    background: rgb(55 132 112 / 22%);
    box-shadow: inset 2px 0 0 #45b893;
}
.compact-sidebar-shell .sidebar-note-count {
    flex: 0 0 auto;
    color: #a9b7cb;
    font-size: 0.68rem;
    white-space: nowrap;
}
.compact-sidebar-shell .sidebar-card-tools {
    background: linear-gradient(90deg, rgb(142 87 190 / 7%), transparent 78%);
}
.compact-sidebar-shell .compact-sidebar-logout {
    margin-top: auto;
    padding: 0.55rem 0.42rem 0.12rem;
    border-top: 1px solid rgb(162 174 215 / 15%);
}
.compact-sidebar-shell .compact-sidebar-logout button {
    min-height: 2rem;
    padding: 0.4rem 0.65rem;
    border-color: rgb(147 162 209 / 22%);
    border-radius: 0.58rem;
    background: rgb(25 31 50 / 35%);
    color: #c3cce0;
    font-size: 0.8rem;
}
.compact-sidebar-shell .compact-sidebar-logout button:hover {
    border-color: rgb(147 162 209 / 38%);
    background: rgb(57 68 103 / 30%);
    color: #fff;
}

@media (max-width: 720px) {
    .compact-sidebar-shell {
        display: flex;
        height: auto;
        min-height: 3.65rem;
        margin: 0;
        padding: 0.5rem 0.65rem;
        border-width: 0 0 1px;
        border-radius: 0;
        box-shadow: 0 0.35rem 1rem rgb(5 9 20 / 14%);
    }
    .compact-sidebar-shell .sidebar-card-user {
        display: grid;
        width: 100%;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.55rem;
        padding: 0;
    }
    .compact-sidebar-shell .sidebar-card-title,
    .compact-sidebar-shell .sidebar-nav,
    .compact-sidebar-shell .sidebar-subsection,
    .compact-sidebar-shell .sidebar-card-public,
    .compact-sidebar-shell .sidebar-card-tools,
    .compact-sidebar-shell .compact-sidebar-logout { display: none; }
    .compact-sidebar-shell .sidebar-profile-button { grid-column: 1; min-width: 0; }
    .compact-sidebar-shell .primary-action {
        grid-column: 2;
        min-height: 2.15rem;
        white-space: nowrap;
    }
}

/* Alpha18-r22: member identity, profile activity, avatar policy, and presence UI. */
.compact-sidebar-shell .sidebar-card-user {
    gap: 0.55rem;
}
.sidebar-profile-summary {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    min-width: 0;
    padding: 0.12rem 0.22rem 0.2rem;
}
.sidebar-avatar-button {
    display: inline-grid;
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.compact-sidebar-shell .sidebar-avatar-wrap,
.compact-sidebar-shell .sidebar-avatar {
    width: 60px;
    height: 60px;
}
.compact-sidebar-shell .sidebar-avatar-wrap { flex-basis: 60px; }
.sidebar-avatar-button:hover .sidebar-avatar,
.sidebar-avatar-button:focus-visible .sidebar-avatar {
    filter: brightness(0.72);
    box-shadow: 0 0 0 3px rgb(126 145 218 / 24%);
}
.sidebar-avatar-button:hover .sidebar-avatar-edit,
.sidebar-avatar-button:focus-visible .sidebar-avatar-edit { opacity: 1; }
.compact-sidebar-shell .sidebar-profile-copy {
    align-content: center;
    gap: 0.28rem;
}
.compact-sidebar-shell .sidebar-profile-copy strong {
    overflow: hidden;
    color: #f4f6ff;
    font-size: 0.88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compact-sidebar-shell .sidebar-role-badge {
    justify-self: start;
    width: fit-content;
    padding: 0.18rem 0.44rem;
    border: 1px solid rgb(135 151 224 / 26%);
    border-radius: 999px;
    background: rgb(88 104 181 / 25%);
    color: #c9d4ff;
    font-size: 0.67rem;
    font-weight: 700;
    line-height: 1;
    text-transform: lowercase;
}
.compact-sidebar-shell .public-notes-link {
    grid-template-columns: minmax(0, 1fr) auto;
}
.compact-sidebar-shell .sidebar-note-count {
    color: #d5deed;
    font-size: 0.78rem;
    font-weight: 700;
}

.profile-dialog {
    width: min(92vw, 38rem);
}
.profile-dialog > header {
    align-items: center;
}
.profile-dialog > header h2 {
    margin: 0;
}
.profile-avatar-editor {
    gap: 1.2rem;
    padding: 1rem;
}
.profile-avatar-editor img {
    width: 120px;
    height: 120px;
    flex: 0 0 120px;
    border: 2px solid #e1e7ef;
    box-shadow: 0 0.3rem 1rem rgb(17 24 39 / 8%);
}
.profile-account-facts {
    display: grid;
    gap: 0.42rem;
    min-width: 0;
}
.profile-account-facts strong {
    margin-bottom: 0.12rem;
    color: var(--text);
    font-size: 1rem;
}
.profile-avatar-editor .profile-account-facts span {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.35;
}
.profile-avatar-form small,
.profile-reset-form small {
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}
.profile-avatar-field {
    display: grid;
    gap: 0.4rem;
}
.profile-field-label {
    font-size: 0.78rem;
    font-weight: 700;
}
.profile-avatar-picker-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.profile-avatar-picker-button {
    flex: 0 0 auto;
}
.profile-avatar-file-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#profile-avatar-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    pointer-events: none;
    white-space: nowrap;
}
.profile-reset-form {
    display: grid;
    gap: 0.35rem;
    text-align: center;
}

.public-member-card .member-presence {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 700;
}
.public-member-card .member-presence i {
    display: inline-block;
    width: 0.46rem;
    height: 0.46rem;
    border-radius: 50%;
    background: #9aa3b2;
    box-shadow: 0 0 0 2px rgb(154 163 178 / 12%);
}
.public-member-card .member-presence.is-online { color: #28795f; }
.public-member-card .member-presence.is-online i {
    background: #2fb27d;
    box-shadow: 0 0 0 2px rgb(47 178 125 / 14%);
}
.public-member-card .member-presence.is-offline { color: #7a8494; }

@media (max-width: 720px) {
    .compact-sidebar-shell {
        min-height: 4.9rem;
    }
    .compact-sidebar-shell .sidebar-card-user {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .compact-sidebar-shell .sidebar-profile-summary {
        min-width: 0;
    }
    .profile-avatar-editor {
        align-items: flex-start;
    }
}


/* Alpha18-r24: title-only card navigation and stable note metadata placement. */
.note-card-tile {
    height: auto;
    min-height: 19.5rem;
    cursor: default;
    transition: none;
}
.note-card-tile:hover {
    border-color: var(--border);
    box-shadow: 0 0.22rem 0.8rem rgb(25 35 55 / 6%);
    transform: none;
}
.shared-public-note-card .note-card-tile:hover {
    border-color: #cad8ff;
}
.note-card-title-link {
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}
.note-card-title-link:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.14em;
}
.note-card-title-link:focus-visible {
    border-radius: 3px;
    outline: 3px solid rgb(79 99 217 / 25%);
    outline-offset: 2px;
}
.note-card-excerpt {
    display: block;
    height: auto;
    min-height: 0;
    max-height: none;
    margin-top: 0.7rem;
    overflow: visible;
    line-height: 1.5;
    text-overflow: clip;
    white-space: normal;
    -webkit-line-clamp: unset;
}
.card-knowledge-indicators {
    margin-top: 0.7rem;
}
.note-card-classification {
    margin-top: auto;
}
.note-card-tile footer {
    margin-top: 0.45rem;
}
.note-card-expanded .note-card-tile {
    min-height: 0;
    cursor: default;
}
.note-card-expanded .note-card-title {
    min-height: 0;
}
.note-card-expanded .note-card-classification {
    margin-top: 1.1rem;
}


/* Alpha18-r25: uniform compact-card dimensions and owner Private/Public boundary. */
.note-card-grid {
    grid-auto-rows: 19.5rem;
}
.note-card-wrap:not(.note-card-expanded) {
    height: 19.5rem;
}
.note-card-wrap:not(.note-card-expanded) .note-card-tile {
    height: 100%;
    min-height: 0;
}
.note-card-wrap:not(.note-card-expanded) .note-card-excerpt {
    max-height: 5rem;
    overflow: hidden;
}
.owned-visibility-separator {
    height: 1px;
    margin: 0.9rem 0;
    border: 0;
    background: #d8dee8;
}
.note-card-expanded,
.note-card-expanded .note-card-tile {
    height: auto;
}
