:root {
    --cyan: #86e8ff;
    --cyan-bright: #d8f9ff;
    --blue: #268dff;
    --deep-blue: #06142b;
    --panel: rgba(4, 15, 31, 0.58);
    --line: rgba(118, 225, 255, 0.18);
    --text-muted: rgba(191, 229, 242, 0.62);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #010309;
    color: white;
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

#nexus {
    position: relative;
    width: 100%;
    height: 100%;
    isolation: isolate;
    background:
        radial-gradient(circle at 50% 48%, rgba(13, 55, 102, 0.24), transparent 38%),
        linear-gradient(180deg, #020713 0%, #01030a 100%);
}

#scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.vignette {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(
            circle at center,
            transparent 28%,
            rgba(0, 3, 10, 0.18) 58%,
            rgba(0, 1, 5, 0.86) 100%
        );
}

.scanlines {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0.035;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 3px,
        rgba(160, 235, 255, 0.24) 4px
    );
}

.topbar {
    position: absolute;
    z-index: 10;
    top: 30px;
    left: 38px;
    right: 38px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-12px);
    animation: revealTop 1.2s ease 2.4s forwards;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-mark {
    position: relative;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(134, 232, 255, 0.7);
    border-radius: 50%;
    box-shadow:
        0 0 16px rgba(84, 206, 255, 0.4),
        inset 0 0 10px rgba(84, 206, 255, 0.28);
}

.brand-mark::before,
.brand-mark::after {
    content: "";
    position: absolute;
    border-radius: 50%;
}

.brand-mark::before {
    inset: 6px;
    border: 1px solid rgba(134, 232, 255, 0.8);
}

.brand-mark::after {
    inset: 11px;
    background: #d8f9ff;
    box-shadow: 0 0 12px #70dcff;
}

.brand h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1;
    letter-spacing: 0.48em;
    font-weight: 500;
    color: #d5f6ff;
    text-shadow: 0 0 22px rgba(95, 216, 255, 0.35);
}

.brand p {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 8px;
    letter-spacing: 0.3em;
}

.clock-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.clock-panel span {
    color: var(--text-muted);
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.clock-panel strong {
    color: #cff6ff;
    font-size: 19px;
    font-weight: 300;
    letter-spacing: 0.16em;
    text-shadow: 0 0 15px rgba(85, 214, 255, 0.35);
}

.core-interface {
    position: absolute;
    z-index: 9;
    top: 50%;
    left: 50%;
    width: 215px;
    height: 215px;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    pointer-events: none;
}

#coreButton {
    width: 118px;
    height: 118px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transform: scale(0.5);
    animation: revealCoreButton 1s cubic-bezier(0.2, 0.8, 0.2, 1) 2s forwards;
}

.core-button-ring {
    position: absolute;
    inset: 19px;
    border: 1px solid rgba(171, 241, 255, 0.28);
    border-radius: 50%;
    transition:
        transform 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}

.core-button-dot {
    position: absolute;
    inset: 46px;
    border-radius: 50%;
    background: rgba(225, 251, 255, 0.9);
    box-shadow:
        0 0 12px rgba(191, 246, 255, 1),
        0 0 28px rgba(81, 203, 255, 0.9);
    animation: buttonPulse 2.8s ease-in-out infinite;
}

#coreButton:hover .core-button-ring {
    transform: scale(1.22);
    border-color: rgba(207, 248, 255, 0.75);
    box-shadow: 0 0 28px rgba(76, 204, 255, 0.28);
}

.core-label {
    position: absolute;
    top: calc(50% + 117px);
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(191, 235, 246, 0.6);
    font-size: 8px;
    letter-spacing: 0.25em;
    white-space: nowrap;
    opacity: 0;
    animation: fadeIn 1s ease 3s forwards;
}

.status-light {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #9bffd1;
    box-shadow: 0 0 8px #54f9ad;
    animation: statusPulse 2.4s ease-in-out infinite;
}

.thought-stream {
    position: absolute;
    z-index: 10;
    left: 50%;
    bottom: 42px;
    min-height: 28px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 11px;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: 0.09em;
    color: rgba(205, 241, 250, 0.76);
    opacity: 0;
    animation: fadeIn 1s ease 3.1s forwards;
}

.thought-prefix {
    color: #7bdcff;
    font-size: 9px;
    letter-spacing: 0.25em;
}

