:root {
    --bg-deep: #0a0a12;
    --bg-base: #0e0c18;
    --bg-surface: rgba(20, 16, 34, 0.72);
    --bg-elevated: rgba(28, 22, 46, 0.85);

    --accent: #a78bfa;
    --accent-light: #c4b5fd;
    --accent-dim: rgba(167, 139, 250, 0.14);
    --accent-glow: rgba(167, 139, 250, 0.18);
    --accent-glow-strong: rgba(167, 139, 250, 0.38);

    --text-primary: #ede9fe;
    --text-secondary: #c4b5dd;
    --text-muted: #8a7aa8;

    --border: rgba(167, 139, 250, 0.14);
    --border-strong: rgba(167, 139, 250, 0.32);

    --success: #34d399;
    --danger: #fb4d6d;
    --warning: #fbbf24;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(167, 139, 250, 0.06);
    --shadow-hover: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 30px rgba(167, 139, 250, 0.18);
    --duration: 0.25s;
}

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

body {
    font-family: 'Inter', 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', 'Courier New', monospace;
    background: var(--bg-deep);
    background-image:
        radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, 0.12), transparent 60%),
        radial-gradient(900px 600px at -10% 100%, rgba(167, 139, 250, 0.08), transparent 55%),
        linear-gradient(180deg, #0c0a15 0%, #08070e 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}


* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.35), rgba(139, 92, 246, 0.45));
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(196, 181, 253, 0.55), rgba(167, 139, 250, 0.65));
    background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

::selection {
    background: rgba(167, 139, 250, 0.35);
    color: #fff;
}

input,
select,
textarea,
button {
    font-family: inherit;
}

select {
    color-scheme: dark;
}

input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 28px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    outline: none;
    transition: all var(--duration);
    vertical-align: middle;
}

input[type="checkbox"]:hover {
    border-color: var(--accent-light);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.25);
}

input[type="checkbox"]:checked {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.5), rgba(139, 92, 246, 0.7));
    border-color: var(--accent-light);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 44%;
    width: 4px;
    height: 8px;
    border: solid var(--text-primary);
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -50%) rotate(45deg);
}

input[type="checkbox"]:focus-visible,
select:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 1px;
}

details>summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

details>summary::-webkit-details-marker {
    display: none;
}

details>summary::before {
    content: '';
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--accent-light);
    border-bottom: 2px solid var(--accent-light);
    transform: rotate(-45deg);
    transition: transform var(--duration) ease;
    margin-right: 0.15rem;
}

details[open]>summary::before {
    transform: rotate(45deg) translate(-1px, -1px);
}

.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-mesh::before,
.bg-mesh::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
}

.bg-mesh::before {
    width: 720px;
    height: 720px;
    top: -280px;
    right: -180px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.14) 0%, transparent 62%);
    animation: float 22s ease-in-out infinite;
}

.bg-mesh::after {
    width: 540px;
    height: 540px;
    bottom: -180px;
    left: -140px;
    background: radial-gradient(circle, rgba(196, 181, 253, 0.08) 0%, transparent 62%);
    animation: float 28s ease-in-out infinite reverse;
}

@keyframes float {

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

    33% {
        transform: translate(28px, -18px) scale(1.04);
    }

    66% {
        transform: translate(-18px, 14px) scale(0.97);
    }
}

#loginView {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    padding: 1rem;
}

#loginView.raven-bg {
    background-image: radial-gradient(800px 500px at 50% 40%, #141126 0%, #07060d 100%);
}

.raven-bg-glow {
    position: absolute;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.16), transparent 62%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    pointer-events: none;
    animation: ravenBreathe 4.5s ease-in-out infinite alternate;
}

@keyframes ravenBreathe {
    0% {
        opacity: 0.55;
        transform: translate(-50%, -52%) scale(0.85);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -52%) scale(1.12);
    }
}

.login-card {
    width: 400px;
    max-width: calc(100vw - 2rem);
    background: var(--bg-surface);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 3rem 2.6rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.12);
    animation: cardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    width: 62px;
    height: 62px;
    margin: 0 auto 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    background: rgba(139, 92, 246, 0.08);
    filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.45));
}

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.22em;
    text-shadow: 0 0 18px rgba(196, 181, 253, 0.5);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 2.4rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.8rem;
}

.input-group .icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    pointer-events: none;
    display: flex;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.1rem 1rem 3.2rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.92rem;
    transition: all var(--duration) ease;
    letter-spacing: 0.06em;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 24px rgba(167, 139, 250, 0.18);
}

.input-group input::placeholder {
    color: rgba(196, 181, 253, 0.28);
    letter-spacing: 0.1em;
}

.login-error {
    color: var(--danger);
    font-size: 0.82rem;
    text-align: center;
    letter-spacing: 0.12em;
    margin-bottom: 1.2rem;
    display: none;
    text-shadow: 0 0 10px rgba(251, 77, 109, 0.5);
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--duration) ease;
    letter-spacing: 0.06em;
}

.btn-primary {
    background: var(--accent-dim);
    border-color: var(--accent-light);
    color: var(--text-primary);
    box-shadow: 0 0 24px rgba(167, 139, 250, 0.14);
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.btn-primary:hover {
    background: var(--accent-light);
    color: #0a0a12;
    box-shadow: 0 0 34px rgba(167, 139, 250, 0.42);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    background: var(--accent-dim);
    border-color: var(--accent-light);
    color: var(--text-primary);
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.18);
}

.btn-danger {
    background: rgba(251, 77, 109, 0.08);
    color: var(--danger);
    border-color: rgba(251, 77, 109, 0.3);
}

.btn-danger:hover {
    background: rgba(251, 77, 109, 0.16);
    box-shadow: 0 0 22px rgba(251, 77, 109, 0.2);
}

.btn-success {
    background: var(--accent-dim);
    border-color: var(--accent-light);
    color: var(--text-primary);
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.12);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-success:hover {
    background: var(--accent-light);
    color: #0a0a12;
    box-shadow: 0 0 30px rgba(167, 139, 250, 0.4);
    transform: translateY(-1px);
}

.btn-approve {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.42);
    color: var(--success);
    box-shadow: 0 0 18px rgba(52, 211, 153, 0.12);
    transition: all 0.25s ease;
}

.btn-approve:hover {
    background: rgba(52, 211, 153, 0.2);
    border-color: var(--success);
    color: #eafff6;
    box-shadow: 0 0 26px rgba(52, 211, 153, 0.34);
    transform: translateY(-1px);
}

.btn-reject {
    background: rgba(251, 77, 109, 0.1);
    border-color: rgba(251, 77, 109, 0.4);
    color: var(--danger);
    box-shadow: 0 0 18px rgba(251, 77, 109, 0.1);
    transition: all 0.25s ease;
}

.btn-reject:hover {
    background: rgba(251, 77, 109, 0.2);
    border-color: var(--danger);
    color: #ffe8ee;
    box-shadow: 0 0 26px rgba(251, 77, 109, 0.34);
    transform: translateY(-1px);
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

.btn.loading .spinner {
    display: block;
}

.btn.loading span {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#dashboardView {
    display: none;
    position: relative;
    z-index: 1;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(12, 10, 20, 0.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 80;
}

.topbar-brand {
    font-weight: 700;
    letter-spacing: 0.18em;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-shadow: 0 0 14px rgba(167, 139, 250, 0.45);
}

.sidebar-toggle {
    display: none;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--accent-light);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.sidebar {
    width: 256px;
    flex-shrink: 0;
    background: rgba(13, 11, 22, 0.86);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 90;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.4rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    background: rgba(139, 92, 246, 0.08);
    filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.4));
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.4);
}

.brand-tag {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 1.1rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sidebar-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    padding: 0.9rem 0.85rem 0.4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.86rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-align: left;
    transition: all var(--duration) ease;
    position: relative;
}

.nav-item .nav-ico {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--accent-dim);
}

.nav-item.active {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(167, 139, 250, 0.16), rgba(167, 139, 250, 0.06));
    border-color: var(--border-strong);
    box-shadow: inset 0 0 24px rgba(167, 139, 250, 0.08);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 22%;
    bottom: 22%;
    width: 3px;
    border-radius: 2px;
    background: var(--accent-light);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.7);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(52, 211, 153, 0.08);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.22);
    border-radius: 999px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-footer .status-pill {
    font-size: 0.6rem;
    padding: 0.28rem 0.6rem;
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
    }
}

.btn-logout {
    padding: 0.4rem 0.85rem;
    font-size: 0.72rem;
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(251, 77, 109, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(251, 77, 109, 0.1);
    box-shadow: 0 0 18px rgba(251, 77, 109, 0.16);
}

.sidebar-overlay {
    display: none;
}

.content {
    flex: 1;
    min-width: 0;
    padding: 2.4rem 2.6rem 3rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 1.3rem;
    margin-bottom: 1.8rem;
    border-bottom: 1px solid var(--border);
}

.content-header .section-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-shadow: 0 0 16px rgba(167, 139, 250, 0.35);
}

