/* =========================================================
   GTKZ FORGE
   COMMERCIAL DESKTOP DENSITY — FINAL PRESENTATION LAYER

   Loaded LAST.
   Geometry/density only.
   No structural JavaScript changes.
   ========================================================= */


/* ---------------------------------------------------------
   PAGE
   --------------------------------------------------------- */

html,
body {
    font-size: 13px !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;
}


/* ---------------------------------------------------------
   APP SHELL
   --------------------------------------------------------- */

.app {
    grid-template-columns:
        176px minmax(0, 1fr) !important;

    width:
        100% !important;

    min-height:
        100vh !important;

    align-items:
        stretch !important;
}


/* ---------------------------------------------------------
   SIDEBAR
   --------------------------------------------------------- */

.sidebar {
    width:
        176px !important;

    min-width:
        176px !important;

    height:
        auto !important;

    min-height:
        100vh !important;

    max-height:
        none !important;

    padding:
        9px 8px !important;

    overflow:
        visible !important;

    align-self:
        stretch !important;
}

.brand {
    padding:
        5px 4px 9px !important;
}

.brand-name {
    font-size:
        16px !important;
}

.brand-sub {
    font-size:
        7px !important;
}

.nav-group {
    margin:
        6px 0 !important;
}

.nav-title {
    margin-bottom:
        2px !important;

    font-size:
        9px !important;
}

.nav-item {
    min-height:
        20px !important;

    padding:
        2px 5px !important;

    font-size:
        8.5px !important;

    line-height:
        1.15 !important;
}

.sidebar-footer {
    margin-top:
        9px !important;

    padding:
        7px !important;

    height:
        auto !important;

    min-height:
        0 !important;
}


/* ---------------------------------------------------------
   MAIN
   --------------------------------------------------------- */

.main {
    min-width:
        0 !important;

    padding:
        7px 8px 14px !important;
}


/* ---------------------------------------------------------
   TOPBAR
   --------------------------------------------------------- */

.topbar {
    min-height:
        40px !important;

    gap:
        6px !important;

    margin-bottom:
        6px !important;
}

.search {
    min-height:
        34px !important;
}


/* ---------------------------------------------------------
   GENERIC PANELS
   --------------------------------------------------------- */

.panel,
.card {
    border-radius:
        8px !important;
}

.panel {
    padding:
        8px !important;
}

.panel-head {
    min-height:
        24px !important;

    margin-bottom:
        5px !important;
}

.panel-title {
    font-size:
        12px !important;
}


/* ---------------------------------------------------------
   KPI ROW
   --------------------------------------------------------- */

.kpis {
    gap:
        6px !important;

    margin-bottom:
        6px !important;
}

.kpi {
    min-height:
        60px !important;

    padding:
        7px !important;
}

.kpi-icon {
    width:
        30px !important;

    height:
        30px !important;
}

.kpi-label {
    font-size:
        8px !important;
}

.kpi-value {
    font-size:
        17px !important;
}


/* ---------------------------------------------------------
   ANALYTICS
   --------------------------------------------------------- */

.analytics {
    gap:
        6px !important;

    margin-bottom:
        6px !important;
}

.analytics .panel {
    min-height:
        125px !important;
}


/* ---------------------------------------------------------
   ACTION BAR
   --------------------------------------------------------- */

.actions {
    gap:
        5px !important;

    margin-bottom:
        6px !important;
}

.action {
    min-height:
        38px !important;

    padding:
        5px 4px !important;

    font-size:
        8px !important;
}


/* ---------------------------------------------------------
   LIVE SESSIONS + TV PREVIEW
   --------------------------------------------------------- */

.mid {
    gap:
        6px !important;

    margin-bottom:
        6px !important;
}

.mid > .panel {
    min-height:
        160px !important;
}

.table-wrap {
    font-size:
        8px !important;
}

table th,
table td {
    padding:
        5px 6px !important;
}


/* TV Experience Builder */

.preview {
    min-height:
        145px !important;
}

.preview-hero {
    min-height:
        83px !important;

    padding:
        10px !important;
}

.preview-copy h2 {
    font-size:
        19px !important;

    line-height:
        1.02 !important;
}

