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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f7;
  color: #333;
  min-height: 100vh;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #ff2442 0%, #d61c3a 100%);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 22px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  color: white;
  font-weight: 700;
}

.sidebar-header .sub {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 6px;
}

.sidebar-nav {
  padding: 10px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 15px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,0.2);
  color: white;
  font-weight: 600;
  border-left: 3px solid white;
}

.nav-icon {
  margin-right: 10px;
  font-size: 18px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.sidebar-footer a,
.sidebar-footer button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 6px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.95);
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  text-decoration: none;
}

.sidebar-footer a:hover,
.sidebar-footer button:hover {
  background: rgba(255,255,255,0.2);
}

.main-content {
  flex: 1;
  margin-left: 220px;
  padding: 20px;
  min-height: 100vh;
  background: #f5f5f7;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #222;
}

.page-header p {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}

.stat-info h3 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.stat-info p {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

.panel {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-toolbar {
  padding: 20px 24px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title .count {
  font-weight: 400;
  font-size: 13px;
  color: #999;
}

.panel-body {
  padding: 12px 24px 24px;
}

.panel-padded {
  padding: 24px;
}

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.alert-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.alert-err {
  background: #ffebee;
  color: #c62828;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.filter-btn.active {
  background: #ff2442;
  color: white;
  border-color: #ff2442;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f5f5f7;
  border-bottom: 2px solid #e0e0e0;
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #fafafa;
}

.data-table .mono {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  color: #666;
  max-width: 200px;
  word-break: break-all;
}

.table-scroll {
  overflow: auto;
  max-height: 520px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #ff2442;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group textarea.code {
  font-family: Consolas, monospace;
  font-size: 12px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.form-row .form-group {
  flex: 1;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-inline input {
  width: 16px;
  height: 16px;
  accent-color: #ff2442;
}

.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: #ff2442;
  color: white;
}

.btn-primary:hover {
  background: #e01e3a;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.status-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-on {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-off {
  background: #f5f5f5;
  color: #757575;
}

.status-warn {
  background: #fff3e0;
  color: #e65100;
}

.status-danger {
  background: #ffebee;
  color: #c62828;
}

.input-sm {
  width: 100%;
  min-width: 100px;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

.input-sm:focus {
  outline: none;
  border-color: #ff2442;
}

.input-wide {
  min-width: 220px;
}

pre.preview {
  background: #f8f9fb;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
}

.muted {
  color: #888;
  font-size: 13px;
  line-height: 1.6;
}

code {
  background: #f0f3f8;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.steps {
  padding-left: 20px;
}

.steps li {
  margin-bottom: 8px;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff2442 0%, #ff6080 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.login-card h2 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 8px;
  color: #ff2442;
}

.login-card .login-sub {
  text-align: center;
  font-size: 14px;
  color: #888;
  margin-bottom: 28px;
}

.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 14px;
}

.login-card input:focus {
  outline: none;
  border-color: #ff2442;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #ff2442 0%, #ff6080 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.login-btn:hover {
  opacity: 0.92;
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin-top: 16px;
}

.login-err {
  color: #c62828;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2,
  .sidebar-header .sub { display: none; }
  .nav-item { padding: 12px; justify-content: center; }
  .nav-item span:not(.nav-icon) { display: none; }
  .sidebar-footer a span:not(.nav-icon),
  .sidebar-footer button span:not(.nav-icon) { display: none; }
  .main-content { margin-left: 60px; padding: 12px; }
}