.content-header .section-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-top: 0.35rem;
}

.panels {
    width: 100%;
}

.panel {
    display: none;
    animation: fadePanel 0.35s ease;
}

.panel.active {
    display: block;
}

@keyframes fadePanel {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.card {
    background: #141022;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.2rem 2.4rem;
    transition: border-color var(--duration), box-shadow var(--duration);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}

.panel .card {
    width: 100%;
    margin: 0;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(196, 181, 253, 0.5), transparent);
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-hover);
}

.card-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 1.1rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--accent-dim);
    transition: all var(--duration) ease;
}

.card:hover .card-icon {
    border-color: var(--accent-light);
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.3);
}

.card-icon.blue {
    background: rgba(139, 92, 246, 0.1);
}

.card-icon.amber {
    background: rgba(251, 191, 36, 0.08);
}

.card-icon.red {
    background: rgba(251, 77, 109, 0.08);
}

.card-icon.purple {
    background: rgba(167, 139, 250, 0.1);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    letter-spacing: 0.05em;
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}

.card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.6rem;
    letter-spacing: 0.04em;
}

.card-body {
    flex: 1;
}

.card form {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-section {
    margin-bottom: 2rem;
}

.card-section-title {
    font-size: 0.82rem;
    color: var(--accent-light);
    letter-spacing: 0.06em;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.4rem 2rem;
}

.form-grid>.form-group,
.form-grid>.section-label,
.form-grid>.section-divider {
    min-width: 0;
}

.form-grid .form-group.full {
    grid-column: 1 / -1;
}

.form-checks-row {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 2.4rem;
    padding: 0.85rem 1.1rem;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.form-checks-row .form-group {
    margin: 0;
}

.form-checks-row .form-check {
    margin: 0;
    white-space: nowrap;
}



.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
    letter-spacing: 0.04em;
}

.field-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.model-picker {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    min-width: 0;
}

.model-picker .model-select {
    flex: 1 1 auto;
    min-width: 0;
}

.model-picker .model-select select.form-input {
    height: 100%;
    text-overflow: ellipsis;
}

.model-picker .model-select::after {
    display: none;
}

.ms {
    position: relative;
    display: block;
    min-width: 0;
}

.model-picker .ms {
    flex: 1 1 auto;
}

.ms-native {
    position: absolute !important;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    padding: 0;
    border: 0;
}

.select-wrapper:has(.ms)::after,
.pager-size-wrapper:has(.ms)::after {
    display: none;
}

.ms-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    height: 100%;
    min-height: 2.5rem;
    padding: 0.7rem 0.9rem;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-align: left;
    transition: border-color var(--duration), box-shadow var(--duration), background var(--duration);
}

.ms-trigger:hover {
    border-color: var(--border-strong);
}

.ms.open .ms-trigger,
.ms-trigger:focus-visible {
    outline: none;
    border-color: var(--accent-light);
    background: rgba(0, 0, 0, 0.45);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(167, 139, 250, 0.12);
}

.ms-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-label.is-placeholder {
    color: rgba(196, 181, 253, 0.4);
}

.ms-caret {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c4b5fd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform var(--duration);
}

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

.ms-menu {
    position: fixed;
    z-index: 20000;
    min-width: 120px;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.3rem;
    background: #141126;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(167, 139, 250, 0.1);
    animation: msMenuIn 0.12s ease both;
}

@keyframes msMenuIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

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

.ms-option {
    display: block;
    width: 100%;
    padding: 0.5rem 0.7rem;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--duration), color var(--duration);
}

.ms-option:hover {
    background: rgba(167, 139, 250, 0.16);
    color: var(--text-primary);
}

.ms-option.is-selected {
    color: var(--accent-light);
    background: rgba(167, 139, 250, 0.12);
    font-weight: 600;
}

.ms-option.is-selected::after {
    content: '✓';
    float: right;
    margin-left: 0.6rem;
}

.ms-option.ms-custom {
    border-top: 1px solid var(--border);
    margin-top: 0.3rem;
    padding-top: 0.55rem;
    color: var(--accent-light);
}

.ms-empty {
    padding: 0.6rem 0.7rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.ms-compact .ms-trigger {
    min-height: 0;
    padding: 0.24rem 1.4rem 0.24rem 0.45rem;
    font-size: 0.7rem;
    border-color: var(--border-strong);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-secondary);
}

.ms-compact .ms-caret {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
}

.ms-compact.open .ms-caret {
    transform: translateY(-50%) rotate(180deg);
}

.ms-compact .ms-menu {
    font-size: 0.74rem;
}

.ms-compact .ms-option {
    padding: 0.35rem 0.55rem;
    font-size: 0.74rem;
}

.model-fetch-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0 1rem;
    font-size: 0.76rem;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--accent-light);
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.18), rgba(167, 139, 250, 0.08));
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--duration);
}

.model-fetch-btn::before {
    content: '⟳';
    font-size: 0.85rem;
    line-height: 1;
}

.model-fetch-btn:hover {
    color: #fff;
    border-color: var(--accent-light);
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.34), rgba(167, 139, 250, 0.16));
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.3);
}

.model-fetch-btn:disabled {
    opacity: 0.55;
    cursor: default;
    box-shadow: none;
}

.model-fetch-btn:disabled::before {
    content: '';
    width: 0.75rem;
    height: 0.75rem;
    border: 2px solid rgba(196, 181, 253, 0.4);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: model-btn-spin 0.7s linear infinite;
}

@keyframes model-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.ms-custom-input {
    flex: 1 1 auto;
    min-width: 0;
}

.ms-custom-input {
    width: 100%;
    min-height: 2.5rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.84rem;
    letter-spacing: 0.02em;
    transition: border-color var(--duration), box-shadow var(--duration), background var(--duration);
    caret-color: var(--accent-light);
}

.form-input:hover,
.form-textarea:hover {
    border-color: var(--border-strong);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-light);
    background: rgba(0, 0, 0, 0.45);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(167, 139, 250, 0.12);
}

.form-input::placeholder {
    color: rgba(196, 181, 253, 0.25);
}

.form-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0e0c18 inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: var(--accent-light);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.55;
}

.select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 100%;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    pointer-events: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c4b5fd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: opacity var(--duration), filter var(--duration);
}

.select-wrapper:hover::after {
    opacity: 1;
    filter: drop-shadow(0 0 3px rgba(196, 181, 253, 0.6));
}

.select-wrapper:has(select:disabled)::after {
    opacity: 0.35;
}

select.form-input {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.2rem;
    background-image: none;
    transition: border-color var(--duration), box-shadow var(--duration), background-color var(--duration);
}

select.form-input option {
    background: #141126;
    color: var(--text-primary);
}

select option,
select optgroup {
    background-color: #141126;
    color: var(--text-primary);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.btn-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.install-detail-box {
    margin-top: 0.6rem;
    padding: 0.75rem 0.9rem;
    min-height: 0;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow: auto;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.install-detail-box:empty {
    display: none;
}

.panel-note {
    margin: 0.7rem 0 0;
    font-size: 0.7rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.panel-note code {
    color: var(--accent-light);
    font-size: 0.68rem;
}

.section-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
    margin: 0.4rem 0;
}

.section-label {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    color: var(--accent-light);
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: -0.4rem;
}

.panel-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.6rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.danger-zone-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--danger);
    font-weight: 600;
    margin-bottom: 0.8rem;
    text-shadow: 0 0 10px rgba(251, 77, 109, 0.4);
}

.data-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0);
    transition: border-color var(--duration) ease,
        background-color var(--duration) ease,
        box-shadow var(--duration) ease;
}

.list-row>.row-main {
    flex: 1 1 0;
    min-width: 0;
}

.list-row>.row-check {
    flex: 0 0 auto;
}

.list-row>.row-actions,
.list-row>.tag {
    flex: 0 0 auto;
    margin-left: auto;
}

.list-row:hover {
    border-color: var(--border-strong);
    background: var(--accent-dim);
    box-shadow: 0 0 22px rgba(167, 139, 250, 0.1);
}

.pref-session-row.pref-active {
    border-color: var(--accent-light);
    background: rgba(167, 139, 250, 0.16);
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.25);
}

.list-row.picker-active {
    border-color: var(--accent-light);
    background: rgba(167, 139, 250, 0.16);
}

.list-row .row-check-right {
    margin-left: auto;
}

.session-list-row {
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    cursor: pointer;
}

.session-list-row:has(.session-checkbox:checked),
.session-list-row.is-selected {
    border-color: var(--accent-light);
    background: rgba(167, 139, 250, 0.14);
}

.session-list-row>.row-check {
    padding-top: 0.1rem;
    cursor: pointer;
}

