:root {
  color: #18201c;
  background: #f4f6f3;
  font-family: "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #18201c;
  --muted: #67716b;
  --line: #dce2dd;
  --surface: #ffffff;
  --green: #176b4c;
  --green-soft: #e5f2eb;
  --red: #b9474f;
  --red-soft: #f8e8e9;
  --blue: #3476a7;
  --gold: #b98728;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f4f6f3;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 28px 20px;
  background:
    linear-gradient(#dfe5e0 1px, transparent 1px),
    linear-gradient(90deg, #dfe5e0 1px, transparent 1px),
    #f4f6f3;
  background-size: 36px 36px;
}

.login-panel {
  width: min(100%, 380px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 55px rgba(23, 45, 33, 0.1);
  animation: enter 360ms ease-out both;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 62px;
  place-items: center;
  border: 1px solid #cbd5cd;
  border-bottom: 4px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--green);
  font-family: "Noto Serif SC", "SimSun", serif;
  font-size: 25px;
  font-weight: 700;
  box-shadow: 0 5px 0 #dfe6e1;
}

.brand-mark-small {
  width: 38px;
  height: 43px;
  border-bottom-width: 3px;
  font-size: 18px;
  box-shadow: 0 3px 0 #dfe6e1;
}

.eyebrow {
  margin: 24px 0 7px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: 31px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.25;
}

.login-status {
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 14px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #46514b;
  font-size: 13px;
  font-weight: 600;
}

input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid #cbd4cd;
  border-radius: 5px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 76, 0.13);
}

.form-error {
  min-height: 20px;
  margin: 8px 0;
  color: var(--red);
  font-size: 12px;
}

.primary-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 5px;
  background: var(--green);
  color: white;
  font-weight: 700;
  transition: background 160ms ease, transform 160ms ease;
}

.primary-button:hover {
  background: #11583e;
}

.primary-button:active {
  transform: translateY(1px);
}

.dashboard {
  min-height: 100vh;
}

.topbar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 10px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

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

.service-state {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
}

.service-state i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.service-state.online i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(23, 107, 76, 0.11);
}

.service-state.offline i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(185, 71, 79, 0.11);
}

.quiet-button {
  min-width: 58px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #3d4942;
  font-size: 13px;
  transition: border-color 160ms ease, background 160ms ease;
}

.quiet-button:hover {
  border-color: #b8c4bb;
  background: #f7f9f7;
}

.quiet-button.loading {
  animation: pulse 800ms ease-in-out infinite alternate;
}

main {
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  padding: 30px 0 56px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.summary-item {
  position: relative;
  min-height: 116px;
  padding: 22px 25px;
}

.summary-item + .summary-item {
  border-left: 1px solid var(--line);
}

.summary-item span,
.summary-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-item strong {
  display: inline-block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
}

.summary-item small {
  display: inline-block;
  margin-left: 6px;
}

.summary-upload strong {
  color: var(--blue);
}

.summary-download strong {
  color: var(--green);
}

.error-banner {
  margin-top: 18px;
  padding: 11px 14px;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  color: #7d3036;
  font-size: 13px;
}

.traffic-section,
.users-section {
  padding-top: 38px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading .eyebrow {
  margin: 0 0 5px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 17px;
  height: 3px;
  border-radius: 2px;
}

.legend-upload {
  background: var(--blue);
}

.legend-download {
  background: var(--green);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 230px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

#traffic-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: #849087;
  font-size: 13px;
}

.updated-at {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.table-shell {
  overflow-x: auto;
  border-top: 1px solid #cfd8d1;
  border-bottom: 1px solid #cfd8d1;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #e4e9e5;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #6a756e;
  font-size: 11px;
  font-weight: 700;
}

td {
  color: #354139;
  font-size: 13px;
}

tbody tr {
  animation: row-in 280ms ease-out both;
  transition: background 150ms ease;
}

tbody tr:hover {
  background: #f7faf7;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 700;
}

.tile-avatar {
  display: grid;
  width: 34px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #cbd5cd;
  border-bottom: 3px solid #92a79a;
  border-radius: 5px;
  background: #fff;
  color: var(--green);
  font-family: "Noto Serif SC", "SimSun", serif;
  font-size: 11px;
  font-style: normal;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 62px;
  color: #6b756f;
}

.status-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aab2ad;
  content: "";
}

.status-badge.online {
  color: var(--green);
  font-weight: 700;
}

.status-badge.online::before {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 76, 0.1);
}

.upload-value {
  color: var(--blue);
}

.download-value {
  color: var(--green);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    padding: 11px 16px;
  }

  .brand small,
  .service-state span {
    display: none;
  }

  .service-state {
    margin: 14px 4px 0 0;
  }

  main {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

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

  .summary-item {
    min-height: 100px;
    padding: 18px;
  }

  .summary-item:nth-child(3) {
    border-left: 0;
  }

  .summary-item:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .summary-item strong {
    font-size: 23px;
  }

  .chart-wrap {
    height: 190px;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
  }

  tbody tr:last-child {
    border-bottom: 0;
  }

  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 4px;
    border: 0;
    white-space: normal;
  }

  td::before {
    color: var(--muted);
    font-size: 11px;
    content: attr(data-label);
  }

  td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 13px;
    border-bottom: 1px solid #e7ebe8;
  }

  td:first-child::before {
    display: none;
  }
}

@media (max-width: 470px) {
  .login-panel {
    padding: 30px 24px;
  }

  .quiet-button {
    min-width: 48px;
    padding: 0 9px;
  }

  .brand strong {
    font-size: 14px;
  }

  .summary-item {
    min-height: 94px;
    padding: 15px;
  }

  .summary-item strong {
    font-size: 20px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .users-heading {
    flex-direction: row;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
