/* 后台共用样式：登录页 login.html + 学习看板 dashboard.html + 内容后台 admin.html
   （由 demo/css/admin.css 改造，新增的样式在文件末尾「正式版新增」一节）
   浅色、安静、可信。颜色按“作用”分配。 */

@font-face { font-family: "UKIJ Esliye Tom"; src: url(../fonts/UKIJEsliyeTom.ttf); }
@font-face { font-family: "UKIJ Tuz B";      src: url(../fonts/UKIJTuzB.ttf); }
@font-face { font-family: "UKIJ Reyhane";    src: url(../fonts/UKIJReyhane.ttf); }
/* Material Icons（Apache 2.0，来自 npm material-icons）：显示卡片的 mi: 图标，和电视端一样 */
@font-face { font-family: "Material Icons"; font-style: normal; font-weight: 400; font-display: block; src: url(../fonts/MaterialIcons.woff2) format("woff2"); }

:root {
  --page: #f6f6f3;          /* 页面底色 */
  --surface: #ffffff;       /* 卡片 */
  --surface-2: #fafaf8;     /* 次级面板 */
  --ink: #1b1b1a;           /* 主文字 */
  --ink-2: #52514e;         /* 次要文字 */
  --muted: #898781;         /* 坐标轴、说明 */
  --grid: #e8e7e1;          /* 网格线 */
  --line: rgba(11,11,11,.09);  /* 细边框 */
  --accent: #2a78d6;        /* 主色（蓝） */
  --accent-soft: #eaf2fc;
  /* 顺序色阶（蓝，浅→深）：热力图、进度 */
  --seq-0: #efeee9; --seq-1: #cde2fb; --seq-2: #86b6ef; --seq-3: #3987e5; --seq-4: #1c5cab;
  /* 状态色：只用于“好/注意/严重”，总是配图标和文字 */
  --good: #0ca30c; --good-ink: #0a6e0a; --good-bg: #ebf6ea;
  --warn: #fab219; --warn-ink: #8a5a00; --warn-bg: #fdf5e2;
  --serious: #ec835a; --serious-ink: #a14416; --serious-bg: #fcefe8;
  --critical: #d03b3b; --critical-ink: #a32525; --critical-bg: #fbeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.035);
  --zh: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --latin: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ug: "UKIJ Tuz B", "UKIJ Esliye Tom", "Noto Naskh Arabic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--zh); color: var(--ink); background: var(--page);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.ug { font-family: var(--ug); direction: rtl; unicode-bidi: isolate; }
.py { font-family: var(--latin); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: relative; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 28px; height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #E6337A, #8E4DFF); color: #fff; font-size: 14px;
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px;
}
.nav a:hover { background: #f0efeb; text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .clock { color: var(--ink-2); font-size: 13px; white-space: nowrap; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px;
}
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid #d9d8d2; background: #fff; color: var(--ink); font-size: 13.5px; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: #f5f5f2; border-color: #cfcec7; }
.btn:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #256abf; }
.btn.good { background: #0f8a0f; border-color: #0f8a0f; color: #fff; }
.btn.good:hover { background: #0b760b; }
.btn.danger { color: var(--critical-ink); border-color: #ebc9c7; }
.btn.danger:hover { background: var(--critical-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #f0efeb; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field > .label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.req { color: var(--critical); margin-left: 2px; }
input[type=text], input[type=number], input[type=search], select, textarea {
  height: 34px; padding: 0 10px; border: 1px solid #d9d8d2; border-radius: 8px; background: #fff;
  font-size: 13.5px; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 11px; font-size: 12px; white-space: nowrap; font-weight: 500;
  background: #f0efeb; color: var(--ink-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.published { background: var(--good-bg); color: var(--good-ink); }
.badge.pending   { background: var(--warn-bg); color: var(--warn-ink); }
.badge.draft     { background: #eef0f3; color: #4f5866; }
.badge.retired   { background: #f0efeb; color: var(--muted); }
.badge.agent     { background: #f1edfd; color: #5a3fc0; }
.badge.p0 { background: var(--critical-bg); color: var(--critical-ink); }
.badge.p1 { background: var(--accent-soft); color: #1c5cab; }
.badge.p2 { background: #f0efeb; color: var(--ink-2); }

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; line-height: 1.5; border: 1px solid transparent;
}
.notice .ico { flex: none; font-size: 15px; line-height: 1.35; }
.notice.info { background: var(--accent-soft); color: #1c4f8f; border-color: #d6e6fa; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: #f5e3b8; }
.notice.bad  { background: var(--critical-bg); color: var(--critical-ink); border-color: #f1d0ce; }
.notice.ok   { background: var(--good-bg); color: var(--good-ink); border-color: #cfe8cd; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

/* 悬浮提示（图表共用） */
.tip {
  position: fixed; z-index: 100; pointer-events: none; opacity: 0; transition: opacity .08s;
  background: #1f1f1e; color: #fff; border-radius: 8px; padding: 7px 10px; font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 260px; line-height: 1.45;
}
.tip.show { opacity: 1; }
.tip b { font-size: 14px; font-weight: 600; }
.tip .t2 { color: #c3c2b7; }

/* ================= 学习看板 ================= */
.dash { max-width: 1180px; margin: 0 auto; padding: 24px 28px 64px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.hero h1 { font-size: 24px; margin: 0 0 4px; font-weight: 650; letter-spacing: .2px; }
.hero .meta { color: var(--ink-2); font-size: 13.5px; display: flex; gap: 18px; flex-wrap: wrap; }
.hero .meta b { color: var(--ink); font-weight: 600; }
.hero .actions { display: flex; gap: 8px; }
.today-line {
  display: flex; gap: 10px 22px; flex-wrap: wrap; align-items: center;
  padding: 12px 18px; margin-bottom: 16px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2);
}
.today-line b { color: var(--ink); font-weight: 600; }
.today-line .tag { font-weight: 600; color: var(--ink); margin-right: 4px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 146px; }
.kpi .k-label { font-size: 13px; color: var(--ink-2); }
.kpi .k-value { font-size: 32px; font-weight: 650; line-height: 1.15; letter-spacing: -.3px; }
.kpi .k-value small { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 3px; letter-spacing: 0; }
.kpi .k-foot { font-size: 12.5px; color: var(--muted); margin-top: auto; }
.kpi .meter { position: relative; height: 8px; border-radius: 4px; background: #e9e8e3; margin: 8px 0 4px; }
.kpi .meter .band { position: absolute; top: -3px; bottom: -3px; background: rgba(12,163,12,.16); border-left: 1.5px solid var(--good); border-right: 1.5px solid var(--good); }
.kpi .meter .mark { position: absolute; top: -5px; width: 4px; height: 18px; border-radius: 2px; background: var(--ink); transform: translateX(-2px); box-shadow: 0 0 0 2px #fff; }
.kpi .meter-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.status-line { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; margin-top: 6px; }
.status-line .s-ico { flex: none; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #fff; font-weight: 700; margin-top: 1px; }
.s-good .s-ico { background: var(--good); } .s-good { color: var(--good-ink); }
.s-warn .s-ico { background: var(--warn); color: #5b3b00; } .s-warn { color: var(--warn-ink); }
.s-serious .s-ico { background: var(--serious); } .s-serious { color: var(--serious-ink); }
.s-info .s-ico { background: var(--accent); } .s-info { color: #1c4f8f; }
.s-none .s-ico { background: #bdbcb5; } .s-none { color: var(--ink-2); }

.cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-2b { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.mb { margin-bottom: 14px; }

/* 热力图 */
.heat-wrap { overflow-x: auto; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: 18px repeat(7, 26px); gap: 5px; align-items: center; width: max-content; }
.heat .wd { font-size: 11px; color: var(--muted); padding-right: 6px; text-align: right; }
.heat .mo { font-size: 11px; color: var(--muted); white-space: nowrap; height: 18px; }
.heat .cell { width: 26px; height: 26px; border-radius: 4px; background: var(--seq-0); cursor: default; }
.heat .cell.l1 { background: var(--seq-1); } .heat .cell.l2 { background: var(--seq-2); }
.heat .cell.l3 { background: var(--seq-3); } .heat .cell.l4 { background: var(--seq-4); }
.heat .cell.future { background: transparent; box-shadow: inset 0 0 0 1px #eceae4; }
.heat .cell.today { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }
.heat .cell:hover:not(.future) { filter: brightness(1.08); box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #9a9993; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); margin-top: 12px; flex-wrap: wrap; }
.heat-legend .sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.heat-legend .gap { width: 10px; }
.heat-sum { display: flex; gap: 24px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.heat-sum b { color: var(--ink); }

/* 场景进度 */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.scene-row { display: grid; grid-template-columns: 150px 1fr 88px; align-items: center; gap: 12px; padding: 9px 0; }
.scene-row + .scene-row { border-top: 1px solid #f1f0ec; }
.scene-name { font-size: 13.5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.scene-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: flex; height: 14px; gap: 2px; }
.stack > div { height: 100%; min-width: 0; }
.stack > div:first-child { border-radius: 4px 0 0 4px; }
.stack > div:last-child { border-radius: 0 4px 4px 0; }
.stack > div:only-child { border-radius: 4px; }
.stack .m { background: var(--seq-4); } .stack .l { background: var(--seq-2); } .stack .u { background: #e4e3dd; }
.scene-count { font-size: 12.5px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.defs { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.6; }

/* 最难的句子 */
.hard-list { list-style: none; margin: 0; padding: 0; }
.hard-item { display: grid; grid-template-columns: 22px 44px 1fr; gap: 12px; align-items: center; padding: 11px 0; }
.hard-item + .hard-item { border-top: 1px solid #f1f0ec; }
.hard-rank { font-size: 12px; color: var(--muted); text-align: center; }
.hard-emoji { font-size: 26px; text-align: center; }
.hard-zh { font-size: 18px; font-weight: 600; }
.hard-zh .py { font-size: 13px; font-weight: 400; color: var(--ink-2); margin-left: 8px; }
.hard-ug { font-size: 15px; color: var(--ink-2); text-align: left; display: block; }
.hard-ug .ug { display: inline-block; }
.hard-meta { font-size: 12px; color: var(--muted); }
.hard-counts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 5px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #f3f2ee; color: var(--ink-2); white-space: nowrap; }
.pill b { color: var(--ink); font-weight: 600; }
.call-hint { font-size: 12px; color: #1c4f8f; margin-left: 4px; }

/* 折线图 */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { font-size: 11px; fill: var(--muted); font-family: var(--zh); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .band { fill: rgba(12,163,12,.10); }
.chart .band-label { font-size: 11px; fill: var(--good-ink); }
.chart .series { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.chart .endlabel { font-size: 12px; fill: var(--ink); font-weight: 600; }
.chart .xhair { stroke: #b9b8b1; stroke-width: 1; }

/* 最近动态 */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; padding: 10px 0; align-items: center; }
.tl-item + .tl-item { border-top: 1px solid #f1f0ec; }
.tl-when { font-size: 13px; }
.tl-when .muted { font-size: 12px; display: block; }
.tl-what { font-size: 13px; color: var(--ink-2); }
.tl-what b { color: var(--ink); font-weight: 600; }
.tl-rate { font-size: 13px; font-weight: 600; text-align: right; }
.tl-gap { font-size: 12px; color: var(--warn-ink); padding: 6px 0 6px 124px; border-top: 1px dashed #efe6cf; }

/* 远程设置 */
.settings { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 22px; }
.settings h3 { font-size: 13.5px; margin: 0 0 10px; font-weight: 600; }
.set-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.set-row .field { flex: 1; min-width: 110px; }
.saved { font-size: 12.5px; color: var(--good-ink); min-height: 18px; }
.msg-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 180px; overflow: auto; }
.msg-list li { font-size: 13px; padding: 7px 10px; background: var(--surface-2); border: 1px solid #efeee9; border-radius: 8px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 10px; }
.msg-list .muted { font-size: 11.5px; white-space: nowrap; }

/* 空状态 */
.empty { text-align: center; padding: 56px 24px 60px; }
.empty .big { font-size: 44px; margin-bottom: 6px; }
.empty h2 { font-size: 20px; margin: 0 0 8px; }
.empty p { color: var(--ink-2); max-width: 560px; margin: 0 auto 8px; }
.empty .row { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.dash-foot { margin-top: 22px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }

/* ================= 内容后台 ================= */
.admin-banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 28px; font-size: 13px;
  background: #fff8e8; color: var(--warn-ink); border-bottom: 1px solid #f3e4bf; flex-wrap: wrap;
}
.admin-banner .spacer { flex: 1; }
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr) 440px; gap: 14px; padding: 14px 20px 40px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { padding: 12px 16px; border-bottom: 1px solid #f0efeb; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-h h2 { font-size: 14px; margin: 0; font-weight: 600; }
.panel-b { padding: 12px 16px; }

.tree { list-style: none; margin: 0; padding: 6px; }
.tree li { list-style: none; }
.tree ul { margin: 0; padding: 0 0 4px 0; }
.tree .node {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; user-select: none;
}
.tree .node:hover { background: #f4f3ef; }
.tree .node.active { background: var(--accent-soft); color: #1c5cab; font-weight: 600; }
.tree .node .cnt { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tree .node.active .cnt { color: #1c5cab; }
.tree .sit { padding-left: 32px; font-size: 13px; }
.tree .scene-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.filters { padding: 12px 16px; border-bottom: 1px solid #f0efeb; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 28px; padding: 0 11px; border-radius: 14px; border: 1px solid #dddcd6; background: #fff;
  font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2);
}
.chip:hover { border-color: #c9c8c1; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .c { font-size: 11.5px; opacity: .75; font-variant-numeric: tabular-nums; }
.filter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filter-row select { width: 100%; height: 30px; font-size: 12.5px; }

.tabs { display: flex; gap: 2px; }
.tab { padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); border: none; background: none; }
.tab:hover { background: #f4f3ef; }
.tab.on { background: var(--ink); color: #fff; }
.tab .n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #4a3200; font-size: 11px; margin-left: 4px; font-weight: 600; text-align: center; }

.search { position: relative; }
.search input { width: 100%; padding-left: 30px; }
.search::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 16px; }

table.cards { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.cards th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid #efeee9; position: sticky; top: 0; background: #fff; white-space: nowrap; }
table.cards td { padding: 7px 10px; border-bottom: 1px solid #f4f3ef; vertical-align: middle; }
table.cards tr.row { cursor: pointer; }
table.cards tr.row:hover td { background: #faf9f6; }
table.cards tr.row.sel td { background: var(--accent-soft); }
table.cards tr.row.retired td { opacity: .55; }
.t-zh { font-size: 15px; font-weight: 600; white-space: nowrap; }
.t-zh .e { margin-right: 6px; font-weight: 400; }
.t-zh .t-py { font-weight: 400; margin: 1px 0 0 27px; }
.t-py { color: var(--ink-2); font-family: var(--latin); font-size: 12.5px; white-space: nowrap; }
.t-ug { font-family: var(--ug); direction: rtl; text-align: right; font-size: 14.5px; color: var(--ink-2); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-missing { color: var(--critical-ink); font-size: 12px; font-family: var(--zh); direction: ltr; }
.table-wrap { max-height: calc(100vh - 300px); min-height: 360px; overflow: auto; }
.table-foot { padding: 10px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid #f0efeb; display: flex; justify-content: space-between; }
.empty-rows { text-align: center; color: var(--muted); padding: 40px 10px; }

/* 审核队列 */
.queue { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.q-item { border: 1px solid #ecebe6; border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: 48px 1fr; gap: 12px; cursor: pointer; background: #fff; }
.q-item:hover { border-color: #d8d7d0; }
.q-item.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.q-emoji { font-size: 32px; text-align: center; }
.q-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-top .zh { font-size: 17px; font-weight: 600; }
.q-ug { font-family: var(--ug); direction: rtl; text-align: left; font-size: 15px; color: var(--ink-2); }
.q-checks { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.q-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.q-msg { margin-top: 8px; }

/* 编辑器 */
.editor .panel-b { display: flex; flex-direction: column; gap: 12px; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.ed-grid .full { grid-column: 1 / -1; }
.ed-grid .field input, .ed-grid .field select, .ed-grid .field textarea { width: 100%; }
.ed-zh { font-size: 18px !important; height: 40px !important; font-weight: 600; }
.ed-ug { font-family: var(--ug); direction: rtl; font-size: 16px !important; }
.media { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px dashed #d4d3cc; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); min-height: 34px; }
.media .mi { font-size: 16px; }
.media .state { margin-left: auto; color: var(--muted); white-space: nowrap; }
.media .state.warn { color: var(--warn-ink); }
.media label.up { color: var(--accent); cursor: pointer; white-space: nowrap; }
.media input[type=file] { display: none; }
.sys { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.sys b { color: var(--ink-2); font-weight: 500; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid #f0efeb; padding-top: 12px; }
.ed-actions .spacer { flex: 1; }
.section-t { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .5px; margin: 2px 0 -4px; }
.history { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--ink-2); max-height: 120px; overflow: auto; }
.history li { padding: 3px 0; display: flex; gap: 8px; }
.history .muted { white-space: nowrap; }
.ed-empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* 电视预览（按 1920×1080 画，缩小显示） */
.tvp-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 0 0 6px #1b1b1f, 0 8px 22px rgba(0,0,0,.25); margin: 6px 0 4px; }
.tvp { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; color: #fff;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(142,77,255,.35), transparent 60%),
    radial-gradient(800px 500px at 0% 110%, rgba(230,51,122,.28), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(29,233,182,.14), transparent 60%),
    #0B0A1F;
  font-family: var(--zh); direction: rtl; }
.tvp .tv-top { position: absolute; top: 44px; right: 70px; left: 70px; display: flex; justify-content: space-between; align-items: center; font-family: var(--ug); font-size: 40px; color: rgba(255,255,255,.75); }
.tvp .tv-prog { width: 420px; height: 12px; border-radius: 6px; background: rgba(255,255,255,.14); overflow: hidden; direction: rtl; }
.tvp .tv-prog i { display: block; height: 100%; width: 40%; background: #FFA726; border-radius: 6px; }
.tvp .tv-img { position: absolute; top: 120px; left: 0; right: 0; text-align: center; font-size: 250px; line-height: 1.1; }
.tvp .tv-img .frame { display: inline-block; width: 560px; height: 330px; border-radius: 40px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); line-height: 330px; }
.tvp .tv-zh { position: absolute; top: 490px; left: 0; right: 0; text-align: center; font-size: 150px; font-weight: 600; letter-spacing: 16px; direction: ltr; white-space: nowrap; }
.tvp .tv-py { position: absolute; top: 690px; left: 0; right: 0; text-align: center; font-size: 60px; color: #1DE9B6; font-family: var(--latin); direction: ltr; }
.tvp .tv-ug { position: absolute; top: 790px; left: 0; right: 0; text-align: center; font-size: 48px; color: rgba(255,255,255,.8); font-family: var(--ug); direction: rtl; }
.tvp .tv-ring { position: absolute; top: 60px; left: 70px; display: flex; align-items: center; gap: 22px; direction: rtl; font-family: var(--ug); font-size: 38px; color: rgba(255,255,255,.8); flex-direction: row-reverse; }
.tvp .tv-ring svg { width: 84px; height: 84px; }
.tvp .tv-keys { position: absolute; bottom: 0; left: 0; right: 0; height: 120px; display: flex; justify-content: center; gap: 56px; align-items: center; background: rgba(0,0,0,.28); font-family: var(--ug); font-size: 34px; color: rgba(255,255,255,.85); direction: rtl; }
.tvp .tv-keys span { display: inline-flex; align-items: center; gap: 14px; }
.tvp .tv-keys kbd { font-family: var(--latin); font-size: 28px; min-width: 64px; height: 56px; padding: 0 12px; border-radius: 14px; background: rgba(255,255,255,.14); display: inline-grid; place-items: center; }
.tvp .tv-type { position: absolute; top: 120px; right: 70px; font-family: var(--ug); font-size: 34px; padding: 8px 26px; border-radius: 30px; background: rgba(41,121,255,.25); color: #cfe0ff; }
.tvp .tv-type.say { background: rgba(230,51,122,.25); color: #ffd3e4; }
.tvp .ghost { color: rgba(255,255,255,.3); }

details.doc { border-top: 1px solid #f0efeb; }
details.doc summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.doc summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.doc[open] summary::before { transform: rotate(90deg); }
details.doc .doc-b { padding: 0 16px 16px; font-size: 13px; color: var(--ink-2); }
details.doc h4 { font-size: 13px; color: var(--ink); margin: 14px 0 6px; }
details.doc pre { background: #1f1f1e; color: #e8e7e1; border-radius: 8px; padding: 12px 14px; font-size: 12px; line-height: 1.55; overflow: auto; font-family: "SF Mono", Menlo, Consolas, monospace; }
details.doc code { font-family: "SF Mono", Menlo, monospace; font-size: 12px; background: #f0efeb; padding: 1px 5px; border-radius: 4px; }
details.doc pre code { background: none; padding: 0; }
details.doc table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
details.doc pre .ugc { font-family: var(--ug); font-size: 14px; }
details.doc th { white-space: nowrap; }
details.doc td, details.doc th { border-bottom: 1px solid #f0efeb; padding: 6px 8px; text-align: left; vertical-align: top; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: all .2s; z-index: 200;
  background: #1f1f1e; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 窄屏（手机、小窗口） ---------- */
@media (max-width: 1280px) {
  .admin { grid-template-columns: 220px minmax(0, 1fr); }
  .admin .editor { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2b, .cols { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 14px; gap: 12px; height: auto; min-height: 52px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .topbar .clock { display: none; }
  .dash { padding: 16px 14px 48px; }
  .admin { grid-template-columns: 1fr; padding: 10px; }
  .admin #listPanel { order: 1; } .admin .editor { order: 2; } .admin #treePanel { order: 3; }
  .t-ug, table.cards th:nth-child(2) { display: none; }
  .admin-banner { padding: 8px 14px; }
  .scene-row { grid-template-columns: 100px 1fr 64px; }
  .tl-item { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .tl-when { grid-column: 1; grid-row: 1; }
  .tl-what { grid-column: 1; grid-row: 2; }
  .tl-rate { grid-column: 2; grid-row: 1 / span 2; }
  .tl-gap { padding-left: 0; }
  .hard-item { grid-template-columns: 34px 1fr; }
  .hard-rank { display: none; }
  .ed-grid { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi { min-height: 0; }
}

/* 编辑器列：固定在视口里，自己滚动；表格项不许撑破网格 */
@media (min-width: 761px) {
  .admin .editor, .admin #treePanel { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow: auto; }
}
.ed-grid > *, .field, .admin > * { min-width: 0; }
table.cards th:nth-child(2) { text-align: right; }
.media .state { overflow: hidden; text-overflow: ellipsis; }
.media > span:not(.mi) { min-width: 0; }

/* ================= 正式版新增 ================= */
/* 卡片图标（js/icons.js） */
.ico-mi { font-family: "Material Icons"; font-weight: normal; font-style: normal; line-height: 1; letter-spacing: normal;
  text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; overflow: hidden; vertical-align: middle; }
.ico-text { display: inline-block; font-weight: 700; font-family: var(--latin); line-height: 1; white-space: nowrap; vertical-align: middle; }
.ico-emoji, .ico-none { display: inline-block; line-height: 1; vertical-align: middle; }
.ico-sm.ico-mi { font-size: 20px; width: 20px; color: #6d5bd0; }
.ico-sm.ico-text { font-size: 11px; color: #6d5bd0; min-width: 20px; text-align: center; }
.ico-sm.ico-emoji, .ico-sm.ico-none { font-size: 17px; width: 20px; text-align: center; }
.ico-md.ico-mi { font-size: 30px; width: 30px; color: #6d5bd0; }
.ico-md.ico-text { font-size: 14px; color: #6d5bd0; }
.ico-md.ico-emoji, .ico-md.ico-none { font-size: 26px; }
.ico-tile { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #7c5cf0, #e6337a); }
.ico-tile .ico-mi { color: #fff; font-size: 24px; width: 24px; }
.ico-tile .ico-text { color: #fff; font-size: 12px; }
.ico-tile .ico-emoji, .ico-tile .ico-none { font-size: 21px; }
.tvp .tv-img .frame .ico-mi { font-size: 230px; width: 230px; color: #fff; line-height: 330px; }
.tvp .tv-img .frame .ico-text { font-size: 140px; color: #fff; line-height: 330px; font-family: var(--latin); }
.tvp .tv-img .frame .ico-emoji, .tvp .tv-img .frame .ico-none { font-size: 220px; line-height: 330px; }
.tvp .tv-img .frame { background: linear-gradient(135deg, rgba(124,92,240,.55), rgba(230,51,122,.45)); }

/* 顶栏：退出按钮 */
.topbar .logout { margin-left: 4px; }
.topbar .clock b { color: var(--ink); font-weight: 600; }

/* 登录页 */
body.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(700px 400px at 90% -10%, rgba(142,77,255,.12), transparent 60%), radial-gradient(600px 400px at 0% 110%, rgba(230,51,122,.10), transparent 60%), var(--page); }
.login-box { width: 100%; max-width: 360px; padding: 28px 28px 30px; }
.login-box .brand { font-size: 17px; margin-bottom: 6px; }
.login-box p { margin: 0 0 20px; font-size: 13px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box input[type=password] { height: 42px; font-size: 16px; width: 100%; }
.login-box .btn { height: 42px; font-size: 15px; }
.login-err { color: var(--critical-ink); font-size: 13px; min-height: 18px; }

/* 看板：留言删除、设备信息 */
.msg-list li > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.msg-list .msg-del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; }
.msg-list .msg-del:hover { color: var(--critical-ink); }
.scene-name .ico-mi { font-size: 18px; width: 18px; color: var(--ink-2); }
.hard-emoji .ico-mi { font-size: 28px; width: 28px; color: #6d5bd0; }
.hard-emoji .ico-text { font-size: 13px; color: #6d5bd0; }

/* 内容后台：发音 */
.audio-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px dashed #d4d3cc; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.audio-row .a-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.audio-row .a-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-family: "SF Mono", Menlo, monospace; font-size: 11.5px; }
.audio-row .a-wait { color: var(--warn-ink); }
.audio-row label.up { margin-left: auto; color: var(--accent); cursor: pointer; white-space: nowrap; }
.audio-row input[type=file] { display: none; }
.audio-row audio { width: 100%; height: 32px; }
.badge.tts { background: var(--warn-bg); color: var(--warn-ink); }
.icon-field { display: flex; gap: 8px; align-items: center; }
.icon-field input { flex: 1; }
.t-zh .e { display: inline-block; width: 22px; text-align: center; }
@media (max-width: 760px) {
  .topbar .brand-sub { display: none; }
  .topbar .spacer { display: none; }
  .topbar .logout { margin-left: auto; }
}
.brand .brand-sub { margin-left: -7px; }
