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

:root {
  --bg-body: #f5f7fa;
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-hover: #f5f7fa;
  --bg-active: #e8f5e9;
  --text-primary: #303133;
  --text-secondary: #606266;
  --text-muted: #909399;
  --border-color: #e4e7ed;
  --border-light: #ebeef5;
  --border-input: #dcdfe6;
  --accent: #1b5e20;
  --accent-hover: #2e7d32;
  --accent-light: #e8f5e9;
  --shadow: rgba(0,0,0,0.04);
  --shadow-heavy: rgba(0,0,0,0.1);
  --success: #1b5e20;
  --danger: #f56c6c;
  --warning: #e6a23c;
}

[data-theme="dark"] {
  --bg-body: #0a0a0a;
  --bg-primary: #141414;
  --bg-secondary: #1a1a1a;
  --bg-hover: #1f1f1f;
  --bg-active: #1d3712;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted: #808080;
  --border-color: #2a2a2a;
  --border-light: #2a2a2a;
  --border-input: #3a3a3a;
  --accent: #388e3c;
  --accent-hover: #4caf50;
  --accent-light: #1b3a1c;
  --shadow: rgba(0,0,0,0.2);
  --shadow-heavy: rgba(0,0,0,0.4);
  --success: #388e3c;
  --danger: #f78989;
  --warning: #ebb563;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  transition: background 0.3s, color 0.3s;
}

/* 布局框架 */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s, background 0.3s, border-color 0.3s;
}

.logo {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border-color);
  gap: 10px;
}

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

.menu {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  gap: 10px;
}

.menu-item:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.menu-item.active {
  background: var(--bg-active);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.menu-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.user-info .badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.logout-btn {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-input);
  background: var(--bg-primary);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  transition: margin-left 0.3s;
}

.header {
  height: 64px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.3s, border-color 0.3s;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-input);
  background: var(--bg-primary);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-input);
  background: var(--bg-primary);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.content {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

/* 页面卡片 */
.page-card {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 4px var(--shadow);
  border: 1px solid var(--border-light);
  overflow-x: auto;
  transition: background 0.3s, border-color 0.3s;
}

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

.page-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  transition: background 0.3s;
}

.login-box {
  width: 420px;
  padding: 48px;
  border-radius: 12px;
  box-shadow: 0 4px 24px var(--shadow-heavy);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  transition: background 0.3s, border-color 0.3s;
}

.login-title {
  text-align: center;
  margin-bottom: 32px;
}

.login-title .icon-wrap {
  width: 64px;
  height: 64px;
  background: var(--accent-light);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 28px;
  overflow: hidden;
}

.login-title .icon-wrap img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.login-title h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-title p {
  color: var(--text-muted);
  font-size: 14px;
}

.input-icon {
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 14px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 12px var(--shadow-heavy);
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  body.sidebar-open .sidebar-overlay {
    display: block;
  }
  .main {
    margin-left: 0;
  }
  .menu-toggle {
    display: flex;
  }
  .login-box {
    width: 90%;
    padding: 32px;
  }
  .header {
    padding: 0 16px;
  }
  .content {
    padding: 16px;
  }
  .page-card {
    padding: 16px;
    border-radius: 6px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }
  .content {
    padding: 16px;
  }
  .data-table {
    font-size: 13px;
  }
  .data-table th, .data-table td {
    padding: 8px;
  }
  .login-box {
    padding: 32px 24px;
  }

}
