/* 設計語彙沿用對外版清單文件，讓客戶感覺是同一份文件的延伸。 */
:root{
  --ground:#F2F5F8; --surface:#FFFFFF; --surface-2:#E9EEF3; --line:#D6DEE7; --line-soft:#E4EAF0;
  --ink:#0D1B2C; --ink-2:#2B3F55; --muted:#5E7189;
  --teal:#0C6F79; --teal-soft:#DCEDEF; --teal-line:#8FC4C9;
  --burn:#B04E14; --burn-soft:#F7E6D9; --burn-line:#E0A578;
  --risk:#A8302A; --risk-soft:#F7E1DF;
  --ok:#256B4D; --ok-soft:#DCEDE4;
  --shadow:0 1px 2px rgba(13,27,44,.05), 0 8px 24px -16px rgba(13,27,44,.28);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --ground:#0A121C; --surface:#111C29; --surface-2:#182636; --line:#25374B; --line-soft:#1C2A3B;
    --ink:#E7EEF6; --ink-2:#BACBDC; --muted:#8298AF;
    --teal:#3FAEB6; --teal-soft:#0F2E33; --teal-line:#1F5F66;
    --burn:#E08A44; --burn-soft:#331E10; --burn-line:#6B4322;
    --risk:#E0736B; --risk-soft:#331A18;
    --ok:#5FBF92; --ok-soft:#12301F;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px -16px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"]{
  --ground:#0A121C; --surface:#111C29; --surface-2:#182636; --line:#25374B; --line-soft:#1C2A3B;
  --ink:#E7EEF6; --ink-2:#BACBDC; --muted:#8298AF;
  --teal:#3FAEB6; --teal-soft:#0F2E33; --teal-line:#1F5F66;
  --burn:#E08A44; --burn-soft:#331E10; --burn-line:#6B4322;
  --risk:#E0736B; --risk-soft:#331A18;
  --ok:#5FBF92; --ok-soft:#12301F;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px -16px rgba(0,0,0,.8);
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0; background:var(--ground); color:var(--ink);
  font-family:"Chivo","Noto Sans TC","Microsoft JhengHei",system-ui,sans-serif;
  line-height:1.75; font-size:16px; -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{margin:0; line-height:1.3; text-wrap:balance}
p{margin:0}
a{color:var(--teal)}
button{font:inherit; cursor:pointer}
.mono{font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,monospace}
.eyebrow{
  font-family:"IBM Plex Mono",ui-monospace,monospace; font-size:11px; font-weight:600;
  letter-spacing:.16em; text-transform:uppercase; color:var(--muted);
}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* 頁首 */
.mast{background:var(--surface); border-bottom:1px solid var(--line-soft); position:sticky; top:0; z-index:40}
.mast-in{max-width:1120px; margin:0 auto; padding:20px 24px 16px; display:flex; flex-direction:column; gap:14px}
.mast-top{display:flex; align-items:flex-start; justify-content:space-between; gap:20px; flex-wrap:wrap}
.mast h1{font-size:clamp(20px,3vw,28px); font-weight:900; letter-spacing:-.015em}
.mast .sub{color:var(--muted); font-size:14px}
.rule{height:3px; width:56px; background:var(--teal); border-radius:2px}

/* 進度 */
.stats{display:flex; gap:10px; flex-wrap:wrap}
.stat{background:var(--surface-2); border:1px solid var(--line); border-radius:8px; padding:8px 14px; min-width:112px}
.stat .k{font-size:11px; color:var(--muted); letter-spacing:.08em; text-transform:uppercase; font-weight:600}
.stat .v{font-size:20px; font-weight:800; font-family:"IBM Plex Mono",monospace; letter-spacing:-.02em}
.stat.p0 .v{color:var(--burn)}
.stat.done .v{color:var(--ok)}
.bar{height:4px; background:var(--line); border-radius:2px; overflow:hidden; margin-top:6px}
.bar i{display:block; height:100%; background:var(--teal); border-radius:2px; transition:width .35s ease}
.stat.p0 .bar i{background:var(--burn)}

/* 頁籤 */
.tabs{display:flex; gap:4px; overflow-x:auto; padding-bottom:2px; scrollbar-width:thin}
.tab{
  flex:0 0 auto; border:1px solid var(--line); border-bottom:none; background:var(--surface-2);
  color:var(--muted); padding:8px 14px; border-radius:8px 8px 0 0; font-size:13px; font-weight:600; white-space:nowrap;
}
.tab[aria-selected="true"]{background:var(--surface); color:var(--ink); box-shadow:inset 0 3px 0 var(--teal)}
.tab .dot{display:inline-block; width:6px; height:6px; border-radius:50%; background:var(--burn); margin-left:6px; vertical-align:middle}
.tab[data-complete="true"] .dot{background:var(--ok)}

/* 版面 */
.wrap{max-width:1120px; margin:0 auto; padding:26px 24px 120px}
.toolbar{
  display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:20px;
  padding:12px 16px; background:var(--surface); border:1px solid var(--line-soft); border-radius:10px;
}
.toolbar label{font-size:13px; color:var(--ink-2); display:flex; align-items:center; gap:6px; cursor:pointer}
.chips{display:flex; gap:4px}
.chip{
  border:1px solid var(--line); background:var(--surface-2); color:var(--muted);
  padding:4px 11px; border-radius:999px; font-size:12px; font-weight:700; font-family:"IBM Plex Mono",monospace;
}
.chip[aria-pressed="true"]{background:var(--teal); border-color:var(--teal); color:#fff}
.spacer{flex:1 1 auto}

.section-note{
  background:var(--teal-soft); border-left:3px solid var(--teal); border-radius:0 8px 8px 0;
  padding:11px 16px; font-size:13.5px; color:var(--ink-2); margin-bottom:18px;
}
.group-title{
  font-size:13px; font-weight:800; color:var(--teal); letter-spacing:.04em;
  margin:26px 0 10px; padding-bottom:6px; border-bottom:1px solid var(--line-soft);
}
.group-title:first-child{margin-top:0}

/* 基本資料 */
.profile{
  background:var(--surface); border:1px solid var(--teal-line); border-radius:10px;
  margin-bottom:20px; box-shadow:var(--shadow); overflow:hidden;
}
.profile[data-complete="true"]{border-color:var(--line-soft)}
.profile > summary{
  list-style:none; cursor:pointer; padding:13px 18px; display:flex; align-items:center;
  gap:12px; font-weight:800; font-size:15px; background:var(--teal-soft);
}
.profile[data-complete="true"] > summary{background:var(--surface-2)}
.profile > summary::-webkit-details-marker{display:none}
.profile > summary::after{content:'▾'; margin-left:auto; color:var(--muted); font-size:13px}
.profile[open] > summary::after{content:'▴'}
.profile-state{
  font-size:11.5px; font-weight:700; padding:2px 9px; border-radius:999px;
  background:var(--risk-soft); color:var(--risk);
}
.profile[data-complete="true"] .profile-state{background:var(--ok-soft); color:var(--ok)}
.profile-body{
  padding:16px 18px 18px; display:grid; gap:13px;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
}
.profile-body label{display:flex; flex-direction:column; gap:5px; font-size:13px; font-weight:600; color:var(--ink-2)}
.profile-body input[aria-invalid="true"]{border-color:var(--risk); background:var(--risk-soft)}

/* 題目卡 */
.item{
  background:var(--surface); border:1px solid var(--line-soft); border-radius:10px;
  padding:14px 16px; margin-bottom:10px; box-shadow:var(--shadow); transition:border-color .2s;
}
.item[data-filled="true"]{border-color:var(--teal-line)}
.item-head{display:flex; gap:11px; align-items:flex-start}
.item-head input[type=checkbox]{margin-top:5px; width:17px; height:17px; accent-color:var(--teal); flex:0 0 auto; cursor:pointer}
.item-main{flex:1 1 auto; min-width:0}
.item-label{font-weight:700; font-size:15px; display:flex; gap:8px; align-items:baseline; flex-wrap:wrap}
.item-desc{color:var(--ink-2); font-size:13.5px; margin-top:3px}
.item-hint{color:var(--muted); font-size:12.5px; margin-top:5px; font-style:italic}
.item-body{margin-top:11px; padding-left:28px}
textarea{
  width:100%; min-height:60px; resize:vertical; padding:9px 11px; border-radius:8px;
  border:1px solid var(--line); background:var(--ground); color:var(--ink); font:inherit; font-size:14px; line-height:1.6;
}
textarea:focus, input:focus, .btn:focus-visible{outline:2px solid var(--teal); outline-offset:1px}
input[type=text], input[type=email]{
  width:100%; padding:9px 11px; border-radius:8px; border:1px solid var(--line);
  background:var(--ground); color:var(--ink); font:inherit; font-size:14px;
}
.item-actions{display:flex; gap:12px; align-items:center; margin-top:8px; flex-wrap:wrap}

/* 分段按鈕 */
.choice{display:flex; gap:6px; flex-wrap:wrap}
.choice-opt{
  border:1px solid var(--line); background:var(--surface-2); color:var(--ink-2);
  padding:7px 15px; border-radius:8px; font-size:13.5px; font-weight:700; transition:.14s;
  white-space:nowrap;
}
.choice-opt:hover:not(:disabled){border-color:var(--teal); color:var(--teal)}
.choice-opt[aria-pressed="true"]{background:var(--teal); border-color:var(--teal); color:#fff}
.choice-opt:disabled{opacity:.45; cursor:not-allowed}

/* 節標題與分頁導覽 */
.section-head{display:flex; align-items:baseline; gap:12px; margin-bottom:16px}
.section-no{
  font-family:"IBM Plex Mono",monospace; font-size:13px; font-weight:700; color:var(--teal);
  letter-spacing:.08em;
}
.section-title{font-size:22px; font-weight:900; letter-spacing:-.01em}
.pager{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-top:24px; padding-top:18px; border-top:1px solid var(--line-soft);
}
.pager-pos{font-size:12.5px; color:var(--muted)}
.tab-no{
  font-family:"IBM Plex Mono",monospace; font-size:11px; color:var(--muted);
  margin-right:6px; font-weight:700;
}
.tab[aria-selected="true"] .tab-no{color:var(--teal)}

/* 說明區塊（不作答） */
.info-card{
  background:var(--teal-soft); border:1px solid var(--teal-line); border-left-width:3px;
  border-radius:0 10px 10px 0; padding:14px 18px; margin-bottom:10px;
}
.info-title{font-weight:800; font-size:14px; color:var(--teal); margin-bottom:6px}
.info-list{margin:0; padding-left:18px; font-size:13.5px; color:var(--ink-2); line-height:1.8}

/* 範本下載 */
.template{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px;
  padding:11px 14px; background:var(--surface-2); border:1px solid var(--line); border-radius:8px;
}

/* 平台色標 */
.platform{
  font-family:"IBM Plex Mono",monospace; font-size:10px; font-weight:700; letter-spacing:.06em;
  padding:2px 7px; border-radius:4px; flex:0 0 auto; text-transform:uppercase;
}
.platform.google{background:#E8F0FE; color:#1A5FB4}
.platform.microsoft{background:#E9F1F8; color:#12507A}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .platform.google{background:#132845; color:#8AB4F8}
  :root:not([data-theme="light"]) .platform.microsoft{background:#0E2438; color:#6FB3E8}
}
:root[data-theme="dark"] .platform.google{background:#132845; color:#8AB4F8}
:root[data-theme="dark"] .platform.microsoft{background:#0E2438; color:#6FB3E8}

/* 條件免填 */
.item[data-skipped="true"]{opacity:.6; border-style:dashed}
.item[data-skipped="true"] .item-body{display:none}
.skip-note{
  margin-top:8px; font-size:12.5px; color:var(--ink-2); background:var(--surface-2);
  border-left:3px solid var(--line); border-radius:0 6px 6px 0; padding:8px 12px;
}

/* 與填寫人相同 */
.sameas{display:flex; align-items:center; gap:12px; margin-bottom:12px; flex-wrap:wrap}
.sameas label{display:flex; align-items:center; gap:6px; font-size:13px; font-weight:700; color:var(--teal); cursor:pointer}
.sameas input{width:16px; height:16px; accent-color:var(--teal); cursor:pointer}

/* 題目欄位 */
.field-grid{display:grid; gap:12px; grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
.field{display:flex; flex-direction:column; gap:5px; min-width:0}
.field.textarea{grid-column:1/-1}
.field-label{font-size:12.5px; font-weight:700; color:var(--ink-2); display:flex; align-items:center; gap:6px}
.opt-tag{
  font-size:10.5px; font-weight:600; color:var(--muted); background:var(--surface-2);
  border:1px solid var(--line); border-radius:999px; padding:0 6px;
}
.field-note{font-size:11.5px; color:var(--muted); line-height:1.5}
.field input, .field select{
  width:100%; padding:8px 11px; border-radius:8px; border:1px solid var(--line);
  background:var(--ground); color:var(--ink); font:inherit; font-size:14px;
}
.field input.narrow{max-width:140px}
.field select{cursor:pointer}
.field input:disabled, .field select:disabled, .field textarea:disabled{opacity:.5; cursor:not-allowed}
.field textarea{min-height:64px}

.radio-row{display:flex; gap:16px; flex-wrap:wrap; padding:4px 0}
.radio-opt{display:flex; align-items:center; gap:6px; font-size:14px; cursor:pointer; font-weight:600}
.radio-opt input{width:16px; height:16px; accent-color:var(--teal); cursor:pointer}

/* 可重複列 */
.rows{display:flex; flex-direction:column; gap:6px; margin-bottom:14px}
.row-line{display:flex; gap:8px; align-items:center}
.row-line.head .row-cell{
  font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:var(--muted); padding-bottom:2px;
}
.row-cell{flex:1 1 0; min-width:0}
.row-cell.narrow{flex:0 0 110px}
.row-cell.act{flex:0 0 30px}
.row-cell input, .row-cell select{
  width:100%; padding:7px 10px; border-radius:7px; border:1px solid var(--line);
  background:var(--ground); color:var(--ink); font:inherit; font-size:13.5px;
}
.row-cell .rm{
  border:none; background:none; color:var(--risk); font-size:17px; line-height:1;
  padding:2px 6px; border-radius:5px;
}
.row-cell .rm:hover{background:var(--risk-soft)}
.add-row{align-self:flex-start; margin-top:2px}

/* 不填的理由 */
.optouts{display:flex; gap:16px; flex-wrap:wrap; margin-top:12px; padding-top:11px; border-top:1px dashed var(--line)}
.optout{display:flex; align-items:center; gap:6px; font-size:13px; color:var(--ink-2); cursor:pointer; font-weight:600}
.optout input{width:16px; height:16px; accent-color:var(--burn); cursor:pointer}

/* 附件 */
.drop{border:1.5px dashed var(--line); border-radius:8px; padding:12px 14px; text-align:center; color:var(--muted); font-size:13px; background:var(--ground); transition:.18s}
.drop.over{border-color:var(--teal); background:var(--teal-soft); color:var(--teal)}
.files{list-style:none; margin:9px 0 0; padding:0; display:flex; flex-direction:column; gap:6px}
.files li{display:flex; align-items:center; gap:9px; font-size:13px; background:var(--surface-2); border:1px solid var(--line); border-radius:7px; padding:6px 10px}
.files .name{flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600}
.files .size{color:var(--muted); font-size:11.5px; font-family:"IBM Plex Mono",monospace; flex:0 0 auto}
.files .rm{border:none; background:none; color:var(--risk); font-size:16px; line-height:1; padding:2px 5px; border-radius:5px; flex:0 0 auto}
.files .rm:hover{background:var(--risk-soft)}

/* 按鈕 */
.btn{border:1px solid var(--line); background:var(--surface); color:var(--ink); padding:8px 16px; border-radius:8px; font-size:14px; font-weight:700; transition:.15s}
.btn:hover:not(:disabled){border-color:var(--teal); color:var(--teal)}
.btn:disabled{opacity:.45; cursor:not-allowed}
.btn.primary{background:var(--teal); border-color:var(--teal); color:#fff}
.btn.primary:hover:not(:disabled){filter:brightness(1.1); color:#fff}
.btn.danger{color:var(--risk); border-color:var(--risk)}
.btn.sm{padding:5px 11px; font-size:12.5px}

/* 狀態列 */
.savebar{position:fixed; left:0; right:0; bottom:0; z-index:50; background:var(--surface); border-top:1px solid var(--line); box-shadow:0 -6px 24px -18px rgba(13,27,44,.5)}
.savebar-in{max-width:1120px; margin:0 auto; padding:11px 24px; display:flex; align-items:center; gap:14px; flex-wrap:wrap}
.savestate{font-size:13px; color:var(--muted); display:flex; align-items:center; gap:7px}
.savestate .led{width:7px; height:7px; border-radius:50%; background:var(--muted); flex:0 0 auto}
.savestate[data-state="saving"] .led{background:var(--burn); animation:pulse 1s infinite}
.savestate[data-state="saved"] .led{background:var(--ok)}
.savestate[data-state="error"] .led{background:var(--risk)}
@keyframes pulse{50%{opacity:.3}}

.notice{border-radius:10px; padding:14px 18px; margin-bottom:20px; font-size:14px; border-left:3px solid var(--teal); background:var(--teal-soft); color:var(--ink-2)}
.notice.warn{border-color:var(--burn); background:var(--burn-soft)}
.notice.error{border-color:var(--risk); background:var(--risk-soft)}
.notice.ok{border-color:var(--ok); background:var(--ok-soft)}
.notice strong{color:var(--ink)}

/* 表格（後台） */
table{width:100%; border-collapse:collapse; font-size:14px}
th{text-align:left; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); font-weight:700; padding:9px 12px; border-bottom:1px solid var(--line)}
td{padding:11px 12px; border-bottom:1px solid var(--line-soft); vertical-align:middle}
tbody tr:hover{background:var(--surface-2)}
.table-wrap{background:var(--surface); border:1px solid var(--line-soft); border-radius:10px; overflow-x:auto; box-shadow:var(--shadow)}
.badge{font-size:11.5px; font-weight:700; padding:2px 9px; border-radius:999px; background:var(--surface-2); color:var(--muted); white-space:nowrap}
.badge.submitted{background:var(--ok-soft); color:var(--ok)}
.badge.draft{background:var(--burn-soft); color:var(--burn)}
.minibar{height:4px; width:88px; background:var(--line); border-radius:2px; overflow:hidden}
.minibar i{display:block; height:100%; background:var(--teal)}

/* 對話框 */
dialog{border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); padding:0; max-width:560px; width:calc(100% - 32px); box-shadow:0 24px 60px -20px rgba(0,0,0,.4)}
dialog::backdrop{background:rgba(13,27,44,.5)}
.dlg-head{padding:18px 22px 12px; border-bottom:1px solid var(--line-soft); font-weight:800; font-size:17px}
.dlg-body{padding:18px 22px; display:flex; flex-direction:column; gap:13px; max-height:70vh; overflow-y:auto}
.dlg-body label{display:flex; flex-direction:column; gap:5px; font-size:13px; color:var(--ink-2); font-weight:600}
.dlg-foot{padding:14px 22px 18px; display:flex; gap:9px; justify-content:flex-end}

.empty{padding:56px 24px; text-align:center; color:var(--muted)}
.copy-field{display:flex; gap:8px; align-items:center}
.copy-field input{font-family:"IBM Plex Mono",monospace; font-size:12.5px}

@media (max-width:640px){
  .wrap{padding:20px 14px 130px}
  .mast-in{padding:16px 14px 12px}
  .savebar-in{padding:10px 14px}
  .item-body{padding-left:0}
}
