/* KS 呆瓜 · 控制台 v2 */
:root {
  --bg: #0b0f14;
  --bg-elevated: #111820;
  --sidebar: #0e1319;
  --card: #151b24;
  --card-hover: #1a222d;
  --card2: #1c2430;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #eef2f8;
  --muted: #8a96a8;
  --muted2: #5f6b7c;
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --blue: #60a5fa;
  --orange: #fb923c;
  --purple: #c4b5fd;
  --accent: #ff4906;
  --accent2: #ff6b35;
  --accent-dim: rgba(255, 73, 6, 0.14);
  --accent-glow: rgba(255, 73, 6, 0.25);
  --sidebar-w: 252px;
  --top-h: 60px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── 登录页 ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 73, 6, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(96, 165, 250, 0.08) 0%, transparent 50%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

.auth-brand { text-align: center; margin-bottom: 28px; }

.auth-brand .logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  background: linear-gradient(145deg, var(--accent), #ff8c42);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 22px; color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
  letter-spacing: -0.02em;
}

.auth-brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.auth-brand p { color: var(--muted); font-size: 13px; margin-top: 8px; }

.auth-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 5px 12px;
  background: var(--green-dim); color: var(--green);
  border-radius: 999px; font-size: 12px; font-weight: 600;
}

.tabs {
  display: flex; gap: 6px; margin-bottom: 22px;
  padding: 4px; background: var(--bg-elevated);
  border-radius: 12px; border: 1px solid var(--border);
}

.tab {
  flex: 1; padding: 10px; border: none; background: transparent;
  color: var(--muted); border-radius: 9px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: var(--accent); color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.auth-form label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--muted); margin: 14px 0 7px; letter-spacing: 0.02em;
}

.auth-form input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated);
  color: var(--text); border-radius: var(--radius-sm);
  font-size: 14px; transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-form .btn-primary { margin-top: 20px; padding: 12px; font-size: 15px; }

.hidden { display: none !important; }

.admin-only.hidden { display: none !important; }
button.nav-item.admin-only.hidden { display: none !important; }

.auth-msg { margin-top: 16px; font-size: 13px; text-align: center; min-height: 20px; }
.auth-msg.ok { color: var(--green); }
.auth-msg.err { color: var(--red); }
.auth-foot { text-align: center; font-size: 11px; color: var(--muted2); margin-top: 22px; }

/* ── 门户布局 ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column; z-index: 100;
}

.sidebar-brand {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.brand-row { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  width: 40px; height: 40px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--accent), #ff8c42);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.sidebar-brand h1 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.sidebar-brand p { font-size: 11px; color: var(--muted2); margin-top: 3px; }

.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }

.nav-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted2);
  padding: 8px 12px 6px; margin-top: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 12px; margin-bottom: 3px;
  border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 500;
  text-align: left; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--card-hover); color: var(--text); }

.nav-item.active {
  background: var(--accent-dim); color: var(--accent2);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-note {
  font-size: 10px; font-weight: 500; color: var(--muted2);
  margin-left: 2px; line-height: 1.3;
}

.title-note {
  font-size: 12px; font-weight: 500; color: var(--muted);
  margin-left: 4px;
}

.nav-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}

.sidebar-foot .user-name {
  color: var(--text); font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.main {
  flex: 1; margin-left: var(--sidebar-w);
  min-width: 0; display: flex; flex-direction: column;
}

.topbar {
  height: var(--top-h);
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-left h2 {
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.menu-toggle {
  display: none; flex-shrink: 0; width: 40px; height: 40px;
  border: 1px solid var(--border-strong); background: var(--card);
  color: var(--text); border-radius: var(--radius-sm);
  font-size: 18px; cursor: pointer;
  align-items: center; justify-content: center; padding: 0;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: var(--green-dim); color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge.off {
  background: var(--red-dim); color: var(--red);
  border-color: rgba(248, 113, 113, 0.25);
}

.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.running .dot { animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.85); } }

.content { flex: 1; padding: 24px 28px 40px; overflow-y: auto; }
.panel { display: none; animation: fadeIn 0.2s ease; }
.panel.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6); z-index: 99;
  opacity: 0; transition: opacity 0.2s;
}

.sidebar-overlay.show { display: block; opacity: 1; }

/* ── 统计卡片 ── */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }

.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: border-color 0.15s;
}

.stat:hover { border-color: var(--border-strong); }

.stat label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--muted2); margin-bottom: 8px;
  letter-spacing: 0.06em; text-transform: uppercase;
}

.stat .val {
  font-size: 26px; font-weight: 800; color: var(--accent2);
  letter-spacing: -0.03em; line-height: 1.1;
}

.stat .val.val-sm { font-size: 15px; font-weight: 700; line-height: 1.4; word-break: break-all; color: var(--text); }
.stat .val.val-green { color: var(--green); }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

