* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #333;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff7a1a 0%, #ff9a3c 50%, #ffc080 100%);
}
.login-card {
  width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand h1 { font-size: 28px; color: #ff7a1a; margin-bottom: 8px; }
.login-brand p { color: #999; font-size: 13px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #666; font-size: 13px; }
.form-control {
  width: 100%;
  height: 44px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: border .2s;
}
.form-control:focus { border-color: #ff7a1a; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .2s;
}
.btn:hover { opacity: .9; }
.btn-primary {
  width: 100%;
  background: linear-gradient(90deg, #ff7a1a, #ff9a3c);
  color: #fff;
  font-weight: 600;
}
.alert { padding: 12px 16px; border-radius: 8px; margin: 12px 0; font-size: 13px; }
.alert-error { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.alert-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  border-bottom: 1px solid #f5f5f5;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  display: block;
  margin: 0 auto 16px;
}
.login-brand h1 { display: none; }
.brand-text { font-size: 18px; font-weight: 700; color: #ff7a1a; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  color: #666; margin-bottom: 4px;
  transition: all .2s;
}
.nav-item:hover { background: #fff7f0; color: #ff7a1a; }
.nav-item.active { background: #fff3e8; color: #ff7a1a; font-weight: 600; }
.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon img {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
  opacity: 0.55;
  transition: opacity .2s, filter .2s;
}
.nav-item:hover .nav-icon img,
.nav-item.active .nav-icon img {
  opacity: 1;
  filter: invert(55%) sepia(89%) saturate(1200%) hue-rotate(360deg) brightness(101%) contrast(101%);
}
.sidebar-foot { padding: 16px 20px; font-size: 12px; color: #bbb; border-top: 1px solid #f5f5f5; }

.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; margin-left: 220px; min-height: 100vh; }
.topbar {
  height: 64px; background: #fff;
  border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 90;
}
.breadcrumb { font-size: 16px; font-weight: 600; color: #333; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.icon-btn {
  width: 36px; height: 36px; border: none; background: #f5f5f5;
  border-radius: 8px; cursor: pointer; position: relative; font-size: 16px;
}
.badge-dot {
  position: absolute; top: -4px; right: -4px;
  background: #ff4d4f; color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #ff7a1a, #ff9a3c);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.user-name { font-size: 14px; color: #333; }
.logout-link { font-size: 12px; color: #999; margin-left: 8px; }
.logout-link:hover { color: #ff7a1a; }

.main-content { flex: 1; padding: 0 24px 20px; overflow-y: auto; }
.panel:first-child { margin-top: 0; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.stat-label { font-size: 13px; color: #999; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: #333; margin-bottom: 8px; }
.stat-change { font-size: 12px; }
.stat-change.up { color: #52c41a; }
.stat-change.down { color: #ff4d4f; }

/* Panels */
.panel-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.panel-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.panel {
  background: #fff; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #f5f5f5;
}
.panel-title { font-size: 15px; font-weight: 600; }
.panel-body { padding: 20px; }
.panel-tabs { display: flex; gap: 8px; }
.tab-btn {
  padding: 4px 12px; border: 1px solid #e8e8e8; border-radius: 6px;
  background: #fff; font-size: 12px; cursor: pointer; color: #666;
}
.tab-btn.active { background: #fff3e8; border-color: #ff7a1a; color: #ff7a1a; }
.chart-wrap { height: 280px; position: relative; }
.chart-wrap-sm { height: 220px; position: relative; }

/* Quick actions */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px; border-radius: 10px; background: #fafafa;
  transition: background .2s; cursor: pointer; text-align: center;
}
.quick-item:hover { background: #fff3e8; }
.quick-icon { font-size: 24px; }
.quick-text { font-size: 12px; color: #666; }

/* Table */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 12px 16px;
  background: #fafafa; color: #999; font-weight: 500;
  border-bottom: 1px solid #f0f0f0; white-space: nowrap;
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid #f5f5f5; }
.data-table tr:hover td { background: #fafafa; }
.link-btn { color: #ff7a1a; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* Tags */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
}
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-orange { background: #fff7e6; color: #fa8c16; }
.tag-red { background: #fff2f0; color: #ff4d4f; }
.tag-gray { background: #f5f5f5; color: #999; }

/* Banner preview */
.banner-preview { border-radius: 10px; overflow: hidden; }
.banner-preview img { width: 100%; height: 120px; object-fit: cover; display: block; }
.banner-title { padding: 10px; font-size: 13px; color: #666; background: #fafafa; }
.banner-thumb { width: 120px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }

.upload-preview {
  margin-bottom: 12px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px dashed #e8e8e8;
  background: #fafafa;
}
.upload-preview img { width: 100%; max-height: 180px; object-fit: cover; display: block; }
.upload-preview-empty {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 13px;
}
.upload-box { display: block; cursor: pointer; }
.upload-box input[type="file"] { display: none; }
.upload-box-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 110px;
  border: 1px dashed #ffb980;
  border-radius: 10px;
  background: #fffaf5;
  color: #666;
  font-size: 13px;
  transition: border-color .2s, background .2s;
}
.upload-box:hover .upload-box-inner {
  border-color: #ff7a1a;
  background: #fff5eb;
}
.upload-icon { font-size: 28px; line-height: 1; }
.upload-hint { font-size: 12px; color: #999; }

/* Message list */
.msg-list { display: flex; flex-direction: column; gap: 12px; }
.msg-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; border-radius: 8px; background: #fafafa;
}
.msg-icon { font-size: 20px; flex-shrink: 0; }
.msg-body { flex: 1; min-width: 0; }
.msg-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.msg-summary { font-size: 12px; color: #999; }
.msg-meta { text-align: right; flex-shrink: 0; }
.msg-time { font-size: 11px; color: #ccc; margin-bottom: 4px; }

/* Forms page */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.search-form { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; }
.btn-outline { background: #fff; border: 1px solid #e8e8e8; color: #666; }
.btn-danger { background: #ff4d4f; color: #fff; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.page-link {
  padding: 6px 12px; border: 1px solid #e8e8e8; border-radius: 6px;
  font-size: 13px; color: #666;
}
.page-link.active { background: #ff7a1a; color: #fff; border-color: #ff7a1a; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
textarea.form-control { height: auto; padding: 10px 14px; resize: vertical; }
.config-table .form-control { height: 36px; }

.config-form .form-group { margin-bottom: 16px; }
.config-form .form-group label { display: block; margin-bottom: 8px; color: #666; font-size: 13px; font-weight: 500; }
.config-form .form-control { max-width: 520px; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  max-width: 520px;
}
.switch-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #ff7a1a;
}
.switch-hint {
  font-size: 13px;
  color: #888;
  font-weight: normal;
}

.sub-nav {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.sub-nav a {
  padding: 8px 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e8e8e8;
  color: #666;
  font-size: 13px;
}
.sub-nav a.active {
  background: #fff3e8;
  border-color: #ffb980;
  color: #ff7a1a;
  font-weight: 600;
}
.page-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab-link {
  padding: 6px 12px;
  border-radius: 6px;
  background: #f5f5f5;
  color: #666;
  font-size: 12px;
}
.tab-link.active { background: #ff7a1a; color: #fff; }
.ui-image-field { display: flex; flex-direction: column; gap: 8px; }
.ui-thumb { width: 120px; height: 48px; object-fit: contain; border: 1px solid #eee; border-radius: 6px; background: #fafafa; }
.ui-path { font-size: 12px; color: #999; word-break: break-all; }
textarea.form-control { min-height: 88px; height: auto; }

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .panel-grid-3 { grid-template-columns: 1fr; }
}
