:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #64748b;
  --line: #d8e0e6;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.user-badge {
  padding: 8px 10px;
  border-radius: 6px;
  background: #eefbf8;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.login-panel {
  width: min(720px, 100%);
  margin: 48px auto 0;
}

.business-panel {
  width: min(760px, 100%);
  margin: 48px auto 0;
}

.user-admin-panel {
  display: grid;
  gap: 16px;
}

.profile-panel {
  display: grid;
  gap: 16px;
  width: min(920px, 100%);
  margin: 48px auto 0;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-grid > div,
.profile-form > div:first-child {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.profile-grid span {
  color: var(--muted);
  font-size: 13px;
}

.profile-grid strong {
  color: var(--ink);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.user-admin-form {
  display: grid;
  gap: 14px;
}

.user-table {
  min-width: 860px;
}

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

.business-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.business-card {
  display: grid;
  gap: 6px;
  min-height: 88px;
  padding: 16px 18px;
  text-align: left;
  align-content: center;
}

.business-card strong {
  font-size: 18px;
}

.business-card span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.layout,
.inner-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.25fr);
  gap: 20px;
  padding: 20px;
  align-items: start;
}

main {
  padding: 20px;
}

.wizard {
  display: grid;
  gap: 16px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.step {
  background: #e2e8f0;
  color: #334155;
}

.step.is-active {
  background: var(--accent);
  color: #ffffff;
}

.step-panel {
  display: grid;
  gap: 16px;
}

.step-panel h2,
.subform h3 {
  margin-bottom: 4px;
}

.subform {
  display: grid;
  gap: 14px;
  align-content: start;
  align-self: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.panel h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

form {
  display: grid;
  gap: 14px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
}

fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

legend {
  padding: 0 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.segmented-field {
  display: flex;
  align-items: center;
  gap: 16px;
}

.choice {
  display: inline-flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.choice input {
  width: auto;
}

.hazard-fields {
  display: grid;
  gap: 14px;
}

.hazard-fields[hidden] {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  background: #ffffff;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

textarea[readonly] {
  background: #f8fafc;
  color: #475569;
}

input[readonly] {
  background: #f8fafc;
  color: #475569;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  min-height: 0;
}

.photo-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

button,
.export-button {
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.record-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

.small-button {
  padding: 7px 10px;
  font-size: 13px;
}

.danger {
  background: #b91c1c;
}

.danger:hover {
  background: #991b1b;
}

button:hover,
.export-button:hover {
  background: var(--accent-strong);
}

button:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
}

.steps .step {
  background: #e2e8f0;
  color: #334155;
}

.steps .step.is-active {
  background: var(--accent);
  color: #ffffff;
}

.secondary {
  background: #e2e8f0;
  color: #334155;
}

.secondary-link {
  background: #334155;
}

.secondary-link:hover {
  background: #1f2937;
}

.secondary:hover {
  background: #cbd5e1;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-head > div:not(.actions) {
  display: grid;
  gap: 6px;
}

.section-head p {
  color: var(--muted);
  font-size: 14px;
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

.station-dashboard {
  display: grid;
  gap: 16px;
}

.station-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.station-filters .search-field {
  grid-column: span 2;
}

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

.station-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: #ffffff;
}

.catering-table {
  min-width: 1480px;
}

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

.station-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
  white-space: nowrap;
}

.select-head label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
}

.select-head input {
  width: auto;
}

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

.station-table tbody tr:hover,
.station-table tbody tr.is-selected {
  background: #eefbf8;
}

.station-table td:nth-child(4),
.station-table td:nth-child(5) {
  min-width: 180px;
}

.station-check {
  width: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.is-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.is-done {
  background: #dcfce7;
  color: #166534;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
  padding: 28px !important;
}

.file-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.records {
  display: grid;
  gap: 12px;
}

.record-card {
  display: grid;
  grid-template-columns: 36px 128px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sequence {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #e0f2f1;
  color: var(--accent-strong);
  font-weight: 800;
}

.record-photo {
  width: 128px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  background: #edf2f7;
}

.record-body {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.record-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.record-title-row h3 {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.record-title-row span {
  color: var(--warn);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.record-title-row .status-bad {
  color: var(--warn);
}

.meta,
.description,
.advice {
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
  overflow-wrap: anywhere;
}

.description {
  color: var(--ink);
}

.empty {
  color: var(--muted);
  padding: 28px;
  text-align: center;
  border: 1px dashed #b8c4cf;
  border-radius: 8px;
}

@media (max-width: 980px) {
  .layout,
  .inner-layout,
  .steps,
  .business-grid,
  .station-filters,
  .two,
  .three,
  .four,
  .five {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .topbar,
  .layout,
  .inner-layout,
  main {
    padding: 16px;
  }

  .record-card {
    grid-template-columns: 1fr;
  }

  .record-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }
}
