/* ==========================================================================
   HR-Rule AI 工作規則規劃訪談問卷 2.0 (index2.css)
   專屬品牌色彩系統 ＋ 80/20 動態模組化架構
   ========================================================================== */

:root {
  --navy: #1B3F78;
  --navy-dark: #0F2549;
  --navy-deep: #081A38;
  --teal: #5BB39A;
  --teal-dark: #438f7a;
  --leaf: #8FC859;
  --sky: #3B8BC7;
  --amber: #F4A623;
  --amber-dark: #D48812;
  --danger-red: #C0492F;
  --danger-bg: #FDF1ED;

  /* 溫潤紙張米底色與卡片 */
  --bg: #FAF8F2;
  --bg-subtle: #F3F0E6;
  --card: #FFFFFF;
  --ink: #1E293B;
  --ink-secondary: #475569;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;

  --ok-bg: #EBF7F3;
  --ok-text: #166534;
  --warn-bg: #FEF7EA;
  --warn-text: #92400E;
  --err-bg: #FDF1ED;
  --err-text: #991B1B;

  /* 品牌代表漸層 */
  --grad-hero: linear-gradient(135deg, #081A38 0%, #0F2549 50%, #1B3F78 100%);
  --grad-kyle: linear-gradient(135deg, #8FC859 0%, #5BB39A 45%, #3B8BC7 100%);
  --grad-gold: linear-gradient(135deg, #F4A623 0%, #D48812 100%);

  /* 圓角與陰影 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-card: 16px;
  --radius-pill: 999px;
  --shadow-soft: 0 4px 20px rgba(15, 37, 73, 0.07);
  --shadow-float: 0 10px 30px rgba(15, 37, 73, 0.12);
  --shadow-hover: 0 6px 24px rgba(27, 63, 120, 0.15);
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* 頂部通用導航列 */
.topbar {
  background: var(--grad-hero);
  color: #fff;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 18px rgba(8, 26, 56, 0.25);
  position: relative;
  overflow: hidden;
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.topbar-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-family: "Noto Serif TC", Georgia, serif;
  font-weight: 700;
  letter-spacing: .03em;
  color: #FFFFFF;
}
.topbar-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #CBD5E1;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sync-badge {
  font-size: 0.82rem;
  font-family: "JetBrains Mono", monospace;
  background: rgba(255, 255, 255, 0.12);
  color: #EBF7F3;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.topbar-link {
  color: #FFFFFF;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}
.topbar-link:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}
.topbar-link.special {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  border-color: #a78bfa;
}

/* ==========================================================================
   首頁 Landing 模式選擇與步驟卡片
   ========================================================================== */
.landing-wrap {
  max-width: 820px;
  margin: 2rem auto 4rem;
  padding: 0 1.25rem;
}
.landing-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-float);
  position: relative;
}
.landing-card::before {
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 4px;
  background: var(--grad-kyle);
  border-radius: 99px;
}
.landing-hero {
  text-align: center;
  margin-bottom: 2.2rem;
}
.landing-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--teal-dark);
  background: var(--ok-bg);
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.65rem;
  letter-spacing: .04em;
}
.landing-hero h2 {
  font-size: 1.8rem;
  font-family: "Noto Serif TC", Georgia, serif;
  color: var(--navy-dark);
  margin: 0.2rem 0 0.5rem;
  font-weight: 700;
}
.landing-hero p {
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0;
  line-height: 1.55;
}

/* 步驟方塊 */
.step-block {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1.35rem 1.45rem;
  margin-bottom: 1.75rem;
}
.step-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.95rem;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  flex-shrink: 0;
}
.step-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-dark);
}
.step-subtext {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: normal;
}

