:root {
    color-scheme: light;
    --brand-50: #eef6ff;
    --brand-100: #d9ebff;
    --brand-200: #b9d9ff;
    --brand-500: #1677ff;
    --brand-600: #0564e8;
    --brand-700: #004cb8;
    --cyan-500: #13b8c8;
    --navy-950: #081225;
    --navy-900: #0d1b33;
    --navy-800: #132441;
    --ink-950: #172033;
    --ink-800: #34415b;
    --ink-600: #66728a;
    --ink-500: #8792a8;
    --line: #e5eaf1;
    --line-strong: #d8dee8;
    --surface: #ffffff;
    --canvas: #f5f7fa;
    --success: #18a874;
    --success-soft: #e9f8f2;
    --warning: #d98916;
    --warning-soft: #fff7e8;
    --danger: #e34d59;
    --danger-soft: #fff0f1;
    --shadow-sm: 0 1px 2px rgba(18, 32, 56, 0.04);
    --shadow-md: 0 8px 24px rgba(18, 32, 56, 0.08);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --sidebar-width: 244px;
    font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink-950);
    background: var(--canvas);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

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

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(22, 119, 255, 0.18);
    outline-offset: 1px;
}

.app-shell {
    min-height: 100vh;
}

.login-overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(8, 18, 37, 0.72);
}

.login-overlay[hidden] {
    display: none;
}

.login-dialog {
    display: grid;
    width: min(380px, 100%);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 18px 60px rgba(3, 11, 24, 0.28);
}

.login-dialog h1 {
    margin: 13px 0 24px;
    font-size: 22px;
    letter-spacing: 0;
}

.login-dialog label {
    margin: 13px 0 7px;
    color: var(--ink-800);
    font-weight: 600;
}

.login-dialog input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-950);
    background: var(--surface);
}

.login-brand {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    color: #ffffff;
    background: var(--brand-600);
    font-size: 20px;
    font-weight: 800;
}

.login-button {
    width: 100%;
    margin-top: 24px;
}

.login-error {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--danger);
    background: var(--danger-soft);
}

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 50;
    height: 64px;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    color: #ffffff;
    background: linear-gradient(103deg, #0b1a32 0%, #102b50 58%, #12375b 100%);
    box-shadow: 0 2px 8px rgba(5, 19, 41, 0.18);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 22px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    position: relative;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: linear-gradient(145deg, #3ea2ff 0%, #146df2 52%, #7657ff 100%);
    box-shadow: 0 5px 14px rgba(0, 109, 242, 0.36);
}

.brand-mark::before,
.brand-mark::after {
    content: "";
    position: absolute;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
}

.brand-mark::before {
    width: 4px;
    height: 14px;
    left: 8px;
    top: 8px;
    box-shadow: 7px -3px 0 rgba(255, 255, 255, 0.94), 14px 2px 0 rgba(255, 255, 255, 0.94);
}

.brand-mark::after {
    width: 4px;
    height: 8px;
    left: 15px;
    top: 11px;
}

.brand-copy {
    min-width: 0;
}

.brand-title {
    display: block;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-subtitle {
    display: block;
    margin-top: 1px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 24px;
}

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

.app-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9px;
    color: #c9e6ff;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
    font-weight: 700;
}

.app-context strong {
    display: block;
    overflow: hidden;
    color: #f7fbff;
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 11px;
}

.environment-badge {
    padding: 2px 6px;
    border-radius: 999px;
    color: #aeead6;
    background: rgba(34, 190, 137, 0.14);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-link,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 0;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    text-decoration: none;
    cursor: pointer;
}

.top-link {
    gap: 7px;
    padding: 0 10px;
    font-size: 13px;
}

.top-link:hover,
.icon-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: 6px;
    padding-left: 14px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.78);
    background: transparent;
    font-size: 12px;
    cursor: pointer;
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #ffffff;
    background: linear-gradient(145deg, #6b9fff, #7759e8);
    font-weight: 700;
}

.menu-toggle {
    display: none;
}

