:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #202421;
  background: #f5f6f4;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 1240px; padding: 28px 24px 40px; margin: auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { line-height: 1.6; }
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { min-height: 42px; border: 1px solid #c7cdc6; border-radius: 6px; background: #fff; color: #202421; padding: 9px 14px; cursor: pointer; }
button:hover { background: #f0f3ef; }
button:disabled { color: #969c96; border-color: #dce0da; background: #f3f5f1; cursor: default; }
button.primary { color: #fff; background: #244c3c; border-color: #244c3c; }
button.primary:hover { background: #183e2f; }
button.primary:disabled { background: #a2b2a7; border-color: #a2b2a7; color: #fff; }
button.danger { color: #a2332e; }
button.compact { padding: 7px 10px; font-size: 14px; }
a { color: #285940; text-underline-offset: 3px; }
input, textarea { display: block; width: 100%; color: #202421; background: #fff; border: 1px solid #bdc6bc; border-radius: 5px; padding: 10px; min-height: 42px; }
textarea { resize: vertical; min-height: 86px; line-height: 1.5; }
input[type="checkbox"] { display: inline-block; width: 18px; height: 18px; min-height: 0; margin: 0; }
input:disabled, textarea:disabled { background: #f5f6f3; color: #788278; }
label { font-size: 14px; line-height: 1.5; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
hr { border: 0; border-top: 1px solid #e2e7df; margin: 20px 0; }
form { margin: 0; }
.muted, .hint { color: #636f64; }
.hint { font-size: 13px; line-height: 1.6; }
.wrap { overflow-wrap: anywhere; }
.login-panel { width: 100%; max-width: 420px; margin: 10vh auto 0; padding: 28px; background: #fff; border: 1px solid #dbe1d8; border-radius: 10px; }
.login-panel > p { margin-top: 8px; }
.login-panel form { display: grid; gap: 10px; margin-top: 24px; }
.login-panel button { margin-top: 6px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.page-header p { margin-top: 5px; font-size: 14px; }
.page-header nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.message { padding: 12px 14px; margin-bottom: 18px; border-radius: 6px; background: #eaf1e7; color: #294832; overflow-wrap: anywhere; }
.message.error { background: #faece9; color: #8d302a; }
.login-panel .message { margin: 18px 0 0; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.device-sidebar { display: grid; gap: 20px; }
.panel { min-width: 0; background: #fff; border: 1px solid #dbe1d8; border-radius: 8px; padding: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.section-heading .muted { font-size: 13px; }
.stack { display: grid; gap: 9px; margin-top: 16px; }
.device-list { display: grid; gap: 8px; }
.device-button { width: 100%; display: grid; gap: 5px; text-align: left; padding: 12px; overflow-wrap: anywhere; }
.device-button[aria-pressed="true"] { border-color: #477759; background: #edf4e9; }
.device-button .name { font-weight: 600; }
.device-button .detail { font-size: 12px; color: #647165; }
.empty { padding: 20px 0; color: #657065; font-size: 14px; }
.device-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.device-heading > div { min-width: 0; }
.device-heading h3 { overflow-wrap: anywhere; }
.device-heading p { font-size: 13px; margin-top: 6px; }
.badge { display: inline-block; font-size: 13px; border-radius: 20px; padding: 4px 10px; color: #4e5a51; background: #edf0eb; white-space: nowrap; }
.badge.online { color: #245638; background: #e8f3e4; }
.badge.revoked { color: #8d302a; background: #faece9; }
.connection-note { margin: 16px 0 4px; font-size: 14px; line-height: 1.6; }
.connection-note.simulator { color: #875c16; }
.version-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; padding: 14px 0; border-top: 1px solid #e6eae2; border-bottom: 1px solid #e6eae2; }
.version-grid dt { color: #6a7469; font-size: 13px; }
.version-grid dd { margin: 8px 0 0; font-size: 18px; font-variant-numeric: tabular-nums; }
.device-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.content-section { margin-top: 22px; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 12px 0; min-height: 32px; }
.rows { display: grid; gap: 12px; margin: 12px 0; }
.point-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 1fr) auto; align-items: end; gap: 10px; }
.point-row label { display: grid; gap: 6px; }
.product-row { border: 1px solid #e0e6dc; border-radius: 6px; padding: 14px; display: grid; gap: 10px; }
.product-row .row-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: #647165; }
.product-row label { display: grid; gap: 6px; }
.publish-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.publish-actions button { min-width: 160px; }
.inquiries-panel { margin-top: 20px; }
.table-scroll { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e5e9e0; vertical-align: top; }
th { color: #647165; font-weight: 500; white-space: nowrap; }
td { overflow-wrap: anywhere; max-width: 250px; }
td:first-child { white-space: nowrap; }
td:last-child { font-family: ui-monospace, monospace; font-size: 12px; }
.page-footer { margin-top: 20px; color: #657065; font-size: 12px; line-height: 1.7; }
@media (max-width: 800px) {
  main { padding: 20px 16px 32px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .device-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-header { align-items: flex-start; }
  .page-header nav { flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
}
@media (max-width: 540px) {
  main { padding: 18px 12px 28px; }
  .page-header { flex-direction: column; gap: 14px; }
  .page-header nav { justify-content: flex-start; }
  .device-sidebar { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px; }
  .point-row { grid-template-columns: minmax(0, 1fr) minmax(80px, 1fr); }
  .point-row button { grid-column: 1 / -1; }
  .version-grid { gap: 8px; }
  .version-grid dd { font-size: 16px; }
  .login-panel { padding: 22px; margin-top: 7vh; }
  button { min-height: 44px; }
}

/* ====== 内容推送总管控墙 (/admin/wall) 与客户独立子页面 (/portal) ====== */
.nav-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 6px;
  background: #244c3c;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.nav-pill:hover { background: #183e2f; }
.wide-main { max-width: 1380px; }
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border: 1px solid #dbe1d8;
  border-radius: 8px;
  padding: 14px 16px;
}
.stat-card .label { font-size: 12px; color: #636f64; }
.stat-card .val { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ws-indicator { font-size: 13px; padding: 5px 11px; border-radius: 20px; background: #edf0eb; color: #4e5a51; }
.ws-indicator.live { background: #e8f3e4; color: #1f5c35; font-weight: 600; }

.broadcast-panel { margin-bottom: 22px; border-color: #b8ccb9; }
.broadcast-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 12px; }

.wall-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.wall-toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}
.terminal-card {
  background: #fff;
  border: 1px solid #d5ddd2;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.terminal-card.selected-card { border-color: #244c3c; box-shadow: 0 0 0 2px rgba(36, 76, 60, 0.14); }
.terminal-card.disabled-card { opacity: 0.72; background: #f8f9f7; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-title-row { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.portal-tag { background: #e0f2fe; color: #075985; }

/* 拟真终端屏幕汇总图框 */
.screen-preview {
  border: 2px solid #2c3530;
  border-radius: 9px;
  background: #fafbf9;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.screen-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #5c685e;
  border-bottom: 1px dashed #dce2d9;
  padding-bottom: 6px;
}
.screen-main-zone { display: grid; gap: 6px; }
.screen-zone-tag { font-size: 12px; font-weight: 600; color: #244c3c; }
.screen-chart-mini {
  background: #eff4ee;
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 12px;
  color: #2d4739;
}
.screen-item {
  background: #fff;
  border: 1px solid #e3e8e0;
  border-radius: 5px;
  padding: 8px 10px;
}
.screen-item-title { font-size: 14px; font-weight: 600; }
.screen-item-sum { font-size: 12px; color: #5b675c; margin-top: 2px; line-height: 1.45; }

.screen-portal-zone {
  border-top: 1px solid #dce2d9;
  padding-top: 8px;
  background: #f0f7ff;
  margin: 0 -12px -12px;
  padding: 9px 12px;
  border-radius: 0 0 7px 7px;
}
.screen-portal-tag { font-size: 12px; font-weight: 600; color: #0369a1; }
.screen-portal-title { font-size: 13px; font-weight: 600; margin-top: 2px; color: #0f172a; }
.screen-portal-body { font-size: 12px; color: #334155; margin-top: 2px; white-space: pre-wrap; line-height: 1.45; }

.card-meta {
  font-size: 12px;
  color: #636f64;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #ebeee8;
}
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions button { min-height: 36px; padding: 6px 10px; font-size: 13px; }

.key-modal {
  background: #f4f8f2;
  border: 1px solid #9fc0a8;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  display: grid;
  gap: 8px;
}
.mono-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: #fff;
  border: 1px solid #cbd5c8;
  border-radius: 5px;
  padding: 9px 11px;
  overflow-wrap: anywhere;
  user-select: all;
}

/* 客户独立控制子页布局 */
.portal-layout {
  display: grid;
  grid-template-columns: minmax(290px, 380px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.range-row { display: grid; gap: 6px; margin-top: 10px; }
.range-head { display: flex; justify-content: space-between; font-size: 14px; }
input[type="range"] { padding: 0; min-height: 28px; border: 0; background: transparent; }
.hour-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
select {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #bdc6bc;
  border-radius: 5px;
  background: #fff;
  color: #202421;
  font: inherit;
}
@media (max-width: 860px) {
  .portal-layout { grid-template-columns: minmax(0, 1fr); }
}
