:root {
    --op-bg: #f5f7fb;
    --op-sidebar-bg: #0f172a;
    --op-sidebar-text: #cbd5e1;
    --op-sidebar-active: #ffffff;
    --op-accent: #2563eb;
    --op-accent-soft: #dbeafe;
    --op-border: #e2e8f0;
    --op-text: #0f172a;
    --op-muted: #64748b;
    --op-code-bg: #0b1220;
    --op-content-width: 920px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--op-text);
    background: var(--op-bg);
}

a {
    color: var(--op-accent);
    text-decoration: none;
}

.op-layout {
    display: flex;
    min-height: 100vh;
}

.op-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--op-sidebar-bg);
    color: var(--op-sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.op-brand {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.op-brand-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
}

.op-brand-sub {
    margin: 8px 0 0;
    font-size: 12px;
    color: #94a3b8;
}

.op-version-wrap {
    padding: 0 16px 12px;
}

.op-version-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    color: #94a3b8;
}

.op-version-select,
.op-compare-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 13px;
}

.op-compare-select {
    width: auto;
    min-width: 96px;
    background: #fff;
    color: var(--op-text);
}

.op-search-wrap {
    padding: 16px 16px 8px;
}

.op-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 13px;
    outline: none;
}

.op-search::placeholder {
    color: #94a3b8;
}

