:root {
  color-scheme: light;
  --bg: #f4f4f3;
  --panel: #ffffff;
  --text: #151716;
  --muted: #717976;
  --line: #e6e7e4;
  --brand: #f05a28;
  --brand-dark: #c8431b;
  --ink: #101111;
  --soft: #f7f7f6;
  --danger: #8b2f38;
  --danger-bg: #fde6e7;
  --shadow: 0 18px 40px rgba(31, 35, 33, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border-radius: 28px;
  padding: 38px;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #ff2f1f, #f39a3d);
  font-weight: 900;
  font-size: 30px;
}

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

.auth-card h1 {
  margin-top: 24px;
  font-size: 30px;
}

.auth-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: #222;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  height: 52px;
  border-radius: 16px;
  color: #fff;
  background: var(--ink);
}

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

.form-error,
.notice {
  border-radius: 14px;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 12px 14px;
  font-weight: 700;
}

.dashboard-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
  padding-bottom: 56px;
}

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

.eyebrow {
  color: var(--brand);
  display: block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
}

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

.ghost-button,
.danger-button {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 18px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

.danger-button {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: transparent;
}

.ghost-button.small {
  min-height: 34px;
  padding: 0 12px;
}

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

.stat-card,
.panel,
.detail-panel {
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 22px;
}

.stat-card span,
.stat-card small,
.user-cell small,
.map-row small,
.login-row small {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 38px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  font-size: 22px;
}

.panel-head.compact {
  align-items: center;
}

.date-input,
.search-input {
  max-width: 260px;
  height: 42px;
  border-radius: 999px;
  background: var(--soft);
}

.bar-chart {
  height: 220px;
  display: grid;
  grid-template-columns: repeat(14, minmax(20px, 1fr));
  gap: 10px;
  align-items: end;
}

.bar-item {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  width: 100%;
  height: 170px;
  border-radius: 999px;
  background: var(--soft);
  display: flex;
  align-items: end;
  overflow: hidden;
}

.bar-track i {
  display: block;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff2f1f, #f39a3d);
}

.users-panel {
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.user-cell {
  display: grid;
  gap: 4px;
}

.login-list,
.detail-section {
  display: grid;
  gap: 10px;
}

.login-row,
.map-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--soft);
}

.login-row div,
.map-row div {
  display: grid;
  gap: 4px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 96px;
  border-radius: 18px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
}

.small-empty {
  min-height: 54px;
}

.detail-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: min(460px, calc(100vw - 40px));
  padding: 24px;
  overflow: auto;
  z-index: 10;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-head h2 {
  font-size: 28px;
}

.detail-head p {
  color: var(--muted);
  margin-top: 4px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

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

.detail-grid div {
  padding: 14px;
  border-radius: 16px;
  background: var(--soft);
  display: grid;
  gap: 4px;
}

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

.detail-section {
  margin-top: 22px;
}

.detail-section h3 {
  font-size: 18px;
}

@media (max-width: 900px) {
  .dashboard-shell {
    padding: 18px;
  }

  .topbar,
  .panel-head.compact {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .date-input,
  .search-input {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .auth-card {
    padding: 26px;
    border-radius: 22px;
  }

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

  .stat-card strong {
    font-size: 30px;
  }

  .bar-chart {
    overflow-x: auto;
    grid-template-columns: repeat(14, 28px);
  }
}
