/* ==========================================================================
   工具頁共用版面（tool-page.css）
   用於改版後的計算機頁面（salary-lite、insurance…），載入於頁面 inline <style> 之後，
   因此共用規則以 `html body` 提高權重。
   #capture-area 與 #capture-area2-limited 會被 html2canvas 截成圖片，這兩區只使用
   html2canvas 支援的樣式（不用 backdrop-filter、color-mix、background-clip:text、負字距）。
   ========================================================================== */

html body .tp-page { padding: calc(var(--lt-header-h) + 8px) 0 32px; }

/* 擷取範圍：原本用 margin: 0 -80px 擴出容器，html2canvas 會把超出視窗的右側裁掉；
   改為留在容器內，左右用 padding 留白 */
html body .tp-page #capture-area2-limited { margin-left: 0; margin-right: 0; padding: 8px 24px 24px; }
html body .tp-page #capture-area { margin-left: 0; margin-right: 0; padding: 4px 16px 20px; }
html body .tp-page #capture-area2-limited > .container { padding-left: 0; padding-right: 0; }
@media screen and (max-width: 767.98px) {
  html body .tp-page #capture-area2-limited { padding: 4px 0 16px; }
  html body .tp-page #capture-area { padding: 4px 0 16px; }
}
html body .tp-page .row { margin-bottom: 4px; }

/* ---- 標題 ---- */
html body .tp-hero-head { padding: 8px 0 8px; text-align: center; }
html body .tp-hero-head h1 { margin-top: 24px !important; }
.tp-lead {
  max-width: 38em;
  margin: 14px auto 0;
  color: var(--lt-ink-3);
  font-size: 1.0625rem;
  line-height: 1.75;
}

html body .tp-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 40px 0 16px;
  color: var(--lt-ink);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
html body .tp-section-title::before {
  content: "";
  flex: none;
  width: 4px;
  height: 20px;
  border-radius: 2px;
  background: linear-gradient(180deg, #5a55f0, #3fb6e8);
}

/* ---- 輸入：分組卡片 ---- */
.tp-form { display: grid; gap: 16px; }
.tp-group {
  min-width: 0;
  margin: 0;
  padding: 20px 24px 10px;
  border: 1px solid var(--lt-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--lt-shadow-1);
}
.tp-group__legend {
  float: left;
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 16px;
  padding: 0;
  color: var(--lt-ink);
  font-size: 1rem;
  font-weight: 700;
}
.tp-group__legend small { color: var(--lt-ink-4); font-size: .8125rem; font-weight: 400; }
.tp-group__legend ~ * { clear: both; }
.tp-group__num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5a55f0, #7675ff);
  color: #fff;
  font: 700 .8125rem/1 var(--lt-font-num);
}
.tp-group .row + .row { padding-top: 6px; border-top: 1px dashed var(--lt-line); }

/* ---- 結果：薪資條 ---- */
.tp-result { padding-top: 8px; }
.tp-result__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0 16px;
}
html body .tp-result__head .tp-section-title { margin: 0; }
.tp-meta { display: flex; gap: 12px; }
.tp-meta__item { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.tp-meta__label { color: var(--lt-ink-4); font-size: .75rem; font-weight: 600; letter-spacing: .04em; margin: 0; }
html body .tp-meta__value {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--lt-line);
  border-radius: 10px;
  background: var(--lt-canvas);
  color: var(--lt-ink);
  font-weight: 700;
}