/* 統編輸入行 */
.tax-input-wrap {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.tax-input-wrap input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  font-size: 1.15rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  letter-spacing: 0.1em;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #FFF;
  color: var(--navy-dark);
  transition: all 0.2s ease;
}
.tax-input-wrap input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 63, 120, 0.15);
}
.btn-autofill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #0F2549 0%, #1B3F78 100%);
  color: #FFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 37, 73, 0.18);
  transition: all 0.2s ease;
}
.btn-autofill:hover {
  background: linear-gradient(135deg, #1B3F78 0%, #3B8BC7 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 37, 73, 0.25);
}
.autofill-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.tip-tag {
  background: #E0E7FF;
  color: #3730A3;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.input-error {
  color: var(--danger-red);
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0.5rem 0 0;
}
.latest-record-note {
  color: var(--teal-dark);
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0.5rem 0 0;
}

/* 行業別選擇卡片 (6大行業) */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.industry-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: #FFF;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
}
.industry-card:hover {
  border-color: var(--teal);
  background: #FAF8F2;
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.industry-card.selected {
  border-color: var(--navy);
  background: #F0F4FA;
  box-shadow: 0 0 0 2px rgba(27, 63, 120, 0.2);
}
.industry-card .ind-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.industry-card .ind-info {
  flex: 1;
  min-width: 0;
}
.industry-card .ind-title {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--navy-dark);
}
.industry-card .ind-desc {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.industry-card .ind-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.industry-card.selected .ind-check {
  background: var(--navy);
  border-color: var(--navy);
  color: #FFF;
}

/* 模式選擇卡片 (自動分類兩種模式) */
.mode-list {
  display: grid;
  gap: 0.85rem;
}
.mode-card {
  display: flex;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: #FFF;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.mode-card:hover {
  border-color: var(--teal);
  background: #FAF8F2;
  transform: translateY(-1px);
}
.mode-card.selected {
  border-color: var(--navy);
  background: #F0F4FA;
  box-shadow: 0 0 0 2px rgba(27, 63, 120, 0.2);
}
.mode-radio {
  display: flex;
  align-items: flex-start;
  padding-top: 0.2rem;
}
.radio-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transition: all 0.2s ease;
}
.mode-card.selected .radio-circle {
  border-color: var(--navy);
}
.mode-card.selected .radio-dot {
  background: var(--navy);
}
.mode-content {
  flex: 1;
}
.mode-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.mode-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--navy-dark);
}
.mode-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
}
.mode-tag.tag-all { background: #FEF3C7; color: #92400E; }
.mode-tag.tag-core { background: #E0E7FF; color: #3730A3; }
.mode-tag.tag-industry { background: #DCFCE7; color: #166534; }
.mode-desc {
  font-size: 0.88rem;
  color: var(--ink-secondary);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}
.mode-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  background: #E2E8F0;
  color: #334155;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
}

/* 底部開始填寫按鈕列 */
.landing-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.btn-start-primary {
  flex: 1;
  min-width: 240px;
  padding: 0.95rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFF;
  background: linear-gradient(135deg, #1B3F78 0%, #3B8BC7 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(27, 63, 120, 0.25);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-start-primary:hover {
  background: linear-gradient(135deg, #0F2549 0%, #1B3F78 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(27, 63, 120, 0.35);
}
.btn-import-secondary {
  padding: 0.95rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  background: #FFF;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-import-secondary:hover {
  border-color: var(--navy);
  background: #FAF8F2;
}

/* ==========================================================================
   問卷工作台主佈局 (側邊欄 + 主表單區)
   ========================================================================== */
.workspace-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 1240px;
  margin: 1.5rem auto 4rem;
  padding: 0 1.25rem;
  align-items: start;
}

/* 側邊欄 Aside */
.side-panel {
  position: sticky;
  top: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 1.35rem 1.2rem;
  box-shadow: var(--shadow-soft);
}
.side-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 3px;
  background: var(--grad-kyle);
  border-radius: 99px;
}
.side-company-header {
  margin-bottom: 1rem;
}
.side-tax {
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--navy);
}
.side-company-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 0.2rem 0 0;
  line-height: 1.35;
}
.side-ind-tag {
  display: inline-block;
  font-size: 0.78rem;
  background: #EFF6FF;
  color: #1D4ED8;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  margin-top: 0.35rem;
  font-weight: 600;
}