.preview-copy p {
    font-size:
        9px !important;
}

.preview-nav {
    font-size:
        7px !important;
}

.preview-categories {
    gap:
        4px !important;
}

.preview-cat {
    padding:
        6px 2px !important;

    font-size:
        7px !important;
}


/* ---------------------------------------------------------
   BOTTOM MASTER GRID
   --------------------------------------------------------- */

.bottom {
    grid-template-columns:
        minmax(0, 1fr)
        190px !important;

    gap:
        7px !important;

    align-items:
        start !important;
}


/* ---------------------------------------------------------
   UNIVERSAL DEVICE SIMULATOR
   --------------------------------------------------------- */

.simulator {
    padding:
        9px !important;
}

.simulator-grid {
    gap:
        7px !important;
}


/* STEP COPY */

.choice-title {
    margin-bottom:
        1px !important;

    font-size:
        10.5px !important;
}

.choice-sub {
    margin-bottom:
        4px !important;

    font-size:
        7px !important;
}


/* ---------------------------------------------------------
   ONE ROW OF 8 SMART DEVICES
   ONE ROW OF 8 TVS
   --------------------------------------------------------- */

#device-group .icon-grid,
#tv-group .icon-grid {
    grid-template-columns:
        repeat(8, minmax(0, 1fr))
        !important;

    gap:
        5px !important;
}

.device-option,
.tv-option {
    height:
        52px !important;

    min-height:
        52px !important;

    padding:
        4px !important;

    border-radius:
        8px !important;
}

.gtkz-device-icon {
    width:
        31px !important;

    height:
        31px !important;

    max-width:
        31px !important;

    max-height:
        31px !important;
}

.tv-option .gtkz-device-icon {
    width:
        50px !important;

    height:
        26px !important;

    max-width:
        50px !important;

    max-height:
        26px !important;
}


/* ---------------------------------------------------------
   PLAYER
   --------------------------------------------------------- */

.simulator-grid > div:nth-child(3) {
    min-width:
        0 !important;
}

.sim-screen {
    height:
        260px !important;

    min-height:
        260px !important;
}

.sim-top {
    min-height:
        29px !important;

    padding:
        5px 7px !important;

    font-size:
        7px !important;
}

.sim-live {
    min-height:
        158px !important;

    padding:
        12px !important;
}

.sim-live h3 {
    font-size:
        25px !important;

    line-height:
        1.03 !important;
}

.sim-live p {
    margin:
        5px 0 !important;

    font-size:
        10px !important;
}

.sim-channels {
    gap:
        3px !important;

    padding:
        4px !important;
}

.sim-channel {
    padding:
        6px 2px !important;

    font-size:
        7px !important;
}


/* ---------------------------------------------------------
   LAUNCH
   --------------------------------------------------------- */

.deploy-button {
    min-height:
        36px !important;

    margin-top:
        6px !important;

    padding:
        6px !important;

    font-size:
        12px !important;
}


/* ---------------------------------------------------------
   FACTORY REMOTE
   --------------------------------------------------------- */

.simulator-grid > .remote,
.remote {
    max-width:
        108px !important;

    height:
        302px !important;

    min-height:
        302px !important;

    padding:
        8px 4px !important;
}

.remote-brand {
    font-size:
        7px !important;
}

.remote-pad {
    width:
        68px !important;

    height:
        68px !important;

    margin:
        9px auto !important;
}

.remote-button {
    width:
        23px !important;

    height:
        23px !important;

    margin:
        1px !important;
}


/* ---------------------------------------------------------
   RIGHT SYSTEM RAIL
   --------------------------------------------------------- */

.side-stack {
    width:
        190px !important;

    min-width:
        190px !important;

    gap:
        7px !important;
}

.side-stack .panel {
    padding:
        8px !important;
}

.side-stack .panel-title {
    font-size:
        11px !important;
}

.activity-row,
.status-row {
    padding:
        2px 0 !important;

    font-size:
        7.5px !important;
}


/* ---------------------------------------------------------
   1440+ DESKTOP
   Give slightly more breathing room without becoming huge.
   --------------------------------------------------------- */

