.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--grad-brand);
  color: #fff;
  font-weight: 750;
  letter-spacing: .04em;
}

/* ---------- 侧栏 ---------- */

.nav { flex: 1; align-content: start; overflow: auto; }
.rail-foot { margin-top: auto; }
.nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--rail-text);
  font-weight: 550;
  text-align: left;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.nav button .i { color: var(--rail-dim); transition: color var(--dur-1); }
.nav button:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav button[aria-current="page"] {
  background: var(--rail-active);
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-tint) 16%, transparent);
}
.nav button[aria-current="page"] .i { color: var(--brand-tint); }
.nav button[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--grad-brand);
  box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 80%, transparent);
}
.nav-label { margin-top: 10px; }
.nav-label:first-child { margin-top: 0; }
.rail-tools.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rail-btn .i { width: 15px; height: 15px; }
.rail-btn span { font-size: 12.5px; }

.pool-pill { border: 0; cursor: pointer; }
.pool-pill:hover { filter: brightness(.97); }

.banner {
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line));
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn);
}

.banner.danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--tone-soft, var(--brand-soft));
  color: var(--tone, var(--brand));
  font-size: 13px;
  line-height: 1.55;
}
.notice .i { flex: none; width: 16px; height: 16px; margin-top: 2px; }
#agent-update:empty { display: none; }

/* ---------- 通用 ---------- */

.intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.intro p { max-width: 72ch; color: var(--text-2); }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.vstack { display: grid; gap: 16px; }
.row, .checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel-head .meta { margin-top: 2px; }
.panel-head .toolbar-left .input { width: auto; }
.panel-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.inline-icon { display: inline-flex; align-items: center; gap: 5px; }
.inline-icon .i { width: 14px; height: 14px; }
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); }
.danger-text { color: var(--danger); }
.btn.ghost.danger-text { color: var(--danger); }
.btn.ghost.danger-text:hover:not(:disabled) { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--line-strong)); }
.icon-only { width: 30px; padding: 0; }

button.kpi { width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; }
button.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }

.empty.compact { padding: 32px 20px; }

.field.search { width: min(280px, 100%); }
.field.search .input { height: 34px; }
.seg .n { margin-left: 2px; }

.label .hint-text { color: var(--text-3); font-size: 12px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { display: grid; gap: 14px; }
.form-section + .form-section { padding-top: 18px; border-top: 1px solid var(--line); }
.form-section h4 { font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .04em; }
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.label .select, .modal .select { width: 100%; max-width: none; }
.intro-actions .input[type="date"] { height: 38px; }

/* ---------- 弹窗和提示 ---------- */

.modal form:focus { outline: none; }
.modal.mid { width: min(560px, calc(100vw - 32px)); }
.modal.wide { width: min(760px, calc(100vw - 32px)); }
.modal form { max-height: calc(100vh - 48px); overflow: auto; }
.modal-body { display: grid; gap: 14px; margin-top: 6px; }
.modal .form-error { margin-top: 4px; }
.toast[data-tone] .toast-icon { background: var(--tone-soft); color: var(--tone); }

.choice-list { display: grid; gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  color: var(--text);
  transition: border-color var(--dur-1), background var(--dur-1);
}
.choice:hover { border-color: var(--tone, var(--brand)); background: var(--tone-soft, var(--brand-soft)); }
.choice-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--tone-soft); color: var(--tone); }
.choice b { display: block; font-weight: 650; }
.choice small { display: block; color: var(--text-3); font-size: 12.5px; }

.copy-box {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--line);
  font: 13px/1.8 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- 端口工作台 ---------- */