.tp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  margin-bottom: 16px;
  border-radius: 22px;
  overflow: hidden;
  background: #0f1330;
  color: #fff;
}
.tp-hero__main {
  padding: 28px 32px;
  background: linear-gradient(120deg, #3a33ab 0%, #5a55f0 60%, #3f8fe0 100%);
}
.tp-hero__side { padding: 28px 32px; border-left: 1px solid rgba(255, 255, 255, .08); }
.tp-hero__label { color: rgba(255, 255, 255, .82); font-size: .875rem; font-weight: 500; }
.tp-hero__amount { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.tp-hero__currency { color: rgba(255, 255, 255, .78); font: 600 1rem/1 var(--lt-font-num); }
html body .tp-hero__amount .value {
  color: #fff;
  font: 800 clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem)/1.05 var(--lt-font-num);
  letter-spacing: 0; /* html2canvas 匯出圖片時，負字距會讓千分位逗號錯位 */
  font-variant-numeric: tabular-nums;
}
html body .tp-hero__amount.is-small .value { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }

.tp-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tp-card {
  --tone: #5a55f0; --tone-ink: #3a33ab;
  padding: 18px 22px 10px;
  border: 1px solid var(--lt-line);
  border-radius: 18px;
  background: #fff;
}
.tp-card.is-earn    { --tone: #14a585; --tone-ink: #0b6e58; }
.tp-card.is-deduct  { --tone: #e04b6a; --tone-ink: #a42945; }
.tp-card.is-company { --tone: #5a55f0; --tone-ink: #3a33ab; }
.tp-card.is-income  { --tone: #d9850b; --tone-ink: #8f5300; }
html body .tp-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--tone-ink);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .08em;
}
.tp-card__title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.tp-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--lt-line);
}
.tp-line:last-child { border-bottom: 0; }
.tp-line__label { color: var(--lt-ink-3); font-size: .9375rem; }
html body .tp-line__value {
  min-width: 4ch;
  color: var(--lt-ink);
  font: 700 1rem/1.3 var(--lt-font-num);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tp-line.is-subtotal { margin: 0 -10px 4px; padding: 10px; border: 0; border-radius: 10px; background: var(--lt-brand-50); }
.tp-line.is-subtotal .tp-line__label { color: var(--lt-ink); font-weight: 600; }

.tp-remarks { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }

/* ---- 分享與匯出 ---- */
.tp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid var(--lt-line);
  border-radius: 18px;
  background: var(--lt-surface-2);
}
.tp-actions__primary, .tp-actions__export { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tp-actions__label { margin-right: 4px; color: var(--lt-ink-4); font-size: .8125rem; font-weight: 600; }
html body .tp-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--lt-line-2);
  border-radius: 999px;
  background: #fff;
  color: var(--lt-ink-2);
  font-size: .875rem;
  box-shadow: none;
}
html body .tp-actions .btn:hover { border-color: var(--lt-brand-300); background: var(--lt-brand-50); color: var(--lt-brand-800); }
html body .tp-actions #share-button { border-color: var(--lt-brand-600); background: var(--lt-brand-600); color: #fff; }
html body .tp-actions #share-button:hover { border-color: var(--lt-brand-700); background: var(--lt-brand-700); color: #fff; }
html body .tp-actions .btn-icon { justify-content: center; width: 40px; height: 40px; padding: 0; }
/* 部分頁面有 #resetButton 的 id 規則，這裡以同等權重維持一致外觀 */
html body .tp-actions #resetButton { padding: 0; border: 1px solid var(--lt-line-2); background: #fff; }

