/* ============================================================
   工程進度管控儀表板 — 視覺系統
   概念:一張工程進度總表。墨藍與圖紙灰白,1px 線條分層,不用陰影;
   橘色只給「延誤起因」;狀態色依 KPI 文件(綠/黃/紅)。
   ============================================================ */
:root {
  --ink: #1b2a41; --ink-2: #33455e;
  --brand: #0033CC; --brand-dark: #00249A; --brand-light: #4D6BDF; --brand-tint: #E6ECFA;  /* 華城品牌藍,與標單系統相同 */
  --paper: #eef1f4; --surface: #ffffff; --surface-2: #f6f8fa;
  --line: #d9dfe7; --line-2: #eceff3;
  --text: #1f2933; --muted: #5b6b7f;
  --accent: #e8620a;
  --ok: #1e9e63; --ok-bg: #e4f5ec;
  --warn: #d98a00; --warn-bg: #fdf1dc; --warn-ink: #8a5800;
  --bad: #d63a2f; --bad-bg: #fbe7e5;
  --done: #9aa7b6; --today: #2f6fed;
  --r-panel: 10px; --r-ctl: 6px; --r-tag: 4px;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--paper); color: var(--text); line-height: 1.5; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- 標頭 ---------- */
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 28px; height: 56px; background: var(--brand); color: #fff; }
header h1 { font-size: 16px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.head-right { display: flex; align-items: center; gap: 8px; }
.whoami { font-size: 13px; opacity: .85; margin: 0 6px; }
.zoomctl { display: flex; }
.zoomctl .zoombtn:first-child { border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.zoomctl .zoombtn:last-child { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; margin-left: -1px; }
.zoombtn { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: var(--r-ctl); padding: 4px 10px; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.4; }
.zoombtn:hover { background: rgba(255,255,255,.12); }

/* ---------- 目前專案 + 選擇器 ---------- */
.projhead { display: flex; align-items: center; gap: 16px; padding: 22px 28px 14px; flex-wrap: wrap; }
.view.hidden { display: none; }
.projhead .btn.primary { margin-left: auto; }
td.nowrap, th.nowrap { white-space: nowrap; }
#overviewTable a.o-open { color: var(--ink); text-decoration: none; }
#overviewTable a.o-open:hover { text-decoration: underline; }
.projtitle { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.projtitle h2 { font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 14px; min-width: 260px; background: var(--surface); }
.chips { display: inline-flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 專案狀態列 ---------- */
.cards { margin: 0 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); display: grid; grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(200px, 1fr); }
.cards:empty { display: none; }
.stat { padding: 22px 24px; border-right: 1px solid var(--line-2); min-width: 0; }
.stat:last-child { border-right: none; }
.stat .label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.stat .value { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.stat .sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stat.finish .value { font-size: 34px; letter-spacing: -.01em; }
.stat.finish.late .value { color: var(--bad); }
.stat.finish.slight .value { color: var(--warn-ink); }
.stat .delta { display: inline-block; font-size: 13px; font-weight: 600; margin-left: 8px; vertical-align: 5px; }
.rail.small { width: 90px; display: inline-block; vertical-align: middle; margin: 0 8px 0 0; }
.rail { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.rail > i { display: block; height: 100%; background: var(--brand); }
.stat.worst .value { font-size: 16px; }
.stat.worst.red .value { color: var(--bad); } .stat.worst.yellow .value { color: var(--warn-ink); } .stat.worst.green .value { color: var(--ok); }
.stat .list { font-size: 13px; line-height: 1.6; color: var(--text); }
@media (max-width: 900px) { .cards { grid-template-columns: 1fr 1fr; } .stat:nth-child(2) { border-right: none; } .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); } }

/* ---------- 頁籤與主區 ---------- */
.tabs { margin: 28px 28px 0; display: flex; gap: 4px; align-items: flex-end; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: none; background: transparent; padding: 10px 16px 12px; cursor: pointer; font-size: 15px; text-decoration: none; display: inline-block; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
main { margin: 0 28px 32px; padding-top: 20px; }
.tab-sep { width: 1px; height: 22px; background: var(--line); margin: 0 10px 12px; }
.tabpane { display: none; } .tabpane.active { display: block; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .toggle { font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.toolbar .hint { margin-left: auto; }
.toolbar select, .drawer select, .inline-form select, .panel select { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 5px 8px; font-size: 13px; background: var(--surface); }
.hint { font-size: 12px; color: var(--muted); }
.msg { font-size: 13px; color: var(--bad); min-height: 18px; }
.msg.ok { color: var(--ok); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); margin: 0 0 12px 2px; }
.legend-title { font-weight: 600; }
.legend .sw { display: inline-block; width: 14px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.sw.done { background: var(--done); } .sw.green { background: var(--ok); } .sw.yellow { background: var(--warn); } .sw.red { background: var(--bad); }
.sw.planned { background: #c9d9ee; border: 1px solid #8fa9cc; }
.sw.running { background: var(--ok); background-image: repeating-linear-gradient(90deg, transparent 0 4px, rgba(255,255,255,.5) 4px 6px); }
.sw.cause { background: #c9d9ee; outline: 2px solid var(--accent); }
.sw.baseline { background: repeating-linear-gradient(135deg, #a5b0bd 0 3px, #e6eaef 3px 6px); }

/* ---------- 按鈕 ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 6px 14px; border-radius: var(--r-ctl); cursor: pointer; font-size: 13px; color: var(--text); text-decoration: none; display: inline-block; line-height: 1.5; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { border-color: var(--bad); color: var(--bad); margin-left: 8px; }
.btn.ghost { border: none; font-size: 16px; background: transparent; }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 6px; padding: 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- 甘特圖 ---------- */
.gantt-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); position: relative; }
.gantt { position: relative; font-size: 14px; --rowh: 44px; }
.gantt.compare { --rowh: 54px; }
.g-header { position: relative; height: 40px; background: var(--surface-2); border-bottom: 1px solid var(--line); z-index: 4; }
.g-header > div:first-child { position: sticky; left: 0; z-index: 5; height: 40px; background: var(--surface-2); border-right: 1px solid var(--line); }
.g-month { position: absolute; top: 0; height: 20px; line-height: 20px; padding-left: 6px; color: var(--ink); font-weight: 600; font-size: 12px; white-space: nowrap; border-left: 1px solid var(--line); }
.g-minor { position: absolute; top: 20px; height: 20px; line-height: 20px; padding-left: 3px; font-size: 11px; color: var(--muted); border-left: 1px solid var(--line-2); white-space: nowrap; }
.g-grid { position: absolute; top: 40px; bottom: 0; width: 1px; background: var(--line-2); z-index: 0; }
.g-grid.major { background: var(--line); }
.g-wkend { position: absolute; top: 40px; bottom: 0; background: #f3f5f8; z-index: 0; }
.g-row { position: relative; height: var(--rowh); border-bottom: 1px solid var(--line-2); }
.g-row:nth-child(even) { background: #fbfcfd; }
.g-row:hover { background: #eef4fd; }
.g-row.summary { background: var(--surface-2); cursor: pointer; }
.g-label { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; gap: 6px; height: var(--rowh); width: 300px; padding: 0 10px 0 12px; background: var(--surface); border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; cursor: pointer; }
.g-row:nth-child(even) .g-label { background: #fbfcfd; }
.g-row:hover .g-label { background: #eef4fd; }
.g-row.summary .g-label { font-weight: 600; color: var(--ink); background: var(--surface-2); }
.g-label .wbs { flex: 0 0 36px; text-align: right; color: var(--muted); font-size: 12px; }
.g-row.summary .g-label .wbs { color: var(--ink); }
.g-label .tname { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.arrow { display: inline-block; width: 10px; color: var(--muted); font-size: 10px; margin-right: -4px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: var(--r-tag); flex-shrink: 0; font-weight: 600; }
.badge.yellow { background: var(--warn-bg); color: var(--warn-ink); } .badge.red { background: var(--bad-bg); color: var(--bad); }
.badge.cause { background: var(--accent); color: #fff; }
.mine { font-size: 10px; color: #5b3fb5; background: #ece8fa; border-radius: var(--r-tag); padding: 1px 5px; flex-shrink: 0; }
.g-canvas { position: absolute; top: 0; left: 300px; right: 0; bottom: 0; }

.bar { position: absolute; height: 12px; border-radius: 3px; cursor: pointer; }
/* 上排:預計(淺藍,固定色) */
.bar.planned { top: 6px; background: #c9d9ee; border: 1px solid #8fa9cc; }
/* 下排:實際(依狀況著色) */
.bar.actual { top: 22px; height: 12px; }
.bar.actual.green { background: var(--ok); }
.bar.actual.yellow { background: var(--warn); }
.bar.actual.red { background: var(--bad); }
.bar.actual.running { border-radius: 3px 0 0 3px; background-image: repeating-linear-gradient(90deg, transparent 0 8px, rgba(255,255,255,.35) 8px 10px); }
.bar.summarybar { background: var(--ink-2); height: 6px; top: 19px; border-radius: 2px; }
.gantt.compare .bar.summarybar { top: 24px; }
.bar.cause { outline: 3px solid var(--accent); z-index: 2; }
.bar.affected { outline: 2px dashed var(--warn); }
/* 原訂計畫斜紋:只在對照模式顯示 */
.bar.baseline { top: 38px; height: 6px; border-radius: 2px; cursor: default; background: repeating-linear-gradient(135deg, #a5b0bd 0 3px, #e6eaef 3px 6px); border: 1px solid var(--line); }
.gantt.compare .bar.baseline { top: 42px; display: block; }
.gantt.compact .bar.baseline { display: none; }
.shiftlabel { position: absolute; top: 5px; font-size: 11px; font-weight: 700; white-space: nowrap; z-index: 2; }
.shiftlabel.red { color: var(--bad); } .shiftlabel.yellow { color: var(--warn-ink); }
.g-overlay { position: absolute; left: 0; top: 40px; z-index: 1; pointer-events: none; }
.todayline { position: absolute; top: 40px; bottom: 0; width: 2px; background: var(--today); z-index: 2; }
.todaytag { position: absolute; top: 22px; font-size: 10px; color: #fff; background: var(--today); border-radius: 3px; padding: 0 5px; z-index: 5; line-height: 16px; }
.g-empty { padding: 48px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; white-space: nowrap; }
.tabpane { overflow-x: auto; }
#tab-users table, #tab-audit table, #tab-notif table, #tab-history table, #importResult table, #overviewTable { min-width: 860px; }
td.strong { font-weight: 600; color: var(--ink); }
.lvl-red { color: var(--bad); font-weight: 600; } .lvl-yellow { color: var(--warn-ink); font-weight: 600; } .lvl-green { color: var(--ok); }
#overviewTable tr.current td { background: #eef4fd; }
tr:last-child td { border-bottom: none; }
tr.cascade td { background: #fffaf0; }
tr.err td { background: var(--bad-bg); }
tr.warn td { background: var(--warn-bg); }
td.errcell { color: var(--bad); font-size: 12px; white-space: pre-line; }
td.warncell { color: var(--warn-ink); font-size: 12px; white-space: pre-line; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: var(--r-tag); background: var(--line-2); }
.pill.email { background: #e3ecfb; color: #1d4ea8; }
.role { font-size: 11px; padding: 2px 8px; border-radius: var(--r-tag); font-weight: 600; }
.role.admin { background: var(--brand); color: #fff; } .role.staff { background: #e3ecfb; color: #1d4ea8; } .role.vendor { background: #ece8fa; color: #5b3fb5; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: var(--r-tag); background: var(--line-2); margin-left: 4px; }
.tag.off { background: var(--bad-bg); color: var(--bad); }
.tag.on { background: var(--ok-bg); color: #13704a; }

/* ---------- 管理面板 ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px 22px; margin-bottom: 18px; }
.panel h3 { font-size: 14px; color: var(--ink); margin-bottom: 8px; font-weight: 600; }
.panel .hint { margin-bottom: 10px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.inline-form input, .inline-form select { padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 13px; min-width: 160px; background: var(--surface); color: var(--text); }
.settings-form label { display: block; font-size: 13px; margin-bottom: 12px; }
.settings-form input[type=number] { padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.admin-only.hidden, .hidden { display: none !important; }

/* ---------- 側欄 ---------- */
.drawer { position: fixed; top: 0; right: 0; width: 400px; max-width: 94vw; height: 100vh; background: var(--surface); border-left: 1px solid var(--line); z-index: 20; padding: 20px 22px; overflow-y: auto; }
.drawer.hidden { display: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drawer h2 { font-size: 16px; color: var(--ink); } .drawer h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
.drawer label { display: block; font-size: 13px; margin-bottom: 10px; color: var(--text); }
.drawer input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r-ctl); margin-top: 4px; font-size: 13px; background: var(--surface); }
.drawer select { width: 100%; margin-top: 4px; }
.drawer .hint { margin-top: 8px; }
#dInfo { font-size: 13px; line-height: 1.8; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-ctl); padding: 10px 12px; }
#editSection { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 8px 12px; }
#editSection summary { cursor: pointer; font-size: 13px; color: var(--ink); font-weight: 600; }
#editSection form { margin-top: 10px; }
#newGroupFields.hidden { display: none; }
#dHistory { font-size: 12px; }
#dHistory .h-item { border-left: 3px solid var(--line); padding: 4px 10px; margin-bottom: 6px; }
#dHistory .h-item.cascade { border-color: var(--warn); background: #fffaf0; }
#dHistory .h-item.report { border-color: var(--bad); }
#overlay { position: fixed; inset: 0; background: rgba(27,42,65,.35); z-index: 10; }
#overlay.hidden { display: none; }

/* ---------- 登入頁 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--r-panel); padding: 28px 32px 24px; width: 420px; max-width: 94vw; }
.login-card h1 { font-size: 16px; color: var(--ink); margin-bottom: 20px; font-weight: 600; }
.login-form h2 { font-size: 15px; margin-bottom: 12px; color: var(--ink); }
.login-form label { display: block; font-size: 13px; margin-bottom: 12px; color: var(--text); }
.login-form input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); margin-top: 4px; font-size: 14px; }
.login-form.hidden { display: none; }
.login-form .hint { margin-bottom: 12px; }
.demo { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.demo .hint { margin-bottom: 8px; }
.demo.hidden { display: none; }

/* ---------- 通知紀錄清單 ---------- */
.spacer { flex: 1; }
.maillist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.mail { border-bottom: 1px solid var(--line-2); }
.mail:last-child { border-bottom: none; }
.mail summary { display: grid; grid-template-columns: 120px 84px 1fr 110px 90px; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.mail summary::-webkit-details-marker { display: none; }
.mail summary:hover { background: var(--surface-2); }
.mail[open] summary { background: var(--surface-2); }
.mail-time { font-size: 13px; color: var(--muted); }
.mail-subject { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-to { font-size: 13px; color: var(--muted); white-space: nowrap; }
.mail-status { font-size: 13px; white-space: nowrap; }
.mail.fail .mail-status { color: var(--bad); }
.mail-body { padding: 8px 16px 16px 228px; }
.mail-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; color: var(--text); margin-bottom: 10px; }
.mail-meta b { color: var(--muted); font-weight: 600; }
.mail-body pre { font-family: var(--font); font-size: 13px; line-height: 1.7; white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-ctl); padding: 12px 14px; max-width: 720px; }
.pill.kind-due_soon { background: #e3ecfb; color: #1d4ea8; } .pill.kind-overdue { background: var(--bad-bg); color: var(--bad); }
.pill.kind-digest { background: var(--warn-bg); color: var(--warn-ink); } .pill.kind-test { background: var(--line-2); color: var(--muted); }
@media (max-width: 720px) { .mail summary { grid-template-columns: auto 1fr auto; } .mail-time, .mail-to { display: none; } .mail-body { padding-left: 16px; } }
.demo select { width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 14px; background: var(--surface); }

/* ============ 檢視模式切換 / 工項列表 ============ */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; }
.seg-btn { border: none; background: var(--surface); padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: var(--brand); color: #fff; }
.tasklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.tasklist.hidden { display: none; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.tcard.can { border-left: 4px solid var(--brand); }
.tcard:active { background: var(--surface-2); }
.tcard-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tcard-head .wbs { color: var(--muted); font-size: 13px; }
.tcard-head .tname { font-weight: 600; color: var(--ink); font-size: 15px; }
.tcard-row { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tcard-row .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--ok); } .dot.yellow { background: var(--warn); } .dot.red { background: var(--bad); } .dot.done { background: var(--done); }
.tcard-act { margin-top: 4px; }
.tcard-act .btn { padding: 8px 16px; font-size: 14px; }
.tcard-others { grid-column: 1 / -1; }
.tcard-others summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 8px 4px; }
.tcard-others[open] summary { margin-bottom: 8px; }
.tcard-others .tcard { margin-bottom: 8px; opacity: .8; }
.t-short { display: none; }

/* ============ 手機版(≤720px) ============ */
@media (max-width: 720px) {
  html { font-size: 15px; }
  header { padding: 0 14px; height: 50px; }
  header h1 { font-size: 15px; }
  .whoami { display: none; }
  .zoombtn { padding: 5px 9px; font-size: 12px; }
  .projhead { padding: 14px 14px 8px; gap: 10px; }
  .projtitle h2 { font-size: 19px; white-space: normal; }
  .projhead .btn { padding: 8px 12px; }
  .cards { margin: 0 14px; grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 14px; }
  .stat.finish .value { font-size: 24px; }
  .stat .value { font-size: 17px; }
  .stat .delta { font-size: 12px; margin-left: 4px; vertical-align: 2px; }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
  .tabs { margin: 14px 14px 0; }
  .tab { padding: 8px 12px 10px; font-size: 14px; }
  main { margin: 0 14px 24px; padding-top: 12px; }
  .toolbar { gap: 8px; }
  .toolbar .search { min-width: 0; width: 100%; }
  .chips { flex-wrap: wrap; }
  .legend { display: none; }
  .c-sec { display: none; }
  #overviewTable { min-width: 0; }
  #overviewTable td, #overviewTable th { padding: 10px 8px; font-size: 13px; }
  #overviewTable td.strong { min-width: 130px; }
  .rail.small { width: 56px; }
  .gantt .g-label { width: 150px; padding: 0 6px; gap: 4px; }
  .gantt .g-canvas { left: 150px; }
  .g-label .wbs { flex-basis: 30px; font-size: 11px; }
  .g-label .badge { display: none; }
  .drawer { width: 100vw; max-width: 100vw; padding: 16px 16px 40px; }
  .drawer-head { position: sticky; top: -16px; background: var(--surface); padding: 12px 0; margin: -16px 0 8px; z-index: 1; border-bottom: 1px solid var(--line-2); }
  .drawer input, .drawer select, .login-form input, .inline-form input, .inline-form select, .search { font-size: 16px; padding: 11px 12px; }
  .drawer .btn.primary { width: 100%; padding: 12px; font-size: 16px; }
  .btn.danger { margin: 10px 0 0; width: 100%; }
  .inline-form label { width: 100%; }
  .inline-form input, .inline-form select { width: 100%; min-width: 0; }
  .login-card { padding: 22px 18px; }
  .btn.wide { padding: 12px; font-size: 16px; }
  .mail summary { grid-template-columns: auto 1fr auto; }
}

/* ---------- 回報表單:兩欄日期 / 變更申請 ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.form-sub { font-size: 13px; color: var(--ink); font-weight: 600; margin: 6px 0 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.badge.pending { background: #e3ecfb; color: #1d4ea8; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.count.hidden { display: none; }
.reqlist { display: flex; flex-direction: column; gap: 10px; }
.req { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.req.pending { border-left: 4px solid #1d4ea8; }
.req-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 14px; }
.req-dates .hint { display: block; }
.req-reason { font-size: 13px; }
.req-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.req-act .req-note { flex: 1; min-width: 200px; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.pill.st-pending { background: #e3ecfb; color: #1d4ea8; } .pill.st-ok { background: var(--ok-bg); color: #13704a; } .pill.st-bad { background: var(--bad-bg); color: var(--bad); }
.pill.kind-change_request { background: #e3ecfb; color: #1d4ea8; } .pill.kind-change_decision { background: var(--ok-bg); color: #13704a; }
@media (max-width: 720px) { .req-dates { grid-template-columns: 1fr; } .two-col { grid-template-columns: 1fr; } }

/* ---------- 品牌區(華城 TE 標誌,與標單系統一致) ---------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { background: #fff; border-radius: 6px; padding: 3px; display: flex; flex-shrink: 0; }
.brand-mark img { height: 26px; width: 35px; display: block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-co { font-size: 15px; font-weight: 700; letter-spacing: .08em; }
.brand-app { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand img { height: 42px; width: 56px; }
.login-brand .brand-co { color: var(--brand); font-size: 20px; }
.login-brand .brand-app { color: var(--muted); opacity: 1; font-size: 13px; }
.notice { background: var(--brand-tint); color: var(--brand-dark); border-radius: var(--r-ctl); padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }
.notice.hidden { display: none; }
.pw-rules { list-style: none; padding: 0; margin: -4px 0 12px; font-size: 12px; color: var(--muted); }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓ "; }
.loginlog { margin-top: 14px; }
@media (max-width: 720px) { .brand-app { display: none; } .brand-co { font-size: 14px; } }
#auditTable td:nth-child(-n+3), #auditTable th, #loginLog td, #loginLog th { white-space: nowrap; }
