/*******************************************************************************
 * File Name          : mst-upgrade.css
 * Description        : HX-221C / MST WebUSB DFU 升级工具界面样式（深色工程师风格）
 *                      本文件由 MST/Host/style.css 作用域化而来——所有选择器前缀
 *                      .mst-tool，确保深色主题与变量不会泄漏到站点的浅色主题，
 *                      也不会与站点 Tailwind / 组件类（.btn/.card/.badge 等）冲突。
 *                      若上游 style.css 更新，请重新前缀化同步本文件。
 *******************************************************************************/

.mst-tool {
  --bg:        #0d1117;
  --panel:     #161b22;
  --panel-2:   #1c2128;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --accent:    #58a6ff;
  --ok:        #3fb950;
  --warn:      #d29922;
  --err:       #f85149;
  --radius:    10px;
  --mono:      ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.mst-tool * { box-sizing: border-box; }

/* ------------------------------------------------------------------ topbar */
.mst-tool .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: linear-gradient(180deg, #161b22, #0d1117);
  border-bottom: 1px solid var(--border);
  position: static;          /* 站点已有 sticky 全局头部，工具自带头部改为静态避免重叠 */
  top: auto;
  z-index: auto;
}

.mst-tool .brand { display: flex; align-items: center; gap: 14px; }

.mst-tool .logo {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1f6feb, #58a6ff);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
}

.mst-tool .titles h1 { margin: 0; font-size: 17px; font-weight: 650; }
.mst-tool .titles p  { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.mst-tool .conn { display: flex; align-items: center; gap: 10px; }

/* ------------------------------------------------------------------ badges */
.mst-tool .badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.mst-tool .badge-off  { background: #21262d; color: var(--muted); border-color: var(--border); }
.mst-tool .badge-ok   { background: rgba(63,185,80,.15);  color: var(--ok);  border-color: rgba(63,185,80,.35); }
.mst-tool .badge-warn { background: rgba(210,153,34,.15); color: var(--warn); border-color: rgba(210,153,34,.35); }
.mst-tool .badge-err  { background: rgba(248,81,73,.15);  color: var(--err);  border-color: rgba(248,81,73,.35); }

.mst-tool .tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: #21262d;
  color: var(--muted);
  border: 1px solid var(--border);
}
.mst-tool .tag-app  { background: rgba(88,166,255,.15); color: var(--accent); border-color: rgba(88,166,255,.35); }
.mst-tool .tag-boot { background: rgba(210,153,34,.15); color: var(--warn);   border-color: rgba(210,153,34,.35); }

/* ------------------------------------------------------------------ layout */
.mst-tool .layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px 28px;
  align-items: start;
  max-width: 1500px;
  margin: 0 auto;
}

.mst-tool .col-left, .mst-tool .col-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

@media (max-width: 1000px) {
  .mst-tool .layout { grid-template-columns: minmax(0, 1fr); }
}

/* -------------------------------------------------------------------- card */
.mst-tool .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
}

.mst-tool .card h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mst-tool .hint {
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #6e7681;
}

/* ----------------------------------------------------------------- kv list */
.mst-tool .kv {
  margin: 0;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 6px 12px;
  align-items: baseline;
}
.mst-tool .kv dt { color: var(--muted); font-size: 12px; }
.mst-tool .kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
}

/* ---------------------------------------------------------------- filebox */
.mst-tool .filebox { position: relative; }
.mst-tool .filebox input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.mst-tool .filebox-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  transition: border-color .15s, background .15s;
}
.mst-tool .filebox:hover .filebox-inner {
  border-color: var(--accent);
  background: #1f2733;
}
.mst-tool .filebox-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: #21262d;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  color: var(--accent);
}
.mst-tool .filebox-text { display: flex; flex-direction: column; }
.mst-tool .filebox-text strong { font-size: 13px; }
.mst-tool .filebox-text span { font-size: 11.5px; color: var(--muted); }

.mst-tool .fwinfo {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.mst-tool .fwinfo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mst-tool .fwname { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

/* ----------------------------------------------------------------- buttons */
.mst-tool .btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #21262d;
  color: var(--text);
  padding: 7px 15px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background .13s, border-color .13s, opacity .13s;
  font-family: inherit;
}
.mst-tool .btn:hover:not(:disabled) { background: #30363d; border-color: #8b949e; }
.mst-tool .btn:disabled { opacity: .4; cursor: not-allowed; }
.mst-tool .btn-primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.mst-tool .btn-primary:hover:not(:disabled) { background: #388bfd; border-color: #388bfd; }
.mst-tool .btn-danger  { background: transparent; border-color: rgba(248,81,73,.4); color: var(--err); }
.mst-tool .btn-danger:hover:not(:disabled) { background: rgba(248,81,73,.12); border-color: var(--err); }

.mst-tool .btns { display: flex; gap: 10px; margin-top: 14px; }
.mst-tool .btns-wrap { flex-wrap: wrap; align-items: center; }
.mst-tool .spacer { flex: 1 1 auto; }

/* --------------------------------------------------------------- progress */
.mst-tool .bar {
  position: relative;
  height: 26px;
  border-radius: 7px;
  background: #0d1117;
  border: 1px solid var(--border);
  overflow: hidden;
}
.mst-tool .bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1f6feb, #58a6ff);
  transition: width .12s linear;
}
.mst-tool .bar-fill.err { background: linear-gradient(90deg, #a40e26, #f85149); }
.mst-tool .bar-fill.done { background: linear-gradient(90deg, #238636, #3fb950); }
.mst-tool .bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

/* ------------------------------------------------------------------- opts */
.mst-tool .opts { display: flex; flex-direction: column; gap: 8px; }
.mst-tool .chk { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.mst-tool .chk input { width: 15px; height: 15px; accent-color: #1f6feb; cursor: pointer; }

/* -------------------------------------------------------------------- log */
.mst-tool .card-log { display: flex; flex-direction: column; min-height: 0; }
.mst-tool .log {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  background: #010409;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.mst-tool .log .t-ok   { color: var(--ok); }
.mst-tool .log .t-err  { color: var(--err); }
.mst-tool .log .t-info { color: var(--muted); }
.mst-tool .log .t-warn { color: var(--warn); }
.mst-tool .log .ts     { color: #6e7681; }

/* ----------------------------------------------------------------- banner */
.mst-tool .banner {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 11px 22px;
  border-radius: 8px;
  background: #1c2128;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 8px 26px rgba(0,0,0,.5);
  z-index: 100;
}
.mst-tool .banner.err  { border-color: rgba(248,81,73,.5); color: var(--err); }
.mst-tool .banner.ok   { border-color: rgba(63,185,80,.5);  color: var(--ok); }
.mst-tool .banner.warn { border-color: rgba(210,153,34,.5); color: var(--warn); }

/* ------------------------------------------------------------------- misc */
.mst-tool .adc {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0d1117;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
}
