/* Claude 控制台 · 全局样式 */

:root {
  /* 中性色阶 (OKLCH) */
  --n-100: #f8f9fb;   /* 极浅背景 */
  --n-150: #f2f4f7;   /* 卡片表面 */
  --n-200: #e8eaed;   /* 边框 */
  --n-300: #d1d5db;   /* 强边框 */
  --n-500: #6b7280;   /* 辅助文字 */
  --n-700: #374151;   /* 次级文字 */
  --n-900: #111827;   /* 主文字 (off-black) */

  /* 主蓝 */
  --blue:       #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft:  #eff6ff;

  /* 语义色 */
  --green:        #059669;
  --green-soft:   #ecfdf5;
  --amber:        #d97706;
  --amber-soft:   #fffbeb;
  --red:          #dc2626;
  --red-soft:     #fef2f2;
  --red-hover:    #b91c1c;

  /* 布局 */
  --sidebar-w:  200px;
  --gap:        16px;
  --radius-sm:  4px;
  --radius:     8px;
  --radius-lg:  12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/*  hidden 属性必须永远生效 —— 否则会被 .form-row{display:flex} 之类的作者样式顶掉
   （2026-10-01 踩坑：验活卡的国家/文件行设了 hidden 却一直显示） */
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--n-900);
  background: var(--n-100);
  display: flex;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid var(--n-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-logo {
  padding: 20px 16px 12px;
}
.logo-main {
  font-weight: 700;
  font-size: 16px;
  color: var(--n-900);
  letter-spacing: -.3px;
}
.logo-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--n-500);
  letter-spacing: .2px;
}
.sidebar nav { flex: 1; padding: 4px 8px; }
.nav-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  color: var(--n-700);
  font-size: 14px;
  transition: background 120ms, color 120ms;
}
.nav-item:hover   { background: var(--n-150); }
.nav-item.active  { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.sidebar-bottom {
  padding: 12px 16px;
  border-top: 1px solid var(--n-200);
  font-size: 12px;
  color: var(--n-500);
}
.sidebar-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-brand {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--n-200);
  font-size: 11px;
  line-height: 1.6;
  color: var(--n-500);
  letter-spacing: .2px;
}
.btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--n-500); font-size: 12px;
  padding: 0;
}
.btn-link:hover { color: var(--red); }

/* ── Main ── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: var(--gap);
}
.tab { display: none; }
.tab.active { display: block; }

/* ── Hero numbers (总览) ── */
.hero-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.hero-card {
  background: #fff;
  border: 1px solid var(--n-200);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.hero-card.ok     { border-top: 3px solid var(--green); }
.hero-card.warn   { border-top: 3px solid var(--amber); }
.hero-card.dead   { border-top: 3px solid var(--n-300); }
.hero-card.dim    { border-top: 3px solid var(--blue); }
.hero-card.sold   { border-top: 3px solid #b8860b; }
.hero-label { font-size: 12px; color: var(--n-500); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.hero-num {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 4px;
}
.hero-card.ok   .hero-num { color: var(--green); }
.hero-card.warn .hero-num { color: var(--amber); }
.hero-card.dead .hero-num { color: var(--n-300); }
.hero-card.dim  .hero-num { color: var(--blue); }
.hero-card.sold .hero-num { color: #b8860b; }
.hero-sub { font-size: 12px; color: var(--n-500); }

/* ── Action row ── */
.action-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.action-card {
  background: #fff;
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  padding: 16px;
}
.action-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--n-900);
}

/* ── Forms ── */
.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.form-row label {
  min-width: 68px;
  font-size: 13px;
  color: var(--n-700);
  flex-shrink: 0;
}
.form-row input[type="number"],
.form-row input[type="text"],
.form-row select {
  flex: 1;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #fff;
  color: var(--n-900);
  outline: none;
  transition: border-color 120ms;
}
.form-row input:focus,
.form-row select:focus { border-color: var(--blue); }
.toggle-row { margin-top: 4px; }

/* ── Buttons ── */
.btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--n-700);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { background: var(--n-150); }
.btn-primary {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-danger-outline {
  border-color: var(--red); color: var(--red);
}
.btn-danger-outline:hover { background: var(--red-soft); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.full-width { width: 100%; }

/* ── Switch ── */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--n-300); border-radius: 20px;
  transition: background 200ms;
}
.slider::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms;
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: var(--gap);
}
.card-title {
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--gap);
  color: var(--n-900);
}

/* ── Running tasks ── */
#runningTasksCard { margin-bottom: var(--gap); }
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--n-200);
}
.task-row:last-child { border-bottom: none; }
.task-kind { font-weight: 600; min-width: 48px; }
.task-progress { flex: 1; min-width: 0; }
.task-detail { font-size: 12px; color: var(--n-500); }
.progress-bar { height: 4px; background: var(--n-200); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 400ms; }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filter-tabs { display: flex; border: 1px solid var(--n-300); border-radius: var(--radius-sm); overflow: hidden; }
.filter-btn {
  height: 30px; padding: 0 14px;
  border: none; background: #fff; cursor: pointer;
  font-size: 13px; color: var(--n-700);
  border-right: 1px solid var(--n-300);
  transition: background 120ms;
}
.filter-btn:last-child { border-right: none; }
.filter-btn:hover  { background: var(--n-150); }
.filter-btn.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.count-badge {
  background: var(--n-150); border: 1px solid var(--n-300);
  border-radius: 12px; padding: 0 10px; height: 26px;
  line-height: 26px; font-size: 12px; font-variant-numeric: tabular-nums;
  font-weight: 600; white-space: nowrap;
}

