:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #647086;
  --line: #dfe5ee;
  --brand: #156f62;
  --brand-dark: #0c4e46;
  --accent: #c77a18;
  --danger: #b42318;
  --warn: #b35c00;
  --ok: #19714d;
  --soft: #eef7f5;
  --shadow: 0 10px 28px rgba(20, 34, 54, 0.09);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(12, 24, 36, 0.62), rgba(12, 24, 36, 0.7)),
    url("https://images.unsplash.com/photo-1581092160607-ee22621dd758?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.login-box {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.login-box p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 111, 98, 0.12);
}

.date-combo {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 8px;
  align-items: stretch;
  position: relative;
}

.date-combo input {
  margin: 0;
}

.date-pick-trigger {
  border-radius: 6px;
  background: #e8edf3;
  color: var(--ink);
  min-height: 42px;
  padding: 0 10px;
}

.date-hidden-picker {
  position: absolute;
  right: 0;
  top: 0;
  width: 74px;
  height: 42px;
  opacity: 0;
  pointer-events: none;
}

.btn {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--brand);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn.secondary {
  background: #e8edf3;
  color: var(--ink);
}

.btn.warn {
  background: var(--accent);
}

.btn.danger {
  background: var(--danger);
}

.btn.compact {
  min-height: 34px;
  padding: 0 10px;
}

.quick-users {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.quick-users button {
  min-height: 34px;
  border-radius: 6px;
  background: #edf3f1;
  color: var(--brand-dark);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.side {
  background: #172033;
  color: #f4f7fb;
  padding: 18px 14px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 18px;
}

.user-chip {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #dce5f0;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip strong {
  color: #fff;
  font-size: 15px;
  margin-bottom: 2px;
}

.user-chip span {
  color: #dce5f0;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  text-align: left;
  border-radius: 6px;
  padding: 10px;
  background: transparent;
  color: #dce5f0;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.main {
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
}

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

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

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

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

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

.panel {
  padding: 16px;
}

.card {
  padding: 14px;
}

.metric {
  display: grid;
  gap: 8px;
}

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

.metric strong {
  font-size: 28px;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  background: #f8fafc;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e9eef5;
  color: #344054;
  white-space: nowrap;
}

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

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

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

.route-row {
  display: grid;
  grid-template-columns: 100px minmax(180px, 1fr) 180px 210px 92px 72px 72px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.route-row:last-child {
  border-bottom: 0;
}

.route-row .compact {
  min-height: 34px;
  padding: 0 10px;
}

.employee-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) minmax(150px, 1fr) minmax(120px, 1fr) 76px 72px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.employee-row:last-child {
  border-bottom: 0;
}

.employee-row .compact {
  min-height: 34px;
  padding: 0 10px;
}

.add-route-row {
  display: grid;
  grid-template-columns: 180px 180px 210px 120px;
  gap: 10px;
  align-items: center;
  padding-top: 12px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e7ecf3;
  overflow: hidden;
}

.progress div {
  height: 100%;
  background: var(--brand);
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fff;
}

.check-pill input {
  width: auto;
}

.mobile-shell {
  min-height: 100vh;
  background: #eef2f6;
}

.phone {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: #f7f9fb;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.phone-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--brand-dark);
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.phone-head h1 {
  margin: 0;
  font-size: 18px;
}

.phone-logout {
  min-width: 76px;
  min-height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 13px;
  white-space: nowrap;
}

.phone-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.phone-tabs button {
  min-height: 36px;
  border-radius: 6px;
  background: #eef3f6;
  color: var(--ink);
}

.phone-tabs button.active {
  background: var(--brand);
  color: #fff;
}

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

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

.task-title h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

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

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

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.thumbs img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.empty {
  padding: 26px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #172033;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  z-index: 9;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: sticky;
    top: 0;
    z-index: 3;
  }

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

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .route-row {
    grid-template-columns: 1fr;
  }
}
