:root {
  --brand: #E8590C;
  --brand-dark: #C2410C;
  --brand-soft: #FFF0E6;
  --ink: #2B2320;
  --ink-soft: #6F6058;
  --card: #FFFFFF;
  --line: #F0E3D8;
  --ok: #2F9E44;
  --warn: #E03131;
  --sys2: #1971C2;   /* 系統2 理性 = 藍 */
  --sys1: #E8590C;   /* 系統1 感性 = 橘 */
  --radius: 20px;
  --shadow: 0 10px 30px rgba(190, 110, 50, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: linear-gradient(180deg, #FFF9F3 0%, #FAF5EF 45%, #F7F0E8 100%);
  min-height: 100vh;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  padding-bottom: 90px;
}

/* ── 頂部導覽 ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  display: flex; align-items: center; gap: 10px;
  height: 66px;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-weight: 900; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -0.5px;
}
.topbar .logo {
  font-weight: 900; font-size: 19px; color: var(--ink);
  margin-right: auto; white-space: nowrap;
  display: flex; align-items: center; gap: 10px;
}
.topbar a {
  text-decoration: none; color: var(--ink-soft);
  font-size: 15.5px; font-weight: 600;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
}
.topbar a:hover { color: var(--brand-dark); }
.topbar a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; }

.demo-banner {
  background: #FFF3BF; color: #7A5A00;
  text-align: center; font-size: 13.5px; padding: 7px 12px;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.wrap.narrow { max-width: 880px; }

/* ── Hero 區 ── */
.hero-grid {
  display: grid; grid-template-columns: 1.9fr 1fr; gap: 22px;
  margin-bottom: 34px; align-items: stretch;
}
.hero-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF6EE 100%);
  border: 1px solid var(--line); border-radius: 26px;
  padding: 40px 44px; box-shadow: var(--shadow);
}
.hero-date { font-size: 14.5px; color: var(--ink-soft); letter-spacing: 1px; }
.hero-title {
  font-size: 40px; font-weight: 900; letter-spacing: 1px;
  line-height: 1.3; margin: 6px 0 10px;
}
.hero-sub { font-size: 16.5px; color: var(--ink-soft); max-width: 560px; }
.battle {
  margin-top: 24px; background: var(--brand-soft);
  border-left: 5px solid var(--brand);
  border-radius: 14px; padding: 16px 20px;
  font-size: 16px;
}
.battle b { color: var(--brand-dark); }

.side-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 26px; padding: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.side-card h3 { font-size: 18px; font-weight: 900; }

.quick-item {
  display: block; width: 100%; text-align: left;
  background: #FDFAF6; border: 1px solid var(--line);
  border-radius: 14px; padding: 15px 18px;
  font-size: 15.5px; font-weight: 700; color: var(--ink);
  font-family: inherit; cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.quick-item:hover { border-color: var(--brand); color: var(--brand-dark); box-shadow: 0 4px 14px rgba(190,110,50,.12); }

/* ── 區塊標題 ── */
.section-label {
  font-size: 12.5px; letter-spacing: 4px; font-weight: 800;
  color: var(--brand); text-transform: uppercase;
}
.section-head { font-size: 26px; font-weight: 900; margin: 2px 0 16px; }

/* ── 卡片 ── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 28px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 20px; font-weight: 900; margin-bottom: 14px; }
.card h3 { font-size: 17px; margin: 16px 0 8px; }

.badge {
  display: inline-block; font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.badge.orange { background: var(--brand-soft); color: var(--brand-dark); }
.badge.green { background: #EBFBEE; color: var(--ok); }
.badge.gray { background: #F1F3F5; color: #666; }

.progress-track { background: #F3E7DA; border-radius: 999px; height: 12px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, var(--brand), #FF922B); height: 100%; border-radius: 999px; transition: width .3s; }
.progress-note { font-size: 14.5px; color: var(--ink-soft); margin-top: 8px; }

/* ── 守則摺疊 ── */
details.rules { background: var(--brand-soft); border-radius: 16px; padding: 16px 22px; margin-bottom: 18px; }
details.rules summary { cursor: pointer; font-weight: 800; color: var(--brand-dark); font-size: 15.5px; }
details.rules ul { margin: 10px 0 0 22px; font-size: 15px; }

/* ── 成員評分卡 ── */
.member-card { position: relative; }
.member-card .head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 21px; flex-shrink: 0;
}
.member-card .name { font-weight: 900; font-size: 18px; }
.member-card .role { font-size: 13.5px; color: var(--ink-soft); }
.done-tag { margin-left: auto; }