.grid-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-stats-3 { grid-template-columns: repeat(3, 1fr); }
.grid-stats-4 { grid-template-columns: repeat(4, 1fr); }

/* ── 公告卡片 ── */
.notice-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(52, 211, 153, 0.06) 100%);
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 16px;
}

.notice-icon {
  font-size: 22px; line-height: 1; flex-shrink: 0;
  margin-top: 2px;
}

.notice-body { flex: 1; min-width: 0; }

.notice-title {
  font-size: 13px; font-weight: 800; color: var(--blue);
  letter-spacing: 0.02em; margin-bottom: 6px;
}

.notice-text {
  font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0;
}

.notice-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 9px 16px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: var(--radius-sm);
  color: var(--blue); font-size: 13px; font-weight: 700;
  text-decoration: none; transition: background 0.15s, border-color 0.15s;
}

.notice-link:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: var(--blue);
  text-decoration: none;
}

.notice-link-block {
  display: flex; justify-content: center; width: 100%;
  margin-top: 14px; text-align: center;
}

.notice-modal-box { max-width: 420px; text-align: center; }

.notice-modal-head {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 14px;
}

.notice-modal-icon { font-size: 36px; line-height: 1; }

.notice-modal-text {
  font-size: 14px; color: var(--muted); line-height: 1.65; margin: 0;
}

/* ── 欢迎横幅 ── */
.welcome-banner {
  background: linear-gradient(135deg, rgba(255, 73, 6, 0.12) 0%, rgba(255, 140, 66, 0.06) 100%);
  border: 1px solid rgba(255, 73, 6, 0.22);
  border-radius: var(--radius); padding: 22px 24px;
  margin-bottom: 20px; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 16px;
}

.welcome-banner h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.welcome-banner p { font-size: 13px; color: var(--muted); margin-top: 6px; max-width: 480px; }

.step-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.step-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}

.step-chip .num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}

/* ── 卡片 ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
}

.card-title {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.card-desc { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.6; }

.head-row {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-start; gap: 12px;
}

.head-row .actions { margin: 0; }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }

input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated);
  color: var(--text); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { min-height: 96px; resize: vertical; font-family: var(--mono); line-height: 1.55; font-size: 12px; }

input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── 任务芯片 / 开关 ── */
.tasks { display: flex; flex-wrap: wrap; gap: 8px; }

.task-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.task-chip:has(input:checked) {
  border-color: rgba(255, 73, 6, 0.45);
  background: var(--accent-dim); color: var(--accent2);
}

.task-chip input { width: auto; accent-color: var(--accent); }

.switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }

.switch {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer;
}

.switch input { width: auto; flex-shrink: 0; accent-color: var(--accent); }

details {
  margin-top: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  background: var(--bg-elevated);
}

summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; user-select: none; }

/* ── 按钮 ── */
.btn {
  border: 1px solid var(--border-strong); background: var(--card2);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 9px 18px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--blue); background: var(--card-hover); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(145deg, var(--accent), #ff6b20);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover { filter: brightness(1.06); border-color: transparent; }

.btn-danger {
  background: var(--red-dim); border-color: rgba(248, 113, 113, 0.35);
  color: var(--red);
}

.btn-ghost { color: var(--muted); background: transparent; border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--card-hover); border-color: var(--border); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }

.preset-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

.preset-bar .btn { font-size: 12px; padding: 7px 14px; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-scroll-hint { -webkit-overflow-scrolling: touch; }
.table-scroll-hint table { min-width: 520px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  background: var(--bg-elevated); color: var(--muted2);
  font-weight: 700; font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); font-size: 14px; }

.acc-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
tr.row-disabled td { opacity: 0.5; }

/* ── Toggle ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #2a3340; border-radius: 999px; transition: 0.2s;
}
.toggle-slider::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
tr.row-disabled .toggle-switch input:not(:checked) + .toggle-slider { background: #1e2530; }

/* ── 格式帮助 ── */
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }

.format-help {
  margin-top: 14px; padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); line-height: 1.65;
}

.format-help-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.format-help p { margin: 6px 0; }
.format-help ul { margin: 6px 0 10px 18px; padding: 0; }
.format-help li { margin: 4px 0; }
.format-help code, .format-example code { font-size: 11px; word-break: break-all; }
.format-example { color: var(--accent2); }

code {
  background: rgba(0, 0, 0, 0.35); padding: 2px 7px;
  border-radius: 5px; font-size: 11px; font-family: var(--mono);
}

/* ── 日志 ── */
.log-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.log-toolbar .log-count { color: var(--muted2); font-size: 12px; font-weight: 600; flex-shrink: 0; }

.log-box {
  min-height: 480px; max-height: calc(100vh - 210px);
  background: #060a0f; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
}

