:root {
    --bg: #f4f0e9;
    --surface: rgba(255, 252, 247, 0.94);
    --surface-strong: #fffdfa;
    --surface-soft: #f7f1ea;
    --ink: #1a1b1f;
    --ink-soft: #5f5a54;
    --ink-muted: #8a857f;
    --stroke: rgba(125, 117, 108, 0.16);
    --nav: #17191f;
    --nav-stroke: rgba(255, 255, 255, 0.08);
    --terminal: #111318;
    --purple-a: #7568d7;
    --purple-b: #8ca2ff;
    --blue-soft: rgba(157, 177, 216, 0.16);
    --pink-soft: rgba(220, 198, 208, 0.18);
    --green-soft: rgba(120, 173, 138, 0.14);
    --shadow: 0 26px 70px rgba(39, 31, 24, 0.08);
    --shadow-soft: 0 16px 40px rgba(40, 32, 24, 0.06);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(220, 198, 208, 0.28), transparent 30%),
        radial-gradient(circle at bottom right, rgba(168, 189, 219, 0.3), transparent 32%),
        linear-gradient(180deg, #f7f3ed 0%, #f1ece5 100%);
    color: var(--ink);
    font-family: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.36) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.36) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: 0.22;
    pointer-events: none;
}

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

button {
    cursor: pointer;
}

.ambient {
    position: fixed;
    border-radius: 999px;
    filter: blur(24px);
    opacity: 0.42;
    pointer-events: none;
}

.ambient-a {
    width: 260px;
    height: 260px;
    background: rgba(165, 182, 221, 0.3);
    top: 8%;
    right: 10%;
}

.ambient-b {
    width: 320px;
    height: 320px;
    background: rgba(221, 199, 209, 0.22);
    left: 5%;
    bottom: 10%;
}

.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr) 380px;
    gap: 20px;
    width: min(1640px, calc(100vw - 36px));
    margin: 18px auto;
    align-items: stretch;
}

.sidebar,
.terminal-panel,
.card {
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
}

.sidebar {
    background: linear-gradient(180deg, var(--nav) 0%, #1d2028 100%);
    color: #f6f4f0;
    border-radius: 36px;
    padding: 18px 14px;
    border-color: var(--nav-stroke);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand-block {
    display: grid;
    gap: 12px;
    justify-items: center;
    text-align: center;
}

.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    font-family: "Manrope", sans-serif;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--purple-a), var(--purple-b));
}

.brand-copy {
    display: grid;
    gap: 4px;
}

.brand-copy strong {
    font-size: 0.88rem;
}

.brand-copy span,
.sidebar-footer span {
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.58);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-pill {
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 13px 8px;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-pill:hover,
.nav-pill.is-active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-1px);
}

.nav-icon {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(145, 164, 255, 0.72));
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 12px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 6px;
}

.sidebar-label,
.mini-label,
.topbar-kicker,
.metric-label,
.field span,
.efun-path,
.terminal-toolbar,
.inline-foot {
    font-size: 0.78rem;
    color: var(--ink-muted);
    font-weight: 600;
}

.workspace {
    min-width: 0;
    display: grid;
    gap: 18px;
}

.card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.97) 0%, rgba(249, 244, 238, 0.95) 100%);
    border-radius: 30px;
    padding: 22px;
}

.card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 30%);
    pointer-events: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.topbar h1,
.hero-card h2,
.section-head h2,
.terminal-head h2 {
    margin: 0;
    font-family: "Manrope", sans-serif;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.topbar h1 {
    font-size: 2rem;
}

.topbar-kicker {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.topbar-actions,
.hero-actions,
.inline-actions,
.inline-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-badge,
.ghost-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid var(--stroke);
}

.status-badge {
    background: rgba(137, 156, 205, 0.16);
    color: #485c82;
}

.status-badge.dark {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.88);
}

.ghost-tag {
    background: rgba(255, 255, 255, 0.68);
    color: var(--ink-soft);
}

.main-column {
    display: grid;
}

.view {
    display: none;
}

.view.is-active {
    display: grid;
    gap: 18px;
}

.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.hero-card h2 {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.primary-btn,
.ghost-btn,
.op-btn {
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 12px 18px;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--purple-a), var(--purple-b));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 16px 28px rgba(118, 106, 218, 0.28);
}

.ghost-btn {
    background: rgba(255, 255, 255, 0.74);
    color: var(--ink-soft);
    border-color: rgba(125, 117, 108, 0.15);
    font-weight: 700;
}

.ghost-btn.small,
.primary-btn.compact,
.op-btn {
    padding: 10px 14px;
    border-radius: 14px;
}

.ghost-btn.dark {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.88);
}

.primary-btn:hover,
.ghost-btn:hover,
.op-btn:hover {
    transform: translateY(-1px);
}

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

