/* 布局样式文件：负责后台整体排版和页面骨架布局。 */
:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top, rgba(190, 165, 92, 0.10), transparent 32%),
    linear-gradient(135deg, #06121b 0%, #08131c 42%, #03100f 100%);
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: transparent;
  color: #e6edf3;
  overflow-x: hidden;
}

a,
button,
input,
select {
  font: inherit;
  box-sizing: border-box;
  max-width: 100%;
}

input,
select,
button {
  width: auto;
}

.mobile-header,
.mobile-nav-backdrop {
  display: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(8, 18, 28, 0.96), rgba(4, 12, 18, 0.92)),
    rgba(4, 12, 18, 0.88);
  border-right: 1px solid rgba(197, 168, 92, 0.18);
  backdrop-filter: blur(24px);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-brand {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.sidebar-brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(216, 186, 102, 0.9), rgba(104, 188, 153, 0.36));
  color: #041015;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.sidebar-eyebrow {
  margin: 0 0 6px;
  color: rgba(198, 214, 227, 0.62);
  font-size: 12px;
  letter-spacing: 0.24em;
}

.sidebar h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.sidebar a {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: rgba(226, 236, 243, 0.84);
  font-size: 14px;
  text-decoration: none;
  transition:
    transform 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.sidebar a::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f4d47c, #63c7a0);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 180ms ease, transform 180ms ease;
}

.sidebar a:hover,
.sidebar a.is-active {
  color: #f7fbff;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(197, 168, 92, 0.24);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  transform: translateX(4px);
}

.sidebar a:hover::before,
.sidebar a.is-active::before {
  opacity: 1;
  transform: scaleY(1);
}

.content {
  padding: 30px 34px;
  min-width: 0;
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .content {
    padding: 26px 24px 32px 22px;
  }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.metric-card {
  background: rgba(12, 26, 38, 0.72);
  border: 1px solid rgba(151, 174, 192, 0.18);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
}

.logout-form {
  margin-top: auto;
  padding-top: 18px;
}

.logout-button,
button {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(197, 168, 92, 0.22);
  background: linear-gradient(135deg, #0d7f66, #135f74);
  color: #f6fbff;
  box-shadow: 0 14px 30px rgba(6, 19, 28, 0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.logout-button {
  width: 100%;
  min-height: 44px;
  border-color: rgba(197, 168, 92, 0.16);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(235, 243, 248, 0.92);
  box-shadow: none;
}

.logout-button:hover,
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.28);
  filter: brightness(1.05);
}

.logout-button:hover {
  border-color: rgba(197, 168, 92, 0.22);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.logout-button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
.sidebar a:focus-visible {
  outline: 2px solid rgba(235, 202, 112, 0.86);
  outline-offset: 2px;
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: 60vh;
}

.login-form {
  width: min(420px, 100%);
}

.login-error {
  color: #ff9f8f;
  margin-bottom: 12px;
}

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

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(197, 168, 92, 0.18);
  }
}

@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 12px 16px;
    background: rgba(6, 17, 25, 0.92);
    border-bottom: 1px solid rgba(197, 168, 92, 0.16);
    backdrop-filter: blur(24px);
  }

  .mobile-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mobile-header-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(216, 186, 102, 0.9), rgba(104, 188, 153, 0.36));
    color: #041015;
    font-weight: 800;
    letter-spacing: 0.08em;
  }

  .mobile-header-title {
    min-width: 0;
    color: #f4f8fb;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-nav-toggle {
    display: inline-grid;
    gap: 4px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    place-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
  }

  .mobile-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #f5fafc;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(2, 8, 12, 0.54);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .app-shell {
    display: block;
    min-height: calc(100vh - 64px);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
    width: min(86vw, 320px);
    min-height: 100vh;
    border-right: 1px solid rgba(197, 168, 92, 0.18);
    border-bottom: 0;
    transform: translateX(-104%);
    transition: transform 200ms ease;
  }

  .content {
    padding: 16px;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 18px;
  }

  .page-header h2 {
    font-size: 24px;
  }
}

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