.cursor {
    width: 6px;
    height: 13px;
    background: rgba(130, 228, 255, 0.8);
    box-shadow: 0 0 8px rgba(91, 211, 255, 0.6);
    animation: cursorBlink 1s steps(1) infinite;
}

.command-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    background: rgba(0, 4, 12, 0.58);
    backdrop-filter: blur(20px);
    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
}

.command-overlay.open {
    visibility: visible;
    opacity: 1;
}

.command-shell {
    width: min(680px, 92vw);
    padding: 30px;
    border: 1px solid rgba(119, 225, 255, 0.2);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(8, 28, 50, 0.78), rgba(3, 11, 24, 0.82));
    box-shadow:
        0 35px 90px rgba(0, 0, 0, 0.6),
        0 0 55px rgba(38, 150, 255, 0.11),
        inset 0 1px 0 rgba(213, 248, 255, 0.08);
    transform: translateY(18px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.command-overlay.open .command-shell {
    transform: translateY(0) scale(1);
}

.command-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.command-kicker {
    color: #70d8ff;
    font-size: 8px;
    letter-spacing: 0.28em;
}

.command-header h2 {
    margin: 9px 0 0;
    color: #e5fbff;
    font-size: 26px;
    font-weight: 300;
}

#closeCommand {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(131, 225, 255, 0.18);
    border-radius: 50%;
    background: rgba(111, 220, 255, 0.04);
    color: rgba(212, 247, 255, 0.76);
    font-size: 23px;
    font-weight: 200;
    cursor: pointer;
}

.command-line {
    margin-top: 31px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 17px 19px;
    border: 1px solid rgba(114, 219, 255, 0.18);
    border-radius: 14px;
    background: rgba(0, 7, 18, 0.5);
    box-shadow: inset 0 0 24px rgba(51, 158, 255, 0.04);
}

.command-line span {
    color: #69d9ff;
    font-size: 20px;
}

#commandInput {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #ebfcff;
    caret-color: #70dfff;
    font-size: 18px;
    font-weight: 300;
}

#commandInput::placeholder {
    color: rgba(183, 224, 237, 0.32);
}

