/* emby-proxy 面板样式：仪器面板风（蓝灰机身 + 琥珀读数 + 青色测量线）
   —— 不引外部字体/CDN，面板在墙内、离线机器上也要能正常渲染。 */

:root {
  --bezel: #0e1622;          /* 机身：偏蓝的石墨色，不是假黑 */
  --bezel-2: #0b1420;        /* 凹陷面（输入框/终端） */
  --panel: #14202f;          /* 抬起面 */
  --rule: #22344a;           /* 丝印细线 */
  --amber: #f5a524;          /* 主读数：启用/主按钮/关键数值 */
  --cyan: #5ad1e3;           /* 测量值：延迟/链路/链接 */
  --rose: #ff6b85;           /* 故障与危险操作 */
  --text: #e7eef7;
  --dim: #859ab4;
  --sans: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei",
          "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas,
          "Noto Sans Mono CJK SC", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bezel);
  background-image: linear-gradient(180deg, #16243500 0, #16243566 100%);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -.01em; font-weight: 650; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }

a { color: var(--cyan); }

.mono, input.mono, textarea.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.hint { color: var(--dim); font-size: 13px; line-height: 1.7; max-width: 68ch; }
.err { color: var(--rose); font-size: 13px; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 按钮 ---------- */

.btn {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #1a2839;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: #223449; border-color: #2e4763; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #14202f;
  font-weight: 650;
}
.btn-primary:hover { background: #ffb843; border-color: #ffb843; }

.btn-ghost { background: none; border-color: transparent; color: var(--dim); }
.btn-ghost:hover { background: #1a2839; color: var(--text); }

.btn-danger { background: none; border-color: #4a2634; color: var(--rose); }
.btn-danger:hover { background: #3a1c27; border-color: var(--rose); color: #ffd0d9; }

.btn-sm { padding: 4px 9px; font-size: 12.5px; }

/* ---------- 启动占位 ---------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  justify-items: center;
  color: var(--dim);
  font-size: 13px;
}
.boot-trace {
  width: 180px;
  height: 2px;
  background: var(--rule);
  overflow: hidden;
  position: relative;
}
.boot-trace::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: sweep 1.1s linear infinite;
}
@keyframes sweep { from { transform: translateX(-60px); } to { transform: translateX(180px); } }

/* ---------- 登录 ---------- */

.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }

.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 30px 28px 24px;
  position: relative;
}
.login-trace {
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 2px;
  background: var(--rule);
  overflow: hidden;
  border-radius: 6px 6px 0 0;
}
.login-trace i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 90px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  animation: sweep-wide 2.6s ease-in-out infinite;
}
@keyframes sweep-wide { from { transform: translateX(-90px); } to { transform: translateX(380px); } }

.login-sub { color: var(--dim); font-size: 13px; margin: 8px 0 22px; }
.login-box label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.login-box input { width: 100%; margin-bottom: 16px; }
.login-box .btn { width: 100%; padding: 10px; }
.login-box .err { margin-top: 12px; }

/* ---------- 输入控件 ---------- */

input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bezel-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  outline: none;
  box-shadow: 0 0 0 3px #5ad1e31f;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
select { appearance: none; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ---------- 顶栏 ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 22px;
  border-bottom: 1px solid var(--rule);
  background: #101b28;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 16px; }
.brand small { color: var(--dim); font-size: 12px; font-family: var(--mono); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.ok { background: var(--amber); box-shadow: 0 0 0 3px #f5a5242e; }
.dot.bad { background: var(--rose); box-shadow: 0 0 0 3px #ff6b852e; }

.gauges {
  display: flex;
  gap: 20px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.gauges::-webkit-scrollbar { display: none; }
.gauge { flex: none; line-height: 1.35; }
.gauge b {
  display: block;
  font-size: 13px;
  font-weight: 550;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gauge span { font-size: 11px; color: var(--dim); }
.gauge.warn b { color: var(--amber); }
.gauge.bad b { color: var(--rose); }

.bar-actions { display: flex; gap: 8px; flex: none; }

/* ---------- 信号链 ---------- */

.chain {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}
.chain-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: max-content;
}
.node { position: relative; padding-right: 34px; }
.node:last-child { padding-right: 0; }

/* 节点之间的连线：一条 1px 走线 + 中间一个小菱形，像面板上的信号走向 */
.node:not(:last-child)::before {
  content: "";
  position: absolute;
  right: 8px;
  left: calc(100% - 26px);
  top: 21px;
  border-top: 1px solid var(--rule);
}
.node:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 18px;
  width: 5px;
  height: 5px;
  background: var(--rule);
  transform: rotate(45deg);
}
.node.live:not(:last-child)::before { border-color: #35597a; }
.node.live:not(:last-child)::after { background: var(--cyan); }

.node-k { display: block; font-size: 11px; color: var(--dim); margin-bottom: 3px; }
.node-v {
  display: block;
  font-family: var(--mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.node.live .node-v { color: var(--amber); }
.node.off .node-v { color: var(--dim); }
.node-x { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; }

.chain-note { margin-top: 12px; font-size: 12.5px; color: var(--dim); }

/* 载入时整条链路扫一次，之后只在用户操作（探测/优选）时再扫 */
.chain { position: relative; }
.chain.sweep::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 130px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, #5ad1e314, transparent);
  animation: chain-sweep 1.2s ease-out 1;
}
@keyframes chain-sweep { from { transform: translateX(-130px); } to { transform: translateX(100vw); } }

/* ---------- 分区导航 ---------- */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  font: inherit;
  font-size: 14px;
  color: var(--dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 14px;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--amber); }

main { max-width: 1180px; padding: 22px; }
.tab { display: none; }
.tab.on { display: block; }

.tab-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tab-head h2 { margin-bottom: 6px; }
.tab-head-act { display: flex; gap: 8px; flex: none; }

/* ---------- 规则通道条 ---------- */

.strip {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) 138px auto;
  gap: 20px;
  align-items: start;
  padding: 16px 14px 16px 12px;
  border-top: 1px solid var(--rule);
  border-left: 2px solid transparent;
  transition: background .12s, border-color .12s;
}
.strip:last-child { border-bottom: 1px solid var(--rule); }
.strip:hover { background: #17232f; border-left-color: var(--amber); }
.strip.off { color: var(--dim); }
.strip.off .port-n { color: var(--dim); }

.strip-port { display: flex; flex-direction: column; gap: 2px; }
.port-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--amber);
}
.port-k { font-size: 11px; color: var(--dim); }

.strip-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.strip-title b { font-size: 15px; font-weight: 600; }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; font-size: 12.5px; }
.kv dt { color: var(--dim); }
.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.kv dd.plain { font-family: var(--sans); }

.badge {
  font-size: 11.5px;
  line-height: 1.5;
  padding: 1px 7px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--dim);
  white-space: nowrap;
}
.badge.cy { color: var(--cyan); border-color: #2c5563; }
.badge.am { color: var(--amber); border-color: #5b4520; }
.badge.ro { color: var(--rose); border-color: #4a2634; }
.badge.pin { border-style: dashed; font-family: var(--mono); }

/* 延迟读数：数字在上，走线在下，数据更新时条形有过渡 */
.strip-meter { text-align: right; }
.meter-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  color: var(--cyan);
  line-height: 1.2;
}
.meter-n small { font-size: 11px; color: var(--dim); }
.meter-n.none { color: var(--dim); font-size: 13px; }
.meter-n.bad { color: var(--rose); }
.meter { height: 3px; background: var(--rule); margin: 7px 0 5px; overflow: hidden; }
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cyan);
  transition: width .5s cubic-bezier(.2, .7, .3, 1);
}
.meter.slow i { background: var(--amber); }
.meter.bad i { background: var(--rose); }
.meter-note { font-size: 11px; color: var(--dim); }

.strip-act { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.strip-act .btn { white-space: nowrap; }

/* 开关：真实 checkbox 保留键盘可达性，外观自绘 */
.sw { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 11px; color: var(--dim); }
.sw input { position: absolute; opacity: 0; width: 30px; height: 16px; margin: 0; cursor: pointer; }
.sw i {
  width: 30px;
  height: 16px;
  border-radius: 8px;
  background: #24364c;
  border: 1px solid var(--rule);
  position: relative;
  flex: none;
  transition: background .15s;
}
.sw i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dim);
  transition: transform .15s, background .15s;
}
.sw input:checked + i { background: #4a3a1c; border-color: #6b5124; }
.sw input:checked + i::after { transform: translateX(14px); background: var(--amber); }
.sw input:focus-visible + i { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- 空状态 ---------- */

.empty {
  border: 1px dashed var(--rule);
  border-radius: 5px;
  padding: 26px 20px;
  color: var(--dim);
  font-size: 13.5px;
}
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 6px; font-weight: 600; }

/* ---------- 入口列表 ---------- */

.entry {
  display: grid;
  grid-template-columns: 30px minmax(0, 1.6fr) minmax(0, 1fr) 120px auto;
  gap: 14px;
  align-items: center;
  padding: 11px 12px;
  border-top: 1px solid var(--rule);
}
.entry:last-of-type { border-bottom: 1px solid var(--rule); }
.entry input { margin: 0; }
.entry-ms {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--cyan);
}
.entry-ms.dim { color: var(--dim); font-size: 12px; }
.entry-ms.bad { color: var(--rose); font-size: 12px; }
.entry-note { font-size: 11.5px; color: var(--dim); grid-column: 2 / -1; margin-top: -6px; }
.entry-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1.6fr) minmax(0, 1fr) 120px auto;
  gap: 14px;
  padding: 0 12px 7px;
  font-size: 11px;
  color: var(--dim);
}
.entry-head span:nth-child(4) { text-align: right; }

/* ---------- 参数 ---------- */

.pgroup { margin-bottom: 26px; }
.pgroup > h3 { margin-bottom: 4px; }
.pgroup > .hint { margin-bottom: 14px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 16px; }

.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
.field .sub { font-size: 11.5px; color: var(--dim); margin-top: 5px; line-height: 1.55; }
.field .err { margin-top: 5px; }
.field.wide { grid-column: 1 / -1; }

/* ---------- 终端窗格（日志 / 配置预览） ---------- */

.term {
  margin: 0;
  background: var(--bezel-2);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: #c7d6e6;
  max-height: 62vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}
.term .t { color: var(--dim); }
.term .k-warn { color: var(--amber); }
.term .k-err { color: var(--rose); }
.term .k-debug { color: #6d829b; }

/* ---------- 弹层 ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: #060c14cc;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}
.sheet {
  width: 100%;
  max-width: 660px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 24px 60px #030811b3;
}
.sheet-sm { max-width: 400px; }
.sheet > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--rule);
}
.sheet-body { padding: 18px; overflow: auto; }
.sheet > footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 18px;
  border-top: 1px solid var(--rule);
}
.sheet > footer .err { margin-right: auto; flex: 0 1 auto; }
.x { font: inherit; font-size: 20px; line-height: 1; color: var(--dim);
  background: none; border: none; cursor: pointer; padding: 2px 6px; }
.x:hover { color: var(--text); }

/* 弹层内的分节与表单网格 */
.sect { border-top: 1px solid var(--rule); margin-top: 20px; padding-top: 16px; }
.sect:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.sect > h4 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; }
.sect > .hint { margin-bottom: 13px; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.row2 + .row2, .row2 + .field, .field + .field, .field + .row2 { margin-top: 14px; }
.checks { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin: 3px 0 0; flex: none; accent-color: var(--amber); }
.check .sub { margin-top: 3px; }

/* 优选结果小表 */
.opt-res { margin-top: 13px; font-size: 12px; font-family: var(--mono); }
.opt-res div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 78px;
  gap: 10px;
  padding: 4px 0;
  border-top: 1px solid var(--rule);
}
.opt-res div:first-child { border-top: none; color: var(--dim); font-family: var(--sans); font-size: 11px; }
.opt-res span:nth-child(2), .opt-res span:nth-child(3) { text-align: right; }
.opt-res .yes { color: var(--cyan); }
.opt-res .no { color: var(--dim); }

/* ---------- 浮动提示 ---------- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 60;
  max-width: min(94vw, 400px);
}
.toast {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--cyan);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: 0 12px 30px #030811a6;
  animation: toast-in .18s ease-out;
}
.toast.warn { border-left-color: var(--amber); }
.toast.err { border-left-color: var(--rose); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 窄屏 ---------- */

@media (max-width: 860px) {
  .bar { padding: 11px 14px; }
  .chain { padding: 16px 14px; }
  main { padding: 16px 14px; }
  .strip {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 16px;
    padding: 14px 10px;
  }
  .strip-port { flex-direction: row; align-items: baseline; gap: 9px; }
  .port-n { font-size: 21px; }
  .strip-body { grid-column: 1 / -1; }
  .strip-meter { grid-column: 1; text-align: left; }
  .meter { max-width: 160px; }
  .strip-act { grid-column: 2; grid-row: 3; flex-direction: row; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; }
  .entry, .entry-head { grid-template-columns: 26px minmax(0, 1fr) 90px auto; }
  .entry .entry-label { grid-column: 2; }
  .entry-head span:nth-child(3) { display: none; }
}

@media (max-width: 520px) {
  .bar-actions { width: 100%; }
  .bar-actions .btn { flex: 1 1 auto; }
  .toasts { right: 10px; left: 10px; bottom: 10px; max-width: none; }
}

/* ---------- 降低动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  .boot-trace::after, .login-trace i, .chain.sweep::after { animation: none; }
  .login-trace i { transform: none; width: 100%; opacity: .5; }
  .toast { animation: none; }
  .meter i { transition: none; }
  .btn:active { transform: none; }
  * { scroll-behavior: auto; }
}