.sidebar {
    position: fixed;
    z-index: 40;
    inset: 64px auto 0 0;
    width: var(--sidebar-width);
    overflow: auto;
    color: #bdc8d9;
    background: var(--navy-950);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.side-nav {
    padding: 18px 12px 96px;
}

.nav-group {
    margin-bottom: 17px;
}

.nav-label {
    padding: 0 12px;
    margin: 0 0 7px;
    color: #60708b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.nav-item {
    position: relative;
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    color: #9fadc2;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
}

.nav-item:hover {
    color: #e6efff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(22, 119, 255, 0.24), rgba(22, 119, 255, 0.08));
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #3c9bff;
    box-shadow: 0 0 12px rgba(60, 155, 255, 0.6);
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    flex: 0 0 18px;
    font-size: 15px;
    line-height: 1;
}

.nav-item span:last-child {
    font-size: 13px;
}

.sidebar-foot {
    position: fixed;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 14px 18px 16px;
    color: #60708b;
    background: linear-gradient(0deg, #081225 72%, rgba(8, 18, 37, 0));
    font-size: 10px;
    line-height: 1.5;
}

.workspace {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding-top: 64px;
}

.workspace-header {
    position: sticky;
    top: 64px;
    z-index: 30;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ink-500);
    font-size: 12px;
}

.breadcrumb strong {
    color: var(--ink-800);
    font-weight: 600;
}

.page-context-title {
    margin-top: 4px;
    font-size: 17px;
    font-weight: 700;
}

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

.button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 15px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    color: var(--ink-800);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease,
        background 120ms ease;
}

.button:hover {
    border-color: #b8c5d7;
    background: #fbfcfe;
    box-shadow: 0 3px 9px rgba(18, 32, 56, 0.08);
}

.button:active {
    transform: translateY(1px);
}

.button.primary {
    border-color: var(--brand-500);
    color: #ffffff;
    background: linear-gradient(135deg, #2585ff, #0869ea);
    box-shadow: 0 5px 13px rgba(22, 119, 255, 0.24);
}

.button.primary:hover {
    border-color: var(--brand-600);
    background: linear-gradient(135deg, #1579f5, #005fd9);
}

.button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

.unsaved-dot {
    width: 7px;
    height: 7px;
    display: none;
    border-radius: 50%;
    background: #ffb020;
    box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.13);
}

.unsaved-dot.visible {
    display: inline-block;
}

.main-content {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 26px 28px 110px;
}

.section {
    display: none;
    animation: section-enter 180ms ease;
}

.section.active {
    display: block;
}

@keyframes section-enter {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.section-heading h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.section-heading p {
    max-width: 740px;
    margin: 7px 0 0;
    color: var(--ink-600);
    line-height: 1.65;
}

.heading-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid #cde3ff;
    border-radius: 7px;
    color: #0d63ce;
    background: #f2f8ff;
    font-size: 12px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(24, 168, 116, 0.14);
}

.hero-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.7fr);
    min-height: 214px;
    margin-bottom: 18px;
    border: 1px solid #dbe8f8;
    border-radius: var(--radius-lg);
    color: #ffffff;
    background:
        radial-gradient(circle at 81% 24%, rgba(68, 205, 255, 0.24), transparent 25%),
        radial-gradient(circle at 94% 94%, rgba(117, 90, 255, 0.25), transparent 32%),
        linear-gradient(118deg, #0d3970 0%, #075caa 55%, #0c74c8 100%);
    box-shadow: 0 10px 28px rgba(19, 73, 132, 0.16);
}

.hero-card::before,
.hero-card::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 50%;
}

.hero-card::before {
    width: 260px;
    height: 260px;
    right: -92px;
    top: -122px;
}

.hero-card::after {
    width: 190px;
    height: 190px;
    right: 90px;
    bottom: -142px;
}

.hero-main {
    position: relative;
    z-index: 1;
    padding: 28px 30px;
}

.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero-title {
    margin: 14px 0 8px;
    font-size: 28px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.hero-description {
    max-width: 660px;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.hero-tag {
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.08);
    font-size: 11px;
}

.hero-runtime {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 20px;
    padding: 21px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 11px;
    background: rgba(7, 31, 65, 0.34);
    backdrop-filter: blur(8px);
}

.runtime-state {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #dffdf4;
    font-weight: 600;
}

.runtime-generation {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
}

.runtime-generation strong {
    display: block;
    margin-top: 2px;
    color: #ffffff;
    font-size: 25px;
    font-variant-numeric: tabular-nums;
}

.runtime-foot {
    display: flex;
    gap: 18px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
    color: rgba(255, 255, 255, 0.54);
    font-size: 11px;
}

.runtime-foot strong {
    color: #ffffff;
    font-size: 13px;
}

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

.metric-card {
    min-height: 112px;
    padding: 19px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.metric-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--ink-600);
    font-size: 12px;
}