.command-suggestions {
    margin-top: 17px;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.command-suggestions span {
    padding: 8px 11px;
    border: 1px solid rgba(124, 217, 255, 0.1);
    border-radius: 999px;
    color: rgba(190, 230, 241, 0.46);
    font-size: 9px;
    letter-spacing: 0.08em;
}

.startup-mask {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: #010309;
    animation: removeStartup 1.2s ease 2.4s forwards;
    pointer-events: none;
}

.startup-mask p {
    position: absolute;
    top: calc(50% + 43px);
    color: rgba(150, 224, 245, 0.5);
    font-size: 8px;
    letter-spacing: 0.34em;
    animation: fadeIn 0.6s ease 0.35s both;
}

.startup-point {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #e7fcff;
    box-shadow:
        0 0 8px #bcf4ff,
        0 0 25px #58ceff,
        0 0 80px rgba(45, 148, 255, 0.8);
    animation: startupIgnition 2.1s cubic-bezier(0.2, 0.75, 0.2, 1) forwards;
}

@keyframes startupIgnition {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    20% {
        transform: scale(1);
        opacity: 1;
    }

    75% {
        transform: scale(8);
        opacity: 1;
    }

    100% {
        transform: scale(34);
        opacity: 0;
    }
}

@keyframes removeStartup {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes revealTop {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes revealCoreButton {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes buttonPulse {
    0%,
    100% {
        transform: scale(0.85);
        opacity: 0.72;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes statusPulse {
    0%,
    100% {
        opacity: 0.42;
    }

    50% {
        opacity: 1;
    }
}

@keyframes cursorBlink {
    50% {
        opacity: 0;
    }
}

@media (max-width: 700px) {
    .topbar {
        top: 21px;
        left: 20px;
        right: 20px;
    }

    .brand p {
        display: none;
    }

    .brand h1 {
        font-size: 17px;
        letter-spacing: 0.35em;
    }

    .clock-panel span {
        display: none;
    }

    .clock-panel strong {
        font-size: 14px;
    }

    .thought-stream {
        bottom: 25px;
        max-width: 86vw;
        font-size: 10px;
        overflow: hidden;
    }

    .command-shell {
        padding: 22px;
    }

    .command-header h2 {
        font-size: 22px;
    }
}

/* Hero Core enhancement */

#scene {
    transition: filter 0.4s ease;
}

.command-overlay.open ~ * {
    pointer-events: none;
}

.command-shell::before {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    background:
        linear-gradient(
            120deg,
            transparent,
            rgba(117, 224, 255, 0.13),
            transparent
        );
    opacity: 0.75;
    pointer-events: none;
}

.command-shell {
    position: relative;
    overflow: hidden;
}

#thought {
    transition: opacity 0.28s ease;
}


/* =========================================================
   NEXUS DOCKED CHAT
   ========================================================= */

:root {
    --chat-dock-height: 270px;
}

.command-overlay {
    display: none !important;
}

.chat-dock {
    position: fixed;
    z-index: 30;
    left: 18px;
    right: 18px;
    bottom: 14px;
    height: var(--chat-dock-height);
    display: grid;
    grid-template-rows: 52px minmax(0, 1fr) auto;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transform: translateY(calc(100% + 35px));
    border: 1px solid rgba(118, 225, 255, 0.22);
    border-radius: 18px;
    background:
        linear-gradient(
            180deg,
            rgba(7, 23, 42, 0.92),
            rgba(2, 10, 22, 0.96)
        );
    box-shadow:
        0 -18px 65px rgba(0, 0, 0, 0.48),
        0 0 42px rgba(38, 150, 255, 0.09),
        inset 0 1px 0 rgba(220, 250, 255, 0.07);
    backdrop-filter: blur(18px);
    transition:
        transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.3s ease,
        visibility 0.3s ease;
}

.chat-dock.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.chat-dock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    padding: 0 16px 0 18px;
    border-bottom: 1px solid rgba(118, 225, 255, 0.13);
    background: rgba(7, 25, 45, 0.46);
}

.chat-agent {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.chat-agent-status,
.restore-status {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9bffd1;
    box-shadow:
        0 0 7px #54f9ad,
        0 0 15px rgba(84, 249, 173, 0.46);
}

.chat-agent > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.chat-agent strong {
    overflow: hidden;
    color: #e2faff;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.chat-agent span:last-child {
    color: rgba(183, 226, 239, 0.48);
    font-size: 8px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.chat-dock-controls {
    display: flex;
    align-items: center;
    gap: 7px;
}

.chat-dock-controls button {
    width: 31px;
    height: 31px;
    padding: 0;
    border: 1px solid rgba(131, 225, 255, 0.14);
    border-radius: 50%;
    outline: 0;
    background: rgba(111, 220, 255, 0.035);
    color: rgba(212, 247, 255, 0.72);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        color 0.2s ease;
}

.chat-dock-controls button:hover {
    border-color: rgba(131, 225, 255, 0.42);
    background: rgba(111, 220, 255, 0.1);
    color: #ffffff;
}

.chat-messages {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 17px 20px;
    scrollbar-width: thin;
    scrollbar-color:
        rgba(108, 216, 255, 0.24)
        transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    border-radius: 20px;
    background: rgba(108, 216, 255, 0.24);
}

.chat-empty {
    height: 100%;
    display: grid;
    place-content: center;
    gap: 7px;
    text-align: center;
}

.chat-empty strong {
    color: rgba(222, 249, 255, 0.83);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.08em;
}

.chat-empty span {
    color: rgba(183, 226, 239, 0.38);
    font-size: 10px;
    letter-spacing: 0.05em;
}

.chat-message {
    width: min(760px, 88%);
    margin-bottom: 14px;
}

.chat-message:last-child {
    margin-bottom: 0;
}

.chat-message-user {
    margin-left: auto;
    text-align: right;
}

.chat-message-agent {
    margin-right: auto;
}

.chat-message-label {
    display: block;
    margin-bottom: 5px;
    color: #72dcff;
    font-size: 7px;
    letter-spacing: 0.2em;
}

.chat-message p {
    display: inline-block;
    max-width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(118, 225, 255, 0.11);
    border-radius: 12px;
    background: rgba(10, 31, 52, 0.48);
    color: rgba(226, 249, 255, 0.84);
    font-size: 12px;
    line-height: 1.55;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message-user p {
    background: rgba(28, 105, 157, 0.25);
}

.chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 11px;
    padding: 11px 14px;
    border-top: 1px solid rgba(118, 225, 255, 0.13);
    background: rgba(0, 7, 17, 0.54);
}

.chat-prompt {
    padding: 8px 0 7px 2px;
    color: #70dfff;
    font-size: 17px;
    line-height: 1;
}

#chatInput {
    flex: 1;
    min-width: 0;
    min-height: 34px;
    max-height: 104px;
    padding: 7px 0;
    resize: none;
    overflow-y: auto;
    border: 0;
    outline: 0;
    background: transparent;
    color: #ebfcff;
    caret-color: #70dfff;
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
}

#chatInput::placeholder {
    color: rgba(183, 224, 237, 0.3);
}

#sendChat {
    flex: 0 0 auto;
    min-width: 68px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid rgba(112, 216, 255, 0.22);
    border-radius: 9px;
    outline: 0;
    background: rgba(41, 145, 205, 0.12);
    color: rgba(217, 249, 255, 0.76);
    font-size: 8px;
    letter-spacing: 0.17em;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

#sendChat:hover {
    border-color: rgba(112, 216, 255, 0.5);
    background: rgba(41, 145, 205, 0.23);
    color: white;
}

.restore-chat {
    position: fixed;
    z-index: 31;
    right: 22px;
    bottom: 18px;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 116px;
    height: 38px;
    padding: 0 14px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(15px);
    border: 1px solid rgba(118, 225, 255, 0.19);
    border-radius: 999px;
    background: rgba(5, 20, 37, 0.88);
    color: rgba(217, 249, 255, 0.78);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.42),
        0 0 22px rgba(38, 150, 255, 0.08);
    backdrop-filter: blur(14px);
    font-size: 8px;
    letter-spacing: 0.16em;
    cursor: pointer;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
}

.restore-chat.visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

body.chat-open .thought-stream {
    bottom: calc(var(--chat-dock-height) + 29px);
}

.thought-stream {
    transition: bottom 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 700px) {
    :root {
        --chat-dock-height: 42vh;
    }

    .chat-dock {
        left: 7px;
        right: 7px;
        bottom: 7px;
        border-radius: 15px;
    }

    .topbar {
        top: 20px;
        left: 20px;
        right: 20px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand p {
        display: none;
    }

    .clock-panel strong {
        font-size: 14px;
    }

    .clock-panel span {
        font-size: 7px;
    }

    .chat-message {
        width: 94%;
    }

    .chat-messages {
        padding: 13px;
    }

    #sendChat {
        min-width: 54px;
        padding: 0 9px;
    }

    body.chat-open .thought-stream {
        bottom: calc(var(--chat-dock-height) + 18px);
    }

    .thought-stream {
        max-width: 86vw;
        overflow: hidden;
        font-size: 10px;
        text-overflow: ellipsis;
    }
}

/* Compact floating chat dock */
:root {
    --chat-dock-height: 220px;
}

.chat-dock {
    left: 50%;
    right: auto;
    width: min(68vw, 1050px);
    bottom: 24px;
    transform: translate(-50%, calc(100% + 50px));
    border-radius: 24px;
}

.chat-dock.open {
    transform: translate(-50%, 0);
}

body.chat-open .thought-stream {
    bottom: calc(var(--chat-dock-height) + 40px);
}

@media (max-width: 900px) {
    .chat-dock {
        width: calc(100vw - 28px);
        bottom: 14px;
    }
}

@media (max-width: 700px) {
    :root {
        --chat-dock-height: 40vh;
    }

    .chat-dock {
        width: calc(100vw - 14px);
        bottom: 7px;
        border-radius: 17px;
    }

    body.chat-open .thought-stream {
        bottom: calc(var(--chat-dock-height) + 20px);
    }
}

/* =========================================================
   NEXUS WORKSPACE MODE
   ========================================================= */

.nexus-workspace {
    position: fixed;
    top: 94px;
    left: 42px;
    right: 310px;
    bottom: 42px;
    z-index: 30;
    padding: 22px;
    overflow: hidden;

    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.985);
    transition:
        opacity 320ms ease,
        transform 420ms cubic-bezier(.2,.8,.2,1),
        visibility 320ms ease;

    border: 1px solid rgba(88, 221, 255, 0.28);
    border-radius: 14px;

    background:
        linear-gradient(
            rgba(10, 23, 34, 0.94),
            rgba(3, 12, 21, 0.97)
        );

    box-shadow:
        0 0 0 1px rgba(57, 179, 224, 0.05) inset,
        0 24px 80px rgba(0, 0, 0, 0.55),
        0 0 45px rgba(30, 170, 230, 0.08);

    backdrop-filter: blur(18px);
}

