/* TVbox-Configs · 商务风格管理控制台
   所有类名与 assets/app.js 生成的 DOM 保持一致。 */
:root {
  --navy: #16233a;
  --navy-2: #22314c;
  --ink: #1a2333;
  --ink-2: #46536b;
  --muted: #7a8699;
  --line: #e3e8f0;
  --line-soft: #eef2f7;
  --bg: #f3f6fa;
  --card: #ffffff;
  --accent: #2456d8;
  --accent-dark: #1a43ad;
  --accent-soft: #eaf0ff;
  --ok: #12805c;
  --warn: #b8730b;
  --bad: #c93b32;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 35, 58, .04), 0 6px 18px rgba(22, 35, 58, .045);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font-family: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 56px; }

/* ---------- 顶部导航 ---------- */
.topnav {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  margin: 0 -20px 26px; padding: 0 20px; height: 62px;
  background: var(--navy); color: #fff;
  box-shadow: 0 2px 12px rgba(22, 35, 58, .16);
}
.nav-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.nav-brand:hover { text-decoration: none; }
.nav-mark { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 8px; background: #2f63e0; }
.nav-mark svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-brand-txt span { color: #9fb2d6; font-weight: 500; }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-links a { color: #c4cee0; font-size: 13px; padding: 6px 12px; border-radius: 6px; }
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .1); text-decoration: none; }
.lang-switch { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; padding: 3px; border: 1px solid rgba(255,255,255,.18); border-radius: 7px; }
.lang-switch button { font: inherit; cursor: pointer; border: 0; background: none; color: #b9c6dc; padding: 3px 9px; border-radius: 5px; }
.lang-switch button:hover { color: #fff; }
.lang-switch button.on { color: #fff; background: #2f63e0; font-weight: 600; }
.lang-switch .sep { color: #52627f; }

/* ---------- 标题区 ---------- */
.top { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.eyebrow { color: var(--accent); font-size: 10.5px; letter-spacing: 1.6px; font-weight: 700; margin-bottom: 5px; }
.brand h1 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.5px; color: var(--navy); }
.brand .sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.stats { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card);
  color: var(--ink-2); font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow);
}
.pill.ok { color: var(--ok); border-color: #c6e6d9; background: #f0faf5; }
.pill.warn { color: var(--warn); border-color: #f1e0bd; background: #fdf8ee; }
.pill.bad { color: var(--bad); border-color: #f3d4d1; background: #fdf4f3; }
.pill.action { cursor: pointer; user-select: none; }
.pill.action.ok { color: var(--ok); }

/* ---------- 卡片与分区 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px;
}
.section-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.section-index {
  flex: 0 0 auto; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid #d3e0ff;
  padding: 4px 7px; border-radius: 5px; margin-top: 2px;
}
.section-title h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--navy); }
.section-title h2 .sub-count { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 8px; }
.section-title p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.hint.warn { color: #a87010; }
.hint.err { color: var(--bad); }

/* ---------- 状态总览 ---------- */
.status-card { padding-top: 18px; padding-bottom: 18px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.bdg { display: inline-flex; align-items: stretch; overflow: hidden; border: 1px solid #e0e5ed; border-radius: 5px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; text-decoration: none; }
.bdg:hover { text-decoration: none; border-color: #b9c6dc; }
.bdg-k { background: #33425e; color: #fff; padding: 3px 8px; white-space: nowrap; }
.bdg-v { background: #f2f5f9; color: #475670; padding: 3px 8px; white-space: nowrap; }
.bdg-v.blue { background: var(--accent); color: #fff; }
.bdg-v.green { background: var(--ok); color: #fff; }
.bdg-v.red { background: var(--bad); color: #fff; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.status-item { background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 13px; }
.status-k { display: block; color: #9aa5b6; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; margin-bottom: 3px; }
.status-line { margin: 0; font-size: 12.5px; color: var(--ink-2); }

/* ---------- 快速导入 ---------- */
.hero { border-color: #d5e1f7; }
.quick-block { background: linear-gradient(115deg, #1d3358 0%, #24406d 55%, #2a4b82 100%); border-radius: 10px; padding: 16px 18px; color: #fff; }
.quick-label { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #c8d6ef; letter-spacing: .5px; margin-bottom: 8px; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: #55d6a0; box-shadow: 0 0 0 3px rgba(85, 214, 160, .18); }
.quick-url {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: #eaf1ff;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22);
  border-radius: 7px; padding: 10px 12px; overflow-wrap: anywhere; user-select: all;
}
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-actions .btn.primary { background: #fff; color: #1c3a6b; border-color: #fff; }
.quick-actions .btn.primary:hover { background: #eaf1ff; }
.quick-actions .btn:not(.primary) { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.32); }
.quick-actions .btn:not(.primary):hover { background: rgba(255,255,255,.2); }

/* ---------- 控件 ---------- */
.btn {
  font-size: 12.5px; line-height: 1; cursor: pointer; white-space: nowrap;
  padding: 9px 14px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-weight: 600;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: #f5f8fc; border-color: #ccd6e4; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { color: var(--muted); }
.btn.danger { color: #b93b33; border-color: #f0d2cf; background: #fdf5f4; }
.btn.danger:not(:disabled):hover { background: #fbe9e7; }
.btn.sm { font-size: 12px; padding: 7px 11px; }
.btn.tiny { font-size: 11.5px; padding: 5px 9px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.input, select {
  font-size: 13px; color: var(--ink); width: 100%;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
.input::placeholder { color: #a7b0bf; }
.input:focus, select:focus { outline: none; border-color: #9db8ee; box-shadow: 0 0 0 3px var(--accent-soft); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools .input { width: 190px; }
.tools select { width: auto; min-width: 108px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; margin-bottom: 12px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.import-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.import-label { font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.import-bar .input { flex: 1; min-width: 220px; }
.inline-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.inline-row.wide { margin: 12px 0 4px; }
.inline-row.wide .input { flex: 1; min-width: 220px; }
.inline-row .url {
  flex: 1; min-width: 220px; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 7px; background: #f9fafc; font-family: var(--mono);
  font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.index-row { padding-top: 12px; margin-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- 订阅地址 ---------- */
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 5px; background: #eef2f8; color: var(--ink-2); white-space: nowrap; }
.tag.primary { background: var(--accent-soft); color: var(--accent); }
#mirrorGroups { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 10px; }
.mgroup { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; background: #fbfcfe; min-width: 0; }
.mgroup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mgroup-title { font-size: 13px; font-weight: 700; color: var(--navy); flex: 1; min-width: 0; }
.mgroup .primary-url { margin-top: 9px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.mgroup details { margin-top: 9px; }
.mgroup summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.mirror { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 6px; background: #fff; }
.mirror .url { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11px; color: #66738a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 源表格 ---------- */
.table { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.grid-cols { display: grid; grid-template-columns: 26px minmax(120px, 1fr) minmax(220px, 1.7fr) 74px 96px 72px 92px 132px; gap: 10px; align-items: center; }
.thead { min-width: 900px; padding: 10px 12px; background: #f7f9fc; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 700; color: var(--ink-2); letter-spacing: .2px; }
.row { min-width: 900px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.row:last-child { border-bottom: none; }
.row:nth-child(even) { background: #fcfdff; }
.row:hover { background: #f2f7ff; }
.name-cell { min-width: 0; }
.name-cell .n { display: flex; align-items: center; gap: 6px; font-weight: 650; color: var(--navy); }
.name-cell .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-cell {
  font-family: var(--mono); font-size: 11px; color: #5f6d84;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: copy;
}
.api-cell:hover { color: var(--accent); }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px; background: #eef1f6; color: #5b6b83; white-space: nowrap; }
.badge.on { background: #e9f7f0; color: var(--ok); }
.dot { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot.ok { color: var(--ok); } .dot.ok i { background: var(--ok); }
.dot.warn { color: var(--warn); } .dot.warn i { background: var(--warn); }
.dot.bad { color: var(--bad); } .dot.bad i { background: var(--bad); }
.spark { display: inline-flex; gap: 3px; align-items: center; }
.spark span { width: 6px; height: 13px; border-radius: 2px; background: #e5eaf1; }
.spark span.on { background: #b6e4d0; }
.spark span.now.on { background: var(--ok); }
.spark span.now.off { background: var(--bad); }
.ops { display: flex; gap: 5px; justify-content: flex-end; }
.c-check { display: flex; align-items: center; justify-content: center; }
.c-check input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.recov { padding-top: 12px; margin-top: 12px; border-top: 1px dashed var(--line); }
.recov .hint { flex: 1; min-width: 180px; margin: 0; }

/* ---------- 部署步骤 ---------- */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 9px; }
.steps li { counter-increment: step; position: relative; padding: 9px 12px 9px 42px; background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--ink-2); font-size: 12.5px; }
.steps li::before { content: counter(step); position: absolute; left: 11px; top: 10px; width: 20px; height: 20px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font: 700 11px/20px var(--mono); text-align: center; }

/* ---------- 弹窗与提示 ---------- */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(16, 26, 43, .5); z-index: 50; backdrop-filter: blur(2px); }
.modal.open { display: flex; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; padding: 22px 24px; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(16, 26, 43, .3); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sheet h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--navy); }
.icon-btn { border: 0; background: #f2f5f9; color: var(--muted); width: 27px; height: 27px; border-radius: 6px; font-size: 18px; line-height: 1; cursor: pointer; }
.icon-btn:hover { background: #e6ebf3; color: var(--ink); }
.sheet label { display: block; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.sheet label > span { display: block; margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px);
  max-width: 88vw; padding: 11px 18px; border-radius: 8px; background: var(--navy); color: #fff;
  font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
  box-shadow: 0 10px 30px rgba(16, 26, 43, .28);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
footer { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; padding-top: 8px; color: var(--muted); font-size: 11.5px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .topnav { height: auto; padding-top: 12px; padding-bottom: 12px; gap: 10px; }
  .top { align-items: flex-start; }
  .stats { width: 100%; }
  .status-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; }
  .tools, .tools .input, .tools select { width: 100%; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 12px 44px; }
  .topnav { margin: 0 -12px 20px; padding-left: 12px; padding-right: 12px; }
  .card { padding: 16px; }
  .brand h1 { font-size: 21px; }
  .thead { display: none; }
  .row { display: block; min-width: 0; margin-bottom: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
  .grid-cols { display: block; }
  .row .c-check { justify-content: flex-start; margin-bottom: 6px; }
  .api-cell { margin: 7px 0; white-space: normal; word-break: break-all; }
  .row .c-state, .row .c-lat, .row .c-spark { display: inline-block; margin-right: 10px; vertical-align: middle; }
  .row .c-spark { margin-right: 0; }
  .ops { justify-content: flex-start; margin-top: 9px; }
  #mirrorGroups { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .inline-row .url { min-width: 100%; }
}