.metric-card {
    padding: 20px;
}

.metric-value {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
    font-family: "Manrope", sans-serif;
    letter-spacing: -0.04em;
}

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

.compact-card {
    padding: 18px 20px;
}

.inline-value {
    display: block;
    margin-top: 6px;
    font-size: 1rem;
    line-height: 1.55;
}

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

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

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

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

.field {
    display: grid;
    gap: 8px;
}

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

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid rgba(125, 117, 108, 0.16);
    border-radius: 16px;
    padding: 13px 14px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--ink);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field textarea {
    resize: vertical;
    min-height: 180px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(118, 106, 218, 0.34);
    box-shadow: 0 0 0 4px rgba(118, 106, 218, 0.08);
    background: rgba(255, 255, 255, 0.95);
}

.switch {
    position: relative;
    display: inline-flex;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch span {
    width: 54px;
    height: 32px;
    border-radius: 999px;
    background: rgba(126, 116, 108, 0.18);
    position: relative;
}

.switch span::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 8px 16px rgba(31, 24, 18, 0.12);
    transition: transform 160ms ease;
}

.switch input:checked + span {
    background: linear-gradient(135deg, var(--purple-a), var(--purple-b));
}

.switch input:checked + span::after {
    transform: translateX(22px);
}

.band-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(118, 106, 218, 0.12);
    overflow: hidden;
    margin-top: 18px;
}

.band-track span {
    display: block;
    height: 100%;
    width: 6%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--purple-a), var(--purple-b));
}

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

.efun-ops-card,
.efun-main-card {
    min-height: 640px;
}

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

.op-btn {
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.68);
    border-color: rgba(125, 117, 108, 0.12);
    color: var(--ink-soft);
    font-weight: 700;
}

.op-btn.is-active {
    background: rgba(140, 162, 255, 0.16);
    border-color: rgba(118, 106, 218, 0.22);
    color: #4c5f84;
}

.efun-path {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(125, 117, 108, 0.12);
    word-break: break-all;
}

.efun-form {
    margin-bottom: 18px;
}

.efun-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.efun-summary span {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(125, 117, 108, 0.12);
    font-size: 0.78rem;
    color: var(--ink-soft);
    font-weight: 700;
}

.result-panel {
    min-height: 340px;
    border-radius: 20px;
    background: #14171d;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 18px;
}

.result-panel pre {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
    line-height: 1.65;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-panel {
    position: sticky;
    top: 18px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 16px;
    padding: 22px 20px;
    min-height: calc(100vh - 36px);
    border-radius: 36px;
    background: linear-gradient(180deg, var(--terminal) 0%, #171b23 100%);
    color: rgba(255, 255, 255, 0.96);
    border-color: rgba(255, 255, 255, 0.08);
}

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

.terminal-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.56);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.term-led {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #74da8e;
    box-shadow: 0 0 0 5px rgba(116, 218, 142, 0.14);
}

.toolbar-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.12);
}

.terminal-output {
    min-height: 0;
    overflow: auto;
    display: grid;
    gap: 10px;
    padding-right: 4px;
}

.terminal-output::-webkit-scrollbar {
    width: 8px;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.log-entry {
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.log-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.log-tone {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
}

.log-tone-info { color: #b7c7ff; }
.log-tone-success { color: #98d5aa; }
.log-tone-error { color: #ffb0aa; }
.log-tone-warn { color: #f0c98f; }

.log-time {
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.74rem;
}

.log-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.82rem;
    line-height: 1.6;
    word-break: break-word;
}

.terminal-actions {
    display: grid;
    gap: 10px;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 30;
    min-width: 220px;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(22, 24, 29, 0.95);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 20px 48px rgba(20, 22, 28, 0.28);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1400px) {
    .app-shell {
        grid-template-columns: 96px minmax(0, 1fr) 340px;
    }

    .cards-grid,
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .terminal-panel {
        position: static;
        min-height: 520px;
        grid-column: 1 / -1;
    }
}

@media (max-width: 920px) {
    .app-shell {
        width: min(100vw - 20px, 100%);
        margin: 10px auto 18px;
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        align-items: center;
        border-radius: 28px;
        padding: 16px;
    }

    .brand-block {
        grid-auto-flow: column;
        align-items: center;
        text-align: left;
    }

    .nav-list {
        flex-direction: row;
        flex: 1;
    }

    .nav-pill {
        flex: 1;
        flex-direction: row;
        justify-content: center;
    }

    .sidebar-footer {
        display: none;
    }

    .topbar,
    .hero-card,
    .section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .cards-grid,
    .metrics-grid,
    .overview-grid,
    .efun-layout,
    .form-grid,
    .form-grid-compact {
        grid-template-columns: 1fr;
    }
}
