:root {
  --blue: #1b6ef3;
  --blue-dark: #0f57cc;
  --blue-soft: #e8f1ff;
  --bg: #f2f6fd;
  --card: #ffffff;
  --line: #e4ebf7;
  --text: #16233a;
  --muted: #7b8aa3;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --t-blue: #e9f1ff;
  --t-green: #e7f8ee;
  --t-amber: #fef4e6;
  --t-red: #fdeceb;
  --t-purple: #f2ecff;
  --t-cyan: #e6f6fb;
  --radius: 8px;
  --nav-h: 62px;
  --tg-safe-top: env(safe-area-inset-top, 0px);
  --tg-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.error { color: var(--red); min-height: 18px; font-size: 12px; }

/* ---------------- login ---------------- */
.login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #1b6ef3 0%, #1b6ef3 190px, var(--bg) 190px, var(--bg) 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 12px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(15, 40, 90, 0.16);
}

.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card .btn { margin-top: 12px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------------- shell ---------------- */
.app { display: block; min-height: 100vh; }
.sidebar { display: none; }

.main {
  padding: calc(var(--tg-safe-top) + 10px) 14px calc(var(--nav-h) + var(--tg-safe-bottom) + 20px);
}

/* ---------------- hero header ---------------- */
.hero {
  margin: 0 0 14px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
}

.titles { min-width: 0; }
.app-name {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.hero h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.hero-hint { font-size: 12px; color: var(--muted); }

.bell-btn { position: relative; }
.bell-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.bulk-form {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.bulk-form input { width: 100%; }
.mini-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.account-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fbfdff;
}
.check-item input { width: auto; height: auto; }

.notice-list { display: flex; flex-direction: column; gap: 8px; }
.notice-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.notice-item.unread { border-color: #bcd6ff; background: var(--blue-soft); }
.notice-item b { font-size: 13px; }
.notice-item small { color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.notice-item em { color: var(--muted); font-size: 11px; font-style: normal; }

@keyframes highlight-pulse {
  0% { background: #dbeaff; }
  100% { background: transparent; }
}
tr.highlight, .notice-item.highlight { animation: highlight-pulse 2.4s ease; }

.login-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.login-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.login-choice:active { background: var(--blue-soft); border-color: var(--blue); }
.login-choice span { font-size: 22px; }
.login-choice b { font-size: 14px; }
.login-choice small { color: var(--muted); font-size: 11px; text-align: center; }

#account-modal-body {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
#account-modal-body input,
#account-modal-body select { width: 100%; }

.chips { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  white-space: nowrap;
}

.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.chip .dot.on { background: #4ade80; }

.hero-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  border: none;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--blue);
  font-size: 16px;
  cursor: pointer;
}
.hero-btn:active { background: var(--blue-soft); }

.pill { display: none; }

/* ---------------- stats ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 104px;
  padding: 14px 10px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
}

.stat .stat-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: var(--t-blue);
}

.stat-body { text-align: center; }
.stat b { display: block; font-size: 22px; line-height: 1.1; font-weight: 700; }
.stat span { color: var(--muted); font-size: 12px; }

.stat.tint-blue { background: linear-gradient(0deg, var(--t-blue), var(--t-blue)); }
.stat.tint-green { background: var(--t-green); }
.stat.tint-amber { background: var(--t-amber); }
.stat.tint-red { background: var(--t-red); }
.stat.tint-purple { background: var(--t-purple); }
.stat.tint-cyan { background: var(--t-cyan); }

.stat.tint-blue .stat-icon, .stat.tint-cyan .stat-icon { background: #fff; }
.stat.tint-green .stat-icon,
.stat.tint-amber .stat-icon,
.stat.tint-red .stat-icon,
.stat.tint-purple .stat-icon { background: #fff; }

.stat.tint-blue, .stat.tint-cyan { border-color: #d7e6ff; }
.stat.tint-green { border-color: #d3f0de; }
.stat.tint-amber { border-color: #fbe3bd; }
.stat.tint-red { border-color: #f8d5d3; }
.stat.tint-purple { border-color: #e2d8ff; }

/* ---------------- panels ---------------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head h3::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--blue);
  flex: 0 0 4px;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fbfdff; }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; max-width: 320px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f8fbff; }

/* mobile: table rows become cards */
@media (max-width: 899px) {
  .table-wrap { overflow: visible; padding: 10px; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; margin-bottom: 10px; background: var(--card); }
  tbody tr:last-child { margin-bottom: 0; }
  tbody td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); white-space: normal; text-align: right; }
  tbody td:last-child { border-bottom: none; }
  tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: 0 0 auto; text-align: left; }
  tbody td.actions { justify-content: flex-end; gap: 8px; }
  tbody td.actions::before { display: none; }
}

/* ---------------- badges / buttons / inputs ---------------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; line-height: 1.4; }
.badge.blue { background: var(--blue-soft); color: var(--blue-dark); }
.badge.green { background: #e8f9ef; color: #15803d; }
.badge.amber { background: #fef3e2; color: #b45309; }
.badge.red { background: #fdecec; color: #b91c1c; }
.badge.purple { background: #f1ecfe; color: #6d28d9; }
.badge.gray { background: #eef2f7; color: #475569; }

input, select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }

.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filters input, .filters select, .filters .btn { width: 100%; }
.panel-head .filters { grid-template-columns: 1fr; justify-items: stretch; }

.btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(27, 110, 243, 0.24); }
.btn.primary:hover { background: var(--blue-dark); color: #fff; }
.btn.danger { color: var(--red); border-color: #f6c9c9; }
.btn.ghost { border-color: transparent; }
.btn.wide { width: 100%; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon { font-size: 13px; }

/* ---------------- dashboard extras ---------------- */
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }

