:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #dce3ee;
  --blue: #2167d8;
  --blue-dark: #174ea6;
  --green: #17844b;
  --red: #c43d3d;
  --amber: #a86612;
  --shadow: 0 8px 24px rgba(24, 39, 75, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

h1 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f9;
}

.tab {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(24, 39, 75, 0.08);
}

main {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 14px 12px 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.panel-title {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

.select-button {
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  text-align: center;
  cursor: pointer;
}

.select-button.active,
.select-button:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(33, 103, 216, 0.14);
}

.person-list {
  display: grid;
  gap: 10px;
}

.person-report {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.person-name {
  padding-top: 8px;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.person-fields {
  min-width: 0;
}

.phone-line + .phone-line {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.phone-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  align-items: center;
}

.phone-control .phone-number {
  min-width: 0;
  margin: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.phone-control .choice-row {
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.phone-control .choice {
  min-height: 38px;
  border-radius: 6px;
  font-size: 14px;
}

.department-submit-row {
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding-top: 10px;
  background: linear-gradient(to top, var(--panel) 78%, rgba(255, 255, 255, 0));
}

.department-submit-row .submit {
  width: 100%;
}

.submit:disabled {
  background: #aeb9c9;
  cursor: not-allowed;
}

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

.selected-person {
  font-size: 18px;
  font-weight: 700;
}

.ghost,
.primary,
.submit {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.ghost {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary,
.submit {
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.primary:hover,
.submit:hover {
  background: var(--blue-dark);
}

.phone-list {
  display: grid;
  gap: 12px;
}

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

.phone-number {
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 700;
}

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

.choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice.accept.active {
  border-color: var(--green);
  background: #eaf7ef;
  color: var(--green);
}

.choice.reject.active {
  border-color: var(--red);
  background: #fff0f0;
  color: var(--red);
}

.reason {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

.submit-row {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  background: linear-gradient(to top, var(--bg) 72%, rgba(245, 247, 251, 0));
}

.submit {
  width: 100%;
  max-width: none;
}

.admin-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-date {
  font-size: 20px;
  font-weight: 700;
}

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

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-name {
  font-weight: 700;
}

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

.status-pill {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef3f9;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s ease;
}

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

@media (max-width: 720px) {
  .topbar {
    display: block;
  }

  .tabs {
    width: 100%;
    margin-top: 14px;
  }

  .tab {
    flex: 1;
  }

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

  .admin-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .primary {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .person-report {
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .phone-control {
    grid-template-columns: 1fr;
  }

  .phone-control .choice-row {
    width: 100%;
  }
}
