:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #eef4f8;
  --text: #1f2a37;
  --muted: #5f6f7d;
  --line: #d8e0e7;
  --accent: #1b6f8f;
  --accent-strong: #13546d;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #287046;
  --shadow: 0 12px 28px rgba(31, 42, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 92px;
  padding: 18px clamp(18px, 4vw, 48px);
  background: #123746;
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(18, 55, 70, 0.2);
}

.eyebrow {
  margin: 0 0 4px;
  color: #a7d4e2;
  font-size: 0.875rem;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  min-width: 68px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.link-button.primary {
  border-color: #9fd8ea;
  background: #d9f2fb;
  color: #123746;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.icon-button.danger {
  border-color: rgba(255, 211, 208, 0.58);
  color: #ffd3d0;
}

.icon-button.primary {
  border-color: #9fd8ea;
  background: #d9f2fb;
  color: #123746;
}

.icon-button.primary:hover,
.icon-button.primary:focus-visible {
  background: #ffffff;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-bar > div {
  min-height: 74px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-bar strong {
  display: block;
  font-size: 1.35rem;
  color: var(--accent-strong);
}

.status-bar span {
  color: var(--muted);
  font-size: 0.9rem;
}

.form-section {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.section-title p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #bcc8d2;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

input {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 111, 143, 0.16);
  outline: none;
}

input.invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.full-width {
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

.data-table thead th {
  background: var(--surface-soft);
  color: #274654;
  font-size: 0.9rem;
  white-space: nowrap;
}

.data-table tbody th {
  width: 24%;
  font-weight: 700;
}

.data-table td input {
  min-width: 92px;
}

.data-table tfoot th,
.data-table tfoot td {
  background: #f8fbfc;
  color: var(--accent-strong);
  font-weight: 800;
}

.issues-section {
  border-color: #c7d6df;
}

.issues-list {
  margin: 0;
  padding-left: 22px;
}

.submit-result {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #9ecbb2;
  border-radius: 6px;
  background: #eef8f2;
  color: #195c35;
  font-weight: 700;
}

.issues-list li {
  margin: 8px 0;
}

.issues-list .empty {
  color: var(--ok);
}

.admin-table tbody tr {
  cursor: pointer;
}

.admin-table tbody tr:hover,
.admin-table tbody tr:focus-visible {
  background: #eef8f2;
  outline: none;
}

.detail-panel {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1f29;
  color: #e6f2f5;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 8px;
  background: #123746;
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(18, 55, 70, 0.26);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .app-header,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .status-bar,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .form-section {
    padding: 16px;
  }
}

@media print {
  .app-header,
  .toast {
    position: static;
  }

  .header-actions {
    display: none;
  }

  body {
    background: #ffffff;
  }

  .page-shell {
    width: 100%;
    margin: 0;
  }

  .form-section,
  .status-bar > div {
    box-shadow: none;
    break-inside: avoid;
  }
}
