/* ============================================================
   AI智能编码 — "AI 指挥中心 / 赛博终端" 主题
   深空暗色 · 蓝图网格 · 青→紫霓虹渐变 · 玻璃拟态 · 等宽科技字体
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
    /* base surfaces */
    --bg-0: #06080f;
    --bg-1: #0a0d18;
    --bg-2: #10141f;
    --panel: rgba(17, 23, 42, 0.55);
    --panel-2: rgba(22, 29, 51, 0.7);
    --stroke: rgba(120, 165, 255, 0.12);
    --stroke-2: rgba(120, 165, 255, 0.28);

    /* neon accents */
    --cyan: #2dd4ff;
    --blue: #4d7cff;
    --violet: #9b6dff;
    --magenta: #ff5fd2;
    --lime: #5ef08f;
    --amber: #ffc24b;
    --red: #ff6b81;

    /* signature gradient */
    --grad: linear-gradient(135deg, #2dd4ff 0%, #4d7cff 45%, #9b6dff 100%);
    --grad-soft: linear-gradient(135deg, rgba(45,212,255,0.18), rgba(155,109,255,0.18));

    /* text */
    --tx-hi: #e9eefb;
    --tx-mid: #9fb0cf;
    --tx-dim: #5e6a85;

    --r: 14px;
    --r-sm: 10px;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --disp: 'Chakra Petch', 'Noto Sans SC', sans-serif;
    --body: 'Noto Sans SC', 'Chakra Petch', system-ui, sans-serif;

    --pulse-color: var(--cyan);
}

