/* ============================================
   Premium Enterprise Docs
   IBM Plex Sans / Mono · Deep Navy · Refined Indigo
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* Core palette */
    --bg: #fbfbfa;
    --bg-elevated: #ffffff;
    --text: #1a1d23;
    --text-secondary: #4a4f57;
    --text-muted: #88909a;
    --text-faint: #b8bec6;

    /* Accents */
    --accent: #2952cc;
    --accent-hover: #1e3fa8;
    --accent-light: #eef2ff;
    --accent-glow: rgba(41, 82, 204, 0.08);

    /* Surfaces */
    --surface: #ffffff;
    --surface-hover: #f6f7f9;
    --sidebar-bg: #f3f4f6;
    --sidebar-hover: #e8eaef;

    /* Borders */
    --border: #e2e4e8;
    --border-light: #eef0f3;
    --border-strong: #cbd0d8;

    /* Topbar */
    --topbar-bg: #0f1b2d;
    --topbar-text: #c8d0dc;
    --topbar-text-hover: #ffffff;
    --topbar-accent: #4a7eff;

    /* Table */
    --table-header-bg: #f0f2f5;
    --table-stripe: #fafbfc;
    --table-border: #d4d8de;
    --table-hover: #eef3ff;

    /* Code */
    --code-bg: #1e2227;
    --code-text: #d4d7de;
    --code-inline-bg: #eceef2;
    --code-inline-text: #c53030;

    /* Callouts */
    --note-bg: #eef4ff;
    --note-border: #2952cc;
    --note-icon: #2952cc;
    --warn-bg: #fef9ec;
    --warn-border: #d4a017;
    --warn-icon: #d4a017;
    --tip-bg: #ecf8f0;
    --tip-border: #1a8754;
    --tip-icon: #1a8754;
    --danger-bg: #fef0f0;
    --danger-border: #cc2936;
    --danger-icon: #cc2936;

    /* Layout */
    --sidebar-w: 300px;
    --topbar-h: 52px;
    --content-max: 940px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.04);
    --shadow-md: 0 2px 8px rgba(15, 27, 45, 0.06);
    --shadow-lg: 0 4px 16px rgba(15, 27, 45, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::selection {
    background: var(--accent-glow);
    color: var(--accent);
}

body {
    font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.78;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.001em;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8ccd2; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8acb4; }

/* ===== Topbar ===== */
.td-topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), inset 0 -1px 0 rgba(255,255,255,0.04);
}

