/* ==========================================================================
   tool.css — 工具页共用样式 (统一模板)
   所有工具页复用同一套版式, 仅 .tool-panel 内的交互各自实现。

   ★ 工具页统一模板 (改版式前先读 PROJECT_RULES.md 第六节)

     宽屏 (>980px)                          窄屏 (<=980px)
     ┌ 左栏 ──────────────┬ 右栏 ────────┐  ┌────────────────┐
     │ .tool-head 标题卡片 │ .tool-side   │  │ .tool-head 卡片 │
     ├────────────────────┤  推荐工具     │  ├────────────────┤
     │ .tool-panel 工具面板│      ↓       │  │ .tool-panel    │
     │                    │  广告位       │  ├────────────────┤
     └────────────────────┴──────────────┘  │ .tool-side     │
                                            └────────────────┘

     四条约定:
       1) 标题卡片与工具面板同宽、左右对齐 (同在左栏, 共用一套卡片样式);
       2) 侧栏从标题卡片顶端起、跨满两行 —— 上=推荐工具, 下=广告位;
       3) 列宽/间距只有一处定义 = .tool-page 的 --side-w / --layout-gap;
       4) 宽屏定位写在 @media (min-width: 981px); 窄屏不定位, 按 DOM 顺序单栏。
   ========================================================================== */

.tool-page {
  padding: 6px 24px 30px;
  /* 右侧栏宽度 / 两栏间距: 标题卡片与 .tool-layout 共用, 以后只改这里 */
  --side-w: 300px;
  --layout-gap: 20px;
}

/* ---------- 顶部标题区 (白色卡片, 与 .tool-panel 同款) ---------- */
/* 宽度与位置由 .tool-layout 的网格决定, 见下方 min-width:981px 的排布规则 */
.tool-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}
/* ★ 工具名在语义上是 <h1>(SEO/GEO 需要), 但视觉必须和原来的 <span> 完全一致:
   h1 自带 margin / font-size / font-weight, 这里全部改回"继承", 不影响现有排版。 */
h1.tool-title-text {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

/* ---------- 工具页正文 (B3) ----------
   ★ 这块由 scripts/build.js 在构建时写入, 位置在 </main> 之后 ——
     即 [data-content] 之外, 运行时不会被 layout.js 覆盖,
     所以爬虫抓到的和真人看到的是同一份内容, 不存在"只给爬虫看"的隐藏文本。
   ★ 宽度: 跟顶部广告条同宽 (.container), 不受工具面板 / sidebar 窄栏限制。 */
.tool-content {
  margin: 26px auto 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.tool-content h2 { margin: 0 0 12px; font-size: 19px; font-weight: 700; color: var(--text); }
.tool-content h3 { margin: 20px 0 6px; font-size: 15px; font-weight: 600; color: var(--text); }
.tool-content p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
}
.tool-content h2 + p, .tool-content h3 + p { margin-top: 0; }
/* 分节里的要点列表 (config/content 的 sections[].list) */
.tool-content ul {
  margin: 0 0 16px;
  padding-left: 22px;
}
.tool-content li {
  margin: 4px 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
}
/* 代码示例 (config/content 的 sections[].code) */
.tool-content pre {
  margin: 6px 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0F172A;
  color: #E2E8F0;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  overflow: auto;
  tab-size: 2;
}
.tool-content pre code {
  color: inherit;
  font: inherit;
}
.tool-content table {
  width: 100%;
  margin: 6px 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--surface);
  font-size: 14px;
}
.tool-content caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.tool-content th, .tool-content td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.tool-content th {
  font-weight: 600;
  white-space: nowrap;
  background: rgba(249, 124, 18, .06);
  color: var(--text);
}
.tool-content tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .tool-content table { font-size: 13px; }
  .tool-content th, .tool-content td { padding: 8px 10px; }
  .tool-content th { white-space: normal; }
}

.tool-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .2px;
}
.tool-title .tool-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.tool-desc {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.tool-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.tool-meta .price-label { font-size: 13px; color: var(--text-muted); margin-right: 2px; }
.tool-meta .tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-left: 8px; }

/* ---------- 主体两栏 ---------- */
.tool-layout {
  display: grid;
  grid-template-columns: 1fr var(--side-w);
  gap: var(--layout-gap);
  align-items: start;
}

