/* 亚马逊 FIST 模拟端联调控制台样式（无构建依赖，纯静态） */
:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #f1f5f9;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg);
  color: #e2e8f0;
}

.topbar .brand { font-weight: 600; letter-spacing: .3px; }
.topbar .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok); margin-right: 6px;
}
.topbar .host { color: #94a3b8; font-size: 12px; }

.layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(460px, 1fr);
  gap: 14px;
  padding: 14px;
  align-items: start;
}

@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px 16px;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px;
}
.panel-head h2 { margin: 0; font-size: 15px; }

/* ── 左栏 Tab（实时收包 / 历史记录） ── */
.tabs { display: flex; gap: 4px; }
.tab {
  border: 1px solid transparent; border-bottom: none; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; padding: 6px 12px;
  border-radius: 8px 8px 0 0; cursor: pointer;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); background: #eff6ff; border-color: var(--line); }

.hist-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.hist-tools select, .hist-tools input { width: auto; margin-top: 0; }
.hist-tools #hist-keyword { flex: 1; min-width: 180px; }

/* 方向徽标：IN=JMTMS 打进来，OUT=控制台发出去 */
.dir {
  border-radius: 4px; padding: 0 6px; font-size: 11px; font-weight: 700;
  font-family: Consolas, monospace; letter-spacing: .5px;
}
.dir.in { background: #e0f2fe; color: #0369a1; }
.dir.out { background: #fef3c7; color: #b45309; }
.packet-cost { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

.tools { display: flex; align-items: center; gap: 10px; }
/* 复选框走独立规则，避免被下方 input 的整宽/输入框样式命中 */
.switch {
  display: inline-flex; align-items: center; gap: 5px;
  margin: 0; color: var(--muted); font-size: 12px;
}
.switch input[type="checkbox"] { width: auto; margin: 0; }


.hint { color: var(--muted); font-size: 12px; margin-bottom: 8px; }

.btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { opacity: .92; color: #fff; }
.btn.ghost { background: transparent; }
.btn.warn { border-color: var(--warn); color: var(--warn); }
.btn:active { transform: translateY(1px); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

/* ── 收包记录 ── */
.packet-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 190px); overflow: auto; }

.packet {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  background: #fff;
}
.packet:hover { border-color: var(--brand); }
.packet-head { display: flex; align-items: center; gap: 8px; font-family: Consolas, monospace; font-size: 12.5px; }
.packet-time { color: var(--muted); white-space: nowrap; }
.packet-method { font-weight: 700; color: var(--brand); }
.packet-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status { border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; background: #e2e8f0; color: var(--muted); }
.status.ok { background: #dcfce7; color: var(--ok); }
.status.bad { background: #fee2e2; color: var(--bad); }

.packet-detail { margin-top: 8px; display: none; }
.packet.open .packet-detail { display: block; }
.packet-detail h4 { margin: 6px 0 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.packet-detail pre {
  margin: 0; padding: 8px; border-radius: 6px; background: var(--bg); color: #d1e3ff;
  font: 12px/1.45 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 220px; overflow: auto;
}

.empty { color: var(--muted); text-align: center; padding: 26px 0; }

/* ── 发送面板 ── */
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10px 0;
  padding: 10px 12px 12px;
}
fieldset legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; }

label { display: block; font-size: 12px; color: var(--muted); margin: 6px 0; }
input:not([type="checkbox"]), select, textarea {
  display: block; width: 100%; margin-top: 3px;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
  font: 13px Consolas, "Microsoft YaHei", monospace; color: var(--ink); background: #fff;
}
input:not([type="checkbox"]):focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.grid-method { display: grid; grid-template-columns: 100px 1fr; gap: 10px; }
@media (max-width: 640px) {
  .grid2, .grid3, .grid-method { grid-template-columns: 1fr; }
}

.resp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.resp-body {
  margin: 0; padding: 10px; border-radius: 8px; background: var(--bg); color: #d1e3ff;
  font: 12px/1.5 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
  min-height: 90px; max-height: 320px; overflow: auto;
}