.td-topbar .brand {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-right: 32px;
    white-space: nowrap;
    position: relative;
}
.td-topbar .brand::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--topbar-accent);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: 0 0 8px var(--topbar-accent);
}
.td-topbar .brand a { color: #fff; text-decoration: none; }
.td-topbar .brand a:hover { text-decoration: none; opacity: 0.9; }

.td-topbar .breadcrumb {
    font-size: 13px;
    color: var(--topbar-text);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.td-topbar .breadcrumb a { color: var(--topbar-text); text-decoration: none; }
.td-topbar .breadcrumb a:hover { color: var(--topbar-text-hover); text-decoration: none; }
.td-topbar .breadcrumb .sep { color: #4a5568; font-size: 11px; }
.td-topbar .breadcrumb .current { color: #e0e6f0; font-weight: 500; }

.td-topbar .topbar-right {
    margin-left: auto;
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}
.td-topbar .topbar-right a {
    color: var(--topbar-text);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.td-topbar .topbar-right a:hover { color: var(--topbar-text-hover); text-decoration: none; }

/* ===== Sidebar ===== */
.td-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 0 0 40px;
    background-image:
        linear-gradient(var(--sidebar-bg), var(--sidebar-bg)),
        radial-gradient(circle at 20% 0%, rgba(41, 82, 204, 0.02) 0%, transparent 50%);
}

.td-sidebar .sidebar-header {
    padding: 18px 22px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 5;
    backdrop-filter: blur(8px);
}

.td-sidebar nav ul {
    list-style: none;
    padding: 6px 0;
}

.td-sidebar nav a {
    display: block;
    padding: 6px 22px 6px 25px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: all 0.12s ease;
    line-height: 1.5;
    font-weight: 400;
}

.td-sidebar nav a:hover {
    background: var(--sidebar-hover);
    border-left-color: var(--text-faint);
    color: var(--text);
    text-decoration: none;
}

.td-sidebar nav a.active {
    background: var(--accent-light);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.td-sidebar nav .sub a {
    padding-left: 38px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.td-sidebar nav .sub-sub a {
    padding-left: 50px;
    font-size: 12px;
    color: var(--text-faint);
}

/* ===== Main content ===== */
.td-main {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 44px 56px 80px;
    max-width: var(--content-max);
}

/* Article header */
.td-article-header {
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--text);
    position: relative;
}

.td-article-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--accent);
}

.td-article-header .doc-category {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 10px;
}

.td-article-header h1 {
    font-size: 30px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.td-article-header .doc-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.td-article-header .doc-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.td-article-header .doc-meta span::before {
    content: '';
    display: inline-block;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--text-faint);
    margin-right: 4px;
}
.td-article-header .doc-meta span:first-child::before { display: none; }

/* Lead paragraph */
.td-main .lead {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 36px;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 0 6px 6px 0;
    box-shadow: var(--shadow-sm);
}

/* Headings */
.td-main h2 {
    font-size: 22px;
    font-weight: 600;
    margin-top: 44px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    letter-spacing: -0.02em;
    scroll-margin-top: 70px;
}
.td-main h2:first-of-type { margin-top: 0; }

.td-main h3 {
    font-size: 17px;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.01em;
    scroll-margin-top: 70px;
}

.td-main h4 {
    font-size: 13px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    scroll-margin-top: 70px;
}

/* Paragraphs */
.td-main p {
    margin-bottom: 14px;
}

/* Bold / emphasis */
.td-main strong, .td-main b {
    font-weight: 600;
    color: #0a0c10;
}

.td-main em {
    font-style: italic;
    color: var(--text-secondary);
}

/* Inline code */
.td-main code {
    font-family: "IBM Plex Mono", "SF Mono", "Consolas", monospace;
    background: var(--code-inline-bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--code-inline-text);
    font-weight: 500;
}

/* Code block */
.td-main pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 18px 22px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.65;
    margin: 18px 0;
    font-family: "IBM Plex Mono", "SF Mono", "Consolas", monospace;
    border: 1px solid #2a2f36;
    box-shadow: var(--shadow-md);
    position: relative;
}

.td-main pre::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 28px;
    background: #191c21;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #2a2f36;
}

.td-main pre::after {
    content: '';
    position: absolute;
    top: 10px; left: 14px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 16px 0 0 #febc2e, 32px 0 0 #28c840;
}

.td-main pre code {
    background: none;
    color: var(--code-text);
    padding: 0;
    font-weight: 400;
    font-size: 13px;
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 10px;
}

/* Lists */
.td-main ul, .td-main ol {
    margin: 12px 0 14px;
    padding-left: 28px;
}
.td-main li {
    margin-bottom: 6px;
    line-height: 1.7;
}
.td-main ul li::marker { color: var(--accent); }
.td-main ol li::marker { color: var(--accent); font-weight: 600; }

/* ===== Tables ===== */
.td-table-wrap {
    margin: 22px 0;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.td-main table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border: 1px solid var(--table-border);
    border-radius: 8px;
    overflow: hidden;
}

.td-main table caption {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    background: var(--topbar-bg);
    color: #fff;
    caption-side: top;
    letter-spacing: 0.01em;
}

.td-main table th {
    background: var(--table-header-bg);
    font-weight: 600;
    text-align: left;
    padding: 11px 16px;
    border-bottom: 2px solid var(--table-border);
    white-space: nowrap;
    color: var(--text);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.td-main table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    line-height: 1.65;
    color: var(--text);
}

.td-main table tr:nth-child(even) td {
    background: var(--table-stripe);
}

.td-main table tr:hover td {
    background: var(--table-hover);
}

.td-main table td strong {
    color: var(--accent);
}

.td-main table .highlight {
    background: #fff8e1 !important;
    font-weight: 600;
}

/* ===== Callouts ===== */
.td-callout {
    margin: 18px 0;
    padding: 14px 18px 14px 54px;
    border-radius: 8px;
    position: relative;
    font-size: 14px;
    line-height: 1.7;
    border: 1px solid transparent;
    border-left-width: 4px;
}

.td-callout .callout-title {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.td-callout::before {
    position: absolute;
    left: 16px;
    top: 15px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    font-family: "Segoe UI", sans-serif;
}

.td-callout.note {
    background: var(--note-bg);
    border-color: var(--note-border);
    border-left-color: var(--note-border);
}
.td-callout.note::before { content: "i"; background: var(--note-icon); font-style: italic; }
.td-callout.note .callout-title { color: var(--note-icon); }

.td-callout.warning {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    border-left-color: var(--warn-border);
}
.td-callout.warning::before { content: "!"; background: var(--warn-icon); }
.td-callout.warning .callout-title { color: #9a7300; }

.td-callout.tip {
    background: var(--tip-bg);
    border-color: var(--tip-border);
    border-left-color: var(--tip-border);
}
.td-callout.tip::before { content: "\2713"; background: var(--tip-icon); font-size: 13px; }
.td-callout.tip .callout-title { color: var(--tip-icon); }

.td-callout.danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    border-left-color: var(--danger-border);
}
.td-callout.danger::before { content: "\26A0"; background: var(--danger-icon); font-size: 12px; }
.td-callout.danger .callout-title { color: var(--danger-icon); }

/* ===== Figures ===== */
.td-main figure {
    margin: 24px 0;
    text-align: center;
}

.td-main figure img {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

.td-main figcaption {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
    font-style: italic;
}

/* ===== Bottom nav ===== */
.td-doc-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 56px;
    padding: 24px 0 0;
    border-top: 1px solid var(--border);
    gap: 20px;
}

.td-doc-nav a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 0;
    transition: transform 0.15s;
}
.td-doc-nav a:hover { text-decoration: none; transform: translateX(-2px); }
.td-doc-nav .next:hover { transform: translateX(2px); }
.td-doc-nav .nav-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
}
.td-doc-nav .nav-title { font-weight: 600; color: var(--text); }
.td-doc-nav .prev { text-align: left; }
.td-doc-nav .next { text-align: right; }
.td-doc-nav a:hover .nav-title { color: var(--accent); }

