:root {
    --brand-green: #16a34a;
    --brand-green-mid: #15803d;
    --brand-green-dark: #14532d;
    --brand-green-bg: #f0fdf4;
    --brand-green-100: #dcfce7;

    --sidebar-w: 268px;

    /* Light mode */
    --bg-page: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-topbar: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --sidebar-hover: #f0fdf4;
    --sidebar-active-bg: #dcfce7;
    --sidebar-active-text: #15803d;
    --step-bg: #16a34a;
    --info-border: #16a34a;
    --info-bg: #f0fdf4;
    --info-text: #14532d;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ─── Dark Mode Overrides ─── */
.dark {
    --bg-page: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-topbar: #1e293b;
    --border: #334155;
    --border-light: #273449;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --sidebar-hover: #273449;
    --sidebar-active-bg: #14532d;
    --sidebar-active-text: #4ade80;
    --step-bg: #15803d;
    --info-border: #16a34a;
    --info-bg: #052e16;
    --info-text: #86efac;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ─── Base Reset ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

body {
    background: var(--bg-page);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    transition:
        background 0.25s,
        color 0.25s;
}

/* ─── Layout ─── */
#manual-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition:
        width 0.3s ease,
        min-width 0.3s ease,
        border 0.25s;
    position: relative;
    z-index: 20;
}

#manual-sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
    overflow: hidden;
}

#manual-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-page);
    transition: background 0.25s;
}

/* ─── Sidebar Header ─── */
.sidebar-logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    transition: border 0.25s;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-green);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.sidebar-logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.sidebar-app-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
    white-space: nowrap;
    transition: color 0.25s;
}

.sidebar-app-name span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ─── Search ─── */
.sidebar-search-wrap {
    padding: 12px 12px 8px;
    flex-shrink: 0;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 11px;
    transition:
        border-color 0.2s,
        background 0.25s;
}

.sidebar-search:focus-within {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.sidebar-search svg {
    width: 14px;
    height: 14px;
    color: var(--text-subtle);
    flex-shrink: 0;
}

.sidebar-search input {
    background: none;
    border: none;
    outline: none;
    font-size: 13px;
    color: var(--text-main);
    width: 100%;
    font-family: "Plus Jakarta Sans", sans-serif;
}

.sidebar-search input::placeholder {
    color: var(--text-subtle);
}

/* ─── Nav Tree ─── */
#manual-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px 16px;
}

#manual-nav::-webkit-scrollbar {
    width: 3px;
}

#manual-nav::-webkit-scrollbar-track {
    background: transparent;
}

#manual-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.nav-group {
    margin-bottom: 2px;
}

.nav-group-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    transition:
        background 0.15s,
        color 0.15s;
    font-family: "Plus Jakarta Sans", sans-serif;
    white-space: nowrap;
    overflow: hidden;
}

.nav-group-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text-main);
}

.nav-group-btn.active-parent {
    color: var(--brand-green);
}

.nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.nav-group-btn:hover .nav-icon {
    background: var(--brand-green-bg);
}

.nav-group-btn.active-parent .nav-icon {
    background: var(--brand-green-100);
}

.nav-group-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-chevron {
    flex-shrink: 0;
    font-size: 9px;
    color: var(--text-subtle);
    transition: transform 0.22s;
}

.nav-group-btn.open .nav-chevron {
    transform: rotate(90deg);
}

/* Children */
.nav-children {
    display: none;
    padding: 2px 0 2px 14px;
    border-left: 2px solid var(--border-light);
    margin-left: 24px;
}

.nav-children.open {
    display: block;
}

.nav-child-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12.5px;
    text-align: left;
    transition:
        background 0.12s,
        color 0.12s;
    font-family: "Plus Jakarta Sans", sans-serif;
    white-space: nowrap;
    overflow: hidden;
}

.nav-child-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text-main);
}

.nav-child-btn.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-child-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.15s;
}

.nav-child-btn.active .nav-child-dot {
    background: var(--brand-green);
}

.nav-child-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Topbar ─── */
#manual-topbar {
    height: 56px;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    flex-shrink: 0;
    transition:
        background 0.25s,
        border 0.25s;
}

.topbar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 7px;
    border-radius: 7px;
    color: var(--text-muted);
    display: flex;
    transition:
        background 0.15s,
        color 0.15s;
}

.topbar-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--text-main);
}

.topbar-toggle svg {
    width: 18px;
    height: 18px;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    overflow: hidden;
}

.topbar-breadcrumb .bc-home {
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
}

.topbar-breadcrumb .bc-sep {
    color: var(--border);
    font-size: 16px;
}

.topbar-breadcrumb .bc-section {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-breadcrumb .bc-child {
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-theme-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 6px 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: "Plus Jakarta Sans", sans-serif;
    transition:
        background 0.15s,
        border 0.2s,
        color 0.15s;
}

.topbar-theme-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text-main);
}

.topbar-theme-btn svg {
    width: 15px;
    height: 15px;
}

.topbar-badge {
    background: var(--brand-green-bg);
    color: var(--brand-green-mid);
    border: 1px solid var(--brand-green-100);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    transition: background 0.25s;
}

.dark .topbar-badge {
    background: #052e16;
    color: #4ade80;
    border-color: #14532d;
}

/* ─── Content Area ─── */
#manual-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 36px;
}

