@font-face {
    font-family: "InterLocal";
    src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "RobotoLocal";
    src: url("fonts/roboto-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "OpenSansLocal";
    src: url("fonts/open-sans-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "LatoLocal";
    src: url("fonts/lato-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "MontserratLocal";
    src: url("fonts/montserrat-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "SourceSans3Local";
    src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f8f7ff;
    --bg2: #eefaf6;
    --surface: #ffffffd9;
    --surface-strong: #ffffff;
    --text: #243445;
    --muted: #5e6e80;
    --primary: #4f8bd8;
    --primary-soft: #c8dcf9;
    --danger: #cb4f62;
    --border: #d8e3ee;
    --link: #1d4ed8;
    --topbar-bg: #ffffffba;
    --footer-bg: #ffffffb5;
    --btn-bg: #4f8bd8;
    --btn-bg-hover: #3f78c2;
    --btn-text: #ffffff;
    --btn-border: #3f78c2;
    --btn-danger-bg: #cb4f62;
    --btn-danger-hover: #b83e51;
    --btn-danger-text: #ffffff;
    --btn-ghost-bg: #ffffff;
    --btn-ghost-hover: #eef5ff;
    --btn-ghost-text: #243445;
    --btn-ghost-border: #c9d8ea;
    --btn-info-bg: #eef5ff;
    --btn-info-hover: #d9e8ff;
    --btn-info-text: #24548e;
    --btn-info-border: #8fb0d8;
}

:root[data-theme="dark"] {
    --bg: #0b1220;
    --bg2: #131c2f;
    --surface: #0f172ae6;
    --surface-strong: #111c30;
    --text: #e5eef8;
    --muted: #a6b6cb;
    --primary: #60a5fa;
    --primary-soft: #1f3558;
    --danger: #ef6b82;
    --border: #2a3a55;
    --link: #93c5fd;
    --topbar-bg: #0b1426eb;
    --footer-bg: #0b1426eb;
    --btn-bg: #3b82f6;
    --btn-bg-hover: #2563eb;
    --btn-text: #f8fbff;
    --btn-border: #4f8fe9;
    --btn-danger-bg: #dc5a73;
    --btn-danger-hover: #c54660;
    --btn-danger-text: #fff4f6;
    --btn-ghost-bg: #132034;
    --btn-ghost-hover: #1a2a43;
    --btn-ghost-text: #d9e8fa;
    --btn-ghost-border: #2f4766;
    --btn-info-bg: #1a2e4d;
    --btn-info-hover: #244066;
    --btn-info-text: #d4e7ff;
    --btn-info-border: #456792;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    min-height: 100vh;
    background: linear-gradient(145deg, var(--bg), var(--bg2));
    display: flex;
    flex-direction: column;
}
a { color: var(--link); }
a:hover { color: color-mix(in oklab, var(--link) 80%, white); }

.bg-shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(34px);
    z-index: -1;
}
.bg-shape-a { width: 260px; height: 260px; background: #ffd8e6; top: -80px; right: 10%; }
.bg-shape-b { width: 340px; height: 340px; background: #d8f8ea; bottom: -90px; left: -50px; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}
.brand {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
}
.topnav {
    display: grid;
    gap: 8px;
    margin-left: auto;
}
.topnav-userline {
    display: flex;
    justify-content: flex-end;
}
.topnav-greeting {
    color: #46596e;
    font-weight: 700;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #d6e2f0;
    background: #f7fbff;
}
.topnav-user-role,
.topnav-user-rights {
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid #bed2ea;
    border-radius: 999px;
    padding: 2px 8px;
    color: #24548e;
    background: #edf5ff;
}
.topnav-user-rights {
    cursor: help;
}
.topnav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.topnav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 0.94rem;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: color-mix(in oklab, var(--surface-strong) 88%, transparent);
}
.topnav a:hover {
    border-color: #c8d9eb;
    background: color-mix(in oklab, var(--surface-strong) 94%, #ffffff);
}
.topnav a.topnav-logout {
    border-color: color-mix(in oklab, var(--btn-danger-bg) 55%, var(--border));
    color: color-mix(in oklab, var(--btn-danger-bg) 55%, var(--text));
    background: color-mix(in oklab, var(--btn-danger-bg) 16%, var(--surface-strong));
}
button.theme-toggle-btn {
    border: 1px solid var(--border);
    background: var(--btn-ghost-bg);
    color: var(--btn-ghost-text);
    font-weight: 700;
    font-size: 0.86rem;
    padding: 7px 12px;
    border-radius: 10px;
    width: auto;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
button.theme-toggle-btn:hover {
    background: var(--btn-ghost-hover);
    border-color: color-mix(in oklab, var(--primary) 55%, var(--btn-ghost-border));
}
.topbar-public-tools {
    margin-left: auto;
}

.container { width: min(1560px, 96%); margin: 24px auto; flex: 1 0 auto; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 8px 24px #2e55830f;
}
.app-footer {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    background: var(--footer-bg);
    backdrop-filter: blur(8px);
}
.app-footer-inner {
    width: min(1560px, 96%);
    margin: 0 auto;
    padding: 12px 0 16px;
    color: var(--muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.app-footer-brand {
    color: var(--text);
    font-weight: 600;
}
.app-footer-sep {
    color: #8ea0b4;
}
.app-footer-copy {
    color: var(--muted);
}
.app-footer-lastchange,
.app-footer-db,
.app-footer-online {
    color: var(--muted);
}
.narrow { max-width: 460px; margin: 38px auto; }
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }

h1, h2, h3 { margin-top: 0; }
label { display: block; margin: 12px 0 6px; font-weight: 600; }
input, select, textarea, button {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.98rem;
}
textarea { resize: vertical; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { cursor: pointer; }
:root:not([data-theme="dark"]) input[type="datetime-local"]::-webkit-calendar-picker-indicator,
:root:not([data-theme="dark"]) input[type="date"]::-webkit-calendar-picker-indicator,
:root:not([data-theme="dark"]) input[type="time"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 1;
}
:root[data-theme="dark"] input[type="datetime-local"],
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] input[type="time"] {
    color-scheme: dark;
}
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 1;
}
.rich-storage { display: none; }
button, .button-link {
    display: inline-block;
    text-align: center;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-text);
    cursor: pointer;
    text-decoration: none;
    width: auto;
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 600;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
button:hover, .button-link:hover {
    background: var(--btn-bg-hover);
    border-color: var(--btn-bg-hover);
    color: var(--btn-text);
}
button:focus-visible, .button-link:focus-visible, .theme-toggle-btn:focus-visible, .table-icon-btn:focus-visible, .admin-maillog-info-btn:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--btn-bg) 65%, #ffffff);
    outline-offset: 2px;
}
.button-link { font-size: 0.92rem; }
.danger {
    background: var(--btn-danger-bg);
    border-color: var(--btn-danger-bg);
    color: var(--btn-danger-text);
}
.danger:hover {
    background: var(--btn-danger-hover);
    border-color: var(--btn-danger-hover);
}
.actions { display: flex; gap: 10px; margin-top: 14px; }
.inline-actions { display: flex; gap: 10px; align-items: center; }
.page-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.alert { padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; }
.alert { transition: opacity 220ms ease, transform 220ms ease; }
.alert.is-dismissing { opacity: 0; transform: translateY(-4px); }
.alert-success { background: #dbf8e7; color: #17603a; border: 1px solid #a6e0be; }
.alert-warning { background: #fff5dc; color: #7a5a12; border: 1px solid #f0d18a; }
.alert-error { background: #ffe7ec; color: #6f2030; border: 1px solid #efb4c1; }

.twofa-hint-banner {
    margin-bottom: 14px;
    border: 1px solid #c9dff5;
    background: linear-gradient(135deg, #eef6ff, #eafaf3);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: opacity 220ms ease, transform 220ms ease;
}
.twofa-hint-banner.is-dismissing {
    opacity: 0;
    transform: translateY(-4px);
}
.twofa-hint-banner-text {
    color: #204160;
    font-size: 0.95rem;
}
.twofa-hint-banner-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.twofa-hint-link {
    text-decoration: none;
    border: 1px solid #94b7dd;
    background: #edf6ff;
    color: #1f4f86;
    border-radius: 999px;
    padding: 5px 10px;
    font-weight: 700;
    font-size: 0.86rem;
}
.twofa-hint-link:hover {
    background: #dfefff;
}
.twofa-hint-close {
    border: 1px solid #b7cde6;
    background: #ffffff;
    color: #3b556f;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}
.twofa-hint-close:hover {
    background: #f3f8ff;
}

.grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.tile {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
.tile h3 { margin: 0 0 7px; }
.tile p { margin: 7px 0; }
.muted { color: var(--muted); font-size: 0.92rem; }
.tile-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr auto;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px;
    background: color-mix(in oklab, var(--surface-strong) 82%, transparent);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.home-layout {
    display: flex;
    gap: 18px;
    align-items: start;
    min-height: 560px;
}
.home-tree {
    width: 360px;
    flex: 0 0 360px;
    border: 0;
    border-right: 2px solid #d8e3ef;
    border-radius: 0;
    background: transparent;
    padding: 4px 14px 4px 0;
    position: static;
    max-height: none;
    overflow: visible;
    box-shadow: none;
}
.home-tree h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}
.home-tree-groups {
    display: grid;
    gap: 12px;
}
.tree-group {
    border: 1px solid #dfe9f4;
    border-radius: 12px;
    background: var(--surface-strong);
    overflow: hidden;
    box-shadow: 0 3px 12px #2e558308;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.tree-group[open] {
    border-color: #c9dbee;
    box-shadow: 0 8px 18px #2e558314;
}
.tree-group-summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(180deg, color-mix(in oklab, var(--surface-strong) 96%, #fff), color-mix(in oklab, var(--surface-strong) 86%, #dbeafe));
    border-bottom: 1px solid #e8eff6;
    outline: none;
    position: relative;
}
.tree-group-summary::-webkit-details-marker {
    display: none;
}
.tree-group-summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid #7a90aa;
    border-bottom: 2px solid #7a90aa;
    transform: rotate(-45deg);
    transition: transform 160ms ease, border-color 160ms ease;
    margin-right: 2px;
    flex: 0 0 auto;
}
.tree-group[open] .tree-group-summary::before {
    transform: rotate(45deg);
    border-color: #4d80be;
}
.tree-group-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.tree-category-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    min-width: 0;
    flex: 1 1 auto;
}
.tree-category-link:hover,
.tree-category-link:focus,
.tree-category-link:active,
.tree-category-link:visited {
    text-decoration: none;
}
.tree-category-link.is-selected {
    color: #2459b3;
}
.tree-group-title .icon-thumb {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 1px 3px #00000026;
}
.tree-count {
    font-size: 0.72rem;
    color: var(--muted);
    border: 1px solid #d8e3ef;
    background: #f8fbff;
    border-radius: 999px;
    padding: 2px 8px;
}
.tree-list {
    list-style: none;
    margin: 0;
    padding: 8px 10px 10px 24px;
    display: grid;
    gap: 6px;
    position: relative;
    background: linear-gradient(180deg, color-mix(in oklab, var(--surface-strong) 100%, #fff), color-mix(in oklab, var(--surface-strong) 92%, #dbeafe));
}
.tree-list::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 10px;
    bottom: 12px;
    width: 1px;
    background: linear-gradient(180deg, #8ea9c6, #d9e6f4);
}
.tree-list li {
    position: relative;
    padding-left: 12px;
}
.tree-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    width: 10px;
    height: 1px;
    background: #8ea9c6;
}
.tree-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: 9px;
    border: 1px solid #e7eff8;
    padding: 5px 8px;
    text-decoration: none;
    color: var(--text);
    background: var(--surface-strong);
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.tree-link:hover {
    background: #f3f8ff;
    border-color: #cfe0f4;
    transform: translateY(-1px);
}
.tree-link.is-selected {
    border-color: #7ea8dc;
    background: #e8f2ff;
    box-shadow: 0 1px 0 #ffffff inset;
}
.tree-link-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.tree-link-status {
    font-size: 0.72rem;
    color: #2459b3;
    border: 1px solid #cfe0f6;
    background: #f2f7ff;
    border-radius: 999px;
    padding: 1px 7px;
}
.tree-group-summary:focus-visible,
.tree-link:focus-visible {
    outline: 2px solid #7fa9e0;
    outline-offset: 1px;
}
.tree-link.is-draft {
    background: #fff6f1;
    border-color: #f2d6c7;
}
.tree-link.is-draft .tree-link-status {
    color: #a43d1f;
    border-color: #efc6b2;
    background: #fff1e8;
}
.category-article-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.category-article-list li {
    border: 1px solid #d9e6f5;
    border-radius: 10px;
    background: #f6faff;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.category-article-list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}
.category-article-list a:hover {
    text-decoration: underline;
}
.home-content {
    min-width: 0;
    flex: 1 1 auto;
}
.home-category-table-panel {
    min-height: 420px;
}
.home-category-table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto;
}
.home-category-table th {
    white-space: nowrap;
    font-size: 0.86rem;
    background: color-mix(in oklab, var(--surface-strong) 90%, #dbeafe);
}
.home-category-table td {
    font-size: 0.9rem;
}
.home-table-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.home-table-controls select {
    width: auto;
    min-width: 90px;
    padding: 7px 10px;
    font-size: 0.86rem;
}
.home-table-label {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0;
}
.home-table-controls button {
    width: auto;
    margin: 0;
    padding: 7px 11px;
}
.home-table-sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}
.home-table-sort-link:hover {
    text-decoration: underline;
}
.home-category-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}
.home-table-pagination {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.button-link.is-disabled {
    pointer-events: none;
    opacity: 0.5;
}
.home-article-direct-link {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}
.home-article-direct-link:hover {
    text-decoration: underline;
}
.home-article-summary {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}
.home-detail,
.home-empty-state {
    border: 1px solid #dbe6f1;
    border-radius: 14px;
    background: var(--surface-strong);
    padding: 18px;
    min-height: 420px;
    box-shadow: 0 8px 22px #2e55830f;
}
.home-empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.home-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ebf1f7;
}
.home-detail-head h2 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: 0.01em;
}
.home-detail-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 0;
}
.article-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #c5d8f6;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 0.76rem;
    padding: 2px 9px;
}
.article-status.is-draft {
    border-color: #efc6b2;
    color: #9a3412;
    background: #fff3ec;
}
.tile-draft {
    border-color: #efb4c1;
    background: #fff7f8;
}

.prose {
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.prose img { max-width: 100%; }
.prose .rich-embed-remove { display: none !important; }
.prose .rich-embed {
    position: static;
    display: block;
    margin: 8px 0;
    cursor: default;
}
.summary {
    background: var(--primary-soft);
    padding: 12px;
    border-radius: 10px;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.category-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
}
.icon-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 7px; }
.category-list .icon-thumb {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    flex: 0 0 auto;
}
.category-picker {
    position: relative;
}
.category-picker-trigger {
    width: 100%;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.category-picker-trigger-content {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.category-picker-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 auto;
}
.category-picker-icon-placeholder {
    background: #e6eef6;
    border: 1px solid #d6e0ea;
}
.category-picker-caret {
    color: var(--muted);
    font-size: 0.9rem;
}
.category-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-strong);
    box-shadow: 0 10px 20px #2e558320;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 20;
}
.category-picker.is-open .category-picker-menu {
    display: block;
}
.category-picker-option {
    width: 100%;
    background: var(--surface-strong);
    color: var(--text);
    border: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    text-align: left;
}
.category-picker-option:hover,
.category-picker-option.is-selected {
    background: #eef5ff;
}

.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 8px 6px;
    vertical-align: middle;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: inset 0 0 0 1px #0000001a;
}
.status-dot-online {
    background: #22c55e;
}
.status-dot-offline {
    background: #94a3b8;
}
.twofa-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
    white-space: nowrap;
}
.twofa-badge-yes {
    background: #e7f9ef;
    border-color: #9ad7b0;
    color: #17603a;
}
.twofa-badge-no {
    background: #ffe9ee;
    border-color: #efb4c1;
    color: #8d1f37;
}
.users-search {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0 12px;
}
.users-search input[type="search"],
.users-search button,
.users-search .button-link {
    height: 42px;
}
.users-search input[type="search"] {
    flex: 1 1 auto;
}
.users-search button,
.users-search .button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.table-icon-actions {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    min-height: 32px;
}
.table-icon-actions form {
    margin: 0;
    display: flex;
    align-items: flex-start;
}
.table-icon-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--btn-ghost-text);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
    vertical-align: middle;
    box-sizing: border-box;
}
.table-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.table-icon-btn:hover {
    background: var(--btn-ghost-hover);
    border-color: color-mix(in oklab, var(--primary) 40%, var(--btn-ghost-border));
}
.table-icon-btn-danger {
    color: color-mix(in oklab, var(--btn-danger-bg) 65%, #ffffff);
    border-color: color-mix(in oklab, var(--btn-danger-bg) 55%, var(--btn-ghost-border));
}
.table-icon-btn-danger:hover {
    background: color-mix(in oklab, var(--btn-danger-bg) 25%, var(--btn-ghost-bg));
    border-color: var(--btn-danger-bg);
}
.card form > button[type="submit"] { margin-top: 14px; }
.card form .actions button[type="submit"] { margin-top: 0; }
.card form + p { margin-top: 14px; }
.login-hero {
    max-width: 460px;
    margin: 26px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.login-hero-logo {
    width: 210px;
    height: 210px;
    border-radius: 999px;
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 12px 28px #4f8bd833;
}
.login-hero-title {
    margin: 0;
    font-size: 1.15rem;
    color: #3c4f63;
    letter-spacing: 0.3px;
}

.rich-editor {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-strong);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    min-height: 460px;
}
.markdown-live-preview {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: color-mix(in oklab, var(--surface-strong) 92%, transparent);
}
.markdown-live-preview[hidden] {
    display: none !important;
}
.markdown-live-preview-head {
    padding: 8px 12px;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--surface-strong) 85%, #dbeafe);
}
.markdown-live-preview-body {
    padding: 12px;
    max-height: 260px;
    overflow: auto;
    background: color-mix(in oklab, var(--surface-strong) 96%, transparent);
    border-top: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}