.metric-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: var(--brand-600);
    background: var(--brand-50);
}

.metric-value {
    margin-top: 10px;
    font-size: 25px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.metric-note {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: 11px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.8fr);
    gap: 18px;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel + .panel {
    margin-top: 16px;
}

.panel-header {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
}

.panel-description {
    margin: 4px 0 0;
    color: var(--ink-500);
    font-size: 11px;
}

.panel-body {
    padding: 20px;
}

.service-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.service-card {
    position: relative;
    min-height: 182px;
    display: flex;
    flex-direction: column;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: linear-gradient(180deg, #ffffff, #fbfcff);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.service-card:hover {
    transform: translateY(-2px);
    border-color: #cddaf0;
    box-shadow: var(--shadow-md);
}

.service-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.service-logo {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(145deg, #2c8cff, #1265d8);
    box-shadow: 0 5px 12px rgba(22, 119, 255, 0.2);
    font-size: 13px;
    font-weight: 800;
}

.service-logo.llm {
    background: linear-gradient(145deg, #7f65f2, #5d41cf);
    box-shadow: 0 5px 12px rgba(104, 75, 218, 0.2);
}

.service-logo.tts {
    background: linear-gradient(145deg, #19b9bd, #0a909e);
    box-shadow: 0 5px 12px rgba(13, 157, 168, 0.2);
}

.service-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--success);
    font-size: 10px;
}

.service-name {
    margin-top: 15px;
    font-weight: 650;
}

.service-type {
    overflow: hidden;
    margin-top: 5px;
    color: var(--ink-600);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.service-card button {
    align-self: flex-start;
    margin-top: auto;
    padding: 0;
    border: 0;
    color: var(--brand-600);
    background: transparent;
    font-size: 12px;
    cursor: pointer;
}

.service-card button:hover {
    color: var(--brand-700);
}

.release-flow {
    display: grid;
    gap: 0;
}

.flow-step {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 11px;
    min-height: 60px;
}

.flow-step:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 27px;
    bottom: -3px;
    width: 1px;
    background: #dce4ef;
}

.flow-index {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid #cfe2fb;
    border-radius: 50%;
    color: var(--brand-600);
    background: var(--brand-50);
    font-size: 11px;
    font-weight: 700;
}

.flow-copy strong {
    display: block;
    padding-top: 3px;
    font-size: 12px;
}

.flow-copy span {
    display: block;
    margin-top: 4px;
    color: var(--ink-500);
    font-size: 11px;
    line-height: 1.45;
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 14px;
    border: 1px solid #cfe2fb;
    border-radius: 8px;
    color: #37516e;
    background: #f3f8ff;
    font-size: 12px;
    line-height: 1.55;
}

.notice.warning {
    border-color: #f1d8a8;
    color: #76511e;
    background: var(--warning-soft);
}

.notice-icon {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    color: #ffffff;
    background: var(--brand-500);
    font-size: 11px;
    font-weight: 800;
}

.notice.warning .notice-icon {
    background: var(--warning);
}

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

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

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--ink-800);
    font-size: 12px;
    font-weight: 550;
}

.field-hint {
    color: var(--ink-500);
    font-size: 10px;
    font-weight: 400;
}

.required {
    color: var(--danger);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-950);
    background: #ffffff;
    outline: 0;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input,
select {
    height: 39px;
    padding: 0 11px;
}

select {
    cursor: pointer;
}

textarea {
    min-height: 390px;
    padding: 12px 13px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.65;
    tab-size: 4;
}

textarea.compact {
    min-height: 190px;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #bdc8d8;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: #aeb7c6;
}

.segmented-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 11px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    color: #53637a;
    background: #f1f4f8;
    font-size: 10px;
}

.chip.success {
    color: #167958;
    background: var(--success-soft);
}

.icon-command {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    color: var(--brand-600);
    background: #ffffff;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.icon-command:hover {
    border-color: #b8c5d7;
    background: var(--brand-50);
}

.button.danger {
    border-color: #f0c9cd;
    color: #bb3340;
    background: #ffffff;
    box-shadow: none;
}

.button.danger:hover {
    border-color: #e7aab0;
    background: var(--danger-soft);
}

