/* 後台介面細修（共用的對話框、提示、載入、焦點等樣式在 /assets/base.css；顏色一律用 base.css 的變數） */

/* ---------- 頂端列：標題｜快速搜尋｜通知｜帳號選單｜登出 ---------- */
.topbar .qs { margin-right: 4px; }
@media (max-width: 640px) {
  .topbar { gap: 2px; padding: 0 8px 0 6px; }
  .topbar h1 { font-size: 18px; margin: 0 4px; }
  .topbar .qs { margin-right: 0; }
  .topbar .user-menu { margin-left: 2px; }
  /* 手機：登出收在帳號選單裡（點頭像），頂端列留給標題 */
  .topbar .logout-btn { display: none; }
  /* 帳號選單改成貼齊左右的面板，放大字也不會超出畫面 */
  .user-pop { position: fixed; left: 8px; right: 8px; top: calc(env(safe-area-inset-top) + 58px); width: auto; max-width: none; max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; }
  .up-item { min-height: 46px; }
  .up-sec .seg button { min-height: 40px; }
}
@media (max-width: 640px) {
  html:is(.fs-l, .fs-xl) .user-pop { max-height: calc((100dvh - 24px) / var(--fs-zoom) - 58px); }
  html:is(.fs-l, .fs-xl) .bell-drop { max-height: calc((100dvh - 24px) / var(--fs-zoom) - 58px); }
}

/* ---------- 頁首工具列：手機上間距收一點 ---------- */
@media (max-width: 640px) {
  .page-head { gap: 8px; margin-bottom: 14px; }
}

/* ---------- 紀錄審核：footer 的「完成後自動開下一筆」提示 ---------- */
.modal-f .next-hint { align-self: center; margin-right: 4px; }
@media (max-width: 640px) { .modal-f .next-hint { width: 100%; text-align: center; order: -1; margin: 0; } }
.set-pane { max-width: 940px; } /* 設定表單不要拉得太寬，眼睛不用左右掃 */

/* ---------- 明細頁標題：標題至少留一段寬度，按鈕放不下就整組換到下一行，不會把標題擠成直排 ---------- */
.detail-head { align-items: flex-start; }
.detail-head > .icon-btn { margin-top: 2px; }
.detail-head > .grow { flex: 1 1 420px; min-width: min(100%, 340px); }
.detail-head .head-actions { gap: 8px; }
@media (max-width: 640px) {
  .detail-head .head-actions { width: 100%; }
  .detail-head .head-actions > .btn { flex: 1 1 auto; }
}

/* ---------- 派工排程（手機）：每筆派工變成一張小卡，不用左右捲動 ---------- */
@media (max-width: 640px) {
  .dispatch-tbl { min-width: 0 !important; }
  .dispatch-tbl, .dispatch-tbl tbody { display: block; }
  .dispatch-tbl tr {
    display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center;
    padding: 11px 16px; border-bottom: 1px solid var(--line-2);
  }
  .dispatch-tbl tr:last-child { border-bottom: 0; }
  .dispatch-tbl td { display: block; padding: 0 !important; border: 0; min-width: 0 !important; width: auto !important; }
  .dispatch-tbl .d-time { grid-column: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
  .dispatch-tbl .d-who { grid-column: 2; }
  .dispatch-tbl .d-st { grid-column: 3; grid-row: 1; justify-self: end; }
  .dispatch-tbl .col-main, .dispatch-tbl .d-task, .dispatch-tbl .d-rec { grid-column: 1 / -1; }
  .dispatch-tbl .d-task:empty { display: none; }
  .dispatch-tbl .d-rec { color: var(--muted); }
  .detail-head > .grow { flex: 1 1 0; min-width: 0; }
}

/* ---------- 系統設定：有尚未儲存的變更時，固定在畫面下方的儲存列 ---------- */
.save-bar {
  position: sticky; bottom: 14px; z-index: 30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 12px 10px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--brand-200); box-shadow: var(--shadow-toast);
  font-size: 14px; color: var(--ink); animation: save-bar-in .22s var(--ease-out);
}
.save-msg { flex: 1; min-width: 10em; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.save-msg > svg { color: var(--amber); flex: none; }
@keyframes save-bar-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tabs .dirty-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--warn-fill); vertical-align: 2px; }
@media (max-width: 640px) {
  .save-bar { bottom: calc(8px + env(safe-area-inset-bottom)); padding: 10px 12px; }
  .save-msg { flex: 1 1 100%; font-size: 13.5px; }
  .save-bar > .btn { flex: 1 1 auto; min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) { .save-bar { animation: none; } }

/* 帳號選單裡的補充說明（例如「切換到顧問專區：填紀錄、看自己的行程」） */
.up-item .up-note { margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; }
