:root {
  --ink: #14213d;
  --muted: #6d778b;
  --line: #e5e9f0;
  --panel: #ffffff;
  --canvas: #f4f6fa;
  --navy: #111c35;
  --blue: #2864dc;
  --blue-soft: #eaf1ff;
  --green: #0e9f6e;
  --green-soft: #e7f8f1;
  --orange: #c96b18;
  --orange-soft: #fff3e5;
  --red: #c63c4a;
  --red-soft: #ffebee;
  --shadow: 0 14px 40px rgba(19, 32, 58, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: #7180a0; font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: white; background: linear-gradient(145deg, #386fef, #183f9f); font-weight: 800; box-shadow: 0 9px 22px rgba(40,100,220,.24); }
.brand-mark.small { display: inline-grid; width: 34px; height: 34px; border-radius: 11px; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #edf3ff, transparent 34%), radial-gradient(circle at 85% 80%, #e8f7f2, transparent 32%), #f6f7fb; }
.login-card { width: min(440px, 100%); padding: 44px; border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.login-card h1 { margin: 14px 0 8px; font-size: 30px; }
.login-card form { margin-top: 28px; }
label { display: block; margin-bottom: 8px; color: #38445e; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #d7dce7; border-radius: 10px; color: var(--ink); background: white; outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,100,220,.12); }
button { border: 0; border-radius: 10px; }
.primary { padding: 11px 18px; color: white; background: var(--blue); font-weight: 700; }
.primary:hover { background: #1f55c4; }
.secondary { padding: 10px 15px; border: 1px solid #d8deea; color: #33405a; background: white; font-weight: 650; }
.danger { padding: 8px 12px; color: var(--red); background: var(--red-soft); font-weight: 650; }
.wide { width: 100%; margin-top: 18px; }
.form-error { min-height: 18px; margin: 12px 0 0; color: var(--red); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; color: white; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; font-size: 17px; font-weight: 760; }
.version { margin: 8px 0 28px 54px; color: #8290ad; font-size: 11px; }
nav { display: grid; gap: 5px; overflow-y: auto; padding-right: 2px; }
nav button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: #aeb8ce; text-align: left; background: transparent; }
nav button:hover, nav button.active { color: white; background: rgba(255,255,255,.09); }
nav button span { width: 18px; font-size: 17px; text-align: center; }
.nav-divider { margin: 15px 13px 5px; color: #72809f; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-foot { display: grid; gap: 12px; margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.status-dot { color: #72e2ba; font-size: 12px; }
.text-button { padding: 0; color: #9da9c2; text-align: left; background: none; font-size: 12px; }
main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 94px; padding: 22px 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.82); backdrop-filter: blur(10px); }
.topbar h2 { margin: 0; font-size: 25px; }
.top-actions { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.content { padding: 28px 34px 44px; }
.notice { margin: 18px 34px 0; padding: 12px 16px; border-radius: 10px; color: #166846; background: var(--green-soft); font-size: 13px; }
.notice.error { color: #9f2835; background: var(--red-soft); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card, .panel { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 5px 18px rgba(20,33,61,.035); }
.card { padding: 20px; }
.card .label { color: var(--muted); font-size: 12px; }
.card .value { margin-top: 10px; font-size: 29px; font-weight: 780; letter-spacing: -.03em; }
.card .hint { margin-top: 8px; color: #8791a3; font-size: 11px; }
.panel { margin-top: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-body { padding: 20px; }
.split { display: grid; grid-template-columns: 1.3fr .7fr; gap: 18px; }
.status-list { display: grid; gap: 13px; }
.status-row { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 12px; font-size: 12px; }
.bar { height: 7px; overflow: hidden; border-radius: 99px; background: #eef1f6; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 16px; color: #778298; text-align: left; white-space: nowrap; background: #fafbfc; font-weight: 650; }
td { padding: 14px 16px; border-top: 1px solid #edf0f4; vertical-align: middle; }
tbody tr:hover { background: #fbfcff; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 11px; }
.truncate { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 99px; color: #4f5b72; background: #eef1f6; font-size: 11px; font-weight: 700; }
.badge.completed, .badge.succeeded, .badge.authorized, .badge.approved, .badge.active { color: #087552; background: var(--green-soft); }
.badge.failed, .badge.revoked, .badge.rejected { color: #a82d3b; background: var(--red-soft); }
.badge.awaiting_approval, .badge.pending, .badge.expired { color: #9b5515; background: var(--orange-soft); }
.badge.running, .badge.created { color: #2459bd; background: var(--blue-soft); }
.filters { display: grid; grid-template-columns: 1fr 180px auto; gap: 10px; }
.empty { padding: 44px 20px; color: var(--muted); text-align: center; }
.inline-form { display: grid; grid-template-columns: 1fr 120px 110px auto; gap: 10px; align-items: end; }
.knowledge-form { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.knowledge-form .full { grid-column: 1 / -1; }
.customer-create-form { grid-template-columns: 1fr 1fr 1fr 110px auto !important; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 10px; background: #f7f8fb; font-size: 12px; }
.check-row input { width: 16px; min-height: auto; }
.lab-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
.memory-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.memory-card h3 { margin: 0 0 14px; }
.memory-list { display: grid; gap: 10px; }
.memory-list div { padding: 10px; border-radius: 9px; background: #f7f8fb; font-size: 12px; }
.memory-list span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.chat-panel { display: flex; flex-direction: column; min-height: 600px; border: 1px solid var(--line); border-radius: 16px; background: white; overflow: hidden; }
.chat-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-stream { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 350px; max-height: 520px; overflow-y: auto; padding: 20px; background: #f7f8fb; }
.bubble { max-width: 78%; padding: 12px 14px; border-radius: 14px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.bubble.inbound { align-self: flex-start; border-bottom-left-radius: 4px; background: white; }
.bubble.draft { align-self: flex-end; border-bottom-right-radius: 4px; color: #17396f; background: #dfebff; }
.bubble small { display: block; margin-top: 6px; color: #8190a9; font-size: 9px; }
.composer { padding: 16px; border-top: 1px solid var(--line); }
.composer .actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.human-alert { padding: 11px 13px; border-radius: 10px; color: #9b5515; background: var(--orange-soft); font-size: 12px; }
.one-time-code { margin-top: 14px; padding: 14px; border: 1px dashed #8ba8e9; border-radius: 11px; background: var(--blue-soft); word-break: break-all; }
.one-time-code strong { display: block; margin-bottom: 7px; }
.link-button { padding: 0; color: var(--blue); background: none; font-weight: 650; }
dialog { width: min(880px, calc(100% - 40px)); max-height: 86vh; padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 30px 100px rgba(10,20,40,.28); }
dialog::backdrop { background: rgba(11,20,38,.5); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); background: white; }
.dialog-head h3 { margin: 0; }
.icon-button { width: 34px; height: 34px; color: #5d687d; background: #f1f3f7; font-size: 21px; }
#detail-content { padding: 22px 24px 30px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.detail-item { padding: 12px; border-radius: 10px; background: #f7f8fb; }
.detail-item span { display: block; color: var(--muted); font-size: 10px; }
.detail-item strong { display: block; margin-top: 5px; font-size: 12px; word-break: break-all; }
.action-step { margin-top: 12px; padding: 14px; border-left: 3px solid var(--blue); border-radius: 4px 10px 10px 4px; background: #f8faff; }
.action-step pre { max-height: 220px; overflow: auto; padding: 10px; border-radius: 8px; background: #eef2f8; white-space: pre-wrap; word-break: break-word; font-size: 10px; }
.spark-bars { display: flex; align-items: end; gap: 8px; min-height: 170px; padding-top: 18px; }
.spark { position: relative; flex: 1; min-width: 20px; max-width: 52px; border-radius: 6px 6px 2px 2px; background: linear-gradient(#5b87ed, #2864dc); }
.spark span { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 9px; white-space: nowrap; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, 1fr); } .split, .lab-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .app-shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } nav { grid-template-columns: repeat(2, 1fr); } .sidebar-foot { display: none; } .topbar, .content { padding-left: 18px; padding-right: 18px; } .top-actions .muted { display: none; } .cards { grid-template-columns: 1fr; } .inline-form, .filters, .customer-create-form { grid-template-columns: 1fr !important; } .detail-grid { grid-template-columns: 1fr; } }
