/* ============================================================
   TradeKit — document generator styling
   Built on the site palette from assets/style.css (DESIGN.md):
   navy #0b2545 base, orange #f2600c reserved for the primary
   action only, navy-tinted shadows (never pure black).
   ============================================================ */

.dwrap {
  max-width: var(--maxw, 1120px);
  margin: 0 auto;
  /* 顶部留白统一：这些页没有 hero 横幅，H1 直接顶在吸顶导航下，
     过去 padding-top:0 导致紧贴边缘。统一给到与 .section 一致的呼吸感。 */
  padding: clamp(40px,5vw,56px) 20px 64px;
}
.dwrap > p.dlead {
  max-width: 800px;
  margin: 0 0 18px;
  font-size: 17px;
  line-height: 1.78;
  color: var(--muted, #5b6b7f);
}

/* ---------- hub grid ---------- */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.docs-grid .card {
  display: block;
  background: #fff;
  border: 1px solid var(--line, #e4e9f0);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 10px 30px rgba(11, 37, 69, .10));
  text-decoration: none;
  transition: transform .18s var(--ease, ease), box-shadow .18s var(--ease, ease);
}
.docs-grid .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg, 0 22px 52px rgba(11, 37, 69, .14));
}
.docs-grid .card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  /* 标题占满两行的高度：原来 1 行 / 2 行标题混排，卡片描述起始高度参差 */
  line-height: 1.3;
  min-height: 2.6em;
  font-weight: 800;
  color: var(--navy, #0b2545);
}
.docs-grid .card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted, #5b6b7f);
}