/* 進度條列 */
.progress-container {
  margin: 0.85rem 0;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.progress-bar-bg {
  height: 9px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-bar-fill {
  height: 100%;
  background: var(--grad-kyle);
  transition: width 0.35s ease;
}

/* 快捷完成按鈕 */
.btn-quick-fill {
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #B45309;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.2s ease;
}
.btn-quick-fill:hover {
  background: #FDE68A;
  border-color: #F59E0B;
}

/* 分類標籤切換器 */
.side-tab-row {
  display: flex;
  gap: 0.35rem;
  margin: 1.1rem 0 0.85rem;
  background: #F1F5F9;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}
.side-tab-btn {
  flex: 1;
  padding: 0.4rem 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.side-tab-btn.active {
  background: #FFF;
  color: var(--navy-dark);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* 側邊欄章節分組列表 */
.side-cat-group {
  margin-bottom: 1.15rem;
}
.side-cat-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 0.5rem;
}
.side-cat-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.side-cat-badge.core { background: #E0E7FF; color: #3730A3; }
.side-cat-badge.industry { background: #DCFCE7; color: #166534; }
.side-cat-count {
  font-size: 0.78rem;
  color: var(--muted);
}
.side-section-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}
.side-sec-btn {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FFF;
  color: var(--navy);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}
.side-sec-btn:hover {
  background: #FAF8F2;
  border-color: var(--teal);
  transform: translateX(2px);
}
.side-sec-btn.current {
  background: var(--navy);
  color: #FFF;
  border-color: var(--navy);
  box-shadow: 0 3px 10px rgba(27, 63, 120, 0.25);
}
.side-sec-btn.done {
  border-color: var(--teal);
}
.side-sec-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-missing-badge {
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  background: #FEE2E2;
  color: #991B1B;
  font-weight: 700;
  margin-left: 0.35rem;
}
.side-sec-btn.current .side-missing-badge {
  background: #EF4444;
  color: #FFF;
}
.btn-switch-company {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.2s ease;
}
.btn-switch-company:hover {
  background: #E2E8F0;
  color: var(--ink);
}

/* ==========================================================================
   主表單區 (Main Form Content)
   ========================================================================== */
.form-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-soft);
  position: relative;
}
.form-content::before {
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 4px;
  background: var(--grad-kyle);
  border-radius: 99px;
}

/* 章節分類徽章 (頂端標示) */
.chapter-type-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
}
.chapter-type-banner.core {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: #3730A3;
}
.chapter-type-banner.industry {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
}
.chapter-type-icon { font-size: 1.25rem; }
.chapter-type-title { font-weight: 700; font-size: 0.92rem; }
.chapter-type-desc { font-size: 0.82rem; opacity: 0.85; margin-left: auto; }

.chapter-title-header {
  margin-bottom: 1.5rem;
}
.chapter-title-header h2 {
  font-size: 1.65rem;
  font-family: "Noto Serif TC", Georgia, serif;
  color: var(--navy-dark);
  margin: 0 0 0.35rem;
}
.chapter-meta-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.chapter-intro-text {
  background: #F8FAFC;
  border-left: 3px solid var(--teal);
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  color: var(--ink-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 0.85rem;
}

/* 欄位表單樣式 */
.subsections-wrap {
  display: grid;
  gap: 2rem;
}
.subsection-block {
  border-top: 1.5px dashed var(--line);
  padding-top: 1.5rem;
}
.subsection-block:first-child {
  border-top: none;
  padding-top: 0;
}
.subsection-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 0 0 1rem;
}

.field-wrap {
  margin-bottom: 1.5rem;
  padding: 1.15rem 1.25rem;
  background: #FAFAF7;
  border: 1px solid #EBECE6;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}
.field-wrap:hover {
  background: #FFF;
  border-color: #D1D5DB;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.field-wrap.field-conditional {
  background: #F8FAFC;
  border-left: 3px solid var(--sky);
}
.field-label-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.field-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}
.req-star {
  color: var(--danger-red);
  font-weight: 700;
}
.field-help {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
  line-height: 1.5;
}

/* 輸入控制項 */
.field-wrap input[type="text"],
.field-wrap input[type="number"],
.field-wrap select,
.field-wrap textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #FFF;
  color: var(--ink);
  transition: all 0.2s ease;
}
.field-wrap input:focus,
.field-wrap select:focus,
.field-wrap textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 63, 120, 0.15);
}

