:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --radius: 1rem;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* 导航栏 */
.navbar {
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

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

.nav-links a,
.dropbtn {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  transition: background 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
}

.nav-links a:hover,
.dropdown:hover .dropbtn,
.dropbtn:focus {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

/* 下拉小工具栏 */
.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  background: var(--card);
  min-width: 180px;
  border-radius: 0.75rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  animation: fadeIn 0.18s ease;
}

.dropdown-content a,
.dropdown-content span {
  color: var(--text);
  padding: 0.75rem 1rem;
  display: block;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.dropdown-content a:hover {
  background: #f3f4f6;
}

.dropdown:hover .dropdown-content,
.dropdown.open .dropdown-content {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 主体容器 */
.container {
  max-width: 960px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: #111827;
}

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.card h1,
.card h2 {
  margin-top: 0;
}

/* 登录页居中 */
.login-wrap {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card h1 {
  margin-bottom: 0.25rem;
}

.login-card .subtitle {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* 表单 */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input[type="text"],
input[type="password"] {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  outline: none;
}

/* 按钮 */
button,
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
}

button:hover,
.btn:hover {
  background: var(--primary-dark);
}

button:active,
.btn:active {
  transform: translateY(1px);
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* 管理页小工具栏 */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.tool-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tool-list li {
  margin-bottom: 0.75rem;
}

.tool-list a,
.tool-list .tool-placeholder {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  text-decoration: none;
  color: var(--text);
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  transition: background 0.15s, transform 0.1s;
}

.tool-list a:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: translateX(4px);
}

.tool-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e0e7ff;
  border-radius: 0.5rem;
  font-size: 1.1rem;
}

.tool-placeholder {
  color: var(--muted);
  cursor: not-allowed;
}

/* 提示消息 */
.flash {
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid #fecaca;
}

.flash p {
  margin: 0;
}

/* 响应式 */
@media (max-width: 600px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .nav-links {
    flex-wrap: wrap;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
