:root {
    --bg: #000;
    --text: #e2e8f0;
    --muted: rgba(226, 232, 240, .75);
    --orange: #f38c18;
    --card: #101010;
    --panel: rgba(0, 0, 0, .6);
    --ok: #22c55e;
    --warn: #f59e0b;
    --err: #ef4444
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 5%, rgba(243, 140, 24, .32), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(243, 140, 24, .22), transparent 55%),
        radial-gradient(circle at 40% 120%, rgba(243, 140, 24, .2), transparent 60%),
        var(--bg)
}

/* bg fx */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -5;
    pointer-events: none;
    background-image:
        linear-gradient(90deg, rgba(243, 140, 24, .06) 1px, transparent 1px),
        linear-gradient(0deg, rgba(243, 140, 24, .04) 1px, transparent 1px);
    background-size: 110px 110px
}

.bg-grid-2 {
    position: fixed;
    inset: 0;
    z-index: -4;
    pointer-events: none;
    opacity: .5;
    background-image:
        linear-gradient(90deg, rgba(243, 140, 24, .035) 1px, transparent 1px),
        linear-gradient(0deg, rgba(243, 140, 24, .02) 1px, transparent 1px);
    background-size: 32px 32px
}

.neon-band {
    position: fixed;
    top: -12vh;
    left: -12vw;
    width: 70vw;
    height: 36vh;
    background: radial-gradient(circle at 10% 50%, rgba(243, 140, 24, .75), transparent 70%);
    filter: drop-shadow(0 0 35px rgba(243, 140, 24, .45));
    transform: rotate(5deg);
    z-index: -3;
    pointer-events: none;
    animation: orangeFloat 14s ease-in-out infinite alternate
}

@keyframes orangeFloat {
    0% {
        transform: translateY(0) rotate(5deg);
        opacity: .95
    }

    100% {
        transform: translateY(35px) rotate(7deg);
        opacity: .6
    }
}

.neon-pill {
    position: fixed;
    bottom: -120px;
    right: -80px;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(243, 140, 24, .5), transparent);
    filter: blur(16px);
    opacity: .6;
    z-index: -2;
    pointer-events: none;
    animation: orangeFloat2 16s ease-in-out infinite alternate
}

@keyframes orangeFloat2 {
    0% {
        transform: translateY(0);
        opacity: .7
    }

    100% {
        transform: translateY(-32px);
        opacity: .35
    }
}

/* layout */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 12px;
    max-width: 1360px;
    margin: 20px auto;
    padding: 0 12px 32px
}

/* sidebar */
.sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
    height: calc(100vh - 40px);
    background: rgba(0, 0, 0, .8);
    backdrop-filter: blur(14px);
    border-radius: 20px;
    padding: .8rem;
    display: flex;
    flex-direction: column
}

.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem
}

.brand {
    display: flex;
    gap: .6rem;
    align-items: center;
    color: #fff;
    text-decoration: none
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .7)
}

.brand-logo img {
    width: 28px;
    height: auto;
    display: block
}

.brand-meta small {
    color: rgba(226, 232, 240, .7)
}

.side-close {
    display: none;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.1rem
}

.side-nav {
    display: grid;
    gap: .35rem;
    margin: .4rem 0 1rem
}

.nav-link {
    text-align: left;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: .7rem;
    padding: .65rem .75rem;
    font-weight: 700;
    transition: background .2s ease, transform .18s ease, border-color .2s ease
}

.nav-link:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, .06)
}

.nav-link.active {
    background: rgba(243, 140, 24, .2);
    border-color: rgba(243, 140, 24, .35)
}

.side-foot {
    margin-top: auto;
    display: grid;
    gap: .5rem
}

.plan-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: rgba(0, 0, 0, .35);
    border-radius: .7rem;
    padding: .5rem .6rem
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%
}

.dot-ok {
    background: var(--ok)
}

.dot-warn {
    background: var(--warn)
}

.dot-err {
    background: var(--err)
}

.side-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap
}

/* page column */
.page {
    display: grid;
    height: fit-content;
    gap: 12px
}

/* TOPBAR */
.topbar {
    background: rgba(0, 0, 0, .8);
    border-radius: 20px;
    backdrop-filter: blur(14px);
    padding: .5rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem
}

.top-left {
    display: flex;
    align-items: center;
    gap: .6rem
}

.hamburger {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    background: transparent;
    color: #fff;
    font-size: 1rem;
    display: none
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: rgba(0, 0, 0, .35);
    padding: .45rem .75rem;
    border-radius: .9rem;
    font-size: .9rem;
    white-space: nowrap
}

.top-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    font-weight: 800;
    letter-spacing: .01em
}

.top-right {
    display: flex;
    align-items: center;
    gap: .6rem
}

.meter {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem
}

.meter-label {
    color: rgba(226, 232, 240, .75)
}

.meter-bar {
    width: 110px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden
}

.meter-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(135deg, #f38c18, #ffb96a)
}

/* sys-strip (inside Streams) */
.sys-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, .6);
    border-radius: 20px;
    padding: .8rem 1rem .7rem;
    margin-bottom: .8rem
}

.strip-actions {
    display: flex;
    gap: .5rem
}

/* buttons */
.btn-primary {
    background: var(--orange);
    color: #000;
    border: 0;
    border-radius: .8rem;
    padding: .6rem .9rem .55rem;
    font-weight: 800
}

.btn-primary:hover {
    background: rgba(243, 140, 24, .9)
}

