/* ═══════════════════════════════════════════════
   URIT 远程服务系统 · 管理后台
   暗色 · 玻璃态 · 渐变微光（零外部依赖）
   ═══════════════════════════════════════════════ */
:root {
  --bg: #0b0f1a;
  --bg-2: #101627;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --txt: #e8ecf4;
  --txt-dim: #8b94a8;
  --brand: #0072CE;
  --brand-2: #4DA6FF;
  --ok: #2dd4a0;
  --warn: #ffb02e;
  --bad: #ff5d6c;
  --glass: blur(14px);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.65 "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--txt);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(0, 114, 206, .14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(0, 114, 206, .13), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--txt-dim); }

/* ─────────── 登录页 ─────────── */
#login { position: fixed; inset: 0; display: grid; place-items: center; }
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 70% 20%, rgba(77, 166, 255, .20), transparent 65%),
    radial-gradient(500px 280px at 20% 80%, rgba(0, 114, 206, .18), transparent 65%);
  animation: float 9s ease-in-out infinite alternate;
}
@keyframes float { to { transform: translate(-18px, 12px) scale(1.06); } }
.login-card {
  position: relative; width: 360px; padding: 38px 36px 30px; text-align: center;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 20px; backdrop-filter: var(--glass);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.login-logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 18px;
  display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 26px rgba(0, 114, 206, .45);
}
.login-card h2 { margin: 0 0 2px; font-size: 20px; }
.login-card .muted { margin: 0 0 22px; font-size: 12.5px; }
.login-card .err { color: var(--bad); min-height: 19px; margin: 8px 0 0; font-size: 13px; }

/* 浮起标签输入框 */
.field { position: relative; margin: 10px 0; }
.field input {
  width: 100%; padding: 14px 14px 12px; color: var(--txt); font-size: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--panel-border); border-radius: 10px;
  outline: none; transition: border .18s, box-shadow .18s, background .18s;
}
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 114, 206, .22);
  background: rgba(255, 255, 255, .07);
}
.field label {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--txt-dim); pointer-events: none; transition: .16s ease;
  background: transparent; padding: 0 5px;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 0; font-size: 11.5px; color: var(--brand);
  background: linear-gradient(var(--bg-2), var(--bg-2)); border-radius: 5px;
}
.field.slim { margin: 0; display: inline-block; width: 180px; }
.field.slim input { padding: 9px 12px 8px; }
.field.slim label { top: 50%; }
input.input, select {
  padding: 9px 12px; color: var(--txt); font-size: 13.5px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--panel-border);
  border-radius: 10px; outline: none; color-scheme: dark;
}
input.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 114, 206, .18); }

/* ─────────── 按钮 ─────────── */
button, .btn-primary, .btn-ghost {
  border: none; cursor: pointer; font-size: 13.5px; border-radius: 10px;
  padding: 10px 18px; color: #fff; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; justify-content: center;
  transition: transform .14s, box-shadow .18s, filter .18s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 20px rgba(0, 114, 206, .35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 9px 26px rgba(0, 114, 206, .45); }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; margin-top: 8px; padding: 12px; }
.btn-ghost {
  background: rgba(255, 255, 255, .06); border: 1px solid var(--panel-border); color: var(--txt);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .1); }