body.workspace-open .nexus-workspace {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.nexus-workspace::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;

    background-image:
        linear-gradient(
            rgba(91, 218, 255, 0.035) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(91, 218, 255, 0.035) 1px,
            transparent 1px
        );

    background-size: 34px 34px;
    mask-image:
        linear-gradient(
            to bottom,
            rgba(0,0,0,.8),
            transparent
        );
}

.workspace-scanline {
    position: absolute;
    left: 0;
    right: 0;
    top: -20%;
    height: 120px;
    pointer-events: none;

    background:
        linear-gradient(
            to bottom,
            transparent,
            rgba(92, 226, 255, 0.07),
            transparent
        );

    animation: workspaceScan 5.5s linear infinite;
}

@keyframes workspaceScan {
    from {
        transform: translateY(-180px);
    }

    to {
        transform: translateY(calc(100vh + 260px));
    }
}

.workspace-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(95, 220, 255, 0.18);
}

.workspace-kicker,
.panel-code,
.workspace-status {
    font-size: 10px;
    letter-spacing: 0.22em;
    color: rgba(115, 221, 255, 0.72);
}

.workspace-header h2 {
    margin: 6px 0 0;
    font-size: clamp(24px, 2.6vw, 42px);
    font-weight: 500;
    letter-spacing: 0.08em;
    color: rgba(232, 251, 255, 0.96);
}

