:root {
  --bg: #f7f3ee;
  --ink: #1a1410;
  --muted: #5c534c;
  --accent: #6b2d3c;
  --border: #ddd4c8;
  --card: #fffdf9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.admin-header {
  background: #2a1814;
  color: #f7f3ee;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-family: "Noto Serif TC", serif;
}

.admin-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-nav a,
.admin-nav button {
  font-size: 0.85rem;
}

.admin-nav a {
  color: #e8d5d9;
}

.admin-nav button {
  margin-left: 0.75rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #f7f3ee;
  padding: 0.35rem 0.65rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-family: "Noto Serif TC", serif;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

input[type="password"],
select {
  display: block;
  width: 100%;
  max-width: 20rem;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font: inherit;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.error {
  color: #9b1c1c;
  font-size: 0.9rem;
}

.stats-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.stats-table th,
.stats-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.4rem;
  text-align: left;
  vertical-align: top;
}

.stats-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
}

.stats-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-table a {
  color: var(--accent);
}

.stats-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.referrer-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.referrer-list li {
  margin-bottom: 0.2rem;
}

.daily-block {
  margin-top: 1.25rem;
}

.daily-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.legend-note {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}

.site-total {
  margin-bottom: 1.25rem;
}

.site-total-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.site-total-grid div {
  background: #faf6f0;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.75rem;
}

.site-total-grid strong {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.site-total-grid span {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .stats-table {
    font-size: 0.8rem;
  }

  .stats-table th:nth-child(n+3),
  .stats-table td:nth-child(n+3) {
    display: none;
  }
}
