:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #6b7a90;
  --line: #e5eaf3;
  --line-2: #eef2f8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --ok: #16a34a;
  --ok-soft: #e9f8ef;
  --warn: #d97706;
  --warn-soft: #fef4e6;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #0891b2;
  --info-soft: #e6f7fb;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
  --shadow-lg: 0 30px 60px -20px rgba(15, 23, 42, .35);
}

* { box-sizing: border-box; }
/* hidden 属性必须能覆盖组件自身的 display，否则按权限隐藏的按钮仍会显示 */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; }
code { font-family: "Cascadia Mono", Consolas, monospace; }
.muted { color: var(--muted); font-size: 12.5px; }
svg { display: block; }

/* ============================ 通用控件 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border-radius: 10px; border: 1px solid transparent;
  background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .16s ease; white-space: nowrap;
}
.btn:hover { background: #f7f9fd; }
.btn:active { transform: translateY(.5px); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .9); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warn { background: var(--warn-soft); color: #b45309; border-color: #f6dcb6; }
.btn-warn:hover { background: #fdeacb; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #cfd9e8; background: #f8fafd; }
/* 画中画开关处于开启状态 */
.btn-ghost.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  cursor: pointer; transition: all .16s;
}
.icon-btn:hover { background: #f5f8fd; border-color: #cfd9e8; color: var(--primary); }
.select {
  height: 32px; padding: 0 28px 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--ink-2); font-size: 12.5px; font-family: inherit; appearance: none; cursor: pointer; outline: none;
}
.select:focus { border-color: #b9cdf7; box-shadow: 0 0 0 3px var(--primary-soft); }

/* ============================ 登录页 ============================ */
.login-body { background: #eef2f9; }
.login-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.login-brand {
  position: relative; overflow: hidden; padding: 48px 54px;
  background: linear-gradient(155deg, #0c1a35 0%, #142a52 52%, #1e3d78 100%);
  color: #fff; display: flex; flex-direction: column;
}
.brand-top { display: flex; align-items: center; gap: 13px; }
/* 品牌标志：白底容器托住红色 logo，深色品牌区与白色顶栏都清晰 */
.brand-logo {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  padding: 5px; background: #fff; border: 1px solid #f1e2e3;
  box-shadow: 0 10px 24px -12px rgba(10, 24, 50, .55);
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-logo.sm { width: 34px; height: 34px; border-radius: 10px; padding: 3px; }
.brand-top h1 { font-size: 19px; letter-spacing: .01em; }
.brand-sub { font-size: 12.5px; color: #a9c0e2; margin-top: 3px; }
.brand-copy { margin-top: auto; max-width: 430px; }
.brand-copy h2 { font-size: 34px; line-height: 1.35; letter-spacing: -.02em; font-weight: 700; }
.brand-copy p { margin-top: 16px; color: #b9cdea; font-size: 14px; line-height: 1.9; }
.brand-points { list-style: none; padding: 0; margin: 34px 0 auto; display: grid; gap: 12px; }
.brand-points li { display: flex; align-items: center; gap: 10px; color: #d5e3f7; font-size: 13.5px; }
.brand-points .dot { width: 6px; height: 6px; border-radius: 50%; background: #60a5fa; box-shadow: 0 0 0 4px rgba(96, 165, 250, .16); }
.brand-foot { font-size: 11.5px; color: #7189ad; letter-spacing: .12em; margin-top: 40px; }
.brand-glow {
  position: absolute; width: 460px; height: 460px; right: -190px; top: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, .38), transparent 62%); filter: blur(10px); pointer-events: none;
}
.login-form-wrap { display: grid; place-items: center; padding: 40px; position: relative; }
.login-card {
  width: 100%; max-width: 386px; background: #fff; padding: 38px 34px 30px;
  border-radius: 20px; box-shadow: var(--shadow); border: 1px solid #fff;
}
.login-card h3 { font-size: 22px; }
.login-card > .muted { margin-top: 8px; }
.field { display: block; margin-top: 22px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.field input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line);
  background: #fbfcfe; font-size: 14px; color: var(--ink); outline: none; transition: all .16s;
  font-family: inherit;
}
.field input:focus { border-color: #9dbcf7; background: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.field-pass { position: relative; }
.field-pass input { padding-right: 44px; }
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 8px;
}
.eye:hover { background: #eef2f9; color: var(--ink-2); }
.login-error {
  min-height: 20px; margin-top: 12px; font-size: 12.5px; color: var(--danger); font-weight: 500;
}
.login-hint {
  margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted);
}
.login-hint code { background: #f4f7fc; padding: 4px 9px; border-radius: 6px; color: var(--ink-2); font-size: 12px; }
.copyright { position: absolute; bottom: 22px; font-size: 11.5px; color: #94a3b8; }

/* ============================ 顶栏 ============================ */
.topbar {
  height: 62px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.topbar-title { display: flex; align-items: baseline; gap: 8px; }
.topbar-title strong { font-size: 15.5px; }
.topbar-title span { font-size: 12.5px; color: var(--muted); padding-left: 8px; border-left: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.conn-badge {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: 20px; background: var(--ok-soft); color: #15803d; font-size: 12px; font-weight: 600;
}
.conn-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .16); animation: pulse 2s infinite; }
.conn-badge.down { background: var(--danger-soft); color: #b91c1c; }
.conn-badge.down i { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .14); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px;
  border-radius: 20px; background: #f5f8fd; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, #60a5fa, #2563eb); color: #fff; font-size: 12px; font-weight: 700;
}

/* ============================ 页面布局 ============================ */
.page { padding: 20px 22px 34px; max-width: 1560px; margin: 0 auto; display: grid; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { margin-top: 7px; font-size: 27px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 5px; }
.stat-value small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-foot { margin-top: 9px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.pill { font-style: normal; padding: 2px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; }
.pill.ok { background: var(--ok-soft); color: #15803d; }
.pill.off { background: #f1f5f9; color: #64748b; }
.pill.info { background: var(--info-soft); color: #0e7490; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.panel-title { display: flex; align-items: baseline; gap: 10px; }
.panel-title h2 { font-size: 15px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search {
  position: relative; display: flex; align-items: center; height: 32px; width: 236px;
  border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; padding: 0 10px; gap: 7px;
  color: var(--muted); transition: all .16s;
}
.search:focus-within { border-color: #9dbcf7; background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.search input { border: 0; background: transparent; outline: none; font-size: 12.5px; width: 100%; color: var(--ink); font-family: inherit; }

/* ============================ 设备表格 ============================ */
.table-wrap { overflow-x: auto; }
.dev-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dev-table th {
  text-align: left; font-size: 11.5px; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  padding: 10px 14px; background: #fafbfe; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.dev-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.dev-table tbody tr { transition: background .14s; }
.dev-table tbody tr:hover { background: #f9fbff; }
.dev-table tbody tr.selected { background: #f2f7ff; }
.col-check { width: 40px; }
.col-actions { text-align: right; width: 1%; }
.dev-check { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.dev-name { display: flex; align-items: center; gap: 10px; }
.dev-ico {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); flex-shrink: 0;
}
.dev-ico.off { background: #f1f5f9; color: #94a3b8; }
.dev-meta strong { font-size: 13.5px; font-weight: 650; display: block; }
.dev-meta span { font-size: 11.5px; color: var(--muted); }
.group-tag {
  display: inline-block; margin-left: 6px; font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
  background: #f1f5f9; color: #64748b; font-weight: 600; vertical-align: 1px;
}
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; }
.status.online { color: #15803d; }
.status.online i { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.status.offline { color: #94a3b8; }
.status.offline i { background: #cbd5e1; }
.status.preview { color: var(--primary); }
.status.preview i { background: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .16); animation: pulse 1.6s infinite; }
.status.shutting { color: var(--warn); }
.status.shutting i { background: var(--warn); box-shadow: 0 0 0 3px rgba(217, 119, 6, .18); animation: pulse 1.2s infinite; }
/* 放音占用标记：与「预览中」并列，让所有人都能看到谁在广播 */
.talk-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap; vertical-align: 1px;
  background: #fff2e3; color: #b45309;
}
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; color: var(--ink-2); }
/* IP 列：可直接点击编辑 */
.ip-cell { cursor: pointer; border-bottom: 1px dashed transparent; padding: 1px 0; transition: color .15s, border-color .15s; }
.ip-cell:hover { color: var(--brand); border-bottom-color: var(--brand); }
.ip-tag {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px;
  font-size: 10px; font-style: normal; line-height: 15px; vertical-align: 1px;
  color: #b45309; background: var(--warn-soft, #fef4e6);
}
.perm { display: flex; gap: 4px; flex-wrap: wrap; }
.perm span {
  font-size: 10.5px; padding: 2px 6px; border-radius: 5px; font-weight: 600;
  background: #f1f5f9; color: #94a3b8;
}
.perm span.yes { background: var(--ok-soft); color: #15803d; }
.perm span.no { background: var(--danger-soft); color: #b91c1c; }
.chans { display: flex; gap: 5px; }
.chans span {
  font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: #f4f6fb; color: #9aa8bb; font-weight: 600;
}
.chans span.on { background: var(--primary-soft); color: var(--primary-dark); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.act {
  height: 29px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.act:hover { border-color: #b9cdf7; color: var(--primary-dark); background: #f5f9ff; }
.act:disabled { opacity: .44; cursor: not-allowed; border-color: var(--line); color: var(--ink-2); background: #fff; }
.act.danger:hover { border-color: #f5c2c2; color: #b91c1c; background: #fff6f6; }
.panel-foot {
  display: flex; align-items: center; justify-content: space-between; padding: 11px 18px;
  font-size: 12px; color: var(--ink-2); background: #fbfcfe; border-top: 1px solid var(--line-2);
}

.empty { padding: 54px 20px 60px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; color: #b7c4d8; margin-bottom: 12px; }
.empty h3 { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: 12.5px; }
.empty code {
  display: inline-block; margin-top: 14px; background: #f4f7fc; border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 8px; font-size: 12px; color: var(--ink-2);
}

/* ============================ 日志 ============================ */
.log-panel .panel-head { border-bottom: 1px solid var(--line-2); }
.log-list { max-height: 260px; overflow-y: auto; padding: 6px 0; }
.log-row {
  display: grid; grid-template-columns: 148px 56px 1fr; gap: 10px; align-items: baseline;
  padding: 7px 18px; font-size: 12.5px; border-bottom: 1px dashed #f2f5fa;
}
.log-row:hover { background: #fafcff; }
.log-time { color: #94a3b8; font-family: "Cascadia Mono", Consolas, monospace; font-size: 11.5px; }
.log-lv { font-size: 10.5px; font-weight: 700; text-align: center; border-radius: 5px; padding: 1px 0; }
.log-lv.INFO { background: #f1f5f9; color: #64748b; }
.log-lv.OP { background: var(--primary-soft); color: var(--primary-dark); }
.log-lv.WARN { background: var(--warn-soft); color: #b45309; }
.log-lv.ERROR { background: var(--danger-soft); color: #b91c1c; }
.log-msg { color: var(--ink-2); word-break: break-all; }

/* ============================ 弹窗 ============================ */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); padding: 24px;
}
.modal.open { display: flex; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }

.preview-card { width: min(1180px, 96vw); display: flex; flex-direction: column; overflow: hidden; }
.pv-head {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.pv-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pv-title h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .16); }
.status-dot.off { background: #cbd5e1; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #f1f5f9; color: #64748b;
  font-weight: 600; font-family: "Cascadia Mono", Consolas, monospace;
}
.tag.ghost { background: var(--primary-soft); color: var(--primary-dark); font-family: inherit; }
.pv-tabs { display: flex; gap: 4px; background: #f4f6fb; padding: 3px; border-radius: 10px; margin-left: auto; }
.pv-tabs button {
  height: 28px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent;
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s;
}
.pv-tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.pv-tabs button:disabled { opacity: .4; cursor: not-allowed; }
.pv-tools { display: flex; align-items: center; gap: 6px; }
.pv-tools select {
  height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid #dbe3ef;
  background: #fff; color: #172033; font-size: 12.5px; cursor: pointer; max-width: 128px;
}
.pv-tools select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.pv-tools select:disabled { opacity: .5; cursor: not-allowed; }
.pv-close { border: 0; }

.pv-stage {
  position: relative; background: #0b1220; aspect-ratio: 16 / 9; max-height: 68vh;
  display: grid; place-items: center; overflow: hidden;
}
#pvCanvas { width: 100%; height: 100%; display: block; object-fit: contain; }
/* 画中画：主画面之外再叠一路（屏幕 + 摄像头同看），点小窗主副互换 */
.pv-pip {
  position: absolute; right: 16px; bottom: 16px; width: 27%; min-width: 168px; max-width: 380px;
  aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; cursor: pointer; z-index: 3;
  border: 1px solid rgba(148, 163, 184, .38); background: #0b1220;
  box-shadow: 0 10px 28px rgba(2, 6, 23, .6); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pv-pip:hover { border-color: rgba(96, 165, 250, .85); box-shadow: 0 12px 34px rgba(37, 99, 235, .4); transform: translateY(-1px); }
.pv-pip[hidden] { display: none; }
.pv-pip canvas { width: 100%; height: 100%; display: block; }
.pv-pip-tag {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(15, 23, 42, .78); color: #dbeafe; font-size: 11px; font-weight: 600;
  backdrop-filter: blur(4px); pointer-events: none;
}
/* 小窗占住右下角时，把"现场声音"提示挪到左下，避免叠在一起 */
.pv-stage.has-pip .pv-audio { left: 14px; right: auto; }
.pv-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: #93a7c4; font-size: 13px; background: radial-gradient(circle at 50% 45%, #16233d, #0b1220 70%);
}
.pv-overlay[hidden] { display: none; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid rgba(147, 167, 196, .22);
  border-top-color: #60a5fa; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pv-badge {
  position: absolute; left: 14px; top: 14px; display: none; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 20px; background: rgba(220, 38, 38, .92); color: #fff;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; animation: blink 1.6s infinite;
}
.pv-badge.show { display: inline-flex; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
/* 录制中角标（右上角，避免和左上"正在被查看"重叠） */
.pv-rec {
  position: absolute; right: 14px; top: 14px; display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 20px; background: rgba(15, 23, 42, .82); color: #fecaca;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  border: 1px solid rgba(239, 68, 68, .55); backdrop-filter: blur(6px); z-index: 4;
}
.pv-rec[hidden] { display: none; }
.pv-rec i { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: blink 1.2s infinite; }
/* 录制按钮：未录时白底，录制中变红提示"再点一下停止" */
.btn.rec.on { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.btn.rec.on::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #dc2626; margin-right: 6px; vertical-align: 1px; animation: blink 1.2s infinite;
}
.pv-audio {
  position: absolute; right: 16px; bottom: 16px; display: none; align-items: center; gap: 10px;
  padding: 7px 14px; border-radius: 12px; background: rgba(15, 23, 42, .72);
  color: #cfe0f7; font-size: 11.5px; backdrop-filter: blur(6px);
}
.pv-audio.show { display: flex; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.bars i { width: 3px; border-radius: 2px; background: #60a5fa; height: 4px; transition: height .1s linear; }
.pv-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 16px; border-top: 1px solid var(--line); background: #fbfcfe; font-size: 12px;
}
.pv-stats { display: flex; align-items: center; gap: 14px; color: var(--ink-2); font-weight: 600; }
.pv-vol { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.pv-vol input { width: 110px; accent-color: var(--primary); }
/* 对讲按钮：按住说话，把本机麦克风送到现场音箱 */
.talk-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 12px; font-family: inherit; font-weight: 600; cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.talk-btn:hover { border-color: #9dbcf7; color: var(--primary); }
.talk-btn:active { transform: translateY(1px); }
.talk-btn.on {
  background: #dc2626; border-color: #dc2626; color: #fff;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .16);
  animation: talkPulse 1.4s ease-in-out infinite;
}
.talk-btn.on svg { stroke: #fff; }
@keyframes talkPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220, 38, 38, .16); }
  50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, .05); }
}
.talk-btn:disabled { opacity: .45; cursor: not-allowed; }

.dialog-card { width: min(430px, 94vw); padding: 22px 24px 18px; }
.dialog-card.wide { width: min(720px, 96vw); }
/* 批量改 IP 列表 */
.bulk-ip-list { margin-top: 10px; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.bulk-ip-row { display: grid; grid-template-columns: 1fr 130px 130px; gap: 10px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.bulk-ip-row:last-child { border-bottom: none; }
.bulk-ip-row:nth-child(odd) { background: #fafbfe; }
.bi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.bi-now { color: var(--muted); }
.bi-input { width: 100%; height: 30px; border-radius: 8px; border: 1px solid var(--line); padding: 0 8px; font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace; outline: none; }
.bi-input:focus { border-color: #9dbcf7; box-shadow: 0 0 0 3px var(--primary-soft); }
.chk-line { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 2px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; cursor: pointer; }
.chk-line input { margin-top: 2px; accent-color: var(--primary); }
.dialog-card h3 { font-size: 16.5px; }
.dlg-body { margin: 14px 0 20px; font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.dlg-body strong { color: var(--ink); }
.dlg-body .warn-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft);
  color: #b91c1c; font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start;
}
.dlg-body .hint-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #f5f8fd;
  color: var(--muted); font-size: 12px;
}
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; }
.dlg-body label.fl { display: block; font-size: 12.5px; font-weight: 600; margin: 14px 0 7px; }
.dlg-body input[type="text"], .dlg-body input[type="number"] {
  width: 100%; height: 38px; border-radius: 9px; border: 1px solid var(--line); padding: 0 11px;
  font-size: 13px; outline: none; font-family: inherit; color: var(--ink);
}
.dlg-body input:focus { border-color: #9dbcf7; box-shadow: 0 0 0 3px var(--primary-soft); }
.delay-presets { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.delay-presets button {
  height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-size: 12px; color: var(--ink-2); cursor: pointer; font-weight: 600;
}
.delay-presets button.active { border-color: #9dbcf7; background: var(--primary-soft); color: var(--primary-dark); }

/* ============================ 行操作菜单 ============================ */
.ctx-menu {
  position: fixed; z-index: 150; min-width: 150px; padding: 5px;
  background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow);
  display: grid; gap: 2px;
}
.ctx-menu button {
  text-align: left; height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.ctx-menu button:hover { background: var(--primary-soft); color: var(--primary-dark); }

/* ============================ Toast ============================ */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 10px; justify-items: end; }
.toast {
  min-width: 220px; max-width: 380px; padding: 11px 15px; border-radius: 11px; background: #0f172a; color: #fff;
  font-size: 13px; box-shadow: var(--shadow-lg); animation: slide .22s ease; display: flex; gap: 9px; align-items: flex-start;
}
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
.toast.warn { background: #78350f; }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================ 响应式 ============================ */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .preview-card { width: 98vw; }
  .pv-title h3 { max-width: 150px; }
}
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .page { padding: 14px; }
  .topbar { padding: 0 14px; }
  .topbar-title span { display: none; }
  .search { width: 100%; }
  .toolbar { width: 100%; }
}
@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 22px; }
  .log-row { grid-template-columns: 110px 48px 1fr; }
  .user-chip span:not(.avatar) { display: none; }
}

/* ============================ 用户与权限管理 ============================ */
#userModal, #schoolModal { z-index: 90; }
.um-card { width: min(780px, 96vw); padding: 22px 24px 14px; }
.um-card h3 { font-size: 16.5px; margin-bottom: 8px; }
.um-tip {
  font-size: 12px; line-height: 1.7; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line-2);
  padding: 8px 11px; border-radius: 9px; margin-bottom: 12px;
}
.um-scroll { max-height: 44vh; overflow: auto; margin-bottom: 12px; }
.um-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--line-2);
}
.um-row:last-child { border-bottom: 0; }
.um-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.um-id strong { font-size: 13px; color: var(--ink); }
.um-id span { font-size: 11.5px; color: var(--muted); font-family: "Cascadia Mono", Consolas, monospace; }
.um-role-sel {
  height: 28px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink-2); font-size: 12.5px; padding: 0 6px;
}
.um-state { font-size: 11px; padding: 2.5px 7px; border-radius: 5px; white-space: nowrap; }
.um-state.on { color: #12813f; background: var(--ok-soft); }
.um-state.off { color: var(--danger); background: var(--danger-soft); }
.um-acts { display: flex; gap: 6px; }
.um-add {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px dashed var(--line);
}
.um-add input, .um-add select {
  flex: 1 1 130px; min-width: 0; height: 32px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0 10px; font-size: 12.5px; color: var(--ink); background: #fff;
}
.um-add input:focus, .um-add select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.role-badge {
  font-style: normal; font-size: 10.5px; line-height: 16px; padding: 0 6px;
  border-radius: 5px; color: var(--primary-dark); background: var(--primary-soft);
  margin-left: 2px; white-space: nowrap;
}

/* ==================== 网卡参数表单（IP / 掩码 / 网关 / DNS） ==================== */
.net-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px; margin-top: 4px;
}
.net-grid .fl { margin-top: 10px; }
.net-grid .hint-box { font-size: 11.5px; line-height: 1.5; }

/* ============================ 批量广播 ============================ */
.bc-card { width: min(680px, 96vw); padding: 20px 22px 16px; display: flex; flex-direction: column; max-height: 90vh; }
.bc-card h3 { font-size: 16.5px; margin-bottom: 4px; }
.bc-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.bc-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.bc-tabs button {
  flex: 1; height: 38px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.bc-tabs button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.bc-pane { display: none; }
.bc-pane.active { display: block; }
.bc-file {
  width: 100%; padding: 14px; border: 1.5px dashed var(--line); border-radius: 10px;
  background: #fafbfe; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.bc-file:hover { border-color: var(--primary); }
.bc-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.bc-opts input[type="range"] { flex: 1; min-width: 110px; accent-color: var(--primary); }
.bc-devs {
  max-height: 190px; overflow: auto; border: 1px solid var(--line);
  border-radius: 10px; margin-top: 6px;
}
.bc-dev {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid var(--line-2); font-size: 12.5px;
}
.bc-dev:last-child { border-bottom: 0; }
.bc-dev:nth-child(odd) { background: #fafbfe; }
.bc-dev input { accent-color: var(--primary); }
.bc-dev .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
.bc-dev .ip { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
.bc-dev .st { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: #f1f5f9; color: #64748b; white-space: nowrap; }
.bc-dev .st.ok { background: var(--ok-soft); color: #12813f; }
.bc-dev .st.err { background: var(--danger-soft); color: #b91c1c; }
.bc-dev .st.busy { background: #fff2e3; color: #b45309; }
.bc-status {
  margin-top: 12px; padding: 10px 12px; border-radius: 9px;
  background: #f5f8fd; color: var(--ink-2); font-size: 12.5px; min-height: 38px;
  display: flex; align-items: center; gap: 8px;
}
.bc-status.live { background: var(--danger-soft); color: #b91c1c; font-weight: 600; }
.bc-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.bc-status.live .bc-dot { background: var(--danger); animation: talkPulse 1.2s infinite; }
.bc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.bc-foot > div { display: flex; gap: 8px; }