@media (min-width: 1440px) {

    .app {
        grid-template-columns:
            188px minmax(0, 1fr) !important;
    }

    .sidebar {
        width:
            188px !important;

        min-width:
            188px !important;
    }

    .bottom {
        grid-template-columns:
            minmax(0, 1fr)
            200px !important;
    }

    .side-stack {
        width:
            200px !important;

        min-width:
            200px !important;
    }

    .device-option,
    .tv-option {
        height:
            56px !important;

        min-height:
            56px !important;
    }

    .sim-screen {
        height:
            275px !important;

        min-height:
            275px !important;
    }
}


/* ---------------------------------------------------------
   TABLET/MOBILE
   --------------------------------------------------------- */

@media (max-width: 900px) {

    .app {
        display:
            block !important;
    }

    .sidebar {
        display:
            none !important;
    }

    .bottom {
        grid-template-columns:
            1fr !important;
    }

    .side-stack {
        width:
            100% !important;

        min-width:
            0 !important;
    }

    #device-group .icon-grid,
    #tv-group .icon-grid {
        grid-template-columns:
            repeat(4, minmax(0, 1fr))
            !important;
    }
}


/* =========================================================
   GTKZ FORGE — COMMERCIAL SIDEBAR FINAL OWNER
   ========================================================= */

@media (min-width: 901px) {

    /*
     * Give the navigation enough width to read naturally,
     * but do not steal too much room from the simulator.
     */
    .app {
        grid-template-columns:
            210px minmax(0, 1fr) !important;
    }

    .sidebar {
        width:
            210px !important;

        min-width:
            210px !important;

        min-height:
            100vh !important;

        height:
            auto !important;

        padding:
            12px 10px !important;

        display:
            flex !important;

        flex-direction:
            column !important;

        align-self:
            stretch !important;

        overflow:
            visible !important;
    }


    /* Brand */

    .brand {
        flex:
            0 0 auto;

        padding:
            7px 6px 13px !important;
    }

    .brand-name {
        font-size:
            19px !important;

        line-height:
            1.05 !important;
    }

    .brand-sub {
        font-size:
            9px !important;

        line-height:
            1.25 !important;
    }


    /* Navigation */

    .nav-primary {
        flex:
            0 0 auto !important;
    }

    .nav-group {
        flex:
            0 0 auto;

        margin:
            8px 0 !important;
    }

    .nav-title {
        margin-bottom:
            4px !important;

        font-size:
            10.5px !important;

        line-height:
            1.2 !important;
    }

    .nav-item {
        min-height:
            26px !important;

        padding:
            4px 7px !important;

        font-size:
            10.5px !important;

        line-height:
            1.25 !important;

        border-radius:
            6px !important;
    }


    /*
     * This is the important part:
     * push the GTKZ FORGE card to the bottom of the rail.
     */
    .sidebar-footer {
        flex:
            0 0 auto !important;

        margin-top:
            auto !important;

        margin-bottom:
            8px !important;

        padding:
            10px 8px !important;

        min-height:
            0 !important;

        height:
            auto !important;
    }

    .sidebar-footer strong {
        display:
            block;

        font-size:
            13px !important;

        line-height:
            1.15 !important;
    }

    .sidebar-footer small {
        font-size:
            9px !important;

        line-height:
            1.2 !important;
    }
}


/*
 * Larger desktop: just a little more rail.
 */
@media (min-width: 1500px) {

    .app {
        grid-template-columns:
            220px minmax(0, 1fr) !important;
    }

    .sidebar {
        width:
            220px !important;

        min-width:
            220px !important;
    }

    .nav-item {
        font-size:
            11px !important;
    }
}


/* =========================================================
   GTKZ FORGE — COMMERCIAL LAYOUT CORRECTION
   FINAL OWNERSHIP LAYER
   ========================================================= */

