:root {
    --bg: #f7f8fa;
    --panel: #ffffff;
    --panel-soft: #fbfcfe;
    --text: #1f2937;
    --muted: #667085;
    --border: #d9dee7;
    --border-soft: #e8ecf2;
    --primary: #2f6fed;
    --primary-strong: #1f56c8;
    --accent: #f97316;
    --selected-green: #00a651;
    --danger: #b42318;
    --code-bg: #f6f8fa;
    --code-text: #172033;
    --code-muted: #7b8794;
    --code-border: #eef1f5;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.mobile-nav-btn,
.mobile-nav-mask {
    display: none;
}

.app-shell {
    height: 100vh;
    min-width: 960px;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
}

.topbar {
    height: 52px;
    padding: 0 16px;
    border: 1px solid var(--code-border);
    border-bottom: 1px solid var(--border-soft);
    background: #ffffff;
    border-radius: 0;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex: 0 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.brand strong {
    font-size: 17px;
    letter-spacing: 0;
}

.global-search {
    position: relative;
    width: min(520px, 42vw);
    flex: 0 1 520px;
}

.global-search input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 12px;
    outline: none;
    background: #f8fafc;
    color: var(--text);
}

.global-search input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: none;
}

.search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 40;
    max-height: min(520px, calc(100vh - 92px));
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
}

.search-group {
    padding: 8px 10px 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.search-result {
    width: 100%;
    border: 0;
    background: transparent;
    display: grid;
    gap: 4px;
    text-align: left;
    padding: 10px;
    border-radius: 7px;
    color: var(--text);
}

.search-result:hover {
    background: #f1f6ff;
}

.search-result span {
    font-weight: 600;
    line-height: 1.35;
}

.search-result small,
.search-empty {
    color: var(--muted);
}

.search-empty {
    padding: 16px 10px;
}

.top-actions,
.toolbar-actions,
.panel-actions,
.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.workspace {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
    gap: 0;
}

.category-panel,
.menu-rail,
.content-panel {
    min-height: 0;
    background: var(--panel);
    border: 1px solid var(--border-soft);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.menu-rail {
    width: 80px;
    flex: 0 0 80px;
    border-left: 0;
    border-top: 0;
    border-bottom: 0;
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    background: #f8fafc;
    overflow-y: auto;
    z-index: 4;
}

.menu-add-btn {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    display: grid;
    place-items: center;
    padding: 0;
}

.menu-add-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
}

.menu-list {
    width: 100%;
    display: grid;
    gap: 8px;
}

.menu-item {
    width: 100%;
    min-height: 66px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 5px;
    padding: 7px 4px;
    text-align: center;
}

.menu-item:hover {
    background: #fff;
    border-color: var(--border-soft);
    color: var(--primary);
}

.menu-item.active {
    background: #fff;
    border-color: rgba(47, 111, 237, 0.22);
    color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}

.menu-item[draggable="true"] {
    cursor: grab;
}

.menu-item.dragging,
.menu-item.drop-target {
    opacity: 0.62;
    background: #eef6ff;
    border-color: var(--primary);
}

.menu-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.menu-title {
    width: 100%;
    font-size: 12px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-panel {
    width: 360px;
    min-width: 240px;
    max-width: 620px;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    z-index: 2;
    border-left: 0;
    border-top: 0;
    border-bottom: 0;
    box-shadow: none;
}

.content-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 360px;
    z-index: 3;
    position: relative;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: inset 8px 8px 18px rgba(15, 23, 42, 0.08);
}

.content-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 8px 8px 18px rgba(15, 23, 42, 0.08);
    z-index: 4;
}

.panel-head {
    min-height: 54px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-soft);
    background: #ffffff;
}

.panel-head h2,
.modal-head h2 {
    margin: 0;
    font-size: 15px;
}

.muted {
    color: var(--muted);
}

.field {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.field.compact {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--panel-soft);
}

.category-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: end;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--panel-soft);
}

.category-filter-row .field.compact {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
}

.category-filter-row .icon-btn {
    width: 32px;
    height: 36px;
    background: #fff;
    border: 1px solid var(--border);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 9px 10px;
    color: var(--text);
    outline: none;
    background: #fff;
}

.menu-icon-picker {
    display: grid;
    gap: 10px;
}

.menu-icon-preview {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--text);
}

.menu-icon-preview img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.menu-icon-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.menu-icon-option {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    display: grid;
    place-items: center;
}

