:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ef;
  --brand: #1f4e79;
  --brand-2: #2f7a67;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #027a48;
  --soft: #eef4ff;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 16px auto 40px;
}

.mobile-page {
  width: min(680px, calc(100% - 24px));
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.field small {
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8d3e1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 9px 10px;
  min-height: 40px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #c8d3e1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.success {
  border-color: var(--brand-2);
  background: var(--brand-2);
  color: #fff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  display: none;
}

.status.show {
  display: block;
}

.status.ok {
  background: #ecfdf3;
  border-color: #abefc6;
  color: var(--ok);
}

.status.error {
  background: #fef3f2;
  border-color: #fecdca;
  color: var(--danger);
}

.location-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px dashed #9fb2c8;
  border-radius: 8px;
  background: #fbfdff;
}

.location-box div {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.photo-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  display: none;
}

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

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

.metric.warn .metric-value {
  color: var(--warn);
}

.metric.ok .metric-value {
  color: var(--ok);
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 7px 10px;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #eef4ff;
  color: #1f4e79;
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f6;
  color: #344054;
}

.tag.red {
  background: #fef3f2;
  color: var(--danger);
}

.tag.yellow {
  background: #fffaeb;
  color: var(--warn);
}

.tag.green {
  background: #ecfdf3;
  color: var(--ok);
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid,
  .grid-3,
  .cards,
  .location-box {
    grid-template-columns: 1fr;
  }

  .nav-actions {
    width: 100%;
  }

  .button {
    flex: 1;
  }
}
