:root {
    /* --- GroJa Hub Core Tokens --- */
    --primary-color: #005D50;
    --secondary-color: #00382E;
    --accent-color: #4DB6AC;
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Montserrat', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --header-height: 60px;

    /* --- Fence Geometry (Preserved) --- */
    --post-w: 22px;
    --rail-h: 8px;
    --bottom-rail-h: 10px;
    --cap-h: 8px;
    --cap-extra: 1px;
    --post-base: #4a4e51;
    --post-hi: #6b7074;
    --post-groove: #383b3d;
    --post-shadow: #2a2c2e;
    --rail-top: #6b7074;
    --rail-face: #4a4e51;
    --rail-bottom: #383b3d;
}

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

body {
    font-family: var(--font-body);
    font-weight: 500;
    background: 
        radial-gradient(at 0% 0%, rgba(77, 182, 172, 0.4) 0, transparent 60%),
        radial-gradient(at 50% 0%, rgba(0, 93, 80, 0.3) 0, transparent 60%),
        radial-gradient(at 100% 50%, rgba(77, 182, 172, 0.2) 0, transparent 50%),
        #00382E;
    color: var(--text-color);
    position: relative;
    overflow: hidden;
    height: 100vh;
}

/* Atmospheric Noise Overlay */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Cfilter id='noiseFilter'%3%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3%3C/filter%3%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3%3C/svg%3");
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
}

.app-layout {
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
    display: flex;
}

.main-dashboard {
    flex: 1;
    display: flex;
    position: relative;
    z-index: 10;
}

/* --- Sidebar Glass --- */
.sidebar-glass {
    flex: 0 0 460px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 3rem 2.5rem;
    z-index: 20;
}

.sidebar-header {
    margin-bottom: 2.5rem;
}

.brand-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.sidebar-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    line-height: 1;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 40px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--accent-color);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(77, 182, 172, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(77, 182, 172, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(77, 182, 172, 0); }
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-right: -10px;
}

.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* --- Dashboard Accordion --- */
.dashboard-accordion {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.family-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.accordion-header:hover .header-label {
    color: var(--accent-color);
}

.header-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.accordion-header .icon-arrow {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.5;
}

.accordion-header.active .icon-arrow {
    transform: rotate(180deg);
    opacity: 1;
    color: var(--accent-color);
}

.accordion-content {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding-top: 0.5rem;
}

.accordion-content.open {
    display: flex;
}

/* --- Item Styling --- */
.item-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.item-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.item-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
}

