/* ==========================================================
   BLE 串口配置终端 — 样式表（浅色主题 / 桌面优先）
   ========================================================== */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-2: #475569;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
  --radius: 10px;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", "Microsoft YaHei Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  flex: 0 0 auto;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .28);
}

.brand-text h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand-text p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---------------- 通用控件 ---------------- */
.btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

/* 危险操作：断开连接 */
.btn-danger {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 600;
}
.btn-danger:hover:not(:disabled) {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}
.btn-danger:disabled { background: #fef2f2; border-color: #fecaca; color: #fca5a5; }

.btn-ghost { background: transparent; border-style: dashed; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text-2);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill-on { background: #ecfdf5; border-color: #86efac; color: #15803d; }
.pill-on .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.pill-busy { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
.pill-busy .dot { background: var(--warn); animation: blink 1s infinite; }
.pill-off { background: #f1f5f9; border-color: var(--border-strong); color: var(--muted); }
.pill-err { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.pill-err .dot { background: var(--err); }

@keyframes blink { 50% { opacity: .25; } }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-off { background: #94a3b8; }
.dot-on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.dot-err { background: var(--err); box-shadow: 0 0 0 3px rgba(220,38,38,.16); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .3px;
  display: flex; align-items: center; gap: 6px;
}
.card-title::before {
  content: "";
  width: 3px; height: 13px;
  border-radius: 2px;
  background: var(--accent);
}

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}

.hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.kv { display: grid; grid-template-columns: 78px 1fr; gap: 6px 10px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }
.mono { font-family: var(--mono); font-size: 11.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 可折叠分组 ---------------- */
.collapsible {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  overflow: hidden;
}
.coll-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--text-2);
  text-align: left;
}
.coll-head:hover { background: var(--accent-soft); }
.coll-title { flex: 0 0 auto; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.coll-value {
  flex: 1 1 auto;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right;
}
.coll-arrow {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  transition: transform .15s ease;
}
.collapsible.open .coll-arrow { transform: rotate(180deg); }
.collapsible.open .coll-head { border-bottom: 1px solid var(--border); }
.coll-body { padding: 10px; }
.coll-body .field:first-child { margin-top: 0; }
.coll-body .field-row:first-child { margin-top: 0; }

/* ---------------- 设备信息（结构化） ---------------- */
.dev-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.dev-avatar {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.dev-head.live .dev-avatar { color: #fff; background: linear-gradient(135deg, #2563eb, #0ea5e9); border-color: transparent; }
.dev-head-text { flex: 1 1 auto; min-width: 0; }
.dev-name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dev-sub {
  font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.switches { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.sw { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.sw input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.sw-inline { font-size: 12px; }

.btn-grid { display: flex; gap: 8px; margin-top: 10px; }
.btn-grid .btn { flex: 1; }

/* 屏幕容器：终端层与空状态层叠放 */
.screen-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  padding: 10px 14px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  /* 默认不折行：保留交换机回显的原始列对齐，便于鼠标跨行选中复制 */
  white-space: pre;
  word-break: normal;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}
.screen.wrap { white-space: pre-wrap; word-break: break-all; }
.screen .ln { min-height: 1.5em; }

/* ---- 未连接时的空状态 ---- */
.screen-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 24px;
  text-align: center;
  background: var(--panel);
  color: var(--muted);
}
.screen-empty.hidden { display: none; }
.es-icon { color: var(--border-strong); }
.es-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.es-desc { font-size: 12.5px; color: var(--muted); max-width: 420px; line-height: 1.7; }
.es-status {
  font-size: 11.5px; color: var(--muted);
  font-family: var(--mono);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.screen-empty .btn { margin-top: 4px; }

/* ---- 内联输入行：光标跟随回显，与 SecureCRT / PuTTY 一致 ---- */
.input-line { display: inline-block; }
.typed { white-space: pre; }
.caret {
  position: relative;
  display: inline-block;
  width: .58em;
  height: 1.05em;
  vertical-align: text-bottom;
  margin-left: -1px;
  background: currentColor;
  animation: caret-blink 1.05s steps(1, end) infinite;
}
.caret.idle {
  background: transparent;
  box-shadow: inset 0 0 0 1px currentColor;
  animation: none;
}
@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }

/* 隐藏的真实输入框：承载键盘输入与中文输入法，光标位置由 .caret 决定 */
.hidden-input {
  position: absolute;
  left: 0; top: 0;
  width: 12px;
  height: 1.2em;
  padding: 0; margin: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  opacity: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  pointer-events: none;
  z-index: 3;
}
.screen::selection, .screen .ln::selection { background: #3b6fd4; color: #fff; }

.banner {
  padding: 9px 18px;
  font-size: 12.5px;
  border-bottom: 1px solid transparent;
}
.banner-warn { background: #fffbeb; color: #92400e; border-bottom-color: #fde68a; }
.banner-err { background: #fef2f2; color: #991b1b; border-bottom-color: #fecaca; }
.banner a { color: inherit; }

/* ---------------- 布局 ---------------- */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 322px minmax(0, 1fr) 392px;
  gap: 12px;
  padding: 12px;
}
.col { min-width: 0; min-height: 0; }
.col-left, .col-right { overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.col-main { display: flex; }

/* 滚动条 */
.col-left::-webkit-scrollbar, .col-right::-webkit-scrollbar,
.log-list::-webkit-scrollbar, .cmd-list::-webkit-scrollbar { width: 9px; }
.col-left::-webkit-scrollbar-thumb, .col-right::-webkit-scrollbar-thumb,
.log-list::-webkit-scrollbar-thumb, .cmd-list::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 6px; border: 2px solid transparent; background-clip: content-box;
}

/* ---------------- 终端 ---------------- */
.terminal {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.term-toolbar {
  flex: 0 0 auto;
  height: 40px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.term-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.term-dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.term-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.term-tools { display: flex; align-items: center; gap: 8px; }

.mini-select, .mini-input {
  height: 28px;
  font-size: 12px;
  padding: 0 8px;
  width: auto;
}
.mini-input.num { width: 74px; }
.mini-label { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

.drop-banner {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #991b1b;
  font-size: 12.5px;
}

.screen::-webkit-scrollbar-thumb { background: #475569; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }

.screen.theme-dark { background: #0d1520; color: #d5dee9; }
.screen.theme-dark::-webkit-scrollbar-thumb { background: #475569; }
.screen.theme-light { background: #ffffff; color: #1e293b; }
.screen.theme-light::-webkit-scrollbar-thumb { background: #cbd5e1; }

.screen .tx { color: #7dd3fc; }
.screen.theme-light .tx { color: #0369a1; }
.screen .sys { color: #f0abfc; font-style: normal; }
.screen.theme-light .sys { color: #a21caf; }
.screen .err { color: #fca5a5; }
.screen.theme-light .err { color: #b91c1c; }
.screen .ok { color: #86efac; }
.screen.theme-light .ok { color: #15803d; }

.c-black { color: #64748b; }  .screen.theme-dark .c-black { color: #556070; }
.c-red { color: #b91c1c; }    .screen.theme-dark .c-red { color: #f87171; }
.c-green { color: #15803d; }  .screen.theme-dark .c-green { color: #4ade80; }
.c-yellow { color: #a16207; } .screen.theme-dark .c-yellow { color: #facc15; }
.c-blue { color: #1d4ed8; }   .screen.theme-dark .c-blue { color: #60a5fa; }
.c-magenta { color: #a21caf; } .screen.theme-dark .c-magenta { color: #e879f9; }
.c-cyan { color: #0e7490; }   .screen.theme-dark .c-cyan { color: #22d3ee; }
.c-white { color: #334155; }  .screen.theme-dark .c-white { color: #e2e8f0; }
.b { font-weight: 700; }

/* 终端内注释/提示行 */
.screen .sys { opacity: .95; }

/* ---------------- 右栏 ---------------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tab:hover { background: var(--panel-2); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.badge {
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px; font-weight: 700;
  display: inline-grid; place-items: center;
}

.tab-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-tools .mini-input { flex: 1 1 120px; }

.cmd-list { max-height: calc(100vh - 330px); overflow-y: auto; }
.cmd-group { margin-bottom: 12px; }
.cmd-group-title {
  position: sticky; top: 0;
  background: var(--panel);
  padding: 5px 0;
  font-size: 12px; font-weight: 700; color: var(--muted);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 6px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.cmd-group-dev {
  flex: 0 0 auto;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  padding: 1px 6px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.cmd-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 6px 6px 8px;
  border-radius: 7px;
  border-left: 3px solid transparent;
}
.cmd-item:hover { background: var(--panel-2); border-left-color: var(--accent); }
.cmd-meta { flex: 1 1 auto; min-width: 0; }
.cmd-name { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.cmd-ver {
  flex: 0 0 auto;
  font-size: 10px; font-weight: 600;
  padding: 0 5px; border-radius: 4px;
  color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
}
.cmd-code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmd-desc {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}
.cmd-acts { display: flex; gap: 5px; flex: 0 0 auto; }
.cmd-empty { padding: 18px 6px; text-align: center; color: var(--muted); font-size: 12.5px; }

.log-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.log-tab {
  position: relative;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.log-tab:hover { color: var(--text-2); }
.log-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.log-list {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}
.log-row {
  display: grid;
  grid-template-columns: 58px 40px 1fr;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid #eef2f7;
  align-items: start;
}
.log-row:last-child { border-bottom: none; }
.log-row.op { grid-template-columns: 132px 1fr; }   /* 操作日志：完整时间戳 年-月-日 时:分:秒 */
.log-time { color: var(--muted); }
.log-row.op .log-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-row.op .log-body { color: var(--text-2); }
.log-dir { font-weight: 700; }
.log-dir.tx { color: #0369a1; }
.log-dir.rx { color: #15803d; }
.log-body { white-space: pre-wrap; word-break: break-all; color: var(--text-2); }
.log-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 12.5px; }

.script-area {
  width: 100%;
  min-height: 200px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------------- 状态栏 ---------------- */
.statusbar {
  flex: 0 0 auto;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-2);
}
.sb-item { display: inline-flex; align-items: center; gap: 5px; }
.sb-item b { color: var(--text); font-weight: 700; }
.sb-sep { width: 1px; height: 14px; background: var(--border-strong); }
.sb-grow { flex: 1 1 auto; }

/* ---------------- Toast ---------------- */
.toasts {
  position: fixed;
  right: 18px; bottom: 44px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999;
}
.toast {
  min-width: 240px; max-width: 380px;
  padding: 10px 14px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 30px rgba(15,23,42,.16);
  font-size: 12.5px;
  color: var(--text);
  display: flex; gap: 9px; align-items: flex-start;
  animation: slidein .18s ease-out;
}
.toast::before { content: ""; width: 4px; align-self: stretch; border-radius: 3px; background: var(--accent); }
.toast.ok::before { background: var(--ok); }
.toast.warn::before { background: var(--warn); }
.toast.err::before { background: var(--err); }
.toast-title { font-weight: 700; display: block; margin-bottom: 2px; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

.hidden { display: none !important; }

/* ==========================================================
   响应式：窄屏单列 + 移动端（手机 / 平板）适配
   ========================================================== */
@media (max-width: 1280px) {
  .layout { grid-template-columns: 290px minmax(0, 1fr) 340px; }
}

/* 单列纵向堆叠：页面整体滚动，顶栏吸顶 */
@media (max-width: 1080px) {
  html, body { height: auto; min-height: 100%; }
  body { overflow: visible; }

  .topbar { position: sticky; top: 0; z-index: 30; }

  .layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
    overflow: visible;
  }
  .col-left, .col-right { overflow: visible; }
  .col-main { display: flex; min-width: 0; }

  .terminal { min-height: 60vh; }
  .cmd-list { max-height: 46vh; }
  .log-list { max-height: 46vh; }

  .statusbar { height: auto; min-height: 30px; padding: 5px 12px; flex-wrap: wrap; }
}

/* 手机：放大触控区、收紧字号，避免横向溢出 */
@media (max-width: 768px) {
  /* 顶栏 */
  .topbar { height: auto; min-height: 56px; padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .brand { gap: 9px; min-width: 0; }
  .brand-logo { width: 32px; height: 32px; border-radius: 8px; }
  .brand-text h1 { font-size: 15px; }
  .brand-text p { display: none; }
  .topbar-actions { gap: 8px; }
  /* 顶栏的「导出当前配置」在窄屏隐藏，终端工具栏的「导出配置」承担同一功能 */
  #btnExportConfig { display: none; }

  /* 触控区：主按钮 ≥ 44px，次按钮 ≥ 34px */
  .btn { height: 42px; padding: 0 14px; font-size: 14px; }
  .btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
  .btn-grid { gap: 10px; }
  .btn-grid .btn { min-height: 44px; }
  .tabs .tab { height: 40px; font-size: 13.5px; }
  .log-tab { padding: 9px 12px; }
  .sw { min-height: 34px; font-size: 13px; }
  .sw input { width: 18px; height: 18px; }

  /* 表单：16px 字号可避免 iOS 聚焦时页面自动放大 */
  input[type="text"], input[type="number"], input[type="search"], select, textarea {
    height: 42px;
    font-size: 16px;
    padding: 0 10px;
  }
  textarea { height: auto; padding: 10px; }
  .mini-select, .mini-input { height: 36px; font-size: 13px; }
  .mini-input.num { width: 84px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .field { margin-bottom: 12px; }

  /* 布局与卡片 */
  .layout { padding: 8px; gap: 10px; }
  .card { padding: 12px; margin-bottom: 10px; }
  .kv { grid-template-columns: 72px 1fr; font-size: 12px; }

  /* 终端：高度自适应，横向仅终端内部滚动，不撑破页面 */
  .terminal { min-height: 54vh; max-width: 100%; }
  .term-toolbar {
    height: auto; min-height: 46px;
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .term-title { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .term-tools { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .screen {
    font-size: 12px;
    padding: 8px 10px 12px;
    -webkit-overflow-scrolling: touch;
    /* 终端内容超宽时只在终端内横向滚动，整页不出现横向滚动条 */
    overflow-x: auto;
    max-width: 100%;
  }
  .screen-empty { padding: 20px 16px; gap: 8px; }
  .es-title { font-size: 14.5px; }
  .es-desc { font-size: 12px; }
  .drop-banner { flex-wrap: wrap; gap: 8px; }

  /* 右栏列表：命令按钮与筛选控件加大热区 */
  .cmd-list, .log-list { max-height: 40vh; }
  .script-area { min-height: 150px; }
  .log-row { grid-template-columns: 52px 34px 1fr; gap: 6px; }
  .log-row.op { grid-template-columns: 112px 1fr; }
  .panel-tools { gap: 8px; }
  .panel-tools .mini-select { flex: 1 1 auto; min-width: 0; }
  .panel-tools .mini-input { flex: 1 1 100%; }   /* 搜索框独占一行，避免与下拉框挤在一起 */
  .cmd-item { padding: 8px 6px 8px 8px; gap: 10px; }
  .cmd-acts { gap: 8px; }
  .cmd-acts .btn { min-width: 62px; }

  /* 状态栏：窄屏隐藏次要技术参数，避免换行堆叠 */
  .statusbar { gap: 10px; padding: 6px 12px; }
  .sb-tech { display: none; }

  /* 提示条 */
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { width: 100%; min-width: 0; max-width: none; }
}