.menu-icon-option.active,
.menu-icon-option:hover {
    border-color: var(--primary);
    background: #f1f6ff;
}

.menu-icon-option img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-inline input {
    flex: 1 1 auto;
}

.field-inline .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.editor-check-row {
    justify-content: flex-start;
    color: var(--text);
    padding: 8px 0;
}

.media-upload-row {
    justify-content: flex-start;
}

.media-file-name {
    min-width: 0;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-select {
    position: relative;
}

.search-select-trigger {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    padding: 9px 34px 9px 10px;
    text-align: left;
    position: relative;
}

.search-select-trigger::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 0;
    height: 0;
    margin-top: -2px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #667085;
}

.search-select-trigger:focus {
    border-color: var(--primary);
    outline: none;
}

.search-select-dropdown {
    position: absolute;
    z-index: 95;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(17, 24, 39, 0.16);
}

.search-select-input {
    margin-bottom: 8px;
}

.search-select-options {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    gap: 2px;
}

.search-select-option {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    border-radius: 4px;
    padding: 8px 10px;
    text-align: left;
}

.search-select-option:hover,
.search-select-option.active {
    background: #f1f6ff;
    color: var(--primary);
}

.search-select-empty {
    padding: 12px 10px;
    color: var(--muted);
    font-size: 12px;
}

.editor-format-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    background: #f8fafc;
}

.editor-format-toolbar .btn {
    min-height: 30px;
    padding: 0 9px;
    font-size: 12px;
}

.editor-format-toolbar select,
.editor-format-toolbar input[type="color"] {
    width: auto;
    min-height: 34px;
}

.editor-format-toolbar input[type="color"] {
    width: 42px;
    padding: 4px;
}

.editor-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
    gap: 12px;
    min-height: 360px;
}

.editor-workbench textarea {
    min-height: 420px;
}

.editor-preview {
    min-height: 420px;
    max-height: 680px;
    overflow: auto;
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    padding: 16px;
    background: #fff;
}

.field textarea {
    width: 100%;
    min-height: 360px;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: none;
}

.tree-list {
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
    padding: 8px 10px 16px;
    background: #ffffff;
}

.tree-category {
    display: block;
}

.tree-row {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    border-radius: 5px;
    margin: 1px 0;
    padding-left: calc(8px + var(--level, 0) * 19px);
    padding-right: 8px;
}

.tree-row:hover {
    background: #f8fafc;
}

.category-row.active {
    background: #f3f6fb;
}

.article-row.active {
    background: transparent;
}

.tree-toggle {
    width: 14px;
    height: 22px;
    border: 0;
    background: transparent;
    padding: 0;
    flex: 0 0 auto;
    position: relative;
}

.tree-toggle::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 7px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid #0f172a;
}

.tree-toggle.expanded::before {
    left: 2px;
    top: 9px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #0f172a;
    border-bottom: 0;
}

.tree-label {
    min-width: 0;
    flex: 1 1 auto;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    color: inherit;
    text-align: left;
}

.tree-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: #0f172a;
}

.tree-count {
    display: none;
}

.article-row {
    align-items: center;
    min-height: 35px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.article-dot {
    width: 4px;
    height: 4px;
    margin-left: 4px;
    margin-right: 8px;
    margin-top: 0;
    border-radius: 50%;
    background: #0f172a;
    flex: 0 0 auto;
}

.tree-article-main {
    min-width: 0;
    display: grid;
    gap: 0;
    flex: 1 1 auto;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    color: inherit;
}

.article-title-line {
    display: flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    width: fit-content;
    border-bottom: 1px solid #edf1f6;
    padding-bottom: 2px;
}

.article-icons {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
    margin-right: 6px;
}

.article-icon {
    display: block;
    width: 15px;
    height: 15px;
    object-fit: contain;
    flex: 0 0 15px;
}

.article-icon-lock {
    opacity: 0.88;
}

.article-title {
    display: inline-block;
    min-width: 0;
    font-weight: 400;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0f172a;
    max-width: 100%;
}

.article-row.active .article-dot {
    background: var(--selected-green);
}

.article-row.active .article-title-line {
    border-bottom-color: rgba(0, 166, 81, 0.45);
}

.article-row.active .article-title {
    color: var(--selected-green);
    font-weight: 700;
}

.article-row:hover .article-title {
    color: var(--primary);
}

.article-row.active:hover .article-title {
    color: var(--selected-green);
}

.category-row[draggable="true"],
.article-row[draggable="true"] {
    cursor: grab;
}

.category-row.dragging,
.article-row.dragging {
    opacity: 0.55;
    background: #f1f6ff;
}

.tree-row.drop-target {
    outline: 1px dashed var(--primary);
    outline-offset: -2px;
    background: #eef6ff;
}

.article-meta {
    display: none;
}

.tree-delete-btn {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #9aa3b2;
    flex: 0 0 auto;
    opacity: 0;
    line-height: 1;
    font-size: 16px;
}

.tree-row:hover .tree-delete-btn {
    opacity: 1;
}

.tree-delete-btn:hover {
    background: #fff1f1;
    color: var(--danger);
}

.tree-empty-child {
    min-height: 30px;
    padding-left: calc(30px + var(--level, 0) * 19px);
    display: flex;
    align-items: center;
    color: #9aa3b2;
    font-size: 12px;
}

.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 7px;
    height: 100%;
    cursor: col-resize;
    z-index: 8;
}

