:root {
  --primary: #123b63;
  --accent: #c4762d;
  --bg: #f3f6fa;
  --text: #172033;
  --muted: #667085;
  --card: #ffffff;
  --line: #e7edf5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.sidebar {
  width: 280px;
  min-height: 100vh;
  background: #0f2f4f;
  color: #fff;
  padding: 28px 20px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 34px;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #fff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 24px;
}

h1, h2, h3, p { margin: 0; }

.brand h1 { font-size: 20px; }
.brand p { color: rgba(255,255,255,.68); margin-top: 4px; }

.nav {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.75);
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px;
  margin-bottom: 8px;
}

.nav.active, .nav:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.main {
  flex: 1;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: 30px;
  margin-bottom: 8px;
}

.topbar p {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 12px;
}

input, textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.actions input {
  width: 260px;
}

button {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.view { display: none; }
.view.active { display: block; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric, .panel {
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 14px 38px rgba(18,59,99,.07);
}

.metric {
  padding: 24px;
}

.metric span {
  font-size: 28px;
}

.metric strong {
  display: block;
  font-size: 34px;
  margin: 12px 0 4px;
}

.metric p, .panel-head span, .muted {
  color: var(--muted);
}

.panel {
  padding: 22px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f8fafc;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.online { background: #dcfce7; color: #166534; }
.pending { background: #fef3c7; color: #92400e; }
.offline { background: #fee2e2; color: #991b1b; }

.ops {
  display: flex;
  gap: 8px;
}

.ops button, .text-btn {
  background: #eef6ff;
  color: var(--primary);
  padding: 8px 10px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.bar {
  flex: 1;
  height: 10px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #2f855a);
}

.todo {
  margin: 0;
  padding-left: 20px;
  line-height: 2;
  color: #344054;
}

.settings {
  max-width: 720px;
}

.password-panel {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.password-panel h4 {
  margin: 0 0 16px;
  font-size: 16px;
}

.password-panel .primary-btn,
.password-panel .ghost-btn,
.settings > .primary-btn {
  width: auto;
  min-width: 160px;
}

.settings > .primary-btn {
  margin-top: 8px;
}

.settings label, .form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  margin-bottom: 16px;
}

.settings input, .settings textarea {
  width: 100%;
  color: var(--text);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,47,79,.42);
  place-items: center;
  padding: 24px;
}

.modal.active {
  display: grid;
}

.dialog {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 28px 80px rgba(18,59,99,.26);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
}

@media (max-width: 980px) {
  body { display: block; }
  .app-shell { display: block; }
  .sidebar { width: 100%; min-height: auto; position: static; }
  .metrics, .panel-grid { grid-template-columns: 1fr; }
  .topbar, .actions { flex-direction: column; align-items: stretch; }
  .actions input { width: 100%; }
}

.hidden { display: none !important; }

.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, #0f2f4f, #1b5ea8);
  overflow-y: auto;
}

.login-screen.hidden {
  display: none !important;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 28px 80px rgba(0,0,0,.18);
  margin: auto;
}

.login-card .primary-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
}

.remember-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px !important;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.remember-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.wechat-login-panel {
  text-align: center;
}

.wechat-qr-box {
  background: #f8fbff;
  border: 1px dashed #93c5fd;
  border-radius: 16px;
  padding: 24px 16px;
  margin-bottom: 12px;
}

.wechat-qr-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: #07c160;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.wechat-qr-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--text);
}

.wechat-qr-status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.wechat-login-btn {
  width: 100%;
  opacity: 0.72;
  cursor: not-allowed;
}

.wechat-login-btn.enabled {
  opacity: 1;
  cursor: pointer;
}

.wechat-qr-box.enabled {
  border-style: solid;
  border-color: #07c160;
}

.wechat-qr-image {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.login-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
}

.login-card input { width: 100%; }

.login-error {
  color: #b42318;
  min-height: 20px;
  margin-top: 8px;
}

.login-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 12px;
}

.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, #1b5ea8, #2d8fd9);
}

.ghost-btn {
  background: #eef6ff;
  color: var(--primary);
}

.danger-btn {
  background: #fee2e2;
  color: #991b1b;
}

.logout-btn {
  width: 100%;
  margin-top: 24px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
}

.metrics.secondary { margin-bottom: 22px; }

.metric.warn strong { color: #c56a00; }

.review-detail {
  background: #f8fbff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  line-height: 1.8;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.modal-actions button { flex: 1; }

.media-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  align-items: center;
}

.media-toolbar input,
.media-toolbar select {
  min-width: 160px;
}

.upload-label {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  background: #eef6ff;
  color: var(--primary);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.media-card-item {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.media-card-item img,
.media-card-item video {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}

.media-card-item .meta {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.media-card-item .ops {
  padding: 0 12px 12px;
}

.media-card-item .ops button {
  width: 100%;
  padding: 8px;
  font-size: 12px;
}

.media-editor {
  grid-column: 1 / -1;
  border: 1px dashed #93c5fd;
  border-radius: 16px;
  padding: 16px;
  background: #f8fbff;
}

.media-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--primary);
}

.media-selected-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 80px;
}

.media-thumb-item {
  width: 100px;
  position: relative;
}

.media-thumb-item img,
.media-thumb-item video {
  width: 100px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.media-thumb-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  line-height: 22px;
  background: rgba(0,0,0,.55);
  color: #fff;
}

.media-editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.media-editor-actions button {
  padding: 8px 12px;
  font-size: 13px;
}

.dialog-wide {
  width: min(960px, 100%);
}

.picker-grid .media-card-item {
  cursor: pointer;
}

.picker-grid .media-card-item:hover {
  outline: 2px solid var(--primary);
}

select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}