.session-list-row>.row-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.session-primary {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.session-list-row .row-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.session-list-row .live-topic-chip {
    max-width: 10rem;
}

.session-prefs-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.session-prefs-header .tag {
    margin-right: 0;
}

.pref-row {
    display: flex;
    padding: 0.6rem 0.75rem;
    align-items: center;
    cursor: pointer;
}

.pref-row .row-main {
    min-width: 0;
}

.pref-row>.tag {
    margin-left: auto;
    white-space: nowrap;
}

.pref-row .form-check {
    margin: 0;
    align-items: center;
    cursor: pointer;
}

.pref-row .form-check input[type="checkbox"] {
    pointer-events: none;
}

.pref-row .server-id {
    color: var(--text-primary);
    font-weight: 600;
}

.pref-row .pref-desc {
    padding-left: 2.2rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.row-check {
    display: flex;
    align-items: center;
}

.row-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.row-title {
    font-size: 0.86rem;
    color: var(--text-primary);
    word-break: break-all;
}

.row-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memory-row-sub {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.memory-row-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memory-row-time {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    opacity: 0.85;
}

@media (max-width: 520px) {
    .memory-row-sub {
        flex-wrap: wrap;
        gap: 0.1rem 0.6rem;
    }

    .memory-row-text,
    .memory-row-time {
        flex: 1 1 100%;
    }
}

.row-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.row-actions .btn {
    width: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.72rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.32rem 0.7rem;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    border: 1px solid;
    border-radius: 999px;
    margin-right: 0.5rem;
    letter-spacing: 0;
    text-indent: 0;
    text-transform: none;
    vertical-align: middle;
    font-family: inherit;
}

.tag-group {
    background: rgba(167, 139, 250, 0.12);
    color: #d8caff;
    border-color: rgba(196, 181, 253, 0.38);
    box-shadow: inset 0 0 12px rgba(167, 139, 250, 0.08);
}

.tag-user {
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7;
    border-color: rgba(110, 231, 183, 0.35);
    box-shadow: inset 0 0 12px rgba(52, 211, 153, 0.08);
}

.list-row.reminder-row.is-loop {
    border-left: 2px solid rgba(96, 165, 250, 0.55);
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.06), transparent 42%);
}

.reminder-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.reminder-time {
    font-size: 0.8rem;
    color: var(--text-secondary, var(--text-muted));
    letter-spacing: 0.2px;
}

.loop-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(96, 165, 250, 0.4);
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.1);
    color: #bfdbfe;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: inset 0 0 12px rgba(96, 165, 250, 0.08);
}

.loop-badge .loop-icon {
    font-size: 0.72rem;
    animation: loop-spin 3.6s linear infinite;
}

.loop-badge .loop-interval {
    color: #93c5fd;
}

.loop-badge .loop-count {
    padding-left: 0.4rem;
    border-left: 1px solid rgba(147, 197, 253, 0.3);
    color: #dbeafe;
    font-variant-numeric: tabular-nums;
}

.loop-badge.is-infinite {
    border-color: rgba(167, 139, 250, 0.5);
    background: rgba(167, 139, 250, 0.12);
    color: #ddd6fe;
}

.loop-badge.is-infinite .loop-interval {
    color: #c4b5fd;
}

.loop-badge.is-infinite .loop-count {
    border-left-color: rgba(196, 181, 253, 0.35);
    color: #ede9fe;
}

@keyframes loop-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loop-badge .loop-icon {
        animation: none;
    }
}

.list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.list-toolbar .btn,
.list-toolbar .refresh-sessions-btn {
    width: auto;
    flex: 0 0 auto;
}

.empty-state {
    text-align: center;
    padding: 2.4rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.18);
}

.data-list-wrapper {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.18);
}

.refresh-sessions-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 0.32rem 0.75rem;
    cursor: pointer;
    font-size: 0.68rem;
    font-family: inherit;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all var(--duration);
}

.refresh-sessions-btn:hover {
    color: var(--accent-light);
    border-color: var(--accent-light);
    box-shadow: 0 0 14px rgba(167, 139, 250, 0.22);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.7rem;
    font-size: 0.74rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.pager:empty {
    display: none;
}

[id$="Box"]:empty,
[id$="DetailBox"]:empty,
[id$="ProbeBox"]:empty,
#promptPreviewBox:empty,
#mcpPathStatus:empty {
    display: none;
}

.pager-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 0.28rem 0.65rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    transition: all var(--duration);
    min-width: 30px;
}

.pager-btn:hover:not(:disabled) {
    border-color: var(--accent-light);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.22);
}

.pager-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pager-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent-light);
    color: var(--text-primary);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}

.pager-size-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.pager-size-wrapper::after {
    content: '';
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    pointer-events: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23c4b5fd' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: opacity var(--duration);
}

.pager-size-wrapper:hover::after {
    opacity: 1;
    filter: drop-shadow(0 0 2px rgba(196, 181, 253, 0.5));
}

.pager-size {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 0.24rem 1.4rem 0.24rem 0.45rem;
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
}

.toast-container {
    position: fixed;
    bottom: 1.6rem;
    right: 1.6rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    pointer-events: none;
}

.toast-item {
    padding: 0.8rem 1.3rem;
    background: rgba(16, 13, 26, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.84rem;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 24px rgba(139, 92, 246, 0.12);
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.toast-item.leaving {
    animation: toastOut 0.3s ease forwards;
}

.toast-item.success {
    border-left: 3px solid var(--success);
}

.toast-item.error {
    border-left: 3px solid var(--danger);
}

.toast-item.warning {
    border-left: 3px solid var(--warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

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

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

.raven-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 4, 10, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.raven-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.raven-modal-card {
    background: rgba(16, 13, 26, 0.96);
    border: 1px solid rgba(251, 77, 109, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 40px rgba(251, 77, 109, 0.14);
    padding: 2.4rem 2rem;
    width: 92%;
    max-width: 440px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    transform: translateY(18px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}

.raven-modal-card.modal-wide {
    max-width: 620px;
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 40px rgba(167, 139, 250, 0.14);
}

.raven-modal-overlay.active .raven-modal-card {
    transform: translateY(0) scale(1);
}

.modal-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 1px solid var(--danger);
    border-radius: 14px;
    background: rgba(251, 77, 109, 0.1);
    color: var(--danger);
    box-shadow: 0 0 22px rgba(251, 77, 109, 0.28);
}

.modal-title {
    color: var(--text-primary);
    letter-spacing: 0.14em;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.4);
    text-transform: uppercase;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.65;
    margin-bottom: 1.8rem;
    letter-spacing: 0.03em;
}

.modal-actions {
    display: flex;
    gap: 0.9rem;
    justify-content: center;
}

.modal-actions .btn {
    flex: 1;
    padding: 0.8rem 1rem;
    font-size: 0.78rem;
}

.footer {
    text-align: center;
    padding: 2.6rem 1rem 1.6rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 85;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .content {
        padding: 4.8rem 1.25rem 2rem;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel .card {
        padding: 1.6rem 1.4rem;
    }
}

@media (max-width: 600px) {
    .content {
        padding: 4.8rem 1rem 1.5rem;
    }

    .model-picker {
        flex-wrap: wrap;
    }

    .model-picker .ms {
        flex: 1 1 100%;
    }

    .model-fetch-btn {
        flex: 1 1 100%;
        padding: 0.6rem 1rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .list-row {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .session-list-row {
        flex-wrap: nowrap;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.7rem 0.75rem;
    }

    .list-row>.row-main {
        flex: 1 1 0;
        min-width: 0;
    }

    .row-actions {
        justify-content: flex-start;
        flex-wrap: nowrap;
        align-items: stretch;
        width: 100%;
    }

    .row-actions .btn {
        flex: 1 1 auto;
        white-space: nowrap;
    }

    .btn-row {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-row .btn {
        width: 100%;
    }

    .panel-actions {
        flex-direction: column;
    }

    .panel .card .btn-success,
    .panel .card .btn-danger {
        width: 100%;
    }

    .login-card {
        padding: 2.4rem 1.8rem;
    }
}

.live-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1.05rem;
    align-items: stretch;
    height: clamp(540px, calc(100vh - 210px), 920px);
}

.live-sessions {
    position: relative;
    background: var(--bg-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    transition: border-color var(--duration) ease, box-shadow var(--duration) ease;
}

.live-sessions::before,
.live-detail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(196, 181, 253, 0.5), transparent);
    pointer-events: none;
}

.live-sessions:hover,
.live-detail:hover {
    border-color: var(--border-strong);
}

.live-sessions-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex: 0 0 auto;
    min-width: 0;
}

.live-head-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    flex: 1 1 auto;
    overflow: visible;
}

.live-head-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 0 1 auto;
}

.live-head-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}

.live-head-actions .refresh-sessions-btn {
    padding: 0.28rem 0.62rem;
    font-size: 0.64rem;
    white-space: nowrap;
}

.live-head-actions .refresh-sessions-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.live-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 0.1rem 0.5rem;
    font-size: 0.68rem;
    border-radius: 999px;
    background: var(--accent-dim);
    border: 1px solid var(--border-strong);
    color: var(--accent-light);
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
}

.live-pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 0 rgba(52, 211, 153, 0);
    transition: background var(--duration), box-shadow var(--duration);
    flex: 0 0 auto;
}