#manual-content::-webkit-scrollbar {
    width: 5px;
}

#manual-content::-webkit-scrollbar-track {
    background: transparent;
}

#manual-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ─── Welcome Screen ─── */
#welcome-screen {
    max-width: 720px;
    margin: 32px auto;
}

.welcome-hero {
    text-align: center;
    padding: 40px 32px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition:
        background 0.25s,
        border 0.25s;
}

.welcome-icon-wrap {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    background: var(--brand-green);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.35);
}

.welcome-icon-wrap svg {
    width: 32px;
    height: 32px;
    color: white;
}

.welcome-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    transition: color 0.25s;
}

.welcome-title span {
    color: var(--brand-green);
}

.welcome-sub {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.65;
    max-width: 500px;
    margin: 0 auto;
    transition: color 0.25s;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.quick-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition:
        box-shadow 0.2s,
        border-color 0.2s,
        background 0.25s,
        transform 0.15s;
}

.quick-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand-green);
    transform: translateY(-1px);
}

.quick-card-icon {
    font-size: 22px;
    margin-bottom: 8px;
}

.quick-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.quick-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ─── Section Content ─── */
#section-content {
    display: none;
}

#section-content.active {
    display: block;
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    transition: border 0.25s;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--brand-green-bg);
    color: var(--brand-green-mid);
    border: 1px solid var(--brand-green-100);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    transition: background 0.25s;
}

.dark .section-tag {
    background: #052e16;
    color: #4ade80;
    border-color: #14532d;
}

.section-main-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 6px;
    transition: color 0.25s;
}

.section-purpose {
    font-size: 14px;
    color: var(--text-muted);
    transition: color 0.25s;
}

.section-purpose strong {
    color: var(--brand-green);
}

/* ─── Content Card ─── */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    transition:
        background 0.25s,
        border 0.25s;
}

.content-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.25s;
}

.content-card-title::before {
    content: "";
    display: block;
    width: 3px;
    height: 18px;
    background: var(--brand-green);
    border-radius: 2px;
    flex-shrink: 0;
}

.prose-text {
    font-size: 14px;
    line-height: 1.72;
    color: var(--text-muted);
}

.prose-text p {
    margin-bottom: 10px;
}

.prose-text strong {
    color: var(--text-main);
    font-weight: 600;
}

/* ─── Steps ─── */
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.step-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    transition: color 0.25s;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-green);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

/* ─── Bullets ─── */
.bullet-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.bullet-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    transition: color 0.25s;
}

.bullet-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-green);
    flex-shrink: 0;
    margin-top: 6px;
}

/* ─── Info Box ─── */
.info-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--info-bg);
    border: 1px solid var(--brand-green-100);
    border-left: 3px solid var(--info-border);
    border-radius: 0 8px 8px 0;
    padding: 11px 14px;
    margin-top: 14px;
    font-size: 13px;
    color: var(--info-text);
    line-height: 1.5;
    transition:
        background 0.25s,
        color 0.25s;
}

.dark .info-box {
    border-color: var(--brand-green-dark);
    border-left-color: var(--brand-green);
}

.info-box svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.info-label {
    font-weight: 700;
}

/* Mobile Sidebar */
/* Container */
.img-wrap {
    margin-top: 16px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: border 0.25s;

    display: flex;
    flex-direction: column;
    /* 🔥 IMPORTANT (stack title + image) */
}

/* Title ABOVE image */
.img-caption {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-subtle);

    display: flex;
    /* 🔥 IMPORTANT */
    align-items: center;
    /* vertical align */
    gap: 6px;
    /* space between icon & text */
}

/* Image wrapper behavior */
.img-wrap img {
    max-width: 100%;
    height: auto;
    object-fit: contain;

    margin: auto;
    /* 🔥 centers image */
    padding: 12px;
    /* 🔥 adds breathing room */
    display: block;
}
/* ─────────────────────────────────────────────
   DESKTOP SIDEBAR COLLAPSE
───────────────────────────────────────────── */
@media (min-width: 769px) {
    #manual-sidebar {
        transition:
            width 0.3s cubic-bezier(0.32, 0.72, 0, 1),
            min-width 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    }

    /* Collapsed: shrink to 0 (or icon-only width if you prefer) */
    #manual-sidebar.collapsed {
        width: 0;
        min-width: 0;
        overflow: hidden;
    }

    /* Main shifts left to fill the space */
    #manual-main {
        transition: margin-left 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    }

    #manual-main.sidebar-collapsed {
        margin-left: 0;
    }
}
/* ─────────────────────────────────────────────
   MOBILE SIDEBAR (Better & Cleaner)
───────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Sidebar - Default closed state on mobile */
    #manual-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        min-width: 280px;
        height: 100vh;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    }

    /* OPEN STATE */
    #manual-sidebar.open {
        transform: translateX(0);
    }

    /* Remove collapsed class conflict on mobile */
    #manual-sidebar.collapsed {
        transform: translateX(-100%) !important;
    }

    /* Backdrop */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: all 0.35s ease;
        pointer-events: none;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* Main content adjustment */
    #manual-main {
        position: relative;
        z-index: 1;
    }

    /* Content padding on mobile */
    #manual-content {
        padding: 20px 16px;
    }

    .quick-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    #manual-sidebar {
        width: 260px;
        min-width: 260px;
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }
}
