/* 元件樣式 — 合併自 mockup/index.html(儀表板)、mockup/shared.css(人員/月度名單/專案 三頁共用)
   與 mockup/snapshots.html 內嵌樣式,去重後集中。所有顏色/間距皆引用 tokens.css 的 CSS 變數。 */

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; } /* 保護 hidden 屬性不被 .btn/.card 等元件的 display 規則覆蓋(同 specificity 時 author 樣式蓋過 UA 樣式) */
body {
  background:
    radial-gradient(900px 480px at 12% -8%, var(--page-glow-a), transparent 60%),
    radial-gradient(720px 420px at 92% 12%, var(--page-glow-b), transparent 55%),
    var(--page);
  color: var(--ink);
  font-family: "Fira Sans", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.num { font-family: "Fira Code", "Noto Sans TC", monospace; }
.shell { max-width: 1392px; margin: 0 auto; padding: 0 48px 64px; }

/* ── 頂部 band(masthead + tabs)───────────────── */
.band { background: var(--band); padding: 34px 0 0; border-bottom: 1px solid var(--border); margin-bottom: 26px; }
.band .inner { max-width: 1392px; margin: 0 auto; padding: 0 48px; }
header.masthead { display: flex; align-items: flex-end; justify-content: space-between; }
.masthead .eyebrow {
  font-family: "Fira Code", monospace; font-size: 11px; font-weight: 500;
  letter-spacing: .32em; color: var(--accent); margin-bottom: 8px;
}
.masthead h1 { font-size: 28px; font-weight: 700; letter-spacing: .02em; color: var(--band-ink); }
.masthead .meta { text-align: right; color: var(--band-ink2); font-size: 13px; }
.meta-top { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-bottom: 4px; }
.year-switch { display: inline-flex; align-items: center; gap: 12px; font-size: 21px; font-weight: 600; color: var(--band-ink); }
.year-switch .arrow { color: var(--band-ink2); font-size: 13px; cursor: pointer; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--band-ink2);
  transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--band-ink); border-color: var(--band-ink2); }
.export-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px;
  padding: 0 14px; border-radius: 9px; cursor: pointer; text-decoration: none;
  font-size: 13px; font-weight: 600; font-family: inherit;
  background: var(--accent); border: 1px solid transparent; color: #14100a;
  transition: filter .2s;
}
.export-btn:hover { filter: brightness(1.08); }
.export-btn svg { width: 15px; height: 15px; }
.export-btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--band-ink2); }
.export-btn.ghost:hover { color: var(--band-ink); border-color: var(--band-ink2); filter: none; }
.export-btn:disabled { opacity: .6; cursor: progress; }
nav.tabs { display: flex; gap: 26px; padding-top: 22px; }
nav.tabs a {
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; color: var(--band-ink2); font-weight: 500;
  padding-bottom: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .2s;
}
nav.tabs a:hover { color: var(--band-ink); }
nav.tabs a.active { color: var(--band-ink); border-bottom-color: var(--accent); }
nav.tabs svg { width: 15px; height: 15px; }

/* ── 卡片基底(儀表板 tile/runway-card + 全域 card)─────────── */
.tile, .card, .runway-card {
  background: linear-gradient(180deg, var(--sheen), transparent 42%), var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.card { padding: 20px 24px; }
main[data-view="dashboard"] .card { padding: 20px 24px 14px; }

/* ── 按鈕(人員/月度名單/專案 三頁)────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px;
  padding: 0 14px; border-radius: 9px; cursor: pointer; text-decoration: none;
  font: 600 13px/1 "Fira Sans", "Noto Sans TC", sans-serif;
  background: var(--accent); border: 1px solid transparent; color: #14100a;
  transition: filter .2s;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--ink2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--axis); filter: none; }
.btn.blue { background: var(--rev); color: #fff; }
.btn.danger-ghost { background: transparent; border: 1px solid var(--border); color: var(--crit); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }

/* ── 頁面標題列 ─────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-head h2 { font-size: 18px; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-head .actions { display: flex; gap: 10px; }

/* ── 資料表 ─────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--grid);
}
table.data td { padding: 12px; border-bottom: 1px solid var(--grid); color: var(--ink); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
table.data td.r, table.data th.r { text-align: right; }
table.data .rowact { display: flex; gap: 8px; justify-content: flex-end; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.tag.blue { background: color-mix(in srgb, var(--rev) 15%, transparent); color: var(--rev); }
.tag.amber { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent-ink); }
.tag.green { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.tag.gray { background: var(--surface-2); color: var(--muted); }

/* ── 表單(抽屜)───────────────────────────── */
.layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.layout.no-drawer { grid-template-columns: 1fr; }
.drawer h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.drawer .hint { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink2); margin-bottom: 6px; }
.field input[type="text"], .field input[type="number"], .field input[type="month"], .field select, .field textarea {
  width: 100%; height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--axis); background: var(--surface); color: var(--ink);
  font: 400 13.5px "Fira Sans", "Noto Sans TC", sans-serif;
}
.field textarea { height: 72px; padding: 8px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--rev); outline-offset: 1px; border-color: transparent; }
.field .suffix { font-size: 12px; color: var(--muted); margin-top: 4px; }
.radio-row { display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.radio-card.on { border-color: var(--rev); background: color-mix(in srgb, var(--rev) 7%, transparent); }
.radio-card b { font-size: 13px; color: var(--ink); }
.radio-card p { font-size: 12px; color: var(--muted); }
.drawer .form-actions { display: flex; gap: 10px; margin-top: 18px; }
.custom-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.custom-grid .cg { font-size: 11px; color: var(--muted); }
.custom-grid input { width: 100%; height: 30px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink); font: 400 12px "Fira Code", monospace; }