/* ── Tables ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  padding: 8px 10px;
  background: var(--n-150);
  border-bottom: 1px solid var(--n-200);
  font-weight: 600;
  text-align: left;
  color: var(--n-700);
  white-space: nowrap;
  position: sticky; top: 0;
}
.tbl tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--n-200);
  color: var(--n-900);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--n-150); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-usable  { background: var(--green-soft); color: var(--green); }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-dead    { background: var(--n-150); color: var(--n-500); }

/* ── Pager ── */
.pager {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  padding: 12px 0;
  color: var(--n-500); font-size: 13px;
}

/* ── Misc ── */
.hint        { color: var(--n-500); font-size: 12px; }
.hint-block  { color: var(--n-500); font-size: 13px; margin-bottom: 12px; }
.mono        { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; color: var(--n-700); }
.stat-row    { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--n-700); }
.stat-row b  { color: var(--n-900); }
.subform     { background: var(--n-150); border: 1px solid var(--n-200); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }

/* ── Toast ── */
.toast {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  background: var(--n-900); color: #fff;
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.18);
  pointer-events: none;
}
.toast.err  { background: var(--red); }
.toast.warn { background: var(--amber); color: var(--n-900); }

/* ── Responsive ── */
@media (max-width: 860px) {
  .hero-row   { grid-template-columns: repeat(2, 1fr); }
  .action-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 4px; }
  .nav-item { flex: 0 auto; }
  .hero-row { grid-template-columns: repeat(2, 1fr); }
}


/* ── 2026-09-30 夜新增 ── */
.country-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.country-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border: 1px solid var(--n-300); border-radius: 14px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.country-chip:hover { background: var(--n-150); }
.country-chip.bad { border-color: var(--amber); color: var(--amber); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-on  { background: var(--green); }
.dot-off { background: var(--n-300); }
.scan-agent-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--n-200); }
.attr-warn {
  background: var(--amber-soft); border: 1px solid var(--amber);
  color: var(--amber); border-radius: var(--radius-sm);
  padding: 8px 12px; margin-bottom: 10px; font-size: 13px;
}

/* ══════════════════════════════════════════════════════════
   任务窗口系统（终端风：黑底绿字）—— 2026-09-30 夜
   ══════════════════════════════════════════════════════════ */
.taskwin {
  position: fixed;
  width: 620px;
  max-width: calc(100vw - 24px);
  background: #000;
  border: 1px solid #1f3b1f;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55), 0 0 0 1px rgba(60, 255, 60, .06);
  z-index: 900;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}
.taskwin.min { display: none; }