.live-pulse.online {
    background: var(--success);
    animation: livePulse 1.8s infinite;
}

.live-pulse.offline {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(251, 77, 109, 0.18);
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

.live-filter {
    position: relative;
    flex: 0 0 auto;
}

.live-filter::before {
    content: '';
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
    pointer-events: none;
    opacity: 0.6;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.live-filter-input {
    width: 100%;
    font-size: 0.78rem;
    padding: 0.5rem 0.7rem 0.5rem 1.95rem;
}

.live-session-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.1rem 0.35rem 0.2rem 0.1rem;
    flex: 1 1 auto;
    min-height: 0;
    scroll-behavior: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.live-session-list::-webkit-scrollbar,
.live-tab-pane::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.live-session-list::-webkit-scrollbar-track,
.live-tab-pane::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

.live-session-list::-webkit-scrollbar-thumb,
.live-tab-pane::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
    transition: background var(--duration);
}

.live-session-list::-webkit-scrollbar-thumb:hover,
.live-tab-pane::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    background-clip: padding-box;
}

.live-session-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.22);
    padding: 0.65rem 0.75rem 0.65rem 0.85rem;
    cursor: pointer;
    transition: background var(--duration) ease, border-color var(--duration) ease,
        box-shadow var(--duration) ease, transform var(--duration) ease,
        opacity var(--duration) ease;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow: hidden;
    outline: none;
    flex: 0 0 auto;
}

.live-session-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background var(--duration) ease, opacity var(--duration) ease;
}

.live-session-card:focus-visible {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.35);
}

.live-session-card.is-new {
    animation: liveCardIn 0.24s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes liveCardIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.live-session-card:hover {
    border-color: var(--border-strong);
    background: var(--accent-dim);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.live-session-card:active {
    transform: translateY(0) scale(0.995);
}

.live-session-card.active {
    border-color: var(--accent-light);
    background: rgba(167, 139, 250, 0.16);
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.22);
    transform: translateX(2px);
}

.live-session-card.active::before {
    background: linear-gradient(180deg, var(--accent-light), var(--accent));
}

.live-session-card.is-busy::before {
    background: linear-gradient(180deg, var(--accent-light), var(--accent));
    animation: liveBarPulse 1.7s ease-in-out infinite;
}

.live-session-card.is-error::before {
    background: var(--danger);
}

@keyframes liveBarPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

.live-session-card.is-idle {
    background: rgba(0, 0, 0, 0.16);
}

.live-session-card.is-idle .live-card-detail,
.live-session-card.is-idle .live-card-foot {
    color: var(--text-muted);
}

.live-session-card.is-known {
    background: rgba(0, 0, 0, 0.1);
    border-style: dashed;
    border-color: var(--border);
}

.live-session-card.is-known .live-card-pk {
    color: var(--text-secondary);
}

.live-session-card.is-known .live-card-detail {
    color: var(--text-muted);
}

.live-session-card.is-known .live-card-foot {
    opacity: 0.7;
}

.live-session-card.is-known .live-status-badge {
    opacity: 0.9;
}

.live-session-card.is-idle:hover,
.live-session-card.is-known:hover {
    background: var(--accent-dim);
    border-style: solid;
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.live-session-card.is-idle:hover .live-card-foot,
.live-session-card.is-known:hover .live-card-foot {
    opacity: 1;
}

.live-session-card.active,
.live-session-card.active.is-known,
.live-session-card.active.is-idle,
.live-session-card.active:hover {
    opacity: 1;
    background: rgba(167, 139, 250, 0.16);
    border-style: solid;
    border-color: var(--accent-light);
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.22);
    transform: translateX(2px);
}

.live-session-card.active .live-card-pk {
    color: #fff;
}

.live-session-card.active .live-card-detail,
.live-session-card.active .live-card-foot {
    color: var(--text-secondary);
    opacity: 1;
}

.live-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.live-card-id {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
}

.live-card-top .live-status-badge {
    flex: 0 0 auto;
}

.live-card-pk {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--text-primary);
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-card-detail {
    font-size: 0.72rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-card-preview {
    font-size: 0.68rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-card-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.5rem;
    font-size: 0.64rem;
    color: var(--text-muted);
    min-width: 0;
}

.live-card-foot>span {
    white-space: nowrap;
}

.live-card-dur {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.live-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    transition: color var(--duration), border-color var(--duration), background var(--duration), transform var(--duration);
}

.live-back-btn:hover {
    color: var(--accent-light);
    border-color: var(--accent-light);
    background: var(--accent-dim);
}

.live-back-btn:active {
    transform: scale(0.94);
}

.live-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    font-size: 0.66rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    white-space: nowrap;
    flex: 0 0 auto;
    transition: color var(--duration), border-color var(--duration), background var(--duration);
}

.live-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.9;
    flex: 0 0 auto;
}

.live-status-badge.st-thinking,
.live-status-badge.st-queued {
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.1);
}

.live-status-badge.st-thinking::before,
.live-status-badge.st-queued::before {
    animation: liveBarPulse 1.2s ease-in-out infinite;
}

.live-status-badge.st-tool {
    color: var(--accent-light);
    border-color: var(--border-strong);
    background: var(--accent-dim);
}

.live-status-badge.st-replying {
    color: #6ee7b7;
    border-color: rgba(110, 231, 183, 0.4);
    background: rgba(52, 211, 153, 0.1);
}

.live-status-badge.st-replying::before {
    animation: liveBarPulse 1.2s ease-in-out infinite;
}

.live-status-badge.st-done,
.live-status-badge.st-idle {
    color: var(--text-muted);
}

.live-status-badge.st-error {
    color: #fda4af;
    border-color: rgba(251, 77, 109, 0.45);
    background: rgba(251, 77, 109, 0.12);
}

.live-status-badge.st-interrupted {
    color: #fca5a5;
    border-color: rgba(251, 113, 133, 0.4);
    background: rgba(251, 113, 133, 0.1);
}

.live-detail {
    position: relative;
    background: var(--bg-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.2rem 1.35rem;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color var(--duration) ease, box-shadow var(--duration) ease;
}

.live-detail.is-live {
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: var(--shadow-card), 0 0 26px rgba(167, 139, 250, 0.16);
}

.live-detail-empty {
    margin: auto;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    padding: 2rem 1rem;
    animation: liveFadeIn 0.3s ease both;
}

@keyframes liveFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.live-empty-icon {
    font-size: 2.4rem;
    opacity: 0.75;
    filter: drop-shadow(0 0 14px rgba(167, 139, 250, 0.35));
}

.live-empty-title {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.live-empty-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.live-detail-inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.8rem;
    animation: liveFadeIn 0.26s ease both;
}

.live-secondary {
    display: flex;
    flex-direction: column;
    gap: inherit;
    flex: 0 0 auto;
    min-height: 0;
}

.live-secondary-toggle {
    display: none;
    align-items: center;
}

.live-focus-toggle {
    width: auto;
    padding: 0.32rem 0.6rem;
    font-size: 0.72rem;
    line-height: 1.2;
}

.live-focus-toggle[aria-pressed="true"],
.live-secondary-toggle[aria-expanded="true"] {
    color: var(--accent-light);
    border-color: var(--accent-light);
    background: var(--accent-dim);
}

.live-detail.is-focus {
    position: fixed;
    inset: 0;
    z-index: 500;
    height: auto;
    max-height: none;
    padding: 0.85rem clamp(0.75rem, 2.5vw, 1.6rem);
    border-radius: 0;
    background: rgba(12, 10, 20, 0.985);
    box-shadow: none;
}

body.live-focus-lock {
    overflow: hidden;
}

.live-detail.is-focus .live-secondary,
.live-detail.is-focus .live-secondary-toggle {
    display: none;
}

.live-detail.is-focus .live-pane-wrap {
    min-height: 0;
}

.live-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex: 0 0 auto;
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

.live-detail-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
    row-gap: 0.4rem;
}

.live-detail-title .mono {
    font-size: 0.92rem;
    color: var(--text-primary);
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-detail-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 0 0 auto;
}

.live-mini-btn {
    width: auto;
    padding: 0.36rem 0.9rem;
    font-size: 0.72rem;
}

.live-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem 1.1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    flex: 0 0 auto;
    line-height: 1.5;
}

.live-meta>span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-meta b {
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.live-ops {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    flex: 0 0 auto;
}

.live-ops-label {
    font-size: 0.68rem;
    color: var(--accent-light);
    letter-spacing: 0.08em;
    margin-right: 0.2rem;
    flex: 0 0 auto;
}

.live-op-btn {
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 0.34rem 0.78rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.7rem;
    transition: color var(--duration), border-color var(--duration),
        box-shadow var(--duration), background var(--duration), transform var(--duration);
}

.live-op-btn:hover {
    color: var(--accent-light);
    border-color: var(--accent-light);
    background: var(--accent-dim);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.2);
    transform: translateY(-1px);
}