.log-line { margin-bottom: 3px; white-space: pre-wrap; word-break: break-all; }
.log-time { color: #4b5c72; font-weight: 600; user-select: none; }
.log-line.system { color: var(--purple); }
.log-line.success { color: #6ee7b7; }
.log-line.reward { color: #fde047; font-weight: 700; }
.log-line.warn { color: #fdba74; }
.log-line.error { color: #fca5a5; }
.log-line.info { color: #93c5fd; }

/* ── 代理卡片 ── */
.proxy-card { border-color: rgba(255, 73, 6, 0.28); background: linear-gradient(135deg, var(--card) 0%, rgba(255, 73, 6, 0.04) 100%); }

.proxy-link {
  display: block; margin-top: 10px; padding: 12px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--accent2);
  font-size: 13px; word-break: break-all; text-decoration: none;
  transition: border-color 0.15s;
}

.proxy-link:hover { border-color: var(--accent); text-decoration: underline; }

/* ── 弹窗 ── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}

.modal-box {
  width: min(560px, 100%); background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}

.modal-box.modal-wide { width: min(860px, 100%); }
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.02em; }

/* ── Toast / Loading ── */
.page-loading {
  position: fixed; inset: 0; background: rgba(11, 15, 20, 0.78);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}

.page-loading.show { display: flex; }

.page-loading-inner {
  padding: 18px 26px; background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--text); font-size: 14px; font-weight: 600;
}

.toast {
  position: fixed; bottom: 28px; right: 28px;
  padding: 13px 20px; background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; z-index: 999;
  box-shadow: var(--shadow);
  transform: translateY(80px); opacity: 0; transition: 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok { border-color: rgba(52, 211, 153, 0.4); }
.toast.err { border-color: rgba(248, 113, 113, 0.4); }

.status-tag {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
}

.status-tag.unused { background: var(--green-dim); color: var(--green); }
.status-tag.used { background: rgba(138, 150, 168, 0.15); color: var(--muted); }
.status-tag.disabled { background: var(--red-dim); color: var(--red); }
.status-tag.member { background: var(--accent-dim); color: var(--accent2); }
.status-tag.expired { background: var(--red-dim); color: var(--red); }

.redeem-row { display: flex; gap: 10px; align-items: stretch; }
.redeem-input { flex: 1; min-width: 0; text-transform: uppercase; font-size: 14px !important; padding: 11px 12px !important; }
.redeem-btn { flex-shrink: 0; white-space: nowrap; min-height: 44px; }

.gen-result-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.gen-result-bar .hint { margin: 0; flex: 1 1 auto; }

.agent-expand-cell { width: 44px; text-align: center; vertical-align: middle; }
.btn-agent-expand { min-width: 32px; padding: 2px 8px; font-size: 12px; line-height: 1.2; color: var(--muted); }
.btn-agent-expand.expanded { color: var(--accent2); }
.agent-sub-row td { background: rgba(255, 255, 255, 0.02); }
.agent-sub-row .agent-name-sub { padding-left: 8px; color: var(--muted); }

/* ── 响应式 ── */
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
    width: min(288px, 88vw);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
  }

  .main { margin-left: 0; }
  .topbar { padding: 0 16px; height: 54px; }
  .topbar-left h2 { font-size: 16px; max-width: 52vw; }
  .content { padding: 16px 16px 28px; }
  .card { padding: 16px 18px; }

  .grid-stats-3, .grid-stats-4, .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .row, .switches { grid-template-columns: 1fr; }
  .redeem-row { flex-direction: column; }
  .redeem-btn { width: 100%; }

  .actions .btn { flex: 1 1 auto; min-height: 44px; }
  .actions .btn-primary { flex: 1 1 100%; }

  .log-box { min-height: 280px; max-height: calc(100vh - 160px); font-size: 11px; }
  .toast { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  .badge { font-size: 11px; padding: 5px 11px; }
  .preset-bar .btn { flex: 1 1 calc(50% - 4px); min-height: 40px; }
  .welcome-banner { padding: 18px; }
}

@media (max-width: 480px) {
  .grid-stats, .grid-stats-3, .grid-stats-4 { grid-template-columns: 1fr; }
  .stat .val { font-size: 22px; }
  .stat .val.val-sm { font-size: 14px; }
  .auth-card { padding: 26px 20px; }
  .topbar-left h2 { font-size: 15px; max-width: 46vw; }
  .task-chip { flex: 1 1 calc(50% - 4px); justify-content: center; min-height: 44px; }
  .tasks { gap: 6px; }
  th, td { padding: 10px 11px; font-size: 12px; }
  .table-scroll-hint table { min-width: 480px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { width: 100%; }
  .card-desc code { word-break: break-all; display: inline-block; max-width: 100%; }
  .step-row { flex-direction: column; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .log-box { max-height: 50vh; min-height: 180px; }
}

button.nav-item.admin-only.hidden,
section.panel.admin-only.hidden {
  display: none !important;
}
