/* RTMP 推流控制中心 · 设计系统（与校园直播管理后台视觉一致） */
:root {
  --navy: #18354d;
  --navy-2: #244a67;
  --blue: #17628f;
  --blue-dark: #115378;
  --blue-soft: #edf4f8;
  --page: #f4f6f8;
  --paper: #ffffff;
  --line: #dce3e8;
  --line-soft: #e5eaed;
  --ink: #24333d;
  --muted: #687985;
  --muted-2: #87939b;
  --green: #277a59;
  --red: #b43f47;
  --warn: #d58a29;
  --focus: rgba(23, 98, 143, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 7px 24px rgba(31, 54, 69, 0.045);
  --shadow-lg: 0 24px 80px rgba(15, 35, 48, 0.22);
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--page);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }

/* ===== 登录页 ===== */
.login-page {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(480px, 0.85fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: #fff;
}
.login-showcase {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(34px, 4vw, 60px);
  color: #fff;
  background-color: #18394f;
  background-image: linear-gradient(90deg, rgba(9, 34, 52, 0.87), rgba(9, 34, 52, 0.34)), url("/assets/campus-main.jpg");
  background-position: center;
  background-size: cover;
}
.showcase-brand { display: flex; align-items: center; gap: 14px; }
.showcase-brand img {
  width: 54px;
  height: 54px;
  padding: 2px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
}
.showcase-brand > div { display: flex; flex-direction: column; gap: 5px; }
.showcase-brand strong { font-size: 17px; letter-spacing: 0.03em; }
.showcase-brand span { color: rgba(255, 255, 255, 0.72); font-size: 12px; }
.showcase-copy { max-width: 600px; padding: 60px 0; }
.showcase-copy > span {
  display: inline-block;
  margin-bottom: 18px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.showcase-copy h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(38px, 5vw, 66px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.16;
}
.showcase-copy p {
  max-width: 500px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 14px;
  line-height: 1.85;
}
.login-showcase > footer {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
}
.login-showcase > footer i { width: 24px; height: 1px; background: rgba(255, 255, 255, 0.38); }

.login-panel {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  justify-content: center;
  padding: 54px clamp(44px, 7vw, 100px) 30px;
  background: #fff;
}
.login-form-wrap { width: 100%; max-width: 430px; margin: auto; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 38px; }
.login-brand img { width: 44px; height: 44px; object-fit: contain; }
.login-brand > div { display: flex; flex-direction: column; gap: 3px; }
.login-brand strong { color: var(--navy); font-size: 14px; }
.login-brand span { color: #85929a; font-size: 10px; }
.login-panel h1 { margin: 0; color: var(--navy); font-size: 36px; font-weight: 700; letter-spacing: -0.04em; }
.login-intro { margin: 12px 0 30px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.login-form { display: grid; gap: 19px; }
.login-form label { display: grid; gap: 8px; }
.login-form label > span { color: #435662; font-size: 13px; font-weight: 700; }
.login-input {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid #cfd9df;
  border-radius: var(--radius-sm);
  color: #788892;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.login-input:focus-within { border-color: #6da2c0; box-shadow: 0 0 0 3px var(--focus); }
.login-input svg { flex: 0 0 auto; }
.login-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}
.login-submit {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  padding: 0 17px;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--blue);
  font-size: 14px;
  font-weight: 700;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.login-submit:hover { border-color: var(--blue-dark); background: var(--blue-dark); }
.login-submit:disabled { cursor: wait; opacity: 0.65; }
.login-security {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 24px;
  padding: 13px 14px;
  border: 1px solid #dfe7eb;
  border-radius: var(--radius-sm);
  color: #71838e;
  background: #f8fafb;
}
.login-security svg { flex: 0 0 auto; color: var(--green); }
.login-security > span { display: flex; flex-direction: column; gap: 3px; font-size: 10px; line-height: 1.45; }
.login-security strong { color: #506671; font-size: 11px; }
.login-panel > footer { margin-top: 26px; color: #a0a9af; font-size: 10px; text-align: center; }

.form-alert {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid #edcfd2;
  border-radius: var(--radius-sm);
  color: #9e3e45;
  background: #fff5f6;
  font-size: 12px;
}
.form-alert[hidden] { display: none; }

/* ===== 控制台框架 ===== */
.admin-shell { min-height: 100vh; min-height: 100dvh; background: var(--page); }
.admin-sidebar, .nav-backdrop { display: none; }
.admin-workspace { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(360px, 1fr) auto;
  align-items: center;
  min-height: 72px;
  padding: 0 clamp(24px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}
.topbar-brand { display: flex; align-items: center; min-width: 0; }
.topbar-brand > img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  margin-right: 12px;
  border: 1px solid #d9e0e5;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
}
.topbar-brand > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.topbar-brand strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-brand small {
  overflow: hidden;
  color: #84919a;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-menu { display: none; }

.desktop-navigation {
  display: flex;
  align-self: stretch;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 0 24px;
}
.desktop-navigation a {
  position: relative;
  display: inline-flex;
  height: 100%;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  color: #61727e;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}
.desktop-navigation a::after {
  position: absolute;
  right: 16px;
  bottom: -1px;
  left: 16px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  content: "";
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 160ms ease, transform 160ms ease;
}
.desktop-navigation a:hover { color: var(--blue); background: #f7fafb; }
.desktop-navigation a.active { color: var(--blue); }
.desktop-navigation a.active::after { opacity: 1; transform: scaleX(1); }

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.live-clock { display: flex; align-items: center; gap: 9px; color: #6d7d87; font-family: var(--mono); font-size: 12px; }
.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(39, 122, 89, 0.12);
}
.account-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background-color 160ms ease;
}
.account-button:hover { background: #f1f5f7; }
.account-button > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  font-size: 13px;
  font-weight: 700;
}
.account-button > div { display: flex; flex-direction: column; gap: 1px; text-align: left; }
.account-button strong { color: #314653; font-size: 12px; font-weight: 700; }
.account-button small { color: var(--muted-2); font-size: 10px; }

.warning-strip {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 11px clamp(24px, 3vw, 48px);
  border-bottom: 1px solid #f0ddb8;
  color: #7a5a1e;
  background: #fcf1e3;
  font-size: 12px;
}
.warning-strip button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: inherit;
  background: transparent;
  font-weight: 700;
}

.admin-main { width: 100%; flex: 1; padding: 36px clamp(24px, 3vw, 48px) 56px; }
.admin-page { width: 100%; max-width: 1380px; margin: 0 auto 52px; scroll-margin-top: 84px; }
.admin-page:last-child { margin-bottom: 0; }

.page-heading {
  display: flex;
  min-height: 84px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-heading > div:first-child { min-width: 0; }
.page-heading p {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.page-heading h1 { margin: 0; color: var(--navy); font-size: clamp(28px, 3vw, 36px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.2; }
.page-heading h2 { margin: 0; color: var(--navy); font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.25; }
.page-heading small { display: block; margin-top: 9px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.page-heading.compact { min-height: 0; }

/* ===== 通用按钮 ===== */
.subtle-button, .gold-button, .mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.subtle-button, .gold-button { min-height: 42px; padding: 0 17px; font-size: 13px; }
.subtle-button { border: 1px solid var(--line); color: #526570; background: #fff; }
.subtle-button:hover { border-color: #adc3d1; color: var(--blue); background: #f8fafb; }
.subtle-button.danger-text:hover { border-color: #ecc7ca; color: var(--red); background: #fff7f8; }
.gold-button { border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.gold-button:hover { border-color: var(--blue-dark); background: var(--blue-dark); }
.gold-button.full { width: 100%; min-height: 48px; }
.subtle-button:active, .gold-button:active, .mini-button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: 0.55; }

/* ===== 服务状态与控制 ===== */
.service-block {
  display: grid;
  gap: 10px;
  justify-items: end;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}
.service-state { display: flex; align-items: center; gap: 14px; }
.service-state small { display: block; margin-bottom: 4px; color: var(--muted-2); font-size: 11px; }
.service-state strong { color: var(--navy); font-size: 14px; }
.service-pulse { width: 11px; height: 11px; flex: 0 0 11px; border-radius: 50%; background: #9ba9b2; box-shadow: 0 0 0 5px #eef1f3; }
.service-pulse.online { background: var(--green); box-shadow: 0 0 0 5px rgba(39, 122, 89, 0.12); animation: pulse 2s ease-in-out infinite; }
.service-pulse.offline { background: var(--red); box-shadow: 0 0 0 5px rgba(180, 63, 71, 0.12); }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(39, 122, 89, 0); } }
.service-actions { display: flex; gap: 7px; }
.service-actions .subtle-button { min-height: 34px; padding: 0 13px; font-size: 12px; }

/* ===== 指标卡 ===== */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.metric-card {
  display: flex;
  min-height: 176px;
  flex-direction: column;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.metric-index { align-self: flex-end; color: #b3bec6; font-family: var(--mono); font-size: 11px; }
.metric-card p { margin: 10px 0 auto; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-card > div { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.metric-card strong { color: var(--navy); font-size: clamp(34px, 3vw, 44px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.metric-card > div span { color: var(--muted-2); font-size: 13px; }
.metric-card small { margin-top: 11px; color: var(--muted-2); font-size: 11px; }
.metric-feature strong { color: var(--blue); }
.metric-bar { height: 6px; margin-top: 15px; border-radius: 3px; background: #e8edf0; overflow: hidden; }
.metric-bar b { display: block; width: 0; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--blue), #3d8cba); transition: width 0.5s ease; }

/* ===== 卡片与带宽面板 ===== */
.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.bandwidth-panel { padding: 27px 28px; }
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-heading h2 { display: flex; margin: 0; flex-direction: column; gap: 3px; color: var(--navy); font-size: 17px; font-weight: 700; }
.card-heading h2 small { color: #95a0a7; font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.09em; }
.mono-tag {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafb;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
}
.bandwidth-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.bandwidth-item {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #f8fafb;
}
.bandwidth-item > span { color: var(--muted); font-size: 12px; }
.bandwidth-item strong { margin: auto 0 6px; color: var(--navy); font-size: clamp(22px, 2vw, 28px); font-weight: 700; letter-spacing: -0.03em; }
.bandwidth-item small { color: var(--muted-2); font-size: 10px; }
.bandwidth-item.accent { border-color: #cfe0ea; background: var(--blue-soft); }
.bandwidth-item.accent strong { color: var(--blue); }
.system-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 30px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
}
.system-foot b { color: #354955; font-weight: 700; }
.system-foot span:last-child { margin-left: auto; font-family: var(--mono); color: var(--muted-2); }

/* ===== 推流通道列表 ===== */
.stream-list { display: grid; gap: 14px; }
.stream-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) minmax(170px, 0.75fr) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 22px 26px;
}
.stream-title { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.stream-state { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: #9ba9b2; box-shadow: 0 0 0 4px #eef1f3; }
.stream-state.active { background: var(--green); box-shadow: 0 0 0 4px rgba(39, 122, 89, 0.14); animation: pulse 2s ease-in-out infinite; }
.stream-state.disabled { background: var(--red); box-shadow: 0 0 0 4px rgba(180, 63, 71, 0.12); }
.stream-title h3 { margin: 0 0 7px; color: var(--navy); font-size: 17px; font-weight: 700; }
.stream-title code { color: var(--muted); font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.stream-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stream-stat div { padding-left: 13px; border-left: 1px solid var(--line-soft); }
.stream-stat span, .stream-meta > span { display: block; margin-bottom: 6px; color: var(--muted-2); font-size: 10px; }
.stream-stat b { color: var(--navy); font-family: var(--mono); font-size: 17px; font-weight: 700; }
.stream-meta { min-width: 0; }
.stream-meta code {
  display: block;
  overflow: hidden;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: #435662;
  background: #f8fafb;
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.mini-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: #526570;
  background: #fff;
  font-size: 11px;
}
.mini-button:hover { border-color: #adc3d1; color: var(--blue); background: #f8fafb; }
.mini-button.danger { color: var(--red); border-color: #e5c8ca; background: #fff; }
.mini-button.danger:hover { border-color: var(--red); color: #fff; background: var(--red); }

.empty-state {
  display: flex;
  min-height: 240px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 13px;
  padding: 36px;
  color: var(--muted);
  text-align: center;
}
.empty-state p { margin: 0; font-size: 13px; }
.empty-state strong { color: #445964; font-size: 14px; }
.empty-state small { color: var(--muted-2); font-size: 11px; }
.empty-state > span { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; color: var(--blue); background: var(--blue-soft); }
.loader { width: 26px; height: 26px; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 审计表格 ===== */
.table-card { overflow: hidden; }
.responsive-table { width: 100%; overflow-x: auto; }
.responsive-table table { width: 100%; border-collapse: collapse; }
.responsive-table th, .responsive-table td {
  padding: 15px 20px;
  border-bottom: 1px solid #e7ecef;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.responsive-table th { color: #6f7e87; background: #f8fafb; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.responsive-table td { color: #52646f; font-size: 12px; }
.responsive-table tbody tr:last-child td { border-bottom: 0; }
.responsive-table tbody tr:hover td { background: #fbfcfd; }
.responsive-table td:first-child, .responsive-table td:last-child { font-family: var(--mono); }

/* ===== 运行日志 ===== */
.log-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.log-filters { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.log-filter { min-height: 32px; padding: 0 13px; border: 0; border-radius: 6px; color: #526570; background: transparent; font-size: 12px; }
.log-filter:hover { color: var(--blue); background: #f1f6f9; }
.log-filter.active { color: #fff; background: var(--navy); font-weight: 600; }
.log-search {
  width: 220px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: #fff;
  font-size: 12px;
}
.log-search:focus { border-color: var(--blue); outline: 2px solid var(--focus); outline-offset: 1px; }
.log-auto { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.log-auto input { width: 15px; height: 15px; accent-color: var(--blue); }
.log-card { padding: 24px 26px; }
.log-heading { margin-bottom: 16px; }
.log-view {
  padding: 14px 6px;
  min-height: 260px;
  max-height: 560px;
  overflow: auto;
  border: 1px solid #22384a;
  border-radius: 10px;
  background: #101d27;
  overscroll-behavior: contain;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
}
.log-line { display: grid; grid-template-columns: 74px 40px minmax(120px, 220px) minmax(0, 1fr); gap: 10px; padding: 3px 12px; color: #c3d1da; }
.log-line:hover { background: rgba(255, 255, 255, 0.045); }
.log-time { color: #6d8393; }
.log-level { font-weight: 700; }
.log-line.info .log-level { color: #62a8d8; }
.log-line.warn .log-level { color: #e4b356; }
.log-line.error .log-level { color: #ef7a7f; }
.log-line.warn .log-message { color: #f0d9a8; }
.log-line.error .log-message { color: #f4b9bc; }
.log-source { overflow: hidden; color: #8fa6b4; text-overflow: ellipsis; white-space: nowrap; }
.log-message { min-width: 0; overflow-wrap: anywhere; }
.log-empty { display: flex; min-height: 240px; align-items: center; justify-content: center; padding: 0 20px; color: #6d8393; text-align: center; font-size: 12px; }

/* ===== 页脚 ===== */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 0 clamp(24px, 3vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  background: #fff;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* ===== 会话内弹窗 ===== */
.dialog {
  width: min(92vw, 560px);
  padding: 0;
  border: 1px solid #dce3e7;
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(20, 37, 49, 0.54); backdrop-filter: blur(3px); }
.dialog > form, .dialog > div { padding: 26px 28px; }
.dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dialog-eyebrow { margin: 0 0 6px; color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: 0.09em; }
.dialog h2 { margin: 0; color: var(--navy); font-size: 21px; font-weight: 700; }
.dialog-note { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #75858e;
  background: #f2f5f6;
  transition: background-color 160ms ease;
}
.icon-button:hover { background: #e8edef; color: #52646f; }
.field { display: grid; gap: 8px; margin-bottom: 19px; }
.field > span { color: #435662; font-size: 13px; font-weight: 700; }
.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #cfd9df;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field input:focus { border-color: #6da2c0; outline: 0; box-shadow: 0 0 0 3px var(--focus); }
.field small { color: #82909a; font-size: 11px; line-height: 1.55; }
.input-prefix { display: flex; min-height: 46px; border: 1px solid #cfd9df; border-radius: var(--radius-sm); background: #fff; transition: border-color 160ms ease, box-shadow 160ms ease; }
.input-prefix:focus-within { border-color: #6da2c0; box-shadow: 0 0 0 3px var(--focus); }
.input-prefix b { display: grid; place-items: center; padding-left: 13px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.input-prefix input { flex: 1; min-width: 0; border: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; box-shadow: none !important; background: transparent; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 6px;
  cursor: pointer;
}
.toggle-row > span b, .toggle-row > span small { display: block; }
.toggle-row > span b { margin-bottom: 6px; color: #435662; font-size: 13px; font-weight: 700; }
.toggle-row > span small { color: #82909a; font-size: 11px; }
.toggle-row input { position: absolute; opacity: 0; }
.toggle-row i { position: relative; flex: 0 0 auto; width: 44px; height: 24px; border-radius: 20px; background: #c4ccd1; transition: background-color 0.2s; }
.toggle-row i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle-row input:checked + i { background: var(--blue); }
.toggle-row input:checked + i::after { transform: translateX(20px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.critical-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid #edcfd2;
  border-radius: var(--radius-sm);
  color: #9e3e45;
  background: #fff5f6;
  font-size: 12px;
  line-height: 1.65;
}
.critical-note svg { flex: 0 0 auto; margin-top: 1px; }
.credential-list { margin: 0 0 22px; }
.credential-list > div { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.credential-list > div:last-child { border-bottom: 0; }
.credential-list dt { margin-bottom: 8px; color: var(--muted-2); font-size: 10px; }
.credential-list dd { display: flex; align-items: center; gap: 10px; margin: 0; }
.credential-list code {
  min-width: 0;
  flex: 1;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f4f6f8;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
}
.credential-list button {
  border: 0;
  border-bottom: 1px solid var(--blue);
  color: var(--blue);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}
.dialog[data-required] [data-close-dialog] { display: none; }

/* ===== 账户菜单与提示 ===== */
.account-menu {
  position: fixed;
  z-index: 100;
  top: 66px;
  right: clamp(24px, 3vw, 48px);
  width: 192px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 15px 45px rgba(15, 35, 48, 0.16);
}
.account-menu button {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 7px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
}
.account-menu button:hover { background: #f1f5f7; }
.account-menu button:last-child { color: var(--red); }
.account-menu button:last-child:hover { background: #fbf1f2; }
.toast-region { position: fixed; right: 28px; top: 88px; z-index: 120; display: grid; gap: 10px; }
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(400px, calc(100vw - 40px));
  padding: 12px 15px;
  border: 1px solid #cfe5da;
  border-radius: var(--radius-sm);
  color: #2e6b51;
  background: #f1f8f4;
  box-shadow: 0 12px 30px rgba(31, 54, 69, 0.12);
  font-size: 12px;
  line-height: 1.55;
  animation: toast-in 0.25s ease both;
}
.toast.error { border-color: #edcfd2; color: #9e3e45; background: #fff5f6; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ===== 响应式 ===== */
@media (max-width: 1180px) {
  .admin-topbar { grid-template-columns: minmax(210px, auto) minmax(330px, 1fr) auto; padding-inline: 24px; }
  .topbar-brand small, .account-button > div { display: none; }
  .desktop-navigation { padding-inline: 10px; }
  .desktop-navigation a { padding-inline: 12px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bandwidth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stream-row { grid-template-columns: minmax(240px, 1.2fr) minmax(170px, 0.8fr); }
  .stream-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 920px) {
  .admin-topbar { grid-template-columns: auto minmax(0, 1fr) auto; min-height: 64px; padding: 0 18px; gap: 4px; }
  .mobile-menu {
    display: grid;
    width: 38px;
    height: 38px;
    margin-right: 10px;
    place-items: center;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--navy);
    background: #f1f5f7;
  }
  .topbar-brand > img { width: 36px; height: 36px; flex-basis: 36px; margin-right: 9px; }
  .topbar-brand strong { font-size: 13px; }
  .desktop-navigation, .live-clock { display: none; }

  .admin-sidebar {
    position: fixed;
    z-index: 90;
    inset: 0 auto 0 0;
    display: flex;
    width: min(310px, 86vw);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    flex-direction: column;
    color: #fff;
    background: var(--navy);
    box-shadow: 18px 0 50px rgba(16, 36, 50, 0.2);
    opacity: 0;
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 220ms ease, opacity 220ms ease, visibility 220ms;
  }
  .admin-sidebar.is-open { opacity: 1; transform: translateX(0); visibility: visible; }
  .nav-backdrop {
    position: fixed;
    z-index: 80;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(18, 35, 47, 0.48);
    backdrop-filter: blur(2px);
  }
  .sidebar-brand { display: flex; min-height: 82px; align-items: center; padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
  .sidebar-brand > img { width: 44px; height: 44px; margin-right: 11px; border-radius: 50%; background: #fff; }
  .sidebar-brand > div { display: flex; flex-direction: column; gap: 3px; }
  .sidebar-brand strong { color: #fff; font-size: 16px; letter-spacing: 0.03em; }
  .sidebar-brand span { color: rgba(255, 255, 255, 0.6); font-size: 10px; }
  .sidebar-close { display: grid; width: 36px; height: 36px; margin-left: auto; place-items: center; border: 0; border-radius: 7px; color: #fff; background: rgba(255, 255, 255, 0.09); }
  .admin-navigation { display: flex; flex: 1; flex-direction: column; gap: 5px; padding: 18px 12px; }
  .admin-navigation a { display: grid; grid-template-columns: 38px 1fr; min-height: 50px; align-items: center; padding: 0 12px; border-radius: var(--radius-sm); color: rgba(255, 255, 255, 0.67); text-decoration: none; }
  .admin-navigation a:hover, .admin-navigation a.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
  .admin-navigation strong { font-size: 13px; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
  .sidebar-user { display: flex; align-items: center; gap: 10px; }
  .sidebar-user > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: var(--navy); background: #fff; font-weight: 700; }
  .sidebar-user > div { display: flex; flex-direction: column; gap: 2px; }
  .sidebar-user strong { color: #fff; font-size: 12px; }
  .sidebar-user small { color: rgba(255, 255, 255, 0.56); font-size: 10px; }
  .sidebar-footer > button { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 7px; color: #fff; background: rgba(255, 255, 255, 0.08); }

  .admin-main { padding: 28px 20px 44px; }
  .page-heading { min-height: 0; align-items: flex-start; flex-direction: column; gap: 18px; }
  .service-block { width: 100%; justify-items: start; padding-left: 0; border-left: 0; }
  .stream-row { grid-template-columns: 1fr; gap: 18px; }
  .stream-actions { justify-content: flex-start; }

  .login-page { grid-template-columns: minmax(0, 1fr); }
  .login-showcase { display: none; }
  .login-panel { min-height: 100dvh; padding: 68px clamp(24px, 9vw, 80px) 26px; }
  .account-menu { top: 60px; right: 14px; }
}

@media (max-width: 640px) {
  .admin-topbar { padding-inline: 12px; }
  .topbar-brand strong { max-width: 150px; }
  .account-button > span { width: 32px; height: 32px; flex-basis: 32px; }
  .account-button { padding: 2px; }
  .warning-strip { justify-content: space-between; padding: 11px 16px; }
  .admin-main { padding: 24px 14px 36px; }
  .page-heading h1 { font-size: 27px; }
  .page-heading > button { align-self: stretch; }
  .metric-grid, .bandwidth-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 150px; }
  .bandwidth-item { min-height: 112px; }
  .system-foot span:last-child { width: 100%; margin-left: 0; }
  .stream-row { padding: 20px 18px; }
  .stream-meta code { white-space: normal; overflow-wrap: anywhere; }
  .stream-actions .mini-button { flex: 1 1 calc(50% - 7px); }

  .log-toolbar { width: 100%; }
  .log-filters { width: 100%; }
  .log-filter { flex: 1; padding: 0 8px; }
  .log-search { width: 100%; }
  .log-card { padding: 20px 16px; }
  .log-view { max-height: 420px; padding: 10px 2px; }
  .log-line { grid-template-columns: 64px 36px minmax(0, 1fr); gap: 4px 8px; }
  .log-message { grid-column: 1 / -1; padding-left: 100px; }

  .responsive-table { overflow: visible; }
  .responsive-table table, .responsive-table thead, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table thead { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0 0 0 0); }
  .responsive-table tbody { padding: 10px 14px; }
  .responsive-table tr { margin: 10px 0; padding: 8px 12px; border: 1px solid #e0e6ea; border-radius: 9px; background: #fff; }
  .responsive-table td {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid #edf0f2;
    white-space: normal;
    text-align: right;
  }
  .responsive-table td::before { flex: 0 0 auto; color: #89959d; content: attr(data-label); font-size: 10px; font-weight: 700; }
  .responsive-table td:last-child { border-bottom: 0; }

  .dialog > form, .dialog > div { padding: 22px 20px; }
  .footer { min-height: 96px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; padding: 18px 16px; }
  .login-panel { padding-inline: 22px; }
  .login-brand { margin-bottom: 30px; }
  .login-panel h1 { font-size: 32px; }
  .toast-region { right: 14px; left: 14px; top: 76px; }
  .toast { width: 100%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
