:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --ok: #059669;
  --shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

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

.app { max-width: 1080px; margin: 0 auto; padding: 24px; }

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

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

.logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

h1 { font-size: 22px; margin: 0; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ok);
  background: #ecfdf5;
  padding: 6px 10px;
  border-radius: 999px;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.section-head, .list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2, .list-head h3 { margin: 0; font-size: 18px; }
.hint { color: var(--muted); font-size: 13px; }

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.platform-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  text-align: left;
}

.platform-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
  border-color: #93c5fd;
}

.platform-name { font-size: 20px; font-weight: 700; margin-bottom: 10px; }

.platform-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.count-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--primary);
  background: #eff6ff;
  border-radius: 999px;
  padding: 4px 10px;
}

.latest-line {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
  min-height: 36px;
}

.latest-line strong { color: var(--text); }

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

.btn-back {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  padding: 0 0 14px;
}

.platform-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.platform-head h2 { margin: 0; font-size: 24px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

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

.record-form {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr .8fr auto auto;
  gap: 14px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

.field input, .field select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field input:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.checkbox-field { flex-direction: row; align-items: center; gap: 8px; height: 40px; }
.checkbox-field input { width: 16px; height: 16px; accent-color: var(--primary); }

.btn-primary {
  height: 40px;
  padding: 0 22px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.form-msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.form-msg.error { color: var(--danger); }
.form-msg.success { color: var(--ok); }

.table-wrap { overflow-x: auto; }

.record-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.record-table th, .record-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.record-table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: #f9fafb;
}

.user-link { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; }
.user-link:hover { text-decoration: underline; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; }
.badge-yes { background: var(--danger-bg); color: var(--danger); }
.badge-no { background: #f3f4f6; color: var(--muted); }

.empty-hint {
  padding: 16px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  display: none;
}

.empty-hint.show { display: block; }

.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 50; }
.modal.open { display: flex; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }

.modal-card {
  position: relative;
  width: min(680px, 92vw);
  max-height: 86vh;
  overflow: auto;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { margin: 0; font-size: 18px; }
.modal-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.btn-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal-body { padding: 20px 22px; }

@media (max-width: 860px) {
  .record-form { grid-template-columns: 1fr 1fr; }
  .checkbox-field { grid-column: span 2; }
  .btn-primary { grid-column: span 2; }
}

@media (max-width: 560px) {
  .app { padding: 16px; }
  .record-form { grid-template-columns: 1fr; }
  .checkbox-field, .btn-primary { grid-column: span 1; }
  .section-head, .list-head { flex-direction: column; align-items: flex-start; }
}

/* ===== 美化迭代 ===== */
body {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  min-height: 100vh;
}

.panel { border-radius: 14px; }

.platform-card {
  position: relative;
  overflow: hidden;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  background: linear-gradient(145deg, #ffffff, #f8fbff);
  border-radius: 14px;
}

.platform-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #2563eb, #60a5fa);
}

.platform-name { font-size: 21px; letter-spacing: .5px; }
.platform-arrow { color: var(--primary); font-weight: 600; }
.count-badge { font-weight: 600; }

.recent-panel { margin-top: 24px; }
.recent-panel .list-head { margin-bottom: 16px; }

.record-table tbody tr:nth-child(even) { background: #fafbfe; }
.record-table tbody tr:hover { background: #f3f7ff; }
.record-table td { font-size: 13.5px; }
.record-table th { letter-spacing: .3px; }

.platform-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12.5px;
  font-weight: 600;
}

.num-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #111827;
}

.time-cell { color: var(--muted); font-size: 12.5px; }

.badge-banned {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
}

.badge-normal {
  background: #f3f4f6;
  color: #9ca3af;
}

.btn-primary { box-shadow: 0 4px 10px rgba(37, 99, 235, .25); }

/* ===== 平台操作弹窗 ===== */
.platform-modal-card {
  width: min(880px, 94vw);
  max-height: 90vh;
}

.platform-modal-card .modal-body { padding-top: 16px; }

.modal-form-panel {
  margin-bottom: 18px;
  background: #f8fafc;
  box-shadow: none;
}

.modal-list-head {
  margin-top: 4px;
  margin-bottom: 12px;
}

#userModal { z-index: 60; }

/* ===== 备注与搜索 ===== */
.list-head { flex-wrap: wrap; }

.note-field { grid-column: 1 / -1; }

.search-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-box input[type="search"] {
  height: 36px;
  width: 240px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.search-box input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.btn-search-clear {
  height: 36px;
  width: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.btn-search-clear:hover { border-color: var(--primary); color: var(--primary); }

.note-cell {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #4b5563;
  font-size: 13px;
}

.note-empty { color: #9ca3af; }

@media (max-width: 720px) {
  .search-box { margin-left: 0; width: 100%; }
  .search-box input[type="search"] { flex: 1; width: auto; }
}

/* ===== 登录保护 ===== */
.topbar-right { display: flex; align-items: center; gap: 10px; }

.btn-logout {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

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

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

.login-card {
  width: min(400px, 92vw);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .12);
  padding: 32px;
  text-align: center;
}

.login-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}

.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-subtitle { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-card .field { text-align: left; margin-bottom: 16px; }
.login-card .field input { width: 100%; }
.login-btn { width: 100%; }