.btn-soft {
    background: rgba(0, 0, 0, .35);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: .8rem;
    padding: .6rem .9rem .55rem;
    font-weight: 700
}

.btn-soft:hover {
    background: rgba(0, 0, 0, .6)
}

.btn-ghost {
    background: rgba(0, 0, 0, .35);
    color: #fff;
    border: 0;
    border-radius: .8rem;
    padding: .6rem .9rem .55rem;
    font-weight: 700
}

.btn-ghost.danger {
    background: rgba(239, 68, 68, .18)
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, .6)
}

.view-title {
    margin: .2rem 0 .8rem
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

/* grid & cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .8rem
}

.card {
    background: radial-gradient(120% 120% at 20% -10%, rgba(243, 140, 24, .12), transparent 60%), #0f0f0f;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 1.05rem;
    padding: 1rem;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, opacity .2s ease
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
    border-color: rgba(243, 140, 24, .25)
}

.card-create {
    display: flex;
    gap: .9rem;
    align-items: center;
    cursor: pointer
}

.plus {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #101010;
    border: 1px solid rgba(255, 255, 255, .08);
    font-size: 1.6rem;
    color: #fff;
    transition: transform .18s ease
}

.card-create:hover .plus {
    transform: scale(1.06)
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .4rem
}

.pill {
    font-size: .65rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .06em;
    padding: .25rem .55rem .2rem;
    border-radius: 999px
}

.pill.live {
    background: rgba(34, 197, 94, .6);
    color: #ecfdf3
}

.pill.idle {
    background: rgba(255, 255, 255, .16);
    color: #fff
}

.chips {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin: .35rem 0
}

.chip {
    font-size: .78rem;
    background: rgba(255, 255, 255, .08);
    border-radius: .6rem;
    padding: .26rem .55rem
}

.telemetry {
    display: flex;
    gap: 1rem;
    font-size: .9rem;
    color: rgba(226, 232, 240, .85)
}

.next {
    font-size: .9rem;
    color: rgba(226, 232, 240, .75);
    margin: .45rem 0
}

.actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap
}

.btn-action {
    background: rgba(0, 0, 0, .35);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: .7rem;
    padding: .6rem .75rem;
    font-weight: 800
}

.btn-action.primary {
    background: var(--orange);
    color: #000;
    border-color: transparent
}

.btn-action.primary:hover {
    background: rgba(243, 140, 24, .9)
}

.thumb {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: .8rem;
    background: #0b0b0b;
    margin-bottom: .5rem
}

.skeleton {
    position: relative;
    overflow: hidden
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .05), rgba(255, 255, 255, 0));
    transform: translateX(-100%);
    animation: sk 1.5s infinite
}

@keyframes sk {
    to {
        transform: translateX(100%)
    }
}

.kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, .35);
    border-radius: .7rem;
    padding: .6rem .7rem;
    margin: .45rem 0
}

.kv span {
    color: var(--muted)
}

/* views */
.view {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .25s ease, transform .25s ease
}

.view.show {
    display: block;
    opacity: 1;
    transform: translateY(0)
}

/* toasts */
.toasts {
    position: fixed;
    right: 12px;
    bottom: 12px;
    display: grid;
    gap: .5rem;
    z-index: 60
}

.toast {
    background: rgba(0, 0, 0, .8);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: .9rem;
    padding: .7rem .85rem;
    display: flex;
    gap: .5rem;
    align-items: center
}

.toast.ok {
    border-color: rgba(34, 197, 94, .35)
}

.toast.warn {
    border-color: rgba(245, 158, 11, .35)
}

.toast.err {
    border-color: rgba(239, 68, 68, .35)
}

/* responsive */
@media (max-width:1180px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 8px
    }

    .sidebar {
        position: fixed;
        inset: auto 0 0 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        border-radius: 0;
        z-index: 70;
        transition: transform .3s ease
    }

    .sidebar.show {
        transform: translateX(0)
    }

    .side-close {
        display: block
    }

    .hamburger {
        display: block
    }

    .topbar {
        border-radius: 12px
    }

    .sys-strip {
        border-radius: 12px
    }
}

@media (max-width:720px) {
    .top-title {
        font-size: 1rem
    }

    .top-right {
        display: none
    }

    .status-chip {
        font-size: .85rem
    }
}

/* reduced motion */
@media (prefers-reduced-motion:reduce) {
    * {
        animation: none !important;
        transition: none !important
    }

    html {
        scroll-behavior: auto
    }
}

/* modal */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 120;
}

.modal.show {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
}

.modal-sheet {
    position: relative;
    z-index: 1;
    width: min(640px, 92vw);
    margin: 8vh auto 0;
    padding: 0;
    background: rgba(0, 0, 0, .86);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.modal-head h3 {
    margin: 0;
}

.modal-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

.modal-body {
    padding: 1rem;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: .6rem;
}

.field {
    display: grid;
    gap: .35rem;
    margin: .6rem 0;
}

.field span {
    color: var(--muted);
    font-size: .95rem;
}

.field input,
.field select {
    width: 100%;
    padding: .65rem .75rem;
    border-radius: .7rem;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .08);
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: rgba(243, 140, 24, .5);
}

.field-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .7rem;
}

@media (max-width:720px) {
    .field-2col {
        grid-template-columns: 1fr;
    }
}

.select-wrap {
    position: relative;
}

.select-wrap .caret {
    position: absolute;
    right: .7rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: .7;
}