:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #687385;
  --line: #dde3ea;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --brand-soft: #e8f6f3;
  --danger: #b42318;
  --warn: #a15c07;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f6;
}

.login-panel {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 18px 50px rgba(23, 32, 42, 0.1);
}

.login-panel h1,
.header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.login-panel p {
  margin: 8px 0 18px;
  color: var(--muted);
}

.app {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  height: 100vh;
  min-height: 660px;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

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

.top-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.language-row {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.language-row.compact {
  margin-bottom: 0;
}

.language-button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.language-button.active {
  background: var(--panel);
  color: var(--brand-dark);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(23, 32, 42, 0.1);
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

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

.metric strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.metric span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab {
  height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.tab:last-child {
  border-right: 0;
}

.tab.active {
  color: var(--brand-dark);
  background: var(--panel);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--brand);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
}

.panel {
  display: none;
  min-height: 0;
  overflow: auto;
}

.panel.active {
  display: block;
}

.filters,
.form {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 11px;
  outline: none;
  background: #fff;
}

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea.input {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.coordinate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.item-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 38px;
}

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

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
}

.list {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.customer,
.submission {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 10px;
  text-align: left;
}

.customer {
  cursor: pointer;
}

.customer:hover,
.customer.active {
  background: var(--brand-soft);
  border-color: #b9e4dd;
}

.item-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
}

.item-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.submission {
  border-color: var(--line);
  background: #fbfcfd;
}

.submission-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.item-button {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.item-button.approve {
  border-color: #9ad7c9;
  color: var(--brand-dark);
}

.item-button.reject {
  border-color: #f0b4ae;
  color: var(--danger);
}

.error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}

.message {
  min-height: 20px;
  color: var(--brand-dark);
  font-size: 13px;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 660px;
}

.popup {
  min-width: 230px;
}

.popup h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  border-top: 1px solid #edf0f4;
  font-size: 13px;
}

.popup-row:first-of-type {
  border-top: 0;
}

.popup-row span:first-child {
  color: var(--muted);
  white-space: nowrap;
}

.popup-row span:last-child {
  text-align: right;
  font-weight: 600;
}

.popup input {
  width: 120px;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
}

.popup a {
  display: inline-block;
  margin-top: 10px;
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 42vh 58vh;
    min-height: 100vh;
    height: auto;
  }

  #map {
    grid-row: 1;
    min-height: 42vh;
  }

  .sidebar {
    grid-row: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
    min-height: 0;
  }

  .header {
    padding: 14px;
  }
}