.live-op-btn:active {
    transform: translateY(0) scale(0.98);
}

.live-op-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.live-op-btn.live-op-danger:hover {
    color: #fda4af;
    border-color: var(--danger);
    background: rgba(251, 77, 109, 0.1);
    box-shadow: 0 0 12px rgba(251, 77, 109, 0.25);
}

.live-topics {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 0 0 auto;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.live-topics-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    row-gap: 0.4rem;
}

.live-topics-actions {
    display: flex;
    gap: 0.4rem;
    flex: 0 0 auto;
}

.live-topic-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: clamp(96px, 22vh, 168px);
    overflow-y: auto;
    padding: 0.15em 0.15rem 0 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.live-topic-list::-webkit-scrollbar {
    width: 6px;
}

.live-topic-list::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.live-topic-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.55rem 0.38rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: border-color var(--duration) ease,
        background var(--duration) ease,
        box-shadow var(--duration) ease,
        transform 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
    animation: liveTopicIn 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}

.live-topic-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background var(--duration) ease;
}

.live-topic-row:hover {
    border-color: var(--border-strong);
    background: var(--accent-dim);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.live-topic-row.is-active {
    border-color: var(--accent-light);
    background: rgba(167, 139, 250, 0.16);
    box-shadow: 0 0 14px rgba(167, 139, 250, 0.18);
    transform: translateX(2px);
}

.live-topic-row.is-active::before {
    background: linear-gradient(180deg, var(--accent-light), var(--accent));
}

@keyframes liveTopicIn {
    from {
        opacity: 0;
        translate: 0 6px;
    }

    to {
        opacity: 1;
        translate: 0 0;
    }
}

.live-topic-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.live-topic-row:focus-visible {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.35);
}

.live-topic-name {
    font-size: 0.74rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--duration) ease;
}

.live-topic-row.is-active .live-topic-name {
    color: var(--accent-light);
    font-weight: 600;
}

.live-topic-count {
    font-size: 0.64rem;
    color: var(--text-muted);
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.18);
    transition: color var(--duration) ease, border-color var(--duration) ease;
}

.live-topic-row.is-active .live-topic-count {
    color: var(--accent-light);
    border-color: rgba(167, 139, 250, 0.4);
}

.live-topic-tag {
    font-size: 0.6rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.live-topic-row-ops {
    display: flex;
    gap: 0.25rem;
    flex: 0 0 auto;
    opacity: 0;
    transform: translateX(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.live-topic-row:hover .live-topic-row-ops,
.live-topic-row:focus-within .live-topic-row-ops,
.live-topic-row.is-active .live-topic-row-ops {
    opacity: 1;
    transform: translateX(0);
}

.live-topic-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.68rem;
    line-height: 1;
    padding: 0.24rem 0.4rem;
    transition: color var(--duration) ease, border-color var(--duration) ease,
        background var(--duration) ease, transform var(--duration) ease;
}

.live-topic-btn:hover {
    color: var(--accent-light);
    border-color: var(--accent-light);
    background: var(--accent-dim);
    transform: translateY(-1px);
}

.live-topic-btn:active {
    transform: translateY(0) scale(0.96);
}

.live-topic-btn.danger:hover {
    color: #fda4af;
    border-color: var(--danger);
    background: rgba(251, 77, 109, 0.12);
}

.live-topic-empty {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.55rem;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    animation: liveFadeIn 0.28s ease both;
}

.live-topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.62rem;
    line-height: 1.4;
    padding: 0.06rem 0.45rem;
    border-radius: 999px;
    color: var(--accent-light);
    border: 1px solid rgba(167, 139, 250, 0.5);
    background: rgba(167, 139, 250, 0.14);
    white-space: nowrap;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.live-card-topic-row,
.live-card-subagent-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: -0.15rem;
}

.tag-subagent {
    background: rgba(96, 165, 250, 0.14);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow: inset 0 0 12px rgba(96, 165, 250, 0.1);
}

.live-subagent-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.62rem;
    line-height: 1.4;
    padding: 0.06rem 0.45rem;
    border-radius: 999px;
    color: #93c5fd;
    border: 1px dashed rgba(96, 165, 250, 0.6);
    background: rgba(96, 165, 250, 0.12);
    white-space: nowrap;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.live-session-card.is-subagent {
    border-left: 2px solid rgba(96, 165, 250, 0.65);
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.07), transparent 46%);
}

.live-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    flex: 0 0 auto;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.live-tabs::-webkit-scrollbar {
    display: none;
}

.live-tab {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.76rem;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: color var(--duration);
}

.live-tab::after {
    content: '';
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent-light);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.live-tab:hover {
    color: var(--text-secondary);
}

.live-tab.active {
    color: var(--accent-light);
}

.live-tab.active::after {
    transform: scaleX(1);
}

.live-pane-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 220px;
}

.live-tab-pane {
    display: none;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.15rem 0.3rem 0.2rem 0;
    overscroll-behavior: contain;
}

.live-tab-pane.active {
    display: flex;
    flex-direction: column;
    animation: livePaneIn 0.26s ease both;
}

.live-tab-pane.active>.live-timeline,
.live-tab-pane.active>.live-hist-list {
    flex: 0 0 auto;
}

.live-empty-fill {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.55rem;
    padding: 1.75rem 1.25rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: radial-gradient(120% 120% at 50% 0%, rgba(167, 139, 250, 0.08), rgba(0, 0, 0, 0.18) 70%);
    color: var(--text-muted);
    animation: liveFillIn 0.3s ease both;
}

.live-empty-fill .live-empty-icon {
    font-size: 2.2rem;
}

.live-empty-fill .live-empty-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.live-empty-fill .live-empty-sub {
    font-size: 0.75rem;
    line-height: 1.65;
    max-width: 34ch;
}

.live-empty-fill .live-empty-hint {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.live-empty-chip {
    font-size: 0.68rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-secondary);
}

.live-jump-btn {
    position: absolute;
    left: 50%;
    bottom: 0.75rem;
    transform: translateX(-50%);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.34rem 0.85rem;
    font-family: inherit;
    font-size: 0.7rem;
    color: var(--text-primary);
    background: rgba(28, 22, 46, 0.94);
    border: 1px solid var(--accent-light);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 16px rgba(167, 139, 250, 0.3);
    animation: liveJumpIn 0.24s ease both;
    transition: transform var(--duration), box-shadow var(--duration), background var(--duration);
}

.live-jump-btn:hover {
    background: var(--accent-dim);
    transform: translateX(-50%) translateY(-2px);
}

@keyframes liveJumpIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes livePaneIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes liveFillIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.live-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.live-ev {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.55rem 0.75rem 0.55rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    animation: liveEvIn 0.22s ease both;
    overflow: hidden;
    transition: border-color var(--duration) ease, background var(--duration) ease;
    flex: 0 0 auto;
}

.live-ev::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--border-strong);
    transition: background var(--duration) ease;
}

.live-ev:hover {
    border-color: var(--border-strong);
    background: rgba(0, 0, 0, 0.28);
}

@keyframes liveEvIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.live-ev-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    min-width: 0;
}

.live-ev-icon {
    flex: 0 0 auto;
    font-size: 0.72rem;
    line-height: 1;
    opacity: 0.9;
}

.live-ev-callid {
    flex: 0 0 auto;
    font-family: 'Courier New', monospace;
    font-size: 0.64rem;
    color: var(--accent-light);
    background: var(--accent-dim);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0 0.4rem;
    line-height: 1.5;
}

.live-ev-time {
    font-family: 'Courier New', monospace;
    color: var(--text-muted);
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.live-ev-type {
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-ev-body {
    font-size: 0.76rem;
    color: var(--text-secondary);
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.live-expand {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    padding: 0.22rem 0.6rem;
    font-family: inherit;
    font-size: 0.68rem;
    color: var(--accent-light);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--duration), border-color var(--duration), background var(--duration);
}

.live-expand-arrow {
    width: 0.42rem;
    height: 0.42rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-0.05rem, -0.05rem);
    transition: transform var(--duration);
}

.live-expand.is-open .live-expand-arrow {
    transform: rotate(-135deg) translate(-0.05rem, -0.05rem);
}

.live-expand:hover {
    color: var(--text-primary);
    border-color: var(--accent-light);
    background: var(--accent-dim);
}

.live-clip {
    display: inline;
}

.live-clip[hidden] {
    display: none;
}

.live-ellipsis {
    color: var(--accent-light);
    font-weight: 600;
}

.live-ellipsis[hidden] {
    display: none;
}

.live-ev.tool_call::before {
    background: var(--accent-light);
}

.live-ev.tool_result::before {
    background: #6ee7b7;
}

.live-ev.error::before {
    background: var(--danger);
}

.live-ev.reply::before,
.live-ev.interim::before {
    background: #6ee7b7;
}

.live-ev.interrupted::before {
    background: #fbbf24;
}

.live-ev.session_start::before {
    background: var(--accent);
}

.live-ev.session_end::before {
    background: var(--text-muted);
}

.live-arg-chip {
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.08rem 0.42rem;
    margin: 0.1rem 0.25rem 0.1rem 0;
    color: var(--text-secondary);
    max-width: 100%;
    overflow-wrap: anywhere;
    transition: border-color var(--duration), color var(--duration);
}

.live-arg-chip:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.live-ev.is-virtual.kind-think::before {
    background: #60a5fa;
}

.live-ev.is-virtual.kind-reply::before {
    background: #6ee7b7;
}

.live-ev.is-virtual.kind-think .live-ev-type {
    color: #93c5fd;
}

.live-ev.is-virtual.kind-reply .live-ev-type {
    color: #6ee7b7;
}

.live-stream-text {
    font-size: 0.8rem;
    line-height: 1.7;
}

.live-ev.is-virtual.kind-think .live-stream-text {
    color: var(--text-muted);
    font-style: italic;
}

.live-stream-text.streaming::after {
    content: '▍';
    color: var(--accent-light);
    animation: liveCaret 1s steps(2) infinite;
    margin-left: 1px;
}

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

.live-cursor-empty {
    color: var(--text-muted);
    font-style: italic;
}

.live-hist-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.live-hist-row {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem 0.6rem 0.95rem;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: border-color var(--duration) ease, background var(--duration) ease;
    flex: 0 0 auto;
}

.live-hist-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--border-strong);
}

