/* 工商獎金封閉網站 — 設計系統：精緻極簡 / 編輯式
   暖紙背景 + 墨黑字 + 藍黑 accent + 五狀態語意色票。對比 ≥4.5:1，8px 節奏。 */

:root {
  --paper:      #faf8f4;
  --paper-2:    #f3efe7;
  --ink:        #1a1a1a;
  --ink-soft:   #4a4742;
  --muted:      #7c776e;
  --line:       #e5e0d6;
  --line-soft:  #efebe2;
  --accent:     #1f3a5f;   /* 藍黑 */
  --accent-2:   #2f5a8f;

  /* 狀態色票（文字色 / 底色） */
  --s-prog:   #9a6a00;  --s-prog-bg:   #fbf2dd;
  --s-pay:    #1f6e45;  --s-pay-bg:    #e4f1ea;
  --s-review: #b23c0c;  --s-review-bg: #fbe9df;
  --s-exempt: #6f6a62;  --s-exempt-bg: #eeebe4;
  --s-paid:   #1a5f8f;  --s-paid-bg:   #e3eef7;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(26,26,26,.04), 0 6px 22px rgba(26,26,26,.05);
  --serif: "Noto Serif TC", Georgia, "Songti TC", serif;
  --sans:  "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── 報頭 masthead ── */
.masthead {
  border-bottom: 1.5px solid var(--ink);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
.masthead .wrap { display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; gap: 16px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: .5px; }
.brand small { display:block; font-family: var(--sans); font-weight: 400; font-size: 11px;
  letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.topnav a { padding: 7px 12px; border-radius: 8px; color: var(--ink-soft); font-size: 14px; }
.topnav a:hover { background: var(--paper-2); text-decoration: none; }
.topnav a.on { background: var(--ink); color: #fff; }
.topnav .sep { width:1px; height:20px; background:var(--line); margin:0 4px; }

/* ── 頁首 ── */
.page-head { padding: 34px 0 18px; }
.kicker { font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.page-head h1 { font-family: var(--serif); font-size: 34px; margin: 6px 0 4px; font-weight: 700; line-height: 1.15; }
.page-head p { color: var(--muted); margin: 0; font-size: 14px; }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ── 統計卡（分群導覽）── */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 22px 0 8px; }
.stat {
  display: block; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.stat:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--accent); }
.stat.on { border-color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink) inset, var(--shadow); }
.stat .n { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1; }
.stat .l { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.stat .dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:6px; vertical-align: 1px; }

/* ── 狀態 pill ── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill .g { font-size: 12px; }
.st-prog   { color: var(--s-prog);   background: var(--s-prog-bg); }
.st-pay    { color: var(--s-pay);    background: var(--s-pay-bg); }
.st-review { color: var(--s-review); background: var(--s-review-bg); }
.st-exempt { color: var(--s-exempt); background: var(--s-exempt-bg); }
.st-paid   { color: var(--s-paid);   background: var(--s-paid-bg); }
.dot-prog{background:var(--s-prog)} .dot-pay{background:var(--s-pay)}
.dot-review{background:var(--s-review)} .dot-exempt{background:var(--s-exempt)} .dot-paid{background:var(--s-paid)}

/* ── 表格 ── */
.card { background:#fff; border:1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin: 16px 0; }
.card-head { display:flex; justify-content:space-between; align-items:center;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.card-head h2 { font-family: var(--serif); font-size: 18px; margin: 0; font-weight: 700; }
.card-head .meta { font-size: 13px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 18px; font-size: 14px; }
thead th { font-size: 11.5px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
tbody tr { border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--paper); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.client { font-weight: 600; }
.tasktitle { color: var(--muted); font-size: 13px; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.arrow { color: var(--muted); padding: 0 4px; }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); }

/* ── 按鈕 / 表單 ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 14px; font-family: var(--sans); cursor: pointer; min-height: 38px; }
.btn:hover { background: var(--paper-2); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-family: var(--sans); background: #fff; color: var(--ink); min-height: 42px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
label { font-size: 13px; color: var(--ink-soft); font-weight: 600; display:block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* ── flash ── */
.flash { background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px;
  margin: 14px 0; font-size: 14px; }

/* ── 登入頁 ── */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 36px 32px; }
.login-card .kicker { text-align:center; }
.login-card h1 { font-family: var(--serif); font-size: 26px; text-align: center; margin: 8px 0 24px; }
.login-card .btn-primary { width: 100%; justify-content: center; }

/* ── 每人彙總 ── */
.bar-row { display:grid; grid-template-columns: 120px 1fr 90px; gap: 12px; align-items:center;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.bar-track { background: var(--paper-2); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar-name { font-weight: 600; }

/* ── 明細頁 ── */
.detail-grid { display:grid; grid-template-columns: repeat(2,1fr); gap: 0; }
.detail-grid .dt { padding: 14px 18px; border-bottom:1px solid var(--line-soft); }
.detail-grid .dt:nth-child(odd){ border-right:1px solid var(--line-soft); }
.dt .k { font-size:12px; letter-spacing:1px; text-transform:uppercase; color:var(--muted); }
.dt .v { font-size:18px; font-family:var(--serif); margin-top:4px; }

/* ── 讀取中 loading ── */
.loading-wrap { max-width: 520px; margin: 12vh auto; text-align: center; padding: 0 20px; }
.loading-wrap h1 { font-family: var(--serif); font-size: 26px; margin: 18px 0 8px; }
.loading-wrap p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.spinner { width: 46px; height: 46px; margin: 0 auto; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 6px; background: var(--paper-2); border-radius: 999px; overflow: hidden; margin: 22px 0 10px; }
.progress-bar { height: 100%; width: 40%; background: var(--accent); border-radius: 999px;
  animation: indet 1.3s ease-in-out infinite; }
@keyframes indet {
  0%   { margin-left: -40%; width: 40%; }
  50%  { margin-left: 30%;  width: 55%; }
  100% { margin-left: 100%; width: 40%; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner, .progress-bar { animation-duration: 2.4s; }
}

footer.foot { color: var(--muted); font-size: 12px; text-align:center; padding: 30px 0 40px; }

/* ── 響應式 ── */
@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .page-head h1 { font-size: 27px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .dt:nth-child(odd){ border-right:0; }
  .hide-sm { display: none; }
  th, td { padding: 10px 12px; }
}
@media (max-width: 820px) {
  /* 系統內容多：寬表格在手機可橫向捲動，不再被 card 裁切 */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card > table { min-width: 540px; }
  /* 表單欄位在手機改為每行單欄、輸入框滿版好點按 */
  .inline-form { gap: 10px; }
  .inline-form > div { flex: 1 1 100%; min-width: 0; }
  .inline-form > div input, .inline-form > div select { width: 100%; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .masthead .wrap { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topnav { width: 100%; }
  .page-head { padding: 22px 0 14px; }
  .bar-row { grid-template-columns: 92px 1fr 78px; gap: 8px; }
}
