/* 趣玩 RFID 管理后台（Web 版）样式：与桌面端配色、层级保持一致 */
:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #2d2c3c;
  --muted: #8e8ea8;
  --faint: #b4b4c8;
  --purple: #6c5ce7;
  --purple-dark: #5a4ad1;
  --purple-soft: #efecfe;
  --border: #e9eaf3;
  --track: #f8f8fd;
  --green: #1faf6b;
  --green-soft: #e9f8f0;
  --orange: #e89b1c;
  --orange-soft: #fff5e6;
  --blue: #3b82f6;
  --blue-soft: #e9f1fe;
  --red: #e15b5b;
  --red-soft: #fdecec;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(45, 44, 60, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- 登录 */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #f4f5fb 0%, #eef0fb 55%, #f7f4ff 100%);
}
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; }
.blob.b1 { width: 420px; height: 420px; background: #d9d3ff; top: -130px; left: -90px; }
.blob.b2 { width: 360px; height: 360px; background: #d8e6ff; bottom: -120px; right: -60px; }
.blob.b3 { width: 260px; height: 260px; background: #ffe8d6; bottom: 130px; left: 42%; opacity: 0.35; }

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(233, 234, 243, 0.9);
  border-radius: 22px;
  padding: 34px 34px 26px;
  box-shadow: 0 24px 60px rgba(76, 66, 160, 0.14);
  backdrop-filter: blur(8px);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--purple);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(108, 92, 231, 0.32);
}
.brand-mark.sm { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: 0.4px; }
.brand-text span { font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: 0.5px; }
.login-sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--track);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.field input:focus {
  border-color: var(--purple);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.13);
}
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 62px; }
.pwd-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 12px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 8px;
}
.pwd-toggle:hover { background: var(--purple-soft); }
.login-error { min-height: 20px; color: var(--red); font-size: 12.5px; margin-bottom: 8px; }
.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 12px;
}
.remember { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: #5b5a73; cursor: pointer; }
.remember input { width: 15px; height: 15px; accent-color: var(--purple); cursor: pointer; }
.remember-hint { font-size: 11.5px; color: var(--faint); }

/* ---------------------------------------------------------------- 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 14px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 6px 22px; }
.nav-label {
  padding: 0 10px 8px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--faint);
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #5b5a73;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item .ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.nav-item .ico svg { width: 16px; height: 16px; display: block; }
.nav-item:hover { background: var(--track); color: var(--ink); }
.nav-item.active { background: var(--purple-soft); color: var(--purple-dark); font-weight: 600; }
.nav-item.active .ico { color: var(--purple); }

.side-card {
  margin-top: 16px;
  padding: 12px;
  border-radius: 13px;
  background: var(--track);
  border: 1px solid var(--border);
}
.side-card.account { margin-top: auto; }
.side-card-title { font-size: 11.5px; color: var(--muted); }
.side-card-value { margin-top: 4px; font-size: 13px; color: var(--ink); line-height: 1.35; }
.side-card-value.strong { font-weight: 700; }
.side-card-value.ok { color: var(--green); }
.side-card-value.bad { color: var(--red); }
.account-role { font-size: 11.5px; color: var(--purple); margin-top: 2px; }
.link-btn {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 11.5px;
  padding: 0;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 14px;
}
.topbar h1 { margin: 0; font-size: 21px; letter-spacing: 0.4px; }
.topbar p { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: #f1f1f7;
  color: var(--muted);
  font-size: 12px;
}
.conn-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.conn-pill.ok { background: var(--green-soft); color: var(--green); }
.conn-pill.ok i { background: var(--green); }
.conn-pill.bad { background: var(--red-soft); color: var(--red); }
.conn-pill.bad i { background: var(--red); }

.page-host { padding: 0 26px 26px; flex: 1; min-height: 0; }

/* ---------------------------------------------------------------- 通用组件 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card.tight { padding: 10px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title h2 { margin: 0; font-size: 15px; }
.card-desc { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--purple); color: #fff; box-shadow: 0 6px 16px rgba(108, 92, 231, 0.26); }
.btn-primary:hover:not(:disabled) { background: var(--purple-dark); }
.btn-ghost { background: #fff; border-color: var(--border); color: #5b5a73; }
.btn-ghost:hover:not(:disabled) { border-color: #d7d8e6; background: var(--track); }
.btn-soft { background: var(--purple-soft); color: var(--purple-dark); }
.btn-soft:hover:not(:disabled) { background: #e6e1fd; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #fbdcdc; }
.btn-block { width: 100%; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.xs { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 8px; }

.input, .select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--track);
  outline: none;
}
.input:focus, .select:focus { border-color: var(--purple); background: #fff; }
.input.wide { min-width: 320px; }
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--track);
}
.search input { border: 0; background: transparent; outline: none; width: 190px; }
.search .ico { color: var(--muted); font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  font-size: 11.5px;
  background: #f1f1f7;
  color: #7c7c95;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.red { background: var(--red-soft); color: var(--red); }

.grid-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.stat-name { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

.toolbar { display: flex; flex-direction: column; gap: 10px; }
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-row .spacer { flex: 1; }
.hint { font-size: 12px; color: var(--muted); }

.table-wrap { overflow: auto; border-radius: 12px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  position: sticky; top: 0;
  background: #fbfbfe;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f2f8;
  vertical-align: middle;
  white-space: nowrap;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fafaff; }
table.data td.wrap { white-space: normal; max-width: 360px; }
table.data td.url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: #5b5a73; }
table.data .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; }
.empty-row { text-align: center; color: var(--faint); padding: 34px 12px; }

.pager { display: flex; align-items: center; gap: 8px; padding-top: 12px; flex-wrap: wrap; }
.pager .info { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.pager label { font-size: 12.5px; color: var(--muted); }

.checkbox { width: 15px; height: 15px; accent-color: var(--purple); cursor: pointer; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 44px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: #dcdce8;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + span { background: var(--purple); }
.switch input:checked + span::after { transform: translateX(20px); }

.setting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed #eff0f7;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .label { width: 150px; font-weight: 600; font-size: 13px; }
.setting-row .desc { flex: 1; color: var(--muted); font-size: 12.5px; }
.setting-row .ctrl { display: flex; align-items: center; gap: 8px; }

.num-input { width: 74px; text-align: center; }

/* 日志面板 */
.log-panel {
  background: #fbfbfe;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  height: 320px;
  overflow: auto;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.75;
  color: #4a4960;
}
.log-panel .t { color: var(--faint); margin-right: 8px; }
.log-panel .ok { color: var(--green); }
.log-panel .err { color: var(--red); }
.log-panel .info { color: var(--purple); }

.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; line-height: 1.9; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(34, 33, 48, 0.42);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 60;
  opacity: 1;
  animation: fadeIn 0.15s ease both;
}
.modal {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(30, 26, 70, 0.28);
  padding: 22px 24px 18px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  animation: pop 0.18s ease;
}
.modal.wide { max-width: 620px; }
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal .modal-sub { margin: 0 0 16px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.modal-body { overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.field-inline { display: flex; gap: 10px; }

.perm-grid { display: grid; gap: 12px; }
.perm-module { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.perm-module-head { display: flex; align-items: center; justify-content: space-between; }
.perm-module-head strong { font-size: 13px; }
.perm-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.perm-items label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #5b5a73; }
.perm-items label input { accent-color: var(--purple); }

/* Toast */
.toast-root {
  position: fixed;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 90;
  pointer-events: none;
}
.toast {
  min-width: 200px;
  max-width: 420px;
  padding: 10px 16px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(40, 35, 90, 0.16);
  font-size: 13px;
  animation: drop 0.2s ease;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--purple); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1080px) {
  .grid-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 12px 14px;
  }
  .logo { padding: 0 8px 0 0; }
  .nav-label { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav-item { width: auto; padding: 8px 10px; font-size: 12.5px; }
  .side-card { margin: 0; padding: 8px 10px; }
  .side-card.account { margin-left: auto; }
  .side-card .link-btn { display: none; }
  .topbar { padding: 16px 16px 10px; }
  .page-host { padding: 0 16px 20px; }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input.wide { min-width: 0; width: 100%; }
  .setting-row { flex-wrap: wrap; }
  .setting-row .label { width: 100%; }
}