/* 宽屏排布:
 *   左栏第一行 = 标题卡片 (.tool-head)
 *   左栏第二行 = 工具面板 (.tool-panel)
 *   右栏       = 侧栏 (.tool-side), 从顶部起跨两行 -> 推荐工具在上, 广告在下
 * ★ 用 min-width 而不是 max-width: 窄屏时这里完全不生效,
 *   三个区块就直接按 DOM 顺序单栏堆叠 -> 标题 / 工具面板 / 侧栏。 */
@media (min-width: 981px) {
  .tool-head  { grid-column: 1; grid-row: 1; }
  .tool-panel { grid-column: 1; grid-row: 2; }
  .tool-side  { grid-column: 2; grid-row: 1 / span 2; }
}

/* ---------- 文件列表面板 ---------- */
.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.sel-count { font-size: 13px; color: var(--text-sub); }
.sel-count .dot { color: var(--brand); font-weight: 700; }
.file-notice { font-size: 12px; color: var(--text-muted); }

.file-scroll { overflow-x: auto; }
.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.file-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  background: #FAFBFD;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.file-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-sub);
}
.file-table tbody tr:last-child td { border-bottom: 0; }
.file-table tbody tr:hover { background: #FBFCFE; }

.file-name { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 500; }
.file-thumb {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--blue-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.file-path { color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* 状态 */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; }
.status .s-dot { width: 7px; height: 7px; border-radius: 50%; }
.status.waiting { color: var(--text-muted); } .status.waiting .s-dot { background: var(--text-muted); }
.status.running { color: var(--blue); }       .status.running .s-dot { background: var(--blue); animation: s-pulse 1s ease-in-out infinite; }
.status.done    { color: var(--green); }      .status.done .s-dot { background: var(--green); }
.status.failed  { color: var(--red); }        .status.failed .s-dot { background: var(--red); }
@keyframes s-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* 进度 */
.progress { width: 110px; height: 6px; border-radius: 999px; background: #EDF1F7; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--brand); font-size: 13px; font-weight: 600; font-family: inherit;
}
.link-btn:hover { color: var(--brand-dark); }
.link-btn.danger { color: var(--red); }
.link-btn.danger:hover { color: #C93A31; }
.link-btn + .link-btn { margin-left: 14px; }

/* ---------- 底部操作区 ---------- */
.panel-actions {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  background: #FCFDFF;
}
/* 实际工具区 (左下角): 各工具在此实现自己的交互界面 */
.actual-tool {
  flex: 1;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #F8FAFC;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}
.action-right { display: flex; align-items: center; gap: 12px; }
.target-select {
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  outline: none;
}
.target-select:focus { border-color: var(--brand); }
.target-select:disabled { opacity: .55; cursor: not-allowed; }
.action-hint { font-size: 12px; color: var(--text-muted); max-width: 190px; line-height: 1.4; }

/* ---------- 推荐工具侧栏 ---------- */
.tool-side .side-title {
  font-weight: 700;
  font-size: 15px;
  margin: 4px 0 12px;
}
.reco-list { display: flex; flex-direction: column; gap: 8px; }
.reco-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.reco-item:hover { border-color: var(--brand-2); color: var(--brand); box-shadow: 0 8px 20px rgba(249, 124, 18, .1); }
.reco-item .reco-ico {
  width: 32px; height: 32px;
  border-radius: 9px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
/* 右侧栏广告位 (策略见 config/ads.js 的 <工具id>.side) */
.ad-side { margin-top: 14px; }
.tool-side .ad-inner { height: 250px; }   /* 与 config/ads.js 的 'side-300x250' 一致 */

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .tool-layout { grid-template-columns: 1fr; }
  .panel-actions { flex-direction: column; align-items: stretch; }
  .action-right { justify-content: flex-end; }
}

/* ==========================================================================
   图片格式转换 (tool-format) 专属样式
   ========================================================================== */
/* 拖拽悬停高亮 */
.tool-panel.tf-dragging {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* 空状态: 大块点击 / 拖拽上传区 */
.tf-drop {
  margin: 18px;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: #F8FAFC;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.tf-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.tf-drop-ico {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--brand);
  font-size: 26px;
  font-weight: 700;
  box-shadow: var(--shadow-card);
}
.tf-drop-title { font-size: 16px; font-weight: 700; color: var(--text); }
.tf-drop-sub { font-size: 12.5px; color: var(--text-muted); text-align: center; }
.tf-drop-tip { font-size: 12.5px; color: var(--brand); margin-top: 4px; }

/* 底部操作行: 左侧提示 + 右侧[目标格式下拉 + 三个按钮], 同一行 */
.tf-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  background: #FCFDFF;
}
.tf-notice, .tf-hint { font-size: 12.5px; color: var(--text-muted); margin-right: auto; }
.tf-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .tf-actions { flex-direction: column; align-items: stretch; }
  .tf-notice, .tf-hint { margin-right: 0; }
  .tf-right { margin-left: 0; justify-content: flex-end; }
}

/* ==========================================================================
   SQL 枚举值转换 (tool-sql-enum) 专属样式
   结构: 输入框 -> [开始转换 | 自定义分隔符 | 清空] -> 分隔符面板(可折叠)
         -> 结果条(计数 + 引号/去重) -> 输出框(右上角"复制")
   ========================================================================== */
.sq-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

/* 输入框 */
.sq-input {
  width: 100%;
  min-height: 150px;
  box-sizing: border-box;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.sq-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sq-input::placeholder { color: var(--text-muted); }

/* 按钮行 */
.sq-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sq-actions .sq-clear { margin-left: auto; }
.sq-actions .btn.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 识别到的分隔符提示 (面板收起时才显示) */
.sq-hint {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
  word-break: break-all;
}
.sq-hint[hidden] { display: none; }

/* 勾选框: 橙底白勾
   ★ 不用原生勾选框 + accent-color: 各浏览器/系统画出来是"橙底 + 黑勾"(或深色勾),
     和全站橙白配色不搭。这里 appearance:none 自己画, 勾用内联 SVG(白色描边)保证一致。
   ★ 这是全站【统一】的勾选框样式。以后新增勾选框, 把选择器加进下面三组里就行,
     千万别图省事写 accent-color —— 那正是会画出黑勾的写法。 */
.sq-chip input[type="checkbox"],
.sq-opt input[type="checkbox"],
.sal-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 15px;
  height: 15px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #fff center / 11px 11px no-repeat;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.sq-chip input[type="checkbox"]:checked,
.sq-opt input[type="checkbox"]:checked,
.sal-check input[type="checkbox"]:checked {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M3.2 8.4l3.1 3.1L12.8 5'/%3E%3C/svg%3E");
}
.sq-chip input[type="checkbox"]:focus-visible,
.sq-opt input[type="checkbox"]:focus-visible,
.sal-check input[type="checkbox"]:focus-visible { outline: 2px solid var(--brand-soft); outline-offset: 1px; }
/* 换行是固定项: 保持"已勾选"的样子, 只把鼠标指针换成默认 */
.sq-chip.is-fixed input[type="checkbox"] { cursor: default; }

/* 分隔符面板 */
.sq-delims {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #F8FAFC;
}
.sq-delims-title { margin-bottom: 10px; font-size: 12.5px; color: var(--text-muted); }
.sq-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sq-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, color .15s;
}
.sq-chip.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.sq-chip.is-fixed { cursor: default; }
.sq-chip-glyph { font-family: ui-monospace, Consolas, monospace; line-height: 1; }
.sq-chip-name { color: inherit; }

/* 结果区 */
.sq-out { display: flex; flex-direction: column; gap: 8px; }
.sq-out-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sq-count { font-size: 12.5px; color: var(--text-muted); }
.sq-out-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sq-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-sub); }
.sq-opt-label { color: var(--text-muted); }
.sq-select {
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}
.sq-select:focus { border-color: var(--brand); }

.sq-out-box { position: relative; }
.sq-output {
  width: 100%;
  min-height: 130px;
  box-sizing: border-box;
  resize: vertical;
  padding: 12px 96px 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #FCFDFF;
  color: var(--text);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
  outline: none;
  transition: border-color .15s;
}
.sq-output:focus { border-color: var(--brand); }
.sq-output::placeholder { color: var(--text-muted); }
.sq-copy { position: absolute; top: 8px; right: 8px; font-size: 12.5px; }

@media (max-width: 640px) {
  .sq-wrap { padding: 14px; }
  .sq-out-box { display: flex; flex-direction: column; }
  .sq-output { padding-right: 14px; }
  .sq-copy { position: static; align-self: flex-end; margin-top: 8px; }
}

/* ==========================================================================
   时间戳转换 (tool-timestamp) 专属样式
   结构: 顶部橙卡(本地时间/秒级/毫秒级) -> 两栏 [日期->时间戳 | 时间戳->时间]
   两栏各自: 分段输入(年月日 时分秒 + 日历按钮) -> [开始转换 | 时区]
             -> 结果行(标签 + 值 + 复制)
   ========================================================================== */
.ts-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

/* ---------- 顶部橙卡 ---------- */
.ts-now {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--brand);
  color: #fff;
}
.ts-now-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;              /* 允许在网格里被压缩 —— 不然值会撑破卡片而不是换行 */
  text-align: center;
}
.ts-now-k { font-size: 13px; opacity: .92; }
.ts-now-v {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word; /* 值里有空格 -> 优先在空格处换行; 兜底不溢出 */
}
.ts-now-item .ts-copy {
  background: #fff;
  color: var(--brand);
  border-color: transparent;
}