/* ── 月份選擇器(月度名單頁)─────────────────── */
.layout-snap { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.month-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.month-cell {
  padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border);
  cursor: pointer; font-size: 13px; color: var(--ink2);
}
.month-cell .st { display: block; font-size: 11px; margin-top: 2px; }
.month-cell.built .st { color: var(--good); }
.month-cell.est .st { color: var(--muted); }
.month-cell.sel { border-color: var(--rev); background: color-mix(in srgb, var(--rev) 9%, transparent); color: var(--ink); }
.addrow { display: flex; gap: 10px; align-items: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--grid); }
.addrow .field { margin: 0; flex: 1; max-width: 300px; }
table.data input[type="number"].salary-input {
  width: 120px; height: 30px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--axis); background: var(--surface); color: var(--ink);
  font: 500 13px "Fira Code", monospace; text-align: right;
}
table.data input[type="number"].salary-input:focus { outline: 2px solid var(--rev); outline-offset: 1px; border-color: transparent; }

/* ── 摘要條 ─────────────────────────────────── */
.statline { display: flex; gap: 26px; padding: 12px 0 2px; font-size: 13px; color: var(--ink2); }
.statline b { color: var(--ink); font-weight: 600; }

/* ── 數字卡(儀表板)───────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { padding: 18px 20px 15px; position: relative; }
.tile .top { display: flex; justify-content: space-between; align-items: center; }
.tile .label { font-size: 13px; color: var(--ink2); }
.tile .icon { color: var(--muted); }
.tile .icon svg { width: 18px; height: 18px; }
.tile .value { font-size: 33px; font-weight: 600; letter-spacing: -.01em; margin-top: 6px; }
.tile .value .unit { font-size: 15px; font-weight: 500; color: var(--ink2); margin-left: 3px; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tile .sub .up { color: var(--good); font-weight: 600; }
.tile.warn { border-top: 2px solid var(--accent); }
.tile.warn .value { color: var(--accent-ink); }
.tile.warn .icon { color: var(--accent); }
.tile .sub .need { color: var(--accent-ink); font-weight: 500; }

/* ── 年度跑道(儀表板)─────────────────────── */
.runway-card { padding: 20px 24px 22px; margin-top: 14px; }
.runway-head { display: flex; justify-content: space-between; align-items: baseline; }
.runway-head h2 { font-size: 15px; font-weight: 600; }
.runway-head .pct { font-size: 13px; color: var(--ink2); }
.runway-head .pct strong { font-size: 19px; color: var(--ink); font-weight: 600; }
.runway { margin-top: 14px; }
.runway .toprow { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink2); margin-bottom: 6px; }
.runway .toprow .todaymark { padding-left: 7px; border-left: 2px solid var(--accent); }
.runway .toprow strong { color: var(--ink); font-weight: 600; }
.runway .bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; background: var(--gap-track); }
.runway .seg { height: 100%; transform-origin: left center; }
.runway .seg + .seg { margin-left: 2px; }
.runway .seg.actual { background: linear-gradient(90deg, var(--rev-deep), var(--rev)); box-shadow: var(--glow-rev); }
.runway .seg.forecast { background: var(--rev-fc); opacity: .9; }
.runway .flags { display: flex; margin-top: 9px; font-size: 12px; color: var(--ink2); }
.runway .flag { white-space: nowrap; text-align: center; }
.runway .flag strong { color: var(--ink); font-weight: 600; }
.runway .flag.gap strong { color: var(--accent-ink); }

/* ── 圖表卡(儀表板)───────────────────────── */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.card.wide { grid-column: 1 / -1; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .note { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink2); margin: 6px 0 4px; flex-wrap: wrap; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .linekey { width: 14px; height: 0; border-top: 2px solid; display: inline-block; }
.legend .tick { width: 12px; height: 0; border-top: 2px solid var(--ink); display: inline-block; }
svg text { font-family: "Fira Code", monospace; }
svg text.zh { font-family: "Noto Sans TC", sans-serif; }
.axis-label { font-size: 10.5px; fill: var(--muted); }
.direct-label { font-size: 11px; fill: var(--ink2); font-weight: 600; }
svg path.grow { transform-box: fill-box; transform-origin: 50% 100%; }

/* ── 專案時程(儀表板)─────────────────────── */
.gantt { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.gantt th { font-family: "Fira Code", monospace; font-weight: 500; color: var(--muted); font-size: 10.5px; padding: 4px 2px; text-align: center; }
.gantt th.pname, .gantt td.pname { text-align: left; width: 128px; padding-right: 8px; color: var(--ink2); font-weight: 500; white-space: nowrap; font-family: "Fira Sans","Noto Sans TC",sans-serif; }
.gantt th.ptotal, .gantt td.ptotal { text-align: right; width: 86px; padding-left: 8px; color: var(--ink); font-weight: 600; white-space: nowrap; font-family: "Fira Code", monospace; font-size: 12px; }
.gantt td { padding: 2px; }
.gantt .cell { height: 22px; border-radius: 5px; background: transparent; }

/* ── 頁尾 ───────────────────────────────────── */
footer, footer.page-footer { margin-top: 26px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; border-top: 1px solid var(--grid); padding-top: 14px; }
footer .num { font-size: 11.5px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
