/* Docs shell for product manuals (full-width, 3 columns, search, light/dark). Loaded after site.css + manual.css. */
:root[data-theme="dark"] {
    --bg: #0b1120;
    --bg-soft: #111a2e;
    --card: #111a2e;
    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.3);
    --text: #e5e7eb;
    --muted: #a3adbd;
    --dim: #6b7688;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 30px -12px rgba(0,0,0,.6);
    color-scheme: dark;
}
:root[data-theme="dark"] .manual-page { --accent: #60a5fa; }
:root[data-theme="dark"] .manual-page.erp { --accent: #a78bfa; }

body.manual-page { background: var(--bg); color: var(--text); }
body.manual-page::before { display: none; }

/* ---------- Top bar ---------- */
.docs-top {
    position: sticky; top: 0; z-index: 60;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
    height: 60px; padding: 0 1.25rem;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.docs-brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; white-space: nowrap; }
.docs-brand .logo-mark { flex-shrink: 0; }
.docs-brand .sep { color: var(--dim); font-weight: 400; }
.docs-brand .product { color: var(--accent); }
.docs-brand .label { font-weight: 500; color: var(--muted); font-size: .9rem; }
.docs-menu-btn, .docs-icon-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
    border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
}
.docs-menu-btn:hover, .docs-icon-btn:hover { color: var(--text); background: var(--bg-soft); }
.docs-menu-btn { display: none; }
.docs-search-btn {
    justify-self: center; width: min(460px, 100%); display: flex; align-items: center; gap: .6rem;
    height: 38px; padding: 0 .75rem; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--dim); font: inherit; font-size: .9rem;
}
.docs-search-btn:hover { border-color: var(--accent); }
.docs-search-btn span { flex: 1; text-align: left; }
kbd { font-family: var(--mono); font-size: .72rem; border: 1px solid var(--border-strong); border-radius: 5px; padding: .05rem .4rem; color: var(--muted); background: var(--bg); }
.docs-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Theme menu */
.theme-wrap { position: relative; }
.theme-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; padding: .35rem;
    background: var(--card); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); display: none;
}
.theme-menu.open { display: block; }
.theme-menu button {
    display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border: 0; border-radius: 8px;
    background: none; color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; text-align: left;
}
.theme-menu button:hover { background: var(--bg-soft); }
.theme-menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.theme-menu button[aria-checked="true"]::after { content: "✓"; margin-left: auto; }

/* ---------- Three columns ---------- */
.docs-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr) 260px; min-height: calc(100vh - 60px); }
.docs-nav, .docs-otp { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 1.5rem 1.25rem 3rem; }
.docs-nav { border-right: 1px solid var(--border); }
.docs-otp { border-left: 1px solid var(--border); font-size: .86rem; }
.docs-content { min-width: 0; padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 4rem; }
.docs-content .doc { max-width: 880px; margin: 0 auto; }

.docs-nav h5, .docs-otp h5 { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 1.4rem 0 .5rem; }
.docs-nav h5:first-child, .docs-otp h5:first-child { margin-top: 0; }
.docs-nav a { display: block; padding: .38rem .7rem; border-radius: 8px; color: var(--muted); font-size: .93rem; }
.docs-nav a:hover { color: var(--text); background: var(--bg-soft); }
.docs-nav a.active { color: var(--accent); font-weight: 600; background: color-mix(in srgb, var(--accent) 10%, transparent); }

.docs-otp a { display: block; padding: .28rem 0 .28rem .75rem; border-left: 2px solid var(--border); color: var(--muted); }
.docs-otp a.sub { padding-left: 1.5rem; font-size: .82rem; }
.docs-otp a:hover { color: var(--text); }
.docs-otp a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* content tweaks inside the shell */
.docs-content .doc section, .docs-content .doc .mod, .docs-content .doc h3[id] { scroll-margin-top: 80px; }
:root[data-theme="dark"] .doc .feature-card, :root[data-theme="dark"] .doc .tip, :root[data-theme="dark"] .doc .callout { background: var(--bg-soft); }
:root[data-theme="dark"] .doc figure.shot img { border-color: var(--border-strong); }
:root[data-theme="dark"] .manual-card { background: var(--card); }

/* Footer */
.docs-footer { border-top: 1px solid var(--border); padding: 1.5rem clamp(1.25rem, 4vw, 2.5rem); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-size: .85rem; color: var(--dim); }
.docs-footer a:hover { color: var(--text); }

/* ---------- Search dialog ---------- */
.docs-search { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(2, 6, 23, .45); padding: 10vh 1rem 1rem; }
.docs-search.open { display: block; }
.docs-search-box { max-width: 640px; margin: 0 auto; background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.docs-search-input { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.docs-search-input input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 1rem; }
.docs-search-results { max-height: 60vh; overflow-y: auto; padding: .4rem; }
.docs-search-results a { display: block; padding: .65rem .8rem; border-radius: 10px; color: var(--text); }
.docs-search-results a small { display: block; color: var(--dim); font-size: .75rem; margin-bottom: .1rem; }
.docs-search-results a span { display: block; color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.docs-search-results a mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; }
.docs-search-results a.sel, .docs-search-results a:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.docs-search-empty { padding: 1.5rem; text-align: center; color: var(--dim); font-size: .9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) { .docs-shell { grid-template-columns: 260px minmax(0, 1fr); } .docs-otp { display: none; } }
@media (max-width: 860px) {
    .docs-shell { grid-template-columns: minmax(0, 1fr); }
    .docs-menu-btn { display: inline-grid; }
    .docs-top { grid-template-columns: auto auto 1fr auto; padding: 0 .75rem; gap: .5rem; }
    .docs-brand .label, .docs-brand .sep, .docs-brand .zc { display: none; }
    .docs-search-btn { width: 100%; }
    .docs-search-btn span, .docs-search-btn kbd { display: none; }
    .docs-search-btn { width: 38px; justify-self: end; padding: 0; justify-content: center; border-color: transparent; background: none; }
    .docs-nav { position: fixed; top: 60px; left: 0; bottom: 0; width: min(300px, 85vw); height: auto; z-index: 55; background: var(--bg); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    .docs-nav.open { transform: none; }
}