.workspace-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.workspace-status {
    position: relative;
    padding-left: 14px;
}

.workspace-status::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: #56f5c4;
    box-shadow: 0 0 12px #56f5c4;
}

.workspace-close,
.workspace-demo-button {
    border: 1px solid rgba(104, 222, 255, 0.35);
    color: rgba(216, 247, 255, 0.92);
    background: rgba(25, 100, 132, 0.13);
    font: inherit;
    font-size: 10px;
    letter-spacing: 0.18em;
    cursor: pointer;
}

.workspace-close {
    padding: 10px 14px;
    border-radius: 7px;
}

.workspace-close:hover,
.workspace-demo-button:hover {
    border-color: rgba(104, 222, 255, 0.8);
    background: rgba(31, 152, 202, 0.18);
    box-shadow: 0 0 20px rgba(74, 209, 255, 0.12);
}

.workspace-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    height: calc(100% - 82px);
    padding-top: 18px;
}

.workspace-panel {
    position: relative;
    min-height: 0;
    padding: 17px;
    overflow: hidden;

    border: 1px solid rgba(88, 210, 246, 0.15);
    border-radius: 10px;

    background:
        linear-gradient(
            145deg,
            rgba(15, 39, 54, 0.75),
            rgba(4, 16, 26, 0.78)
        );
}

.workspace-panel-main {
    grid-row: 1 / 3;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 13px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(86, 208, 244, 0.11);

    font-size: 11px;
    letter-spacing: 0.15em;
    color: rgba(207, 243, 252, 0.85);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
}

.metric-card {
    padding: 14px;
    min-height: 110px;
    border: 1px solid rgba(80, 208, 244, 0.13);
    background: rgba(5, 23, 35, 0.68);
}

.metric-label {
    display: block;
    font-size: 9px;
    letter-spacing: 0.18em;
    color: rgba(136, 198, 216, 0.72);
}

.metric-value {
    display: block;
    margin: 10px 0 8px;
    font-size: clamp(28px, 3.2vw, 46px);
    font-weight: 300;
    color: rgba(225, 250, 255, 0.97);
    text-shadow: 0 0 18px rgba(73, 210, 255, 0.18);
}

.metric-change {
    font-size: 10px;
    letter-spacing: 0.12em;
    color: rgba(141, 196, 211, 0.8);
}

.positive {
    color: #59e8bc;
}

.warning {
    color: #ffd479;
}

.danger {
    color: #ff7e91;
}

