/*! qr：应用自身样式（布局/表格/画布尺寸等），来自原版 taez/tools/qr/index.html 的 <style>。
 * metro.css 负责外层外观（面板、按钮、页头），本文件只补应用结构与几何，勿随意删减。 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f7f7f7; color: #222; padding: 24px 16px;
}
.wrap { max-width: 900px; margin: 0 auto; }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.sub { color: #888; font-size: 13px; margin: 0 0 20px; }
.tabs { display: flex; border-bottom: 1px solid #ddd; margin-bottom: 16px; }
.tab {
  padding: 10px 20px; cursor: pointer; font-size: 14px; color: #666;
  border: 1px solid transparent; border-bottom: none; border-radius: 2px 2px 0 0;
  margin-bottom: -1px; background: transparent; font-family: inherit;
}
.tab.active { background: #fff; border-color: #ddd; color: #222; font-weight: 600; }
.panel {
  background: #fff; border: 1px solid #ddd; border-radius: 2px;
  padding: 16px; margin-bottom: 16px;
}
.hidden { display: none !important; }
.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 12px; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #666; }
.controls select, .controls input[type="text"], .controls input[type="number"] {
  padding: 5px 8px; border: 1px solid #ccc; border-radius: 2px;
  font-size: 13px; background: #fff; color: #222; min-width: 140px; font-family: inherit;
}
.controls input[type="text"].wide { min-width: 100%; width: 100%; }
textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 2px;
  font-size: 13px; font-family: inherit; min-height: 100px; resize: vertical;
}
.btn {
  padding: 7px 16px; border: 1px solid #bbb; border-radius: 2px;
  background: #fff; color: #222; font-size: 13px; cursor: pointer; font-family: inherit;
  text-decoration: none; display: inline-block;
}
.btn:hover { background: #f0f0f0; }
.btn.primary { background: #2c5fa8; border-color: #2c5fa8; color: #fff; }
.btn.primary:hover { background: #244d8a; border-color: #244d8a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 12px; color: #888; }
.status { font-size: 13px; margin-top: 8px; min-height: 18px; }
.status.err { color: #c62828; white-space: pre-wrap; font-family: monospace; font-size: 12px; }
.status.ok { color: #2e7d32; }
.algo-info {
  margin-top: 10px; padding: 10px 12px;
  background: #fafafa; border: 1px solid #e5e5e5; border-radius: 2px;
  font-size: 12px; color: #555; line-height: 1.65;
  display: none;
}
.algo-info.on { display: block; }
.algo-info .head {
  font-size: 13px; font-weight: 600; color: #222; margin-bottom: 4px;
}
.algo-info .head .kind-tag {
  display: inline-block; padding: 1px 6px; margin-left: 6px;
  background: #eef3fb; color: #2c5fa8; border-radius: 2px;
  font-size: 11px; font-weight: normal; vertical-align: middle;
}
.algo-info .desc { color: #444; }
.algo-info .limits {
  margin: 6px 0 0; padding-left: 18px; color: #777;
}
.algo-info .limits li { margin: 2px 0; }
.preview {
  margin-top: 14px; padding: 14px; background: #fafafa; border: 1px solid #e5e5e5;
  border-radius: 2px; text-align: center;
}
.preview canvas { max-width: 100%; height: auto; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; margin-top: 14px;
}
/* 批量生成：模式切换 */
.mode-tabs {
  display: flex; border-bottom: 1px solid #ddd; margin: 8px 0 14px;
}
.mode-tab {
  padding: 7px 16px; cursor: pointer; font-size: 13px; color: #666;
  border: 1px solid transparent; border-bottom: none;
  border-radius: 2px 2px 0 0; margin-bottom: -1px; background: transparent;
  font-family: inherit;
}
.mode-tab.active { background: #fff; border-color: #ddd; color: #222; font-weight: 600; }

/* 板块 */
.blocks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.block {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: #fafafa; border: 1px solid #e0e0e0;
  border-radius: 2px; flex-wrap: wrap;
}
.block .block-tag {
  padding: 2px 8px; font-size: 11px; border-radius: 2px;
  background: #eef3fb; color: #2c5fa8; flex-shrink: 0;
}
.block .block-tag.seq { background: #fef3e0; color: #b36b00; }
.block input[type="text"] {
  flex: 1; min-width: 100px; padding: 5px 8px;
  border: 1px solid #ccc; border-radius: 2px; font-size: 13px; font-family: inherit;
}
.block input[type="number"] {
  width: 68px; padding: 5px 6px;
  border: 1px solid #ccc; border-radius: 2px; font-size: 13px; font-family: inherit;
}
.block select {
  padding: 5px 6px; border: 1px solid #ccc; border-radius: 2px;
  font-size: 13px; background: #fff; font-family: inherit;
}
.block label {
  display: flex; align-items: center; gap: 3px; font-size: 12px; color: #666;
}
.block-del {
  width: 26px; height: 26px; padding: 0; border: 1px solid #ccc;
  border-radius: 2px; background: #fff; cursor: pointer; font-size: 14px; color: #888;
  line-height: 1; flex-shrink: 0;
}
.block-del:hover { color: #c62828; border-color: #c62828; }
.block-actions { display: flex; gap: 8px; margin-bottom: 14px; }

.field-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  margin-bottom: 12px; font-size: 13px;
}
.field-row > label {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: #666;
}
.field-row input[type="text"], .field-row input[type="number"] {
  padding: 5px 8px; border: 1px solid #ccc; border-radius: 2px;
  font-size: 13px; font-family: inherit; width: 90px;
}
.field-row .info-chip {
  padding: 4px 10px; background: #f0f0f0; border-radius: 2px;
  font-size: 12px; color: #555;
}
.field-row .info-chip.warn { background: #fef3e0; color: #b36b00; }
.field-row .info-chip.err { background: #fde8e8; color: #c62828; }

.radio-group { display: flex; gap: 14px; }
.radio-group label {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; color: #333; cursor: pointer;
}

.overflow-warn {
  margin-top: 10px; padding: 10px 12px;
  background: #fef3e0; border: 1px solid #f0d0a0; border-radius: 2px;
  font-size: 12px; color: #8a5000; line-height: 1.6;
  display: none;
}
.overflow-warn.on { display: block; }
.cell {
  border: 1px solid #ddd; background: #fff; border-radius: 2px;
  padding: 8px; text-align: center; display: flex; flex-direction: column; gap: 6px;
}
.cell canvas { max-width: 100%; height: auto; background: #fff; }
.cell .cap { font-size: 11px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop {
  border: 2px dashed #ccc; border-radius: 2px; padding: 28px 16px;
  text-align: center; color: #666; font-size: 14px;
  background: #fff; cursor: pointer; margin-bottom: 16px;
}
.drop.over { border-color: #2c5fa8; background: #eef3fb; color: #2c5fa8; }
.linkbtn { color: #2c5fa8; text-decoration: underline; }
.result-box {
  margin-top: 12px; padding: 12px; background: #f4f8f4;
  border: 1px solid #cfe3cf; border-radius: 2px;
}
.result-box .fmt { color: #2e7d32; font-weight: 600; font-size: 13px; }
.result-box .text {
  margin-top: 6px; padding: 8px; background: #fff; border: 1px solid #e5e5e5;
  border-radius: 2px; font-family: monospace; font-size: 13px;
  word-break: break-all; white-space: pre-wrap; max-height: 200px; overflow: auto;
}
.cam-wrap { margin-top: 12px; text-align: center; }
.cam-wrap video { max-width: 100%; border: 1px solid #ddd; border-radius: 2px; }
