﻿:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #1a1a1a;
  background: #f6f7f9;
}
body { margin: 0; }
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #0f3d68;
  color: #fff;
}
.topbar a,
.topbar .nav-link {
  color: #dce9f5;
  text-decoration: none;
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.topbar .brand {
  font-weight: 700;
  color: #fff;
  justify-self: start;
}
.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  justify-self: center;
}
.topnav-logout {
  display: flex;
  justify-self: end;
  margin: 0;
}
.topnav-logout .nav-link { margin-top: 0; }
.topnav a {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  transition: background-color .12s ease, color .12s ease;
}
.topnav a:hover { color: #fff; background: rgba(255,255,255,.14); }
.topnav a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.topnav a.active {
  color: #0f3d68;
  background: #fff;
  font-weight: 600;
}
.topnav a.active:hover { color: #0f3d68; background: #fff; }
.container { max-width: 1400px; margin: 1.5rem auto; padding: 0 1rem; }
.card {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin-bottom: 1rem;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid #e8e8e8;
}
table.data-table {
  width: max-content;
  min-width: 100%;
}
table.data-table th,
table.data-table td {
  white-space: nowrap;
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
}
table.data-table th.col-time,
table.data-table td.col-time {
  width: 10.5rem;
  min-width: 10.5rem;
}
table.data-table th.col-type,
table.data-table td.col-type {
  width: 5.5rem;
  min-width: 5.5rem;
}
table.data-table td.col-delivery {
  max-width: 22rem;
  white-space: normal;
}
table.data-table th.col-summary,
table.data-table td.col-summary,
table.data-table th.col-error,
table.data-table td.col-error {
  width: 28rem;
  min-width: 18rem;
  max-width: 28rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
  line-height: 1.5;
  vertical-align: top;
}
table.data-table th.col-error,
table.data-table td.col-error {
  width: 24rem;
  max-width: 24rem;
}
.list-actions {
  display: inline-flex;
  gap: 0.65rem;
  align-items: center;
  white-space: nowrap;
}
a.sort-link {
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}
a.sort-link:hover { color: #0f3d68; text-decoration: underline; }
a.sort-link.is-active { color: #0f3d68; }
.sort-ind {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.75;
}
label { display: block; margin-top: 0.75rem; font-weight: 600; }
input, select, textarea {
  width: 100%; max-width: 480px;
  padding: 0.4rem 0.5rem;
  margin-top: 0.25rem;
}
input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  max-width: none;
  margin: 0;
  padding: 0;
  accent-color: #0f3d68;
  cursor: pointer;
  flex-shrink: 0;
}
label.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  max-width: none;
  margin-top: 1rem;
  margin-bottom: 0;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
button:not(.nav-link) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.4rem;
  min-width: 4.5rem;
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  background: #0f3d68;
  color: #fff;
  border: 1px solid #0a2f52;
  border-radius: 6px;
  box-shadow: 0 2px 0 #0a2f52;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}
button:not(.nav-link):hover {
  background: #154a7d;
}
button:not(.nav-link):active {
  transform: translateY(2px);
  box-shadow: none;
}
button:not(.nav-link):focus-visible {
  outline: 3px solid #7eb6ef;
  outline-offset: 2px;
}
button:not(.nav-link):disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
button.btn-secondary {
  background: #4a5d72;
  border-color: #3a4b5c;
  box-shadow: 0 2px 0 #3a4b5c;
}
button.btn-secondary:hover {
  background: #566c84;
}
button.btn-danger {
  background: #b42318;
  border-color: #912018;
  box-shadow: 0 2px 0 #912018;
}
button.btn-danger:hover {
  background: #c73528;
}
button.btn-outline {
  background: #fff;
  color: #0f3d68;
  border-color: #0f3d68;
  box-shadow: 0 2px 0 #c5d4e4;
}
button.btn-outline:hover {
  background: #eef4fa;
}
button.btn-outline:active {
  box-shadow: none;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.1rem;
}
.page-actions > form {
  display: inline;
  margin: 0;
  padding: 0;
}
.page-actions button {
  margin-top: 0;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.form-actions > form {
  display: inline;
  margin: 0;
  padding: 0;
}
.form-actions button {
  margin-top: 0;
}
.ui-modal[hidden] {
  display: none !important;
}
.ui-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 28, 40, 0.45);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ui-modal.is-open {
  display: flex !important;
}
.ui-modal-dialog {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  padding: 1.25rem 1.35rem 1.35rem;
}
.ui-modal-dialog h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}
.ui-modal-dialog p {
  margin: 0 0 0.75rem;
  line-height: 1.5;
}
.ui-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.1rem;
}
.ui-modal-actions .btn,
.ui-modal-actions button {
  margin-top: 0;
}
/* 相容舊頁面仍使用 a.btn 的情況 */
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  min-width: 4.5rem;
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  background: #0f3d68;
  color: #fff !important;
  border: 1px solid #0a2f52;
  border-radius: 6px;
  box-shadow: 0 2px 0 #0a2f52;
  cursor: pointer;
  text-decoration: none !important;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  box-sizing: border-box;
}
a.btn:hover { background: #154a7d; }
a.btn:active { transform: translateY(2px); box-shadow: none; }
a.btn.btn-secondary {
  background: #4a5d72;
  border-color: #3a4b5c;
  box-shadow: 0 2px 0 #3a4b5c;
}
a.btn.btn-outline {
  background: #fff;
  color: #0f3d68 !important;
  border-color: #0f3d68;
  box-shadow: 0 2px 0 #c5d4e4;
}
.modal-status {
  margin: 0.5rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  background: #f0f7f4;
  border: 1px solid #c5e0d4;
  white-space: pre-wrap;
  word-break: break-word;
}
.modal-status.is-error {
  background: #fff0f0;
  border-color: #ecc;
}
.modal-status.is-muted {
  background: #f5f7fa;
  border-color: #dde3ea;
  color: #555;
}
.delete-confirm-code {
  font-size: 1.5rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  margin: 0.75rem 0 1rem;
  padding: 0.65rem;
  background: #f5f7fa;
  border-radius: 6px;
}
#deleteConfirmInput {
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  font-size: 1.1rem;
}
.time-range {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
  max-width: 480px;
}
.time-range input[type="time"] {
  width: auto;
  max-width: 10rem;
  margin-top: 0;
}
.field-with-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  max-width: 720px;
}
.field-with-actions select {
  width: 100%;
  max-width: 480px;
  margin-top: 0;
}
.field-with-actions button {
  margin-top: 0;
}
.steps { margin: 0.5rem 0 1rem 1.25rem; line-height: 1.6; }
.notify-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  margin: 0.75rem 0 1rem;
  max-width: 900px;
}
@media (max-width: 720px) {
  .notify-pick { grid-template-columns: 1fr; }
}
.notify-pick-col h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.check-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e9ef;
  border-radius: 6px;
  max-height: 240px;
  overflow: auto;
}
.check-list .check-label {
  margin-top: 0;
  font-weight: 500;
}
.detail-table {
  width: 100%;
  max-width: 820px;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 0.25rem 0 0;
}
.detail-table th,
.detail-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: top;
  text-align: left;
}
.detail-table th {
  width: 10.5rem;
  color: #4a5563;
  font-weight: 600;
  white-space: nowrap;
}
.detail-table td {
  word-break: break-word;
}
.muted { color: #666; font-size: 0.9rem; }
.validation { color: #b00020; }
.ok { color: #0a7; }
.text-danger { color: #c62828; }
td.last-update-failed {
  color: #c62828;
  font-weight: 600;
}
table tr.row-warn-soon td { background: #fff4e0; }
table tr.row-warn-critical td { background: #ffe4e4; }
.schedule-help h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}
.schedule-help ul {
  margin: 0;
  padding-left: 1.25rem;
}
.schedule-help li { margin: 0.35rem 0; }
.schedule-help strong { color: #1a1a1a; }