.variant-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    padding: 6px 12px;
    font-size: 11px;
    font-family: inherit;
    margin-right: 12px;
    cursor: pointer;
    outline: none;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-add, .btn-minus {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add:hover:not(:disabled), .btn-minus:hover:not(:disabled) {
    background: var(--accent-color);
    color: var(--secondary-color);
    border-color: var(--accent-color);
}

/* --- Sidebar Footer --- */
.sidebar-footer {
    padding-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-color), #00796B);
    border: none;
    border-radius: 40px;
    padding: 22px;
    color: #00382E;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 40px rgba(77, 182, 172, 0.3);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.primary-btn:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 60px rgba(77, 182, 172, 0.5);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.action-btn-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 40px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn-mini:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* --- Stage Area --- */
.stage-area {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

.stage-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.spotlight-v2 {
    position: absolute;
    top: -10%;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    height: 40vh;
    background: radial-gradient(ellipse at center, rgba(77, 182, 172, 0.1) 0%, transparent 70%);
    filter: blur(100px);
}

.fence-preview {
    position: relative;
    z-index: 10;
}

.stage-footer {
    position: absolute;
    bottom: 3rem;
    left: 3rem;
    right: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.config-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.config-id {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 2px;
    opacity: 0.8;
}

.config-system {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.summary-overlay {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.summary-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.summary-value-grid {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.total-value {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.unit-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* --- Floating Summary Card --- */
.floating-summary {
    position: absolute;
    top: 3rem;
    right: 3rem;
    width: 320px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.summary-header {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
}

.summary-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-family {
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.summary-detail {
    font-size: 13px;
    font-weight: 500;
}

/* --- Fence Core (Preserved) --- */
.fence-container {
    position: relative;
    width: 490px;
    height: 512px;
    transform: scale(1.4);
    transform-origin: center bottom;
}

.fence-frame {
    position: absolute;
    bottom: 2px;
    top: 10px;
    left: 5px;
    right: 5px;
}

.stack-container {
    position: absolute;
    bottom: var(--bottom-rail-h);
    left: var(--post-w);
    right: var(--post-w);
    top: 10px;
    display: flex;
    flex-direction: column-reverse;
    z-index: 5;
    overflow: hidden;
}

.frame-post {
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--post-w);
    z-index: 20;
    background: linear-gradient(to right, var(--post-hi) 0px, var(--post-hi) 2px, var(--post-base) 2px, var(--post-base) 6px, var(--post-groove) 6px, var(--post-groove) 7px, var(--post-base) 7px, var(--post-base) 13px, var(--post-groove) 13px, var(--post-groove) 14px, var(--post-base) 14px, var(--post-base) 19px, var(--post-shadow) 19px, var(--post-shadow) 22px);
    box-shadow: 2px 0 15px rgba(0,0,0,0.4);
    border-radius: 2px;
}

.frame-post-left  { left: 0; }
.frame-post-right { 
    right: 0; 
    transform: scaleX(-1);
    box-shadow: -2px 0 15px rgba(0,0,0,0.4);
}

.frame-post-glow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: #ffffff;
    opacity: 0;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none;
    z-index: 21;
}

.fence-container.glow-on .frame-post-glow {
    opacity: 0.9;
    box-shadow: 0 0 15px 2px rgba(255, 255, 255, 0.8), 0 0 30px 5px rgba(77, 182, 172, 0.4);
}

.frame-top-rail {
    position: absolute;
    top: 2px;
    left: var(--post-w);
    right: var(--post-w);
    height: var(--rail-h);
    z-index: 18;
    background: linear-gradient(to bottom, var(--rail-top) 0%, var(--rail-top) 20%, var(--rail-face) 45%, var(--rail-bottom) 100%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.frame-post-cap {
    position: absolute;
    top: calc(-1 * var(--cap-h));
    width: calc(var(--post-w) + 2 * var(--cap-extra));
    height: var(--cap-h);
    z-index: 25;
    background: linear-gradient(135deg, #82888c 0%, var(--post-base) 20%, var(--post-base) 70%, var(--post-shadow) 100%);
    border-radius: 2px 2px 0 0;
}

.frame-post-cap-left  { left:  calc(-1 * var(--cap-extra)); }
.frame-post-cap-right { right: calc(-1 * var(--cap-extra)); }

.filling-element {
    width: 100%;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: block;
    flex-shrink: 0;
}

.unit-1 { height: 40px; }
.unit-2 { height: 80px; }

/* --- Cinematic Reveal --- */
.panel-reveal {
    animation: panelReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }

@keyframes panelReveal {
    from { opacity: 0; transform: translateY(30px) scale(0.98); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* GroJaGlow Switch styling */
.glow-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.glow-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent-color);
}

.switch {
    width: 44px;
    height: 24px;
    position: relative;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    cursor: pointer;
    transition: 0.4s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.4s;
}

input:checked + .slider { background: var(--accent-color); }
input:checked + .slider:before { transform: translateX(20px); }

/* ==================== SITE NAVIGATION HEADER ==================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 2rem;
    height: var(--header-height);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(0, 32, 26, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
}

.header-inner {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    font-family: var(--font-body);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    gap: 2.5rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-link:hover,
.nav-link.active {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
    .site-header {
        height: auto;
        padding: 0.8rem 1rem;
    }

    .header-inner {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-logo {
        font-size: 1.1rem;
    }

    .site-nav {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-link {
        font-size: 0.7rem;
    }

    .app-layout {
        margin-top: 90px;
        height: calc(100vh - 90px);
    }
}
