:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4d;
  --text: #e7edf5;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; }
.topbar nav a { margin-left: 1rem; }
.topbar-home .topbar-nav a { margin-left: 0; }

.topbar-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 顶栏用户下拉菜单 */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nav-dropdown-trigger:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.1);
}
.nav-dropdown-trigger:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}
.nav-dropdown-user {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-dropdown-caret {
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.nav-dropdown.is-open .nav-dropdown-caret {
  transform: rotate(180deg);
}
.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 11rem;
  padding: 0.35rem 0;
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 300;
}
.nav-dropdown-item {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.nav-dropdown-item:hover {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  text-decoration: none;
}
.nav-dropdown-item--danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}
.nav-dropdown--home .nav-dropdown-trigger--home {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
}

/* 侧栏分组（可折叠） */
.sidebar-group {
  border-top: 1px solid rgba(45, 58, 77, 0.45);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
}
.sidebar-group-title {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.25rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}
.sidebar-group-title::-webkit-details-marker {
  display: none;
}
.sidebar-group-title::marker {
  content: '';
}
.sidebar-group-title:hover {
  color: var(--text);
}
.sidebar-group-caret {
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform 0.2s ease;
  opacity: 0.85;
}
.sidebar-group[open] .sidebar-group-caret {
  transform: rotate(180deg);
}
.sidebar-group-links a.sub {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

.hero {
  text-align: center;
  padding: 4rem 1rem;
}
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero p { color: var(--muted); }

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  background: var(--accent);
  color: #fff;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { filter: brightness(0.95); }

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

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.9rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], textarea {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
select {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b9cb3' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:hover {
  border-color: rgba(59, 130, 246, 0.45);
}
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22);
}
textarea { min-height: 80px; max-width: 100%; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid var(--danger); }
.alert-success { background: rgba(34,197,94,0.15); border: 1px solid var(--success); }

.layout-user {
  display: flex;
  min-height: calc(100vh - 56px);
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
}
.sidebar a {
  display: block;
  padding: 0.6rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.sidebar a:hover, .sidebar a.active { background: rgba(59,130,246,0.12); color: var(--accent); }
.sidebar .sub { padding-left: 2rem; font-size: 0.88rem; }
.sidebar .group-label {
  padding: 0.5rem 1.25rem 0.25rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.main-content { flex: 1; padding: 1.5rem; overflow: auto; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.stat-card .num { font-size: 1.5rem; font-weight: 700; }
.stat-card .lbl { color: var(--muted); font-size: 0.85rem; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
table.data th { background: rgba(0,0,0,0.2); }

.inline-form { display: inline; }

h2.page-title { margin-top: 0; font-size: 1.35rem; }

.radio-row label { margin-right: 1rem; cursor: pointer; }

.tag {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  vertical-align: middle;
}
.license-key {
  font-size: 0.8rem;
  word-break: break-all;
  display: inline-block;
  max-width: 220px;
  vertical-align: middle;
  margin-right: 0.35rem;
}

/* —— 首页 —— */
.page-home {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.home-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.22), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(139, 92, 246, 0.08), transparent),
    radial-gradient(ellipse 50% 35% at 0% 80%, rgba(34, 197, 94, 0.06), transparent),
    var(--bg);
}
.home-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(45, 58, 77, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 58, 77, 0.35) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 70%);
  opacity: 0.45;
}
.topbar-home {
  position: relative;
  z-index: 2;
  background: rgba(26, 35, 50, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: rgba(45, 58, 77, 0.8);
}
.brand-link {
  color: var(--text);
  text-decoration: none;
}
.brand-link:hover {
  color: var(--accent);
  text-decoration: none;
}
.topbar-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}
.topbar-nav .btn {
  text-decoration: none;
}
.topbar-nav .btn:hover {
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-lg {
  padding: 0.65rem 1.35rem;
  font-size: 1rem;
  border-radius: 10px;
  font-weight: 600;
}
.home-main {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}
.home-hero {
  text-align: center;
  padding: 2rem 0 3rem;
  max-width: 640px;
  margin: 0 auto;
}
.home-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
  font-weight: 600;
}
.home-title {
  font-size: clamp(1.85rem, 5vw, 2.65rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 1.25rem;
  letter-spacing: -0.02em;
}
.home-title-accent {
  background: linear-gradient(120deg, #60a5fa, #a78bfa, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-lead {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 2rem;
}
.home-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: center;
}
.home-cta .btn {
  text-decoration: none;
  min-width: 8.5rem;
}
.home-cta .btn:hover {
  text-decoration: none;
}
.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}
.home-card {
  position: relative;
  background: rgba(26, 35, 50, 0.65);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.35rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.home-card:hover {
  border-color: rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.home-card h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
}
.home-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}
.home-card-icon {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  opacity: 0.9;
  line-height: 1;
}
.home-footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 1.25rem 1.5rem 1.75rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid rgba(45, 58, 77, 0.6);
  background: rgba(15, 20, 25, 0.5);
}
.home-footer-dot {
  margin: 0 0.35rem;
  opacity: 0.5;
}