.quick-item {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 10px;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.quick-item b { display: block; font-size: 14px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-item span { color: var(--muted); font-size: 12px; }

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 14px 14px; }

.chart { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; height: 160px; padding: 20px 14px 10px; }
.chart::before { content: ""; position: absolute; left: 14px; right: 14px; bottom: 34px; border-top: 1px dashed var(--line); }
.chart-legend { display: flex; gap: 12px; align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; background: var(--blue); }
.legend-dot.joined { background: var(--green); }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-value { font-size: 10px; color: var(--muted); height: 12px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 10px; border-radius: 4px 4px 2px 2px; background: var(--blue); min-height: 3px; }
.bar.joined { background: var(--green); }
.bar-label { font-size: 10px; color: var(--muted); }

.mini-list { padding: 6px 14px 12px; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.mini-row:last-child { border-bottom: none; }
.mini-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.mini-body { min-width: 0; flex: 1; }
.mini-body .title { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-body .time { color: var(--muted); font-size: 11px; }

/* ---------------- account adding ---------------- */
.add-account { padding: 14px; border-bottom: 1px solid var(--line); background: #fbfdff; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tab { height: 36px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.tab-body { display: grid; grid-template-columns: 1fr; gap: 8px; }
.qr-box { width: 100%; display: flex; justify-content: center; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.settings-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
#settings-save { margin: 0 14px 14px; width: calc(100% - 28px); }

.settings-list { display: flex; flex-direction: column; }
.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
}
.setting-item:last-child { border-bottom: none; }
.setting-item:active { background: var(--blue-soft); }
.setting-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  background: var(--blue-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.setting-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setting-body b { font-size: 14px; font-weight: 600; }
.setting-body small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setting-item em { font-style: normal; color: var(--muted); font-size: 18px; }

.modal-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; text-align: left; }
.modal-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

.wallet-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; text-align: left; }
.wallet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}
.wallet-row span { font-size: 13px; }
.wallet-add { display: flex; gap: 8px; }
.wallet-add input { flex: 1; }

.output { margin: 0; padding: 14px; background: #0f172a; color: #d7e3ff; font-size: 12px; white-space: pre-wrap; min-height: 60px; }

/* ---------------- empty / skeleton ---------------- */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 30px; }
.empty-state .title { color: var(--text); font-size: 14px; font-weight: 600; }

.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, #eef3fa 25%, #f7faff 37%, #eef3fa 63%);
  background-size: 400% 100%;
  animation: skeleton 1.2s ease infinite;
}
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- bottom nav ---------------- */
.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--tg-safe-bottom));
  padding-bottom: var(--tg-safe-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  z-index: 20;
}

