/* ===== 整理工具页面 ===== */
.tool-body { padding-bottom: 40px; }

.main.wide { max-width: 1080px; }

.block { padding: 18px 20px; margin-bottom: 14px; }
.block-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.block-head h2 { font-size: 17px; margin: 0; }
.block-head .hint { flex: 1; }

.sub-h { font-size: 14px; margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sub-h small { font-size: 12px; color: var(--muted); font-weight: 400; }

/* 拖拽区 */
.drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-icon { font-size: 26px; color: var(--muted); line-height: 1; margin-bottom: 8px; }
.drop-text { font-size: 14px; color: var(--text); }
.drop-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.pick { color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* 已选文件 */
.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  font-size: 13.5px;
}
.file-item .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fm { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, monospace; flex: 0 0 auto; }
.file-item .fdel { color: var(--danger); cursor: pointer; background: none; border: 0; font-size: 13px; padding: 2px 4px; }

/* 表单布局 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); margin: 6px 0; cursor: pointer; line-height: 1.6; }
.check > span { flex: 1; min-width: 0; }
.check input { flex: 0 0 auto; margin-top: 2px; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.check code { font-size: 12px; background: var(--bg); padding: 1px 4px; border-radius: 4px; }

.row-end { display: flex; justify-content: flex-end; margin-top: 10px; }
.row-end.gap { gap: 8px; flex-wrap: wrap; }
.row-inline { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.row-inline input { flex: 1; min-width: 160px; }
.mt6 { margin-top: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th, .mini-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.mini-table th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table td input { width: 100%; min-width: 0; box-sizing: border-box; padding: 7px 9px; font-size: 13px; border-radius: 8px; }
#groupRules, #renameRules { table-layout: fixed; }
#groupRules th:nth-child(1) { width: 55%; }
#groupRules th:nth-child(2) { width: auto; }
#groupRules th:nth-child(3), #renameRules th:nth-child(3) { width: 74px; }
/* 窄屏：给「归到分组」留固定宽度，不然分组名会被截成「央视频」 */
@media (max-width: 700px) {
  #groupRules th:nth-child(1) { width: calc(100% - 148px); }
  #groupRules th:nth-child(2) { width: 102px; }
  #groupRules th:nth-child(3) { width: 46px; }
  #renameRules th:nth-child(1) { width: calc(100% - 92px); }
  #renameRules th:nth-child(3) { width: 46px; }
  .mini-table th, .mini-table td { padding: 7px 5px; }
  #groupRules td input, #renameRules td input { font-size: 12.5px; padding: 7px 7px; }
  .mini-table .del-row { font-size: 11.5px; padding: 4px 0; }
}
.mini-table .num { text-align: right; font-family: ui-monospace, Menlo, monospace; }
.mini-table .del-row { color: var(--danger); cursor: pointer; background: none; border: 0; font-size: 12.5px; white-space: nowrap; padding: 4px 6px; }
.mini-table .del-row:hover { text-decoration: underline; }

/* 分组顺序 */
.order-list { display: flex; flex-wrap: wrap; gap: 8px; }
.order-chip {
  display: inline-flex; align-items: center; gap: 1px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 6px 3px 12px; font-size: 13px; cursor: grab;
}
.order-chip.dragging { opacity: .45; }
.order-chip.drop-target { border-color: var(--brand); background: var(--brand-soft); }
.order-chip b { font-weight: 600; }
.order-chip .oi { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 10px; padding: 3px 4px; line-height: 1; border-radius: 4px; }
.order-chip .oi:hover { background: var(--bg); color: var(--text); }
.order-chip .oi[data-act='del'] { margin-left: 3px; }
.order-chip .oi[data-act='del']:hover { color: var(--danger); }

/* 结果表 */
.result-table td { vertical-align: top; }
.result-table .fname { font-weight: 600; }
.result-table .fsub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.result-table .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-tr td { background: var(--bg); font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.detail-tr .dt-h { color: var(--text); font-weight: 600; }
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 8px; }
.chip-list span { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 12px; }

/* 历史 */
.history { display: flex; flex-direction: column; gap: 8px; }
.his-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px;
}
.his-item .t { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: 12.5px; }
.his-item .n { flex: 1; min-width: 120px; }

/* 预览 */
.modal-card.wide-card { max-width: 860px; width: 92vw; }
.pre {
  margin: 0; padding: 12px; background: var(--bg); border-radius: 10px;
  font-size: 12px; line-height: 1.6; max-height: 58vh; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, Menlo, monospace;
}

.hidden { display: none !important; }

@media (max-width: 700px) {
  .block { padding: 14px; }
  .result-table .acts { flex-direction: column; }
  .his-item .n { flex-basis: 100%; }
}

/* 省内频道：省份选择 + 提示 */
.prov-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; margin-bottom: 8px; }
.prov-hint { font-size: 12.5px; color: var(--muted); line-height: 1.7; padding-top: 22px; }
@media (max-width: 700px) {
  .prov-row { grid-template-columns: 1fr; }
  .prov-hint { padding-top: 0; margin: 6px 0 4px; }
}
.prov-hint code, .sub-h code { font-size: 12px; background: var(--bg); padding: 1px 4px; border-radius: 4px; }

/* 分组规则里「按文件名识别省份」那一行 */
.gr-auto { font-size: 13px; color: var(--text); padding: 7px 0; }
.gr-auto .tiny { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 文件列表里的省份标签 */
.file-item .fp {
  flex: 0 0 auto; font-size: 11.5px; padding: 2px 7px; border-radius: 999px;
  background: var(--brand-soft, rgba(45,120,255,.12)); color: var(--brand); white-space: nowrap;
}
.file-item .fp.none { background: var(--bg); color: var(--muted); }

/* 台标地址示例是一条很长的 URL，不换行会把整页撑出横向滚动条 */
#logoSample { word-break: break-all; overflow-wrap: anywhere; line-height: 1.7; }
#logoSample a { word-break: break-all; }

/* 页面底部的引擎版本号：用来确认线上覆盖的文件到底生效没有 */
.ver-line { margin: 2px 2px 26px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.ver-line code { font-size: 11px; padding: 1px 5px; border-radius: 5px; background: var(--bg); border: 1px solid var(--line); }
