/* 直播设备推流管理系统 · 样式 */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #16181d;
  --ink-2: #5b6472;
  --ink-3: #9aa3b2;
  --line: #e6e8ec;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.narrow { max-width: 460px; margin: 0 auto; padding: 28px 16px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand h1 { font-size: 17px; font-weight: 650; letter-spacing: .2px; }
.brand .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: #eef1f6; color: var(--ink-2); border: 1px solid var(--line);
}
.badge.demo { background: #fff7ed; color: var(--warn); border-color: #fed7aa; }
.badge-single {
  display: inline-block; background: #fee2e2; color: var(--danger);
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px;
  margin-right: 6px; vertical-align: 1px;
}

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card h2 { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.card .hint { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink-3); font-weight: 500; font-size: 12px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td .url { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; word-break: break-all; }
td .note { font-weight: 600; }
td .id { color: var(--ink-3); font-size: 11.5px; font-family: ui-monospace, Consolas, monospace; }

.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.state.ok::before { background: var(--ok); }
.state.soon::before { background: var(--warn); }
.state.off::before { background: var(--danger); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* 播出地址 + 编辑图标同行，图标紧跟地址（不贴状态列） */
.cell-inline {
  display: flex; align-items: center; justify-content: flex-start;
  gap: 10px; min-width: 150px; max-width: 300px;
}
.cell-inline .url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-inline .btn.icon { flex-shrink: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 550;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #cfd4dc; background: #fafbfc; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #2560d8; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.icon { padding: 5px 7px; line-height: 1; color: var(--ink-2); }
.btn.icon:hover { color: var(--accent); border-color: var(--accent); }
.btn.block { width: 100%; padding: 11px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .tip { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.input, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; font-size: 14.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.input::placeholder { color: var(--ink-3); }

.seg { display: flex; gap: 8px; }
.seg label {
  flex: 1; text-align: center; padding: 10px 4px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
  background: #fff; transition: .15s; margin: 0;
}
.seg input { display: none; }
.seg input:checked + span { color: var(--accent); }
.seg label:has(input:checked) {
  border-color: var(--accent); background: #eef4ff; color: var(--accent);
}

/* 一体化组合控件：[模式下拉 | 值 | 单位/日历] */
.combo {
  display: flex; align-items: stretch;
  border: 1.5px solid var(--accent); border-radius: 9px;
  overflow: hidden; background: #fff;
}
.combo-cell {
  border: 0; border-left: 1.5px solid var(--accent);
  background: #fff; padding: 9px 12px; font-size: 14.5px;
  color: var(--ink); outline: none; min-width: 0;
  border-radius: 0;
}
.combo-cell:first-child { border-left: 0; }
select.combo-cell { font-weight: 650; cursor: pointer; min-width: 110px; }
.combo-group { display: flex; flex: 1; min-width: 0; border-left: 1.5px solid var(--accent); }
.combo-group .combo-cell { border-left: 0; }
.combo-group .combo-cell + .combo-cell { border-left: 1.5px solid var(--accent); }
.combo input.num { flex: 1; min-width: 56px; font-weight: 650; }
.combo input.grow { flex: 1; min-width: 0; }
.combo input[type="number"]::-webkit-outer-spin-button,
.combo input[type="number"]::-webkit-inner-spin-button { opacity: .45; }
.btn-cal {
  cursor: pointer; display: grid; place-items: center;
  color: var(--ink-2); padding: 0 12px;
}
.btn-cal:hover { background: #eef4ff; color: var(--accent); }
/* 隐藏浏览器自带的日期选择指示器，统一用右侧自定义日历按钮 */
.combo input[type="datetime-local"]::-webkit-calendar-picker-indicator { display: none; }
.combo:focus-within { box-shadow: 0 0 0 3px rgba(47, 111, 237, .15); }

.msg { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; margin-bottom: 12px; display: none; }
.msg.show { display: block; }
.msg.err { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.msg.ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }

/* ---------- 登录 ---------- */
.login-card { max-width: 380px; margin: 8vh auto 0; }
.login-card .logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-card .logo-row .brand-mark { width: 40px; height: 40px; font-size: 21px; }
.login-card h1 { font-size: 18px; font-weight: 650; }
.login-card .sub { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 扫码页 ---------- */
.scan-head { text-align: center; margin-bottom: 18px; }
.scan-head .brand-mark { margin: 0 auto 10px; width: 44px; height: 44px; font-size: 23px; border-radius: 12px; }
.scan-head h1 { font-size: 18px; font-weight: 650; }
.scan-head .sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

.kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink); font-weight: 650; flex-shrink: 0; }
.kv .v { text-align: right; word-break: break-all; }
.kv .v.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.expiry-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line); margin-bottom: 14px; font-size: 13.5px; }
.expiry-line strong { font-weight: 650; }
.expiry-line .left.ok { color: var(--ok); }
.expiry-line .left.soon { color: var(--warn); }
.expiry-line .left.off { color: var(--danger); }

/* 扫码页当前绑定块：推流地址 / 有效期 / 修改 */
.bind-block { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.bind-block .lb { color: var(--ink); font-weight: 650; font-size: 13.5px; margin-bottom: 5px; }
.bind-block .val { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; color: var(--ink); }
.bind-block .exp { font-size: 13.5px; font-weight: 600; }
.bind-block .exp.ok { color: var(--ok); }
.bind-block .exp.soon { color: var(--warn); }
.bind-block .exp.off { color: var(--danger); }
.bind-block + .btn.block { margin-top: 12px; }

.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; margin: 16px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.foot { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 22px; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 18, 25, .45);
  display: grid; place-items: center; padding: 16px; z-index: 50;
  animation: fadeIn .15s ease;
}
.modal {
  background: #fff; border-radius: 14px; padding: 20px;
  width: 100%; max-width: 440px; max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
.modal h3 { font-size: 16px; font-weight: 650; margin-bottom: 14px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

/* 二维码 */
.qr-box { text-align: center; padding: 14px 0 6px; }
.qr-box img { width: 230px; height: 230px; image-rendering: pixelated; }
.qr-url {
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  color: var(--ink-2); background: #f6f7f9; border: 1px dashed var(--line);
  border-radius: 8px; padding: 8px; margin-top: 10px; word-break: break-all; text-align: left;
}
.qr-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }

/* 审计 */
.audit-list { font-size: 13px; }
.audit-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.audit-item:last-child { border-bottom: none; }
.audit-item .t { color: var(--ink-3); white-space: nowrap; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.audit-item .d { word-break: break-all; }

/* 空状态 */
.empty { text-align: center; color: var(--ink-3); padding: 34px 10px; font-size: 13.5px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff; font-size: 13.5px; padding: 10px 18px;
  border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 90;
  max-width: 88vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 打印二维码贴纸 ---------- */
.print-sheet { display: none; }
@media print {
  body > #app, #toast, .modal-mask { display: none !important; }
  .print-sheet {
    display: block; text-align: center; padding-top: 20mm;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  }
  .print-sheet img { width: 60mm !important; height: 60mm !important; image-rendering: pixelated; }
  .print-sheet .p-note { font-size: 16pt; font-weight: 700; margin-top: 6mm; }
  .print-sheet .p-id { font-size: 10pt; color: #555; margin-top: 2mm; font-family: monospace; }
  .print-sheet .p-url { font-size: 7.5pt; color: #777; margin-top: 3mm; word-break: break-all; padding: 0 20mm; }
  .print-sheet .p-tip { font-size: 9pt; color: #333; margin-top: 4mm; }
}

/* 手机端设备卡片（窄屏列表） */
.m-list { display: block; }
.m-card {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; background: #fff;
}
.m-line { padding: 7px 0; font-size: 13.5px; word-break: break-all; }
.m-line .m-k { font-weight: 650; }
.m-line .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.m-ok { color: var(--ok); font-weight: 650; }
.m-off { color: var(--danger); font-weight: 650; }
.m-sub {
  color: var(--ok); font-size: 12.5px; font-weight: 600;
  padding: 0 0 8px 0;
}
.m-acts { display: flex; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.m-acts .btn { flex-shrink: 0; }

@media (max-width: 720px) {
  .wrap { padding: 14px 12px 50px; }
  .card { padding: 14px; }
  th, td { padding: 9px 8px; }
}