.workbench {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: stretch;
}
.ports-panel, .conversation, .sms-pane {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 72px);
  min-height: 560px;
}
.ports-scroll { flex: 1; min-height: 0; overflow: auto; }
.pool-tabs { padding: 12px 14px 0; }
.pool-tabs .seg { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.pool-tabs .seg button { flex: none; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filter-chips .chip { height: 28px; gap: 6px; padding: 0 10px 0 9px; font-size: 12px; }
.slot-group + .slot-group { border-top: 1px solid var(--line); }
.slot-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 0; color: var(--text-2); font-size: 12.5px; font-weight: 650; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; padding: 10px 14px 14px; }
.slot-chip {
  position: relative;
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 74px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color var(--dur-1), box-shadow var(--dur-1), background var(--dur-1), transform var(--dur-1);
}
.slot-chip:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.slot-chip.is-empty { border-style: dashed; background: var(--surface-2); }
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.slot-no { font-size: 15px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.slot-ico { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 7px; background: var(--tone-soft); color: var(--tone); }
.slot-ico .i { width: 13px; height: 13px; stroke-width: 2; }
.slot-com { overflow: hidden; color: var(--text-2); font: 600 11px/1.3 var(--font-mono); white-space: nowrap; text-overflow: ellipsis; }
.slot-tag { overflow: hidden; color: var(--text-3); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.slot-chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.slot-chip[aria-pressed="true"] .slot-ico { background: var(--brand); color: #fff; }
.slot-flag {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--surface);
}
.slot-chip.is-busy .slot-ico { animation: busy 1.4s var(--ease) infinite; }
@keyframes busy { 50% { opacity: .45; } }

.conv-head { display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.conv-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 13px; background: var(--tone-soft); color: var(--tone); }
.conv-icon .i { width: 21px; height: 21px; }
.conv-title { flex: 1; min-width: 0; }
.conv-title > b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.conv-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; color: var(--text-3); font-size: 12.5px; }
.conv-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.conv-meta .i { width: 13px; height: 13px; }
.conv-meta .err-inline { color: var(--danger); }
.conv-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; }
.bars-mini { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.bars-mini i { display: block; width: 3px; border-radius: 1px; background: var(--line-strong); }
.bars-mini i:nth-child(1) { height: 4px; }
.bars-mini i:nth-child(2) { height: 7px; }
.bars-mini i:nth-child(3) { height: 10px; }
.bars-mini i:nth-child(4) { height: 12px; }
.bars-mini i.on { background: var(--ok); }

.messages { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--surface-2); }
.chat-empty { display: grid; justify-items: center; gap: 8px; margin: auto; max-width: 40ch; color: var(--text-3); text-align: center; }
.chat-empty .empty-icon { margin-bottom: 2px; background: var(--surface); border: 1px solid var(--line); }
.chat-empty b { color: var(--text); font-size: 15px; font-weight: 650; }
.bubble { max-width: min(560px, 86%); padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble.out.is-error { background: var(--danger-soft); color: var(--danger); }
.bubble small { display: block; margin-top: 4px; color: var(--text-3); font-size: 11.5px; }
.bubble.out small { color: rgba(255, 255, 255, .78); }
.bubble.out.is-error small { color: var(--danger); }

.composer { display: grid; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.composer-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--tone-soft, var(--surface-3));
  color: var(--tone, var(--text-2));
  font-size: 13px;
  line-height: 1.5;
}
.composer-note .i { flex: none; width: 15px; height: 15px; margin-top: 2px; }
.quick-replies { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quick-replies > span { margin-right: 2px; color: var(--text-3); font-size: 12px; }
.quick-reply {
  max-width: 240px;
  height: 30px;
  padding: 0 11px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: border-color var(--dur-1), background var(--dur-1);
}
.quick-reply b { margin-right: 5px; color: var(--brand); font-family: var(--font-mono); }
.quick-reply:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.quick-reply:disabled { opacity: .5; cursor: not-allowed; }
#composer .input:disabled { background: var(--surface-3); cursor: not-allowed; }
.composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.composer-tools .select { min-width: 160px; height: 32px; font-size: 13px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 6px; }
.composer-line { display: flex; gap: 8px; }
.composer-line .input { flex: 1; min-width: 0; }
.composer-hint, .composer .form-error { margin: 0; }

.sms-list { flex: 1; min-height: 0; overflow: auto; padding: 4px 18px 16px; }
.sms-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sms-item:last-child { border-bottom: 0; }
.sms-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sms-top b { font-size: 13px; font-weight: 650; }
.sms-top time { color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.sms-item p { margin-top: 4px; color: var(--text-2); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
button.code, .code {
  padding: 1px 6px;
  border: 0;
  border-radius: 6px;
  background: var(--ok-soft);
  color: var(--ok);
  font: 700 13px var(--font-mono);
  letter-spacing: .04em;
  cursor: pointer;
}
button.code:hover { box-shadow: inset 0 0 0 1px var(--ok); }

/* ---------- 列表行 ---------- */

.sms-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.sms-row:last-child { border-bottom: 0; }
.sms-row.is-unread { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.sms-row .todo-icon { width: 36px; height: 36px; }
.sms-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sms-row-head b { font-weight: 650; }
.sms-row-head span { color: var(--text-3); font-size: 12.5px; }
.sms-row p { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sms-row-side { display: grid; justify-items: end; gap: 6px; }
.sms-row-side time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-cell b { display: block; font-weight: 650; }
.slot-summary { max-width: 340px; color: var(--text-2); font-size: 13px; line-height: 1.5; }

/* ---------- 总览 ---------- */

.pool-list { display: grid; }
.pool-line { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.pool-line:last-child { border-bottom: 0; }
.pool-line .todo-text small { white-space: normal; }
.balance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 16px 20px 20px; }
.balance-card { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); text-align: left; color: var(--text); }
.balance-card:hover { border-color: var(--brand); }
.balance-card b { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.balance-card small { color: var(--text-3); font-size: 12px; }
.setup-steps { display: grid; }
.setup-step { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.setup-step:last-child { border-bottom: 0; }
.setup-step > i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-style: normal; font-weight: 750; }
.setup-step.is-done > i { background: var(--ok-soft); color: var(--ok); }
.setup-step.is-done b { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.setup-step b { display: block; font-weight: 650; }
.setup-step.check-step > i { background: var(--tone-soft); color: var(--tone); }
.setup-step > i .i { width: 18px; height: 18px; }
.cell-sub[data-tone] { color: var(--tone); }
.setup-step small { display: block; color: var(--text-3); font-size: 12.5px; }

/* ---------- 猫池 ---------- */

.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.pool-card { display: grid; gap: 16px; align-content: start; padding: 18px 20px 20px; }
.pool-card-head { display: flex; align-items: center; gap: 12px; }
.pool-ico { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 13px; background: var(--tone-soft); color: var(--tone); }
.pool-ico .i { width: 21px; height: 21px; }
.pool-card-head .grow { min-width: 0; }
.pool-card-head b { display: block; font-size: 16px; font-weight: 700; }
.pool-card-head small { display: block; overflow: hidden; color: var(--text-3); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.pool-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pool-stats > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.pool-stats b { display: block; font-size: 19px; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pool-stats b[data-tone] { color: var(--tone); }
.pool-stats small { color: var(--text-3); font-size: 11.5px; }
.pool-meta { display: grid; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.pool-meta span { display: flex; align-items: center; gap: 8px; }
.pool-meta .i { width: 14px; height: 14px; color: var(--text-3); }
.pool-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.pool-add {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 260px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--text-3);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1);
}
.pool-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.pool-add .empty-icon { background: var(--surface); border: 1px solid var(--line); }
.pool-add b { color: var(--text); font-size: 15px; }

/* ---------- 连接程序 ---------- */

.agent-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 22px 24px; background: linear-gradient(120deg, var(--brand-soft), var(--surface) 62%); }
.agent-hero h3 { font-size: 17px; font-weight: 700; }
.agent-hero p { margin-top: 3px; color: var(--text-2); font-size: 13px; }
.agent-hero .connect-copy { align-items: center; }
.agent-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; color: var(--text-3); font-size: 12.5px; }
.agent-status span { display: inline-flex; align-items: center; gap: 5px; }
.agent-status .i { width: 13px; height: 13px; }
.agent-download { display: grid; justify-items: end; gap: 6px; }
.agent-download small { color: var(--text-3); font-size: 12px; }
.install-steps { display: grid; padding: 4px 20px 8px; }
.install-step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.install-step:last-child { border-bottom: 0; }
.install-step > i { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.install-step > i em { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; font: 700 10.5px/1 var(--font-sans); font-style: normal; box-shadow: 0 0 0 2px var(--surface); }
.install-step b { display: block; font-weight: 650; }
.install-step span { display: block; margin-top: 2px; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.install-step code { padding: 1px 6px; border-radius: 5px; background: var(--surface-3); font: 12px var(--font-mono); }
.com-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.com-toggle { height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-full); background: var(--surface); color: var(--text-2); font: 600 12px var(--font-mono); }
.com-toggle[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.token-box { display: flex; align-items: center; gap: 8px; }
.token-box code { flex: 1; min-width: 0; padding: 9px 12px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--line); overflow: hidden; font: 12.5px var(--font-mono); white-space: nowrap; text-overflow: ellipsis; }
.faq { padding: 4px 20px 10px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--text-3); font-size: 18px; font-weight: 500; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 14px; color: var(--text-2); font-size: 13px; line-height: 1.65; }
.file-list { display: grid; padding: 6px 20px 12px; }
.file-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.file-list li:last-child { border-bottom: 0; }
.file-list .i { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }
.file-list b { font-family: var(--font-mono); font-size: 12.5px; }
.file-list span { display: block; color: var(--text-3); font-size: 12.5px; }

/* ---------- 子账户 ---------- */

.role-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role-card { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); text-align: left; color: var(--text); }
.role-card b { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.role-card small { color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.role-card[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.slot-picker { display: grid; gap: 12px; }
.picker-pool { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.picker-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.picker-head b { font-size: 13px; font-weight: 650; }
.picker-head small { margin-left: 6px; color: var(--text-3); font-size: 12px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; max-height: 236px; overflow: auto; padding: 10px 12px; }
.pick {
  display: grid;
  place-items: center;
  align-content: center;
  height: 46px;
  padding: 0 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}
.pick small { overflow: hidden; max-width: 100%; color: var(--text-3); font: 500 10px var(--font-mono); white-space: nowrap; text-overflow: ellipsis; }
.pick[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.pick[aria-pressed="true"] small { color: rgba(255, 255, 255, .82); }
.picker-off { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--text-3); font-size: 13px; text-align: center; }
.password-line { display: flex; gap: 8px; }
.password-line .input { flex: 1; min-width: 0; font-family: var(--font-mono); }

/* ---------- 站点 ---------- */

.shortcut-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.save-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow-2); backdrop-filter: blur(10px); }

/* ---------- 引导 ---------- */

.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.glossary { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0; margin: 0; padding: 6px 20px 12px; }
.glossary dt, .glossary dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); }
.glossary dt { font-weight: 650; }
.glossary dd { color: var(--text-2); font-size: 13px; line-height: 1.6; }
.glossary dt:nth-last-child(2), .glossary dd:last-child { border-bottom: 0; }
.agent-download .btn.sm { margin-top: 2px; }

/* ---------- 可搜索下拉 ---------- */

.combo { position: relative; }
.combo-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  overscroll-behavior: contain;
}
.combo-item { display: grid; gap: 1px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; }
.combo-item b { font-size: 13.5px; font-weight: 600; }
.combo-item small { color: var(--text-3); font-size: 12px; }
.combo-item:hover, .combo-item.is-active { background: var(--brand-soft); }
.combo-empty { padding: 12px; color: var(--text-3); font-size: 13px; }

/* ---------- 指令 ---------- */

.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.check-line { display: flex; align-items: flex-start; gap: 10px; color: var(--text-2); font-size: 13px; cursor: pointer; }
.check-line input { margin-top: 2px; }
.cmd-code { padding: 3px 8px; border-radius: 6px; background: var(--surface-3); font: 600 13px var(--font-mono); white-space: nowrap; }
.table tr.is-off td { color: var(--text-3); }
.table tr.is-off .cmd-code { opacity: .6; }
.order-cell { gap: 4px; flex-wrap: nowrap; }
.table-note { padding: 10px 20px; border-top: 1px solid var(--line); }
.notice .btn { flex: none; margin-left: auto; }
.banner.info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------- 手机 ---------- */

button, .btn, .input, a { touch-action: manipulation; }
.nav .nav-more, .conv-head .mobile-back { display: none; }
.modal.sheet { width: min(460px, calc(100vw - 32px)); }
.sheet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sheet-grid + .sheet-grid { padding-top: 12px; border-top: 1px solid var(--line); }
.sheet-tile {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}
.sheet-tile .i { width: 20px; height: 20px; color: var(--brand); }
.sheet-tile.danger-text .i { color: var(--danger); }
.sheet-tile.is-current { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- 响应式 ---------- */

@media (max-width: 1280px) {
  .workbench { grid-template-columns: 320px minmax(0, 1fr); }
  .sms-pane { grid-column: 1 / -1; height: auto; min-height: 0; max-height: 420px; }
}

@media (max-width: 960px) {
  .nav { width: 100%; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); overflow: visible; }
  .nav button { flex-direction: column; justify-content: center; gap: 3px; height: 54px; padding: 0 4px; font-size: 11px; white-space: nowrap; }
  .nav button[data-view]:not([data-primary]) { display: none; }
  .nav .nav-more { display: flex; }
  .nav button[aria-current="page"]::before { left: 32%; right: 32%; top: -7px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .nav button .nav-count { position: absolute; top: 4px; left: calc(50% + 6px); height: 17px; min-width: 17px; margin: 0; padding: 0 5px; font-size: 10px; }
  .topbar { height: calc(var(--topbar-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .ports-panel, .conversation, .sms-pane { height: auto; min-height: 0; }
  .ports-scroll { max-height: 440px; }
  .messages { min-height: 280px; max-height: 56vh; }
  .agent-hero { grid-template-columns: minmax(0, 1fr); }
  .agent-download { justify-items: start; }
  .save-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .slot-chip:hover { transform: none; box-shadow: none; }
}

@media (max-width: 760px) {
  .input, select.input, textarea.input { font-size: 16px; }
  .form-grid, .role-pick { grid-template-columns: minmax(0, 1fr); }
  .pool-grid, .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .pool-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg { display: flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button { flex: none; }
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filter-chips .chip { flex: none; }
  .field.search { width: 100%; }
  .intro-actions { width: 100%; }
  .intro-actions .btn { flex: 1; }

  .workbench[data-pane="list"] .conversation,
  .workbench[data-pane="list"] .sms-pane,
  .workbench[data-pane="chat"] .ports-panel { display: none; }
  .ports-scroll { max-height: none; }
  .conv-head .mobile-back { display: inline-flex; flex: none; }
  .conversation { height: auto; min-height: 0; }
  .messages { max-height: none; min-height: 46vh; padding: 12px; }
  .composer {
    position: sticky;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 6;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    background: var(--surface);
    box-shadow: 0 -10px 18px -14px rgba(0, 0, 0, .45);
  }
  .bubble { max-width: 92%; }
  .conv-head { flex-wrap: wrap; gap: 10px; min-height: 0; padding: 10px 12px; }
  .conv-icon { width: 36px; height: 36px; }
  .conv-title > b { font-size: 14px; }
  .conv-meta { font-size: 12px; gap: 2px 10px; }
  .conv-actions { width: 100%; justify-content: flex-start; }
  .composer { gap: 8px; padding: 10px 12px; }
  .composer-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .composer-tools .select { flex: none; min-width: 132px; max-width: 46vw; }
  .shortcuts { flex-wrap: nowrap; }
  .shortcuts .btn { flex: none; }
  .composer-line { flex-wrap: nowrap; }
  .composer-line .btn span { display: none; }
  .composer-line .btn { width: 44px; padding: 0; }
  .composer-hint { display: none; }
  .quick-reply { max-width: 100%; height: 34px; }

  .sms-row { grid-template-columns: minmax(0, 1fr); }
  .sms-row .todo-icon { display: none; }
  .sms-row-side { justify-items: start; grid-auto-flow: column; justify-content: start; align-items: center; }
  .shortcut-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .sheet-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .modal, .modal.mid, .modal.wide, .modal.sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
  }
  .modal form { max-height: 88dvh; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal[open] { animation: sheet-up var(--dur-3) var(--ease); }
  .modal-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); margin: 8px -16px calc(-16px - env(safe-area-inset-bottom)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .combo-list { max-height: 46vh; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); }
  .table.stack td .cell-actions { justify-content: flex-start; }
  #view-commands .table.stack tr { display: flex; flex-direction: column; }
  #view-commands .table.stack td.lead { order: -1; }
}

@keyframes sheet-up { from { opacity: 0; transform: translateY(32px); } }