.markdown-live-preview-body > :first-child {
    margin-top: 0;
}
.markdown-live-preview-body > :last-child {
    margin-bottom: 0;
}
.markdown-live-preview-body pre.wiki-code {
    margin: 0;
}
.markdown-live-preview-body h1,
.markdown-live-preview-body h2,
.markdown-live-preview-body h3 {
    line-height: 1.25;
    margin: 0.2em 0 0.5em;
}
.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--surface-strong) 90%, #dbeafe);
    position: sticky;
    top: 0;
    z-index: 5;
    flex: 0 0 auto;
}
.rich-toolbar button {
    width: auto;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 1rem;
}
.rich-toolbar button:hover {
    background: var(--btn-ghost-hover);
    border-color: color-mix(in oklab, var(--primary) 40%, var(--btn-ghost-border));
}
.rich-toolbar .tool-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
}
.rich-toolbar .tool-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.rich-toolbar .tool-btn svg circle {
    fill: none;
}
.rich-toolbar select,
.rich-toolbar input[type="color"] {
    width: auto;
    min-width: 90px;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--text);
}
.rich-toolbar select[data-action="fontFamily"] {
    min-width: 128px;
}
.rich-toolbar input[type="color"] {
    min-width: 52px;
    padding: 2px;
    min-height: 40px;
}
.rich-surface {
    min-height: 320px;
    padding: 12px;
    outline: none;
    line-height: 1.6;
    overflow-y: auto;
    flex: 1 1 auto;
}
.rich-surface img,
.rich-surface video,
.rich-surface iframe {
    max-width: 100%;
}
.rich-surface table,
.prose table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    margin: 10px 0;
}
.rich-surface th,
.rich-surface td,
.prose th,
.prose td {
    border: 1px solid color-mix(in oklab, var(--border) 80%, #64748b);
    padding: 8px 9px;
    vertical-align: top;
    word-break: break-word;
    min-width: 36px;
    min-height: 24px;
}
body.is-table-resizing,
body.is-table-resizing * {
    user-select: none !important;
}
.rich-surface th,
.prose th {
    background: color-mix(in oklab, var(--primary-soft) 55%, var(--surface-strong));
    font-weight: 700;
}
.rich-surface figure.wiki-figure {
    display: inline-block;
    max-width: 100%;
    margin: 10px 0;
}
.rich-surface figcaption.wiki-figcaption,
.prose figcaption.wiki-figcaption {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: .82rem;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.35;
}
.rich-surface figcaption.wiki-figcaption {
    min-height: 1.5em;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px dashed color-mix(in oklab, var(--border) 70%, transparent);
    background: color-mix(in oklab, var(--surface-strong) 92%, transparent);
    cursor: text;
}
.rich-surface figcaption.wiki-figcaption:focus {
    outline: 2px solid color-mix(in oklab, var(--primary) 36%, transparent);
    border-color: color-mix(in oklab, var(--primary) 50%, var(--border));
}
.rich-surface figcaption.wiki-figcaption:empty::before {
    content: attr(data-placeholder);
    color: color-mix(in oklab, var(--muted) 86%, #9ca3af);
    font-style: italic;
    pointer-events: none;
}
.prose figcaption.wiki-figcaption {
    border: 0;
    padding: 0;
    background: transparent;
}
.rich-surface .rich-embed {
    position: relative;
    display: inline-block;
    margin: 8px 0;
    max-width: 100%;
    cursor: default;
}
.rich-surface .rich-embed.rich-embed-block {
    display: block;
    width: 100%;
}
.rich-surface .rich-embed.is-edge-hover {
    cursor: move;
}
.rich-surface .rich-embed.is-dragging {
    opacity: 0.65;
}
.rich-surface .rich-drop-indicator {
    position: relative;
    height: 0;
    border-top: 2px solid var(--primary);
    margin: 8px 0;
    border-radius: 999px;
    opacity: 0.95;
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--primary) 35%, transparent);
    pointer-events: none;
}
.rich-surface .rich-drop-indicator::before,
.rich-surface .rich-drop-indicator::after {
    content: "";
    position: absolute;
    top: -6px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}