.data-chart {
    position: relative;
    height: calc(100% - 164px);
    min-height: 260px;
    margin-top: 17px;
    overflow: hidden;
    border: 1px solid rgba(78, 203, 241, 0.12);
    background:
        radial-gradient(
            circle at 50% 60%,
            rgba(30, 148, 200, 0.10),
            transparent 62%
        ),
        rgba(3, 15, 24, 0.65);
}

.chart-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(
            rgba(84, 205, 240, 0.06) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(84, 205, 240, 0.06) 1px,
            transparent 1px
        );
    background-size: 48px 48px;
}

.chart-line {
    position: absolute;
    inset: 12% 3% 18%;
    width: 94%;
    height: 70%;
    overflow: visible;
}

.chart-line polyline {
    fill: none;
    stroke: rgba(80, 221, 255, 0.92);
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 8px rgba(65, 213, 255, 0.8));
    stroke-dasharray: 1300;
    stroke-dashoffset: 1300;
}

body.workspace-open .chart-line polyline {
    animation: chartReveal 1.5s ease forwards 240ms;
}

@keyframes chartReveal {
    to {
        stroke-dashoffset: 0;
    }
}

.chart-axis {
    position: absolute;
    left: 4%;
    right: 4%;
    bottom: 11px;
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    letter-spacing: 0.14em;
    color: rgba(129, 188, 205, 0.65);
}

.signal-list {
    display: grid;
    gap: 10px;
}

.signal-row {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 12px 11px;
    border-left: 2px solid rgba(76, 205, 241, 0.18);
    background: rgba(3, 19, 29, 0.62);

    font-size: 11px;
    letter-spacing: 0.08em;
    color: rgba(206, 239, 248, 0.82);
}

.signal-row strong {
    font-size: 9px;
    letter-spacing: 0.16em;
}

.signal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 9px currentColor;
}

.workspace-insight {
    margin: 0;
    line-height: 1.75;
    font-size: 13px;
    color: rgba(190, 226, 236, 0.82);
}

.terminal-output {
    display: grid;
    gap: 7px;
    margin-top: 17px;
    padding: 12px;
    border-left: 2px solid rgba(78, 220, 255, 0.48);
    background: rgba(1, 13, 21, 0.75);

    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10px;
    color: rgba(101, 231, 255, 0.84);
}

.workspace-demo-button {
    position: fixed;
    right: 26px;
    bottom: 24px;
    z-index: 60;
    padding: 12px 17px;
    border-radius: 8px;
}

body.workspace-open .workspace-demo-button {
    opacity: 0;
    pointer-events: none;
}

/*
 * Moves the whole canvas composition visually toward the
 * bottom-right when workspace mode is active.
 */
#nexusCanvas,
canvas {
    transition:
        transform 650ms cubic-bezier(.2,.8,.2,1),
        filter 450ms ease;
    transform-origin: center;
}

body.workspace-open #nexusCanvas,
body.workspace-open canvas {
    transform:
        translate(
            calc(50vw - 190px),
            calc(50vh - 160px)
        )
        scale(0.34);

    filter: brightness(1.22) saturate(1.15);
}

/* Hide old chat elements in workspace-first mode */
body.workspace-open .chat-dock,
body.workspace-open .restore-chat {
    opacity: 0 !important;
    pointer-events: none !important;
}

@media (max-width: 1000px) {
    .nexus-workspace {
        left: 18px;
        right: 18px;
        top: 80px;
        bottom: 150px;
    }

    .workspace-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .workspace-panel-main {
        grid-row: auto;
    }

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    body.workspace-open #nexusCanvas,
    body.workspace-open canvas {
        transform:
            translate(
                calc(50vw - 105px),
                calc(50vh - 105px)
            )
            scale(0.23);
    }
}

/* =========================================================
   NEXUS OS MODE
   Removes chatbot UI and keeps only voice presence.
   ========================================================= */

.chat-dock,
.restore-chat,
.command-overlay,
.workspace-demo-button {
    display: none !important;
}