.op-search:focus {
    border-color: rgba(37, 99, 235, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

.op-nav {
    flex: 1;
    overflow: auto;
    padding: 8px 0 24px;
}

.op-nav-group {
    margin-bottom: 8px;
}

.op-nav-group-title {
    padding: 10px 20px 6px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
}

.op-nav-item {
    display: block;
    padding: 9px 20px 9px 24px;
    color: var(--op-sidebar-text);
    font-size: 13px;
    line-height: 1.5;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.op-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.op-nav-item.active {
    background: rgba(37, 99, 235, 0.18);
    border-left-color: var(--op-accent);
    color: var(--op-sidebar-active);
    font-weight: 600;
}

.op-nav-item.hidden {
    display: none;
}

.op-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.op-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 32px;
    background: #fff;
    border-bottom: 1px solid var(--op-border);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}

.op-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.op-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.op-compare-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.op-compare-arrow {
    color: var(--op-muted);
    font-size: 13px;
}

.op-compare-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--op-accent);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.op-compare-btn-ghost {
    background: #fff;
    color: var(--op-accent);
    border: 1px solid #bfdbfe;
}

.hidden {
    display: none !important;
}

.op-compare-view {
    max-width: var(--op-content-width);
}

.op-compare-view-split {
    max-width: none;
}

.op-content-wrap--compare {
    padding-left: 24px;
    padding-right: 24px;
}

.op-content-wrap--compare .op-content {
    max-width: none;
}

.op-compare-meta-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.op-compare-meta-card {
    padding: 12px 14px;
    border: 1px solid var(--op-border);
    border-radius: 10px;
    background: #fff;
}

.op-compare-meta-label {
    font-size: 11px;
    color: var(--op-muted);
    margin-bottom: 6px;
}

.op-compare-meta-value {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.op-compare-meta-file {
    font-size: 12px;
    color: var(--op-muted);
    word-break: break-all;
}

.op-diff-split {
    border: 1px solid var(--op-border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.op-diff-columns-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--op-border);
    background: #f8fafc;
}

.op-diff-col-head {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.op-diff-col-head + .op-diff-col-head {
    border-left: 1px solid var(--op-border);
}

.op-diff-col-label {
    font-size: 11px;
    color: var(--op-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.op-diff-col-title {
    font-size: 13px;
    color: #334155;
}

.op-diff-col-note {
    font-size: 12px;
    color: #b45309;
}

.op-diff-rows {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    max-height: calc(100vh - 280px);
    overflow: auto;
}

.op-diff-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 28px;
}

.op-diff-row + .op-diff-row {
    border-top: 1px solid #f1f5f9;
}

.op-diff-cell {
    padding: 4px 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.op-diff-cell + .op-diff-cell {
    border-left: 1px solid #f1f5f9;
}

.op-diff-eq {
    background: #fff;
    color: #64748b;
}

.op-diff-add {
    background: #ecfdf5;
    color: #065f46;
}

.op-diff-del {
    background: #fef2f2;
    color: #991b1b;
}

.op-diff-empty {
    background: #fafafa;
    color: transparent;
}

.op-diff-row-empty .op-diff-cell {
    color: var(--op-muted);
    text-align: center;
    padding: 24px 12px;
}

.op-compare-head {
    margin-bottom: 24px;
}

.op-compare-head h3,
.op-compare-head h4 {
    margin: 0 0 8px;
}

.op-compare-meta,
.op-compare-note {
    color: var(--op-muted);
    font-size: 14px;
}

.op-compare-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.op-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
}

.op-tag-add {
    background: #dcfce7;
    color: #166534;
}

.op-tag-del {
    background: #fee2e2;
    color: #991b1b;
}

.op-tag-chg {
    background: #fef3c7;
    color: #92400e;
}

.op-compare-section {
    margin-bottom: 24px;
}

.op-compare-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.op-compare-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--op-border);
    border-radius: 10px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.op-compare-link:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.op-diff {
    border: 1px solid var(--op-border);
    border-radius: 12px;
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
}

.op-diff-line {
    padding: 4px 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.op-diff-eq {
    background: #fff;
    color: #64748b;
}

.op-diff-add {
    background: #ecfdf5;
    color: #065f46;
}

.op-diff-del {
    background: #fef2f2;
    color: #991b1b;
}

.op-header-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.op-header-meta {
    font-size: 13px;
    color: var(--op-muted);
}

.op-menu-toggle {
    display: none;
    border: 1px solid var(--op-border);
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.op-content-wrap {
    flex: 1;
    padding: 32px;
}

.op-content {
    max-width: var(--op-content-width);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--op-border);
    border-radius: 16px;
    padding: 40px 48px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.op-loading,
.op-error,
.op-empty {
    text-align: center;
    color: var(--op-muted);
    padding: 80px 20px;
}

.op-error {
    color: #dc2626;
}

.op-doc h1,
.op-doc h2,
.op-doc h3,
.op-doc h4 {
    scroll-margin-top: 88px;
    line-height: 1.35;
}

.op-doc h1 {
    font-size: 28px;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--op-border);
}

.op-doc h2 {
    font-size: 22px;
    margin: 32px 0 16px;
}

.op-doc h3 {
    font-size: 18px;
    margin: 28px 0 12px;
    color: #1e293b;
}

.op-doc h4 {
    font-size: 16px;
    margin: 20px 0 10px;
}

.op-doc p {
    margin: 0 0 14px;
    line-height: 1.75;
    color: #334155;
}

.op-doc ul,
.op-doc ol {
    margin: 0 0 16px;
    padding-left: 24px;
    line-height: 1.75;
}

.op-doc li {
    margin-bottom: 6px;
}

.op-doc .op-table-wrap {
    overflow-x: auto;
    margin: 16px 0 24px;
}

.op-doc table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

.op-doc th,
.op-doc td {
    border: 1px solid var(--op-border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    min-width: 80px;
}

.op-doc th {
    background: #f8fafc;
    font-weight: 600;
    white-space: nowrap;
}

.op-doc tbody tr:nth-child(even) {
    background: #fafbfd;
}

.op-doc pre.op-code {
    margin: 16px 0 24px;
    padding: 16px 18px;
    background: var(--op-code-bg);
    color: #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    line-height: 1.6;
    font-size: 13px;
    white-space: pre;
    word-break: normal;
}

.op-doc pre.op-code code {
    display: block;
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.op-doc pre {
    margin: 16px 0;
    padding: 16px 18px;
    background: var(--op-code-bg);
    color: #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    line-height: 1.6;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.op-doc code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.op-doc p code,
.op-doc li code,
.op-doc td code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.op-doc .op-endpoint {
    display: inline-block;
    margin: 8px 0 16px;
    padding: 10px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1d4ed8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    word-break: break-all;
}

.op-doc .op-json-block {
    margin: 16px 0 24px;
}

.op-doc .op-json-block pre {
    margin: 0;
}

.op-footer {
    padding: 16px 32px 32px;
    text-align: center;
    color: var(--op-muted);
    font-size: 12px;
}

@media (max-width: 960px) {
    .op-layout {
        flex-direction: column;
    }

    .op-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    }

    .op-sidebar.open {
        transform: translateX(0);
    }

    .op-menu-toggle {
        display: inline-block;
    }

    .op-content-wrap {
        padding: 16px;
    }

    .op-content {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .op-header {
        padding: 12px 16px;
    }

    .op-compare-meta-panel,
    .op-diff-columns-head,
    .op-diff-row {
        grid-template-columns: 1fr;
    }

    .op-diff-col-head + .op-diff-col-head {
        border-left: none;
        border-top: 1px solid var(--op-border);
    }

    .op-diff-cell + .op-diff-cell {
        border-left: none;
        border-top: 1px dashed #e2e8f0;
    }

    .op-diff-rows {
        max-height: none;
    }
}
