/* ===== 灰白色主题变量 ===== */
:root {
  --color-bg: #f5f5f5;
  --color-bg-alt: #ebebeb;
  --color-surface: #ffffff;
  --color-border: #d4d4d4;
  --color-text: #2d2d2d;
  --color-text-muted: #6b6b6b;
  --color-primary: #4a4a4a;
  --color-primary-hover: #333333;
  --color-accent: #5c5c5c;
  --color-success: #4a7c59;
  --color-error: #a94442;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-narrow {
  max-width: 440px;
}

.container-profile {
  max-width: 960px;
}

/* ===== Header ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-icon {
  font-size: 1.5rem;
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  text-decoration: none;
  color: var(--color-text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
  background: var(--color-bg);
}

.nav-logout-form {
  display: inline;
  margin-left: 0.25rem;
}

/* ===== Main ===== */
.main-content {
  flex: 1;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.hero-desc {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.hero-server-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.hero-server-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-server-ip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.server-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.server-status-dot.loading {
  background: var(--color-border);
}

.server-status-dot.online {
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.2);
}

.server-status-dot.offline {
  background: var(--color-error);
  box-shadow: 0 0 0 3px rgba(169, 68, 66, 0.2);
}

.hero-server-ip code {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-bg);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius);
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Sections ===== */
.section {
  padding: 3rem 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.section-desc {
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 2rem;
}

/* ===== Status Grid ===== */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.status-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.status-label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.status-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
}

.status-value.online {
  color: var(--color-success);
}

.status-value.offline {
  color: var(--color-error);
}

.status-value-sm {
  font-size: 1rem;
}

.status-motd {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 1rem;
  font-style: italic;
}

/* ===== Stats Charts ===== */
.stats-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.stats-tab {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.stats-tab:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.stats-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.stats-view {
  display: none;
}

.stats-view.active {
  display: block;
}

.stats-chart-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  height: 340px;
  box-shadow: var(--shadow-sm);
}

.stats-empty {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text-muted);
  gap: 0.5rem;
  padding: 2rem;
}

