/* ============================================================
   Rs Realme Tool — admin styles (与前台一致的配色体系)
   ============================================================ */

:root {
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --ink: #111827;
  --body: #374151;
  --sub: #4B5563;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --line: #E5E7EB;
  --line-2: #E8EAEE;
  --accent: #4567A8;
  --accent-hover: #3A5891;
  --danger: #C0392B;
  --ok: #1E9E50;
  --font: "Public Sans", "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------
   Login
   ------------------------------------------------------------ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 380px;
  background: #fff;
  border: 1px solid var(--line-2);
  padding: 36px;
}

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

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex: none;
}

.login-title { font-size: 18px; font-weight: 700; color: var(--ink); }
.login-sub { font-size: 13px; color: var(--faint); margin-top: 2px; }

.f-label { display: block; font-size: 13px; font-weight: 600; color: var(--sub); margin: 16px 0 6px; }
.f-input {
  width: 100%;
  height: 42px;
  border: 1px solid #D1D5DB;
  padding: 0 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}
.f-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(69, 103, 168, 0.15); }

.login-err {
  display: none;
  margin-top: 14px;
  font-size: 13px;
  color: var(--danger);
  background: #FBEDEB;
  border: 1px solid #F0D5D1;
  padding: 9px 12px;
}

.btn-block {
  width: 100%;
  height: 46px;
  margin-top: 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
}
.btn-block:hover { background: var(--accent-hover); }

.login-hint { margin-top: 18px; font-size: 13px; color: var(--faint); text-align: center; }
.login-hint b { color: var(--sub); }
.login-back { display: block; margin-top: 12px; font-size: 13px; text-align: center; }

/* ------------------------------------------------------------
   Dashboard layout
   ------------------------------------------------------------ */
.admin-shell { display: flex; min-height: 100vh; }

.admin-side {
  width: 220px;
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--line-2);
}
.admin-brand .brand-badge { width: 34px; height: 34px; font-size: 12px; border-radius: 5px; }
.admin-brand .n { font-size: 15px; font-weight: 700; color: var(--ink); }
.admin-brand .s { font-size: 11px; color: var(--faint); }

.admin-nav { padding: 12px 0; flex: 1; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--body);
  border-left: 3px solid transparent;
  cursor: pointer;
}
.admin-nav a svg { width: 16px; height: 16px; color: var(--faint); }
.admin-nav a:hover { background: #F8F9FA; color: var(--ink); }
.admin-nav a.active {
  background: #F5F6F8;
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}
.admin-nav a.active svg { color: var(--accent); }

.admin-side .side-foot { border-top: 1px solid var(--line-2); padding: 12px 0; }

.admin-main { flex: 1; min-width: 0; padding: 28px 32px 60px; }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.admin-topbar h1 { font-size: 22px; font-weight: 700; color: var(--ink); }
.admin-topbar .who { font-size: 13px; color: var(--faint); }

/* ------------------------------------------------------------
   Panels / stat cards
   ------------------------------------------------------------ */
.panel {
  background: #fff;
  border: 1px solid var(--line-2);
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-2);
}
.panel-head h2 { font-size: 16px; font-weight: 700; color: var(--ink); }
.panel-head .sub { font-size: 13px; color: var(--faint); }
.panel-body { padding: 22px; }
.panel-body.flush { padding: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line-2);
  padding: 20px 22px;
}
.stat-card .l { font-size: 13px; color: var(--faint); }
.stat-card .n { font-size: 28px; font-weight: 700; color: var(--ink); margin-top: 6px; }
.stat-card .d { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
.a-table { width: 100%; border-collapse: collapse; }
.a-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 12px 22px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.a-table td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-2);
  font-size: 14px;
  vertical-align: middle;
}
.a-table tr:last-child td { border-bottom: none; }
.a-table .t-name { font-weight: 700; color: var(--ink); }
.a-table .t-sub { font-size: 12px; color: var(--faint); margin-top: 2px; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-table .t-mono { font-family: Consolas, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
.a-table .empty { color: var(--faint); text-align: center; padding: 30px 22px; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn-a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-a:hover { background: var(--accent-hover); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: #fff;
  color: var(--body);
  border: 1px solid #D1D5DB;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: #FBEDEB; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.form-grid .full { grid-column: 1 / -1; }
.f-area {
  width: 100%;
  border: 1px solid #D1D5DB;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  resize: vertical;
  min-height: 74px;
}
.f-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(69, 103, 168, 0.15); }
.f-help { font-size: 12px; color: var(--faint); margin-top: 5px; }

.form-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px 20px;
  z-index: 50;
}
.modal-mask.open { display: flex; }

.modal {
  width: 560px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(17, 24, 39, 0.25);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-size: 16px; font-weight: 700; color: var(--ink); }
.modal-x {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--faint);
  cursor: pointer;
}
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 20px 22px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line-2);
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------
   型号图片
   ------------------------------------------------------------ */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.img-card {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  background: #fff;
}
.img-card .thumb {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  background: #f6f7f9;
  border-radius: 6px;
  overflow: hidden;
}
.img-card .thumb img { max-width: 64px; max-height: 100px; object-fit: contain; }
.img-card .thumb .ph { color: var(--faint); font-size: 12px; }
.img-card.no-img .thumb { border: 1px dashed var(--line); }
.img-card .m-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.img-card .m-sub { font-size: 11.5px; color: var(--faint); margin: 2px 0 8px; }
.img-card .row-actions { display: flex; gap: 6px; justify-content: center; }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; border-right: none; border-bottom: 1px solid var(--line); }
  .admin-nav { display: flex; flex-wrap: wrap; }
  .admin-nav a { border-left: none; border-bottom: 3px solid transparent; }
  .admin-nav a.active { border-bottom-color: var(--accent); }
  .form-grid { grid-template-columns: 1fr; }
  .admin-main { padding: 20px; }
}