/* ---------- toolbar ---------- */
.dbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line, #e4e9f0);
  margin-bottom: 22px;
}
.dbar-tabs { display: flex; gap: 6px; }
.dtab {
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  padding: 9px 18px;
  border: 1px solid var(--line, #e4e9f0);
  background: #fff;
  color: var(--navy, #0b2545);
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s var(--ease, ease), color .18s var(--ease, ease);
}
.dtab.on { background: var(--navy, #0b2545); border-color: var(--navy, #0b2545); color: #fff; }
.dbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn-ghost,
.btn-primary {
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  border-radius: var(--r-sm, 10px);
  padding: 10px 16px;
  cursor: pointer;
  transition: background .18s var(--ease, ease), box-shadow .18s var(--ease, ease), transform .18s var(--ease, ease);
}
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line, #e4e9f0);
  color: var(--navy, #0b2545);
}
.btn-ghost:hover { background: #f6f8fb; }
.btn-primary {
  background: var(--orange, #f2600c);
  border: 1px solid var(--orange, #f2600c);
  color: #fff;
  box-shadow: 0 6px 18px rgba(11, 37, 69, .12);
}
.btn-primary:hover { background: var(--orange-ink, #c24d06); border-color: var(--orange-ink, #c24d06); }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--orange, #f2600c);
  outline-offset: 2px;
}

/* ---------- cards ---------- */
.dcard {
  background: #fff;
  border: 1px solid var(--line, #e4e9f0);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 10px 30px rgba(11, 37, 69, .10));
  padding: 26px 24px;
  margin-bottom: 22px;
}
.dcard-t {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--navy, #0b2545);
}
.dcard-h { margin: 0 0 22px; font-size: 16px; line-height: 1.7; color: var(--muted, #5b6b7f); }

.dgroup {
  border: 1px solid var(--line, #e4e9f0);
  border-radius: var(--radius, 14px);
  padding: 18px 18px 20px;
  margin: 0 0 18px;
  /* a fieldset defaults to min-width:min-content, which lets a wide item
     table push the page sideways and defeats the table's own scroll box */
  min-width: 0;
}
.dgroup > legend {
  padding: 0 8px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--navy, #0b2545);
}
.dgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 16px;
}
.df { display: flex; flex-direction: column; gap: 6px; }
.df-wide { grid-column: 1 / -1; }
.df label { font-size: 14px; font-weight: 700; color: var(--ink, #16202b); }
.df input,
.df select,
.df textarea {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e4e9f0);
  border-radius: var(--r-sm, 10px);
  background: #fff;
  color: var(--ink, #16202b);
}
.df textarea { resize: vertical; min-height: 62px; }
.df input:focus,
.df select:focus,
.df textarea:focus { border-color: var(--navy, #0b2545); }

/* ---------- live FX rate row (currency converter) ---------- */
.dfx { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 2px; }
.dfx-btn {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 8px 15px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--navy, #0b2545); background: #fff;
  border: 1px solid var(--line, #e3e8ef); border-radius: 999px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.dfx-btn svg {
  width: 15px; height: 15px; flex: 0 0 15px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.dfx-btn:hover { border-color: #cbd9f7; background: #eaf0fd; color: #1b3faa; }
.dfx-btn[disabled] { opacity: .6; cursor: progress; }
.dfx-btn.spin svg { animation: dfxspin .9s linear infinite; }
@keyframes dfxspin { to { transform: rotate(360deg); } }
.dfx-status { font-size: 12.5px; line-height: 1.45; color: #7b8490; }
.dfx-status.ok { color: #0f6e56; font-weight: 600; }
.dfx-status.err { color: #b3261e; font-weight: 600; }

/* ---------- item table ---------- */
.di-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 12px; max-width: 100%; }
.di { width: 100%; border-collapse: collapse; min-width: 640px; }
.di th {
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--navy, #0b2545);
  padding: 8px 10px;
  border-bottom: 2px solid var(--navy, #0b2545);
  white-space: nowrap;
}
.di td { padding: 6px 10px; border-bottom: 1px solid var(--line, #e4e9f0); }
.di td input {
  font: inherit;
  font-size: 15px;
  width: 100%;
  min-width: 70px;
  padding: 8px 9px;
  border: 1px solid var(--line, #e4e9f0);
  border-radius: 8px;
}
.di-calc { font-weight: 700; color: var(--navy, #0b2545); font-variant-numeric: tabular-nums; }
.di-del { width: 44px; text-align: center; }
.di-rm {
  font: inherit;
  font-size: 20px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line, #e4e9f0);
  background: #fff;
  color: var(--danger, #a32111);
  border-radius: 8px;
  cursor: pointer;
}
.di-rm:hover { background: var(--danger-soft, #fdecea); }

.dtotals { display: flex; flex-direction: column; gap: 8px; max-width: 420px; margin-left: auto; }
.dtotal {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  background: var(--orange-soft, #fff4ee);
  border: 1px solid var(--orange-line, #ffd9c2);
  border-radius: var(--r-sm, 10px);
  font-weight: 700;
  color: var(--navy, #0b2545);
}
.dtotal b { font-variant-numeric: tabular-nums; }

/* ---------- preview sheet ---------- */
.pv-sheet {
  background: #fff;
  color: var(--ink, #16202b);
  border: 1px solid var(--line, #e4e9f0);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 10px 30px rgba(11, 37, 69, .10));
  padding: 26px 28px 30px;
}
.pv-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--navy, #0b2545);
  margin-bottom: 18px;
}
.pv-title { margin: 0; font-size: 24px; font-weight: 800; color: var(--navy, #0b2545); }
.pv-meta { font-size: 15px; font-weight: 700; color: var(--muted, #5b6b7f); }
.pv-block { margin-bottom: 20px; }
.pv-block-t {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--navy, #0b2545);
  background: #f6f8fb;
  padding: 7px 10px;
  border-left: 3px solid var(--orange, #f2600c);
  margin-bottom: 10px;
}
.pv-row { display: flex; flex-wrap: wrap; gap: 0 24px; margin-bottom: 6px; }
.pv-cell { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.pv-lb { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted, #5b6b7f); }
.pv-vl { font-size: 15px; }
.pv-table, .pv-totals { width: 100%; border-collapse: collapse; }
/* Fixed layout keeps a many-column document inside the sheet on screen
   and inside A4 landscape when the PDF is rendered. */
.pv-table { table-layout: fixed; }
.pv-table th, .pv-table td { word-break: break-word; overflow-wrap: anywhere; }
.pv-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  background: var(--navy, #0b2545);
  padding: 8px 10px;
}
.pv-table td { padding: 8px 10px; border-bottom: 1px solid var(--line, #e4e9f0); font-size: 14px; }
.pv-table tbody tr:nth-child(even) td { background: #f9fbfd; }
.pv-totals { margin-left: auto; width: min(420px, 100%); }
.pv-totals td { padding: 8px 10px; font-size: 15px; font-weight: 700; }
.pv-totals td.pv-amt { text-align: right; color: var(--navy, #0b2545); font-variant-numeric: tabular-nums; }
.pv-totals tr:last-child td { border-top: 2px solid var(--navy, #0b2545); }

/* ---------- flow diagram ---------- */
.dflow-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dflow { display: block; width: 100%; height: auto; min-width: 860px; }
.dflow a text { pointer-events: none; }
.dflow a:hover rect { fill: #ffe4d2; stroke: var(--orange, #f2600c); }
.dflow a:hover text { fill: var(--orange-ink, #c24d06); }

/* ---------- step-by-step ---------- */
.dstep {
  display: flex;
  gap: 16px;
  margin: 22px 0;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line, #e4e9f0);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 10px 30px rgba(11, 37, 69, .10));
}
.dstep-n {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy, #0b2545);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dstep-b { flex: 1 1 auto; min-width: 0; }
.dstep-b h2 {
  margin: 0 0 10px;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--navy, #0b2545);
}
.dstep-do, .dstep-watch, .dstep-docs {
  font-size: 16px;
  line-height: 1.78;
  margin: 0 0 10px;
  color: var(--ink, #16202b);
}
.dstep-do b, .dstep-docs b, .dstep-watch b { color: var(--navy, #0b2545); }
.dstep-watch {
  background: var(--orange-soft, #fff4ee);
  border-left: 3px solid var(--orange, #f2600c);
  border-radius: 8px;
  padding: 12px 14px;
}
.dstep-docs { margin-bottom: 0; }
.dstep-docs a { color: var(--navy, #0b2545); font-weight: 700; text-decoration: underline; }
.dstep-docs a:hover { color: var(--orange-ink, #c24d06); }

@media (max-width: 640px) {
  .dstep { flex-direction: column; gap: 12px; padding: 18px 16px; }
  .dstep-b h2 { font-size: 18px; }
}

/* ---------- generator-style previews (shipping mark, invoice numbers) ---------- */
.pv-mark {
  border: 2px solid var(--navy, #0b2545);
  border-radius: 4px;
  padding: 16px 18px;
  display: inline-block;
  min-width: 260px;
  max-width: 100%;
}
.pv-mark-diamond { transform: rotate(-4deg); border-style: dashed; }
.pv-markline {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--navy, #0b2545);
  letter-spacing: .02em;
}
.pv-numlist { display: flex; flex-direction: column; gap: 6px; }
.pv-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy, #0b2545);
  background: #f6f8fb;
  border: 1px solid var(--line, #e4e9f0);
  border-radius: 8px;
  padding: 8px 12px;
}

/* ---------- modal ---------- */
.dmodal {
  position: fixed;
  inset: 0;
  background: rgba(11, 37, 69, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
}
.dmodal[hidden] { display: none; }
.dmodal-box {
  background: #fff;
  border-radius: var(--radius-lg, 18px);
  box-shadow: var(--shadow-lg, 0 22px 52px rgba(11, 37, 69, .14));
  max-width: 460px;
  width: 100%;
  padding: 26px 24px;
}
.dmodal-box h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; color: var(--navy, #0b2545); }
.dmodal-box p { margin: 0 0 20px; font-size: 16px; line-height: 1.7; color: var(--muted, #5b6b7f); }
.dmodal-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .dwrap { padding: clamp(28px,7vw,38px) 16px 48px; }
  .dcard { padding: 20px 16px; }
  .dgroup { padding: 14px 12px 16px; }
  .dgrid { grid-template-columns: 1fr; }
  .dbar { gap: 10px; }
  .dbar-actions { width: 100%; }
  .dbar-actions .btn-ghost,
  .dbar-actions .btn-primary { flex: 1 1 auto; }
  .pv-sheet { padding: 18px 16px 22px; }
  .pv-title { font-size: 20px; }
  .dtotals { margin-left: 0; max-width: none; }
}

/* ---- 垂直节奏修正（2026-10-10 间距审计：主标题→正文曾只有 12px） ---- */
h1 { margin-bottom: 18px; }
.dcard-t { margin: 0 0 10px; }
.docs-grid .card p:last-child { margin-bottom: 0; }
.docs-grid .card p { margin: 0 0 12px; }

/* ===== SOFT HOVER 收口（本文件在 style.css 之后加载，故必须在此重声明） ===== */
body .docs-grid .card{
  transition:transform var(--hv-t,180ms) var(--hv-ease,cubic-bezier(.22,.61,.36,1)),box-shadow var(--hv-t,180ms) ease,border-color var(--hv-t,180ms) ease,background-color var(--hv-t,180ms) ease;
}
@media (hover:hover){
  body .docs-grid .card:hover{
    transform:translateY(var(--hv-dy,-2px));background-color:var(--hv-tint,#fdfaf4);
    border-color:var(--hv-line,#e2d8c8);
    box-shadow:var(--hv-sh-h,0 2px 5px rgba(19,32,41,.05),0 12px 26px -18px rgba(19,32,41,.30));
  }
}


/* Align Trade Documents hub banner with calculator tool pages. */
body.tk-page-docs-index main > .dwrap:first-child{padding-top:clamp(40px,5vw,64px)!important}
