:root {
    --bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-bright: #cbd5e1;
    --text: #0f172a;
    --text-dim: #64748b;
    --accent: #2563eb;
    --accent-dim: rgba(37, 99, 235, 0.08);
    --green: #059669;
    --green-dim: rgba(5, 150, 105, 0.08);
    --amber: #d97706;
    --amber-dim: rgba(217, 119, 6, 0.08);
    --red: #dc2626;
    --red-dim: rgba(220, 38, 38, 0.08);
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: radial-gradient(ellipse at bottom right, #f1f5f9, var(--bg));
    color: var(--text);
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    line-height: 1.6;
}

/* SIDEBAR STYLE */
aside.app-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.brand-icon {
    font-size: 1.6rem;
}

.brand-title {
    font-size: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-dim);
    font-weight: 700;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 0.4rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.sidebar-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

/* MAIN CONTENT */
main.spec-main {
    padding: 2.5rem 3rem;
    max-width: 1200px;
    width: 100%;
}

.spec-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.spec-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.spec-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.spec-desc {
    font-size: 1.05rem;
    color: var(--text-dim);
    max-width: 800px;
}

/* CONTENT SECTIONS */
.spec-section {
    margin-bottom: 3.5rem;
    scroll-margin-top: 2rem;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-desc {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
}

/* CARDS & GRIDS */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--border-bright);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
}

/* DATA TABLES */
.table-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    margin-top: 1rem;
}

table.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

table.spec-table th {
    background: #f8fafc;
    color: var(--text);
    padding: 0.85rem 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table.spec-table td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

table.spec-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.02);
}

table.spec-table tr:last-child td {
    border-bottom: none;
}

/* CODE & CHIPS */
code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: #f1f5f9;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    color: #1e40af;
    border: 1px solid var(--border);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 700;
}

.chip-required {
    background: #fef2f2;
    color: var(--red);
    border: 1px solid #fecaca;
}

.chip-optional {
    background: #f1f5f9;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.chip-pk {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.chip-fk {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* FLOW STEPS */
.flow-step {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.flow-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 38px;
    bottom: -18px;
    width: 2px;
    background: var(--border);
}

.step-num {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eff6ff;
    color: var(--accent);
    border: 2px solid rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
    z-index: 2;
}

.step-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    flex: 1;
}

.step-content h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.step-content p {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* VISUAL INFOGRAPHIC FLOW (NON-TECH FRIENDLY) */
.infographic-flow {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    margin-top: 1rem;
}

.info-step-card {
    flex: 1;
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    position: relative;
    transition: all 0.25s;
}

.info-step-card:hover {
    border-color: var(--border-bright);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.info-step-card.card-blue {
    border-top: 4px solid #2563eb;
    background: linear-gradient(to bottom, #ffffff 60%, #f0f7ff);
}

.info-step-card.card-green {
    border-top: 4px solid #059669;
    background: linear-gradient(to bottom, #ffffff 60%, #f0fdf4);
}

.info-step-card.card-amber {
    border-top: 4px solid #d97706;
    background: linear-gradient(to bottom, #ffffff 60%, #fffbeb);
}

.info-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.info-step-icon {
    font-size: 2rem;
    display: inline-block;
}

.info-badge-role {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
}

.role-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.role-green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.role-amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }

.info-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.info-card-sub {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.info-tag-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: auto;
}

.info-tag-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: #334155;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    padding: 0.35rem 0.6rem;
    border-radius: 0.4rem;
}

.info-arrow-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 60px;
    flex-shrink: 0;
    text-align: center;
}

.info-arrow-col span.arrow-icon {
    font-size: 1.4rem;
    color: var(--accent);
}

@media (max-width: 1024px) {
    body {
        grid-template-columns: 1fr;
    }
    aside.app-sidebar {
        display: none;
    }
    main.spec-main {
        padding: 1.5rem;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    .infographic-flow {
        flex-direction: column;
    }
    .info-arrow-col {
        width: 100%;
        margin: 0.5rem 0;
    }
}