.resize-handle:hover {
    background: rgba(47, 111, 237, 0.16);
}

.content-toolbar {
    min-height: 76px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.content-toolbar h1 {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.3;
}

.content-toolbar p {
    margin: 0;
}

.article-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    padding: 5px 12px 0;
    border-bottom: 1px solid var(--border-soft);
    background: #f8fafc;
    overflow-x: auto;
    position: relative;
    z-index: 6;
    flex: 0 0 auto;
}

.article-tab {
    max-width: 220px;
    height: 33px;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 5px 5px 0 0;
    background: transparent;
    color: var(--muted);
    flex: 0 0 auto;
}

.article-tab.active {
    background: #fff;
    border-color: var(--border-soft);
    color: var(--text);
}

.article-tab-main,
.article-tab-close {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.article-tab-main {
    min-width: 0;
    max-width: 176px;
    padding: 8px 8px 7px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-tab-close {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    line-height: 1;
    font-size: 16px;
}

.article-tab-close:hover {
    background: #eef2f7;
    color: #dc2626;
}

.content-labels {
    min-height: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.label-chip {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    min-height: 24px;
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
}

.label-name {
    padding: 3px 6px;
    background: #eef2f7;
    color: #64748b;
    border-right: 1px solid var(--border-soft);
}

.label-value {
    padding: 3px 8px;
    color: #1f2937;
}

.markdown-body,
.editor {
    padding: 22px 28px 40px;
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
    background: #ffffff;
}

.markdown-body {
    line-height: 1.75;
    color: #111827;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    line-height: 1.35;
    margin: 24px 0 12px;
}

.markdown-body p {
    margin: 12px 0;
    white-space: pre-wrap;
}

.markdown-body .markdown-title-line {
    margin: 0 0 16px;
    font-size: 17px;
    line-height: 1.45;
    color: #0f172a;
}

.markdown-body strong {
    font-weight: 700;
}

.markdown-body em {
    font-style: italic;
}

.markdown-body del {
    color: var(--muted);
}

.markdown-body ul,
.markdown-body ol {
    margin: 8px 0 16px;
    padding-left: 26px;
}

.markdown-body ul {
    list-style: disc;
}

.markdown-body ol {
    list-style: decimal;
}

.markdown-body li {
    margin: 7px 0;
    padding-left: 2px;
}

.markdown-body hr {
    width: 100%;
    height: 1px;
    border: 0;
    background: var(--border-soft);
    margin: 22px 0;
}

.markdown-body blockquote {
    margin: 14px 0 16px 22px;
    padding: 2px 0 2px 14px;
    border-left: 2px solid #b7c0cc;
    background: transparent;
    color: #111827;
}

.markdown-body blockquote p {
    margin: 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 20px;
    font-size: 14px;
}

.markdown-body th,
.markdown-body td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.markdown-body th {
    color: #0f172a;
    font-weight: 600;
    background: #fff;
}

.markdown-body td code {
    display: inline-block;
    background: #eef2f7;
    color: #111827;
    border-radius: 6px;
    padding: 2px 6px;
}

.markdown-body a {
    color: var(--primary);
}

.markdown-body img {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.markdown-body pre {
    position: relative;
    background: var(--code-bg);
    color: var(--code-text);
    max-width: 760px;
    box-sizing: border-box;
    margin: 14px 0 18px 22px;
    padding: 46px 16px 18px;
    border-radius: 10px;
    border: 0;
    overflow-x: auto;
    line-height: 1.7;
    box-shadow: none;
}

.markdown-body code {
    font-family: Consolas, "Courier New", monospace;
}

.markdown-body pre code {
    display: block;
    font-size: 13px;
    color: #0f172a;
}

.markdown-body :not(pre) > code {
    background: #eef2f7;
    padding: 2px 5px;
    border-radius: 4px;
}

.external-frame-wrap {
    height: 100%;
    min-height: calc(100vh - 154px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.external-frame {
    width: 100%;
    flex: 1 1 auto;
    min-height: 520px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.external-fallback {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.media-player-wrap,
.locked-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 18px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.media-player {
    width: 100%;
    display: block;
    background: #0f172a;
    border-radius: 6px;
}

audio.media-player {
    background: transparent;
}

video.media-player {
    max-height: calc(100vh - 230px);
}

.locked-content {
    display: grid;
    gap: 12px;
    color: var(--text);
}

.locked-content h2 {
    margin: 0;
    font-size: 18px;
}

.locked-content p {
    margin: 0;
    color: var(--muted);
}

.code-lang {
    position: absolute;
    top: 14px;
    left: 16px;
    display: block;
    color: #0f172a;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 0;
}

.code-block-actions {
    position: absolute;
    top: 12px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.copy-code-btn {
    border: 0;
    background: transparent;
    color: #4b5563;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    min-height: 28px;
}

.copy-code-btn:hover {
    background: #eef2f7;
    color: var(--primary);
}

.code-token-command {
    color: #2563eb;
}

.code-token-keyword {
    color: #7c3aed;
}

.code-token-key {
    color: #0369a1;
}

.code-token-option {
    color: #4f46e5;
}

.code-token-number {
    color: #ea580c;
}

.code-token-string {
    color: #0f766e;
}

.code-token-comment {
    color: #94a3b8;
    font-style: italic;
}

.editor {
    display: grid;
    gap: 14px;
    align-content: start;
}

.btn,
.icon-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 7px;
    min-height: 34px;
    padding: 7px 12px;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icon-btn {
    width: 32px;
    padding: 0;
    font-weight: 700;
}

.btn:hover,
.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(47, 111, 237, 0.12);
}

.btn.primary,
.btn:not(.ghost) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn.primary:hover,
.btn:not(.ghost):hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #fff;
}

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

.btn.danger:hover {
    background: #991b1b;
    border-color: #991b1b;
    color: #fff;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.42);
    display: grid;
    place-items: center;
    z-index: 50;
}

.modal[hidden] {
    display: none;
}

.modal-card {
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    display: grid;
    gap: 14px;
    box-shadow: 0 18px 60px rgba(17, 24, 39, 0.24);
}

.modal-card.wide {
    width: min(560px, calc(100vw - 32px));
}

.confirm-card {
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    gap: 0;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.confirm-card .modal-head {
    min-height: 44px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border-soft);
    background: #f8fafc;
}

.confirm-card .modal-head h2 {
    font-size: 14px;
    font-weight: 600;
}

.confirm-message {
    margin: 0;
    padding: 22px 18px;
    color: #1f2937;
    line-height: 1.65;
}

.confirm-card .modal-actions {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--border-soft);
    background: #fff;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-actions {
    justify-content: flex-end;
}

.modal-hint {
    margin: 0;
    font-size: 12px;
}

.context-menu {
    position: fixed;
    z-index: 90;
    width: 168px;
    min-width: 168px;
    max-height: min(70vh, 520px);
    overflow: auto;
    box-sizing: border-box;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(17, 24, 39, 0.18);
}

.context-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 9px 10px;
    border-radius: 6px;
    text-align: left;
}

.context-menu button:hover {
    background: #f1f6ff;
    color: var(--primary);
}

.category-menu {
    min-width: 150px;
}

.menu-context-menu {
    min-width: 130px;
}

.category-menu button {
    font-weight: 500;
}

#pasteCodeInput {
    width: 100%;
    min-height: 260px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    background: #111827;
    color: #fff;
    padding: 10px 14px;
    border-radius: 7px;
    max-width: 420px;
    z-index: 80;
}

.empty {
    color: var(--muted);
    padding: 24px 14px;
    min-height: 100%;
    display: grid;
    place-items: center;
    text-align: center;
}

@media (max-width: 980px) {
    .app-shell {
        min-width: 0;
    }

    .workspace {
        overflow-x: auto;
    }

    .global-search {
        width: 320px;
        flex-basis: 320px;
    }

    .editor-workbench {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    html,
    body {
        overflow-x: hidden;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .app-shell {
        width: 100%;
        min-width: 0;
        height: 100vh;
    }

    .topbar {
        height: 52px;
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 0 12px;
        overflow: hidden;
    }

    .mobile-nav-btn {
        width: 36px;
        height: 36px;
        border: 1px solid var(--border);
        border-radius: 7px;
        background: #fff;
        color: var(--text);
        display: inline-grid;
        place-items: center;
        padding: 0;
    }

    .mobile-nav-btn svg {
        width: 18px;
        height: 18px;
    }

    .brand {
        min-width: 0;
        overflow: hidden;
    }

    .brand strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .global-search {
        display: none;
    }

    .top-actions {
        min-width: 0;
        gap: 6px;
    }

    .top-actions .btn {
        min-height: 34px;
        padding: 6px 9px;
        white-space: nowrap;
    }

    #topNewArticleBtn,
    #clearDeletedBtn,
    #settingBtn {
        display: none !important;
    }

    .workspace {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .mobile-nav-mask {
        position: fixed;
        inset: 52px 0 0 0;
        z-index: 70;
        background: rgba(15, 23, 42, 0.36);
    }

    body.mobile-nav-open .mobile-nav-mask {
        display: block;
    }

    .menu-rail,
    .category-panel {
        position: fixed;
        left: 0;
        width: min(88vw, 360px) !important;
        max-width: min(88vw, 360px);
        flex-basis: auto !important;
        border-right: 1px solid var(--border-soft);
        transform: translateX(-105%);
        transition: transform 180ms ease;
        z-index: 80;
    }

    body.mobile-nav-open .menu-rail,
    body.mobile-nav-open .category-panel {
        transform: translateX(0);
    }

    .menu-rail {
        top: 52px;
        height: 104px;
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px 8px;
        overflow-x: hidden;
        overflow-y: hidden;
        background: #fff;
        box-shadow: 10px 0 28px rgba(15, 23, 42, 0.12);
    }

    .menu-add-btn {
        flex: 0 0 64px;
        width: 64px;
        height: 66px;
        align-self: center;
    }

    .menu-list {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .menu-list::-webkit-scrollbar {
        display: none;
    }

    .menu-item {
        flex: 0 0 72px;
        width: 72px;
        min-height: 66px;
        scroll-snap-align: start;
        box-shadow: none;
    }

    .menu-item.active {
        box-shadow: inset 0 3px 0 var(--primary);
    }

    .category-panel {
        top: 156px;
        bottom: 0;
        min-width: 0;
        height: auto;
        display: flex;
        box-shadow: 10px 12px 28px rgba(15, 23, 42, 0.12);
    }

    .category-filter-row {
        padding: 12px 14px;
    }

    .tree-list {
        overflow-y: auto;
        overflow-x: hidden;
        min-width: 0;
    }

    .tree-row {
        min-width: 0;
    }

    .resize-handle {
        display: none;
    }

    .content-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: calc(100vh - 52px);
        border: 0;
        box-shadow: none;
        overflow: hidden;
    }

    .content-panel::before {
        display: none;
    }

    .article-tabs {
        display: none !important;
    }

    .content-toolbar {
        min-height: auto;
        padding: 12px 14px;
        align-items: flex-start;
        gap: 10px;
    }

    .content-toolbar h1 {
        font-size: 18px;
        line-height: 1.35;
    }

    .content-labels {
        min-height: 0;
    }

    .toolbar-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 6px;
    }

    .toolbar-actions .btn {
        min-height: 32px;
        padding: 6px 9px;
        white-space: nowrap;
    }

    .markdown-body,
    .editor {
        padding: 16px 14px 28px;
        overflow-x: hidden;
    }

    .markdown-body pre {
        max-width: 100%;
        margin-left: 0;
    }

    .markdown-body blockquote {
        margin-left: 0;
    }

    .external-frame-wrap {
        min-height: calc(100vh - 150px);
    }

    .external-frame {
        min-height: 420px;
    }

    .media-player-wrap,
    .locked-content {
        padding: 14px;
    }

    video.media-player {
        max-height: calc(100vh - 190px);
    }

    .editor-workbench {
        grid-template-columns: minmax(0, 1fr);
    }

    .field-inline {
        align-items: stretch;
        flex-direction: column;
    }

    .modal-card,
    .modal-card.wide {
        width: min(94vw, 560px);
        max-height: calc(100vh - 24px);
    }

    .toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
}
