:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-muted: #f8f9fb;
    --surface-dark: #41305f;
    --surface-dark-2: #312349;
    --text: #29303d;
    --muted: #6c7484;
    --line: #e3e7ee;
    --accent: #7957d5;
    --accent-2: #4fbeff;
    --success: #1f9d73;
    --danger: #d64545;
    --shadow: 0 18px 50px rgba(23, 28, 40, 0.08);
    --radius-lg: 18px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Public Sans", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

.docs-body {
    background: #f5f6f9;
}

.docs-topbar,
.docs-footer {
    background: linear-gradient(90deg, var(--surface-dark) 0%, #4a3768 100%);
    color: #fff;
}

.docs-topbar-inner,
.docs-footer-inner {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.docs-topbar-inner {
    min-height: 72px;
}

.docs-footer-inner {
    min-height: 76px;
}

.docs-brand,
.docs-brand-mark,
.admin-docs-brand,
.docs-brand-mark {
    display: inline-flex;
    align-items: center;
}

.docs-brand {
    gap: 14px;
}

.docs-brand-mark {
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 800;
}

.docs-brand strong,
.admin-docs-brand strong,
h1,
h2,
h3 {
    font-weight: 700;
}

.docs-brand small,
.footer-links a,
.docs-main-nav a {
    color: rgba(255, 255, 255, 0.76);
}

.docs-main-nav {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
}

.docs-header-actions {
    display: flex;
    gap: 8px;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.76);
}

.lang-switch.is-active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.docs-main-nav a {
    font-weight: 600;
}

.docs-search-shell input {
    width: 240px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.docs-search-shell input::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.docs-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 0 0 28px;
}

.ad-slot {
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
}

.ad-slot img {
    display: block;
    width: 100%;
    height: auto;
}

.header-banner-ad {
    width: min(1440px, calc(100% - 32px));
    margin: 16px auto 0;
}

.sidebar-square-ad,
.content-banner-ad,
.content-inline-ad {
    margin-top: 18px;
}

.docs-home-layout,
.docs-page-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
    padding-top: 18px;
}

.docs-sidebar,
.docs-right-rail,
.docs-toc,
.admin-docs-sidebar {
    position: sticky;
    top: 18px;
}

.docs-sidebar,
.docs-right-rail .rail-card,
.toc-card,
.admin-docs-sidebar,
.admin-panel-card,
.docs-home-hero,
.docs-feature-card,
.docs-spotlight,
.docs-article-main,
.docs-toolbar,
.docs-result-card,
.message-card,
.admin-login-card,
.install-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.docs-sidebar,
.admin-docs-sidebar {
    padding: 16px;
    border-radius: var(--radius-lg);
}

.sidebar-section-title {
    margin-bottom: 10px;
    color: #8c93a1;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.docs-nav-group {
    margin-bottom: 18px;
}

.docs-nav-group h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.docs-nav-links {
    display: grid;
}

.docs-nav-links a {
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--muted);
}

.docs-nav-links a:hover,
.docs-nav-links a.is-active {
    color: var(--accent);
    background: #f4f0ff;
}

.docs-home-main,
.docs-tool-main {
    min-width: 0;
}

.docs-home-hero,
.docs-article-main,
.docs-toolbar,
.docs-result-card {
    border-radius: 0;
}

.docs-home-hero,
.docs-article-main,
.docs-result-card {
    padding: 28px 30px;
}

.docs-home-hero h1,
.docs-article-header h1 {
    font-size: clamp(2.2rem, 4vw, 3.3rem);
    line-height: 1.1;
    margin: 12px 0;
}

.docs-home-hero p,
.docs-lead,
.docs-callout p,
.doc-section-body p {
    color: var(--muted);
    line-height: 1.8;
    font-size: 1.02rem;
}

.docs-eyebrow,
.eyebrow {
    color: var(--accent);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

.docs-spotlight {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 0;
    overflow: hidden;
    margin: 18px 0 22px;
    border-radius: var(--radius-lg);
}

.spotlight-main {
    padding: 28px;
    background: linear-gradient(135deg, var(--surface-dark) 0%, #58407f 100%);
    color: #fff;
}

.spotlight-main p {
    color: rgba(255, 255, 255, 0.78);
}

.spotlight-main a {
    display: inline-flex;
    margin-top: 10px;
    color: #fff;
    font-weight: 700;
}

.spotlight-side {
    display: grid;
    background: #f7f4ff;
}

.spotlight-side div {
    padding: 22px;
    border-bottom: 1px solid #e8ddff;
}

.spotlight-side strong {
    display: block;
    font-size: 1.4rem;
}

.docs-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.docs-feature-card {
    padding: 22px;
    border-radius: 0;
}

.tool-card {
    min-height: 220px;
}

.docs-card-tag {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--accent);
    background: #f4f0ff;
    font-size: 0.78rem;
    font-weight: 700;
}

.docs-feature-card h3 {
    margin: 14px 0 10px;
    font-size: 1.25rem;
}

.docs-feature-card p {
    color: var(--muted);
    line-height: 1.7;
}

.docs-feature-card a,
.rail-card a,
.docs-breadcrumbs a,
.toc-card a {
    color: var(--accent);
}

.docs-right-rail {
    display: grid;
    gap: 16px;
}

.rail-card,
.toc-card {
    padding: 18px;
    border-radius: var(--radius-lg);
}

.rail-card h3,
.toc-card h3 {
    margin-top: 0;
}

.rail-card a,
.toc-card a {
    display: block;
    padding: 8px 0;
}

.docs-breadcrumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    color: var(--muted);
}

