/* ============================================================
   EngTranslate Tools — 共享主题
   设计取向：工程化、朴素、可复现。不用渐变/发光等 "AI 感" 视觉——
   工程用户对"AI Generated"更警惕，朴素的工程仪表盘风格反而更可信。
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16202c;
  --ink-2: #46576b;
  --muted: #7488a0;
  --line: #dde3ea;
  --line-2: #eef2f6;
  --accent: #0b6bcb;
  --accent-ink: #084d94;
  --accent-soft: #eaf3fc;
  --ok: #0f7b4f;
  --warn: #8a5a00;
  --warn-soft: #fff6e5;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

/* ---------- 共享导航 ---------- */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-nav .wrap {
  display: flex; align-items: center; gap: 20px;
  height: 56px; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--ink); font-size: 16px; letter-spacing: -.2px; }
.brand span { color: var(--accent); font-weight: 600; }
.site-nav nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.site-nav nav a { color: var(--ink-2); }
.site-nav nav a.is-active { color: var(--accent); font-weight: 600; }
.nav-soon { color: var(--muted); cursor: default; }

/* ---------- 语言切换（右上角） ---------- */
.lang-switch { margin-left: auto; display: flex; gap: 4px; flex: 0 0 auto; }
.lang-switch a {
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); text-decoration: none;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.lang-switch a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.lang-switch a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 560px) {
  .lang-switch { margin-left: 0; }
}

/* ---------- 页头 ---------- */
.page-head { padding: 28px 0 8px; }
.page-head h1 { font-size: 26px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.3px; }
.page-head .lede { color: var(--ink-2); margin: 0; max-width: 68ch; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card > h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 14px; font-weight: 700;
}