* { scrollbar-width: thin; scrollbar-color: #2a3550 #0a0d18; }

html, body { background: var(--bg-0); }

body {
    font-family: var(--body);
    color: var(--tx-hi);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- ambient background: blueprint grid + drifting aurora ---- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(rgba(120,165,255,0.045) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, rgba(120,165,255,0.045) 1px, transparent 1px) 0 0 / 44px 44px,
        radial-gradient(circle at 50% 0%, #0c1020 0%, var(--bg-0) 60%);
    background-color: var(--bg-0);
    mask-image: radial-gradient(circle at 50% 30%, #000 55%, transparent 95%);
}
body::after {
    content: "";
    position: fixed;
    inset: -20%;
    z-index: -1;
    background:
        radial-gradient(380px 380px at 12% 18%, rgba(45,212,255,0.16), transparent 70%),
        radial-gradient(460px 460px at 88% 12%, rgba(155,109,255,0.16), transparent 70%),
        radial-gradient(520px 520px at 70% 88%, rgba(77,124,255,0.12), transparent 70%);
    filter: blur(8px);
    animation: drift 22s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes drift {
    0%   { transform: translate(0,0) scale(1); }
    50%  { transform: translate(-2%, 2%) scale(1.05); }
    100% { transform: translate(2%, -1%) scale(1); }
}

/* fix accidental glyphs from build (defensive) */
body::before { background-color: var(--bg-0); }

/* ============ Typography ============ */
.mono { font-family: var(--mono); }
.disp { font-family: var(--disp); letter-spacing: 0.4px; }
code { color: var(--cyan); font-family: var(--mono); }
.text-muted { color: var(--tx-mid) !important; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: #7fe3ff; }

/* ============ Navbar ============ */
.navbar {
    background: rgba(8, 11, 20, 0.72) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--stroke);
}
.navbar-brand {
    font-family: var(--disp);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 1px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}
.navbar-brand::before {
    content: "◆";
    -webkit-text-fill-color: var(--cyan);
    margin-right: 8px;
    font-size: 0.8em;
    filter: drop-shadow(0 0 6px var(--cyan));
}
.navbar-text, .navbar .small { color: var(--tx-mid) !important; }

/* ============ Glass cards ============ */
.card,
.list-group,
.modal-content {
    background: var(--panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--stroke);
    border-radius: var(--r);
    color: var(--tx-hi);
    box-shadow: 0 12px 40px rgba(3, 6, 16, 0.5);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--stroke);
    color: var(--tx-hi);
    font-family: var(--disp);
    letter-spacing: 0.3px;
}
.card-header strong { font-weight: 600; }
.list-group-flush > .list-group-item { background: transparent; border-color: var(--stroke); color: var(--tx-hi); }
hr { border-color: var(--stroke); opacity: 1; }

/* section headings */
h5, h6 { font-family: var(--disp); }

/* ============ Buttons ============ */
.btn-primary {
    background: var(--grad);
    border: none;
    font-family: var(--disp);
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: var(--r-sm);
    padding: 0.55rem 1.4rem;
    box-shadow: 0 6px 22px rgba(77,124,255,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s;
}
.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow: 0 10px 30px rgba(77,124,255,0.5), 0 0 18px rgba(45,212,255,0.35);
}
.btn-primary:disabled { filter: grayscale(0.4) brightness(0.7); }
.btn-outline-secondary, .btn-outline-danger {
    border-radius: var(--r-sm);
    border-color: var(--stroke-2);
    color: var(--tx-mid);
    background: rgba(255,255,255,0.02);
}
.btn-outline-secondary:hover { background: rgba(255,255,255,0.06); color: var(--tx-hi); border-color: var(--cyan); }
.btn-outline-danger { color: var(--red); border-color: rgba(255,107,129,0.4); }
.btn-outline-danger:hover { background: rgba(255,107,129,0.14); color: #ffd2d9; border-color: var(--red); }
.btn-success {
    background: linear-gradient(135deg, #34d399, #5ef08f);
    border: none; color: #04210f; font-weight: 700;
    border-radius: var(--r-sm);
    box-shadow: 0 6px 22px rgba(94,240,143,0.32);
}
.btn-success:hover { filter: brightness(1.07); color: #04210f; box-shadow: 0 10px 30px rgba(94,240,143,0.45); }

/* ============ Inputs ============ */
.form-control, textarea.form-control {
    background: rgba(8,11,20,0.6);
    border: 1px solid var(--stroke-2);
    color: var(--tx-hi);
    border-radius: var(--r-sm);
    font-family: var(--mono);
}
.form-control::placeholder { color: var(--tx-dim); }
.form-control:focus {
    background: rgba(8,11,20,0.8);
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(45,212,255,0.15), 0 0 18px rgba(45,212,255,0.12);
    color: var(--tx-hi);
}
.form-label { color: var(--tx-mid); font-family: var(--disp); }
.form-text { color: var(--tx-dim) !important; }

/* ============ Badges / status pills ============ */
.badge {
    font-family: var(--mono);
    font-weight: 600;
    letter-spacing: 0.3px;
    border-radius: 20px;
    padding: 0.35em 0.8em;
    border: 1px solid transparent;
}
.badge.bg-secondary { background: rgba(120,140,180,0.16) !important; color: #b9c6df; border-color: rgba(120,140,180,0.3); }
.badge.bg-primary   { background: rgba(77,124,255,0.18) !important;  color: #9bb8ff; border-color: rgba(77,124,255,0.45); box-shadow: 0 0 12px rgba(77,124,255,0.25); }
.badge.bg-success   { background: rgba(94,240,143,0.16) !important;  color: #8ff5b6; border-color: rgba(94,240,143,0.45); box-shadow: 0 0 12px rgba(94,240,143,0.25); }
.badge.bg-warning   { background: rgba(255,194,75,0.16) !important;  color: #ffd884 !important; border-color: rgba(255,194,75,0.5); }
.badge.bg-danger    { background: rgba(255,107,129,0.16) !important; color: #ff9aa8; border-color: rgba(255,107,129,0.5); box-shadow: 0 0 12px rgba(255,107,129,0.25); }

/* ============ index: hero ============ */
.hero {
    text-align: center;
    padding: 64px 16px 28px;
}
.hero-kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--cyan);
    border: 1px solid var(--stroke-2);
    background: rgba(45,212,255,0.06);
    padding: 5px 14px;
    border-radius: 30px;
    margin-bottom: 22px;
}
.hero-kicker .blip {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--lime); box-shadow: 0 0 8px var(--lime);
    animation: live-pulse 1.4s infinite;
}
.hero h1 {
    font-family: var(--disp);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    line-height: 1.05;
    margin: 0 0 16px;
    letter-spacing: 1px;
}
.hero h1 .grad {
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 22px rgba(77,124,255,0.4));
}
.hero p.lead {
    color: var(--tx-mid);
    font-size: 1.05rem;
    max-width: 580px;
    margin: 0 auto;
}

/* model "agents" row */
.agents {
    display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
    margin: 28px auto 8px;
}
.agent {
    display: flex; align-items: center; gap: 10px;
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 30px;
    padding: 8px 16px 8px 10px;
    font-size: 13px;
    backdrop-filter: blur(10px);
}
.agent .orb {
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center;
    font-family: var(--mono); font-size: 11px; font-weight: 700; color: #04121f;
}
.agent .role { color: var(--tx-dim); font-family: var(--mono); font-size: 11px; }
.agent .name { color: var(--tx-hi); font-weight: 600; font-family: var(--disp); }
.agent.deepseek .orb { background: linear-gradient(135deg,#2dd4ff,#4d7cff); box-shadow:0 0 14px rgba(45,212,255,.5); }
.agent.kimi .orb     { background: linear-gradient(135deg,#9b6dff,#ff5fd2); box-shadow:0 0 14px rgba(155,109,255,.5); }
.agent.qwen .orb     { background: linear-gradient(135deg,#5ef08f,#2dd4ff); box-shadow:0 0 14px rgba(94,240,143,.5); }

/* command console (submit card) */
.console-card {
    border: 1px solid var(--stroke-2);
    box-shadow: 0 0 0 1px rgba(45,212,255,0.05), 0 24px 60px rgba(3,6,16,0.6), 0 0 40px rgba(77,124,255,0.08);
    position: relative;
    overflow: hidden;
}
.console-card::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--grad);
    opacity: 0.9;
}
.console-prompt-label {
    font-family: var(--mono); font-size: 12px; color: var(--cyan);
    display: flex; align-items: center; gap: 7px;
}
.console-prompt-label::before { content: "❯"; color: var(--lime); }

/* example chips */
.examples { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
    font-size: 12px;
    font-family: var(--mono);
    color: var(--tx-mid);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--stroke);
    border-radius: 20px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all .15s;
}
.chip:hover { color: var(--cyan); border-color: var(--cyan); background: rgba(45,212,255,0.08); transform: translateY(-1px); }

/* job list rows */
.joblist .list-group-item-action {
    transition: all .15s;
    border-radius: 0;
}
.joblist .list-group-item-action:hover {
    background: rgba(45,212,255,0.05);
    border-left: 2px solid var(--cyan);
    padding-left: calc(1rem - 2px);
}

/* ============ job: header timer ============ */
.timer-big {
    font-family: var(--mono);
    font-weight: 700;
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(77,124,255,0.4));
}

/* ============ Pipeline as glowing timeline ============ */
#stagesList { padding: 6px 4px; }
.stage-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    padding: 10px 14px 10px 6px !important;
    border: none !important;
}
/* vertical connector */
.stage-item::before {
    content: "";
    position: absolute;
    left: 19px; top: 30px; bottom: -10px;
    width: 2px;
    background: linear-gradient(var(--stroke-2), transparent);
}
.stage-item:last-child::before { display: none; }
.stage-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
    background: var(--bg-2);
    color: var(--tx-dim);
    border: 1px solid var(--stroke-2);
    z-index: 1;
    transition: all .3s;
}
.stage-icon.running {
    background: rgba(45,212,255,0.12);
    color: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 0 4px rgba(45,212,255,0.12), 0 0 16px rgba(45,212,255,0.5);
    animation: pulse 1.5s ease-in-out infinite;
}
.stage-icon.completed { background: rgba(94,240,143,0.12); color: var(--lime); border-color: rgba(94,240,143,0.6); box-shadow: 0 0 12px rgba(94,240,143,0.3); }
.stage-icon.failed    { background: rgba(255,107,129,0.12); color: var(--red); border-color: rgba(255,107,129,0.6); }
.stage-icon.skipped   { background: var(--bg-2); color: var(--tx-dim); }
@keyframes pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(0.9);} }

.stage-item .small.text-muted { font-family: var(--mono); font-size: 11px; }

/* ============ Live output (terminal) ============ */
.live-card {
    border: 1px solid var(--stroke-2);
    overflow: hidden;
    border-radius: var(--r);
    box-shadow: 0 0 0 1px rgba(45,212,255,0.04), 0 20px 50px rgba(3,6,16,0.55), 0 0 40px rgba(77,124,255,0.06);
}
.live-titlebar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(20,26,46,0.95), rgba(14,18,32,0.95));
    border-bottom: 1px solid var(--stroke);
}
.live-lights { display: flex; gap: 6px; }
.live-lights .dot { width: 11px; height: 11px; border-radius: 50%; }
.live-lights .red { background:#ff5f56; } .live-lights .yellow{ background:#ffbd2e; } .live-lights .green{ background:#27c93f; }
.live-title { color: var(--tx-hi); font-family: var(--disp); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; letter-spacing: .5px; }
.live-active { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.live-role-chip {
    background: var(--grad); color: #04121f;
    font-family: var(--mono); font-size: 11px; font-weight: 700;
    padding: 2px 11px; border-radius: 20px; letter-spacing: .3px;
    box-shadow: 0 0 14px rgba(77,124,255,0.4);
}
.live-module-chip {
    background: rgba(155,109,255,0.16); color: #cbb6ff;
    border: 1px solid rgba(155,109,255,0.4);
    font-size: 11px; padding: 2px 9px; border-radius: 20px; font-family: var(--mono);
}
.live-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); animation: live-pulse 1.1s ease-in-out infinite; flex-shrink: 0; }
.live-pulse.done { animation: none; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
@keyframes live-pulse {
    0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(45,212,255,0.5); }
    50%     { opacity: .5; box-shadow: 0 0 0 7px rgba(45,212,255,0); }
}
.live-metastrip {
    display: flex; align-items: center; gap: 12px;
    padding: 7px 14px;
    background: rgba(6,8,15,0.7);
    border-bottom: 1px solid var(--stroke);
}
.live-meter { flex: 1; height: 3px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.live-meter-fill { display: block; height: 100%; width: 0%; background: var(--grad); border-radius: 3px; transition: width .4s ease; box-shadow: 0 0 8px rgba(45,212,255,0.5); }
.live-stats { color: var(--tx-dim); font-size: 11.5px; font-family: var(--mono); white-space: nowrap; }
.live-stats b { color: var(--cyan); font-weight: 700; }
.live-stats .sep { margin: 0 4px; opacity: .4; }
.live-output {
    max-height: 440px; min-height: 200px; overflow-y: auto;
    padding: 14px 16px;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
    background: rgba(6,8,15,0.85);
    color: #cdd6e6;
    white-space: pre-wrap; word-break: break-word;
}
.live-output::-webkit-scrollbar { width: 9px; }
.live-output::-webkit-scrollbar-thumb { background: #243049; border-radius: 5px; border: 2px solid rgba(6,8,15,0.85); }
.live-output .live-content { color: #dbe4f4; }
.live-output .live-reasoning {
    color: #6f7d99; font-style: italic;
    border-left: 2px solid rgba(155,109,255,0.4);
    padding-left: 8px;
}
.live-module-tag {
    display: inline-block; margin-right: 7px; padding: 1px 7px;
    background: rgba(155,109,255,0.2); color: #cbb6ff;
    border-radius: 4px; font-size: 10.5px; font-style: normal; font-weight: 700; vertical-align: 1px;
}
.live-cursor { display: inline-block; width: 7px; height: 14px; background: var(--cyan); margin-left: 1px; vertical-align: -2px; animation: blink 1s step-end infinite; border-radius: 1px; box-shadow: 0 0 8px var(--cyan); }
.live-cursor.done { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.live-empty { color: var(--tx-dim); font-size: 12.5px; padding: 28px 8px; text-align: center; }
.live-empty-cursor { display: inline-block; width: 7px; height: 13px; background: var(--tx-dim); vertical-align: -2px; animation: blink 1s step-end infinite; }

/* ============ Event log ============ */
.event-log { max-height: 240px; overflow-y: auto; font-family: var(--mono); font-size: 11.5px; }
.event-log::-webkit-scrollbar { width: 8px; }
.event-log::-webkit-scrollbar-thumb { background: #243049; border-radius: 5px; }
.event-line { padding: 5px 14px; border-bottom: 1px solid var(--stroke); display: flex; gap: 8px; align-items: baseline; }
.event-line:hover { background: rgba(45,212,255,0.04); }
.event-line .ts { color: var(--tx-dim); flex-shrink: 0; }
.event-line .type { color: var(--blue); font-weight: 600; flex-shrink: 0; min-width: 100px; }
.event-line.success .type { color: var(--lime); }
.event-line.error   .type { color: var(--red); }
.event-line.warning .type { color: var(--amber); }
.event-line .payload { color: var(--tx-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.event-line.error .payload { cursor: pointer; text-decoration: underline dotted; }
.event-line.error .payload:hover { color: var(--red); }

/* ============ Quality grade ring ============ */
.quality-card { border: 1px solid var(--stroke-2); box-shadow: 0 0 0 1px rgba(94,240,143,0.05), 0 16px 40px rgba(3,6,16,0.5); }
.q-ring {
    --pct: 0;
    --ring-color: var(--lime);
    width: 92px; height: 92px; border-radius: 50%;
    flex-shrink: 0;
    background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), rgba(255,255,255,0.07) 0);
    display: grid; place-items: center;
    transition: --pct 1s ease;
    position: relative;
}
.q-ring::after {
    content: ""; position: absolute; inset: -3px; border-radius: 50%;
    box-shadow: 0 0 22px var(--ring-color);
    opacity: 0.35; z-index: -1;
}
.q-ring-inner {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--bg-1);
    display: grid; place-items: center; text-align: center;
    border: 1px solid var(--stroke);
}
.q-grade {
    font-family: var(--disp); font-weight: 700; font-size: 26px; line-height: 1;
    color: var(--ring-color, var(--lime));
    text-shadow: 0 0 12px currentColor;
}
.q-score { font-family: var(--mono); font-size: 11px; color: var(--tx-mid); margin-top: 2px; }
.q-score small { font-size: 9px; opacity: 0.6; }
.q-label { font-family: var(--disp); font-size: 1.05rem; font-weight: 600; color: var(--tx-hi); }
.q-sub { font-size: 11.5px; color: var(--tx-dim); margin-top: 4px; }
.q-ring.grade-A, .q-ring.grade-B { --ring-color: var(--lime); }
.q-ring.grade-C { --ring-color: var(--amber); }
.q-ring.grade-D { --ring-color: #ff9a4b; }
@property --pct { syntax: '<number>'; inherits: false; initial-value: 0; }
.metric-anim { transition: color .3s; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.metric-flash { color: var(--cyan) !important; text-shadow: 0 0 10px rgba(45,212,255,0.6); }
.cost-glow {
    font-family: var(--mono); font-weight: 700;
    color: var(--lime);
    text-shadow: 0 0 14px rgba(94,240,143,0.5);
}

/* ============ File tree ============ */
.file-tree { font-family: var(--mono); font-size: 12px; max-height: 320px; overflow-y: auto; }
.file-tree::-webkit-scrollbar { width: 8px; }
.file-tree::-webkit-scrollbar-thumb { background: #243049; border-radius: 5px; }
.file-tree-node { padding: 3px 0; cursor: default; user-select: none; white-space: nowrap; }
.file-tree-node.file { color: var(--cyan); cursor: pointer; }
.file-tree-node.file:hover { color: #8fe7ff; text-shadow: 0 0 8px rgba(45,212,255,0.4); }
.file-tree-node.dir { color: var(--tx-mid); font-weight: 600; }

/* ============ Code modal ============ */
.code-view {
    margin: 0; max-height: 70vh; overflow: auto;
    padding: 1rem; background: rgba(6,8,15,0.9); color: #cdd6e6;
    font-family: var(--mono); font-size: 12px; line-height: 1.5;
    border-radius: var(--r-sm);
}
.modal-header { border-bottom: 1px solid var(--stroke); }
.modal-title { font-family: var(--disp); }
.btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

/* warning alert */
.alert-warning {
    background: rgba(255,194,75,0.08);
    border: 1px solid rgba(255,194,75,0.3);
    color: #ffd884;
    border-radius: var(--r-sm);
}

/* divider line in metric tiles */
.border-end { border-color: var(--stroke) !important; }

/* ============ Responsive ============ */
@media (max-width: 991px) {
    .live-output { max-height: 300px; }
    .event-log { max-height: 180px; }
    .hero { padding: 40px 14px 18px; }
}
