/* HiFleet Skills — demo chat */
.demo-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 70% 50% at 80% 0%, rgba(46, 184, 166, 0.16), transparent 55%),
        radial-gradient(ellipse 50% 40% at 10% 90%, rgba(18, 53, 82, 0.85), transparent 60%),
        linear-gradient(165deg, #06101c 0%, #0b1f36 50%, #061825 100%);
}

.demo-nav .nav-links a.active {
    color: var(--foam);
}

.demo-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 88px var(--content-pad) 28px;
    box-sizing: border-box;
}

.demo-header {
    margin-bottom: 18px;
    animation: rise 0.7s ease-out both;
}

.demo-header h1 {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: clamp(22px, 3.5vw, 30px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.demo-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    max-width: 42em;
}

.demo-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(11, 31, 54, 0.55);
    color: var(--muted);
    font-size: 12px;
}

.demo-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warn);
}

.demo-status.ready .dot { background: var(--signal); }
.demo-status.error .dot { background: #e26d6d; }

.demo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 16px;
}

.demo-chip {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--foam);
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.demo-chip:hover {
    border-color: rgba(46, 184, 166, 0.45);
    background: var(--signal-dim);
}

.demo-chat {
    flex: 1;
    min-height: 360px;
    max-height: calc(100dvh - 280px);
    overflow-y: auto;
    padding: 18px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(6, 16, 28, 0.55);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(143, 163, 181, 0.45) transparent;
}

.demo-chat::-webkit-scrollbar {
    width: 8px;
}

.demo-chat::-webkit-scrollbar-track {
    background: transparent;
    margin: 6px 0;
}

.demo-chat::-webkit-scrollbar-thumb {
    background: rgba(143, 163, 181, 0.35);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.demo-chat::-webkit-scrollbar-thumb:hover {
    background: rgba(46, 184, 166, 0.55);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.demo-chat::-webkit-scrollbar-corner {
    background: transparent;
}

.msg {
    max-width: min(92%, 640px);
    padding: 12px 14px;
    border-radius: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    font-size: 14px;
    animation: rise 0.35s ease-out both;
}

.msg.user {
    align-self: flex-end;
    background: rgba(46, 184, 166, 0.18);
    border: 1px solid rgba(46, 184, 166, 0.35);
    color: #e8fff9;
    border-bottom-right-radius: 4px;
}

.msg.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    color: var(--foam);
    border-bottom-left-radius: 4px;
}

.msg.system {
    align-self: center;
    max-width: 100%;
    text-align: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    padding: 4px 8px;
    font-size: 13px;
}

.msg.error {
    align-self: flex-start;
    background: rgba(226, 109, 109, 0.12);
    border: 1px solid rgba(226, 109, 109, 0.35);
    color: #ffc9c9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg.error .error-text {
    white-space: pre-wrap;
}

.msg.error .error-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.msg.error .error-retry {
    border: 1px solid rgba(226, 109, 109, 0.45);
    background: rgba(226, 109, 109, 0.16);
    color: #ffd6d6;
    border-radius: 999px;
    padding: 6px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.msg.error .error-retry:hover {
    background: rgba(226, 109, 109, 0.28);
}

.msg.error .error-retry:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.msg.typing {
    color: var(--muted);
}

.msg.assistant-wrap {
    align-self: flex-start;
    max-width: min(92%, 640px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: rise 0.35s ease-out both;
}

.think-panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(18, 53, 82, 0.45);
    overflow: hidden;
}

.think-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
}

.think-toggle:hover { color: var(--foam); }

.think-toggle .think-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.think-toggle .think-caret {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    opacity: 0.7;
    transition: transform .2s;
}

.think-panel.open .think-caret {
    transform: rotate(180deg);
}

.think-body {
    display: none;
    max-height: 220px;
    overflow-y: auto;
    padding: 0 12px 12px;
    border-top: 1px solid var(--line);
    color: #b7c7d6;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
    scrollbar-color: rgba(143, 163, 181, 0.45) transparent;
}

.think-panel.open .think-body { display: block; }

.think-body .think-line {
    margin-top: 8px;
    padding-left: 10px;
    border-left: 2px solid rgba(46, 184, 166, 0.35);
}

.think-body .think-line.tool {
    border-left-color: rgba(232, 165, 75, 0.55);
    color: #f0d2a0;
}

.msg.assistant-wrap .msg.assistant {
    max-width: 100%;
}

.msg.assistant.streaming::after {
    content: '|';
    display: inline-block;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
    color: var(--signal);
    font-weight: 700;
}

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

.demo-composer {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.demo-composer textarea {
    flex: 1;
    min-height: 52px;
    max-height: 140px;
    resize: vertical;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(11, 31, 54, 0.7);
    color: var(--foam);
    padding: 14px 16px;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    outline: none;
}

.demo-composer textarea:focus {
    border-color: rgba(46, 184, 166, 0.55);
    box-shadow: 0 0 0 3px rgba(46, 184, 166, 0.12);
}

.demo-composer textarea::placeholder { color: #6f8496; }

.demo-composer .btn {
    min-width: 96px;
    height: 52px;
    border-radius: 14px;
}

.demo-composer .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.demo-footer {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}

.demo-footer button.linkish {
    border: 0;
    background: transparent;
    color: var(--signal);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.demo-footer button.linkish:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .demo-shell { padding-top: 76px; }
    .demo-chat { max-height: calc(100dvh - 320px); min-height: 280px; }
    .demo-composer { flex-direction: column; align-items: stretch; }
    .demo-composer .btn { width: 100%; }
}
