/* =====================================================================
   公开工具箱 共享样式（T-127）
   色板与字号严格取自 public/main.html，不新造配色：
     canvas #ffffff / ink #1d1d1f / hairline #e0e0e0 / primary #0066cc
     surface-2 #f5f5f7 / muted #7a7a7a
   正文 17 / 400 / 1.47 / -0.374px，最小触控高 44px，卡片圆角 18px。
   ⛔ 不引任何外部 CDN、不加载外部字体。
   ===================================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: #ffffff;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

/* ---------- 顶部返回条 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0;
}

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

/* 「回到主界面」= {component.button-secondary-pill}
   透明底 + 1px {colors.primary} 描边 + {rounded.pill} 胶囊，
   文字 {typography.button-utility} 14 / 400 / 1.29 / -0.224px，
   内边距 11 × 22（此处横向收 20，窄屏不挤） */
.topbar .topbar-home {
  flex: 0 0 auto;
  /* 位置统一：index 页 topbar 里只有按钮（无面包屑），
     space-between 单子项会把它顶到最左，与另外 6 页最右不一致。
     这里给按钮自己 margin-left:auto，有无面包屑都吸附右端。 */
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.29;
  letter-spacing: -0.224px;
  /* {colors.primary} #0066cc */
  color: #0066cc;
  background: transparent;
  border: 1px solid #0066cc;
  border-radius: 9999px;
  text-decoration: none;
  white-space: nowrap;
}

.topbar .topbar-home:hover {
  /* 幽灵胶囊悬停：极淡蓝底，不加第二主色 */
  background: #f5f5f7;
  text-decoration: none;
}

.topbar .topbar-home:active {
  transform: scale(0.95);
}

.topbar a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px 0 0;
  color: #0066cc;
  text-decoration: none;
  font-size: 17px;
  letter-spacing: -0.374px;
}

.topbar a:hover {
  text-decoration: underline;
}

.topbar .sep {
  color: #e0e0e0;
}

.topbar .here {
  color: #7a7a7a;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
}

/* ---------- 标题区 ---------- */
.page-title {
  margin: 8px 0 8px;
  /* {typography.display-md} 34 / 600 / 1.47 / -0.374px（章节标题档） */
  font-size: 34px;
  font-weight: 600;
  line-height: 1.47;
  letter-spacing: -0.374px;
}

.page-desc {
  margin: 0 0 20px;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
  color: #7a7a7a;
  line-height: 1.43;
}

/* ---------- 隐私提示条（每页必有） ---------- */
.privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 24px;
  padding: 12px 16px;
  background: #f5f5f7;
  /* {rounded.sm} 8px —— 紧凑工具容器 */
  border-radius: 8px;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
  line-height: 1.43;
  color: #1d1d1f;
}

.privacy .dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-radius: 50%;
  background: #0066cc;
}

/* ---------- 卡片 ---------- */
.card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 18px;
  padding: 24px;
  margin: 0 0 20px;
}

.card-title {
  margin: 0 0 16px;
  /* {typography.tagline} 21 / 600 / 1.19 / +0.231px —— 21px 档是正字距 */
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
}

/* ---------- 表单控件 ---------- */
label.field-label {
  display: block;
  margin: 0 0 8px;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
  color: #7a7a7a;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: #1d1d1f;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  /* {rounded.sm} 8px —— 表单属紧凑工具容器，统一一档；
     ⛔ 不用 11px（那档 {rounded.md} 明文只给 Pearl Button） */
  border-radius: 8px;
  /* ⛔ 不再无条件 outline: none —— 那会把键盘聚焦环一并掐掉。
     鼠标点击仍不显示环（由下面的 :focus:not(:focus-visible) 控制），
     键盘 Tab 进来一定有 2px {colors.primary-focus} 外环。 */
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: #0066cc;
}

/* =====================================================================
   键盘聚焦环（{component.button-primary-focus}）
   规格明文：outline: 2px solid {colors.primary-focus} #0071e3
   ⛔ 这是无障碍硬要求，不受 DESIGN-public.md 定稿影响
   ===================================================================== */

/* 键盘可达元素统一 2px 外环；offset 2px 让环不贴着边框，与规格的 ring 语义一致 */
:focus-visible {
  /* {colors.primary-focus} #0071e3 */
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}

/* 鼠标点击时不显示环（保留 :focus-visible 的键盘路径）。
   只对能自己接焦点的元素写，避免影响程序化 focus。 */
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
button:focus:not(:focus-visible),
.btn:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: #0066cc;
}

input[type="color"] {
  width: 100%;
  min-height: 44px;
  padding: 4px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
}

input[type="file"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-family: inherit;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
  color: #1d1d1f;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 24px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.374px;
  color: #ffffff;
  background: #0066cc;
  border: 0;
  /* {rounded.pill} —— button-primary 的整粒胶囊就是「可点」的信号 */
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.btn:hover {
  background: #0071e3;
}

button:active,
.btn:active {
  /* 规格明文：系统级微交互一律 scale(0.95) */
  transform: scale(0.95);
}

button.btn-secondary,
.btn.btn-secondary {
  color: #0066cc;
  background: #f5f5f7;
}

button.btn-secondary:hover,
.btn.btn-secondary:hover {
  background: #e0e0e0;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.row > * {
  flex: 0 0 auto;
}

.grow {
  flex: 1 1 220px;
  min-width: 0;
}

/* ---------- 结果表 ---------- */
.kv {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 17px;
}

.kv th,
.kv td {
  padding: 12px 0;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: top;
}

.kv th {
  width: 42%;
  font-weight: 400;
  color: #7a7a7a;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
}

.kv tr:last-child th,
.kv tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  /* {typography.caption} 14px 档；等宽字体保留 0 字距，不套 -0.224px */
  font-size: 14px;
  letter-spacing: 0;
}

.note {
  margin: 12px 0 0;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
  color: #7a7a7a;
  line-height: 1.43;
}

.err {
  color: #d70015;
}

.ok {
  color: #0066cc;
}

/* ---------- 索引页分组 ---------- */
.group-title {
  margin: 32px 0 12px;
  /* {typography.tagline} 21 / 600 / 1.19 / +0.231px */
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
}

.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #e0e0e0;
  border-radius: 18px;
  overflow: hidden;
}

.tool-list li {
  border-bottom: 1px solid #e0e0e0;
}

.tool-list li:last-child {
  border-bottom: 0;
}

.tool-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 14px 20px;
  color: #0066cc;
  text-decoration: none;
  font-size: 17px;
  letter-spacing: -0.374px;
}

.tool-list a:hover {
  background: #f5f5f7;
}

.tool-list .t {
  flex: 1 1 auto;
  min-width: 0;
}

.tool-list .d {
  display: block;
  margin-top: 2px;
  /* {typography.caption} 14 / 400 / 1.43 / -0.224px */
  font-size: 14px;
  letter-spacing: -0.224px;
  color: #7a7a7a;
  line-height: 1.43;
}

.tool-list .arrow {
  flex: 0 0 auto;
  color: #e0e0e0;
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 16px 48px;
  }
  /* 页面标题保持 {typography.display-md} 34 / 600 / 1.47 / -0.374 不降档：
     规格阶梯里 28px 是 {typography.lead} 的 400 重档，没有 600 重的 28px 组合，
     自造「28 / 600 / 1.19 / -0.28」等于又跳出资格阶梯。 */
  .card {
    padding: 20px 16px;
  }
  .kv th {
    width: 38%;
  }
}