.rich-surface .rich-drop-indicator::before {
    left: 0;
    border-left: 7px solid var(--primary);
}
.rich-surface .rich-drop-indicator::after {
    right: 0;
    border-right: 7px solid var(--primary);
}
.rich-surface .rich-embed-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 999px;
    padding: 0;
    line-height: 20px;
    text-align: center;
    font-weight: 700;
    border: 1px solid #fff;
    background: #d53a45;
    color: #fff;
    z-index: 3;
    cursor: pointer;
    box-shadow: 0 2px 8px #00000033;
}
.rich-surface .rich-embed-image img {
    display: block;
}
.rich-surface img.wiki-photo-frame-soft,
.prose img.wiki-photo-frame-soft {
    border: 1px solid color-mix(in oklab, var(--border) 85%, #ffffff);
    border-radius: 10px;
    box-shadow: 0 10px 22px #00000024;
    padding: 4px;
    background: var(--surface-strong);
}
.rich-surface img.wiki-photo-frame-polaroid,
.prose img.wiki-photo-frame-polaroid {
    background: #fff;
    border: 1px solid #d9dde5;
    border-radius: 3px;
    padding: 8px 8px 26px;
    box-shadow: 0 14px 28px #0000002b;
}
.rich-surface img.wiki-photo-frame-lifted,
.prose img.wiki-photo-frame-lifted {
    border-radius: 12px;
    border: 1px solid color-mix(in oklab, var(--primary) 36%, var(--border));
    box-shadow:
        0 1px 0 color-mix(in oklab, var(--primary) 45%, transparent),
        0 16px 28px #0000002e;
    outline: 1px solid color-mix(in oklab, var(--primary) 18%, transparent);
    outline-offset: 2px;
}
.rich-surface .rich-embed-image .rich-embed-resize {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 13px;
    height: 13px;
    border-radius: 3px;
    border: 1px solid #ffffffd0;
    background:
        linear-gradient(135deg, transparent 0 35%, #ffffff95 35% 46%, transparent 46% 58%, #ffffffc8 58% 70%, transparent 70% 100%),
        color-mix(in oklab, var(--primary) 80%, #0f172a);
    box-shadow: 0 2px 8px #0000003a;
    cursor: nwse-resize;
    z-index: 3;
}
.rich-surface .rich-embed-image.is-resizing .rich-embed-resize {
    filter: brightness(1.15);
}
.rich-surface .rich-selected-media {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.rich-surface .wiki-code {
    background: #1f2937;
    color: #f3f4f6;
    border-left: 4px solid #9ca3af;
    padding: 0;
    border-radius: 6px;
    overflow: auto;
    white-space: pre-wrap;
    font-family: Consolas, "Courier New", monospace;
    min-height: 84px;
    margin: 0;
    cursor: text;
}
.rich-surface .wiki-code code {
    display: block;
    min-height: 84px;
    padding: 12px 14px;
    box-sizing: border-box;
    line-height: 1.5;
    tab-size: 4;
    white-space: pre-wrap;
    cursor: text;
}
.rich-surface .wiki-code code.hljs {
    background: transparent !important;
}
.prose pre.wiki-code,
.prose .wiki-code {
    background: #1f2937;
    color: #f3f4f6;
    border-left: 4px solid #9ca3af;
    padding: 10px 12px;
    border-radius: 6px;
    overflow: auto;
    white-space: pre-wrap;
    font-family: Consolas, "Courier New", monospace;
}
.prose pre.wiki-code code {
    display: block;
    background: transparent;
    padding: 0;
}
.prose figure.wiki-figure {
    margin: 12px 0;
    max-width: 100%;
}
.prose figure.wiki-figure img {
    display: block;
    max-width: 100%;
    height: auto;
}
.article-end-marker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 14px;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.article-end-marker::before,
.article-end-marker::after {
    content: "";
    height: 1px;
    background: color-mix(in oklab, var(--border) 82%, transparent);
    flex: 1 1 auto;
}

.print-watermark-img,
.print-footer {
    display: none;
}

body.is-login-page {
    overflow: hidden;
}
body.is-login-page .container {
    margin: 10px auto;
}
body.is-login-page .app-footer {
    margin-top: 0;
}

.admin-dashboard h1 {
    margin-bottom: 14px;
}
.admin-grid {
    display: grid;
    gap: 14px;
}
.admin-grid-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}
.admin-grid-main {
    grid-template-columns: 1.2fr 1fr;
    align-items: start;
}
.admin-stat-card,
.admin-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-strong);
    padding: 12px;
    height: fit-content;
}
.admin-collapsible {
    padding: 0;
    overflow: hidden;
}
.admin-panel-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    cursor: pointer;
    padding: 12px;
    user-select: none;
}
.admin-panel-summary::-webkit-details-marker {
    display: none;
}
.admin-panel-summary h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.admin-panel-summary::after {
    content: "▸";
    color: #64748b;
    font-size: 0.9rem;
    transform: rotate(90deg);
    transition: transform 0.2s ease;
}
.admin-panel:not([open]) .admin-panel-summary::after {
    transform: rotate(0deg);
}
.admin-panel-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #dc2626;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.admin-panel-dot.is-visible {
    opacity: 1;
    transform: scale(1);
    animation: admin-panel-blink 1.2s ease-in-out infinite;
}
.admin-panel[open] .admin-panel-summary {
    border-bottom: 1px solid var(--border);
}
.admin-panel-body {
    padding: 12px;
}
@keyframes admin-panel-blink {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.admin-stat-card h3,
.admin-panel h2 {
    margin: 0 0 8px;
}
.admin-stat-card strong {
    font-size: 1.35rem;
}
.admin-stat-card p {
    margin: 6px 0 0;
}
.admin-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
}
.admin-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.admin-pending-list {
    background: #f7fbff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    max-height: 180px;
    overflow: auto;
    margin: 8px 0 12px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.88rem;
}
.admin-inline-form {
    margin: 10px 0;
}
.admin-inline-form.admin-inline-form-compact {
    display: inline-block;
    margin: 0 0 0 6px;
}
.admin-draft-actions {
    white-space: nowrap;
}
.admin-panel fieldset {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    margin: 0;
}
.admin-panel fieldset:disabled {
    opacity: 0.75;
}
.admin-request-list {
    display: grid;
    gap: 10px;
}
.admin-request-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: color-mix(in oklab, var(--surface-strong) 92%, #dbeafe);
}
.admin-request-item p {
    margin: 6px 0;
}
.admin-maillog-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: color-mix(in oklab, var(--surface-strong) 92%, #dbeafe);
}
.admin-maillog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.admin-maillog-table tbody tr:nth-child(even) {
    background: color-mix(in oklab, var(--surface-strong) 92%, #dbeafe);
}
.admin-maillog-table tbody tr:nth-child(odd) {
    background: color-mix(in oklab, var(--surface-strong) 98%, #dbeafe);
}
.admin-log-pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    font-size: 0.85rem;
}
.admin-log-pagination a {
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 10px;
    background: color-mix(in oklab, var(--surface-strong) 96%, #dbeafe);
}
.log-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}
.log-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}
.log-modal-dialog {
    position: relative;
    max-width: 760px;
    width: min(92vw, 760px);
    max-height: 84vh;
    margin: 6vh auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}