/* 單選與複選選項清單 */
.options-grid {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.opt-label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  background: #FFF;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-size: 0.94rem;
}
.opt-label:hover {
  background: #FAF8F2;
  border-color: var(--teal);
}
.opt-label input[type="radio"],
.opt-label input[type="checkbox"] {
  margin-top: 0.25rem;
  cursor: pointer;
  accent-color: var(--navy);
  width: 17px;
  height: 17px;
}
.opt-text {
  flex: 1;
  line-height: 1.45;
}
.opt-note {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* 底部按鈕控制列 */
.form-actions-sticky {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 1rem 0 0.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  z-index: 10;
}
.btn-action-prev {
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  background: #FFF;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-action-prev:hover:not(:disabled) {
  border-color: var(--navy);
  background: #FAF8F2;
}
.btn-action-prev:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-action-submit {
  flex: 1;
  max-width: 320px;
  padding: 0.8rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFF;
  background: linear-gradient(135deg, #1B3F78 0%, #3B8BC7 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(27, 63, 120, 0.25);
  transition: all 0.2s ease;
}
.btn-action-submit:hover {
  background: linear-gradient(135deg, #0F2549 0%, #1B3F78 100%);
  transform: translateY(-1px);
}

.btn-action-next {
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-secondary);
  background: #F1F5F9;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-action-next:hover {
  background: #E2E8F0;
  color: var(--ink);
}

/* 提示橫幅 */
.banner-box {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.banner-box.ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid #86EFAC;
}
.banner-box.warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid #FDE68A;
}
.banner-box.err {
  background: var(--err-bg);
  color: var(--err-text);
  border: 1px solid #FCA5A5;
}

/* 全卷完成頁 */
.done-page-wrap {
  text-align: center;
  padding: 1.5rem 0.5rem;
}
.done-icon { font-size: 3.5rem; margin-bottom: 0.75rem; }
.done-title {
  font-size: 1.85rem;
  font-family: "Noto Serif TC", Georgia, serif;
  color: var(--navy-dark);
  margin: 0 0 0.5rem;
}
.done-sub {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 2rem;
}
.done-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  text-align: left;
  margin-bottom: 2rem;
}
.summary-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}
.summary-card-title {
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.done-actions-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* 響應式佈局調整 */
@media (max-width: 900px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
  .side-panel {
    position: static;
  }
  .landing-card {
    padding: 1.5rem 1.25rem;
  }
  .form-content {
    padding: 1.5rem 1.25rem;
  }
}

/* ==========================================================================
   公司商工登記與官網載入 Modal & 卡片樣式（防止未排版洩漏）
   ========================================================================== */
.autofill-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.autofill-modal-card {
  background: #FFFFFF;
  border-radius: 16px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  animation: modalPopIn 0.25s ease-out;
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.autofill-modal-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.header-icon-box {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-titles h3 {
  margin: 0.15rem 0 0.25rem;
  font-size: 1.25rem;
  color: #FFFFFF;
}

.header-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(245, 158, 11, 0.25);
  color: #FBBF24;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  display: inline-block;
  letter-spacing: 0.05em;
}

.header-sub {
  margin: 0;
  font-size: 0.82rem;
  color: #94A3B8;
}

.btn-close-modal {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: #94A3B8;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.btn-close-modal:hover { color: #FFFFFF; }

.autofill-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: #F8FAFC;
}

.autofill-card-block {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 1.15rem;
}

.block-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.block-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1B3F78;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.block-title {
  font-weight: 700;
  color: #0F172A;
  font-size: 0.96rem;
}

.verified-tag {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: #059669;
  background: #ECFDF5;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
}

.reg-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.reg-cell {
  background: #F8FAFC;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #F1F5F9;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.reg-cell.full-width {
  grid-column: span 2;
}

.cell-label {
  font-size: 0.76rem;
  color: #64748B;
}

.cell-val {
  font-weight: 600;
  color: #1E293B;
  word-break: break-all;
}
.cell-val.bold-navy {
  color: #1B3F78;
  font-size: 1.05rem;
}

.cell-val.monospace {
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.05em;
}

.autofill-modal-footer {
  padding: 1rem 1.5rem;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* 首頁載入完成後的精緻公司摘要卡片 */
.company-loaded-card {
  margin-top: 1rem;
  background: #F0FDF4;
  border: 1.5px solid #86EFAC;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: fadeIn 0.3s ease;
}

.company-loaded-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed #BBF7D0;
  padding-bottom: 0.5rem;
}

.company-loaded-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #166534;
}

.company-loaded-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.company-loaded-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: #374151;
}

.loaded-detail-item {
  display: flex;
  gap: 0.4rem;
}
.loaded-detail-item span.label {
  color: #6B7280;
  flex-shrink: 0;
}
.loaded-detail-item span.val {
  font-weight: 600;
  color: #1F2937;
}

.company-loaded-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.btn-handoff-quick {
  background: linear-gradient(135deg, #1B3F78 0%, #2563EB 100%);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-handoff-quick:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

/* ==========================================================================
   結構化問卷表格樣式 (例如 wage_table 薪資科目)
   ========================================================================== */
.qtable-wrap {
  margin-top: 0.6rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.qtable-custom {
  width: 100%;
  border-collapse: collapse;
  min-width: 580px;
}
.qtable-custom th {
  background: #F1F5F9;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid #CBD5E1;
}
.qtable-custom td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #E2E8F0;
  vertical-align: middle;
}
.qtable-custom tr:hover td {
  background: #F8FAFC;
}
.table-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.65rem;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--navy-dark);
  background: #FFFFFF;
}
.table-input:focus {
  border-color: var(--blue-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.table-select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.65rem;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--navy-dark);
  background: #FFFFFF;
  cursor: pointer;
}
.table-select:focus {
  border-color: var(--blue-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.btn-table-del {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s;
}
.btn-table-del:hover {
  color: #DC2626;
  background: #FEE2E2;
}
.btn-table-add {
  margin-top: 0.75rem;
  background: #F8FAFC;
  border: 1.5px dashed #94A3B8;
  color: var(--blue-primary);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s;
}
.btn-table-add:hover {
  background: #EFF6FF;
  border-color: var(--blue-primary);
  color: var(--navy);
}