@media (min-width: 901px) {

    /* =====================================================
       APP SHELL
       ===================================================== */

    .app {
        display: grid !important;

        grid-template-columns:
            210px minmax(0, 1fr) !important;

        align-items: stretch !important;

        min-height: 100vh !important;
    }


    /* =====================================================
       SIDEBAR
       No private scrollbar.
       Let normal PAGE scrolling move everything.
       ===================================================== */

    .sidebar {
        position: relative !important;

        top: auto !important;
        bottom: auto !important;

        width: 210px !important;
        min-width: 210px !important;

        height: auto !important;
        min-height: 100% !important;
        max-height: none !important;

        overflow: visible !important;

        display: flex !important;
        flex-direction: column !important;

        align-self: stretch !important;
    }


    /*
     * Kill any internal sidebar scrollbar.
     */
    .sidebar,
    .sidebar * {
        scrollbar-width: none !important;
    }

    .sidebar::-webkit-scrollbar,
    .sidebar *::-webkit-scrollbar {
        display: none !important;

        width: 0 !important;
        height: 0 !important;
    }


    /*
     * Known wrappers should not create their own viewport.
     */
    .sidebar nav,
    .sidebar .nav-primary,
    .sidebar .nav-groups,
    .sidebar .nav-scroll,
    .sidebar .sidebar-nav,
    .sidebar .sidebar-content {
        position: relative !important;

        height: auto !important;
        max-height: none !important;

        overflow: visible !important;
    }


    /*
     * GTKZ card naturally remains below navigation.
     * No forced floating in the middle.
     */
    .sidebar-footer {
        margin-top: 16px !important;
        margin-bottom: 16px !important;

        height: auto !important;
        min-height: 0 !important;

        flex: 0 0 auto !important;
    }


    /* =====================================================
       SIDEBAR TYPOGRAPHY
       ===================================================== */

    .nav-title {
        font-size: 11px !important;
    }

    .nav-item {
        min-height: 27px !important;

        padding: 4px 7px !important;

        font-size: 11px !important;

        line-height: 1.25 !important;
    }

    .brand-name {
        font-size: 19px !important;
    }

    .brand-sub {
        font-size: 9px !important;
    }


    /* =====================================================
       BOTTOM MASTER LAYOUT
       Simulator gets the majority of available width.
       ===================================================== */

    .bottom {
        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            210px !important;

        gap: 10px !important;

        width: 100% !important;

        align-items: start !important;
    }


    /* =====================================================
       UNIVERSAL DEVICE SIMULATOR

       ROW 1 = Smart Devices
       ROW 2 = TVs
       ROW 3 = Player + Remote
       ===================================================== */

    .simulator-grid {
        display: grid !important;

        grid-template-columns:
            repeat(12, minmax(0, 1fr)) !important;

        grid-template-rows:
            auto
            auto
            auto !important;

        gap: 9px !important;

        width: 100% !important;
        min-width: 0 !important;
    }


    /* Step 1 — full width */

    #device-group {
        grid-column: 1 / 13 !important;
        grid-row: 1 !important;

        width: 100% !important;
        min-width: 0 !important;
    }


    /* Step 2 — full width */

    #tv-group {
        grid-column: 1 / 13 !important;
        grid-row: 2 !important;

        width: 100% !important;
        min-width: 0 !important;
    }


    /* Player */

    .simulator-grid > div:nth-child(3) {
        grid-column: 1 / 11 !important;
        grid-row: 3 !important;

        width: 100% !important;
        min-width: 0 !important;

        display: flex !important;
        flex-direction: column !important;
    }


    /* Remote */

    .simulator-grid > .remote {
        grid-column: 11 / 13 !important;
        grid-row: 3 !important;

        width: 112px !important;
        max-width: 112px !important;

        min-width: 112px !important;

        justify-self: center !important;
        align-self: stretch !important;
    }


    /* =====================================================
       ONE HORIZONTAL ROW PER SELECTOR
       ===================================================== */

    #device-group .icon-grid,
    #tv-group .icon-grid {
        display: grid !important;

        grid-template-columns:
            repeat(8, minmax(0, 1fr)) !important;

        gap: 7px !important;

        width: 100% !important;
    }


    .device-option,
    .tv-option {
        width: 100% !important;

        height: 60px !important;
        min-height: 60px !important;

        padding: 6px !important;
    }


    .gtkz-device-icon {
        width: 36px !important;
        height: 36px !important;

        max-width: 36px !important;
        max-height: 36px !important;
    }


    .tv-option .gtkz-device-icon {
        width: 58px !important;
        height: 30px !important;

        max-width: 58px !important;
        max-height: 30px !important;
    }


    /* =====================================================
       PLAYER
       ===================================================== */

    .sim-screen {
        width: 100% !important;

        height: 285px !important;
        min-height: 285px !important;
    }


    .sim-live {
        min-height: 175px !important;
    }


    /* =====================================================
       REMOTE
       ===================================================== */

    .remote {
        height: 329px !important;
        min-height: 329px !important;

        padding: 9px 5px !important;
    }


    /* =====================================================
       RIGHT RAIL
       ===================================================== */

    .side-stack {
        width: 210px !important;
        min-width: 210px !important;

        gap: 9px !important;
    }

}