.log-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.log-modal-head h3 {
    margin: 0;
    font-size: 1rem;
}
.log-modal-close {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-strong);
    padding: 2px 10px;
    cursor: pointer;
}
.log-modal-body {
    padding: 12px;
    max-height: calc(84vh - 52px);
    overflow: auto;
    font-size: 0.88rem;
}
.log-modal-body pre {
    max-height: 320px;
    overflow: auto;
}
.admin-maillog-table th,
.admin-maillog-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.admin-maillog-table thead th {
    background: color-mix(in oklab, var(--surface-strong) 85%, #dbeafe);
    font-weight: 700;
}
.admin-maillog-table tbody tr:last-child td {
    border-bottom: 0;
}
.admin-maillog-details {
    position: relative;
}
.admin-maillog-details summary {
    list-style: none;
}
.admin-maillog-details summary::-webkit-details-marker {
    display: none;
}
.admin-maillog-info-btn {
    width: 22px;
    height: 22px;
    border: 1px solid var(--btn-info-border);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--btn-info-text);
    background: var(--btn-info-bg);
    cursor: pointer;
    user-select: none;
}
.admin-maillog-info-btn:hover {
    background: var(--btn-info-hover);
}
.admin-maillog-info-card {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-strong);
    min-width: 320px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}
.admin-maillog-info-card p {
    margin: 4px 0;
    font-size: 0.8rem;
}
.admin-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-top: 6px;
}
.admin-detail-table th,
.admin-detail-table td {
    border: 1px solid var(--border);
    padding: 5px 7px;
    text-align: left;
    vertical-align: top;
}
.admin-detail-table th {
    background: color-mix(in oklab, var(--surface-strong) 88%, #dbeafe);
    font-weight: 700;
}

.help-page h1 {
    margin-bottom: 8px;
}

.article-form-meta-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 8px 0 12px;
    flex-wrap: wrap;
}

