:root {
  --bg: #070d18;
  --panel: #0b1322;
  --panel-2: #0e1829;
  --panel-3: #121f33;
  --line: #1a2740;
  --line-2: #24344f;
  --txt: #e9eff9;
  --txt-2: #a9b7cd;
  --txt-3: #71819b;
  --blue: #4a86f7;
  --blue-dim: rgba(74, 134, 247, 0.12);
  --green: #2fbf71;
  --amber: #dfa45e;
  --violet: #9aa0ff;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, #10203a 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #101a33 0%, transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #1e2c45; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #2a3d5c; }
::-webkit-scrollbar-track { background: transparent; }

.app { height: 100vh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 24, 41, 0.9), rgba(9, 15, 26, 0.7));
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #2f6ff0, #1b46b8);
  box-shadow: 0 4px 14px rgba(47, 111, 240, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-size: 16px; font-weight: 700; color: #fff;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: 0.5px; line-height: 1.15; }
.brand-sub { font-size: 8.5px; letter-spacing: 2px; color: var(--violet); opacity: 0.85; margin-top: 1px; }

.topbar-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 12.5px; color: var(--txt-2); letter-spacing: 0.3px; white-space: nowrap;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.online-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.16);
}
.doctor-name { font-size: 12.5px; color: var(--txt); }
.me-box { display: flex; align-items: center; gap: 8px; }
.me-txt { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.me-role { font-size: 9.5px; color: var(--txt-3); }

.avatar {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600;
  color: var(--ac);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-2);
}
@supports (background: color-mix(in srgb, red 10%, transparent)) {
  .avatar {
    background: color-mix(in srgb, var(--ac) 14%, transparent);
    border-color: color-mix(in srgb, var(--ac) 42%, transparent);
  }
}
.avatar-doctor { width: 28px; height: 28px; font-size: 11.5px; }

.ghost-btn {
  font-size: 11.5px; color: var(--txt-2);
  border: 1px solid var(--line-2); border-radius: 7px;
  padding: 5px 10px; transition: 0.15s;
  background: rgba(255, 255, 255, 0.02);
}
.ghost-btn:hover { color: var(--txt); border-color: #3a5580; background: rgba(255, 255, 255, 0.05); }
.ghost-btn.sm { padding: 4px 9px; font-size: 11px; }

/* ---------- ribbon ---------- */
.ribbon {
  flex: 0 0 32px; height: 32px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  font-size: 11px; color: var(--txt-3);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 14, 25, 0.7);
}
.ribbon b { color: var(--violet); font-weight: 600; }

