:root {
    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-2: #eef3f2;
    --text: #172126;
    --muted: #64727a;
    --border: #d8e0e2;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --warning: #b7791f;
    --shadow: 0 14px 36px rgba(23, 33, 38, 0.08);
}

html[data-theme="modern"],
body[data-theme="modern"] {
    --bg: #eef3f5;
    --surface: #ffffff;
    --surface-2: #f2f6f5;
    --text: #121a1f;
    --muted: #52636b;
    --border: #cfdadd;
    --primary: #00806f;
    --primary-dark: #005f55;
    --shadow: none;
}

html[data-theme="compact"],
body[data-theme="compact"] {
    --bg: #f2f4f5;
    --surface: #ffffff;
    --surface-2: #edf1f2;
    --text: #172126;
    --muted: #5e6c73;
    --border: #cfd9dc;
    --shadow: none;
}

html[data-theme="dark"],
body[data-theme="dark"] {
    --bg: #101719;
    --surface: #172226;
    --surface-2: #223136;
    --text: #eef8f6;
    --muted: #a7b7bc;
    --border: #33474d;
    --primary: #14b8a6;
    --primary-dark: #5eead4;
    --danger: #dc2626;
    --shadow: none;
}

html[data-theme="high-contrast"],
body[data-theme="high-contrast"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f0f0;
    --text: #000000;
    --muted: #222222;
    --border: #000000;
    --primary: #005fcc;
    --primary-dark: #003f8f;
    --danger: #b00020;
    --shadow: none;
}

html[data-theme="modern"] {
    background: #eef3f5;
}

html[data-theme="compact"] {
    background: #f2f4f5;
}

html[data-theme="high-contrast"] {
    background: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
    background: #101719;
}