/* ---------- 两栏 ---------- */
.ts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.ts-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.ts-card-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ---------- 分段输入 ---------- */
.ts-fields { position: relative; }
.ts-seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.ts-seg-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ts-num {
  width: 34px;
  padding: 7px 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ts-num[data-f="y"] { width: 54px; }
.ts-num:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ts-sep { color: var(--text-muted); font-size: 14px; }

.ts-cal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-left: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-sub);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.ts-cal-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ---------- 按钮 / 下拉 ---------- */
.ts-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}
.ts-run { flex: 1 1 auto; }
.ts-select {
  flex: 0 1 auto;
  max-width: 60%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.ts-select:focus { border-color: var(--brand); }

/* ---------- 时间戳输入行 ---------- */
.ts-tsline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ts-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}
.ts-toggle-btn {
  padding: 6px 14px;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--brand-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ts-toggle-btn.is-on { background: var(--brand); color: #fff; }
.ts-tsinput {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ts-tsinput:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ts-tsinput::placeholder { color: var(--text-muted); }

/* ---------- 结果区 ---------- */
.ts-results {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.ts-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.ts-row + .ts-row { border-top: 1px dashed var(--border-strong); }
.ts-row-k {
  flex: 0 0 auto;
  min-width: 86px;
  color: var(--text-muted);
  font-size: 13px;
}
.ts-row-v {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  /* 不用 nowrap / overflow —— 值长了直接换行显示, 不出横向滚动条 */
  overflow-wrap: break-word;
}

/* 复制按钮 (顶部橙卡 / 结果行共用) */
.ts-copy {
  flex: 0 0 auto;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ts-copy:hover { background: var(--brand); color: #fff; }

/* ---------- 日历弹层 ---------- */
/* ★★ .tool-panel 自带 overflow:hidden (为了裁标题栏的圆角)。
   日历弹层是它的绝对定位后代, 一旦超出面板底部就会被【整个裁掉】。
   tool-timestamp 的面板里没有依赖圆角裁切的内容, 所以这一页放开。
   用 body 上已有的 data-page 限定范围, 不影响别的工具。 */
[data-page="tool-timestamp"] .tool-panel { overflow: visible; }

.ts-cal {
  --cal-nav-h: 28px;     /* 月份导航按钮尺寸; 也是「时分秒」标签行的高度 (必须同高才对得齐) */
  --cal-head-gap: 8px;   /* 标题行与其下方内容的间距; 滚轮那边也吃这个值 */
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  /* ★ 不要写 min(470px, 100%): 这页左边有 300px 侧栏, 字段实际只有 ~374px,
     弹层会被卡在 374px, 标题「2026年10月」正好挤到换行。
     改成按视口给上限 -> 弹层允许比字段宽 (弹层溢出卡片是正常表现),
     同时不超视口, 免得撑出横向滚动条。 */
  width: min(430px, calc(100vw - 64px));
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.ts-cal[hidden] { display: none; }
.ts-cal-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--cal-head-gap);
}
.ts-cal-nav {
  width: var(--cal-nav-h);
  height: var(--cal-nav-h);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.ts-cal-nav:hover { border-color: var(--brand); color: var(--brand); }
.ts-cal-title {
  flex: 1 1 auto;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;   /* ★ 年月绝不折成两行 */
}
.ts-cal-week,
.ts-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.ts-cal-wd {
  padding: 4px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.ts-cal-day {
  padding: 7px 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.ts-cal-day:hover { background: var(--brand-soft); color: var(--brand-dark); }
.ts-cal-day.is-out { color: var(--text-muted); opacity: .55; }
.ts-cal-day.is-sel { background: var(--brand); color: #fff; font-weight: 700; }

/* --- 弹层主体: 左 = 日历(年月日), 右 = 时/分/秒 滚轮 --- */
.ts-cal-body {
  /* ★ 用 grid 写死列数, 而不是 flex-wrap。
     用 flex-wrap 时只要空间算差一点点, 滚轮就会换行掉到日历下面 ——
     弹层瞬间高出 ~200px, 又会被 .tool-panel 的 overflow:hidden 裁掉,
     最终表现为「滚轮根本没有显示出来」。grid 没有换行这个失败模式。 */
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;  /* 左: 日历自适应  右: 滚轮固定宽 */
  gap: 12px;
  align-items: start;
}
.ts-cal-datesec { min-width: 0; }

/* 时 / 分 / 秒 三列滚轮
   ★ 下面这两个高度必须与 tool-timestamp.js 里的 COL_VISIBLE / COL_H 严格一致,
     否则「滚到正中」会错位。改高度请两边一起改。 */
.ts-tp { min-width: 0; }
.ts-tp-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  /* ★★ 对齐约束 (验收第 3 轮): 高度 = 月份导航按钮高, 下间距 = 标题行的下间距。
     两处都取 .ts-cal 上的同一组变量, 于是:
       「时 分 秒」与左侧「年 月」自动在同一水平线上;
       下面的数字区正好从左侧「周六」那一行开始。
     要调标题行的高度/间距, 只改 .ts-cal 里的变量, 这里自动跟随。 */
  min-height: var(--cal-nav-h);
  margin-bottom: var(--cal-head-gap);
}
.ts-tp-labels span {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.ts-tp-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.ts-tp-col {
  height: 196px;                 /* = COL_VISIBLE(7) × COL_H(28) */
  overflow-y: auto;
  scroll-snap-type: y mandatory; /* 松手必停在一整格上 -> JS 才能用 round 算序号 */
  overscroll-behavior: contain;  /* 滚到头不要带着整页一起滚 */
  scrollbar-width: none;         /* 隐藏滚动条, 更像轮盘 */
}
.ts-tp-col::-webkit-scrollbar { display: none; }
.ts-tp-col + .ts-tp-col { border-left: 1px solid var(--border); }
.ts-tp-pad { pointer-events: none; }
.ts-tp-item {
  display: block;
  width: 100%;
  height: 28px;                  /* = COL_H */
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
  scroll-snap-align: center;
  transition: background .12s, color .12s;
}
.ts-tp-item:hover { background: var(--brand-soft); }
.ts-tp-item.is-sel {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}
.ts-cal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.ts-cal-foot .ts-cal-now { flex: 0 0 auto; }
.ts-cal-foot .ts-cal-done { flex: 1 1 auto; }

/* ---------- 窄屏 ---------- */
@media (max-width: 980px) {
  .ts-grid { grid-template-columns: 1fr; }
  .ts-now-v { font-size: 16px; }   /* 三列还在, 值缩小以免撑破橙卡 */
}
@media (max-width: 640px) {
  .ts-wrap { padding: 14px; }
  .ts-now { grid-template-columns: 1fr; gap: 14px; }
  .ts-now-v { font-size: 20px; }
  .ts-actions { flex-direction: column; align-items: stretch; }
  .ts-select { max-width: none; }
  .ts-cal { width: 100%; }
  /* 窄屏放不下并排 -> 日历与滚轮改成上下堆叠 (滚轮整行铺开) */
  .ts-cal-body { grid-template-columns: minmax(0, 1fr); }
  /* 结果行: 标签 + 复制 占第一行, 值独占第二行 —— 免得值被挤成窄条疯狂折行 */
  .ts-row { flex-wrap: wrap; }
  .ts-row-k { order: 1; min-width: 0; }
  .ts-row .ts-copy { order: 2; margin-left: auto; }
  .ts-row-v { order: 3; flex: 1 1 100%; }
}