/* ---- 說明區 ---- */
.tp-info {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 40px;
  margin-top: 40px;
}
.tp-callout {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border: 1px solid var(--lt-brand-200);
  border-radius: 16px;
  background: var(--lt-brand-50);
  color: var(--lt-ink);
}
.tp-callout .bi { color: var(--lt-brand-600); font-size: 1.25rem; line-height: 1.5; }
.tp-callout p { margin: 0; font-weight: 600; line-height: 1.7; }
.tp-callout a { display: inline-block; margin-left: 4px; font-weight: 500; word-break: break-all; }
.tp-notice { padding: 16px 20px; border-left: 4px solid #d9850b; border-radius: 0 12px 12px 0; background: var(--lt-amber-50); }
.tp-notice p { margin: 0 0 6px; color: var(--lt-ink); line-height: 1.75; }
.tp-notice p:last-child { margin: 0; }
.tp-notes { margin: 16px 0 0; padding-left: 1.4em; color: var(--lt-ink-2); }
.tp-notes li { margin-bottom: 8px; line-height: 1.75; }
.tp-notes p { margin: 0 0 4px; }

.tp-faq { display: grid; gap: 10px; }
.tp-faq__item { border: 1px solid var(--lt-line); border-radius: 14px; background: #fff; transition: border-color var(--lt-dur-2), box-shadow var(--lt-dur-2); }
.tp-faq__item[open] { border-color: var(--lt-brand-200); box-shadow: var(--lt-shadow-1); }
.tp-faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  color: var(--lt-ink);
  font-weight: 700;
  list-style: none;
}
.tp-faq__item summary::-webkit-details-marker { display: none; }
.tp-faq__item summary .bi {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lt-brand-50);
  color: var(--lt-brand-700);
  transition: transform var(--lt-dur-2) var(--lt-ease), background-color var(--lt-dur-2);
}
.tp-faq__item[open] summary .bi { transform: rotate(45deg); background: var(--lt-brand-600); color: #fff; }
.tp-faq__item p { margin: 0; padding: 0 18px 16px; color: var(--lt-ink-3); line-height: 1.8; }

.tp-info__side { display: grid; gap: 16px; align-content: start; }
.tp-side-card { padding: 20px; border: 1px solid var(--lt-line); border-radius: 18px; background: #fff; }
html body .tp-side-card h3 { margin: 0 0 12px; color: var(--lt-ink-4); font-size: .75rem; font-weight: 700; letter-spacing: .12em; }
.tp-side-card ul { margin: 0; padding: 0; list-style: none; }
.tp-related li + li, .tp-links li + li { border-top: 1px solid var(--lt-line); }
html body main .tp-related li a, html body main .tp-links li a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; color: var(--lt-ink); font-weight: 600; text-decoration: none; }
html body main .tp-related li a:hover, html body main .tp-links li a:hover { color: var(--lt-brand-700); }
.tp-related li { padding-bottom: 2px; }
.tp-related span { display: block; margin: -6px 0 10px; color: var(--lt-ink-4); font-size: .8125rem; line-height: 1.6; }
.tp-links .bi { flex: none; color: var(--lt-ink-4); font-size: .8rem; }
.tp-log li { position: relative; padding: 0 0 14px 18px; }
.tp-log li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--lt-brand-400); }
.tp-log li::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 1px; background: var(--lt-line); }
.tp-log li:last-child::after { display: none; }
.tp-log__ver { margin-right: 8px; color: var(--lt-brand-700); font: 700 .8125rem var(--lt-font-num); }
.tp-log time { color: var(--lt-ink-4); font-size: .8125rem; }
.tp-log p { margin: 2px 0 0; color: var(--lt-ink-2); font-size: .875rem; line-height: 1.6; }