.sys-block { margin-top: 14px; }
.sys-label { display: flex; align-items: baseline; gap: 8px; font-size: 15.5px; font-weight: 800; }
.sys-label .range { font-size: 13px; color: var(--ink-soft); font-weight: 400; }
.sys-label.s2 { color: var(--sys2); }
.sys-label.s1 { color: var(--sys1); }
.sys-hint { font-size: 13.5px; color: var(--ink-soft); margin: 2px 0 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  border: 1.5px solid var(--line); background: #fff;
  border-radius: 999px; padding: 9px 17px;
  font-size: 15.5px; font-weight: 800; cursor: pointer;
  color: var(--ink-soft); transition: all .12s; font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.sel-s2 { background: var(--sys2); border-color: var(--sys2); color: #fff; }
.chip.sel-s1 { background: var(--sys1); border-color: var(--sys1); color: #fff; }

.subtotal {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px;
}
.subtotal b { font-size: 22px; color: var(--brand-dark); }

/* ── 表單 ── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14.5px; font-weight: 800; margin-bottom: 6px; }
.field select, .field textarea, .field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 15.5px; font-family: inherit; background: #fff;
  color: var(--ink);
}
.field textarea { min-height: 84px; resize: vertical; }
.field select:focus, .field textarea:focus, .field input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

/* ── 按鈕 ── */
.btn {
  display: inline-block; border: none; cursor: pointer;
  border-radius: 14px; padding: 14px 26px;
  font-size: 16px; font-weight: 800; font-family: inherit;
  transition: transform .1s;
  text-decoration: none; text-align: center;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand-dark); border: 1.5px solid var(--brand); }
.btn.small { padding: 9px 16px; font-size: 14px; border-radius: 11px; }
.btn.block { display: block; width: 100%; }

.submit-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(255,255,255,.95); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  padding: 14px 16px; display: flex; align-items: center; gap: 14px;
  justify-content: center;
}
.submit-bar .note { font-size: 14.5px; color: var(--ink-soft); }

.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 24px;
  border-radius: 999px; font-size: 15px; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toast.show { opacity: 1; }

/* ── 準則頁 ── */
.guide-section { border-left: 5px solid var(--sys2); padding-left: 16px; margin: 20px 0 10px; }
.guide-section.s1 { border-color: var(--sys1); }
.guide-section h2 { font-size: 20px; }
.guide-section .sub { font-size: 14px; color: var(--ink-soft); }
.dna-list { list-style: none; }
.dna-list li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 16px;
}
.dna-list li:last-child { border-bottom: none; }
.dna-num {
  flex-shrink: 0; width: 27px; height: 27px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 13.5px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  transform: translateY(5px);
}
.dna-en { font-size: 13px; color: var(--ink-soft); display: block; }
.score-table { width: 100%; border-collapse: collapse; font-size: 15.5px; margin-top: 8px; }
.score-table th, .score-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.score-table th { background: var(--brand-soft); color: var(--brand-dark); font-size: 14px; }
.score-table td.pt { font-weight: 900; color: var(--brand-dark); white-space: nowrap; }

/* ── 後台 ── */
.team-tabs { display: flex; gap: 12px; margin-bottom: 26px; }
.team-tab {
  flex: 1; text-align: center; padding: 15px; border-radius: 16px;
  border: 1.5px solid var(--line); background: #fff; cursor: pointer;
  font-size: 16.5px; font-weight: 800; color: var(--ink-soft); font-family: inherit;
  box-shadow: var(--shadow);
}
.team-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 30px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; text-align: center; box-shadow: var(--shadow);
}
.stat .num { font-size: 38px; font-weight: 900; color: var(--brand-dark); line-height: 1.2; }
.stat .lbl { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }

.admin-grid { display: grid; grid-template-columns: 1fr; gap: 0 20px; align-items: start; }

.person-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.person-row:last-child { border-bottom: none; }
.person-row:hover { background: #FDF9F5; }
.person-row .info { min-width: 90px; }
.person-row .nm { font-weight: 900; font-size: 17.5px; }
.person-row .bars { flex: 1; min-width: 130px; }
.bar-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); margin: 4px 0; }
.bar-track { flex: 1; background: #F3E7DA; height: 9px; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }
.bar-fill.s2 { background: var(--sys2); }
.bar-fill.s1 { background: var(--sys1); }
.person-row .total { font-size: 24px; font-weight: 900; color: var(--brand-dark); white-space: nowrap; }
.person-row .go {
  font-size: 13.5px; font-weight: 800; color: var(--brand);
  white-space: nowrap; text-align: right;
}
.trend-up { color: var(--ok); font-size: 13px; font-weight: 700; }
.trend-down { color: var(--warn); font-size: 13px; font-weight: 700; }

.detail-table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.detail-table th, .detail-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.detail-table th { background: #FDF4EC; color: var(--brand-dark); font-size: 14px; }
.detail-table td:first-child, .detail-table th:first-child { text-align: left; }

.comment-box {
  background: #FDF9F5; border-radius: 14px; padding: 14px 18px;
  margin: 10px 0; font-size: 15px;
}
.comment-box .from { font-size: 13px; color: var(--ink-soft); }

.calc-result {
  background: var(--brand-soft); border-radius: 16px;
  padding: 20px; text-align: center; margin-top: 14px;
}
.calc-result .money { font-size: 34px; font-weight: 900; color: var(--brand-dark); }
.calc-result .formula { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.only-mj {
  font-size: 12px; background: #FFE8CC; color: #B35C00;
  border-radius: 6px; padding: 2px 8px; font-weight: 800;
  vertical-align: middle;
}

.back-link { font-size: 15px; color: var(--brand-dark); text-decoration: none; font-weight: 800; }

/* ── 桌機版排版 ── */
@media (min-width: 900px) {
  .admin-grid { grid-template-columns: 1.5fr 1fr; }
  #memberCards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  #memberCards .card { margin-bottom: 0; }
}

/* ── 手機版 ── */
@media (max-width: 899px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { padding: 28px 24px; }
  .hero-title { font-size: 28px; }
  .stat-row { gap: 8px; }
  .stat .num { font-size: 26px; }
  .stat { padding: 14px; }
  .calc-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .topbar a { padding: 6px 9px; font-size: 14px; }
  .topbar .logo { font-size: 16px; }
  .section-head { font-size: 21px; }
  .hero-sub { font-size: 15px; }
  .person-row .go { display: none; }
  .wrap { padding: 20px 14px; }
}