.nexus-voice-status {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 45;

    display: flex;
    align-items: center;
    gap: 13px;

    min-width: 310px;
    padding: 11px 17px;

    transform: translateX(-50%);

    border: 1px solid rgba(91, 217, 255, 0.18);
    border-radius: 999px;

    background: rgba(3, 15, 25, 0.68);

    box-shadow:
        0 14px 38px rgba(0, 0, 0, 0.36),
        inset 0 0 0 1px rgba(89, 211, 255, 0.025);

    backdrop-filter: blur(15px);

    transition:
        left 650ms cubic-bezier(.2,.8,.2,1),
        bottom 650ms cubic-bezier(.2,.8,.2,1),
        transform 650ms cubic-bezier(.2,.8,.2,1),
        opacity 300ms ease;
}

.voice-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;

    border-radius: 50%;

    background: #6fe8ff;

    box-shadow:
        0 0 8px #6fe8ff,
        0 0 18px rgba(88, 222, 255, 0.65);

    animation: voiceStatusPulse 2.2s ease-in-out infinite;
}

@keyframes voiceStatusPulse {
    0%,
    100% {
        opacity: 0.55;
        transform: scale(0.85);
    }

    50% {
        opacity: 1;
        transform: scale(1.18);
    }
}

.voice-status-copy {
    display: grid;
    gap: 2px;
    min-width: 170px;
}

.voice-status-copy strong {
    font-size: 10px;
    letter-spacing: 0.22em;
    color: rgba(111, 228, 255, 0.95);
}

.voice-status-copy span {
    font-size: 11px;
    letter-spacing: 0.055em;
    color: rgba(184, 220, 231, 0.76);
}

.voice-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    margin-left: auto;
}

.voice-wave i {
    display: block;
    width: 2px;
    height: 5px;

    border-radius: 3px;

    background: rgba(91, 218, 255, 0.72);

    box-shadow: 0 0 5px rgba(91, 218, 255, 0.38);

    animation: voiceWaveIdle 1.5s ease-in-out infinite;
}

.voice-wave i:nth-child(2) {
    animation-delay: 100ms;
}

.voice-wave i:nth-child(3) {
    animation-delay: 200ms;
}

.voice-wave i:nth-child(4) {
    animation-delay: 300ms;
}

.voice-wave i:nth-child(5) {
    animation-delay: 400ms;
}

.voice-wave i:nth-child(6) {
    animation-delay: 500ms;
}

.voice-wave i:nth-child(7) {
    animation-delay: 600ms;
}

@keyframes voiceWaveIdle {
    0%,
    100% {
        height: 4px;
        opacity: 0.35;
    }

    50% {
        height: 15px;
        opacity: 0.9;
    }
}

/*
 * Workspace mode:
 * Nexus presence moves to the bottom-right.
 */
body.workspace-open .nexus-voice-status {
    left: auto;
    right: 34px;
    bottom: 32px;

    min-width: 250px;

    transform: none;
}

body.workspace-open #nexusCanvas,
body.workspace-open canvas {
    transform:
        translate(
            calc(50vw - 175px),
            calc(50vh - 155px)
        )
        scale(0.30);

    filter:
        brightness(1.28)
        saturate(1.18);
}

/*
 * Make the information workspace occupy the usable screen.
 */
.nexus-workspace {
    right: 290px;
}