body[data-theme="compact"] {
    font-size: 14px;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 64px;
    padding: 0 28px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

body[data-theme="modern"] .brand {
    color: #ffffff;
}

body[data-theme="modern"] .topbar {
    min-height: 58px;
    background: #172126;
    border-bottom-color: #26373d;
    box-shadow: none;
}

body[data-theme="modern"] .nav a,
body[data-theme="modern"] .logout,
body[data-theme="modern"] .logout a {
    color: #d9e6e5;
}

body[data-theme="modern"] .sidebar {
    top: 58px;
    min-height: calc(100vh - 58px);
    background: #ffffff;
    border-right-color: #cfdadd;
    box-shadow: inset -1px 0 0 #eef2f3;
}

body[data-theme="modern"] .top-search input,
body[data-theme="modern"] .top-search button,
body[data-theme="modern"] .logout button {
    background: #223136;
    border-color: #394d54;
    color: #eef8f6;
}

body[data-theme="modern"] .top-search input::placeholder {
    color: #9eb1b6;
}

body[data-theme="compact"] .topbar {
    background: #f8fafb;
    border-bottom-color: #c6d0d4;
}

body[data-theme="compact"] .sidebar {
    background: #f8fafb;
}

body[data-theme="dark"] .topbar {
    background: rgba(23, 34, 38, 0.96);
}

body[data-theme="high-contrast"] .topbar {
    background: var(--surface);
    border-bottom-width: 2px;
}

.brand {
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0;
}

.nav {
    display: flex;
    gap: 14px;
    flex: 1;
}

.nav a {
    color: var(--muted);
    font-weight: 650;
}

.top-search {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.top-search input {
    min-height: 38px;
    padding: 8px 12px;
}

.top-search button {
    min-height: 38px;
}

body[data-theme="modern"] .top-search {
    grid-template-columns: minmax(280px, 460px) auto;
}

.logout {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.page {
    width: 100%;
    margin: 0;
    padding: 28px 28px 56px;
}

body[data-theme="compact"] .page {
    padding: 18px 18px 40px;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin: -28px -28px -56px;
}

body[data-theme="compact"] .app-shell {
    gap: 18px;
    grid-template-columns: 240px minmax(0, 1fr);
    margin: -18px -18px -40px;
}

.content-area {
    min-width: 0;
    max-width: 1080px;
    padding: 28px 28px 56px 0;
}

body[data-theme="compact"] .content-area {
    padding: 18px 18px 40px 0;
}

.sidebar {
    position: sticky;
    top: 64px;
    min-height: calc(100vh - 64px);
    align-self: stretch;
    padding: 24px 22px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.sidebar-title {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.sidebar-all,
.category-tree a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text);
    font-weight: 650;
}

.category-tree small {
    color: var(--muted);
    font-size: 12px;
}

.sidebar-all.active,
.category-tree a.active,
.category-tree a:hover,
.sidebar-all:hover {
    background: var(--surface-2);
    color: var(--primary-dark);
    text-decoration: none;
}

.category-tree {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.category-tree .category-tree {
    margin-left: 14px;
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

.page-header,
.article-header,
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.article-header > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

h1,
h2,
h3 {
    margin: 0 0 8px;
    line-height: 1.2;
}

h1 {
    font-size: clamp(28px, 4vw, 42px);
}

h2 {
    font-size: 20px;
}

p {
    margin: 0 0 12px;
    color: var(--muted);
}

.panel,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 22px;
    margin-bottom: 22px;
}

.card {
    padding: 22px;
}

body[data-theme="compact"] .panel,
body[data-theme="compact"] .card,
body[data-theme="compact"] .article {
    padding: 16px;
}

body[data-theme="modern"] .card,
body[data-theme="modern"] .panel,
body[data-theme="modern"] .article {
    border-radius: 4px;
    border-color: #cfdadd;
    box-shadow: none;
}

body[data-theme="modern"] .article,
body[data-theme="modern"] .panel {
    border-top: 3px solid var(--primary);
}

body[data-theme="modern"] .primary,
body[data-theme="modern"] .status-reviewed {
    box-shadow: none;
}

body[data-theme="modern"] .sidebar-all.active,
body[data-theme="modern"] .category-tree a.active,
body[data-theme="modern"] .category-tree a:hover,
body[data-theme="modern"] .sidebar-all:hover {
    background: #dff1ed;
    color: #005f55;
}

body[data-theme="modern"] .tags span,
body[data-theme="modern"] .status-badge {
    background: #edf7f4;
    border-color: #b8d9d0;
}

body[data-theme="dark"] .panel,
body[data-theme="dark"] .card,
body[data-theme="dark"] .article,
body[data-theme="dark"] .sidebar {
    background: var(--surface);
    border-color: var(--border);
}

body[data-theme="dark"] .tags span,
body[data-theme="dark"] .status-badge,
body[data-theme="dark"] .toc {
    background: var(--surface-2);
    border-color: var(--border);
}

body[data-theme="dark"] .button,
body[data-theme="dark"] button {
    background: #223136;
    border-color: #3b5259;
    color: var(--text);
}

body[data-theme="dark"] .primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #06201d;
}

body[data-theme="dark"] .danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

body[data-theme="high-contrast"] .panel,
body[data-theme="high-contrast"] .card,
body[data-theme="high-contrast"] .article,
body[data-theme="high-contrast"] .sidebar,
body[data-theme="high-contrast"] button,
body[data-theme="high-contrast"] .button,
body[data-theme="high-contrast"] input,
body[data-theme="high-contrast"] select,
body[data-theme="high-contrast"] textarea {
    border-width: 2px;
}

body[data-theme="compact"] .topbar {
    min-height: 54px;
    padding: 0 18px;
}

body[data-theme="compact"] .sidebar {
    top: 54px;
    min-height: calc(100vh - 54px);
    padding: 18px 16px;
}

.grid {
    display: grid;
    gap: 18px;
}

.article-grid,
.admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-tile {
    display: block;
    color: var(--text);
}

.meta {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tags span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 650;
}

.status-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 10px 0 6px;
    color: var(--muted);
    font-size: 13px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-weight: 800;
}

.status-reviewed {
    border-color: #72c6b9;
    color: var(--primary-dark);
}

.status-outdated {
    border-color: #d99b2b;
    color: var(--warning);
}

.status-archived,
.status-draft {
    color: var(--muted);
}

.article {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 22px;
}

.article-body {
    max-width: 860px;
    min-width: 0;
    color: var(--text);
    overflow: hidden;
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 28px;
    align-items: start;
}

.article-body p,
.article-body li {
    color: var(--text);
}

.article-body img {
    display: block;
    width: auto;
    max-width: min(100%, 760px);
    max-height: 520px;
    height: auto;
    object-fit: contain;
    margin: 14px 0 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    cursor: zoom-in;
}

.article-body figure {
    max-width: 100%;
    margin: 16px 0;
}

.article-body pre,
pre {
    position: relative;
    overflow-x: auto;
    padding: 14px;
    background: #182226;
    color: #eef8f6;
    border-radius: 8px;
    white-space: pre-wrap;
}

.copy-code-button {
    position: absolute;
    top: 8px;
    right: 8px;
    min-height: 30px;
    padding: 4px 9px;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 12px;
}

.toc {
    position: sticky;
    top: 88px;
    z-index: 2;
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(0, 0, 0, 0.82);
}

.image-lightbox[hidden] {
    display: none;
}

.image-lightbox img {
    display: block;
    max-width: min(96vw, 1500px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 22px 80px rgba(0, 0, 0, 0.45);
}

.image-lightbox button {
    position: absolute;
    top: 18px;
    right: 18px;
    min-width: 42px;
    min-height: 42px;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(20, 24, 27, 0.88);
    color: #ffffff;
}

.toc-title {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.toc a {
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
}

.toc-level-3 {
    padding-left: 14px;
}

.heading-anchor {
    margin-left: 8px;
    color: var(--muted);
    font-size: 0.8em;
    opacity: 0;
}

.article-body h2:hover .heading-anchor,
.article-body h3:hover .heading-anchor {
    opacity: 1;
}

mark {
    padding: 0 2px;
    background: #fff0a8;
    color: #111111;
    border-radius: 3px;
}

pre code,
.article-body pre code {
    display: block;
    padding: 0;
    background: transparent;
    color: #eef8f6;
    border-radius: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    line-height: 1.65;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover,
.button:hover {
    text-decoration: none;
    border-color: #aebcc0;
}

.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.primary:hover {
    background: var(--primary-dark);
}

.danger {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.small {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 13px;
}

.theme-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.theme-preview {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.theme-preview span {
    display: block;
    height: 34px;
    border-radius: 6px;
    border: 1px solid #cfd9dc;
}

.theme-preview[data-preview-theme="modern"] span {
    background: linear-gradient(90deg, #f5f7fa 0 32%, #f8f9fb 32% 100%);
}

.theme-preview[data-preview-theme="dark"] span {
    background: linear-gradient(90deg, #141d29 0 32%, #101722 32% 100%);
}

.template-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.text-link {
    font-weight: 750;
}

.form-stack {
    display: grid;
    gap: 18px;
}

.form-grid,
.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
    background: #101719;
    color: var(--text);
}

body[data-theme="high-contrast"] a,
body[data-theme="high-contrast"] button,
body[data-theme="high-contrast"] .button,
body[data-theme="high-contrast"] input,
body[data-theme="high-contrast"] select,
body[data-theme="high-contrast"] textarea {
    outline-offset: 3px;
}

textarea {
    resize: vertical;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

legend {
    padding: 0 8px;
    font-weight: 800;
}

.checkbox,
.checkbox-grid .checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 650;
}

.checkbox input {
    width: auto;
    min-height: auto;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.permission-grid {
    display: grid;
    gap: 10px;
}

.permission-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.category-permissions {
    display: grid;
    gap: 10px;
    padding: 12px 16px 18px;
    margin: -8px 0 12px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: var(--surface-2);
}

.compact-permission-row {
    grid-template-columns: minmax(120px, 1fr) auto auto;
    padding: 6px 0;
}

.editor-topline {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
}

.editor-toolbar,
.editor-mode-switch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.editor-toolbar select {
    width: auto;
    min-width: 130px;
    min-height: 34px;
    padding: 5px 10px;
}

.editor-mode-switch {
    margin-left: auto;
}

.editor-mode-switch button {
    min-height: 34px;
    padding: 5px 10px;
}

.editor-mode-switch button.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.editor-shell textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.editor-modes textarea,
.editor-visual {
    min-height: 420px;
}

[data-editor-markdown-wrap] {
    display: grid;
    gap: 6px;
}

.editor-visual {
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.editor-visual:focus,
.editor-modes textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.editor-visual p,
.editor-visual li {
    color: var(--text);
}

.editor-visual pre {
    white-space: pre-wrap;
}

.form-actions,
.actions,
.row-actions,
.inline-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.article-actions {
    flex: 0 1 380px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    align-items: start;
}

.article-actions form {
    display: inline-flex;
}

.article-actions .button,
.article-actions button {
    width: auto;
    min-width: 72px;
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.article-actions .favorite-button {
    min-width: 34px;
    padding: 4px 8px;
    color: #98a3b0;
    line-height: 1;
}

.article-actions .favorite-button svg { display: block; width: 18px; height: 18px; fill: transparent; stroke: currentColor; stroke-linejoin: round; stroke-width: 1.65; }
.article-actions .favorite-button:hover { color: #e0a41f; }
.article-actions .favorite-button.is-favorite { border-color: #f0d28a; background: #fff8e6; color: #d99310; }
.article-actions .favorite-button.is-favorite svg { fill: currentColor; stroke-width: 1.25; }

.inline-upload {
    justify-content: flex-end;
    padding: 8px;
    border: 1px dashed transparent;
    border-radius: 8px;
}

.inline-upload input[type="file"] {
    width: auto;
    min-width: 260px;
    max-width: 420px;
}

.inline-upload .checkbox {
    min-height: 38px;
    white-space: nowrap;
}

.inline-upload button {
    flex: 0 0 auto;
}

.inline-upload.is-dragover {
    border-color: var(--primary);
    background: var(--surface-2);
}

.upload-hint {
    color: var(--muted);
    font-size: 13px;
}

.attachment-name {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 260px;
}

.file-icon {
    flex: 0 0 auto;
    min-width: 42px;
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 850;
    text-align: center;
}

.attachment-preview {
    display: block;
    width: 120px;
    max-height: 90px;
    object-fit: cover;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.group-row {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.toolbar-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 240px)) auto;
    gap: 12px;
    align-items: end;
}

.article-list-row > div {
    min-width: 0;
}

.article-list-row h2 {
    font-size: 18px;
}

.is-unread {
    border-color: #91d6c8;
    background: #eefbf8;
}

body[data-theme="dark"] .is-unread {
    border-color: #2dd4bf;
    background: #12332f;
}

.list {
    display: grid;
    gap: 12px;
}

.comment-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.comment-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.comment-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.comment-item.is-resolved {
    opacity: 0.72;
}

.diff-list {
    display: grid;
    gap: 4px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.diff-row {
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    white-space: pre-wrap;
}

.diff-same {
    background: var(--surface);
    color: var(--muted);
}

.diff-added {
    background: #e7f7ef;
    border-color: #9bd7b6;
    color: #0f5132;
}

.diff-removed {
    background: #fff0ef;
    border-color: #f0b0a8;
    color: #842029;
}

body[data-theme="dark"] .diff-added {
    background: #123326;
    border-color: #236c4c;
    color: #bff3d4;
}

body[data-theme="dark"] .diff-removed {
    background: #3a1717;
    border-color: #7f2a2a;
    color: #ffd2d2;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.editable-row {
    display: grid;
    grid-template-columns: 180px 220px 1fr auto auto;
}

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

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

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

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

.alert {
    position: relative;
    z-index: 40;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.alert + .app-shell {
    margin-top: 0;
}

.alert-success {
    border-color: #91d6c8;
    background: #e7f7f3;
}

.alert-danger {
    border-color: #f4a69e;
    background: #fff0ef;
}

body[data-theme="dark"] .alert-success {
    border-color: #2dd4bf;
    background: #12332f;
    color: #d8fffa;
}

body[data-theme="dark"] .alert-danger {
    border-color: #ef4444;
    background: #3a1717;
    color: #ffe8e8;
}

.auth-shell {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
}

.is-guest { min-height: 100vh; background: #f8f9fb; }
.auth-topbar { position: absolute; inset: 0 0 auto; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 28px clamp(24px, 5vw, 72px); }
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 7px 11px; border-color: #dde3eb; background: rgba(255, 255, 255, 0.78); color: #556274; font-size: 13px; }
.login-shell { position: relative; display: grid; min-height: 100vh; place-items: center; }
.login-intro { position: absolute; inset: 0 auto 0 0; display: flex; width: 50%; flex-direction: column; justify-content: center; padding: clamp(120px, 14vw, 210px) clamp(42px, 10vw, 170px) 72px; background: radial-gradient(circle at 18% 18%, #dce8ff 0, transparent 29%), linear-gradient(135deg, #eaf1ff 0%, #f7f9ff 66%, #fff 100%); }
.login-intro-mark { display: block; width: 46px; height: 46px; margin-bottom: 28px; filter: drop-shadow(0 8px 20px rgba(37, 99, 235, .22)); }
.login-eyebrow { margin-bottom: 8px; color: #3b6fce; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.login-intro h1 { max-width: 560px; margin-bottom: 16px; font-size: clamp(38px, 4.3vw, 62px); letter-spacing: -.06em; }
.login-intro > p:not(.login-eyebrow) { max-width: 480px; font-size: 16px; }
.login-feature-list { display: grid; gap: 9px; margin-top: 36px; color: #556274; font-size: 13px; font-weight: 650; }
.login-feature-list span::first-letter { color: #31805e; }
.login-card { z-index: 1; width: min(420px, calc(100% - 48px)); display: grid; gap: 18px; padding: 34px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: 0 20px 55px rgba(24, 32, 42, .09); }
.login-card-heading { margin-bottom: 4px; }
.login-card h1 { margin-bottom: 7px; font-size: 30px; }
.login-card-heading p:last-child { font-size: 13px; }
.login-card input { min-height: 44px; }
.login-submit { justify-content: space-between; min-height: 44px; padding-inline: 16px; }

body[data-theme="dark"].is-guest { background: #101722; }
body[data-theme="dark"] .auth-topbar { background: transparent; }
body[data-theme="dark"] .theme-toggle { border-color: #34455d; background: rgba(24, 34, 48, .82); color: #cbd6e3; }
body[data-theme="dark"] .login-intro { background: radial-gradient(circle at 18% 18%, #1e3a65 0, transparent 30%), linear-gradient(135deg, #121c2a 0%, #101722 72%); }
body[data-theme="dark"] .login-eyebrow { color: #a9c2ff; }
body[data-theme="dark"] .login-intro > p:not(.login-eyebrow), body[data-theme="dark"] .login-feature-list { color: #aebaca; }
body[data-theme="dark"] .login-feature-list span::first-letter { color: #93dfb4; }
body[data-theme="dark"] .login-card { border-color: #2b3a4e; background: #182230; box-shadow: 0 20px 55px rgba(0, 0, 0, .3); }

.auth-panel {
    width: min(420px, 100%);
    display: grid;
    gap: 16px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.field-error {
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
}

.empty-state {
    padding: 46px 24px;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 8px;
}

.note-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.note-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    min-height: 190px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.note-card h2 {
    margin: 8px 0;
    font-size: 20px;
}

.note-card p {
    margin: 0;
    color: var(--muted);
    white-space: normal;
}

.note-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.note-actions form {
    margin: 0;
}

.note-visibility { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.note-sharing { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

code {
    padding: 2px 5px;
    background: var(--surface-2);
    border-radius: 4px;
}

@media print {
    .topbar,
    .sidebar,
    .no-print,
    .alert {
        display: none !important;
    }

    .page,
    .content-area,
    .app-shell {
        display: block;
        margin: 0;
        padding: 0;
        max-width: none;
    }

    .article {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    body {
        background: #ffffff;
        color: #000000;
    }
}

@media (max-width: 760px) {
    .topbar,
    .page-header,
    .article-header,
    .section-heading,
    .list-row {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        position: static;
        padding: 14px 16px;
    }

    .nav,
    .logout,
    .top-search {
        flex-wrap: wrap;
    }

    .top-search {
        grid-template-columns: 1fr auto;
        width: 100%;
        margin-left: 0;
    }

    .article {
        padding: 20px;
    }

    .article-actions {
        flex: 1 1 auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .article-layout {
        grid-template-columns: 1fr;
    }

    .toc {
        position: static;
        order: -1;
    }

    .editable-row {
        grid-template-columns: 1fr;
    }

    .permission-row {
        grid-template-columns: 1fr;
    }

    .toolbar-form {
        grid-template-columns: 1fr;
    }

    .editor-modes textarea,
    .editor-visual {
        min-height: 260px;
    }

    .app-shell {
        grid-template-columns: 1fr;
        margin: 0;
    }

    .sidebar {
        position: static;
        min-height: auto;
        border: 1px solid var(--border);
        border-radius: 8px;
    }

    .content-area {
        padding: 0;
    }

    .inline-upload {
        justify-content: flex-start;
    }

    .inline-upload input[type="file"] {
        min-width: 0;
        max-width: 100%;
    }

    .comment-item,
    .comment-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Redesign 2026: ruhige, dokumentationsorientierte Oberfläche */
:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-2: #f3f5f8;
    --text: #18202a;
    --muted: #687382;
    --border: #e6eaf0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --shadow: 0 8px 24px rgba(24, 32, 42, 0.05);
}

body { font-size: 14px; background: var(--bg); }
a { color: var(--primary-dark); }
.topbar { position: sticky; top: 0; min-height: 68px; padding: 0 32px; gap: 20px; background: rgba(255, 255, 255, 0.88); border-color: var(--border); box-shadow: none; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 16px; font-weight: 760; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 28px; height: 28px; }
.top-search { grid-template-columns: minmax(240px, 440px) auto; gap: 6px; margin-left: auto; }
.top-search input, .top-search button { min-height: 38px; border-radius: 8px; }
.top-search input { background: #fff; border-color: #dce2e9; }
.top-search button { padding: 7px 12px; background: var(--surface-2); color: #536071; font-size: 13px; }
.logout { gap: 6px; }
.user-link { display: flex; align-items: center; gap: 8px; color: #566170; font-size: 13px; font-weight: 650; }
.user-link:hover { text-decoration: none; color: var(--text); }
.user-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #dbeafe; color: #2453b4; font-size: 12px; font-weight: 800; }
.logout-button { min-height: 32px; padding: 4px 8px; border-color: transparent; background: transparent; color: var(--muted); }
.page { padding: 0; }
.app-shell { grid-template-columns: 264px minmax(0, 1fr); gap: 0; margin: 0; min-height: calc(100vh - 68px); }
.sidebar { position: sticky; top: 68px; display: flex; flex-direction: column; height: calc(100vh - 68px); min-height: calc(100vh - 68px); padding: 24px 14px; overflow: hidden; background: #f5f7fa; border: 0; border-right: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.sidebar-title { margin: 6px 0 6px; padding: 0 10px; color: #8a94a3; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.sidebar-nav { display: grid; gap: 2px; margin-bottom: 20px; }
.sidebar-nav a, .sidebar-all, .category-tree a { justify-content: flex-start; min-height: 36px; padding: 7px 10px; border-radius: 7px; color: #566170; font-size: 13px; font-weight: 600; }
.sidebar-nav a.active, .sidebar-nav a:hover, .sidebar-all.active, .category-tree a.active, .category-tree a:hover, .sidebar-all:hover { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(24, 32, 42, 0.04); }
.sidebar-nav .create-link { margin-top: 6px; background: #edf3ff; color: var(--primary); }
.category-navigation { flex: 1 1 auto; min-height: 0; padding-top: 12px; overflow-y: auto; border-top: 1px solid var(--border); }
.category-tree { margin-top: 3px; }
.category-tree .category-tree { border-left-color: #dfe4ea; }
.sidebar-bottom { margin-top: auto; }
.sidebar-bottom .sidebar-title { margin-top: 0; }
.sidebar-user-menu { position: relative; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.sidebar-user-menu summary { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 7px 8px; border-radius: 8px; cursor: pointer; list-style: none; color: #566170; }
.sidebar-user-menu summary::-webkit-details-marker { display: none; }
.sidebar-user-menu summary:hover, .sidebar-user-menu[open] summary { background: #fff; }
.sidebar-user-identity { display: grid; min-width: 0; line-height: 1.25; }
.sidebar-user-identity strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-identity small { overflow: hidden; color: #8994a2; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-chevron { margin-left: auto; color: #8a94a3; transition: transform .16s ease; }
.sidebar-user-menu[open] .user-menu-chevron { transform: rotate(180deg); }
.sidebar-user-actions { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; display: grid; min-width: 210px; padding: 6px; border: 1px solid var(--border); border-radius: 9px; background: #fff; box-shadow: 0 12px 28px rgba(24, 32, 42, 0.14); }
.sidebar-user-actions a, .sidebar-user-actions button { display: flex; justify-content: flex-start; width: 100%; min-height: 34px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: #4f5c6b; font-size: 13px; font-weight: 600; text-align: left; }
.sidebar-user-actions a:hover, .sidebar-user-actions button:hover { background: var(--surface-2); color: var(--primary); text-decoration: none; }
.content-area { width: 100%; max-width: 1720px; padding: 48px clamp(28px, 5vw, 64px) 72px; }
.page-header, .article-header, .section-heading { margin-bottom: 28px; }
h1 { font-size: clamp(30px, 3.1vw, 38px); letter-spacing: -0.045em; }
h2 { font-size: 18px; letter-spacing: -0.02em; }
p { color: var(--muted); }
.panel, .card, .article, .note-card, .group-row { border-color: var(--border); border-radius: 10px; box-shadow: none; }
.panel { padding: 20px; }
.card { padding: 18px; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.card:hover { transform: translateY(-2px); border-color: #cfd7e2; box-shadow: var(--shadow); }
.article-grid { gap: 12px; }
.article-grid .card { min-height: 156px; }
.article { padding: 34px; border: 0; border-radius: 0; background: transparent; }
.article-header { padding-bottom: 26px; border-bottom: 1px solid var(--border); }
.article-body { max-width: none; font-size: 15px; }
.article-layout { grid-template-columns: minmax(0, 1fr) 230px; gap: 32px; }
.article-body h2 { margin-top: 34px; }
.article-body img { border-color: var(--border); border-radius: 10px; }
.toc { top: 92px; padding: 14px; border-color: var(--border); border-radius: 9px; background: #fff; }
.tags span, .status-badge { border-color: transparent; background: #f0f4f8; color: #526071; font-size: 12px; }
.status-reviewed { background: #edf8f3; color: #16794a; }
.button, button { min-height: 36px; padding: 7px 12px; border-radius: 8px; border-color: #dce2e9; font-size: 13px; }
.primary { background: var(--primary); border-color: var(--primary); }
.primary:hover { background: var(--primary-dark); }
input, select, textarea { border-color: #dce2e9; border-radius: 8px; }
.toolbar-form { grid-template-columns: repeat(2, minmax(180px, 240px)) auto; padding: 16px; margin-bottom: 28px; background: #fff; }
.list-row { padding: 18px; border-color: var(--border); border-radius: 10px; }
.article-list { gap: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.article-list .article-list-row { min-height: 0; padding: 18px 20px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.article-list .article-list-row:last-child { border-bottom: 0; }
.article-list .article-list-row:hover { background: #fafbfd; }
.article-list .article-list-row h2 { margin-bottom: 4px; font-size: 16px; }
.article-list .article-list-row p { margin: 0; font-size: 13px; }
.article-list .article-list-row .status-line { margin: 8px 0 0; }
.article-list .article-list-row .text-link { flex: 0 0 auto; padding-left: 18px; white-space: nowrap; }
.note-grid { gap: 12px; }
.note-card { min-height: 180px; padding: 18px; }
.empty-state { border-color: #dce2e9; border-radius: 10px; }

/* Admin: Verwaltung nach Aufgaben bündeln statt als unstrukturierte Linkliste zeigen. */
.admin-hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: clamp(26px, 4vw, 42px); margin-bottom: 40px; border: 1px solid #dce6ff; border-radius: 14px; background: linear-gradient(120deg, #edf3ff 0%, #f7f9ff 58%, #fff 100%); }
.admin-eyebrow { margin-bottom: 9px; color: #3568c7; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.admin-hero h1 { margin-bottom: 8px; }
.admin-hero p { max-width: 600px; }
.admin-hero-action { flex: 0 0 auto; background: #fff; }
.admin-section { margin-top: 34px; }
.admin-section-header { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.admin-section-header h2 { margin-bottom: 3px; font-size: 17px; }
.admin-section-header p { font-size: 13px; }
.admin-grid { gap: 12px; }
.admin-tile { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-height: 116px; padding: 18px; color: var(--text); }
.admin-tile:hover { color: var(--text); text-decoration: none; }
.admin-tile h3 { margin: 0 0 4px; font-size: 14px; letter-spacing: -0.01em; }
.admin-tile p { margin: 0; font-size: 12px; }
.admin-tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; font-size: 18px; font-weight: 700; }
.icon-blue { background: #e9f0ff; color: #3568c7; }
.icon-purple { background: #f1ebff; color: #7048c7; }
.icon-teal { background: #e7f8f5; color: #18816e; }
.icon-amber { background: #fff5df; color: #a26312; }
.icon-rose { background: #fff0f2; color: #b64c61; }
.icon-slate { background: #eef2f6; color: #5a6a7c; }
.icon-green { background: #eaf8ed; color: #2b7a48; }
.admin-tile-arrow { color: #9aa6b4; font-size: 18px; transition: transform .16s ease, color .16s ease; }
.admin-tile:hover .admin-tile-arrow { color: var(--primary); transform: translateX(3px); }
.admin-page-header { align-items: end; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.admin-page-header h1 { font-size: clamp(28px, 3vw, 34px); }
.admin-page-header p { max-width: 620px; }
.admin-panel { padding: 24px; margin-bottom: 18px; border-color: var(--border); }
.admin-panel > h2, .admin-panel > .section-heading h2 { font-size: 16px; }
.admin-panel fieldset { margin: 0; border-color: var(--border); background: #fafbfd; }
.admin-panel legend { color: #596575; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.admin-panel .group-row { padding: 18px; border-color: var(--border); background: #fafbfd; }
.admin-table th { padding: 11px 12px; background: #f6f8fa; color: #7b8795; font-size: 11px; letter-spacing: .06em; }
.admin-table td { padding: 14px 12px; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover td { background: #fafbfd; }
.admin-table code { color: #42546a; font-size: 12px; }
.admin-panel details summary { color: var(--primary-dark); font-size: 13px; font-weight: 650; cursor: pointer; }
.admin-panel details pre { margin: 10px 0 0; font-size: 12px; }
.admin-danger-zone { border-color: #f1d2d2; background: #fffafb; }
.admin-danger-zone h2 { color: #9f3434; }

/* Die bisherigen hellen Varianten verwenden dieselbe neue Informationsarchitektur. */
body[data-theme="modern"], body[data-theme="compact"] {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-2: #f3f5f8;
    --text: #18202a;
    --muted: #687382;
    --border: #e6eaf0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
}
body[data-theme="modern"] .topbar, body[data-theme="compact"] .topbar { min-height: 68px; padding: 0 32px; background: rgba(255, 255, 255, 0.88); border-color: var(--border); }
body[data-theme="modern"] .brand { color: var(--text); }
body[data-theme="modern"] .top-search input, body[data-theme="modern"] .top-search button, body[data-theme="modern"] .logout button { background: #fff; border-color: #dce2e9; color: #536071; }
body[data-theme="modern"] .top-search input::placeholder { color: #8d97a4; }
body[data-theme="modern"] .sidebar, body[data-theme="compact"] .sidebar { top: 68px; height: calc(100vh - 68px); min-height: calc(100vh - 68px); padding: 24px 14px; background: #f5f7fa; border-right-color: var(--border); }
body[data-theme="modern"] .card, body[data-theme="modern"] .panel, body[data-theme="modern"] .article { border-radius: 10px; border-color: var(--border); box-shadow: none; }
body[data-theme="modern"] .article, body[data-theme="modern"] .panel { border-top: 0; }
body[data-theme="modern"] .sidebar-all.active, body[data-theme="modern"] .category-tree a.active, body[data-theme="modern"] .category-tree a:hover, body[data-theme="modern"] .sidebar-all:hover { background: #fff; color: var(--primary); }
body[data-theme="modern"] .tags span, body[data-theme="modern"] .status-badge { background: #f0f4f8; border-color: transparent; }

/* Dunkelmodus: dieselbe klare Informationsarchitektur mit reduziertem Kontrast. */
html[data-theme="dark"] { background: #101722; }
body[data-theme="dark"] {
    --bg: #101722;
    --surface: #182230;
    --surface-2: #202c3b;
    --text: #eef3f9;
    --muted: #a4b0c0;
    --border: #2b3a4e;
    --primary: #7aa2ff;
    --primary-dark: #a9c2ff;
    background: var(--bg);
}
body[data-theme="dark"] .topbar { min-height: 68px; padding: 0 32px; background: rgba(16, 23, 34, 0.9); border-color: var(--border); }
body[data-theme="dark"] .brand { color: var(--text); }
body[data-theme="dark"] .top-search input, body[data-theme="dark"] .top-search button, body[data-theme="dark"] .logout button { background: #182230; border-color: var(--border); color: var(--text); }
body[data-theme="dark"] .top-search input::placeholder { color: #8492a5; }
body[data-theme="dark"] .user-link { color: #c5cfdb; }
body[data-theme="dark"] .user-avatar { background: #263d66; color: #bbceff; }
body[data-theme="dark"] .sidebar { top: 68px; height: calc(100vh - 68px); min-height: calc(100vh - 68px); padding: 24px 14px; background: #141d29; border-right-color: var(--border); }
body[data-theme="dark"] .sidebar-nav a, body[data-theme="dark"] .sidebar-all, body[data-theme="dark"] .category-tree a { color: #b4c0cf; }
body[data-theme="dark"] .sidebar-nav a.active, body[data-theme="dark"] .sidebar-nav a:hover, body[data-theme="dark"] .sidebar-all.active, body[data-theme="dark"] .category-tree a.active, body[data-theme="dark"] .category-tree a:hover, body[data-theme="dark"] .sidebar-all:hover { background: #202d40; color: #a9c2ff; box-shadow: none; }
body[data-theme="dark"] .sidebar-nav .create-link { background: #1e345b; color: #b9ceff; }
body[data-theme="dark"] .category-navigation { border-top-color: var(--border); }
body[data-theme="dark"] .category-tree .category-tree { border-left-color: #34455d; }
body[data-theme="dark"] .sidebar-user-menu { border-top-color: var(--border); }
body[data-theme="dark"] .sidebar-user-menu summary:hover, body[data-theme="dark"] .sidebar-user-menu[open] summary { background: #202d40; }
body[data-theme="dark"] .sidebar-user-identity strong { color: var(--text); }
body[data-theme="dark"] .sidebar-user-identity small { color: #91a0b2; }
body[data-theme="dark"] .sidebar-user-actions { border-color: #354861; background: #1b2736; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34); }
body[data-theme="dark"] .sidebar-user-actions a, body[data-theme="dark"] .sidebar-user-actions button { color: #c6d1de; }
body[data-theme="dark"] .sidebar-user-actions a:hover, body[data-theme="dark"] .sidebar-user-actions button:hover { background: #27384e; color: #b9ceff; }
body[data-theme="dark"] .panel, body[data-theme="dark"] .card, body[data-theme="dark"] .note-card, body[data-theme="dark"] .group-row { background: var(--surface); border-color: var(--border); }
body[data-theme="dark"] .article-list { background: var(--surface); border-color: var(--border); }
body[data-theme="dark"] .article-list .article-list-row { border-bottom-color: var(--border); }
body[data-theme="dark"] .article-list .article-list-row:hover { background: #1c2838; }
body[data-theme="dark"] .article { background: transparent; border: 0; }
body[data-theme="dark"] .article-header { border-bottom-color: var(--border); }
body[data-theme="dark"] .card:hover { border-color: #466081; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }
body[data-theme="dark"] .toc { background: #182230; border-color: var(--border); }
body[data-theme="dark"] .tags span, body[data-theme="dark"] .status-badge { background: #202c3b; border-color: transparent; color: #c5d0dd; }
body[data-theme="dark"] .status-reviewed { background: #173b31; color: #92dfb5; }
body[data-theme="dark"] input, body[data-theme="dark"] select, body[data-theme="dark"] textarea { background: #141d29; border-color: var(--border); color: var(--text); }
body[data-theme="dark"] .button, body[data-theme="dark"] button { background: #202c3b; border-color: #354861; color: var(--text); }
body[data-theme="dark"] .primary { background: #5b84e8; border-color: #5b84e8; color: #fff; }
body[data-theme="dark"] .primary:hover { background: #7199f6; }
body[data-theme="dark"] .danger { background: #c54545; border-color: #c54545; }
body[data-theme="dark"] .diff-added { background: #16362c; border-color: #2b7056; color: #b8efd0; }
body[data-theme="dark"] .diff-removed { background: #3b2024; border-color: #82404a; color: #ffd0d5; }
body[data-theme="dark"] .article-actions .favorite-button { color: #8f9caf; }
body[data-theme="dark"] .article-actions .favorite-button:hover { color: #ffd66b; }
body[data-theme="dark"] .article-actions .favorite-button.is-favorite { border-color: #806221; background: #3e3117; color: #ffd66b; }
body[data-theme="dark"] .note-visibility { background: #202c3b; color: #c5d0dd; }
body[data-theme="dark"] .admin-hero { border-color: #2d4160; background: linear-gradient(120deg, #182946 0%, #141f2d 65%, #182230 100%); }
body[data-theme="dark"] .admin-eyebrow { color: #a8c1ff; }
body[data-theme="dark"] .admin-hero-action { background: #202c3b; }
body[data-theme="dark"] .admin-page-header { border-bottom-color: var(--border); }
body[data-theme="dark"] .admin-panel fieldset, body[data-theme="dark"] .admin-panel .group-row { border-color: var(--border); background: #1b2736; }
body[data-theme="dark"] .admin-panel legend { color: #aebaca; }
body[data-theme="dark"] .admin-table th { background: #1b2736; color: #9facbc; }
body[data-theme="dark"] .admin-table tbody tr:hover td { background: #1c2838; }
body[data-theme="dark"] .admin-table code { color: #b9cae3; }
body[data-theme="dark"] .admin-danger-zone { border-color: #673943; background: #2e2025; }
body[data-theme="dark"] .admin-danger-zone h2 { color: #ffb5bf; }
body[data-theme="dark"] .icon-blue { background: #20375f; color: #b7ccff; }
body[data-theme="dark"] .icon-purple { background: #332853; color: #d0c0ff; }
body[data-theme="dark"] .icon-teal { background: #173b37; color: #9fe6d8; }
body[data-theme="dark"] .icon-amber { background: #41351d; color: #ffd98a; }
body[data-theme="dark"] .icon-rose { background: #472832; color: #ffb7c4; }
body[data-theme="dark"] .icon-slate { background: #2a3747; color: #c5d2e0; }
body[data-theme="dark"] .icon-green { background: #1f3d2b; color: #b2eac5; }

@media (max-width: 760px) {
    .topbar, body[data-theme="modern"] .topbar, body[data-theme="compact"] .topbar { position: static; flex-direction: row; flex-wrap: wrap; min-height: 62px; padding: 10px 16px; }
    .brand { font-size: 15px; }
    .top-search { order: 3; width: 100%; }
    .user-link span:last-child, .logout-button { display: none; }
    .app-shell { display: block; min-height: 0; }
    .sidebar, body[data-theme="modern"] .sidebar, body[data-theme="compact"] .sidebar { position: static; display: block; height: auto; min-height: auto; padding: 14px 16px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
    body[data-theme="dark"] .topbar { min-height: 62px; padding: 10px 16px; }
    body[data-theme="dark"] .sidebar { position: static; height: auto; min-height: auto; padding: 14px 16px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
    .category-navigation { overflow: visible; }
    .sidebar-bottom { margin-top: 14px; }
    .sidebar-user-actions { right: auto; left: 0; bottom: calc(100% + 6px); }
    .admin-hero { align-items: stretch; flex-direction: column; margin-bottom: 30px; padding: 24px; }
    .admin-hero-action { align-self: flex-start; }
    .note-sharing { grid-template-columns: 1fr; }
    .auth-topbar { position: static; padding: 18px 20px; border-bottom: 1px solid var(--border); }
    .login-shell { display: block; min-height: auto; }
    .login-intro { display: none; }
    .login-card { width: min(440px, calc(100% - 36px)); margin: 54px auto; }
    .sidebar-nav { display: flex; overflow-x: auto; margin: 0; }
    .sidebar-nav a { white-space: nowrap; }
    .category-navigation { display: none; }
    .content-area { max-width: none; padding: 30px 18px 48px; }
    .article { padding: 0; }
    .article-header { padding-bottom: 18px; }
}