/* ---------- workspace ---------- */
.workspace {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr) 308px;
}
.col { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.col-patients { border-right: 1px solid var(--line); background: rgba(10, 17, 29, 0.55); }
.col-side { border-left: 1px solid var(--line); background: rgba(10, 17, 29, 0.55); }
.col-chat { background: rgba(9, 15, 26, 0.35); }

.col-head {
  flex: 0 0 auto; height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; font-size: 12.5px; font-weight: 600; color: var(--txt);
  border-bottom: 1px solid var(--line);
}
.col-head em { font-style: normal; font-size: 11px; color: var(--txt-3); font-weight: 500; }

/* ---------- patient list ---------- */
.patient-list { flex: 1 1 auto; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.patient {
  display: flex; gap: 10px; text-align: left;
  padding: 10px; border-radius: var(--radius);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.018);
  transition: 0.16s;
}
.patient:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.patient.active {
  background: linear-gradient(180deg, rgba(74, 134, 247, 0.16), rgba(74, 134, 247, 0.06));
  border-color: rgba(74, 134, 247, 0.55);
  box-shadow: 0 0 0 1px rgba(74, 134, 247, 0.12), 0 6px 18px rgba(0, 0, 0, 0.25);
}
.p-main { min-width: 0; flex: 1; }
.p-row1 { display: flex; align-items: center; gap: 6px; }
.p-name { font-size: 12.5px; font-weight: 600; color: var(--txt); }
.p-meta { font-size: 10.5px; color: var(--txt-3); margin-top: 4px; line-height: 1.5; }
.p-status { font-size: 10.5px; margin-top: 2px; color: var(--amber); }
.p-status.in { color: #74a6f5; }
.p-status.ok { color: var(--green); }

.tag {
  font-size: 9.5px; padding: 1px 5px; border-radius: 4px; line-height: 1.5;
  border: 1px solid var(--line-2); color: var(--txt-2); margin-left: 2px;
}
.tag-blue { color: #8fb6ff; border-color: rgba(74, 134, 247, 0.4); background: rgba(74, 134, 247, 0.1); }

.col-foot {
  flex: 0 0 auto; padding: 10px 14px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: #5d6c85; line-height: 1.6;
}

/* ---------- chat head ---------- */
.chat-head { flex: 0 0 auto; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.ch-top { display: flex; align-items: center; gap: 10px; }
.ch-name { font-size: 18px; font-weight: 600; letter-spacing: 0.3px; }
.ch-age { font-size: 11.5px; color: var(--txt-2); font-weight: 400; margin-left: 6px; }
.badge {
  font-size: 10.5px; padding: 2px 8px; border-radius: 5px; margin-left: auto;
  border: 1px solid transparent;
}
.badge-warn { color: var(--amber); background: rgba(223, 164, 94, 0.1); border-color: rgba(223, 164, 94, 0.35); }
.badge-info { color: #74a6f5; background: rgba(74, 134, 247, 0.1); border-color: rgba(74, 134, 247, 0.35); }
.badge-ok { color: var(--green); background: rgba(47, 191, 113, 0.1); border-color: rgba(47, 191, 113, 0.35); }
.ch-sub { font-size: 11.5px; color: var(--txt-3); margin-top: 7px; }
.ch-agents { display: flex; align-items: center; gap: 4px; margin-top: 9px; }
.mini-avatar {
  width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center;
  font-size: 9px; font-weight: 600; color: var(--ac);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-2);
}
@supports (background: color-mix(in srgb, red 10%, transparent)) {
  .mini-avatar {
    background: color-mix(in srgb, var(--ac) 16%, transparent);
    border-color: color-mix(in srgb, var(--ac) 40%, transparent);
  }
}
.ch-agents-txt { font-size: 10.5px; color: var(--txt-3); margin-left: 6px; }

/* ---------- toolbar ---------- */
.chat-toolbar {
  flex: 0 0 auto; height: 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; border-bottom: 1px solid var(--line);
}
.seg { display: flex; gap: 2px; background: rgba(255, 255, 255, 0.03); padding: 2px; border-radius: 7px; border: 1px solid var(--line); }
.seg button {
  font-size: 11px; color: var(--txt-3); padding: 3px 11px; border-radius: 5px; transition: 0.15s;
}
.seg button:hover { color: var(--txt-2); }
.seg button.active { background: rgba(74, 134, 247, 0.2); color: #cfe0ff; box-shadow: inset 0 0 0 1px rgba(74, 134, 247, 0.35); }

/* ---------- timeline ---------- */
.timeline { flex: 1 1 auto; overflow-y: auto; padding: 6px 18px 18px; }
.date-sep {
  text-align: center; font-size: 10.5px; color: #5f6f88;
  margin: 14px 0 6px; letter-spacing: 0.3px;
}
.date-sep span {
  display: inline-block; padding: 3px 12px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
}
.msg { display: flex; gap: 10px; padding: 9px 0; }
.msg.enter { animation: rise 0.28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.s-cursor {
  display: inline-block; width: 2px; height: 13px; margin-left: 2px; vertical-align: -2px;
  background: #7fb0ff; animation: cur 0.85s steps(1) infinite;
}
@keyframes cur { 50% { opacity: 0; } }

.metrics, .bubble-foot, .summary-card { animation: rise 0.3s ease both; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 6px; }
.msg-name { font-size: 12px; font-weight: 600; color: #dbe6f7; }
.msg-role { font-size: 10px; color: var(--txt-3); }
.msg-time { margin-left: auto; font-size: 10.5px; color: #5f6f88; font-variant-numeric: tabular-nums; }

.bubble {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px; line-height: 1.75; color: #d9e3f2;
  max-width: 660px;
}
.msg-own .bubble {
  border-color: rgba(74, 134, 247, 0.3);
  background: linear-gradient(180deg, rgba(74, 134, 247, 0.13), rgba(74, 134, 247, 0.05));
  color: #e2ecff;
}
.mention { color: #8fb8ff; font-weight: 500; }

.metrics { display: flex; gap: 8px; margin-top: 10px; }
.metric {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.032);
  display: flex; align-items: baseline; gap: 8px;
}
.metric .k { font-size: 10px; color: var(--txt-3); }
.metric .v { margin-left: auto; font-size: 12.5px; color: var(--txt); font-weight: 600; white-space: nowrap; }
.metric .v b { font-size: 13.5px; color: #eaf2ff; font-variant-numeric: tabular-nums; }
.metric .v i { font-style: normal; font-size: 10.5px; color: var(--txt-3); margin-left: 3px; font-weight: 400; }

.bubble-foot { display: flex; align-items: center; gap: 10px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed rgba(255, 255, 255, 0.07); }
.bubble-note { font-size: 10px; color: var(--txt-3); }
.src-btn { margin-left: auto; font-size: 10.5px; color: #7fa8ec; padding: 2px 4px; border-radius: 4px; }
.src-btn:hover { color: #b9d3ff; background: rgba(74, 134, 247, 0.14); }

.summary-card {
  max-width: 660px; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(47, 191, 113, 0.26);
  background: linear-gradient(180deg, rgba(47, 191, 113, 0.07), rgba(255, 255, 255, 0.02));
}
.summary-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; }
.summary-title { font-size: 13px; font-weight: 600; color: #eaf3ff; }
.summary-body { padding: 8px 12px 12px; font-size: 12.5px; color: #d3dfee; line-height: 1.7; }
.summary-body ul { margin: 8px 0 0; padding-left: 16px; }
.summary-body li { margin-bottom: 3px; font-size: 12px; color: #c3d1e4; }
.review-bar { display: flex; align-items: center; gap: 8px; padding: 0 12px 12px; }
.primary-btn {
  font-size: 11.5px; color: #fff; padding: 6px 14px; border-radius: 7px;
  background: linear-gradient(180deg, #2f6ff0, #2559ca);
  box-shadow: 0 4px 12px rgba(47, 111, 240, 0.3);
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:disabled { background: rgba(47, 191, 113, 0.16); color: var(--green); box-shadow: none; cursor: default; }
.hint { font-size: 10.5px; color: var(--txt-3); }

.typing { display: flex; gap: 4px; align-items: center; padding: 9px 12px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: #6f86ab; animation: blink 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-right .icon-btn { width: 28px; height: 28px; border: 1px solid var(--line-2); border-radius: 7px; }
.toolbar-right .icon-btn:hover { border-color: #3a5580; background: rgba(255, 255, 255, 0.05); color: var(--txt-2); }

.empty { padding: 50px 0; text-align: center; color: #5b6a83; font-size: 12px; line-height: 2.1; }
.empty b { color: #8fb6ff; font-weight: 600; }

.sys-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; }
.sys-row.enter { animation: rise 0.3s ease both; }
.pending-cell { color: #6d7d96; font-size: 10px; }
.sys-row::before, .sys-row::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, rgba(47, 191, 113, 0.28), transparent);
}
.sys-row span {
  font-size: 10.5px; color: #6fbf94; letter-spacing: 0.3px;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
  border: 1px solid rgba(47, 191, 113, 0.24); background: rgba(47, 191, 113, 0.07);
}

/* ---------- composer ---------- */
.composer { flex: 0 0 auto; padding: 8px 18px 14px; border-top: 1px solid var(--line); background: rgba(8, 14, 25, 0.6); }
.quick-row { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.chip {
  font-size: 10.5px; color: var(--txt-2); padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.025);
}
.chip:hover { color: #cfe0ff; border-color: rgba(74, 134, 247, 0.45); background: rgba(74, 134, 247, 0.1); }
.composer-box {
  position: relative; display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); border-radius: 9px; padding: 4px 4px 4px 8px;
  background: rgba(255, 255, 255, 0.03);
}
.composer-box:focus-within { border-color: rgba(74, 134, 247, 0.5); box-shadow: 0 0 0 3px rgba(74, 134, 247, 0.08); }
.icon-btn {
  width: 26px; height: 26px; border-radius: 6px; color: var(--txt-3); font-size: 14px;
  display: grid; place-items: center;
}
.icon-btn:hover { color: #9dbcf5; background: rgba(74, 134, 247, 0.12); }
#chat-input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--txt); font-size: 12.5px; padding: 6px 2px;
}
#chat-input::placeholder { color: #5d6c85; }
.send-btn {
  font-size: 11.5px; color: #fff; padding: 6px 14px; border-radius: 7px;
  background: linear-gradient(180deg, #2f6ff0, #2559ca);
}
.send-btn:hover { filter: brightness(1.08); }
.mention-menu {
  display: none; position: absolute; bottom: 44px; left: 0; min-width: 220px; z-index: 12;
  background: #101b2c; border: 1px solid var(--line-2); border-radius: 9px; padding: 5px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}
.mention-menu.show { display: block; }
.mention-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 6px; text-align: left; }
.mention-item:hover { background: rgba(74, 134, 247, 0.14); }
.mention-item span { font-size: 11.5px; color: #d6e2f3; }
.mention-item em { font-style: normal; font-size: 10px; color: var(--txt-3); margin-left: auto; }

/* ---------- side panel ---------- */
.side-tabs { flex: 0 0 auto; height: 44px; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.side-tabs button { font-size: 12px; color: var(--txt-3); padding: 12px 0; position: relative; }
.side-tabs button.active { color: var(--txt); font-weight: 600; }
.side-tabs button.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--blue); border-radius: 2px;
}
.side-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 24px; }

.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sec-title { font-size: 12px; font-weight: 600; color: var(--txt); }
.sec-count { font-size: 10.5px; color: var(--txt-3); }
.sec-action { margin-left: auto; font-size: 10.5px; color: #7fa8ec; }
.sec-action:hover { color: #b9d3ff; }

.agent-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 6px; border-radius: 8px; transition: 0.15s;
}
.agent-row:hover { background: rgba(255, 255, 255, 0.035); }
.ar-main { min-width: 0; flex: 1; }
.ar-name { font-size: 11.5px; color: #dbe6f7; font-weight: 500; }
.ar-desc { font-size: 10px; color: var(--txt-3); margin-top: 3px; line-height: 1.5; }
.ar-cap {
  font-size: 9.5px; color: #74849e; border: 1px solid var(--line-2);
  padding: 1px 5px; border-radius: 4px; flex: 0 0 auto;
}

.divider { height: 1px; background: var(--line); margin: 16px 0 14px; }

.progress-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.step { display: flex; align-items: center; gap: 6px; padding: 5px 2px; font-size: 11px; color: var(--txt-3); }
.step .idx {
  width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 9px;
  border: 1px solid var(--line-2); color: #6d7d96;
}
.step.done { color: #c2d2e6; }
.step.done .idx { border-color: transparent; color: var(--green); font-size: 11px; }
.step.current { color: #eaf2ff; }
.step.current .idx { border-color: rgba(74, 134, 247, 0.6); background: rgba(74, 134, 247, 0.18); color: #9fc3ff; }
.step.pulse .idx { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(74, 134, 247, 0.4); } 50% { box-shadow: 0 0 0 5px rgba(74, 134, 247, 0); } }
.progress-note {
  margin-top: 12px; font-size: 10.5px; color: var(--txt-2); line-height: 1.7;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}

.sum-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: rgba(255, 255, 255, 0.022); margin-bottom: 12px; }
.sb-title { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sb-title .badge { margin-left: auto; }
.sb-sub { font-size: 10.5px; color: var(--txt-3); margin-top: 6px; line-height: 1.6; }
.kv { display: flex; gap: 8px; font-size: 11px; padding: 4px 0; }
.kv span { color: var(--txt-3); flex: 0 0 72px; }
.kv b { font-weight: 500; color: #d5e1f0; }
table.mini { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 10.5px; }
table.mini th { text-align: left; color: var(--txt-3); font-weight: 500; padding: 5px 4px; border-bottom: 1px solid var(--line); }
table.mini td { padding: 6px 4px; color: #cfdcec; border-bottom: 1px dashed rgba(255, 255, 255, 0.05); font-variant-numeric: tabular-nums; }

.log-item { display: flex; gap: 8px; padding: 6px 0; font-size: 10.5px; color: var(--txt-2); line-height: 1.6; }
.log-time { color: #64748d; flex: 0 0 36px; font-variant-numeric: tabular-nums; }
.log-dot { width: 4px; height: 4px; border-radius: 50%; background: #3f5473; margin-top: 7px; flex: 0 0 auto; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(3, 7, 14, 0.68);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px;
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 100%); max-height: 84vh; overflow: auto;
  background: linear-gradient(180deg, #101c2e, #0c1524);
  border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: rise 0.2s ease both;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 13.5px; font-weight: 600; }
.modal-sub { font-size: 10.5px; color: var(--txt-3); margin-top: 3px; }
.modal-close { margin-left: auto; width: 26px; height: 26px; border-radius: 6px; color: var(--txt-3); font-size: 16px; }
.modal-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--txt); }
.modal-body { padding: 14px 18px 18px; }
.src-rows { display: flex; flex-direction: column; gap: 2px; }
.src-row { display: flex; gap: 10px; font-size: 11.5px; padding: 5px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.055); }
.src-row span { flex: 0 0 88px; color: var(--txt-3); }
.src-row b { font-weight: 500; color: #d8e4f3; }
pre.raw {
  margin: 12px 0 0; padding: 12px; border-radius: 9px; overflow: auto;
  background: #080f1b; border: 1px solid var(--line);
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 10.5px; line-height: 1.75; color: #8fb0d8;
}
.src-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--green); margin-top: 10px; }
.src-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }

.add-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.add-row .ar-main { flex: 1; }
.add-btn { font-size: 10.5px; color: #9fc3ff; border: 1px solid rgba(74, 134, 247, 0.4); padding: 3px 10px; border-radius: 6px; }
.add-btn:hover { background: rgba(74, 134, 247, 0.15); }
.add-btn:disabled { color: #5a6a83; border-color: var(--line-2); cursor: default; }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; z-index: 55;
  background: linear-gradient(180deg, #0f1a2b, #0a1220);
  border-left: 1px solid var(--line-2);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
  transform: translateX(102%); transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px 30px; }
.fg { margin-bottom: 14px; }
.fg-title { font-size: 11.5px; font-weight: 600; color: #9dbcf5; margin-bottom: 6px; letter-spacing: 0.3px; }
.fg li { font-size: 11px; color: var(--txt-2); line-height: 1.85; list-style: none; position: relative; padding-left: 12px; }
.fg li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 3px; height: 3px; border-radius: 50%; background: #3f5473; }
.fg ul { margin: 0; padding: 0; }

/* ---------- toast ---------- */
.toast-root { position: fixed; top: 62px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  font-size: 11.5px; color: #dfeaf8; padding: 8px 14px; border-radius: 8px;
  border: 1px solid rgba(74, 134, 247, 0.35); background: rgba(16, 28, 46, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.22s ease both;
}
.toast.ok { border-color: rgba(47, 191, 113, 0.45); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 210px minmax(0, 1fr) 268px; }
  .topbar-title { display: none; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .col-side { display: none; }
}
