/* TJ-LIVE 管理后台样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ==========================================================================
   移动端手势与缩放（用户实测反馈：双击 / 点输入框会误放大页面）
   --------------------------------------------------------------------------
   touch-action:manipulation = 允许单指滚动 + 允许双指捏合缩放，**禁止双击缩放**。
   放 html/body 上（touch-action 本身不继承，但祖先的限制会对后代生效），
   这样客户在手机上用后台时，误触不会把页面弹大。

   -webkit-tap-highlight-color:transparent —— 去掉点按的灰色方块闪烁。

   ⚠ 下面那条把窄屏表单字号提到 16px，不是审美选择：
     iOS 的强制规则是「input/textarea 字号 <16px 时，一点聚焦就自动放大整个页面」，
     而 viewport 里的 user-scalable=no 对它**无效**，只能靠字号本身解决。
     桌面保持原来的紧凑字号，只在窄屏放大，不影响后台信息密度。
   ========================================================================== */
html, body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body { -webkit-tap-highlight-color: transparent; }
input, select, textarea, button, a { touch-action: manipulation; }

@media (max-width: 900px) {
  input[type="text"], input[type="password"], input[type="email"],
  input[type="tel"], input[type="number"], input[type="url"],
  select, textarea, .we-input, .we-select, .we-tab-name {
    font-size: 16px !important;
  }
}