/* ---- 手機：實領金額固定列 ---- */
.tp-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 1020;
  transform: translateY(160%);
  transition: transform var(--lt-dur-2) var(--lt-ease);
}
.tp-dock.is-visible { transform: none; }
.tp-dock__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--lt-ink);
  color: #fff;
  box-shadow: 0 16px 40px -12px rgba(15, 19, 48, .6);
}
.tp-dock__label { color: #c9cce0; font-size: .8125rem; }
.tp-dock__amount { margin-right: auto; font: 800 1.25rem/1 var(--lt-font-num); font-variant-numeric: tabular-nums; }
html body .tp-dock__link { color: #c8c6ff; font-size: .875rem; font-weight: 600; white-space: nowrap; }
html body .tp-dock__link:hover { color: #fff; }

/* ---- RWD ---- */
@media screen and (max-width: 991.98px) {
  .tp-info { grid-template-columns: 1fr; gap: 32px; }
}
@media screen and (max-width: 767.98px) {
  .tp-group { padding: 16px 16px 6px; border-radius: 16px; }
  .tp-hero { grid-template-columns: 1fr; border-radius: 18px; }
  .tp-hero__main, .tp-hero__side { padding: 20px 22px; }
  .tp-hero__side { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08); }
  .tp-cards { grid-template-columns: 1fr; }
  /* 窄欄位（年度、月份、時數、級距…）手機上兩欄並排，縮短頁面 */
  .tp-group .row { align-items: flex-end; }
  .tp-group .row > .col-md-2 { flex: 0 0 50%; max-width: 50%; }
  .tp-group .form-label { font-size: .8125rem; }
  .tp-meta { width: 100%; }
  .tp-meta__item { flex: 1; min-width: 0; }
  .tp-actions { flex-direction: column; align-items: stretch; }
  .tp-actions__primary { justify-content: space-between; }
  html body .tp-actions .btn { justify-content: center; }
  .tp-actions__export { display: grid; grid-template-columns: 1fr 1fr; }
  .tp-actions__label { grid-column: 1 / -1; }
}
@media (min-width: 768px) {
  .tp-dock { display: none !important; }
}

@media print {
  .tp-dock, .tp-actions { display: none !important; }
  /* 部分頁面的列印樣式給 .container 左右各 80px 內距（原本與截圖區的 -80px 負邊距抵銷），改版後需收回 */
  html body .tp-page > .container { padding-left: 12px !important; padding-right: 12px !important; }
  .tp-group, .tp-card, .tp-side-card { box-shadow: none; }
}

/* ==========================================================================
   結果附表（insurance 起使用）：面板、唯讀級距表、比例條、提示
   ========================================================================== */
.tp-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.tp-panel { padding: 18px 22px 12px; border: 1px solid var(--lt-line); border-radius: 18px; background: #fff; }
html body .tp-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--lt-ink-2);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .08em;
}
.tp-panel__title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lt-brand-500, #7675ff); }
.tp-panel__desc { margin: 0 0 8px; color: var(--lt-ink-4); font-size: .8125rem; line-height: 1.6; }

/* 唯讀級距表：disabled select 以純數值呈現 */
.tp-table { width: 100%; margin: 0; border-collapse: collapse; }
.tp-table th, .tp-table td { padding: 9px 6px; border-bottom: 1px dashed var(--lt-line); vertical-align: middle; }
.tp-table th:first-child { padding-left: 0; }
.tp-table th:last-child, .tp-table td:last-child { padding-right: 0; text-align: right; }
.tp-table thead th {
  padding-top: 4px;
  border-bottom: 1px solid var(--lt-line);
  color: var(--lt-ink-4);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
}
.tp-table tbody tr:last-child > * { border-bottom: 0; }
.tp-table tbody th { color: var(--lt-ink-2); font-size: .9375rem; font-weight: 600; white-space: nowrap; }
html body .tp-table tbody th label { margin: 0; color: inherit; font-weight: inherit; }
html body .tp-table .form-select:disabled {
  display: inline-block;
  width: auto;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none !important;
  box-shadow: none;
  color: var(--lt-ink);
  font: 700 .9375rem/1.4 var(--lt-font-num);
  font-variant-numeric: tabular-nums;
  opacity: 1;
  cursor: default;
  -webkit-appearance: none;
  appearance: none;
}
html body .tp-table .tp-status .form-select:disabled {
  padding: 3px 10px;
  border-radius: 999px;
  background: #e3f6ef !important;
  color: #0b6e58;
  font-family: inherit;
  font-size: .8125rem;
  font-weight: 600;
}
/* 未投保的列淡化（不支援 :has 的瀏覽器維持原樣） */
html body .tp-table tr:has(.tp-status option:checked[value^="不"]) .tp-status .form-select:disabled {
  background: var(--lt-line) !important;
  color: var(--lt-ink-4);
}
html body .tp-table tr:has(.tp-status option:checked[value^="不"]) th,
html body .tp-table tr:has(.tp-status option:checked[value^="不"]) td:last-child .form-select:disabled { color: var(--lt-ink-4); }

/* 比例條 */
.tp-share { display: grid; gap: 4px; }
.tp-share__row { padding: 10px 0 12px; border-bottom: 1px dashed var(--lt-line); }
.tp-share__row:last-child { border-bottom: 0; }
.tp-share__name { display: block; margin-bottom: 8px; color: var(--lt-ink-2); font-size: .9375rem; font-weight: 600; }
.tp-share__bar {
  display: flex;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--lt-line);
}
.tp-share__bar > span { display: block; width: 0; height: 100%; }
.tp-share__bar > span + span { border-left: 2px solid #fff; }
.tp-share .is-employer { background: #5a55f0; }
.tp-share .is-employee { background: #e04b6a; }
.tp-share .is-gov { background: #14a585; }
.tp-share__legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 0; }
.tp-share__legend > div { min-width: 0; }
.tp-share__legend dt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--lt-ink-4);
  font-size: .75rem;
  font-weight: 600;
}
.tp-share__legend dt i { flex: none; width: 8px; height: 8px; border-radius: 2px; }
html body .tp-share__legend dd {
  margin: 2px 0 0;
  color: var(--lt-ink);
  font: 700 1rem/1.3 var(--lt-font-num);
  font-variant-numeric: tabular-nums;
}

/* 結果下方提示 */
html body .tp-note {
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--lt-amber-50);
  color: var(--lt-ink-2);
  font-size: .9375rem;
  line-height: 1.7;
}
.tp-note .bi { margin-right: 6px; color: #d9850b; }

/* 窄欄位手機上兩欄並排（col-md-2 以外的欄位可加 .tp-col-half） */
@media screen and (max-width: 767.98px) {
  .tp-group .row > .tp-col-half { flex: 0 0 50%; max-width: 50%; }
  .tp-detail { grid-template-columns: 1fr; }
  .tp-panel { padding: 16px 18px 10px; }
}
@media screen and (max-width: 991.98px) and (min-width: 768px) {
  .tp-detail { grid-template-columns: 1fr; }
}
@media print {
  .tp-panel { box-shadow: none; }
}

/* ==========================================================================
   多步驟輸入頁（severance 起使用）
   ========================================================================== */
/* 頁面原本以 .hidden 切換顯示；tp- 元件的 display 規則不可蓋過它 */
html body .tp-page .hidden:not(.legend-item) { display: none !important; }

.tp-scope {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 44em;
  margin: 16px auto 0;
  padding: 10px 16px;
  border: 1px solid var(--lt-brand-200);
  border-radius: 12px;
  background: var(--lt-brand-50);
  color: var(--lt-ink-2);
  font-size: .9375rem;
  line-height: 1.6;
  text-align: left;
}
.tp-scope .bi { color: var(--lt-brand-600); }

/* 唯讀期間摘要 */
.tp-period { padding: 14px 18px; border: 1px solid var(--lt-line); border-radius: 14px; background: var(--lt-surface-2); }
.tp-period__title { margin-bottom: 8px; color: var(--lt-ink-4); font-size: .75rem; font-weight: 700; letter-spacing: .08em; }
html body .tp-period .value { color: var(--lt-ink-3); font-weight: 600; }
html body .tp-period .period-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
html body .tp-period .period-item { flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: 0; }
html body .tp-period .period-label { color: var(--lt-ink-4); font-size: .8125rem; font-weight: 500; }
html body .tp-period .period-value { color: var(--lt-ink); font: 700 1rem/1.4 var(--lt-font-num); font-variant-numeric: tabular-nums; }

/* 二選一卡片（radio） */
.tp-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
html body .tp-choice__item {
  position: relative;
  min-height: 0;
  margin: 0;
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--lt-line-2);
  border-radius: 14px;
  background: #fff;
  transition: border-color var(--lt-dur-1), background-color var(--lt-dur-1), box-shadow var(--lt-dur-1);
}
html body .tp-choice__item .form-check-input { position: absolute; left: 16px; top: 17px; margin: 0; }
html body .tp-choice__item .form-check-label { color: var(--lt-ink); cursor: pointer; }
html body .tp-choice__item .form-check-label::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tp-choice__item .form-text { margin-top: 2px; }
.tp-choice__item:has(.form-check-input:checked) { border-color: var(--lt-brand-500); background: var(--lt-brand-50); box-shadow: 0 0 0 3px rgba(90, 85, 240, .12); }

