/* 亞樂米工程管理系統｜A 工地標示風：安全黃 × 黑、粗框、大按鈕 */
:root {
  --yellow: #FFC20E;
  --black: #111111;
  --ground: #F2F0EA;
  --white: #FFFFFF;
  --red: #D7261E;
  --muted: #4A4A4A;
  --line: 3px solid var(--black);
  --thick: 4px solid var(--black);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--black);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 16px; line-height: 1.5;
}
a { color: var(--black); }
a:hover { color: #000; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
img { max-width: 100%; display: block; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 上方黑底列 */
.topbar { background: var(--black); color: var(--white); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; }
.brand:hover { color: var(--white); }
.brand-mark { background: var(--yellow); color: var(--black); font-weight: 900; padding: 4px 10px; font-size: 18px; letter-spacing: 1px; }
.brand-mark.big { font-size: 28px; padding: 6px 16px; display: inline-block; }
.brand-name { font-weight: 900; font-size: 18px; }
.topnav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.topnav a { color: var(--white); text-decoration: none; font-weight: 700; padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; }
.topnav a.on, .topnav a:hover { background: var(--yellow); color: var(--black); }
.me { color: #DDD; font-size: 14px; text-decoration: none; }
.me:hover { color: var(--yellow); }
.stripe { height: 12px; background: repeating-linear-gradient(-45deg, var(--yellow) 0 16px, var(--black) 16px 32px); }

.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 24px 48px; }
.page-title { font-size: 28px; font-weight: 900; }
.title-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.title-tags { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.crumb { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 900; }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }

/* 按鈕 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: var(--line); background: var(--white); color: var(--black);
  font: inherit; font-weight: 900; text-decoration: none; cursor: pointer; }
.btn:hover { background: #FFF6D6; color: var(--black); }
.btn-yellow { background: var(--yellow); }
.btn-yellow:hover { background: #FFD24D; }
.btn-dark { background: var(--black); color: var(--yellow); }
.btn-dark:hover { background: #333; color: var(--yellow); }
.btn-big { min-height: 56px; font-size: 18px; padding: 0 22px; }
.btn-small { min-height: 36px; padding: 0 10px; font-size: 14px; border-width: 2px; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; color: var(--black); }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* 數字格 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--white); border: var(--thick); padding: 14px 18px; }
.tile-hot { background: var(--yellow); }
.tile-label { font-size: 14px; font-weight: 700; }
.tile-value { font-size: 36px; font-weight: 900; line-height: 1.15; }
.tile-value.small-value { font-size: 24px; }
.tile-sub { font-size: 13px; color: #333; }

/* 面板 */
.panel { background: var(--white); border: var(--thick); margin-bottom: 20px; }
.stack .panel, .grid-2 .panel, .grid-side .panel { margin-bottom: 0; }
.panel.narrow { max-width: 560px; margin: 40px auto; }
.panel-hot { border-color: var(--red); }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: var(--thick); font-size: 14px; font-weight: 700; }
.panel-head h1, .panel-head h2 { font-size: 18px; font-weight: 900; }
.panel-head.yellow { background: var(--yellow); }
.panel-head.dark { background: var(--black); color: var(--white); }
.panel-head.dark a { color: var(--yellow); }
.panel-head.hot { background: var(--red); color: var(--white); border-color: var(--red); }
.panel-body { padding: 14px 16px; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 2px solid var(--black); }
.row-item:last-child { border-bottom: 0; }
.group-head { background: var(--ground); padding: 8px 16px; font-weight: 900; border-bottom: 2px solid var(--black); }
.group-head a { text-decoration: none; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 2px solid var(--black); vertical-align: top; }
thead th { background: var(--ground); white-space: nowrap; }
tr.dim { opacity: .55; }
tr.hl { background: #FFF6D6; }
.wrap-cell { white-space: normal; min-width: 280px; max-width: 640px; }
.board td { white-space: nowrap; }
.board td:nth-child(5) { white-space: normal; min-width: 180px; }
.strong-link { font-weight: 900; font-size: 16px; }
table.kv th { width: 90px; background: var(--ground); white-space: nowrap; }

/* 標籤 */
.tag { display: inline-block; font-size: 13px; font-weight: 900; padding: 2px 9px; border: 2px solid var(--black); background: var(--white); white-space: nowrap; }
.tag-ok { background: var(--black); color: var(--yellow); }
.tag-red { background: var(--red); color: var(--white); border-color: var(--red); }
.tag-yellow { background: var(--yellow); }
.tag-line { background: transparent; color: #333; font-weight: 700; }
.tag-big { font-size: 14px; padding: 4px 10px; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* 進度條 */
.bar-line { display: inline-flex; align-items: center; gap: 8px; }
.bar { display: inline-block; width: 110px; height: 12px; border: 2px solid var(--black); background: var(--white); }
.bar i { display: block; height: 100%; background: var(--black); }

/* 分頁 */
.tabs { display: flex; flex-wrap: wrap; border: var(--line); background: var(--white); margin-bottom: 20px; }
.tabs a { text-decoration: none; font-weight: 700; padding: 12px 18px; min-height: 44px; }
.tabs a.on { background: var(--black); color: var(--yellow); font-weight: 900; }

/* 表單 */
.form { display: flex; flex-direction: column; gap: 8px; }
.form h3 { font-size: 16px; margin-top: 4px; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 18px; }
.span-2 { grid-column: 1 / -1; }
label { font-weight: 700; font-size: 15px; display: block; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: var(--line); background: var(--white); font: inherit; color: var(--black); border-radius: 0;
}
textarea { min-height: 84px; resize: vertical; }
input[type=file] { font: inherit; padding: 8px 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--black); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; margin-bottom: 12px; }
fieldset { border: 0; padding: 0; margin: 4px 0; }
legend { font-weight: 700; font-size: 15px; padding: 0; margin-bottom: 6px; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; }
details[open] summary { margin-bottom: 10px; }
select.pct { min-height: 40px; width: 96px; padding: 6px 8px; }

/* 點選標籤（派工、回報） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: var(--line); background: var(--white); font-weight: 700; cursor: pointer; }
.chip input:checked + span { background: var(--black); color: var(--yellow); }
.chip input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }

.chip-big span { min-height: 56px; font-size: 18px; font-weight: 900; padding: 0 20px; }
.chip-red input:checked + span { background: var(--red); color: var(--white); border-color: var(--red); }
.toggle { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toggle legend { width: 100%; }
.stepper { display: flex; }
.stepper button { width: 56px; min-height: 48px; border: var(--line); background: var(--yellow); font-size: 24px; font-weight: 900; cursor: pointer; }
.stepper input { text-align: center; font-size: 20px; font-weight: 900; border-left: 0 !important; border-right: 0 !important; }

/* 派工狀態按鈕 */
.seg { display: flex; flex-wrap: wrap; gap: 0; }
.seg-btn { min-height: 44px; min-width: 56px; padding: 0 10px; border: 2px solid var(--black); margin-left: -2px; background: var(--white); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.seg-btn.on-normal { background: var(--black); color: var(--yellow); }
.seg-btn.on-delayed, .seg-btn.on-cancelled { background: var(--red); color: var(--white); border-color: var(--red); }
.dispatch-row.status-cancelled > div:first-child { text-decoration: line-through; opacity: .6; }

/* 照片 */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo-grid-big { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.photo-grid a { text-decoration: none; font-size: 12px; color: #333; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 2px solid var(--black); background: #DDD; }
.photo-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 150px; border: 4px dashed var(--black); background: var(--yellow); font-size: 20px; font-weight: 900; text-align: center; cursor: pointer; margin: 8px 0; }
.photo-drop small { font-size: 13px; font-weight: 500; }

/* 訊息 */
.flash { border: var(--line); padding: 12px 16px; margin-bottom: 16px; font-weight: 700; background: var(--white); }
.flash-ok { background: var(--black); color: var(--yellow); }
.flash-error { background: var(--red); color: var(--white); border-color: var(--red); }

/* 手機卡片 */
.cards { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.card { display: flex; flex-direction: column; gap: 6px; border: var(--line); padding: 10px 12px; text-decoration: none; background: var(--white); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-mid { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.card .bar { width: 120px; height: 10px; }
.only-narrow { display: none; }

/* 施工日誌 */
.log h2 { font-size: 17px; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: var(--line); }
.wx { display: inline-block; margin-right: 14px; }
.log-report { padding: 8px 0; border-bottom: 1px solid #999; }
.log-report .photo-grid { margin-top: 8px; }

/* 登入 */
.login { max-width: 440px; margin: 6vh auto 0; background: var(--white); border: var(--thick); }
.login-head { background: var(--black); color: var(--white); padding: 22px; display: flex; align-items: center; gap: 14px; }
.login-head h1 { font-size: 24px; font-weight: 900; }
.login-form { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 8px; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.site-foot { max-width: 1320px; margin: 0 auto; padding: 0 24px 28px; font-size: 13px; color: var(--muted); }
.version { border-bottom: 2px solid var(--black); }
.version:last-child { border-bottom: 0; }
.version-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding: 14px 16px 4px; }
.version-head h2 { font-size: 22px; font-weight: 900; }
.version h3 { font-size: 15px; margin: 8px 16px 4px; }
.version ul { margin: 0 16px 12px; padding-left: 22px; }
.version li { margin: 3px 0; }
.perm-box { border: 2px solid var(--black); padding: 10px 12px; margin: 6px 0; }
.perm-box legend { padding: 0 6px; }
.perm-group { font-weight: 900; font-size: 13px; margin-top: 8px; padding-top: 6px; border-top: 1px solid #BBB; }
.small-check { min-height: 34px; font-size: 14px; }
.small-check input { width: 18px; height: 18px; }
.chip input:disabled + span { opacity: .45; cursor: not-allowed; }
.chip-out span { border-style: dotted; }
.name-list { display: flex; flex-wrap: wrap; gap: 6px; }
.name-list span { border: 2px solid var(--black); padding: 2px 8px; font-weight: 700; background: var(--white); }
.chip-note { display: block; font-size: 11px; font-weight: 500; color: #555; margin-left: 6px; }
.chip span:has(.chip-note) { flex-direction: column; align-items: flex-start; justify-content: center; padding-top: 4px; padding-bottom: 4px; }
.quick { align-items: center; margin-bottom: 6px; }
table.people .stay-label { display: none; }
table.people tr.stay .stay-label { display: block; color: var(--red); font-weight: 700; }
table.people .chips { gap: 6px; }
table.people .chip span { min-height: 40px; padding: 0 10px; font-size: 14px; }
table.people td { vertical-align: middle; }
table.people input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--black); }
.items-edit input:not([type=checkbox]) { min-height: 40px; padding: 6px 8px; border-width: 2px; }
.items-edit td { padding: 6px 8px; vertical-align: middle; }
.items-edit input.w-num { width: 72px !important; }
.items-edit input.w-short { width: 100px !important; }
.items-edit td:nth-child(3) { min-width: 320px; width: 45%; }
.items-edit tr.new-row { background: #FFFBEA; }
.pct.wide { width: 170px; }
.wx-table tr.rainy td { background: #E8F1FB; }
.wx-table details summary { min-height: 28px; }
.stage-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-btns .btn { min-height: 48px; }
.stage-btns .btn.current { background: var(--black); color: var(--yellow); }
.photo-cell { display: flex; flex-direction: column; gap: 2px; }
.photo-cell form { margin: 0; }
.photo-cell .link { color: var(--red); font-weight: 700; min-height: 32px; text-align: left; }
.help-box { background: var(--white); border: 3px solid var(--black); padding: 10px 16px; margin-bottom: 20px; }
.help-box summary { cursor: pointer; min-height: 36px; }
.help-body ol { margin: 6px 0; padding-left: 22px; }
.help-body li { margin: 6px 0; }
.help-table th, .help-table td { padding: 6px 10px; font-size: 14px; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.board-col { border: 2px solid var(--black); padding: 8px 10px; background: var(--white); }
.board-col.done { background: var(--black); color: var(--yellow); }
.items-edit select.w-route { min-height: 40px; padding: 6px; border-width: 2px; min-width: 150px; }
.flow-row-title { font-weight: 900; margin: 14px 0 6px; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.flow-step { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 130px; padding: 10px 12px; border: 3px solid var(--black); background: var(--yellow); text-decoration: none; color: var(--black); }
.flow-step small { font-size: 12px; }
.flow-step.flow-auto { background: var(--black); color: var(--yellow); }
.flow-no { font-size: 12px; font-weight: 900; }
.flow-arrow { align-self: center; font-size: 22px; font-weight: 900; }
.help-text li, .help-list li { margin: 6px 0; }
.help-text dt { font-weight: 900; margin-top: 10px; }
.help-text dd { margin: 2px 0 0 0; }
.help-toc { position: sticky; top: 0; z-index: 5; }
.steps-line { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; }
.steps-line li { padding: 6px 12px; border: 2px solid var(--black); background: var(--white); font-weight: 700; font-size: 14px; }
.steps-line li.done { background: var(--black); color: var(--yellow); }
.steps-line li.on { background: var(--yellow); }
.import-table select { min-height: 40px; padding: 6px; border-width: 2px; }
.import-table td { vertical-align: middle; }
.upload-box { border: 3px dashed var(--black); background: #FFFBEA; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.upload-box input[type=file] { flex: 1; min-width: 220px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.copy-box > summary { cursor: pointer; list-style: none; }
.copy-box > summary::-webkit-details-marker { display: none; }
.copy-box > summary h2::before { content: '＋ '; }
.copy-box[open] > summary h2::before { content: '－ '; }
.done-edit { white-space: nowrap; }
.live-warn { margin: 0; border-width: 0 0 3px; }
.bottomnav { display: none; }

@media (max-width: 860px) {
  .grid-side { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; }
  .topnav, .me { display: none; }
  .wrap { padding: 14px 12px 32px; }
  .page-title { font-size: 22px; }
  .title-row { margin-bottom: 12px; }
  .title-row .actions { width: 100%; }
  .title-row .actions .btn { flex: 1; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tiles-5 .tile:last-child { grid-column: 1 / -1; }
  .tile { padding: 10px 12px; border-width: 3px; }
  .tile-value { font-size: 24px; }
  .panel { border-width: 3px; }
  .only-wide { display: none; }
  .only-narrow { display: flex; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs a { white-space: nowrap; padding: 12px 14px; }
  .row-item { flex-wrap: wrap; }
  .resolve { width: 100%; }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; background: var(--black); padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
  .bottomnav a { color: var(--white); text-align: center; text-decoration: none; font-weight: 700; font-size: 14px; padding: 12px 0; }
  .bottomnav a.on { color: var(--yellow); font-weight: 900; }
}
@media print {
  .topbar, .stripe, .bottomnav, .no-print, .flash { display: none !important; }
  body { background: #FFF; }
  .wrap { padding: 0; max-width: none; }
  .panel { border: 2px solid #000; }
  .panel-head.yellow { background: #FFF; }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
  .weather-report { border-width: 1px; }
  .weather-report th, .weather-report td { padding: 4px 6px; font-size: 11pt; border-bottom: 1px solid #000; }
  .wx-table tr.rainy td { background: #EEE !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .crumb, .title-row .actions, .tiles { display: none !important; }
}
form[data-progress-form] input.w-num { width: 88px !important; min-width: 0; display: inline-block; min-height: 40px !important; padding: 6px 8px !important; }
form[data-progress-form] select.pct.wide { max-width: 230px; }
.edit-section + .edit-section { border-top: 3px solid var(--black); }
.sub-head { padding: 6px 16px; font-weight: 700; font-size: 14px; background: #FFF1B8; border-top: 2px solid var(--black); border-bottom: 2px solid var(--black); }
.sub-head.dark { background: var(--black); color: var(--white); }
.items-edit input[name$="[name]"] { min-width: 150px; max-width: 240px; }
.items-edit .w-short { width: 64px !important; }
.items-edit .w-route { max-width: 140px; }
/* 要徑圖 */
.tile-red { background: var(--red); color: #FFF; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 16px; border-bottom: 2px solid var(--black); }
.gantt-legend .lg { display: inline-block; width: 22px; height: 10px; margin-right: 6px; vertical-align: middle; border: 1px solid var(--black); }
.lg.crit { background: var(--red); } .lg.norm { background: #555; }
.lg.slack { background: repeating-linear-gradient(45deg, #FFF 0 3px, #999 3px 5px); }
.lg.done { background: var(--yellow); } .lg.today { width: 3px !important; background: #1565C0; border: 0 !important; } .lg.end { width: 0 !important; border: 0 !important; border-left: 3px dashed var(--red) !important; }
.gantt { overflow-x: auto; }
.g-row { display: grid; grid-template-columns: 200px 165px minmax(520px, 1fr); border-bottom: 1px solid #CCC; min-height: 36px; align-items: center; }
.g-row > div { padding: 4px 10px; }
.g-head { font-weight: 700; font-size: 13px; background: #F7F5EF; border-bottom: 2px solid var(--black); }
.g-sec { display: block; background: #FFF1B8; font-weight: 700; font-size: 13px; border-top: 2px solid var(--black); }
.g-sec.dark { background: var(--black); color: #FFF; }
.g-row.is-crit .g-name { color: var(--red); font-weight: 700; }
.g-track { position: relative; height: 36px; padding: 0 !important; border-left: 2px solid var(--black); }
.g-head .g-track { height: 28px; }
.g-month { position: absolute; top: 5px; padding-left: 4px; border-left: 2px solid var(--black); font-size: 12px; white-space: nowrap; }
.g-week { position: absolute; top: 0; bottom: 0; border-left: 1px dotted #CCC; }
.g-bar { position: absolute; top: 9px; height: 18px; border: 2px solid var(--black); overflow: hidden; }
.g-bar.crit { background: var(--red); } .g-bar.norm { background: #555; }
.g-bar i { display: block; height: 100%; background: var(--yellow); opacity: .9; }
.g-slack { position: absolute; top: 14px; height: 8px; background: repeating-linear-gradient(45deg, transparent 0 3px, #999 3px 5px); border: 1px solid #999; }
.g-today { position: absolute; top: 0; bottom: 0; border-left: 3px solid #1565C0; }
.g-end { position: absolute; top: 0; bottom: 0; border-left: 3px dashed var(--red); }
.sched-table tr.crit-row td { background: #FDECEA; }
.sched-edit .w-preds { width: 140px !important; }
.sched-edit .w-num { width: 80px !important; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .gantt { overflow: visible; }
  .g-row { grid-template-columns: 150px 140px 1fr; min-height: 26px; page-break-inside: avoid; }
  .g-track { height: 26px; }
  .g-bar { top: 5px; height: 14px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .g-bar.crit, .g-bar.norm, .g-bar i, .g-sec, .tile-red, .lg, .g-slack, .sched-table tr.crit-row td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .gantt-panel ~ .panel { page-break-before: always; }
  .title-row .actions { display: none; }
}
/* 驗收缺失、公文 */
.btn-red { background: var(--red); color: #FFF; border-color: var(--red); }
.tag-dark { background: var(--black); color: var(--yellow); }
.plain { list-style: none; padding: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid #DDD; }
.static { min-height: 48px; display: flex; align-items: center; }
.nowrap { white-space: nowrap; }
.right { float: right; }
.print-only { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.filters select, .filters input { width: auto !important; min-height: 44px; }
.subtabs { display: flex; flex-wrap: wrap; gap: 0; border: 3px solid var(--black); background: #FFF; }
.subtabs a { padding: 10px 16px; font-weight: 700; text-decoration: none; color: var(--black); border-right: 2px solid var(--black); }
.subtabs a.on { background: var(--black); color: var(--yellow); }
.defect .defect-desc { font-size: 17px; font-weight: 700; margin-top: 0; }
.defect-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 10px 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.thumbs img { width: 110px; height: 82px; object-fit: cover; border: 2px solid var(--black); }
.defect-action { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 10px; border-top: 2px dashed #BBB; margin-top: 10px; }
.defect-action input[type=file] { width: auto; }
.defect-action input:not([type=file]):not([type=hidden]) { width: auto; flex: 1; min-width: 180px; }
.doc-table td { vertical-align: top; }
.doc-table tr.row-alert td { background: #FDECEA; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn, .actions-cell form { margin: 2px 0; }
.defect-print { width: 100%; border-collapse: collapse; background: #FFF; }
.defect-print th, .defect-print td { border: 1px solid #000; padding: 6px; vertical-align: top; font-size: 14px; }
.defect-print .pics img { width: 120px; height: 90px; object-fit: cover; margin: 0 4px 4px 0; display: inline-block; }
.sign-row { display: flex; justify-content: space-between; margin-top: 30px; font-weight: 700; }
.sign-row span { flex: 1; border-bottom: 1px solid #000; padding-bottom: 30px; margin-right: 20px; }
@media (max-width: 720px) { .defect-photos { grid-template-columns: 1fr; } }
@media print {
  .print-only { display: block; }
  .defect-print tr { page-break-inside: avoid; }
  .defect-print th, .defect-print td { font-size: 10pt; }
  .doc-table th, .doc-table td { font-size: 10pt; padding: 4px; }
  .doc-table tr.row-alert td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .filters, .subtabs { display: none !important; }
}
.tile-red .tile-sub, .tile-red .tile-label { color: #FFF; }
.defect-action label { display: inline; }
/* 照片依日期 */
.photo-day .panel-head h2 { font-size: 20px; }
.photo-cell { display: flex; flex-direction: column; border: 2px solid var(--black); background: #FFF; }
.photo-cell.in-report { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow); }
.photo-cell > a img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo-meta { padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.photo-meta .when.src-upload { color: #8A5A00; }
.photo-meta .when.src-manual { color: #1565C0; }
.photo-meta .late { color: var(--red); font-weight: 700; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 4px; }
.photo-actions form { margin: 0; }
.photo-actions .check { display: inline-flex; gap: 4px; align-items: center; font-weight: 700; }
.fix-date summary { cursor: pointer; text-decoration: underline; }
.fix-date form { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.fix-date input { min-height: 36px !important; padding: 4px !important; font-size: 14px; width: auto !important; }
/* 一週天氣預報 */
.fc-week { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 0; overflow-x: auto; }
.fc-day { border-right: 1px solid #CCC; padding: 10px; text-align: center; }
.fc-day:last-child { border-right: 0; }
.fc-day .d { font-weight: 700; }
.fc-day .ic { font-size: 28px; line-height: 1.2; }
.fc-day .t { font-size: 18px; font-weight: 700; }
.fc-day.rain { background: #E3F0FB; }
.fc-day.wind { background: #FDECEA; }
.fc-mini { display: flex; gap: 6px; flex-wrap: wrap; }
.fc-mini span { font-size: 13px; border: 1px solid #999; padding: 2px 6px; background: #FFF; white-space: nowrap; }
.fc-mini span.rain { background: #E3F0FB; border-color: #1565C0; }
.fc-mini span.wind { background: #FDECEA; border-color: var(--red); color: var(--red); font-weight: 700; }
.wx-alert { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 8px; margin: 2px 4px 2px 0; }
.wx-alert.red { background: var(--red); color: #FFF; }
.wx-alert.yellow { background: var(--yellow); color: var(--black); }
.photo-cell.is-issue { border-color: var(--red); box-shadow: 0 0 0 3px var(--red); }
.import-table tr.row-heading td { background: #F2F0EA; color: #666; }
.doc-upload { margin-bottom: 6px; }
.doc-upload label { display: flex; flex-direction: column; }
.doc-quick-upload .btn { cursor: pointer; }
.head-btn { margin-left: 10px; vertical-align: middle; font-size: 13px; }
.row-tools { display: flex; gap: 12px; font-size: 13px; margin-top: 2px; }
.row-tools .link { font-size: 13px; color: var(--red); }
tr.quick-add td { background: #FFFBEA; vertical-align: middle; }
tr.quick-add input:not([type=checkbox]), tr.quick-add select { min-height: 40px !important; padding: 6px 8px !important; }
tr.quick-add input.w-num { width: 80px !important; display: inline-block; }
.panel-head a.head-btn.btn-yellow { color: var(--black) !important; background: var(--yellow); text-decoration: none; }
.panel-head a.head-btn.btn-dark { color: var(--yellow) !important; background: var(--black); text-decoration: none; }
.edit-panel { border-color: var(--yellow); }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 20px; min-height: 48px; align-items: center; }
span.label { font-weight: 700; font-size: 15px; display: block; }
.head-btn { margin-left: 10px; text-decoration: none; }
.panel-head a.head-btn.btn-yellow { color: var(--black) !important; }
.alert-bar { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 12px 16px; margin: 0 0 16px; background: var(--yellow); color: var(--black); border: 3px solid var(--black); text-decoration: none; }
.alert-bar.red { background: var(--red); color: #FFF; border-color: var(--red); }
.alert-bar .go { margin-left: auto; font-weight: 700; text-decoration: underline; }
.panel-head.red { background: var(--red); color: #FFF; }
.panel-head.red a { color: #FFF; }
a.row-link { color: inherit; text-decoration: none; }
a.row-link:hover { background: #FFFBEA; }
.row-end { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.btn-copy { white-space: nowrap; margin-top: 4px; }
.copy-prev { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: #F2F0EA; border-bottom: 2px solid var(--black); }
.seg-btn.seg-edit { text-decoration: none; display: inline-flex; align-items: center; }
/* 手機排版：區塊不被表格撐寬、標題列可換行、隱藏的上傳欄位不跑出畫面 */
.grid-2 > *, .grid-side > *, .stack > * { min-width: 0; }
.panel { min-width: 0; max-width: 100%; }
.panel-head { flex-wrap: wrap; gap: 6px 12px; }
.doc-quick-upload label, label.btn { position: relative; overflow: hidden; }
@media (max-width: 720px) {
  .panel-head form.inline { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
  .panel-head form.inline input[name=name] { width: 100% !important; }
  .row-end { justify-content: flex-start; }
  .filters { gap: 6px; }
  .filters input, .filters select { max-width: 100%; }
}
@media print { .table-wrap { overflow: visible !important; } }
td.name-cell { min-width: 8.5em; }
.row-tools { white-space: nowrap; }
.bar-line { white-space: nowrap; }
@media (max-width: 720px) {
  .prog-table, .prog-table tbody { display: block; }
  .prog-table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 14px; border-bottom: 1px solid #DDD; }
  .prog-table td { border: 0 !important; padding: 0 !important; }
  .prog-table td:nth-child(3) { grid-column: 1 / -1; }
  .prog-table .bar { flex: 1; }
  .prog-table .bar-line { display: flex; align-items: center; gap: 6px; }
}
.add-photos { margin-top: 10px; }
.add-photos summary { cursor: pointer; font-weight: 700; }
.thumb, .thumb-cell { display: inline-flex; flex-direction: column; align-items: stretch; width: min-content; vertical-align: top; }
.thumb img, .thumb-cell img { display: block; max-width: none; }
.photo-del { margin: 0; }
.photo-del-btn { display: block; width: 100%; margin: 0; padding: 3px 0; border: 2px solid var(--black); border-top: 0; background: #FFF; color: var(--red); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.photo-del-btn:hover, .photo-del-btn:focus { background: var(--red); color: #FFF; }
.defect-foot { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 2px solid #DDD; }
.defect-foot .add-photos { margin: 0; }
.defect-foot .add-photos[open] { flex: 1 1 100%; order: 2; }
.defect-foot .add-photos summary { list-style: none; display: inline-flex; align-items: center; }
.defect-foot .add-photos summary::-webkit-details-marker { display: none; }
.defect-tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.btn-del { color: var(--red); border-color: var(--red); background: #FFF; }
.btn-del:hover, .btn-del:focus { background: var(--red); color: #FFF; }
.report-edit { margin-top: 8px; }
.report-edit summary { cursor: pointer; text-decoration: underline; }
.report-edit form { margin-top: 6px; }
.photo-grid .thumb-cell { display: flex; width: auto; }

/* 請假 */
.chip-leave { opacity: .55; }
.chip-leave input:disabled + span { text-decoration: line-through; text-decoration-color: var(--red); cursor: not-allowed; }
.chip-leave input:checked + span { opacity: 1; }
.chip-leave-note { color: var(--red) !important; font-weight: 700; text-decoration: none; display: block; }
.chip-half .chip-leave-note { font-weight: 400; }
.leave-today { background: #FFF; border: 3px solid var(--red); border-left-width: 10px; padding: 10px 14px; margin: 0 0 14px; line-height: 1.7; }
.leave-today.none { border-color: #BBB; }
.leave-today b { margin-right: 8px; }
.leave-today .btn { margin-left: 8px; }
.leave-conflict { background: var(--red); color: #FFF; padding: 10px 14px; margin: 0 0 14px; font-weight: 700; line-height: 1.6; }
.leave-conflict a { color: #FFF; }
.staff-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.staff-cols > div { padding: 12px 16px; border-right: 2px solid #DDD; }
.staff-cols > div:last-child { border-right: 0; }
.staff-cols h3 { font-size: 15px; margin: 0 0 8px; }
.staff-cols .name-list span small { display: inline; }
@media (max-width: 720px) { .staff-cols { grid-template-columns: 1fr; } .staff-cols > div { border-right: 0; border-bottom: 2px solid #DDD; } }
tr.on-leave td { background: #FBE9E8; }
.leave-tag { color: var(--red); font-weight: 700; }
@media (min-width: 1100px) { .tiles-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 721px) and (max-width: 1099px) { .tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