.mcp-workspace {
    display: grid;
    grid-template-columns: minmax(250px, 0.34fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.mcp-server-panel {
    position: sticky;
    top: 150px;
}

.mcp-server-list-wrap {
    padding: 10px;
}

.mcp-server-list {
    display: grid;
    gap: 5px;
}

.mcp-server-item {
    width: 100%;
    min-height: 68px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--ink-800);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.mcp-server-item:hover {
    background: #f7f9fc;
}

.mcp-server-item.active {
    border-color: #c9dcf8;
    background: var(--brand-50);
}

.mcp-server-glyph {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #cfe2fb;
    border-radius: 7px;
    color: var(--brand-600);
    background: #ffffff;
    font-size: 12px;
    font-weight: 750;
}

.mcp-server-copy {
    min-width: 0;
}

.mcp-server-copy strong,
.mcp-server-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcp-server-copy strong {
    font-size: 12px;
}

.mcp-server-copy span {
    margin-top: 4px;
    color: var(--ink-500);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10px;
}

.mcp-server-state {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #aeb8c8;
}

.mcp-server-state.enabled {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(24, 168, 116, 0.12);
}

.mcp-empty-state,
.mcp-editor-empty {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 9px;
    color: var(--ink-500);
    text-align: center;
}

.mcp-empty-state {
    min-height: 170px;
}

.mcp-empty-state[hidden],
.mcp-editor-empty[hidden] {
    display: none;
}

.mcp-empty-state strong,
.mcp-editor-empty strong {
    color: var(--ink-600);
    font-size: 12px;
    font-weight: 550;
}

.mcp-empty-icon,
.mcp-editor-empty > span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fc;
}

.mcp-editor-empty {
    min-height: 430px;
}

.mcp-editor[hidden] {
    display: none;
}

.mcp-subsection {
    padding: 20px;
    border-top: 1px solid var(--line);
}

.mcp-subsection-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 15px;
}

.mcp-subsection-head h3 {
    margin: 0;
    font-size: 13px;
}

.mcp-subsection-head > div > span {
    display: block;
    margin-top: 4px;
    color: var(--ink-500);
    font-size: 10px;
}

textarea.mcp-code-editor {
    min-height: 112px;
}

.mcp-tool-list {
    display: grid;
    gap: 7px;
    margin-top: 14px;
}

.mcp-tool-placeholder {
    padding: 18px;
    border: 1px dashed var(--line-strong);
    border-radius: 7px;
    color: var(--ink-500);
    background: #fafbfd;
    text-align: center;
    font-size: 11px;
}

.mcp-tool-item {
    min-height: 58px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
}

.mcp-tool-item input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.mcp-tool-copy {
    min-width: 0;
}

.mcp-tool-copy strong,
.mcp-tool-copy span {
    display: block;
}

.mcp-tool-copy strong {
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcp-tool-copy span {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 3px;
    color: var(--ink-500);
    font-size: 10px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.mcp-danger-zone {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--line);
    background: #fbfcfe;
}

.config-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 18px;
}

.side-help {
    align-self: start;
}

.help-list {
    display: grid;
    gap: 13px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-list li {
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
}

.help-list li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.help-list strong {
    display: block;
    font-size: 12px;
}

.help-list span {
    display: block;
    margin-top: 4px;
    color: var(--ink-500);
    font-size: 11px;
    line-height: 1.55;
}

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

.path-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfe;
}

.path-key {
    color: var(--ink-600);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.path-value {
    overflow-wrap: anywhere;
    color: #3a4d67;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-toolbar input,
.admin-toolbar select {
    width: min(220px, 100%);
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-950);
    background: var(--surface);
}

.filter-toolbar input {
    flex: 1 1 150px;
}

.admin-split {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 22px;
    align-items: start;
}

.two-column-admin {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 12px;
}

.admin-table th,
.admin-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: var(--ink-600);
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.selectable-row {
    cursor: pointer;
    transition: background-color 140ms ease;
}

.selectable-row:hover,
.selectable-row:focus-visible,
.selectable-row.selected {
    background: var(--brand-50);
}

.selectable-row:focus-visible {
    outline: 2px solid rgba(22, 119, 255, 0.24);
    outline-offset: -2px;
}

.mono-cell {
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.admin-empty {
    padding: 28px 12px !important;
    color: var(--ink-500);
    text-align: center !important;
}

.table-actions {
    width: 1%;
    white-space: nowrap;
}

.compact-button {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 11px;
}

.admin-editor {
    display: grid;
    gap: 14px;
}

.admin-editor .field {
    margin: 0;
}

.admin-editor input,
.admin-editor select,
.admin-editor textarea {
    width: 100%;
}

.admin-editor textarea.compact {
    min-height: 230px;
    resize: vertical;
}

.management-split {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.7fr);
}

.management-device-panel {
    margin-top: 18px;
}

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

.credential-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
    padding: 12px;
    border: 1px solid #f1d28b;
    border-radius: var(--radius-sm);
    background: #fff9e8;
}