.taskwin-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: linear-gradient(180deg, #0d150d 0%, #0a100a 100%);
  border-bottom: 1px solid #1f3b1f;
  cursor: move;
  user-select: none;
}
.taskwin-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #ffb020; flex-shrink: 0;
  box-shadow: 0 0 6px rgba(255, 176, 32, .8);
}
.taskwin.done .taskwin-dot   { background: #2fbf5f; box-shadow: 0 0 6px rgba(47, 191, 95, .8); }
.taskwin.failed .taskwin-dot { background: #e5484d; box-shadow: 0 0 6px rgba(229, 72, 77, .8); }
.taskwin-kind { color: #9dff9d; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.taskwin-title { color: #3a5f3a; font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskwin-state { color: #d0f0d0; font-size: 11px; padding: 1px 8px; border: 1px solid #1f3b1f; border-radius: 10px; }
.taskwin.done .taskwin-state   { color: #2fbf5f; border-color: #1f5b2f; }
.taskwin.failed .taskwin-state { color: #e5484d; border-color: #5b1f1f; }

.taskwin-btn {
  width: 22px; height: 20px; line-height: 1;
  background: #0a100a; color: #7fb87f;
  border: 1px solid #1f3b1f; border-radius: 5px;
  font-size: 12px; cursor: pointer; padding: 0;
}
.taskwin-btn:hover { background: #132013; color: #b0ffb0; }
.taskwin-btn.danger:hover { background: #2a0d0d; color: #ff8080; border-color: #5b1f1f; }

.taskwin-body {
  height: 320px;
  overflow: auto;
  padding: 10px 12px;
  background: #000;
  scrollbar-width: thin;
  scrollbar-color: #1f3b1f #000;
}
.taskwin-log {
  margin: 0;
  color: #33ff33;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  text-shadow: 0 0 6px rgba(51, 255, 51, .32);
}
.taskwin-body::-webkit-scrollbar { width: 8px; }
.taskwin-body::-webkit-scrollbar-thumb { background: #1f3b1f; border-radius: 4px; }
.taskwin-body::-webkit-scrollbar-track { background: #000; }

.taskwin-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  background: #0a100a;
  border-top: 1px solid #1f3b1f;
}
.taskwin-progress { flex: 0 0 160px; height: 5px; background: #101a10; border-radius: 3px; overflow: hidden; }
.taskwin-fill { height: 100%; width: 0; background: linear-gradient(90deg, #1f8f3f, #33ff33); transition: width .4s; }
.taskwin-hint { color: #7fb87f; font-size: 11px; flex: 1; }
.taskwin-msg { color: #e5484d; font-size: 11px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 侧边栏任务窗口菜单 */
.sidebar-windows {
  border-top: 1px solid var(--n-200);
  padding: 8px 8px 4px;
  max-height: 240px;
  overflow-y: auto;
}
.sidebar-windows-title {
  font-size: 11px; color: var(--n-500);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 0 4px 6px;
}
.win-menu-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; color: var(--n-700);
}
.win-menu-item:hover { background: var(--n-150); }
.win-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.win-dot.running { background: var(--amber); animation: winpulse 1.2s ease-in-out infinite; }
.win-dot.done    { background: var(--green); }
.win-dot.failed  { background: var(--red); }
@keyframes winpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ==========================================================
   2026-10-01 面板改版：二级菜单 / 邮箱分类 / 复制 / 文件按钮
   ========================================================== */

/* 侧边栏品牌 */
.sidebar-sub {
  font-size: 11px;
  font-weight: 400;
  opacity: .55;
  margin-top: 3px;
  letter-spacing: .2px;
}
.sidebar-credit {
  font-size: 11px;
  line-height: 1.5;
  opacity: .45;
  padding: 10px 0 8px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-bottom: 6px;
}

/* 二级菜单 */
.nav-group { position: relative; }
.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.nav-caret { font-size: 10px; opacity: .5; transition: transform .15s; }
.nav-sub {
  display: flex;
  flex-direction: column;
  margin: 2px 0 4px 10px;
  border-left: 1px solid rgba(255,255,255,.12);
  padding-left: 2px;
}
.nav-subitem {
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  opacity: .72;
}
.nav-subitem:hover { background: rgba(255,255,255,.06); opacity: 1; }
.nav-subitem.active { background: rgba(255,255,255,.10); opacity: 1; font-weight: 600; }

/* 邮箱页分类 tab */
.mail-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.mail-tab {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--line, #e3e3e3);
  background: transparent;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
}
.mail-tab.active {
  background: var(--primary, #111);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

/* 总览邮箱卡片右上角切换按钮 */
.hero-toggle-card { position: relative; }
.hero-switch {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(128,128,128,.35);
  background: rgba(128,128,128,.10);
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  transition: opacity .15s, transform .15s;
}
.hero-switch:hover { opacity: 1; transform: rotate(180deg); }

/* 可点击复制 */
.copyable { cursor: pointer; }
.copyable:hover { text-decoration: underline dotted; }

/* 文件选择按钮（原生 input[type=file] 太丑，包一层） */
.mail-upload-row { align-items: center; gap: 10px; }
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px dashed var(--line, #ccc);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  max-width: 340px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: border-color .15s, background .15s;
}
.file-btn:hover { border-color: var(--primary, #111); background: rgba(128,128,128,.06); }
.file-btn input[type=file] { display: none; }
.file-btn span { overflow: hidden; text-overflow: ellipsis; }

.badge-sold { background: rgba(200,160,40,.16); color: #a37a12; }


/* ── 邮箱二级菜单 ───────────────────────────────────────── */
.nav-sub {
  margin: 2px 0 6px 12px;
  padding-left: 10px;
  border-left: 2px solid var(--n-200);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-sub-item {
  padding: 7px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  color: var(--n-500);
  font-size: 13px;
  transition: background 120ms, color 120ms;
}
.nav-sub-item:hover  { background: var(--n-150); color: var(--n-700); }
.nav-sub-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }

/* ── 总览卡片右上角切换按钮 ─────────────────────────────── */
.hero-card { position: relative; }
.hero-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--n-200);
  border-radius: 50%;
  background: #fff;
  color: var(--n-500);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: all 140ms;
}
.hero-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
  transform: rotate(180deg);
}

/* ── 点击复制 ───────────────────────────────────────────── */
.copyable {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 120ms, color 120ms;
}
.copyable:hover {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

/* ── 文件选择（自定义样式，原生 input 太丑且各浏览器不一）── */
.file-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.file-pick input[type=file] { display: none; }
.file-pick-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--n-700);
  font-size: 13px;
  cursor: pointer;
  transition: all 140ms;
  user-select: none;
}
.file-pick-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}
.file-pick-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--n-500);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.upload-row { align-items: center; }

/* ── 内联统计值 ─────────────────────────────────────────── */
.stat-inline {
  font-weight: 600;
  color: var(--n-900);
  font-size: 13px;
}