.live-hist-row:hover {
    border-color: var(--border-strong);
    background: rgba(0, 0, 0, 0.28);
}

.live-hist-role {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.live-hist-row.role-user::before {
    background: #6ee7b7;
}

.live-hist-row.role-model::before {
    background: var(--accent-light);
}

.live-hist-row.role-function::before {
    background: #fcd34d;
}

.live-hist-role.user {
    color: #6ee7b7;
}

.live-hist-role.model {
    color: var(--accent-light);
}

.live-hist-role.function {
    color: #fcd34d;
    text-transform: none;
    letter-spacing: 0;
}

.live-hist-text {
    font-size: 0.76rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.65;
}

.live-hist-topics-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.65rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.live-hist-topics-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    flex: 0 0 auto;
}

.live-hist-topic-chip {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    padding: 0.18rem 0.55rem;
    cursor: pointer;
    transition: all var(--duration) ease;
    white-space: nowrap;
}

.live-hist-topic-chip:hover {
    color: var(--accent-light);
    border-color: var(--accent-light);
    background: var(--accent-dim);
}

.live-hist-topic-chip.active {
    color: #fff;
    border-color: var(--accent-light);
    background: rgba(167, 139, 250, 0.25);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.2);
}

@media (min-width: 901px) and (max-width: 1180px) {
    .content {
        padding: 2rem 1.4rem 2.5rem;
    }
}

@media (max-width: 1180px) {
    .live-shell {
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 0.85rem;
        height: clamp(520px, calc(100vh - 190px), 860px);
    }

    .live-sessions {
        padding: 0.75rem;
        gap: 0.55rem;
    }

    .live-detail {
        padding: 0.9rem 1.05rem;
    }

    .live-detail-inner {
        gap: 0.6rem;
    }

    .live-meta {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 0.35rem 0.65rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.68rem;
    }

    .live-ops {
        gap: 0.35rem;
    }

    .live-op-btn {
        padding: 0.25rem 0.55rem;
        font-size: 0.66rem;
    }

    .live-topic-list {
        max-height: 110px;
    }

    .live-secondary-toggle {
        display: inline-flex;
    }

    .live-detail:not(.show-secondary) .live-secondary {
        display: none;
    }

    .live-detail.show-secondary .live-secondary {
        max-height: 45%;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 0.2rem;
    }

    .live-pane-wrap {
        min-height: 0;
    }
}

@media (max-width: 960px) and (min-width: 681px) {
    .live-shell {
        display: grid !important;
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 0.75rem;
        height: calc(100vh - 7.5rem);
        min-height: 520px;
    }

    .live-sessions {
        display: flex !important;
        padding: 0.65rem;
        gap: 0.5rem;
        height: 100%;
    }

    .live-detail {
        display: flex !important;
        padding: 0.85rem 0.95rem;
        height: 100%;
        overflow: hidden;
    }

    .live-back-btn {
        display: none !important;
    }

    .live-detail-inner {
        gap: 0.55rem;
    }

    .live-meta {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.3rem 0.55rem;
        padding: 0.45rem 0.65rem;
        font-size: 0.66rem;
    }

    .live-ops {
        gap: 0.3rem;
    }

    .live-op-btn {
        padding: 0.22rem 0.52rem;
        font-size: 0.65rem;
    }

    .live-topics {
        padding-top: 0.55rem;
        gap: 0.4rem;
    }

    .live-topic-list {
        max-height: 95px;
    }

    .live-pane-wrap {
        min-height: 0;
    }
}

@media (max-width: 900px) and (min-width: 681px) {
    .live-shell {
        height: calc(100vh - 11.5rem);
        height: calc(100dvh - 11.5rem);
        min-height: 380px;
    }
}

@media (max-width: 680px) {
    .live-shell {
        display: block;
        height: auto;
        min-height: 0;
    }

    .live-sessions {
        height: auto;
        max-height: none;
        padding: 0.75rem;
    }

    .live-session-list {
        max-height: calc(100vh - 12rem);
    }

    .live-detail {
        display: none;
        min-height: 0;
        max-height: calc(100vh - 11.5rem);
        height: calc(100vh - 11.5rem);
        max-height: calc(100dvh - 11.5rem);
        height: calc(100dvh - 11.5rem);
        padding: 0.8rem;
        overflow: hidden;
    }

    .live-shell.show-detail .live-sessions {
        display: none;
    }

    .live-shell.show-detail .live-detail {
        display: flex;
        animation: liveFadeIn 0.26s ease both;
    }

    .live-back-btn {
        display: inline-flex;
    }

    .live-detail-head {
        position: static;
        margin: 0;
        padding: 0 0 0.5rem;
        border-bottom: 1px solid var(--border);
        flex-wrap: nowrap;
        gap: 0.4rem;
        justify-content: space-between;
    }

    .live-detail-title {
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: nowrap;
        gap: 0.35rem;
        overflow: hidden;
    }

    .live-detail-title .mono {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    .live-detail-title .live-status-badge {
        flex: 0 0 auto;
        font-size: 0.65rem;
        padding: 0.2rem 0.45rem;
        white-space: nowrap;
    }

    .live-detail-actions {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }

    .live-detail-actions .refresh-sessions-btn,
    .live-detail-actions .live-mini-btn {
        padding: 0.28rem 0.55rem;
        font-size: 0.68rem;
        min-height: 28px;
        line-height: 1.2;
        width: auto;
    }

    .live-detail-actions .live-refresh-btn {
        display: none;
    }

    .live-pane-wrap {
        min-height: 0;
        flex: 1 1 auto;
        position: relative;
    }

    .live-tab-pane {
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1 1 auto;
        min-height: 0;
        padding-right: 0;
    }

    .live-empty-fill {
        padding: 1.5rem 1rem;
    }

    .live-jump-btn {
        display: inline-flex;
        bottom: 0.5rem;
    }

    .live-detail-inner {
        min-height: 0;
        flex: 1 1 auto;
        gap: 0.6rem;
    }

    .live-ops {
        gap: 0.4rem;
    }

    .live-op-btn {
        flex: 1 1 calc(50% - 0.4rem);
        text-align: center;
        padding: 0.32rem 0.5rem;
    }

    .live-ops-label {
        flex-basis: 100%;
        margin: 0 0 0.1rem;
    }

    .live-meta {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 0.35rem 0.6rem;
        padding: 0.5rem 0.7rem;
    }

    .live-topics-head {
        align-items: flex-start;
    }

    .live-topics-actions .live-op-btn {
        flex: 0 0 auto;
    }

    .live-topic-row-ops {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 520px) {
    .live-sessions {
        padding: 0.8rem;
    }

    .live-head-title {
        font-size: 0.8rem;
    }

    .live-card-foot {
        flex-wrap: wrap;
        gap: 0.28rem 0.6rem;
    }

    .live-card-dur {
        margin-left: 0;
        flex-basis: 100%;
        text-align: right;
    }

    .live-detail {
        padding: 0.85rem;
    }

    .live-detail-head {
        top: 3.2rem;
    }

    .live-detail-title .mono {
        font-size: 0.84rem;
    }

    .live-meta {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem 0.8rem;
        padding: 0.6rem 0.75rem;
    }

    .live-topic-list {
        max-height: 120px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .live-session-card,
    .live-session-card.is-new,
    .live-session-card.is-busy::before,
    .live-ev,
    .live-status-badge::before,
    .live-pulse.online,
    .live-detail-inner,
    .live-detail-empty,
    .live-empty-fill,
    .live-tab-pane.active,
    .live-shell.show-detail .live-detail,
    .live-stream-text.streaming::after,
    .live-topic-row,
    .live-topic-empty,
    .live-topic-row-ops {
        animation: none !important;
        transition: none !important;
    }

    .live-pulse.online {
        box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
    }

    .live-session-card:hover,
    .live-session-card:active,
    .live-session-card.active,
    .live-op-btn:hover,
    .live-op-btn:active,
    .live-topic-row:hover,
    .live-topic-row.is-active,
    .live-topic-btn:hover,
    .live-topic-btn:active {
        transform: none !important;
    }

    .live-topic-row-ops {
        opacity: 1 !important;
    }
}

.log-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px 12px;
}

.log-cat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-family: var(--mono, monospace);
    letter-spacing: 0.03em;
    color: var(--text-dim, #9aa4b2);
    cursor: pointer;
    user-select: none;
}

.log-cat-item input[type="checkbox"] {
    flex: 0 0 auto;
}

.log-stack {
    display: flex;
    flex-direction: column;
    gap: 1.05rem;
}

.log-config-card {
    flex: 0 0 auto;
}

.log-cat-tools {
    float: right;
    display: inline-flex;
    gap: 0.35rem;
}

.log-mini-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.64rem;
    font-family: inherit;
    letter-spacing: 0.04em;
    padding: 0.08rem 0.6rem;
    cursor: pointer;
    transition: all var(--duration);
}

.log-mini-btn:hover {
    color: var(--accent-light);
    border-color: var(--accent-light);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.22);
}