.credential-result[hidden] {
    display: none;
}

.credential-result > span {
    grid-column: 1 / -1;
    color: #865f09;
    font-size: 11px;
    font-weight: 650;
}

.credential-result code {
    min-width: 0;
    padding: 8px 10px;
    overflow-wrap: anywhere;
    border-radius: var(--radius-sm);
    color: var(--ink-950);
    background: #ffffff;
    font-size: 11px;
}

.admin-editor input[readonly] {
    color: var(--ink-600);
    background: #f4f6f9;
}

.compact-editor {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.compact-list {
    display: grid;
    gap: 0;
    margin-top: 8px;
}

.compact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line);
}

.compact-item:last-child {
    border-bottom: 0;
}

.compact-item > span:first-child {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.compact-item strong,
.compact-item small {
    overflow-wrap: anywhere;
}

.compact-item small,
.compact-empty {
    color: var(--ink-600);
    font-size: 11px;
}

.compact-empty {
    margin: 18px 0 0;
    text-align: center;
}

.json-detail {
    min-height: 280px;
    max-height: 560px;
    margin: 0;
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: #263852;
    background: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sticky-status {
    position: fixed;
    z-index: 60;
    right: 24px;
    bottom: 24px;
    max-width: min(480px, calc(100vw - 32px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    color: var(--ink-800);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 32px rgba(15, 30, 54, 0.15);
    backdrop-filter: blur(12px);
    font-size: 12px;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.sticky-status.visible {
    transform: none;
    opacity: 1;
}

.sticky-status.ok {
    border-color: #bfe8d9;
    color: #14684e;
}

.sticky-status.error {
    border-color: #f2c6ca;
    color: #a52d38;
}

.status-spinner {
    width: 15px;
    height: 15px;
    display: none;
    flex: 0 0 15px;
    border: 2px solid #c8d4e4;
    border-top-color: var(--brand-500);
    border-radius: 50%;
    animation: spin 750ms linear infinite;
}

.sticky-status.loading .status-spinner {
    display: block;
}

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

.sidebar-backdrop {
    display: none;
}

.kb-stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.kb-stat-strip > div {
    min-width: 0;
    padding: 14px 17px;
}

.kb-stat-strip > div + div {
    border-left: 1px solid var(--line);
}

.kb-stat-strip span,
.kb-stat-strip strong {
    display: block;
}

.kb-stat-strip span {
    color: var(--ink-500);
    font-size: 10px;
}

.kb-stat-strip strong {
    overflow: hidden;
    margin-top: 5px;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-dropzone {
    min-height: 116px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    padding: 22px;
    border: 1px dashed #b8c8dc;
    border-radius: var(--radius-sm);
    color: var(--ink-600);
    background: #fafcff;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

.kb-dropzone:hover,
.kb-dropzone.dragging {
    border-color: var(--brand-500);
    background: var(--brand-50);
}

.kb-dropzone.uploading {
    opacity: 0.65;
    pointer-events: none;
}

.kb-dropzone-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    border: 1px solid #c9ddf8;
    border-radius: 50%;
    color: var(--brand-600);
    background: #ffffff;
    font-size: 18px;
    font-weight: 700;
}

.kb-dropzone strong,
.kb-dropzone div > span {
    display: block;
}

.kb-dropzone strong {
    color: var(--ink-800);
    font-size: 13px;
}

.kb-dropzone div > span {
    margin-top: 5px;
    color: var(--ink-500);
    font-size: 11px;
}

.kb-document-table-wrap {
    margin-top: 18px;
}

.kb-document-name strong,
.kb-document-name span {
    display: block;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-document-name strong {
    font-size: 12px;
    font-weight: 600;
}

.kb-document-name span {
    margin-top: 4px;
    color: var(--success);
    font-size: 10px;
}

.kb-document-actions {
    width: 72px;
    text-align: right;
}

.kb-delete-button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
}

.kb-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.kb-search-results {
    margin-top: 16px;
    border-top: 1px solid var(--line);
}

.kb-search-empty {
    padding: 24px 4px 4px;
    color: var(--ink-500);
    text-align: center;
    font-size: 11px;
}

.kb-search-result {
    padding: 15px 2px;
    border-bottom: 1px solid var(--line);
}

.kb-search-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kb-search-result-head strong {
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-search-result-head span {
    flex: 0 0 auto;
    color: var(--ink-500);
    font-size: 10px;
}

.kb-search-result p {
    display: -webkit-box;
    overflow: hidden;
    margin: 8px 0 0;
    color: var(--ink-600);
    font-size: 11px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.kb-faq-compatibility > summary {
    cursor: pointer;
    list-style: none;
}

.kb-faq-compatibility > summary::-webkit-details-marker {
    display: none;
}

.kb-faq-compatibility[open] > summary {
    border-bottom: 1px solid var(--line);
}

@media (max-width: 1180px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .config-columns {
        grid-template-columns: 1fr;
    }

    .side-help {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .service-list {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .mcp-workspace {
        grid-template-columns: minmax(220px, 0.32fr) minmax(0, 1fr);
    }

    .admin-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    :root {
        --sidebar-width: 258px;
    }

    .topbar {
        grid-template-columns: 1fr;
    }

    .brand {
        padding-left: 58px;
        border-right: 0;
    }

    .topbar-main {
        display: none;
    }

    .menu-toggle {
        position: fixed;
        z-index: 70;
        left: 13px;
        top: 14px;
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 8px;
        color: #ffffff;
        background: rgba(255, 255, 255, 0.08);
    }

    .sidebar {
        z-index: 65;
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    body.sidebar-open .sidebar {
        transform: none;
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 60;
        inset: 64px 0 0;
        display: block;
        visibility: hidden;
        background: rgba(3, 11, 24, 0.52);
        opacity: 0;
        transition: opacity 180ms ease, visibility 180ms ease;
    }

    body.sidebar-open .sidebar-backdrop {
        visibility: visible;
        opacity: 1;
    }

    .workspace {
        margin-left: 0;
    }

    .workspace-header {
        padding: 11px 17px;
    }

    .workspace-actions .button-label {
        display: none;
    }

    .workspace-actions .button {
        width: 38px;
        padding: 0;
    }

    .main-content {
        padding: 20px 16px 100px;
    }

    .hero-card {
        grid-template-columns: 1fr;
    }

    .hero-runtime {
        margin-top: 0;
    }

    .form-grid,
    .form-grid.three {
        grid-template-columns: 1fr;
    }

    .side-help {
        grid-template-columns: 1fr;
    }

    .mcp-workspace {
        grid-template-columns: 1fr;
    }

    .mcp-server-panel {
        position: static;
    }

    .two-column-admin {
        grid-template-columns: 1fr;
    }

    .kb-stat-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kb-stat-strip > div:nth-child(3) {
        border-left: 0;
    }

    .kb-stat-strip > div:nth-child(n + 3) {
        border-top: 1px solid var(--line);
    }

    .mcp-server-list {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }
}

@media (max-width: 560px) {
    .section-heading {
        display: block;
    }

    .heading-badge {
        margin-top: 12px;
    }

    .hero-main {
        padding: 23px 20px;
    }

    .hero-title {
        font-size: 23px;
    }

    .hero-runtime {
        margin: 0 13px 13px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .kb-stat-strip {
        grid-template-columns: 1fr;
    }

    .kb-stat-strip > div + div,
    .kb-stat-strip > div:nth-child(3) {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .kb-dropzone {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .kb-search-form {
        grid-template-columns: 1fr;
    }

    .kb-search-result-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .panel-body {
        padding: 16px;
    }

    .mcp-subsection {
        padding: 16px;
    }

    .mcp-server-list {
        grid-template-columns: 1fr;
    }

    .service-list {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .path-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .admin-toolbar {
        align-items: stretch;
    }

    .admin-toolbar input,
    .admin-toolbar select,
    .admin-toolbar .button {
        width: 100%;
    }

    .admin-table {
        min-width: 560px;
    }
}