.autosave-banner {
    display: none;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    margin: 8px 0 12px;
}

.autosave-banner.is-visible {
    display: block;
}

.autosave-banner .inline-actions {
    margin-top: 8px;
}

.autosave-status {
    min-height: 20px;
    margin: 4px 0 10px;
    font-size: 13px;
    color: var(--muted);
}

.autosave-status.is-success {
    color: #16a34a;
}

.autosave-status.is-error {
    color: #dc2626;
}

mark.search-highlight-mark {
    background: color-mix(in oklab, #facc15 72%, #ffffff);
    color: #111827;
    padding: 0 2px;
    border-radius: 3px;
}

.diff-block {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.diff-line {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    white-space: pre-wrap;
    font-size: 13px;
}

.diff-line:last-child {
    border-bottom: 0;
}

.diff-line-added {
    background: rgba(25, 135, 84, 0.14);
}

.diff-line-removed {
    background: rgba(220, 53, 69, 0.14);
}

.diff-line-same {
    background: transparent;
}
.help-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.help-card {
    margin-top: 12px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
.help-card h2 {
    margin: 0 0 8px;
}
.help-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.6;
}
.help-icon-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.help-icon-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: color-mix(in oklab, var(--surface-strong) 92%, #dbeafe);
}
.help-icon {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-strong);
}
.help-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.help-icon strong {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    font-weight: 700;
    line-height: 1;
}
.help-icon-danger {
    color: #b91c1c;
    border-color: #efb4c1;
}

:root[data-theme="dark"] .bg-shape-a { background: #5b2c4a; }
:root[data-theme="dark"] .bg-shape-b { background: #1f4d45; }
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    background: #0b1424;
    color: var(--text);
    border-color: var(--border);
}
:root[data-theme="dark"] .topnav-greeting {
    color: #d4e2f2;
    border-color: #2f445f;
    background: #101f35;
}
:root[data-theme="dark"] .topnav-user-role,
:root[data-theme="dark"] .topnav-user-rights {
    color: #cce3ff;
    border-color: #365075;
    background: #1a2e4d;
}
:root[data-theme="dark"] .home-tree {
    border-right-color: #2f435f;
}
:root[data-theme="dark"] .tree-group {
    border-color: #2f435f;
    box-shadow: 0 3px 12px #00000033;
}
:root[data-theme="dark"] .tree-group[open] {
    border-color: #46638a;
}
:root[data-theme="dark"] .tree-group-summary {
    border-bottom-color: #2f435f;
    background: linear-gradient(180deg, #15243b, #122033);
}
:root[data-theme="dark"] .tree-group-summary::before {
    border-right-color: #9cb6d7;
    border-bottom-color: #9cb6d7;
}
:root[data-theme="dark"] .tree-group[open] .tree-group-summary::before {
    border-right-color: #b7d2f7;
    border-bottom-color: #b7d2f7;
}
:root[data-theme="dark"] .tree-count {
    color: #c9daef;
    border-color: #3d5678;
    background: #16263d;
}
:root[data-theme="dark"] .tree-list {
    background: linear-gradient(180deg, #111d30, #0f1a2b);
}
:root[data-theme="dark"] .tree-list::before {
    background: linear-gradient(180deg, #49648a, #2a3d57);
}
:root[data-theme="dark"] .tree-list li::before {
    background: #4b6891;
}
:root[data-theme="dark"] .tree-link {
    border-color: #2e4564;
    background: #132137;
}
:root[data-theme="dark"] .tree-category-link.is-selected {
    color: #cde2ff;
}
:root[data-theme="dark"] .tree-link-status {
    color: #d2e7ff;
    border-color: #456792;
    background: #1a2e4d;
}
:root[data-theme="dark"] .category-article-list li {
    border-color: #345172;
    background: #132238;
}
:root[data-theme="dark"] .category-article-list a {
    color: #dce9fb;
}
:root[data-theme="dark"] .home-category-table-wrap {
    border-color: #345172;
}
:root[data-theme="dark"] .home-category-table th {
    background: #182b45;
}
:root[data-theme="dark"] .home-table-sort-link {
    color: #dce9fb;
}
:root[data-theme="dark"] .home-article-direct-link {
    color: #dce9fb;
}
:root[data-theme="dark"] .category-picker-icon-placeholder {
    background: #132238;
    border-color: #345070;
}
:root[data-theme="dark"] .category-picker-option:hover,
:root[data-theme="dark"] .category-picker-option.is-selected {
    background: #1a2e4d;
}
:root[data-theme="dark"] .status-dot-offline {
    background: #647792;
}
:root[data-theme="dark"] .twofa-badge-yes {
    background: #133524;
    border-color: #2f7a52;
    color: #b9f0d0;
}
:root[data-theme="dark"] .twofa-badge-no {
    background: #3b1722;
    border-color: #8b3f55;
    color: #ffc3d2;
}
:root[data-theme="dark"] .admin-pending-list {
    background: #132238;
    border-color: #365172;
    color: #d9e8fa;
}
:root[data-theme="dark"] .admin-request-item,
:root[data-theme="dark"] .admin-maillog-wrap,
:root[data-theme="dark"] .help-icon-item {
    background: #132238;
    border-color: #365172;
}
:root[data-theme="dark"] .admin-maillog-table thead th {
    background: #182b45;
}
:root[data-theme="dark"] .help-icon-danger {
    color: #ff9cad;
    border-color: #b85a6d;
}
:root[data-theme="dark"] .alert-success { background: #103321; color: #b8f5d4; border-color: #1f6b49; }
:root[data-theme="dark"] .alert-warning { background: #3a2d11; color: #ffe7ae; border-color: #72561f; }
:root[data-theme="dark"] .alert-error { background: #3a1620; color: #ffc5d0; border-color: #7e2b3e; }
:root[data-theme="dark"] .twofa-hint-banner {
    border-color: #35557e;
    background: linear-gradient(135deg, #162842, #143427);
}
:root[data-theme="dark"] .twofa-hint-banner-text {
    color: #d6e8ff;
}
:root[data-theme="dark"] .twofa-hint-link {
    border-color: #4871a3;
    background: #1a3152;
    color: #d7e9ff;
}
:root[data-theme="dark"] .twofa-hint-link:hover {
    background: #244066;
}
:root[data-theme="dark"] .twofa-hint-close {
    border-color: #3e5f8b;
    background: #162943;
    color: #d7e8fb;
}
:root[data-theme="dark"] .twofa-hint-close:hover {
    background: #1f385b;
}
:root[data-theme="dark"] .article-status {
    border-color: #38619c;
    color: #cde2ff;
    background: #162945;
}
:root[data-theme="dark"] .article-status.is-draft {
    border-color: #8d593e;
    color: #ffd8bf;
    background: #3a2417;
}
:root[data-theme="dark"] .tree-link:hover {
    background: #172942;
    border-color: #39577c;
}
:root[data-theme="dark"] .tree-link.is-selected {
    background: #1a3152;
    border-color: #4d76a8;
}
:root[data-theme="dark"] .tree-link.is-draft {
    background: #312117;
    border-color: #80553b;
}
:root[data-theme="dark"] .topnav a:hover {
    border-color: #4a678e;
    background: #1b2b45;
}
:root[data-theme="dark"] .topnav a.topnav-logout {
    color: #ffd7df;
    background: #3a1b25;
    border-color: #8a4a5b;
}
.admin-rate-table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 10px 0 14px;
    background: color-mix(in oklab, var(--surface-strong) 96%, #dbeafe);
}
.admin-rate-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}
.admin-rate-table th,
.admin-rate-table td {
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}
.admin-rate-table tbody tr:last-child td {
    border-bottom: 0;
}
.admin-rate-table td input[type="number"] {
    margin: 0;
    width: 100%;
    min-width: 110px;
}

.media-kind-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.media-kind-pdf { color: #d11f4a; border-color: rgba(209, 31, 74, 0.35); }
.media-kind-img { color: #1f9d74; border-color: rgba(31, 157, 116, 0.35); }
.media-kind-aud { color: #8a46d9; border-color: rgba(138, 70, 217, 0.35); }
.media-kind-vid { color: #2d7cf6; border-color: rgba(45, 124, 246, 0.35); }
.media-kind-doc, .media-kind-xls, .media-kind-ppt, .media-kind-txt, .media-kind-zip {
    color: var(--text-main);
}

@media (max-width: 900px) {
    .split { grid-template-columns: 1fr; }
    .filter-row { grid-template-columns: 1fr; }
    .topbar {
        padding: 12px 14px;
    }
    .topnav {
        width: 100%;
        margin-left: 0;
    }
    .topnav-userline,
    .topnav-links {
        justify-content: flex-start;
    }
    .home-layout {
        display: block;
        min-height: 0;
    }
    .home-tree {
        width: 100%;
        border-right: 0;
        padding-right: 0;
        margin-bottom: 14px;
    }
    .home-detail-head {
        flex-direction: column;
    }
    .admin-grid-stats,
    .admin-grid-main,
    .help-grid,
    .help-icon-grid { grid-template-columns: 1fr; }
    .admin-rate-table {
        min-width: 520px;
    }
}

@media print {
    @page {
        margin: 12mm 12mm 20mm;
    }
    .topbar, .inline-actions, .alert, form, .app-footer { display: none !important; }
    body {
        background: white;
        position: relative;
        min-height: auto !important;
    }
    body::before {
        content: "";
        position: fixed;
        inset: 0;
        background-image: var(--print-watermark-image, none);
        background-repeat: no-repeat;
        background-position: center;
        background-size: 72%;
        opacity: 0.06;
        pointer-events: none;
        z-index: -1;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .container {
        width: auto !important;
        margin: 0 !important;
        max-width: none !important;
    }
    .card { border: 0; box-shadow: none; padding: 0; overflow: visible !important; }
    .card > :not(.print-only-article) {
        display: none !important;
    }
    .print-only-article {
        display: block !important;
        position: relative;
        z-index: 1;
    }
    .prose, .prose * { overflow: visible !important; }
    .prose pre, .prose .wiki-code {
        overflow: visible !important;
        white-space: pre-wrap !important;
        break-inside: auto;
        page-break-inside: auto;
    }
    .prose img, .prose video, .prose iframe, .prose figure {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }
    .print-watermark-img {
        display: block !important;
        position: fixed;
        inset: 0;
        pointer-events: none;
        z-index: -1;
    }
    .print-watermark-img img {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 72%;
        max-width: 920px;
        opacity: 0.06;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .print-footer {
        display: flex !important;
        position: fixed;
        left: 12mm;
        right: 12mm;
        bottom: 6mm;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding-top: 4px;
        border-top: 1px solid #cbd5e1;
        font-size: 9.5pt;
        color: #475569;
        z-index: 2;
    }
    .print-footer-page::after {
        content: "Seite " counter(page);
    }
}