/* ---------- 表单 ---------- */
.grid {
  display: grid; gap: 14px 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.field label {
  display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600;
}
.field .hint { font-weight: 400; color: var(--muted); }
.field .row { display: flex; gap: 0; }
.field input, .field select {
  width: 100%; padding: 9px 11px; font-size: 15px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit;
}
.field input { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.field .unit {
  flex: 0 0 auto; display: flex; align-items: center; padding: 0 11px;
  background: var(--line-2); border: 1px solid var(--line); border-radius: 0 6px 6px 0;
  font-size: 13px; color: var(--ink-2); font-family: var(--mono); min-width: 52px; justify-content: center;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ---------- 单位切换 ---------- */
.unit-switch {
  display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: var(--surface);
}
.unit-switch button {
  border: 0; background: transparent; padding: 7px 14px; font: inherit; font-size: 13px;
  color: var(--ink-2); cursor: pointer;
}
.unit-switch button.on { background: var(--accent); color: #fff; font-weight: 600; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- 结果 ---------- */
.results { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.result {
  background: var(--accent-soft); border: 1px solid #cfe4f8; border-radius: 6px; padding: 12px 14px;
}
.result .k { font-size: 12px; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.result .v { font-family: var(--mono); font-size: 21px; font-weight: 600; color: var(--ink); margin-top: 3px; }
.result .v small { font-size: 13px; color: var(--ink-2); font-weight: 400; }

/* ---------- 计算过程（可复现） ---------- */
.steps { font-family: var(--mono); font-size: 13.5px; background: var(--surface); }
.steps ol { margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 5px; color: var(--ink-2); }
.steps li b { color: var(--ink); }

.assump-list, .notes-list { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.assump-list li, .notes-list li { margin-bottom: 4px; }

/* ---------- 免责 / 方法 ---------- */
.notice {
  background: var(--warn-soft); border: 1px solid #f0dcae; border-left: 3px solid #d9a300;
  border-radius: 6px; padding: 12px 14px; font-size: 13.5px; color: #5c4200; margin-bottom: 16px;
}
.notice strong { color: #4a3500; }
.method { font-size: 14px; color: var(--ink-2); }
.method code {
  font-family: var(--mono); background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 13px;
}
.refs { font-size: 13px; color: var(--muted); margin: 8px 0 0; padding-left: 20px; }

/* ---------- 表格 ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: right; }
table.data th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { font-family: var(--mono); }
table.data tr:hover td { background: var(--line-2); }

/* ---------- 目录 / 相关工具 ---------- */
.cat { margin-bottom: 26px; }
.cat > h2 { font-size: 15px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.cat ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cat li a {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 13px; color: var(--ink); font-weight: 600; font-size: 14px;
}
.cat li a:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }
.cat li small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  font-size: 13px; padding: 5px 11px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--ink-2);
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- 页脚 ---------- */
.site-foot { margin-top: 40px; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.site-foot .wrap { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }
.site-foot nav { display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .page-head h1 { font-size: 22px; }
  .site-nav .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; }
}

/* ============================================================
   /glossary/ 工程术语库
   ============================================================ */
.gl-search { display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; }
.gl-search input {
  flex: 1 1 auto; min-width: 0; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.gl-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.gl-count { flex: 0 0 auto; font-size: 12.5px; color: var(--muted); }
.gl-empty { font-size: 14px; color: var(--muted); margin: 10px 0 0; }

.cat-n { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.cat-desc { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
.cat > h2 a { color: var(--ink); }
.cat > h2 a:hover { color: var(--accent); text-decoration: none; }

table.terms { font-size: 13.5px; }
table.terms th, table.terms td { text-align: left; vertical-align: top; }
table.terms .t-zh { font-family: inherit; font-weight: 600; color: var(--ink); white-space: nowrap; }
table.terms .t-en { font-family: var(--mono); color: var(--accent-ink); }
table.terms .t-abbr { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
table.terms .t-note { font-family: inherit; color: var(--ink-2); font-size: 13px; }
table.terms tr:hover td { background: var(--accent-soft); }

/* ============================================================
   /app/ 工程翻译
   ============================================================ */
.seg { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg-btn {
  padding: 8px 14px; font: inherit; font-size: 14px; border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer;
}
.seg-btn.on { background: var(--accent); color: #fff; font-weight: 600; }
.seg-swap {
  padding: 8px 10px; font: inherit; font-size: 14px; border: 0; border-left: 1px solid var(--line);
  border-right: 1px solid var(--line); background: var(--line-2); color: var(--ink-2); cursor: pointer;
}
.seg-swap:hover { color: var(--accent); }

.tr-count { font-size: 12.5px; color: var(--muted); }

.field textarea {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 15px; line-height: 1.6; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); resize: vertical;
}
.field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.tr-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-primary {
  padding: 10px 22px; font: inherit; font-weight: 600; font-size: 14px; color: #fff;
  background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius); cursor: pointer;
}
.btn-primary:hover { background: var(--accent-ink); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost {
  padding: 9px 16px; font: inherit; font-size: 14px; color: var(--accent); background: transparent;
  border: 1px solid var(--accent); border-radius: var(--radius); cursor: pointer;
}
.btn-ghost:hover { background: var(--accent-soft); }

.tr-status { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.tr-status.err { color: #b00020; }

.tr-out {
  min-height: 96px; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--line-2); color: var(--muted); font-size: 15px; line-height: 1.65; white-space: pre-wrap;
}
.tr-out.filled { background: var(--surface); color: var(--ink); border-color: var(--line); }

.tr-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; min-height: 22px; }
.hits-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.hit {
  display: inline-block; margin: 0 6px 0 0; padding: 3px 9px; font-size: 12.5px; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 999px; font-family: var(--mono);
}
.conf { font-size: 12.5px; color: var(--muted); }

@media (max-width: 600px) {
  .gl-search { flex-direction: column; align-items: stretch; gap: 6px; }
  .seg { width: 100%; }
  .seg-btn { flex: 1 1 0; padding: 9px 8px; font-size: 13px; }
  table.terms { font-size: 12.5px; }
  table.terms th:nth-child(4), table.terms td:nth-child(4) { display: none; }
}

/* ---- /docs/ 文档翻译 ---- */
.dc-drop {
  margin-top: 12px; padding: 22px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: var(--line-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dc-drop:hover, .dc-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.dc-drop-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.dc-drop-hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.dc-actions { margin-top: 12px; }
.dc-meta { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.dc-warning { margin-top: 8px; font-size: 13px; color: var(--warn); background: var(--warn-soft); border: 1px solid #f0dcae; border-radius: 6px; padding: 10px 12px; }
.dc-status { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.dc-status.err { color: #b00020; }

.dc-preview {
  max-height: 260px; overflow: auto; margin: 10px 0 0; padding: 12px 13px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--line-2);
  font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}

.dc-out { margin-top: 10px; }
.dc-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-2);
}
.dc-pair:last-child { border-bottom: none; }
.dc-src { font-size: 13.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.dc-tgt { font-size: 14px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; word-break: break-word; }

@media (max-width: 600px) {
  .dc-pair { grid-template-columns: 1fr; gap: 4px; }
  .dc-tgt { padding-bottom: 8px; border-bottom: 1px solid var(--line-2); }
}

/* ---- Cookie 提示条（GDPR 事前同意；默认零 Cookie，接受/拒绝同等权重） ---- */
.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(22, 32, 44, .07);
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
}
.consent .wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.consent-txt { flex: 1 1 380px; margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.consent-txt a { color: var(--accent); }
.consent-row { display: flex; gap: 10px; flex: 0 0 auto; }
.consent-row .btn { cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; padding: 9px 18px; border-radius: var(--radius); }
.btn.consent-yes { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn.consent-no { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

@media (max-width: 600px) {
  .consent .wrap { gap: 12px; }
  .consent-txt { flex: 1 1 100%; }
  .consent-row { width: 100%; }
  .consent-row .btn { flex: 1; }
}