/* 輸入表格與工具列 */
.tp-table-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
html body .tp-page .btn.tp-btn-primary,
html body .tp-page .btn.tp-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 600;
  box-shadow: none;
}
html body .tp-page .btn.tp-btn-primary { border: 1px solid var(--lt-brand-600); background: var(--lt-brand-600); color: #fff; }
html body .tp-page .btn.tp-btn-primary:hover { border-color: var(--lt-brand-700); background: var(--lt-brand-700); color: #fff; }
html body .tp-page .btn.tp-btn-ghost { border: 1px solid var(--lt-line-2); background: #fff; color: var(--lt-ink-3); }
html body .tp-page .btn.tp-btn-ghost:hover { border-color: #e04b6a; background: #fff5f7; color: #a42945; }

.tp-input-table { overflow-x: auto; border: 1px solid var(--lt-line); border-radius: 14px; }
html body .tp-input-table .table { margin: 0; }
html body .tp-input-table th,
html body .tp-input-table td { padding: 10px 14px; border-color: var(--lt-line); vertical-align: middle; white-space: nowrap; }
html body .tp-input-table thead th { background: var(--lt-surface-2); color: var(--lt-ink-4); font-size: .75rem; font-weight: 600; letter-spacing: .04em; }
html body .tp-input-table tbody tr:last-child > * { border-bottom: 0; }
html body .tp-input-table tbody td { color: var(--lt-ink-2); font-variant-numeric: tabular-nums; }
html body .tp-input-table .form-control { min-width: 120px; padding: 7px 10px; box-shadow: none; }
html body .tp-input-table .btn-outline-primary { border-radius: 999px; padding: 3px 10px; font-size: .8125rem; }

/* 結果：計算式 */
html body .tp-hero__detail.calculation-detail {
  margin: 10px 0 0;
  padding: 0;
  background: none;
  color: rgba(255, 255, 255, .78);
  font-size: .8125rem;
  line-height: 1.6;
}
.tp-line.has-detail { flex-wrap: wrap; }
html body .tp-line__detail.calculation-detail {
  flex: 0 0 100%;
  margin: 2px 0 0;
  padding: 0;
  background: none;
  color: var(--lt-ink-4);
  font-size: .8125rem;
  line-height: 1.6;
}
html body .tp-line__detail.calculation-detail:empty { display: none; }
html body .tp-line__detail.tp-note { flex: 0 0 100%; margin-top: 8px; }

/* 警示提示 */
html body .tp-note.is-warning { border-left: 3px solid #d9850b; border-radius: 0 12px 12px 0; }
html body .tp-note__title { margin: 0 0 6px; color: var(--lt-ink); font-size: .9375rem; font-weight: 700; }
html body .tp-result .tp-note { margin-bottom: 16px; }
html body .tp-group .tp-note { margin: 0 0 12px; }

.tp-actions__hint { margin: 0; color: var(--lt-ink-4); font-size: .8125rem; }
.tp-actions__hint .bi { margin-right: 4px; }
html body .tp-actions .btn-calculate { padding: 8px 18px; border: 1px solid var(--lt-brand-600); background: var(--lt-brand-600); color: #fff; font-weight: 600; transform: none; }
html body .tp-actions .btn-calculate:hover { border-color: var(--lt-brand-700); background: var(--lt-brand-700); color: #fff; box-shadow: none; transform: none; }

.tp-faq__body { padding: 0 18px 16px; color: var(--lt-ink-3); line-height: 1.8; }
html body .tp-faq__body p { padding: 0; margin: 0 0 6px; }
.tp-faq__body ul { margin: 0; padding-left: 1.2em; }

@media screen and (max-width: 767.98px) {
  html body .tp-period .period-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 輸入表格：手機上每列改為小卡，金額欄不需橫向捲動 */
  html body .tp-input-table { overflow: visible; }
  html body .tp-input-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html body .tp-input-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--lt-line); }
  html body .tp-input-table tbody tr:last-child { border-bottom: 0; }
  html body .tp-input-table tbody td { display: block; padding: 0; border: 0; white-space: normal; background: none; }
  html body .tp-input-table tbody td:nth-child(1) { color: var(--lt-ink); font-weight: 600; }
  html body .tp-input-table tbody td:nth-child(2) { color: var(--lt-ink-4); text-align: right; }
  html body .tp-input-table tbody td:nth-child(3)::before,
  html body .tp-input-table tbody td:nth-child(4)::before { display: block; margin-bottom: 4px; color: var(--lt-ink-4); font-size: .75rem; font-weight: 600; }
  html body .tp-input-table tbody td:nth-child(3)::before { content: "工資金額"; }
  html body .tp-input-table tbody td:nth-child(4)::before { content: "實際工作日數"; }
  html body .tp-input-table tbody td:nth-child(5) { grid-column: 1 / -1; text-align: left !important; }
  html body .tp-input-table tbody td:nth-child(5):not(:has(button)) { display: none; }
  html body .tp-input-table .form-control.wage-input { width: 100%; min-width: 0; max-width: none; }
  .tp-choice { grid-template-columns: 1fr; }
  .tp-scope { font-size: .875rem; }
}

/* ==========================================================================
   主卡變化（vat-invoice 起使用）
   ========================================================================== */
.tp-hero__chinese { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .18); }
html body .tp-hero__chinese .value { margin-top: 4px; color: #fff; font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; line-height: 1.5; word-break: break-all; }
.tp-hero__side--split { display: grid; align-content: center; gap: 20px; }
/* 中文大寫數字由腳本產生並帶 inline 顏色，在深色主卡上改為亮色 */
html body .tp-hero__chinese .value span { color: #c8c6ff !important; }

.tp-taxid .input-group-text { justify-content: center; width: 44px; background: #fff; }

/* 列印：瀏覽器預設不印背景，深色主卡改為白底深字 */
@media print {
  html body .tp-hero { border: 1px solid #c9cce0; background: #fff !important; color: #0f1330; }
  html body .tp-hero__main { background: none !important; }
  html body .tp-hero__side { border-left: 1px solid #c9cce0; }
  html body .tp-hero__label, html body .tp-hero__currency { color: #4b5070 !important; }
  html body .tp-hero__amount .value, html body .tp-hero__chinese .value { color: #0f1330 !important; }
  html body .tp-hero__chinese .value span { color: #3a33ab !important; }
  .tp-hero__chinese { border-top-color: #c9cce0; }
  .tp-group { box-shadow: none; }
}

/* ==========================================================================
   扣繳類頁面（outsourcing、rent、pro 起使用）
   ========================================================================== */
/* 結果組：頁面腳本以 display flex/none 切換，flex 時維持直向堆疊 */
.tp-result-set { display: flex; flex-direction: column; }
.tp-result-set > .tp-cards { margin-top: 0; }
/* 只有一張明細卡時佔滿整列 */
.tp-cards > :only-child { grid-column: 1 / -1; }
/* 說明區小標 */
html body .tp-subhead { margin: 16px 0 4px; color: var(--lt-ink); font-size: .9375rem; line-height: 1.7; }
html body .tp-subhead:first-of-type { margin-top: 0; }
/* 長內容收合（如業別代號表） */
.tp-codes { margin-top: 20px; }
html body .tp-codes p { font-size: .875rem; }

/* 橋接層只作用於螢幕；列印維持各頁原本的列印樣式 */
@media screen {
/* ==========================================================================
   橋接層 .tp-bridge：讓尚未逐一重排的舊版元件（.data-display、.step-card、
   表格、提示框）套用 tool-page 視覺。只改外觀，不改結構與顯示切換。
   ========================================================================== */
/* 步驟卡 → 與 .tp-group 相同 */
html body .tp-bridge .step-card {
  margin: 0 0 16px;
  padding: 20px 24px 12px;
  border: 1px solid var(--lt-line);
  border-left: 1px solid var(--lt-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--lt-shadow-1);
}
html body .tp-bridge .step-title {
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 16px;
  color: var(--lt-ink);
  font-size: 1rem;
  font-weight: 700;
}
html body .tp-bridge .step-number {
  width: 28px;
  height: 28px;
  margin: 0;
  background: linear-gradient(135deg, #5a55f0, #7675ff);
  font: 700 .8125rem/1 var(--lt-font-num);
}
html body .tp-bridge .step-card h5,
html body .tp-bridge .step-card h6 { color: var(--lt-ink) !important; font-size: .9375rem; font-weight: 700; }
html body .tp-bridge .step-card h5 .bi { color: var(--lt-brand-600); }

/* 結果方塊 */
html body .tp-bridge .data-display {
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--lt-line) !important;
  border-radius: 14px;
  background: #fff !important;
  box-shadow: none;
  color: var(--lt-ink) !important;
}
html body .tp-bridge .data-display .title {
  margin: 0 0 6px;
  color: var(--lt-ink-4) !important;
  font-size: .8125rem !important;
  font-weight: 600;
  letter-spacing: .02em;
}
html body .tp-bridge .data-display .value {
  padding: 0;
  border-radius: 0;
  background: none !important;
  color: var(--lt-ink);
  font: 700 1.125rem/1.35 var(--lt-font-num);
  font-variant-numeric: tabular-nums;
}
/* 舊版以 inline 漸層標示的「主要結果」→ 品牌深色主卡 */
html body .tp-bridge .data-display[style*="gradient"] {
  border: 0 !important;
  background: linear-gradient(120deg, #3a33ab 0%, #5a55f0 60%, #3f8fe0 100%) !important;
  color: #fff !important;
}
html body .tp-bridge .data-display[style*="gradient"] .title { color: rgba(255, 255, 255, .82) !important; }
html body .tp-bridge .data-display[style*="gradient"] .value {
  color: #fff !important;
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem) !important;
  font-weight: 800;
  letter-spacing: 0;
}
html body .tp-bridge .data-display[style*="gradient"] .calculation-detail { color: rgba(255, 255, 255, .8) !important; }
html body .tp-bridge .calculation-detail { margin-top: 6px; padding: 0; background: none; color: var(--lt-ink-4); font-size: .8125rem; line-height: 1.6; }

/* 表格 */
html body .tp-bridge .wage-table,
html body .tp-bridge .table-responsive { border: 1px solid var(--lt-line); border-radius: 14px; }
html body .tp-bridge .table { margin: 0; }
html body .tp-bridge .table > :not(caption) > * > * { padding: 10px 12px; border-color: var(--lt-line); vertical-align: middle; }
html body .tp-bridge .table thead th { background: var(--lt-surface-2); color: var(--lt-ink-4); font-size: .75rem; font-weight: 600; letter-spacing: .04em; }
html body .tp-bridge .table-bordered > :not(caption) > * > * { border-width: 0 0 1px; }

/* 提示框 */
html body .tp-bridge .warning-box,
html body .tp-bridge .info-box,
html body .tp-bridge .calculation-info {
  padding: 12px 16px;
  border: 0;
  border-left: 3px solid #d9850b;
  border-radius: 0 12px 12px 0;
  background: var(--lt-amber-50);
  color: var(--lt-ink-2);
}
html body .tp-bridge .info-box,
html body .tp-bridge .calculation-info { border-left-color: var(--lt-brand-500); background: var(--lt-brand-50); }
html body .tp-bridge .alert { border-radius: 12px; }

/* 主要按鈕 */
html body .tp-bridge .btn-calculate,
html body .tp-bridge .btn-primary:not(.modal .btn) {
  border: 1px solid var(--lt-brand-600) !important;
  border-radius: 999px;
  background: var(--lt-brand-600) !important;
  box-shadow: none !important;
  color: #fff;
}
html body .tp-bridge .btn-calculate:hover,
html body .tp-bridge .btn-primary:not(.modal .btn):hover { border-color: var(--lt-brand-700) !important; background: var(--lt-brand-700) !important; transform: none; }
html body .tp-bridge .form-label { color: var(--lt-ink-2); font-weight: 600; }

/* 橋接層：說明區的舊版標題、提示段落與分隔線 */
html body .tp-bridge h5:not(.modal-title):not(.card-title) {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 12px;
  color: var(--lt-ink) !important;
  font-size: 1.125rem;
  font-weight: 800;
}
html body .tp-bridge h5:not(.modal-title):not(.card-title)::before {
  content: "";
  flex: none;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, #5a55f0, #3fb6e8);
}
html body .tp-bridge .step-card h5::before,
html body .tp-bridge .card h5::before,
html body .tp-bridge .modal h5::before { display: none; }
html body .tp-bridge .step-card h5,
html body .tp-bridge .card h5 { margin: 16px 0 10px; font-size: .9375rem; }
html body .tp-bridge p:empty { display: none; }
html body .tp-bridge hr { margin: 24px 0; border-color: var(--lt-line); opacity: 1; }
html body .tp-bridge p[style*="FFFAE6"],
html body .tp-bridge p[style*="fffae6"] {
  padding: 14px 18px !important;
  border: 1px solid var(--lt-brand-200);
  border-radius: 14px !important;
  background: var(--lt-brand-50) !important;
  color: var(--lt-ink);
  font-size: 1rem !important;
  text-align: left !important;
}
html body .tp-bridge p[style*="FFFAE6"] a,
html body .tp-bridge p[style*="fffae6"] a { color: var(--lt-brand-700) !important; word-break: break-all; }
html body .tp-bridge ol,
html body .tp-bridge ul:not(.dropdown-menu):not(.nav) { color: var(--lt-ink-2); line-height: 1.8; }
/* Bootstrap 卡片 */
html body .tp-bridge .card { border: 1px solid var(--lt-line); border-radius: 18px; box-shadow: none; }
html body .tp-bridge .card-header { border-bottom: 1px solid var(--lt-line); border-radius: 18px 18px 0 0; background: var(--lt-surface-2); }
/* 手風琴（FAQ） */
html body .tp-bridge .accordion-item { overflow: hidden; margin-bottom: 10px; border: 1px solid var(--lt-line); border-radius: 14px !important; }
html body .tp-bridge .accordion-button { color: var(--lt-ink); font-weight: 700; }
html body .tp-bridge .accordion-button:not(.collapsed) { background: var(--lt-brand-50); color: var(--lt-brand-800); box-shadow: none; }
}