.log-console-card {
    position: relative;
    padding: 1rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-height: 0;
}

.log-console-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.log-console-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.log-console-actions .refresh-sessions-btn {
    padding: 0.28rem 0.7rem;
    font-size: 0.64rem;
    white-space: nowrap;
}

.log-console-actions .refresh-sessions-btn.is-active {
    color: var(--warning);
    border-color: var(--warning);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

.log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 1rem;
    flex-wrap: wrap;
}

.log-level-wrap {
    position: relative;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem;
    overflow: hidden;
}

.log-level-filter {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.log-level-filter::-webkit-scrollbar {
    display: none;
}

.log-level-wrap::before,
.log-level-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 34px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--duration);
    z-index: 2;
}

.log-level-wrap::before {
    left: 0;
    background: linear-gradient(90deg, rgba(20, 16, 34, 0.96), transparent);
}

.log-level-wrap::after {
    right: 0;
    background: linear-gradient(270deg, rgba(20, 16, 34, 0.96), transparent);
}

.log-level-wrap.can-left::before {
    opacity: 1;
}

.log-level-wrap.can-right::after {
    opacity: 1;
}

.log-lv-btn {
    background: transparent;
    border: none;
    border-radius: 999px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.24rem 0.7rem;
    cursor: pointer;
    transition: all var(--duration);
    white-space: nowrap;
}

.log-lv-btn:hover {
    color: var(--text-secondary);
}

.log-lv-btn.active {
    color: #fff;
    background: var(--accent-dim);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

.log-lv-btn.active.lv-debug {
    color: #7dd3fc;
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.5);
}

.log-lv-btn.active.lv-info {
    color: var(--success);
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.5);
}

.log-lv-btn.active.lv-warning {
    color: var(--warning);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.5);
}

.log-lv-btn.active.lv-error {
    color: var(--danger);
    box-shadow: inset 0 0 0 1px rgba(251, 77, 109, 0.5);
}

.log-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1 1 auto;
    justify-content: flex-end;
    flex-wrap: wrap;
    min-width: 0;
}

.log-cat-select-wrap {
    min-width: 150px;
    flex: 0 1 180px;
}

.log-search {
    flex: 1 1 180px;
    min-width: 120px;
    max-width: 320px;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
}

.log-autoscroll {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    flex: 0 0 auto;
}

.log-console {
    flex: 1 1 auto;
    min-height: 320px;
    max-height: clamp(360px, calc(100vh - 480px), 640px);
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.4rem;
    font-family: var(--mono, 'Courier New', monospace);
    font-size: 0.76rem;
    line-height: 1.55;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}

.log-console>.log-line {
    flex: 0 0 auto;
}

.log-line {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.28rem 0.55rem;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    white-space: pre-wrap;
    word-break: break-word;
    transition: background var(--duration);
}

.log-line:hover {
    background: rgba(167, 139, 250, 0.07);
}

.log-line.is-new {
    animation: logFlash 1.4s ease-out;
}

@keyframes logFlash {
    0% {
        background: rgba(167, 139, 250, 0.22);
    }

    100% {
        background: transparent;
    }
}

.log-col-time {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.log-col-level {
    flex: 0 0 62px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.04em;
    border-radius: 4px;
    font-size: 0.66rem;
    line-height: 1.5;
}

.log-cat-chip {
    flex: 0 0 auto;
    padding: 0.02rem 0.42rem;
    border-radius: 4px;
    font-size: 0.66rem;
    color: var(--accent-light);
    background: var(--accent-dim);
    border: 1px solid var(--border);
    letter-spacing: 0.03em;
}

.log-col-msg {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-secondary);
}

.log-line.log-lv-debug .log-col-level {
    color: #7dd3fc;
}

.log-line.log-lv-debug .log-col-msg {
    color: var(--text-muted);
}

.log-line.log-lv-info .log-col-level {
    color: var(--success);
}

.log-line.log-lv-warning {
    border-left-color: rgba(251, 191, 36, 0.6);
    background: rgba(251, 191, 36, 0.05);
}

.log-line.log-lv-warning .log-col-level {
    color: var(--warning);
}

.log-line.log-lv-warning .log-col-msg {
    color: #ffe6ac;
}

.log-line.log-lv-error {
    border-left-color: rgba(251, 77, 109, 0.7);
    background: rgba(251, 77, 109, 0.07);
}

.log-line.log-lv-error .log-col-level {
    color: var(--danger);
}

.log-line.log-lv-error .log-col-msg {
    color: #ffd0d9;
}

.log-empty {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.6rem 1rem;
    color: var(--text-muted);
}

.log-empty-icon {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.log-empty-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.log-empty-sub {
    font-size: 0.72rem;
}

@media (max-width: 860px) {
    .log-console-card {
        padding: 0.9rem 0.85rem 0.95rem;
    }

    .log-console-head {
        flex-wrap: nowrap;
    }

    .log-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .log-level-wrap {
        align-self: flex-start;
        max-width: 100%;
    }

    .log-toolbar-right {
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .log-cat-select-wrap {
        flex: 1 1 130px;
        min-width: 0;
    }

    .log-search {
        flex: 1 1 100%;
        max-width: none;
    }

    .log-autoscroll {
        flex: 0 0 auto;
    }

    .log-console {
        max-height: 56vh;
        min-height: 220px;
        font-size: 0.72rem;
    }
}

@media (max-width: 520px) {
    .log-stack {
        gap: 0.8rem;
    }

    .log-console-card {
        padding: 0.8rem 0.7rem 0.85rem;
    }

    .log-cat-tools {
        float: none;
        display: flex;
        margin-top: 0.4rem;
    }

    .log-config-card .panel-actions {
        margin-top: 1.1rem;
        padding-top: 1rem;
    }

    .log-config-card .panel-actions .btn {
        width: 100%;
    }

    .log-line {
        flex-wrap: wrap;
        gap: 0.3rem 0.5rem;
        padding: 0.35rem 0.5rem;
    }

    .log-col-level {
        flex: 0 0 54px;
    }

    .log-col-msg {
        flex: 1 1 100%;
        padding-left: 0.1rem;
    }

    .log-console {
        min-height: 200px;
        max-height: 52vh;
    }
}

/* ============================================================
   远程服务器 · 跳板链路编辑器
   ============================================================ */

.chain-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chain-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    min-height: 2.7rem;
    padding: 0.5rem 0.6rem;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--duration), box-shadow var(--duration);
}

.chain-list:hover {
    border-color: var(--border-strong);
}

.chain-list:focus-within {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.chain-empty {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.chain-empty::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
}

.chain-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.35rem 0.2rem 0.3rem;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(167, 139, 250, 0.05));
    border: 1px solid rgba(167, 139, 250, 0.34);
    border-radius: 999px;
    color: var(--accent-light);
    font-size: 0.75rem;
    line-height: 1.4;
    transition: border-color var(--duration), box-shadow var(--duration), transform var(--duration);
}

.chain-chip:hover {
    border-color: var(--accent-light);
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.22);
    transform: translateY(-1px);
}

.chain-chip.is-local {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.18), rgba(52, 211, 153, 0.05));
    border-color: rgba(52, 211, 153, 0.38);
    color: #6ee7b7;
}

.chain-chip.is-local:hover {
    border-color: rgba(110, 231, 183, 0.75);
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.2);
}

.chain-chip-idx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.24);
    color: #ddd3ff;
    font-size: 0.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.chain-chip.is-local .chain-chip-idx {
    background: rgba(52, 211, 153, 0.22);
    color: #8ff0c7;
}