body.workspace-open .nexus-workspace {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

@media (max-width: 1000px) {
    .nexus-voice-status {
        min-width: 270px;
        bottom: 18px;
    }

    body.workspace-open .nexus-voice-status {
        right: 16px;
        bottom: 15px;
        min-width: 215px;
    }

    .nexus-workspace {
        right: 18px;
        bottom: 120px;
    }
}

/* =========================================================
   WORKSPACE LAUNCH ANIMATION
   ========================================================= */

.nexus-workspace {
    transform-origin: calc(100% + 120px) calc(100% + 40px);
}

body.workspace-opening .nexus-workspace {
    opacity: 0;
    visibility: visible;
    transform:
        translate(80px, 55px)
        scale(0.78);
}

body.workspace-open .nexus-workspace {
    animation:
        workspaceLaunch 720ms
        cubic-bezier(.16,.84,.22,1)
        both;
}

@keyframes workspaceLaunch {
    0% {
        opacity: 0;
        transform:
            translate(90px, 65px)
            scale(0.74);
        filter: blur(8px);
    }

    55% {
        opacity: 1;
        filter: blur(0);
    }

    100% {
        opacity: 1;
        transform:
            translate(0, 0)
            scale(1);
        filter: blur(0);
    }
}

/* Smaller Nexus assistant in workspace mode */
body.workspace-open #nexusCanvas,
body.workspace-open canvas {
    transform:
        translate(
            calc(50vw - 112px),
            calc(50vh - 105px)
        )
        scale(0.19);

    filter:
        brightness(1.35)
        saturate(1.24);
}

/* Let Nexus settle before workspace appears */
body.workspace-opening #nexusCanvas,
body.workspace-opening canvas {
    transform:
        translate(
            calc(50vw - 112px),
            calc(50vh - 105px)
        )
        scale(0.19);

    filter:
        brightness(1.48)
        saturate(1.32);
}

/* KPI reveal */
.metric-card {
    opacity: 0;
    transform: translateY(14px);
}

body.workspace-open .metric-card {
    animation:
        metricReveal 480ms ease forwards;
}

body.workspace-open .metric-card:nth-child(1) {
    animation-delay: 230ms;
}

body.workspace-open .metric-card:nth-child(2) {
    animation-delay: 310ms;
}

body.workspace-open .metric-card:nth-child(3) {
    animation-delay: 390ms;
}

body.workspace-open .metric-card:nth-child(4) {
    animation-delay: 470ms;
}

@keyframes metricReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Right-side panels reveal after KPIs */
.workspace-grid > .workspace-panel:not(.workspace-panel-main) {
    opacity: 0;
    transform: translateX(18px);
}

body.workspace-open
.workspace-grid > .workspace-panel:not(.workspace-panel-main) {
    animation:
        sidePanelReveal 520ms ease forwards 520ms;
}

@keyframes sidePanelReveal {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Typing cursor for insight */
.workspace-insight.typing::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: 5px;
    vertical-align: -2px;
    background: rgba(93, 224, 255, 0.9);
    animation: insightCursor 760ms steps(1) infinite;
}

@keyframes insightCursor {
    50% {
        opacity: 0;
    }
}

/* Ensure the close control remains clickable above all overlays */
.workspace-header,
.workspace-header-actions,
.workspace-close {
    position: relative;
    z-index: 9999;
    pointer-events: auto !important;
}

.workspace-scanline,
.nexus-workspace::before {
    pointer-events: none !important;
}

/* Definitive closed state */
.nexus-workspace[aria-hidden="true"] {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(24px) scale(0.985) !important;
}

.nexus-workspace[aria-hidden="false"] {
    pointer-events: auto !important;
}

/* =========================================================
   NEXUS BROWSER VOICE
   ========================================================= */

.nexus-voice-status {
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease,
        background 180ms ease;
}

.nexus-voice-status:hover {
    transform: translateY(-2px);
}

.nexus-voice-status:focus-visible {
    outline: 1px solid rgba(99, 220, 255, 0.9);
    outline-offset: 4px;
}

.nexus-voice-status.is-listening {
    border-color: rgba(99, 220, 255, 0.9);
    background: rgba(25, 92, 120, 0.28);
    box-shadow:
        0 0 24px rgba(77, 211, 255, 0.28),
        inset 0 0 18px rgba(77, 211, 255, 0.08);
}

.nexus-voice-status.is-listening .voice-status-dot {
    animation: nexusVoicePulse 700ms ease-in-out infinite;
}

.nexus-voice-status.is-thinking {
    border-color: rgba(156, 124, 255, 0.85);
    box-shadow:
        0 0 22px rgba(156, 124, 255, 0.22);
}

.nexus-voice-status.is-speaking {
    border-color: rgba(99, 255, 178, 0.85);
    box-shadow:
        0 0 22px rgba(99, 255, 178, 0.22);
}

.nexus-voice-status.is-error {
    border-color: rgba(255, 112, 112, 0.85);
}

.nexus-voice-status.is-listening .voice-wave i,
.nexus-voice-status.is-speaking .voice-wave i {
    animation-duration: 520ms;
}

@keyframes nexusVoicePulse {
    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.55;
    }

    50% {
        transform: scale(1.45);
        opacity: 1;
    }
}

/* Hide rotating background thought while voice mode is active */
body:has(.nexus-voice-status.is-listening) #thought,
body:has(.nexus-voice-status.is-thinking) #thought,
body:has(.nexus-voice-status.is-speaking) #thought {
    opacity: 0 !important;
    visibility: hidden !important;
}
