/* 跨廠商機台維修平台：淺色工控介面；顏色只用在狀態上，其餘保持安靜 */
:root {
  /* 色彩取自簡報 */
  --ink: #1c2b33;
  --ink-2: #5b6770;
  --ink-3: #a3aeb4;
  --line: #c9d3d8;
  --line-2: #e3e9ec;
  --bg: #f3f6f7;
  --panel: #ffffff;
  --brand: #0e6e6a;
  --brand-ink: #0a5552;
  --brand-tint: #e6f2f1;
  --red: #d64545;
  --red-tint: #fdecec;
  --orange: #e0a526;
  --orange-tint: #fff6e0;
  --yellow: #9a6b00;
  --yellow-tint: #fff6e0;
  --green: #2e9e5b;
  --green-tint: #e5f4ea;
  --radius: 10px;
  --font: "Microsoft JhengHei", "微軟正黑體", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--bg);
  font-variant-numeric: tabular-nums;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.3; margin: 0 0 4px; font-weight: 700; letter-spacing: .02em; }
h2 { font-size: 17px; line-height: 1.35; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 700; }
p { margin: 0 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid #7fb0e0; outline-offset: 2px; }

/* 頂部列 */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 58px; background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .03em; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand img { height: 22px; display: block; }
.topbar .brand .sep { width: 1px; height: 20px; background: #3a4a52; }
.topbar nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.topbar nav a, .topbar .menu > button {
  color: #cfd8df; padding: 6px 12px; border-radius: 4px; white-space: nowrap; font-size: 14px; background: none; border: 0;
  font-family: inherit; cursor: pointer;
}
.topbar nav a:hover, .topbar .menu > button:hover { background: #2f3d48; color: #fff; text-decoration: none; }
.topbar nav a.active { background: var(--brand); color: #fff; }
.topbar .btn.small { background: transparent; color: #cfd8df; border-color: #3a4a52; }
.topbar .btn.small:hover { color: #fff; border-color: #9fd3ce; }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.menu { position: relative; }
.menu .dropdown {
  position: absolute; top: 40px; right: 0; min-width: 180px; background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(31, 42, 51, .18); padding: 6px; display: none;
}
.menu.open .dropdown { display: block; }
.menu .dropdown a, .menu .dropdown button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; color: var(--ink); background: none; border: 0;
  font: inherit; border-radius: 4px; cursor: pointer;
}
.menu .dropdown a:hover, .menu .dropdown button:hover { background: var(--bg); text-decoration: none; }
.bell { position: relative; }
.bell .count {
  position: absolute; top: -2px; right: -2px; background: var(--red); color: #fff; border-radius: 9px; font-size: 11px;
  padding: 0 5px; line-height: 16px;
}
.demo-flag { background: #f5c242; color: #3d2e00; font-size: 12px; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }

/* 版面 */
.page { max-width: 1400px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel.flush { padding: 0; }
.panel > h2:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .page { padding: 12px; } }

/* 按鈕與表單 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  min-height: 38px; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { background: var(--panel); border-color: var(--red); color: var(--red); }
.btn.big { min-height: 52px; font-size: 17px; width: 100%; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=tel], input[type=date], input[type=datetime-local], input[type=number],
input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; background: #fff;
  color: var(--ink); min-height: 38px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }
.field-error { color: var(--red); font-size: 13px; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
.choice { display: grid; gap: 8px; }
.choice label {
  display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; background: #fff;
}
.choice input { width: 18px; height: 18px; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--ink-2); font-weight: 600; font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f7f9fa; white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: #f5f8fb; }
.empty { padding: 32px; text-align: center; color: var(--ink-3); }

/* 狀態與嚴重等級 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.sev-red { background: var(--red-tint); color: var(--red); }
.sev-orange { background: var(--orange-tint); color: #a3510f; }
.sev-yellow { background: var(--yellow-tint); color: #7a6200; }
.sev-green { background: var(--green-tint); color: #1f6b41; }
.st-internal { background: var(--brand-tint); color: var(--brand-ink); }
.st-closed { background: var(--line-2); color: var(--ink-3); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--line); }
.dot.red { background: var(--red); } .dot.orange { background: var(--orange); } .dot.yellow { background: var(--yellow); } .dot.green { background: var(--green); }

/* 首頁：嚴重等級帶 */
.sev-strip { display: grid; grid-template-columns: repeat(4, 1fr) 1.4fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); margin-bottom: 16px; }
.sev-strip > div { padding: 14px 18px; border-right: 1px solid var(--line-2); }
.sev-strip > div:last-child { border-right: 0; }
.sev-strip .n { font-size: 34px; font-weight: 700; line-height: 1.1; }
.sev-strip .l { font-size: 13px; color: var(--ink-2); }
.sev-strip .s-red { border-top: 5px solid var(--red); } .sev-strip .s-red .n { color: var(--red); }
.sev-strip .s-orange { border-top: 5px solid var(--orange); } .sev-strip .s-orange .n { color: var(--orange); }
.sev-strip .s-yellow { border-top: 5px solid var(--yellow); } .sev-strip .s-yellow .n { color: var(--yellow); }
.sev-strip .s-green { border-top: 5px solid var(--green); } .sev-strip .s-green .n { color: var(--green); }
.sev-strip .s-meta { border-top: 5px solid var(--ink); font-size: 14px; }
.sev-strip .s-meta div { display: flex; justify-content: space-between; }
@media (max-width: 900px) { .sev-strip { grid-template-columns: repeat(2, 1fr); } }

.status-flow { display: flex; gap: 0; overflow-x: auto; }
.status-flow a { flex: 1; min-width: 100px; padding: 8px 12px; border-right: 1px solid var(--line-2); color: var(--ink); }
.status-flow a:hover { background: #f5f8fb; text-decoration: none; }
.status-flow .n { font-size: 22px; font-weight: 700; }
.status-flow .l { font-size: 12px; color: var(--ink-2); }
.status-flow .internal .l::after { content: "（廠內）"; color: var(--brand); }

/* 機台方塊：左側粗色條代表最嚴重的狀態 */
.zone { margin-bottom: 18px; }
.zone h3 { color: var(--ink-2); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tile {
  display: block; background: var(--panel); border: 1px solid var(--line); border-left: 8px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; color: var(--ink);
}
.tile:hover { border-color: var(--ink-3); text-decoration: none; }
.tile.red { border-left-color: var(--red); } .tile.orange { border-left-color: var(--orange); }
.tile.yellow { border-left-color: var(--yellow); } .tile.green { border-left-color: var(--green); }
.tile .no { font-weight: 700; }
.tile .name { font-size: 13px; color: var(--ink-2); }
.tile .state { margin-top: 6px; font-size: 13px; }
.tile .ok { color: var(--ink-3); }

/* 工單時間軸 */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--ink-3); }
.timeline li.vendor::before { border-color: var(--orange); }
.timeline li.user::before { border-color: var(--brand); }
.timeline li.alert::before { border-color: var(--red); background: var(--red); }
.timeline .t { font-size: 12px; color: var(--ink-3); }
.timeline .who { font-size: 13px; color: var(--ink-2); }
.round-tag { display: inline-block; font-size: 12px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; padding: 0 6px; margin-left: 6px; }

.progress { display: flex; margin: 8px 0 4px; }
.progress span { flex: 1; text-align: center; font-size: 12px; padding: 6px 2px; background: var(--line-2); color: var(--ink-3); border-right: 2px solid #fff; }
.progress span.done { background: #c9dbec; color: var(--brand-ink); }
.progress span.now { background: var(--brand); color: #fff; font-weight: 700; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.callout { border-left: 4px solid var(--orange); background: var(--orange-tint); padding: 10px 12px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 12px; }
.callout.red { border-left-color: var(--red); background: var(--red-tint); }
.callout.blue { border-left-color: var(--brand); background: var(--brand-tint); }

/* 附件 */
.media-list { display: flex; flex-wrap: wrap; gap: 8px; }
.media-list .m { width: 120px; font-size: 12px; color: var(--ink-2); }
.media-list img, .media-list video { width: 120px; height: 90px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: #000; display: block; }
.media-list audio { width: 240px; }
.media-list .doc { display: flex; align-items: center; justify-content: center; width: 120px; height: 90px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fa; font-weight: 700; }
.locked { padding: 12px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); background: #fafbfc; }

/* 提示與對話框 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius); z-index: 100; max-width: 90vw; }
.toast.error { background: var(--red); }
.modal-back { position: fixed; inset: 0; background: rgba(31, 42, 51, .45); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.modal { background: var(--panel); border-radius: 8px; width: min(640px, 100%); max-height: 90vh; overflow: auto; padding: 20px; }
.modal.wide { width: min(980px, 100%); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* 手機版頁面 */
.mobile { max-width: 560px; margin: 0 auto; padding: 12px 12px 40px; }
.mobile .head { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 12px; }
.mobile .head .who { font-size: 13px; color: var(--ink-2); }
.eq-card { background: var(--ink); color: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; }
.eq-card .no { font-size: 24px; font-weight: 700; letter-spacing: .02em; }
.eq-card .meta { color: #c7d3dc; font-size: 14px; }
.stack > * + * { margin-top: 10px; }
.scan-box { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 1 / 1; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-box .frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px; }
.sign-pad { width: 100%; height: 180px; border: 1px dashed var(--ink-3); border-radius: var(--radius); background: #fff; touch-action: none; display: block; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chips span { background: var(--line-2); border-radius: 3px; padding: 2px 8px; font-size: 13px; }
.file-chips button { border: 0; background: none; color: var(--red); cursor: pointer; font-weight: 700; }

/* 登入頁 */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side .title { font-size: 30px; font-weight: 700; line-height: 1.3; }
.login-side .sub { color: #b8c6d1; margin-top: 12px; max-width: 420px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form form { width: min(360px, 100%); }
.demo-accounts { margin-top: 24px; font-size: 13px; }
.demo-accounts button { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 2px 0; font: inherit; }
@media (max-width: 800px) { .login-wrap { grid-template-columns: 1fr; } .login-side { padding: 24px; } .login-side .title { font-size: 22px; } }
@media print { .topbar, .no-print { display: none !important; } body { background: #fff; } }

/* ===== 手機頁：照簡報畫面示意，簡潔乾淨 ===== */
body.m-body { background: var(--bg); }
.m-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--panel); display: flex; flex-direction: column; }
.m-bar { background: var(--brand); color: #fff; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 10; }
.m-bar h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: .04em; flex: 1; }
.m-bar .m-menu { background: none; border: 0; color: #fff; font-size: 22px; line-height: 1; padding: 6px; cursor: pointer; }
.m-body-area { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.m-title { font-size: 30px; font-weight: 700; letter-spacing: .01em; margin: 0 0 6px; color: var(--ink); }
.m-sub { color: var(--ink-2); font-size: 16px; line-height: 1.7; }
.m-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 14px; }
.m-chip { display: inline-block; padding: 6px 16px; border-radius: 999px; font-size: 15px; font-weight: 700; background: var(--bg); color: var(--ink-2); }
.m-chip.green { background: var(--green-tint); color: var(--green); }
.m-chip.red { background: var(--red-tint); color: var(--red); }
.m-chip.amber { background: var(--orange-tint); color: var(--yellow); }
.m-chip.teal { background: var(--brand-tint); color: var(--brand); }
.m-rows { margin: 0; }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line);
  font-size: 16px; color: var(--ink); text-decoration: none; }
.m-row .k { color: var(--ink-2); white-space: nowrap; }
.m-row .v { font-weight: 700; text-align: right; }
a.m-row:hover { text-decoration: none; background: #fafcfc; }
a.m-row .v { color: var(--brand); }
.m-actions { margin-top: auto; padding-top: 28px; display: grid; gap: 12px; }
.m-btn { display: flex; align-items: center; justify-content: center; min-height: 60px; border-radius: 10px; border: 0; font: inherit;
  font-size: 20px; font-weight: 700; letter-spacing: .06em; cursor: pointer; text-decoration: none; color: #fff; background: var(--brand); }
.m-btn:hover { text-decoration: none; filter: brightness(.95); }
.m-btn.red { background: var(--red); }
.m-btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); font-size: 17px; min-height: 52px; }
.m-btn.ghost.red { color: var(--red); border-color: var(--red); background: #fff; }
.m-btn[disabled] { opacity: .5; cursor: not-allowed; }
.m-note { font-size: 14px; color: var(--ink-2); background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-top: 12px; }
.m-note.warn { background: var(--orange-tint); color: #6b4a00; }
.m-note.err { background: var(--red-tint); color: var(--red); }

/* ===== 登入頁：置中一個框 ===== */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--panel); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(28,43,51,.06), 0 8px 28px rgba(28,43,51,.08); }
.auth-card .auth-bar { background: var(--brand); color: #fff; padding: 18px 24px; }
.auth-card .auth-bar .t { font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.auth-card .auth-bar .s { font-size: 13px; color: #cfe9e6; margin-top: 2px; }
.auth-card form { padding: 24px; }
.auth-foot { margin-top: 20px; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12px; }
.auth-foot img { height: 14px; opacity: .8; }
.demo-toggle { background: none; border: 0; color: var(--brand); font: inherit; font-size: 14px; cursor: pointer; padding: 12px 0 0; }
.demo-list { margin-top: 8px; }
.demo-list .m-row { padding: 10px 0; font-size: 14px; cursor: pointer; }
.demo-list .grp { font-size: 12px; color: var(--ink-3); margin-top: 12px; }

/* ===== 步驟清單（簡報第 10 頁） ===== */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 16px; }
.steps li:last-child { border-bottom: 0; }
.steps .mk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.steps li.done .mk { background: var(--brand); border-color: var(--brand); }
.steps li.done .mk::after { content: "✓"; }
.steps li.now .mk { border-color: var(--orange); }
.steps li.now .mk::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.steps li.skip { color: var(--ink-3); }
.steps .lbl { flex: 1; }
.steps .st { font-size: 14px; color: var(--ink-3); }
.steps li.done .st { color: var(--brand); }
.steps li.now .st { color: var(--yellow); font-weight: 700; }

/* ===== 卡片清單 ===== */
.m-card { display: block; border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; background: #fff; color: var(--ink); text-decoration: none; }
a.m-card:hover { text-decoration: none; border-color: var(--line); background: #fbfdfd; }
.m-card + .m-card { margin-top: 10px; }
.m-card .top { display: flex; align-items: center; gap: 8px; }
.m-card .no { font-weight: 700; font-size: 16px; }
.m-card .meta { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.m-section { margin-top: 22px; }
.m-section > h2 { font-size: 15px; color: var(--ink-2); font-weight: 700; margin: 0 0 6px; letter-spacing: .04em; }
.m-hero { background: var(--ink); color: #fff; border-radius: 12px; padding: 16px; }
.m-hero .no { font-size: 24px; font-weight: 700; }
.m-hero .meta { color: #c3ccd2; font-size: 14px; }

/* ===== 報修表單 ===== */
.chip-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-choice label { cursor: pointer; }
.chip-choice input { position: absolute; opacity: 0; pointer-events: none; }
.chip-choice span { display: inline-block; padding: 8px 18px; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-weight: 700; font-size: 15px; border: 1.5px solid transparent; }
.chip-choice input:checked + span { background: var(--red); color: #fff; }
.chip-choice input:focus-visible + span { border-color: var(--brand); }
.chip-choice.teal input:checked + span { background: var(--brand); }
.tiles-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 84px; border-radius: 10px;
  background: var(--brand-tint); color: var(--brand); border: 0; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.tile-btn svg { width: 26px; height: 26px; }
.tile-btn.rec { background: var(--red-tint); color: var(--red); }
.form-label { font-size: 15px; font-weight: 700; color: var(--ink); margin: 18px 0 8px; display: block; }

/* ===== 網頁提醒 ===== */
.alert-stack { position: fixed; top: 70px; right: 16px; z-index: 120; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.alert-card { background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(28,43,51,.22); border-left: 6px solid var(--brand); padding: 12px 14px; }
.alert-card.urgent { border-left-color: var(--red); animation: pulse 1.2s ease-in-out infinite; }
.alert-card .msg { font-weight: 700; }
.alert-card .acts { display: flex; gap: 8px; margin-top: 8px; }
@keyframes pulse { 50% { box-shadow: 0 10px 30px rgba(214,69,69,.45); } }
@media (prefers-reduced-motion: reduce) { .alert-card.urgent { animation: none; } }
.alert-enable { display: block; width: 100%; border: 0; background: var(--orange-tint); color: #6b4a00; font: inherit; font-size: 14px;
  font-weight: 700; padding: 10px 16px; cursor: pointer; text-align: left; }
.topbar .alert-enable { width: auto; border-radius: 6px; padding: 6px 10px; font-size: 13px; }

/* ===== 保養月曆 ===== */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); }
.cal .h { padding: 6px 8px; font-size: 13px; color: var(--ink-2); background: #f8fafb; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.cal .d { min-height: 96px; padding: 6px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); font-size: 12px; }
.cal .d.off { background: #fafbfb; }
.cal .d.other { opacity: .35; }
.cal .d.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal .num { font-weight: 700; font-size: 13px; }
.cal .hol { color: var(--red); font-size: 11px; }
.cal .mk-work { color: var(--brand); font-size: 11px; }
.cal .ev { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 4px; background: var(--brand-tint); color: var(--brand-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.proj { background: #fff; border: 1px dashed var(--brand); }
.cal .ev.done { background: var(--green-tint); color: var(--green); }
.cal .ev.ticketed { background: var(--orange-tint); color: #6b4a00; }
.narrow { max-width: 900px; margin: 0 auto; }

/* ===== 兩種版面：900px 以上為電腦版面 ===== */
.desk-only { display: none !important; }
@media (min-width: 900px) {
  .desk-only { display: revert !important; }
  .mobile-only { display: none !important; }

  /* 登入頁 A：頁首＋置中登入框＋頁尾 */
  .auth-page { padding: 0; justify-content: flex-start; }
  .auth-head { width: 100%; height: 58px; background: var(--ink); color: #fff; display: flex !important; align-items: center; gap: 12px; padding: 0 28px; font-weight: 700; letter-spacing: .03em; }
  .auth-head img { height: 22px; }
  .auth-head .sep { width: 1px; height: 20px; background: #3a4a52; }
  .auth-main { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
  .auth-card { width: 420px; }
  .auth-foot { width: 100%; justify-content: center; margin: 0; padding: 16px; border-top: 1px solid var(--line-2); background: #fff; }

  /* 現場用頁面在電腦上：左右兩欄 */
  .flow-page { max-width: 1200px; margin: 0 auto; padding: 24px; }
  .flow-page.single { max-width: 820px; }
  .dual { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: start; }
  .dual > .col-left { min-width: 0; }
  .flow-page .m-title { font-size: 34px; }
  .flow-page .m-actions { margin-top: 20px; padding-top: 0; }
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
  .card-grid > .m-card + .m-card { margin-top: 0; }
  .part-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
  .part-cards .m-row { border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; }
  .flow-page .m-section:first-child { margin-top: 0; }
  .flow-panel { background: #fff; border: 1px solid var(--line-2); border-radius: 14px; padding: 24px; }
}

/* 電腦頁面在手機上：選單收進 ☰、表格變卡片 */
.topbar .nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 6px; }
@media (max-width: 899px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar nav, .topbar .right > *:not(.nav-toggle) { display: none; }
  .topbar .nav-toggle { display: block; }
  .topbar .right { margin-left: auto; }
  .topbar .brand .sep, .topbar .brand img { display: none; }
  .page-head { align-items: flex-start; }
  table.data.cards thead { display: none; }
  table.data.cards, table.data.cards tbody, table.data.cards tr, table.data.cards td { display: block; width: 100%; }
  table.data.cards tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  table.data.cards td { border: 0; padding: 3px 14px; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  table.data.cards td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: left; flex: none; }
  table.data.cards td[data-label=""]::before { content: none; }
  .grid-2[style] { grid-template-columns: 1fr !important; }
}

/* 登入框不隨內容縮放：外層撐滿寬度再置中 */
.auth-main { width: 100%; display: flex; justify-content: center; }
.auth-card { max-width: 100%; }
/* iPhone 輸入框字小於 16px 時，點選會自動放大畫面 */
@media (max-width: 899px) {
  input[type=text], input[type=password], input[type=tel], input[type=date], input[type=datetime-local],
  input[type=number], input[type=search], select, textarea { font-size: 16px; }
}