/* Slightly roomier on wide desktop */

@media (min-width: 1500px) {

    .app {
        grid-template-columns:
            220px minmax(0, 1fr) !important;
    }

    .sidebar {
        width: 220px !important;
        min-width: 220px !important;
    }

    .bottom {
        grid-template-columns:
            minmax(0, 1fr)
            220px !important;
    }

    .side-stack {
        width: 220px !important;
        min-width: 220px !important;
    }

}


/* =========================================================
   GTKZ FORGE — PLAYER / REMOTE BALANCE OWNER

   Remote uses dead space beneath system rail.
   Player remains centered and commercially proportioned.
   ========================================================= */

@media (min-width: 901px) {

    /* -----------------------------------------------------
       PLAYER NOW OWNS ROW 3
       ----------------------------------------------------- */

    .simulator-grid > div:nth-child(3) {
        grid-column:
            1 / 13 !important;

        grid-row:
            3 !important;

        width:
            min(100%, 760px) !important;

        max-width:
            760px !important;

        min-width:
            0 !important;

        justify-self:
            center !important;

        display:
            flex !important;

        flex-direction:
            column !important;
    }


    /*
     * Keep the screen substantial,
     * but do not allow billboard proportions.
     */
    .sim-screen {
        width:
            100% !important;

        max-width:
            760px !important;

        height:
            285px !important;

        min-height:
            285px !important;
    }


    /*
     * Launch button follows player width exactly.
     */
    .simulator-grid > div:nth-child(3)
    .deploy-button {
        width:
            100% !important;

        max-width:
            760px !important;
    }


    /* -----------------------------------------------------
       RIGHT RAIL REMOTE SLOT
       ----------------------------------------------------- */

    .rail-remote-slot {
        width:
            100%;

        display:
            flex;

        justify-content:
            center;

        align-items:
            flex-start;

        margin-top:
            2px;
    }


    .rail-remote-slot .remote {
        position:
            relative !important;

        grid-column:
            auto !important;

        grid-row:
            auto !important;

        width:
            150px !important;

        min-width:
            150px !important;

        max-width:
            150px !important;

        height:
            300px !important;

        min-height:
            300px !important;

        max-height:
            none !important;

        margin:
            0 auto !important;

        justify-self:
            auto !important;

        align-self:
            auto !important;

        padding:
            10px 6px !important;
    }


    .rail-remote-slot .remote-pad {
        width:
            76px !important;

        height:
            76px !important;

        margin:
            12px auto !important;
    }


    .rail-remote-slot .remote-button {
        width:
            26px !important;

        height:
            26px !important;
    }


    /*
     * Right rail keeps normal stack:
     *
     * Recent Activity
     * Platform Status
     * Factory Remote
     */
    .side-stack {
        align-content:
            start !important;
    }
}


/* ---------------------------------------------------------
   LARGE DESKTOP
   Slightly larger player, still capped.
   --------------------------------------------------------- */

@media (min-width: 1500px) {

    .simulator-grid > div:nth-child(3) {
        width:
            min(100%, 800px) !important;

        max-width:
            800px !important;
    }

    .sim-screen,
    .simulator-grid > div:nth-child(3)
    .deploy-button {
        max-width:
            800px !important;
    }
}


/* ---------------------------------------------------------
   MOBILE
   Remote returns to normal document flow.
   --------------------------------------------------------- */

@media (max-width: 900px) {

    .rail-remote-slot .remote {
        width:
            140px !important;

        min-width:
            140px !important;

        max-width:
            140px !important;

        height:
            auto !important;

        min-height:
            290px !important;
    }
}