.stats-empty small {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.chart-placeholder-icon {
  font-size: 2.5rem;
}

/* ===== GitHub 风格热力图 ===== */
.gh-heatmap-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.gh-heatmap {
  position: relative;
  width: 100%;
  --gh-weeks: 52;
  --gh-gap: 4px;
  --gh-grid-height: 238px;
}

.gh-heatmap-tooltip {
  position: absolute;
  z-index: 5;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  background: #24292f;
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gh-heatmap-tooltip[hidden] {
  display: none;
}

.gh-heatmap-months {
  display: grid;
  grid-template-columns: repeat(var(--gh-weeks), 1fr);
  gap: var(--gh-gap);
  margin-left: 2.5rem;
  margin-bottom: 0.5rem;
  min-height: 1rem;
}

.gh-month-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.gh-heatmap-body {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}

.gh-heatmap-daylabels {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: var(--gh-gap);
  width: 2.5rem;
  height: var(--gh-grid-height);
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.gh-heatmap-daylabels span {
  display: flex;
  align-items: center;
  line-height: 1;
  white-space: nowrap;
}

.gh-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(var(--gh-weeks), 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: var(--gh-gap);
  flex: 1;
  height: var(--gh-grid-height);
  min-width: 0;
}

.gh-cell {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  display: block;
  cursor: default;
  transition: outline 0.15s;
}

.gh-heatmap-grid .gh-cell[data-date]:hover {
  outline: 1px solid rgba(27, 31, 35, 0.35);
  outline-offset: 1px;
}

.gh-level-0 {
  background: #ebedf0;
}

.gh-level-1 {
  background: #9be9a8;
}

.gh-level-2 {
  background: #40c463;
}

.gh-level-3 {
  background: #30a14e;
}

.gh-level-4 {
  background: #216e39;
}

.gh-cell-empty {
  background: #ebedf0;
}

.gh-heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.gh-heatmap-legend .gh-cell {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: default;
}

.gh-heatmap-legend .gh-cell:hover {
  outline: none;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-bg-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}

.btn-danger:hover {
  background: #8b3634;
}

.btn-block {
  width: 100%;
}

/* ===== Auth ===== */
.auth-section {
  padding: 3rem 0;
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.auth-footer a {
  color: var(--color-primary);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ===== Forms ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.form-group input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--color-bg);
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ===== Alerts ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: #fdf0f0;
  color: var(--color-error);
  border: 1px solid #f0c0c0;
}

.alert-success {
  background: #f0f7f2;
  color: var(--color-success);
  border: 1px solid #c0dcc8;
}

/* ===== Profile ===== */
.profile-section {
  padding-top: 2rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.profile-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 76px;
}

.profile-sidebar-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 1.25rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.profile-sidebar-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.profile-avatar-text {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
}

.profile-name {
  font-size: 1rem;
  font-weight: 600;
  word-break: break-all;
}

.profile-meta {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  word-break: break-all;
}

.profile-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.profile-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.profile-nav-item:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.profile-nav-item.active {
  background: var(--color-bg-alt);
  color: var(--color-text);
  font-weight: 500;
}

.profile-main {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  min-height: 400px;
}

.profile-panel-section {
  display: none;
}

.profile-panel-section.active {
  display: block;
}

.profile-panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.profile-panel-desc {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.profile-overview {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-overview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--color-border);
}

.profile-overview-item:last-child {
  border-bottom: none;
}

.profile-overview-label {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.profile-overview-value {
  font-weight: 500;
  font-size: 0.9rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
}

.profile-settings-group {
  margin-bottom: 0.5rem;
}

.profile-settings-subtitle {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.profile-settings-divider {
  height: 1px;
  background: var(--color-border);
  margin: 1.75rem 0;
}

/* ===== Error Pages ===== */
.error-section {
  text-align: center;
  padding: 5rem 0;
}

.error-code {
  font-size: 5rem;
  font-weight: 700;
  color: var(--color-border);
  line-height: 1;
}

.error-message {
  font-size: 1.25rem;
  color: var(--color-text-muted);
  margin: 1rem 0 2rem;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer-server {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer-server code,
.server-ip {
  background: var(--color-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* ===== Admin ===== */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.admin-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 1rem;
}

.admin-sidebar-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.admin-sidebar-user {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-nav-item {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.admin-main {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.admin-panel-title {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.admin-panel-desc {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.admin-form-section {
  margin-bottom: 1.5rem;
}

.admin-form-subtitle {
  font-size: 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.admin-form-divider {
  height: 1px;
  background: var(--color-border);
  margin: 1.75rem 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.radio-group {
  display: flex;
  gap: 1.25rem;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

.admin-logo-preview {
  height: 36px;
  vertical-align: middle;
  margin-left: 0.5rem;
  border-radius: 4px;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

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

.admin-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-ban-form {
  flex-wrap: wrap;
}

.admin-ban-input {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  min-width: 140px;
}

.admin-ban-reason {
  display: block;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
}

.admin-muted {
  color: var(--color-text-muted);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(74, 124, 89, 0.15);
  color: var(--color-success);
}

.badge-danger {
  background: rgba(169, 68, 66, 0.12);
  color: var(--color-error);
}

.footer-extra {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero-title {
    font-size: 1.75rem;
  }

  .hero-server-ip code {
    font-size: 1.1rem;
  }

  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 0;
    gap: 0.5rem;
  }

  .gh-heatmap-wrap {
    overflow-x: auto;
  }

  .gh-heatmap {
    --gh-grid-height: 154px;
    --gh-gap: 3px;
    min-width: 640px;
  }

  .gh-heatmap-daylabels {
    width: 2.1rem;
    font-size: 0.65rem;
  }

  .gh-heatmap-months {
    margin-left: 2.1rem;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-sidebar {
    position: static;
  }

  .profile-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .profile-nav-item {
    flex: 1 1 auto;
    text-align: center;
    min-width: calc(50% - 0.25rem);
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

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