button.ok  { background: linear-gradient(135deg, #1fb585, #2dd4a0); box-shadow: 0 5px 16px rgba(45, 212, 160, .3); }
button.bad { background: linear-gradient(135deg, #e0485a, #ff5d6c); box-shadow: 0 5px 16px rgba(255, 93, 108, .28); }
button.ok:hover, button.bad:hover { transform: translateY(-1px); filter: brightness(1.08); }
button.small { padding: 5px 12px; font-size: 12px; border-radius: 8px; }
button.subtle { background: transparent !important; box-shadow: none; }

/* ─────────── 布局：侧边栏 + 内容 ─────────── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex-shrink: 0; display: flex; flex-direction: column;
  background: rgba(13, 18, 33, .8); backdrop-filter: var(--glass);
  border-right: 1px solid var(--panel-border);
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 20px 18px 16px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 18px rgba(0, 114, 206, .4);
}
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.25; }
.brand-name small { display: block; font-weight: 400; font-size: 11px; color: var(--txt-dim); }
.sidebar nav { flex: 1; padding: 6px 10px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; font-size: 14px; color: var(--txt-dim);
  background: transparent; border-radius: 10px; cursor: pointer; border: none;
  transition: background .15s, color .15s; position: relative; text-align: left;
}
.nav-item svg { width: 19px; height: 19px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { color: var(--txt); background: rgba(255, 255, 255, .05); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(0, 114, 206, .22), rgba(77, 166, 255, .20));
  box-shadow: inset 0 0 0 1px rgba(0, 114, 206, .35);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 22%; bottom: 22%; width: 3px;
  border-radius: 3px; background: linear-gradient(var(--brand), var(--brand-2));
  box-shadow: 0 0 12px rgba(0, 114, 206, .8);
}
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 11px; min-width: 20px; height: 20px;
  display: grid; place-items: center; border-radius: 10px; padding: 0 6px; color: #fff;
  background: linear-gradient(135deg, #ff9f2e, var(--warn)); box-shadow: 0 0 12px rgba(255, 176, 46, .5);
}
.sidebar-foot { padding: 10px; border-top: 1px solid var(--panel-border); }

/* ─────────── 内容区 ─────────── */
.content { flex: 1; padding: 26px 30px 40px; min-width: 0; }

/* 统计卡 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); backdrop-filter: var(--glass);
  transition: transform .16s, box-shadow .2s;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(0, 0, 0, .35); }
.stat b { display: block; font-size: 22px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--txt-dim); }
.stat-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-ico.amber  { background: rgba(255, 176, 46, .14);  box-shadow: 0 0 22px rgba(255, 176, 46, .12); }
.stat-ico.blue   { background: rgba(0, 114, 206, .14);  box-shadow: 0 0 22px rgba(0, 114, 206, .12); }
.stat-ico.sky { background: rgba(77, 166, 255, .16);  box-shadow: 0 0 22px rgba(77, 166, 255, .18); }
.stat-ico.green  { background: rgba(45, 212, 160, .13);  box-shadow: 0 0 22px rgba(45, 212, 160, .12); }

/* 面板 */
.panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); backdrop-filter: var(--glass);
  padding: 20px 22px 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .25);
  overflow-x: auto;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head .hint { font-size: 12px; color: var(--txt-dim); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; white-space: nowrap; font-size: 13px; }
thead th {
  font-size: 12px; font-weight: 600; letter-spacing: .4px; color: var(--txt-dim);
  border-bottom: 1px solid var(--panel-border); text-transform: uppercase;
}
tbody tr { transition: background .13s; }
tbody tr:hover { background: rgba(255, 255, 255, .04); }
tbody td { border-bottom: 1px solid rgba(255, 255, 255, .05); }
.mono { font-family: Consolas, "JetBrains Mono", monospace; font-size: 12.5px; color: #aab6d3; }

/* 状态 pill */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.pill-0 { color: var(--warn); background: rgba(255, 176, 46, .12); } .pill-0::before { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.pill-1 { color: var(--ok);   background: rgba(45, 212, 160, .1); } .pill-1::before { background: var(--ok);   box-shadow: 0 0 8px var(--ok); }
.pill-2 { color: var(--bad);  background: rgba(255, 93, 108, .12); } .pill-2::before { background: var(--bad);  box-shadow: 0 0 8px var(--bad); }

/* 空状态 */
.empty { text-align: center; padding: 36px 0 30px; color: var(--txt-dim); }
.empty::before { content: "☁"; display: block; font-size: 34px; margin-bottom: 6px; opacity: .55; }

/* 图表 */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 6px 0 18px; }
.chart {
  background: rgba(255, 255, 255, .03); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 16px 18px;
}
.chart h4 { margin: 0 0 10px; font-size: 13px; color: var(--txt-dim); font-weight: 600; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar-label { width: 118px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.bar-track { flex: 1; background: rgba(255, 255, 255, .06); border-radius: 5px; height: 14px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 5px; min-width: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 10px rgba(0, 114, 206, .4);
  transition: width .7s cubic-bezier(.2, .8, .2, 1);
}
.chart.bytes .bar-fill { background: linear-gradient(90deg, #1fb585, #2dd4a0); box-shadow: 0 0 10px rgba(45, 212, 160, .4); }
.bar-val { width: 88px; font-size: 12px; color: var(--txt-dim); }

/* Toast */
#toast-box { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 99; }
.toast {
  padding: 12px 18px; border-radius: 12px; color: #fff; font-size: 13.5px;
  background: rgba(22, 28, 46, .92); border: 1px solid var(--panel-border);
  backdrop-filter: var(--glass); box-shadow: 0 12px 34px rgba(0, 0, 0, .4);
  animation: toast-in .25s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.ok { border-color: rgba(45, 212, 160, .4); }
.toast.bad { border-color: rgba(255, 93, 108, .4); }
@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .sidebar { width: 68px; }
  .brand-name, .nav-item span, .sidebar-foot span { display: none; }
  .nav-item { justify-content: center; }
}

/* ─────────── 编辑弹窗 ─────────── */
.modal-mask {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(5, 8, 16, .6); backdrop-filter: blur(6px);
}
.modal {
  width: 460px; max-width: calc(100vw - 40px); padding: 24px 26px 20px;
  background: rgba(17, 23, 40, .96); border: 1px solid var(--panel-border);
  border-radius: 16px; box-shadow: 0 28px 80px rgba(0, 0, 0, .55);
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1.15);
}
.modal h3 { margin: 0 0 16px; font-size: 15px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.meta-grid .field { margin: 7px 0; }
.meta-grid .field:nth-child(6) { grid-column: 1 / -1; }
.check {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 2px;
  font-size: 13.5px; cursor: pointer; color: var(--txt);
}
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.star { color: var(--warn); text-shadow: 0 0 8px rgba(255, 176, 46, .6); }


/* ─────────── 机器卡片视图 ─────────── */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.m-card {
  background: linear-gradient(145deg, rgba(0, 114, 206, .10), rgba(0, 20, 40, .30) 60%, rgba(255, 255, 255, .02));
  border: 1px solid rgba(0, 114, 206, .20);
  border-radius: 14px; padding: 0 18px 16px; transition: transform .16s, box-shadow .22s, border-color .2s;
  position: relative; overflow: hidden; cursor: pointer;
}
.m-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 44px rgba(0, 114, 206, .18), 0 4px 12px rgba(0,0,0,.3);
  border-color: rgba(77, 166, 255, .45);
}
.m-card .mc-top { 
  margin: 0 -18px 12px; padding: 12px 18px 10px;
  background: linear-gradient(135deg, rgba(0, 114, 206, .22), rgba(0, 50, 100, .12));
  border-bottom: 1px solid rgba(0, 114, 206, .25);
  display: flex; align-items: center; justify-content: space-between;
}
.m-card .mc-top h4 { margin: 0; font-size: 16px; color: #e8f0ff; text-shadow: 0 0 12px rgba(0, 114, 206, .3); }
.m-card .st-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.m-card .st-dot.on { 
  background: radial-gradient(circle, #2dd4a0 30%, #00b42a 100%);
  box-shadow: 0 0 14px rgba(45, 212, 160, .7), 0 0 4px rgba(45, 212, 160, .9);
  animation: pulse 2s ease-in-out infinite;
}
.m-card .st-dot.off { background: #3a3f4c; border: 2px solid #555c6b; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 10px rgba(45,212,160,.5); } 50% { box-shadow: 0 0 20px rgba(45,212,160,.8); } }
.m-card .mc-id { font-family: Consolas, monospace; font-size: 12px; color: #7da7d9; margin-bottom: 2px; }
.m-card .mc-row { display: flex; gap: 8px; margin-top: 6px; font-size: 13px; align-items: baseline; }
.m-card .mc-icon { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }
.m-card .mc-val { color: var(--txt); font-weight: 500; }
.m-card .mc-footer { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(0, 114, 206, .15); display: flex; justify-content: space-between; font-size: 11.5px; color: #7da7d9; }
.m-card .mc-key { position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: linear-gradient(180deg, #ffd426, #ff9f2e); box-shadow: 0 0 8px rgba(255, 200, 0, .5); }


/* 卡片图标 + 流量 */
.mc-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.mc-traffic {
  margin-top: 12px; padding: 10px 14px;
  background: linear-gradient(135deg, rgba(0, 114, 206, .14), rgba(31, 181, 133, .06));
  border-radius: 10px; border: 1px solid rgba(0, 114, 206, .25);
}
.mc-traffic .tr-title { display: flex; justify-content: space-between; font-size: 11px; color: #9ab8e0; margin-bottom: 6px; font-weight: 600; }
.mc-traffic .tr-total { text-align: center; font-size: 16px; margin-top: 6px; color: #4DA6FF; font-weight: 700; text-shadow: 0 0 8px rgba(77, 166, 255, .3); }
.mc-traffic .tr-title { display: flex; justify-content: space-between; font-size: 11px; color: var(--txt-dim); margin-bottom: 4px; }
.mc-traffic .tr-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.06); }
.mc-traffic .tr-bar .in { background: linear-gradient(90deg, #0072CE, #4DA6FF); }
.mc-traffic .tr-bar .out { background: linear-gradient(90deg, #1fb585, #2dd4a0); }
.mc-traffic .tr-labels { display: flex; justify-content: space-between; font-size: 10.5px; margin-top: 4px; }
.mc-traffic .tr-labels .dl { color: #4DA6FF; }
.mc-traffic .tr-labels .up { color: #2dd4a0; }
.mc-traffic .tr-total { text-align: center; font-size: 13px; margin-top: 6px; color: var(--txt); font-weight: 600; }


/* 侧边栏分组标题 */
.nav-group {
  padding: 16px 12px 6px; font-size: 10.5px; font-weight: 700;
  color: #5a6478; letter-spacing: 1.5px; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.04); margin-bottom: 4px;
}
.nav-group:first-child { padding-top: 6px; border-top: none; }