:root {
  --primary: #3f76fc;
  --primary-dark: #3161e6;
  --danger: #dc2626;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --ok-bg: #ecfdf5;
  --ok-border: #10b981;
  --err-bg: #fef2f2;
  --err-border: #ef4444;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2ff; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* ========== 左侧菜单布局 ========== */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 20;
  width: 224px; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0f172a 0%, #111c33 100%);
  color: #cbd5e1;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px; border-bottom: 1px solid rgba(148,163,184,.14);
}
.brand-mark {
  width: 36px; height: 36px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.brand-text { display: flex; flex-direction: column; font-size: 14.5px; font-weight: 600; color: #f1f5f9; line-height: 1.35; }
.brand-text small { font-size: 11px; font-weight: 400; color: #7c8aa5; }

.side-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.side-group { padding: 8px 10px 6px; font-size: 11px; letter-spacing: .08em; color: #64748b; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px; border-radius: 8px;
  color: #b6c2d4; font-size: 14px; position: relative;
}
.side-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.side-item:hover { background: rgba(148,163,184,.12); color: #fff; text-decoration: none; }
.side-item.active { background: rgba(37,99,235,.18); color: #fff; font-weight: 500; }
.side-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: #3b82f6;
}

.side-user {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-top: 1px solid rgba(148,163,184,.14);
}
.side-user-meta { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.side-avatar {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #334155; color: #e2e8f0; font-size: 14px; font-weight: 600;
}
.side-user-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.side-user-text strong { font-size: 13px; color: #e2e8f0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text small { font-size: 11px; color: #7c8aa5; }
.side-logout {
  width: 30px; height: 30px; border: none; border-radius: 7px; cursor: pointer;
  background: transparent; color: #94a3b8; display: inline-flex; align-items: center; justify-content: center;
}
.side-logout svg { width: 17px; height: 17px; }
.side-logout:hover { background: rgba(148,163,184,.16); color: #f87171; }

.app-main { margin-left: 224px; min-height: 100vh; }
.workspace { padding: 22px 26px 48px; max-width: 1280px; }
.inline-form { display: inline; }

/* 未登录（登录页/错误页） */
.auth-shell { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 40px; }
.auth-card-wrap { width: 100%; max-width: 420px; }
.auth-card-wrap .center-card { margin-top: 0; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 16px;
  margin-bottom: 16px;
}
.page-head h1 { font-size: 20px; }
.breadcrumb { margin-bottom: 14px; color: var(--muted); font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin-bottom: 14px; color: #111827; }

/* 登录 */
.login-card { padding: 32px; }
.login-title { text-align: center; font-size: 26px; color: var(--primary); }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 22px; }

/* 表单 */
.stack-form label { display: block; margin-bottom: 14px; }
.stack-form label > span { display: block; margin-bottom: 6px; font-weight: 500; }
.radio-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.radio-row input { margin-top: 4px; }
.radio-row span { font-weight: 400; font-size: 13.5px; }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13.5px; margin-top: 9px; }
#pwFields { margin: 0 0 14px 24px; }
input[type="text"], input[type="password"], select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.required { color: var(--danger); font-style: normal; font-size: 12px; margin-left: 4px; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.form-card { max-width: 520px; }
.form-actions { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.form-grid-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 4px 24px; }

/* 按钮 */
.btn {
  display: inline-block; border: none; border-radius: 4px; cursor: pointer;
  padding: 0 16px; font-size: 14px; line-height: 30px; text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* 提示 */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert-ok { background: var(--ok-bg); border: 1px solid var(--ok-border); color: #065f46; }
.alert-err { background: var(--err-bg); border: 1px solid var(--err-border); color: #991b1b; }

/* 筛选栏 */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 150px; }
.filter-input { flex: 1; min-width: 180px; }

/* 表格 */
.table-card { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #f9fafb; color: var(--muted); font-weight: 500; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fafb; }
.table-card .muted { padding: 10px 14px; }
.nowrap { white-space: nowrap; }
.detail-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.url-text { font-family: Consolas, Menlo, monospace; font-size: 12.5px; color: #4338ca; margin-right: 6px; }
.room-link { font-weight: 500; }
.room-title { font-size: 16px; }

/* 标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tag-green { background: #ecfdf5; color: #047857; }
.tag-gray { background: #f3f4f6; color: #6b7280; }
.tag-blue { background: #eff6ff; color: #1d4ed8; }
.tag-amber { background: #fffbeb; color: #b45309; }
.tag-red { background: #fef2f2; color: #b91c1c; }

/* 详情 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.info-label { color: var(--muted); width: 96px; flex-shrink: 0; }
.next-steps { padding-left: 18px; margin-bottom: 14px; }
.next-steps li { margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 12.5px; }

/* 概览 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { text-align: center; display: block; color: var(--text); }
.stat-card:hover { border-color: var(--primary); text-decoration: none; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 空状态 / 错误页 */
.empty-card { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-card .btn { margin-top: 14px; }
.center-card { text-align: center; padding: 44px 20px; margin-top: 10vh; }
.error-code { font-size: 40px; color: var(--primary); }
.error-message { color: var(--muted); margin: 10px 0 20px; }

/* 观众端 */
.live-body { background: #111827; min-height: 100vh; }
.live-wrap { max-width: 720px; margin: 0 auto; padding: 8vh 20px 40px; }
.live-card {
  background: #1f2937; border: 1px solid #374151; color: #f9fafb;
  border-radius: 14px; padding: 40px 30px; text-align: center;
}
.live-card h1 { font-size: 20px; margin-bottom: 10px; }
.live-card p { color: #9ca3af; font-size: 14px; }
.live-room-name { color: #fff; }
.live-icon { font-size: 40px; margin-bottom: 12px; }
.player-placeholder { padding: 30px 0; }
.player-placeholder p { margin: 4px 0; font-size: 15px; color: #e5e7eb; }
.player-placeholder .muted { color: #6b7280; font-size: 13px; }
.live-footer { text-align: center; color: #4b5563; margin-top: 18px; font-size: 12px; }

/* 页面配置（TJ-LIVE-03） */
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tpl-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.tpl-card h3 { font-size: 15px; margin-bottom: 6px; }
.tpl-card.tpl-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.tpl-region-list { margin: 6px 0 12px 18px; color: var(--muted); font-size: 12.5px; }
.tpl-region-list li { margin-bottom: 2px; }

.btn-slot { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.btn-slot legend { font-size: 13px; color: var(--muted); padding: 0 6px; }

/* ---------- 标准观看页配置编辑器（watch_edit）---------- */
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.we-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; margin-bottom: 6px; }
.we-field { display: flex; flex-direction: column; gap: 4px; }
.we-field-wide { grid-column: 1 / -1; }
.we-field label { font-size: 13px; color: #374151; }
.we-field .we-req { color: #dc2626; }
.we-input, .we-select {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
  font-size: 13.5px; background: #fff; max-width: 100%;
}
.we-input:focus, .we-select:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.we-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: #374151; margin-right: 18px; }
.we-checklist { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.we-checklist .we-check { margin-right: 0; }
.we-subtitle { font-size: 13.5px; margin: 16px 0 8px; color: #111827; }
.we-imgrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.we-imgthumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.we-uploadbtn { display: inline-flex; align-items: center; cursor: pointer; }
.we-btnrow { flex-direction: row; align-items: center; gap: 10px; }
.we-btnrow .we-input { flex: 1; }
.we-tab-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.we-tab-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.we-tab-name { width: 160px; }
.we-tab-type { width: 150px; }
.we-tab-ops { margin-left: auto; display: flex; gap: 6px; }
.we-editor-host { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.we-editor-host .w-e-toolbar { background: #f8fafc; }
.we-msg { font-size: 13px; margin-left: 8px; }
.we-msg-ok { color: #047857; }
.we-msg-err { color: #b91c1c; }
.we-inline { font-size: 13px; color: #374151; display: block; margin-bottom: 4px; }
.order-box { border-top: 1px dashed var(--border); margin-top: 12px; padding-top: 10px; }
.order-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.order-row span { flex: 1; }

.mat-thumb { height: 44px; max-width: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.mat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 12px; }
.mat-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: center; }
.mat-item img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.mat-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-item .btn { margin-top: 6px; }

.video-add-form { display: flex; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap; }
.video-add-form input[type="text"] { flex: 1; min-width: 200px; }
.video-add-form .btn { flex-shrink: 0; }
.video-list { margin-top: 14px; }
.video-row { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.video-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.video-order { font-weight: 700; color: var(--primary); }
.video-row input[type="text"] { margin-bottom: 8px; }
.video-ops { display: flex; gap: 6px; flex-wrap: wrap; }

/* 发布检查（TJ-LIVE-05） */
.check-list { padding-left: 20px; margin-bottom: 14px; }
.check-list li { margin-bottom: 6px; }
.check-err { color: #b91c1c; }
.check-warn { color: #92400e; }

/* 响应式：窄屏下侧边栏收为顶部横条 */
@media (max-width: 900px) {
  .sidebar {
    top: 0; left: 0; right: 0; bottom: auto; width: 100%;
    flex-direction: row; align-items: center;
    padding: 0 10px; height: 54px;
  }
  .side-brand { border-bottom: none; padding: 0 10px 0 4px; }
  .brand-text { display: none; }
  .side-nav {
    display: flex; align-items: center; gap: 2px; flex: 1;
    padding: 0; overflow-x: auto; overflow-y: hidden;
  }
  .side-group { display: none; }
  .side-item { white-space: nowrap; margin-bottom: 0; padding: 7px 12px; }
  .side-item span { display: none; }
  .side-item.active::before { display: none; }
  .side-user { border-top: none; padding: 0 4px; }
  .side-user-text { display: none; }
  .app-main { margin-left: 0; }
  .workspace { padding: 68px 14px 40px; }
}
@media (max-width: 760px) {
  .detail-grid, .stat-grid { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: 1fr; }
  .mat-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar select, .filter-bar input { width: 100%; }
  th, td { padding: 8px 10px; }
}

/* === 统一状态标签（改版 V1.0 §3.2） === */
.tag-pending-config { background: #fffbeb; color: #b45309; }   /* 待配置 */
.tag-pending-verify { background: #eff6ff; color: #1d4ed8; }   /* 待验证 */
.tag-not-ready     { background: #f3f4f6; color: #6b7280; }   /* 未就绪 */
.tag-ready         { background: #ecfdf5; color: #047857; }   /* 正常 / 就绪 */

/* === 统一提示（改版 V1.0 §3.2） === */
.alert-warn { background: #fffbeb; border: 1px solid #f59e0b; color: #92400e; }

/* === 空状态与配置引导（改版 V1.0 §七） === */
.empty-state { border: 1px dashed var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.empty-state .tag { margin-bottom: 8px; }

/* === 配置待办与异常列表（补充验收 V1.0） === */
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px; border-radius: 8px;
  background: #f8fafc; border: 1px solid var(--border);
}
.todo .tag { flex-shrink: 0; margin-top: 1px; }
.todo-text { flex: 1; font-size: 13.5px; color: #374151; line-height: 1.5; }
.todo-link { flex-shrink: 0; font-size: 13px; white-space: nowrap; }
.todo-warn { background: #fffbeb; border-color: #fde68a; }
.todo-err { background: #fef2f2; border-color: #fecaca; }
.empty-guide { padding-left: 18px; margin: 8px 0 0; }
.empty-guide li { margin-bottom: 8px; color: #374151; font-size: 13.5px; }
.empty-guide strong { color: #111827; }