/* Feedback */
.td-feedback {
    margin-top: 32px;
    padding: 16px 20px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}
.td-feedback a { font-weight: 500; }

/* ===== Home page ===== */
.home-container { margin-left: 0; max-width: 100%; padding: 0; }

.home-hero {
    background: var(--topbar-bg);
    background-image:
        radial-gradient(circle at 80% 20%, rgba(74, 126, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(41, 82, 204, 0.08) 0%, transparent 40%);
    color: #fff;
    padding: 60px 56px 52px;
    position: relative;
    overflow: hidden;
}

.home-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74, 126, 255, 0.4), transparent);
}

.home-hero h1 {
    font-size: 34px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #fff;
    border: none;
    padding: 0;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.home-hero p {
    color: #a8b4c8;
    font-size: 15px;
    line-height: 1.7;
    max-width: 600px;
}

.home-content {
    padding: 44px 56px 80px;
    max-width: 940px;
}

.section-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--text);
    position: relative;
}
.section-label::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 60px; height: 2px;
    background: var(--accent);
}

.doc-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.doc-item {
    display: flex;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s ease;
    position: relative;
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover {
    background: var(--accent-light);
    text-decoration: none;
}
.doc-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}
.doc-item:hover::before { transform: scaleY(1); }
.doc-item:hover .doc-item-title { color: var(--accent); }

.doc-item-icon {
    width: 40px; height: 40px;
    background: var(--accent-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 18px;
    flex-shrink: 0;
    font-size: 17px;
    color: var(--accent);
    font-weight: 700;
    font-family: "IBM Plex Mono", monospace;
    transition: all 0.15s;
}
.doc-item:hover .doc-item-icon {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.doc-item-body { flex: 1; }
.doc-item-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    transition: color 0.15s;
    color: var(--text);
}
.doc-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
}
.doc-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.doc-item-meta .tag {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2px 9px;
    border-radius: 12px;
    font-weight: 500;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .td-sidebar { width: 260px; }
    .td-main { margin-left: 260px; padding: 32px 32px 60px; }
    .home-hero, .home-content { padding-left: 32px; padding-right: 32px; }
}

@media (max-width: 768px) {
    .td-sidebar { display: none; }
    .td-main { margin-left: 0; padding: 24px 16px 60px; }
    .home-hero { padding: 36px 16px; }
    .home-content { padding: 24px 16px 60px; }
    .td-topbar { padding: 0 12px; }
    .td-topbar .brand { margin-right: 12px; font-size: 13px; }
    .td-topbar .breadcrumb { display: none; }
    .td-article-header h1 { font-size: 24px; }
    .td-main h2 { font-size: 19px; }
    .td-main table { font-size: 12px; }
    .td-main table th, .td-main table td { padding: 8px 10px; }
    .td-main pre { padding: 14px 16px; font-size: 12px; }
    .td-main pre::before { height: 24px; }
    .td-main pre::after { top: 8px; }
    .td-main pre code { margin-top: 8px; }
}
