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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    line-height: 1.6;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f0883e;
    text-decoration: none;
}

.nav-links a {
    color: #8b949e;
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.9rem;
}

.nav-links a:hover { color: #c9d1d9; }

main {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 { margin-bottom: 1.5rem; color: #e6edf3; }
h2 { margin: 2rem 0 1rem; color: #e6edf3; }
h3 { margin: 1.5rem 0 0.5rem; color: #e6edf3; }

a { color: #58a6ff; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* Breadcrumb */
.breadcrumb {
    font-size: 0.85rem;
    color: #8b949e;
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: #58a6ff;
    text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* Hero section */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero .tagline {
    font-size: 1.2rem;
    color: #8b949e;
    margin-bottom: 2rem;
}

.hero .cta {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #f0883e;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1.1rem;
}

.hero .cta:hover { background: #d2742f; }

.hero .cta-secondary {
    background: transparent;
    color: #f0883e;
    border: 2px solid #f0883e;
    margin-left: 0.6rem;
}
.hero .cta-secondary:hover { background: #f0883e; color: #fff; }

/* Feature cards */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-card {
    padding: 1.5rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
}

.feature-card h3 {
    color: #f0883e;
    margin-bottom: 0.5rem;
}

.section-link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
}

.section-link:hover {
    border-color: #f0883e;
}

/* Section subtitle */
.section-subtitle {
    color: #8b949e;
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* Doc list */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.doc-item {
    display: block;
    padding: 1rem 1.25rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    text-decoration: none;
    transition: border-color 0.2s;
}

.doc-item:hover {
    border-color: #f0883e;
}

.doc-item.doc-missing {
    opacity: 0.5;
    pointer-events: none;
}

.doc-title {
    color: #e6edf3;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.doc-short {
    color: #8b949e;
    font-size: 0.85rem;
}

.doc-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: #30363d;
    color: #8b949e;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* Doc layout (content + TOC) */
.doc-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.doc-toc {
    position: sticky;
    top: 1rem;
    width: 240px;
    flex-shrink: 0;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding: 1rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    font-size: 0.8rem;
}

.doc-toc h3 {
    color: #f0883e;
    font-size: 0.85rem;
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-toc ul {
    list-style: none;
    padding: 0;
}

.doc-toc li {
    margin: 0.25rem 0;
}

.doc-toc a {
    color: #8b949e;
    text-decoration: none;
    font-size: 0.8rem;
    line-height: 1.4;
}

.doc-toc a:hover { color: #c9d1d9; }

.doc-toc ul ul {
    padding-left: 0.75rem;
}

.doc-toc ul ul a {
    font-size: 0.75rem;
}

.doc-content {
    flex: 1;
    min-width: 0;
}

/* Markdown content styles */
.doc-content h1 { font-size: 1.8rem; margin: 0 0 1rem 0; border-bottom: 1px solid #30363d; padding-bottom: 0.5rem; }
.doc-content h2 { font-size: 1.4rem; margin: 2rem 0 0.75rem; border-bottom: 1px solid #21262d; padding-bottom: 0.4rem; }
.doc-content h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.doc-content h4 { font-size: 1rem; margin: 1.25rem 0 0.4rem; color: #c9d1d9; }

.doc-content p { margin: 0.75rem 0; }
.doc-content ul, .doc-content ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.doc-content li { margin: 0.3rem 0; }

.doc-content code {
    background: #161b22;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e6edf3;
}

.doc-content pre {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.doc-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.doc-content th, .doc-content td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #30363d;
    text-align: left;
}

.doc-content th {
    background: #161b22;
    color: #e6edf3;
    font-weight: 600;
}

.doc-content blockquote {
    border-left: 3px solid #f0883e;
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    color: #8b949e;
    background: #161b22;
    border-radius: 0 6px 6px 0;
}

.doc-content hr {
    border: none;
    border-top: 1px solid #30363d;
    margin: 2rem 0;
}

.doc-content strong { color: #e6edf3; }

.doc-content img {
    max-width: 100%;
    border-radius: 6px;
}

/* Chat page */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    max-width: 800px;
    margin: 0 auto;
}

.chat-header {
    padding: 1rem 0;
    border-bottom: 1px solid #30363d;
    margin-bottom: 1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 80%;
    line-height: 1.5;
}

.message.user {
    background: #1f3a5f;
    align-self: flex-end;
    color: #c9d1d9;
}

.message.assistant {
    background: #161b22;
    border: 1px solid #30363d;
    align-self: flex-start;
    color: #c9d1d9;
}

.message.error {
    background: #3a1a1a;
    border: 1px solid #f85149;
    color: #f85149;
    align-self: center;
    font-size: 0.9rem;
}

.chat-input-bar {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
    border-top: 1px solid #30363d;
}

.chat-input-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 1rem;
}

.chat-input-bar input:focus {
    outline: none;
    border-color: #f0883e;
}

.chat-input-bar button {
    padding: 0.75rem 1.5rem;
    background: #f0883e;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.chat-input-bar button:hover { background: #d2742f; }
.chat-input-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Responsive: collapse TOC on small screens */
@media (max-width: 768px) {
    .doc-layout {
        flex-direction: column;
    }

    .doc-toc {
        position: static;
        width: 100%;
        max-height: none;
        margin-bottom: 1.5rem;
    }

    .nav-links a {
        margin-left: 0.75rem;
        font-size: 0.8rem;
    }
}