.chain-chip-name {
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    font-size: 0.74rem;
}

.chain-chip-ops {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    opacity: 0.4;
    transition: opacity var(--duration);
}

.chain-chip:hover .chain-chip-ops,
.chain-chip:focus-within .chain-chip-ops {
    opacity: 1;
}

.chain-hop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.62rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--duration), color var(--duration);
}

.chain-hop-btn:hover:not(:disabled) {
    background: rgba(167, 139, 250, 0.26);
    color: #fff;
}

.chain-hop-btn.is-remove:hover:not(:disabled) {
    background: rgba(251, 77, 109, 0.24);
    color: #ffb3c1;
}

.chain-hop-btn:disabled {
    opacity: 0.2;
    cursor: default;
}

.chain-sep {
    flex: 0 0 auto;
    padding: 0 0.05rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.6;
    user-select: none;
}

.chain-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.6rem 0.38rem 0.55rem;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    border-left: 2px solid rgba(167, 139, 250, 0.45);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.chain-preview-label {
    flex: 0 0 auto;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--accent-dim);
    color: var(--accent-light);
    font-size: 0.62rem;
    letter-spacing: 0.04em;
}

.chain-preview-path {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.chain-preview-target {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-light);
    word-break: break-all;
}

.chain-preview-warn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning);
    font-size: 0.64rem;
}

.jump-path {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin: 0 0.15rem;
    padding: 0.02rem 0.42rem;
    border-radius: 999px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    background: rgba(167, 139, 250, 0.13);
    color: var(--accent-light);
    font-family: 'Courier New', monospace;
    font-size: 0.66rem;
    line-height: 1.5;
    vertical-align: middle;
}

.remote-notes {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.remote-notes li {
    position: relative;
    padding-left: 0.85rem;
}

.remote-notes li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.62em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.5);
}

.remote-notes code {
    color: var(--accent-light);
    font-size: 0.9em;
}

.remote-notes-key {
    display: inline-flex;
    align-items: center;
    padding: 0.02rem 0.4rem;
    margin-right: 0.05rem;
    border-radius: 999px;
    border: 1px solid rgba(167, 139, 250, 0.32);
    background: rgba(167, 139, 250, 0.12);
    color: var(--accent-light);
    font-size: 0.68rem;
    line-height: 1.5;
}

.remote-notes-key.is-local {
    border-color: rgba(52, 211, 153, 0.38);
    background: rgba(52, 211, 153, 0.12);
    color: #6ee7b7;
}

@media (hover: none) {
    .chain-chip-ops {
        opacity: 1;
    }
}

@media (max-width: 520px) {
    .chain-list {
        padding: 0.4rem;
        gap: 0.25rem;
    }

    .chain-chip-name {
        max-width: 6rem;
    }

    .chain-preview {
        font-size: 0.68rem;
    }

    .chain-preview-path,
    .chain-preview-target {
        font-size: 0.68rem;
    }
}

.chat-shell {
    display: flex;
    flex-direction: column;
    height: clamp(560px, calc(100vh - 210px), 960px);
    background: var(--bg-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: relative;
    transition: border-color var(--duration) ease, box-shadow var(--duration) ease;
}

.chat-shell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(196, 181, 253, 0.5), transparent);
    pointer-events: none;
}

.chat-shell:hover {
    border-color: var(--border-strong);
}

.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.16);
    flex: 0 0 auto;
    min-width: 0;
}

.chat-head-main {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.chat-avatar {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--accent-dim);
    flex: 0 0 auto;
}

.chat-head-text {
    min-width: 0;
}

.chat-title {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}

.chat-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-head-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chat-head-actions .refresh-sessions-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.66rem;
    white-space: nowrap;
}

.chat-qq-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: border-color var(--duration) ease, color var(--duration) ease;
}

.chat-qq-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    flex: 0 0 auto;
}

.chat-qq-badge.online {
    border-color: rgba(52, 211, 153, 0.38);
    color: #6ee7b7;
}

.chat-qq-badge.online .chat-qq-dot {
    background: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.65);
}

.chat-qq-badge.offline {
    border-color: rgba(251, 77, 109, 0.38);
    color: #fda4b4;
}

.chat-qq-badge.offline .chat-qq-dot {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(251, 77, 109, 0.6);
}

.chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.15rem 1.2rem;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    background-clip: padding-box;
}

.chat-empty {
    margin: auto;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    max-width: min(720px, 84%);
    flex: 0 0 auto;
}

.chat-msg.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg.model {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-msg-who {
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    padding: 0 0.3rem;
}

.chat-bubble {
    padding: 0.62rem 0.85rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.chat-msg.model .chat-bubble {
    border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
    border-color: transparent;
    border-bottom-right-radius: 4px;
    background: linear-gradient(135deg, rgba(196, 181, 253, 0.92), rgba(139, 92, 246, 0.9));
    color: #140f24;
    font-weight: 500;
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.22);
}

.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-muted);
}

.chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.chat-typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-light);
    opacity: 0.35;
    animation: chatDot 1.2s infinite ease-in-out;
}

.chat-typing-dots i:nth-child(2) {
    animation-delay: 0.16s;
}

.chat-typing-dots i:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes chatDot {

    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.18);
    flex: 0 0 auto;
}

.chat-input {
    flex: 1 1 0;
    min-width: 0;
    resize: none;
    min-height: 42px;
    max-height: 160px;
    padding: 0.6rem 0.85rem;
    font-size: 0.84rem;
    line-height: 1.6;
    overflow-y: auto;
}

.chat-input::placeholder {
    color: rgba(196, 181, 253, 0.25);
}

.chat-send {
    flex: 0 0 auto;
    width: auto;
    min-width: 88px;
    height: 42px;
    padding: 0.5rem 1.1rem;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-send.loading {
    min-width: 88px;
}

.chat-status {
    padding: 0 1.1rem 0.75rem;
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    flex: 0 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .chat-shell {
        height: clamp(480px, calc(100dvh - 190px), 900px);
    }

    .chat-head {
        flex-wrap: wrap;
        padding: 0.7rem 0.8rem;
    }

    .chat-head-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .chat-sub {
        white-space: normal;
    }

    .chat-messages {
        padding: 0.9rem 0.8rem;
    }

    .chat-msg {
        max-width: 92%;
    }

    .chat-composer {
        padding: 0.7rem 0.75rem;
    }
}
/* ============================================================
   会话渠道 · 绑定输入行
   ============================================================ */

.channel-bind-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.channel-bind-row .form-input {
    flex: 1 1 220px;
    width: auto;
    min-width: 0;
}

.channel-bind-row .channel-bind-select {
    flex: 0 1 240px;
    width: auto;
    min-width: 0;
}

.channel-editor-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    text-align: left;
}

/* 长表单弹窗：操作栏吸底，移动端无需滚到底才能保存 */
.raven-modal-card.modal-wide {
    scroll-padding-bottom: 4.6rem;
}

.raven-modal-card.modal-wide .modal-actions {
    position: sticky;
    bottom: -2.4rem;
    z-index: 2;
    margin: 0.9rem -2rem -2.4rem;
    padding: 0.75rem 2rem 1.15rem;
    background: #100d1a;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.channel-bind-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.channel-bind-actions .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 6.5rem;
}

@media (max-width: 680px) {
    .channel-editor-form {
        gap: 0.42rem;
    }

    .channel-bind-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .channel-bind-row .form-input,
    .channel-bind-row .channel-bind-select {
        flex: 1 1 auto;
        width: 100%;
    }

    .channel-bind-actions .btn {
        flex: 1 1 0;
    }
}

/* ============================================================
   统一导航：分组侧栏 + 页内标签
   ============================================================ */

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    margin-bottom: 0.5rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-light);
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.nav-item .nav-text {
    flex: 1;
    min-width: 0;
}

.nav-item .nav-count {
    flex: 0 0 auto;
    min-width: 1.35rem;
    padding: 0.05rem 0.35rem;
    font-size: 0.62rem;
    line-height: 1.4;
    text-align: center;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.nav-item.active .nav-count {
    color: var(--accent-light);
    border-color: var(--border-strong);
}

.panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: -0.6rem 0 1.5rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
}

.panel-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--duration) ease;
    white-space: nowrap;
}

.panel-tab .tab-ico {
    font-size: 0.9rem;
}

.panel-tab:hover {
    color: var(--text-primary);
    background: var(--accent-dim);
}

.panel-tab.active {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(167, 139, 250, 0.16), rgba(167, 139, 250, 0.05));
    border-color: var(--border-strong);
    box-shadow: inset 0 0 20px rgba(167, 139, 250, 0.08);
}

.panel .card {
    padding-top: 1.8rem;
}

@media (max-width: 900px) {
    .panel-tabs {
        margin-top: 0;
        padding-bottom: 0.65rem;
    }

    .panel-tab {
        flex: 0 0 auto;
    }

    .panel .card {
        padding-top: 1.4rem;
    }
}