.mnav { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--muted); text-decoration: none; cursor: pointer; }
.mnav span {
  width: 30px;
  height: 22px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.mnav.active { color: var(--blue); font-weight: 600; }
.mnav.active span { background: var(--blue-soft); }

.more-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.more-item:active { background: var(--blue-soft); }
.more-item span { font-size: 18px; }
.more-item em { margin-left: auto; font-style: normal; color: var(--muted); font-size: 18px; }
.more-item.danger { color: var(--red); }

/* ---------------- toast / modal ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--tg-safe-bottom) + 16px);
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 99;
  max-width: 86vw;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 120;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal { width: 100%; max-width: 380px; background: var(--card); border-radius: 12px; padding: 18px; animation: pop-in 0.16s ease; }
@keyframes pop-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--blue-soft); font-size: 17px; }
.modal h3 { margin: 0; font-size: 16px; }
.modal p { margin: 0 0 14px; line-height: 1.6; }
.modal input { margin: 4px 0 12px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions.single { grid-template-columns: 1fr; }
.modal-actions .btn { width: 100%; }
.modal .reason-list { margin: 10px 0 14px; padding: 10px 12px; background: #fbfdff; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; max-height: 160px; overflow: auto; }
.modal .score-big { font-size: 30px; font-weight: 700; margin-right: 6px; }
.min-grid { display: grid; gap: 8px; margin-bottom: 4px; }
.min-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------------- desktop ---------------- */
@media (min-width: 900px) {
  .app { display: flex; }
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 216px;
    flex: 0 0 216px;
    background: var(--card);
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--line); }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
  .brand b { display: block; font-size: 14px; }
  .brand small { color: var(--muted); font-size: 11px; }
  .sidebar nav { padding: 10px 8px; flex: 1; }
  .nav { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; cursor: pointer; margin-bottom: 2px; font-size: 14px; }
  .nav:hover { background: var(--blue-soft); }
  .nav.active { background: var(--blue); color: #fff; }
  .sidebar-footer { padding: 12px; border-top: 1px solid var(--line); }

  .mobile-nav { display: none; }
  .main { flex: 1; min-width: 0; padding: 22px 24px 40px; }
  .hero {
    margin: 0 0 18px;
    padding: 18px 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .hero h2 { text-align: left; font-size: 20px; }
  .app-name { display: none; }
  .hero-actions { margin-top: 0; }
  .pill { display: inline-block; background: var(--blue-soft); color: var(--blue-dark); padding: 4px 10px; border-radius: 999px; font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
  .panel-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .filters { display: flex; flex-wrap: wrap; }
  .filters input, .filters select, .filters .btn { width: auto; }
  .filters input { min-width: 150px; }
  .tab-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-box { grid-column: span 2; }
  .settings-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 16px; }
  #settings-save { width: auto; margin: 0 16px 16px; }
  .toast { bottom: 24px; left: auto; right: 24px; transform: none; }
}

/* ---------------- 输入框防缩放（iOS 聚焦 <16px 会强制放大页面） ---------------- */
@media (max-width: 899px) {
  input, select, textarea {
    font-size: 16px;
  }
  .btn, .tab, .seg-item, .mnav, .nav {
    touch-action: manipulation;
  }
}

/* ---------------- 分段筛选（链接队列） ---------------- */
.seg {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.seg-item {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.seg-item.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
}

/* ---------------- 状态灯 / 账号卡片 ---------------- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #cbd5e1;
  flex: 0 0 8px;
}
.status-dot.ready, .status-dot.joined, .status-dot.already { background: var(--green); }
.status-dot.flood_wait, .status-dot.pending, .status-dot.joining { background: var(--amber); }
.status-dot.session_invalid, .status-dot.limited, .status-dot.failed, .status-dot.expired { background: var(--red); }

.account-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.account-cell .mini-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.avatar-img {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--blue-soft);
}

.account-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.account-meta b { font-size: 13px; font-weight: 600; }
.account-meta small { color: var(--muted); font-size: 11px; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ---------------- 底部抽屉 ---------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: flex-end;
  z-index: 130;
  animation: fade-in 0.15s ease;
}

.sheet {
  width: 100%;
  max-height: 82vh;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(16px + var(--tg-safe-bottom));
  overflow-y: auto;
  animation: sheet-up 0.2s ease;
}

@keyframes sheet-up { from { transform: translateY(18px); opacity: 0.6; } to { transform: none; opacity: 1; } }

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 6px auto 14px;
}

.sheet h3 { margin: 0 0 4px; font-size: 16px; }
.sheet .sheet-sub { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 10px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-all; }

.reason-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.reason-chips .badge { font-size: 11px; }

.sheet-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.sheet-actions .btn { width: 100%; }
.sheet-close-row { margin-top: 10px; }

/* ---------------- 时间线 ---------------- */
.timeline { padding: 8px 16px 16px; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 10px 0 10px 4px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 26px;
  bottom: -4px;
  width: 1px;
  background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 50%;
  background: var(--blue-soft);
  border: 3px solid #dbe8ff;
  margin-top: 3px;
  z-index: 1;
}
.tl-body { min-width: 0; flex: 1; }
.tl-body .tl-title { font-size: 13px; }
.tl-body .tl-time { color: var(--muted); font-size: 11px; margin-top: 2px; }
.tl-body .tl-detail { color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-all; }
