:root {
  --navy: #0d1b2a;
  --navy-2: #14263b;
  --accent: #2f9bff;
  --accent-2: #16c5b0;
  --red: #e3493f;
  --text: #16202c;
  --muted: #6b7a8d;
  --line: #e3e8ef;
  --bg: #f6f8fb;
  --card: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* iOS 横屏 / 小屏下禁止系统自动放大字号 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- header ---------- */
.topbar {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 22px; height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; color: #fff; letter-spacing: -.3px; }
.brand:hover { text-decoration: none; }
.brand .gem {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #06202a;
}
.brand .f { color: var(--accent); }
.brand .tld { color: #8fa6c0; font-weight: 600; font-size: 17px; letter-spacing: -.2px; }
.brand .brandtext { white-space: nowrap; }
.brandnote { font-weight: 400; font-size: 14px; color: #93a7bd; }
.topbar nav { display: flex; gap: 20px; margin-left: auto; font-size: 14px; }
.topbar nav a { color: #b9c6d6; }
.topbar nav a:hover { color: #fff; text-decoration: none; }

/* ---------- language switcher ---------- */
.langsw {
  display: flex; align-items: center; gap: 2px; font-size: 13px;
  margin-left: 6px; padding: 3px; border-radius: 8px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.10);
}
.langsw a, .langsw span {
  padding: 3px 10px; border-radius: 6px; color: #b9c6d6; line-height: 1.3;
}
.langsw a:hover { color: #fff; background: rgba(255,255,255,.10); text-decoration: none; }
.langsw .cur { color: #fff; background: rgba(47,155,255,.85); font-weight: 600; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 60%, #17324d 100%);
  color: #fff;
  padding: 44px 20px 40px;
  text-align: center;
}
.hero h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.6px; }
.hero h1 .f { color: var(--accent); }
.hero h1 .tld { color: #7b93ad; font-size: .8em; }
/* h1 标题里的 logo 只显示域名文字，隐藏角标 */
.hero h1 .gem, .auth-wrap h1 .gem { display: none; }
.hero p { margin: 0 0 22px; color: #a9bdd3; font-size: 15px; }

.searchbar { max-width: 720px; margin: 0 auto; display: flex; gap: 0; }
.searchbar input[type=search] {
  flex: 1; height: 52px; padding: 0 18px; font-size: 16px;
  border: 0; border-radius: var(--radius) 0 0 var(--radius); outline: none;
}
.searchbar button {
  width: 62px; height: 52px; border: 0; cursor: pointer;
  background: var(--red); color: #fff; font-size: 19px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.searchbar button:hover { filter: brightness(1.08); }

/* ---------- container ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------- stats ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; flex: 1 1 160px;
}
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 2px; }

/* ---------- filters ---------- */
.filters {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px;
}
.filters form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select {
  height: 36px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 14px; background: #fff; color: var(--text); min-width: 120px;
}
.field input[type=date], .field input[data-datepicker] { min-width: 148px; }
.btn {
  height: 36px; padding: 0 16px; border: 0; border-radius: 7px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: #eef2f7; color: var(--text); }

/* ---------- table ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 11px 16px; background: #fbfcfe; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid #f0f3f7; vertical-align: middle; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
.dom { font-weight: 700; font-size: 15px; color: var(--text); }
.price { font-weight: 700; color: #0b7a3b; font-variant-numeric: tabular-nums; }
.price.big { color: var(--red); }
.plat {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 20px;
  background: #eef2f7; color: #43536a; white-space: nowrap;
}
.date { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.src { font-size: 12px; color: var(--muted); }
.empty { padding: 54px 20px; text-align: center; color: var(--muted); }

/* 成交列数字对齐 */
table.sales thead th:nth-child(2),
table.sales thead th:nth-child(3),
table.sales tbody td:nth-child(2),
table.sales tbody td:nth-child(3) { text-align: right; }
table.sales tbody td:nth-child(2) { padding-right: 22px; }

/* ---------- pager ---------- */
.pager { display: flex; gap: 6px; justify-content: center; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); font-size: 14px;
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .cur { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
.pager .gap { border: 0; background: transparent; color: var(--muted); }

/* ---------- footer ---------- */
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 20px; }
.foot-line { margin-top: 4px; }

/* 底部外链（友情链接 / 资源）—— 后台「外链管理」控制 */
.outlinks { margin: 0 auto 18px; max-width: 900px; }
.outlinks-in {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  align-items: center; justify-content: center;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card);
}
.outlinks-title {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  padding-right: 4px;
}
.outlinks ul { display: flex; flex-wrap: wrap; gap: 8px 10px; list-style: none; margin: 0; padding: 0; }
.outlinks li { margin: 0; }
.outlinks a {
  display: inline-block; padding: 5px 11px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; color: var(--text); background: #fff;
}
.outlinks a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- auth / admin ---------- */
.auth-wrap { max-width: 400px; margin: 70px auto; }
.auth-wrap .card { padding: 26px; }
.auth-wrap h1 { margin: 0 0 4px; font-size: 22px; }
.auth-wrap h1 .f { color: var(--accent); }
.auth-wrap h1 .tld { color: #9aa9bb; font-size: .82em; }
.auth-wrap .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { font-size: 13px; color: #445; display: block; margin-bottom: 5px; }
.stack input, .stack select, .stack textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.stack textarea { min-height: 190px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
/* 复选框：.stack input 默认 width:100%，会把勾选框拉满整行 */
.stack label.chk { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 0; white-space: nowrap; }
.stack label.chk input[type=checkbox] { width: auto; height: auto; padding: 0; margin: 0; accent-color: var(--accent); }
.btn.full { width: 100%; height: 42px; font-size: 15px; }
.alert { padding: 11px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert.err { background: #fdecea; color: #96271f; border: 1px solid #f7cfcb; }
.alert.ok  { background: #eafaf1; color: #0b6b3a; border: 1px solid #c6efd8; }
.alert.info{ background: #eef5ff; color: #1a4d8f; border: 1px solid #cfe1fb; }

.adminbar {
  background: var(--navy-2); color: #cfdcea; font-size: 13px;
}
.adminbar .in { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 46px; display: flex; align-items: center; gap: 18px; }
.adminbar a { color: #cfdcea; padding: 5px 10px; border-radius: 6px; }
/* 选中态原来只把 #cfdcea 换成 #fff，肉眼几乎看不出当前在哪一页 */
.adminbar a.on { color: #fff; background: rgba(255,255,255,.15); font-weight: 600; }
.adminbar a:hover { color: #fff; background: rgba(255,255,255,.09); text-decoration: none; }
.adminbar .right a { padding: 5px 8px; }
.adminbar .right { margin-left: auto; display: flex; gap: 16px; align-items: center; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 14px; }
.kv .k { color: var(--muted); }
.row-actions form { display: inline; }
.link-btn { background: none; border: 0; color: var(--red); cursor: pointer; font-size: 13px; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

/* 后台文档页的代码块（curl / Python 示例），窄屏横向滚动不撑破页面 */
pre.code {
  background: #f5f8fc; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 0 0 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; color: #16202c;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}

.token-box { background: #f5f8fc; border: 1px dashed #c8d6e8; border-radius: 8px; padding: 10px 12px; }
h2.sec { font-size: 17px; margin: 28px 0 12px; }
.hint { font-size: 13px; color: var(--muted); }

/* ---------- 日期选择器（原生 date input 的年月日跟浏览器语言，改不了） ---------- */
.dp {
  position: absolute; z-index: 60; width: 262px; padding: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 36px rgba(13,27,42,.18);
  font-size: 13px; color: var(--text);
}
.dp[hidden] { display: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-title { font-weight: 700; font-size: 14px; }
.dp-nav {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 15px; line-height: 1; color: var(--text);
}
.dp-nav:hover { background: #f2f6fb; border-color: var(--accent); }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-week { margin-bottom: 4px; }
.dp-week span { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0; }
.dp-day {
  height: 30px; border: 0; border-radius: 6px; background: transparent;
  cursor: pointer; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums;
}
.dp-day:hover { background: #eef4fb; }
.dp-day.other { color: #c3cdd9; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--accent); }
.dp-day.sel, .dp-day.sel:hover { background: var(--accent); color: #fff; font-weight: 600; }
.dp-foot {
  display: flex; justify-content: space-between; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--line);
}
.dp-foot button {
  border: 0; background: none; color: var(--accent); cursor: pointer;
  font-size: 12px; padding: 3px 6px; border-radius: 5px; font-family: inherit;
}
.dp-foot button:hover { background: #eef4fb; }

/* ============================================================
   响应式适配
   ------------------------------------------------------------
   设计约束：≤760px 为手机/小平板，≤480px 进一步收紧。
   三条必须守住的底线（首版全都踩了）：
     1) 表格不能靠 min-content 撑开布局视口 —— 窄屏把 table 变成
        横向滚动容器（display:block + overflow-x:auto），整站才不会
        被一张宽表带偏。
     2) flex 子项默认 min-width:auto，长文本/下拉框不肯收缩就会溢出。
        凡是 flex 里放 input/select/长文本的，一律 min-width:0。
     3) 顶栏与后台导航必须允许换行，否则窄屏直接横向溢出。
   ============================================================ */

/* 横竖屏通用：下拉/输入框允许收缩，长 token 允许断行 */
.field input, .field select, .searchbar input { min-width: 0; max-width: 100%; }
.mono, .token-box { overflow-wrap: anywhere; }

@media (max-width: 760px) {

  /* ---------- 顶栏 ---------- */
  .topbar-inner {
    height: auto; min-height: 54px;
    padding: 8px 12px; gap: 12px;
    flex-wrap: wrap;                 /* 挤不下就换行，绝不横向溢出 */
  }
  .brand { font-size: 18px; gap: 8px; }
  .brand .gem { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }
  .brand .tld { font-size: 15px; }
  .brandnote { display: none; }
  .topbar nav { gap: 12px; font-size: 13px; }
  .langsw { font-size: 12px; padding: 2px; }
  .langsw a, .langsw span { padding: 3px 8px; }

  /* ---------- Hero / 搜索 ---------- */
  .hero { padding: 30px 14px 28px; }
  .hero h1 { font-size: 25px; }
  .hero p { font-size: 13px; margin-bottom: 18px; }
  .searchbar input[type=search] { height: 46px; padding: 0 14px; }
  .searchbar button { width: 54px; height: 46px; }

  /* ---------- 容器 ---------- */
  .wrap { padding: 18px 12px 48px; }

  /* ---------- 统计卡：一行两个 ---------- */
  .stat { flex: 1 1 calc(50% - 6px); padding: 10px 12px; }
  .stat .v { font-size: 18px; }

  /* ---------- 筛选表单：两列，下拉框独占一行 ---------- */
  .filters { padding: 12px; }
  .filters form { gap: 10px 8px; }
  .field { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .field input, .field select {
    width: 100%; min-width: 0;      /* 覆盖 PC 的 min-width:120px，否则不收缩 */
    height: 38px;
  }
  .field input[type=date], .field input[data-datepicker] { min-width: 0; }
  .field:has(select) { flex-basis: 100%; }   /* 选项很长，独占一行 */
  .filters form > .btn { flex: 1 1 100%; height: 40px; }

  /* ---------- 表格：横向滚动，不撑布局视口 ---------- */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  thead th { padding: 10px 12px; }
  tbody td { padding: 10px 12px; }
  .empty { padding: 40px 16px; }
  /* 首列吸附：横向滚动时仍有参照，否则滚过一轮就认不出这行是谁。
     默认吸附第 1 列；.g2 表示关键标识在第 2 列（后台数据列表的关键列是「域名」），
     改吸附域名、行号列跟着滑走 —— 手机上认域名比认行号有用得多。 */
  table.grid thead th:first-child,
  table.grid tbody td:first-child { position: sticky; left: 0; }
  table.grid thead th:first-child { z-index: 2; background: #fbfcfe; }
  table.grid tbody td:first-child { z-index: 1; background: #fff; }

  table.grid.g2 thead th:first-child,
  table.grid.g2 tbody td:first-child { position: static; }
  table.grid.g2 thead th:nth-child(2),
  table.grid.g2 tbody td:nth-child(2) { position: sticky; left: 0; }
  table.grid.g2 thead th:nth-child(2) { z-index: 2; background: #fbfcfe; }
  table.grid.g2 tbody td:nth-child(2) { z-index: 1; background: #fff; }

  /* ---------- 分页 ---------- */
  .pager { gap: 5px; }
  .pager a, .pager span { min-width: 34px; height: 34px; padding: 0 8px; font-size: 13px; }

  /* ---------- 页脚外链 ---------- */
  .outlinks-in { padding: 12px; gap: 8px 10px; }
  .outlinks-title { flex-basis: 100%; text-align: center; padding: 0 0 2px; }
  .outlinks a { font-size: 12px; padding: 5px 10px; }

  /* ---------- 登录框 ---------- */
  .auth-wrap { margin: 40px auto; padding: 0 16px; }
  .auth-wrap .card { padding: 20px; }

  /* ---------- 后台顶栏 ---------- */
  .adminbar .in {
    height: auto; padding: 8px 12px;
    gap: 6px 10px; flex-wrap: wrap;
  }
  .adminbar a { padding: 5px 8px; font-size: 12.5px; }
  .adminbar .right { margin-left: auto; gap: 10px; }

  /* ---------- 后台表单 ---------- */
  .card[style*="max-width"] { max-width: 100% !important; }
  h2.sec { font-size: 16px; margin: 22px 0 10px; }

  /* ---------- 日期选择器：不超出视口 ---------- */
  .dp { width: 262px; max-width: calc(100vw - 24px); }
}

@media (max-width: 480px) {

  /* 极窄屏：字段一律独占一行，避免两个日期框挤在一起 */
  .field { flex: 1 1 100%; }
  .stat { flex: 1 1 100%; }
  .hero h1 { font-size: 22px; }
  .brand { font-size: 17px; }
  .brand .tld { font-size: 14px; }

  /* 后台 kv 表：标签窄一点，值允许断行 */
  .kv { grid-template-columns: 92px 1fr; gap: 6px 10px; }
  .kv .v, .kv > div { overflow-wrap: anywhere; }

  .adminbar a { padding: 4px 7px; font-size: 12px; }
  .adminbar .in { gap: 4px 8px; }
}