.docs-article-header {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.docs-meta-row {
    color: var(--muted);
    margin: 10px 0;
}

.docs-callout {
    margin: 24px 0;
    padding: 18px 20px;
    border-radius: 8px;
    background: #eef5ff;
    border: 1px solid #cfe0ff;
}

.docs-callout strong {
    display: block;
    margin-bottom: 6px;
}

.docs-article-sections {
    display: grid;
    gap: 26px;
}

.doc-section h2 {
    margin: 0 0 12px;
    font-size: 2rem;
}

.doc-list-item {
    position: relative;
    padding-left: 18px;
    margin: 8px 0;
    color: var(--text);
}

.doc-list-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.doc-code {
    overflow-x: auto;
    padding: 16px;
    border-radius: 8px;
    background: #f4f6fa;
    border: 1px solid var(--line);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.9rem;
    line-height: 1.7;
}

.doc-code-wrap {
    position: relative;
    margin: 14px 0;
}

.doc-code-lang {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 1;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.doc-code.dark {
    background: #33374e;
    border-color: #2a2e45;
    color: #f7f7fb;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.back-link,
.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 700;
    cursor: pointer;
}

.back-link,
.btn.secondary {
    color: var(--text);
    background: var(--surface-muted);
    border-color: var(--line);
}

.btn.primary,
button {
    color: #fff;
    background: linear-gradient(90deg, var(--accent) 0%, #5d7cff 100%);
}

.docs-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: end;
    padding: 18px 20px;
    margin: 18px 0;
}

.docs-toolbar label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #d7dce6;
    background: #fff;
    color: var(--text);
}

.result-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.analysis-overview {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.score-orb,
.analysis-charts,
.result-item {
    padding: 16px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
}

.score-ring {
    --score: 50;
    width: 130px;
    height: 130px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
    background:
        radial-gradient(closest-side, #fff 72%, transparent 73% 100%),
        conic-gradient(#3667e9 calc(var(--score) * 1%), #dde4f0 0);
}

.score-ring strong {
    display: block;
    font-size: 2rem;
}

.score-ring span,
.analysis-charts span,
.result-item span,
.message-card p {
    color: var(--muted);
}

.analysis-charts {
    display: grid;
    gap: 12px;
}

.chart-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.chart-bar {
    height: 8px;
    background: #dde4f0;
}

.chart-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #1b8b99 0%, #3667e9 100%);
}

.analysis-notes {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.note-chip {
    padding: 8px 12px;
    border-radius: 999px;
    background: #f4f0ff;
    border: 1px solid #e1d8ff;
    font-size: 0.88rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.result-item strong {
    display: block;
    margin-bottom: 6px;
}

.message-card {
    padding: 16px 18px;
    border-radius: 10px;
}

.message-card.error {
    border-left: 4px solid var(--danger);
}

.message-card.success {
    border-left: 4px solid var(--success);
}

.admin-docs-body {
    background: #eef1f6;
}

.admin-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.admin-login-card {
    width: min(520px, calc(100% - 32px));
    padding: 28px;
    border-radius: var(--radius-lg);
}

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

.admin-docs-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: 100vh;
}

.admin-docs-sidebar {
    background: linear-gradient(180deg, var(--surface-dark) 0%, var(--surface-dark-2) 100%);
    color: #fff;
    border-radius: 0;
    box-shadow: none;
}

.admin-docs-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.admin-docs-nav {
    display: grid;
    gap: 8px;
    margin-bottom: 26px;
}

.admin-docs-nav a {
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.82);
}

.admin-docs-nav a.is-active,
.admin-docs-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.admin-docs-cats {
    display: grid;
    gap: 10px;
}

.admin-cat-chip {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
}

.admin-docs-main {
    padding: 26px;
}

.docs-help-text {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.admin-docs-hero,
.admin-docs-stats article,
.admin-panel-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.admin-docs-hero {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}

.admin-docs-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.admin-docs-stats article {
    padding: 18px;
    border-radius: 12px;
}

.admin-docs-stats strong {
    display: block;
    font-size: 1.35rem;
}

.admin-docs-stats span {
    color: var(--muted);
}

.admin-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-quick-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 12px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
}

.admin-quick-card span {
    color: var(--muted);
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.code-tag-button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
}

.admin-docs-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 18px;
    margin-bottom: 18px;
}

.admin-panel-card {
    padding: 22px;
    border-radius: var(--radius-lg);
}

.full-width {
    width: 100%;
}

.panel-header {
    margin-bottom: 18px;
}

.panel-header h2 {
    margin: 10px 0 0;
}

.checkbox-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.checkbox-row input {
    width: auto;
}

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

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

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

.actions-cell {
    display: flex;
    gap: 12px;
    align-items: center;
}

.actions-cell form {
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

@media (max-width: 1180px) {
    .docs-home-layout,
    .docs-page-layout,
    .admin-docs-grid,
    .admin-docs-stats {
        grid-template-columns: 1fr;
    }

    .docs-sidebar,
    .docs-right-rail,
    .docs-toc,
    .admin-docs-sidebar {
        position: static;
    }

    .docs-spotlight {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .docs-topbar-inner,
    .admin-docs-hero,
    .tool-header,
    .docs-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .docs-header-actions {
        justify-content: flex-start;
    }

    .docs-home-layout,
    .docs-page-layout,
    .admin-docs-layout,
    .analysis-overview,
    .result-grid,
    .docs-feature-grid {
        grid-template-columns: 1fr;
    }

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