/* 霖川 TG 云端工作台 — 正式现代风格：灰底白卡分层、深色侧栏、克制的点缀色 */
:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --accent: #0d9488;
  --accent-dark: #0f766e;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --sidebar: #1e2329;
  --sidebar-active: #2a3038;
  --sidebar-text: #aeb4bc;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 6px rgba(0,0,0,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--sidebar);
}
.login-card {
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--card); border-radius: var(--radius);
  padding: 40px 36px 32px; box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; letter-spacing: 0;
}
.login-brand h1 { font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.login-brand p { color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* ---------- 主布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 10;
}
.sidebar .brand {
  padding: 20px 20px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: var(--radius); background: var(--accent);
  color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.sidebar .brand .name { color: #fff; font-weight: 600; font-size: 15px; }
.sidebar .brand .sub { font-size: 11px; color: var(--text-3); }
.nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav .group { padding: 14px 20px 6px; font-size: 11px; color: #5b636d; letter-spacing: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 20px;
  color: var(--sidebar-text); font-size: 13.5px; border-left: 3px solid transparent;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav a.active { color: #fff; background: var(--sidebar-active); border-left-color: var(--accent); }
.nav a .ico { width: 16px; text-align: center; opacity: .85; }
.sidebar .foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12px; }
.sidebar .foot button { width: 100%; }

.main { flex: 1; margin-left: 216px; padding: 24px 28px 48px; min-width: 0; }
.topbar { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.topbar h2 { font-size: 20px; font-weight: 600; }
.topbar .hint { color: var(--text-3); font-size: 12.5px; }

/* ---------- 卡片与栅格 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card .card-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card .card-h h3 { font-size: 14.5px; font-weight: 600; }
.card .card-b { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.two { grid-template-columns: 2fr 1fr; }
@media (max-width: 980px) { .grid.two { grid-template-columns: 1fr; } }

.stat { padding: 18px; }
.stat .label { color: var(--text-2); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 11px; font-size: 13.5px; background: #fff; color: var(--text);
  font-family: inherit; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 110px; font-family: inherit; }
textarea.mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.6; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: var(--radius); padding: 7px 16px; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s; font-family: inherit;
}
.btn:hover { background: #f6f7f9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #f0c8c8; }
.btn.danger:hover { background: #fdf3f3; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: #f0f2f5; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { display: none; }
.switch .track {
  position: absolute; inset: 0; border-radius: 22px; background: #d4d8dd; transition: background .18s; cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: left .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 21px; }

/* 滑条 */
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.slider-row .pct { width: 46px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 10px 14px; background: #f7f8fa; color: var(--text-2);
  font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafbfc; }
.tbl .mono { font-family: Consolas, monospace; font-size: 12.5px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 11.5px; font-weight: 600; }
.tag.user { background: #eef2ff; color: #4f46e5; }
.tag.channel { background: #fff7ed; color: #c2410c; }
.tag.on { background: #ecfdf3; color: var(--ok); }
.tag.off { background: #f3f4f6; color: var(--text-3); }

/* ---------- 图表 ---------- */
.chart-box { padding: 10px 14px 14px; }
.chart-svg { width: 100%; height: 220px; display: block; }
.chart-axis { font-size: 10px; fill: var(--text-3); }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.bar-row .name { width: 72px; font-size: 12.5px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.bar-row .track { flex: 1; height: 16px; background: #f1f3f5; border-radius: 3px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--accent); }
.bar-row .num { width: 52px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- 提示 ---------- */
.flash { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100;
  padding: 9px 20px; border-radius: var(--radius); font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.16);
  background: #1f2329; color: #fff; animation: drop .22s ease-out; }
.flash.err { background: var(--danger); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.empty { text-align: center; color: var(--text-3); padding: 36px 0; font-size: 13px; }
.muted { color: var(--text-3); font-size: 12.5px; }
.err-inline { color: var(--danger); font-size: 12.5px; margin-top: 6px; }

/* 上传进度 */
.up-zone {
  border: 1.5px dashed #cfd4da; border-radius: var(--radius); padding: 26px;
  text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.up-zone:hover, .up-zone.over { border-color: var(--accent); background: #f6fdfc; }
.progress { height: 8px; background: #eef0f2; border-radius: 4px; overflow: hidden; margin-top: 14px; }
.progress .fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); }
.pager .info { color: var(--text-3); font-size: 12.5px; margin-right: auto; }

/* 远程开关行 */
.flag-row { display: grid; grid-template-columns: 1fr 46px minmax(180px, 320px); gap: 16px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.flag-row:last-child { border-bottom: none; }

/* 响应式 */
@media (max-width: 860px) {
  .sidebar { width: 60px; }
  .sidebar .brand .name, .sidebar .brand .sub, .nav a .txt, .nav .group { display: none; }
  .nav a { justify-content: center; padding: 11px 0; }
  .sidebar .brand { justify-content: center; padding: 16px 0; }
  .sidebar .foot { padding: 12px 6px; }
  .main { margin-left: 60px; padding: 16px 14px 40px; }
}
