:root {
  --bg: #eef2f6;
  --bg-soft: #f7f9fc;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #0e7490;
  --accent-2: #155e75;
  --accent-soft: rgba(14, 116, 144, 0.1);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --sidebar: #0b1220;
  --sidebar-2: #111827;
  --sidebar-text: #94a3b8;
  --sidebar-on: #f8fafc;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}

/* —— App shell —— */
.admin-body {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(14, 116, 144, 0.08), transparent 55%),
    radial-gradient(700px 360px at -10% 110%, rgba(15, 23, 42, 0.05), transparent 50%),
    var(--bg);
}
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.sidebar-brand .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.sidebar-brand .logo img {
  width: 32px; height: 32px; border-radius: 10px; object-fit: cover;
  box-shadow: 0 8px 20px rgba(88, 28, 135, 0.35);
}
.sidebar-brand .sub {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  padding-left: 42px;
}
.sidebar-nav {
  flex: 1;
  overflow: auto;
  padding: 14px 12px 18px;
}
.nav-group { margin-bottom: 16px; }
.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 4px 10px 8px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #e2e8f0;
}
.sidebar-nav a.on {
  background: rgba(14, 116, 144, 0.22);
  color: var(--sidebar-on);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.18);
}
.sidebar-nav a .ico {
  width: 18px; text-align: center; opacity: .85; font-size: 13px;
}
.sidebar-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 12px;
}
.sidebar-foot .who {
  color: #e2e8f0;
  font-weight: 600;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-foot .links { display: flex; gap: 12px; }
.sidebar-foot a { color: #94a3b8; }
.sidebar-foot a:hover { color: #fff; }

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .crumb {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.topbar .crumb span {
  color: var(--muted);
  font-weight: 400;
  margin-right: 8px;
}
.topbar .actions { display: flex; gap: 8px; align-items: center; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head h1, .page-head h2, .wrap > h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-desc, .wrap > .muted:first-of-type {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.muted { color: var(--muted); font-size: 13px; }
label {
  display: block;
  margin: 12px 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=url], select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.55;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  margin-right: 8px;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--bg-soft); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #14b8a6 0%, var(--accent) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(14, 116, 144, 0.25);
}
.btn.primary:hover { filter: brightness(1.04); color: #fff; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; box-shadow: none; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn-row .btn { margin-right: 0; }

.flash, .alert, .ok {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid transparent;
}
.alert, .flash.err {
  background: var(--danger-soft);
  color: #991b1b;
  border-color: #fecaca;
}
.ok, .flash.ok {
  background: var(--ok-soft);
  color: #065f46;
  border-color: #a7f3d0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent-soft);
}
.stat .num {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--text);
  position: relative;
}
.stat .lbl {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 4px;
  position: relative;
}
.stat.accent .num { color: var(--accent); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-hd h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px 14px; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-wrap .pager {
  padding: 0 16px 14px;
  margin: 8px 0 0;
}
.table th, .table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}
.table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 650;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f8fafc; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  margin-right: 4px;
}
.tag.on {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: rgba(14, 116, 144, 0.18);
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }

.ops { white-space: nowrap; }
.ops a, .ops button { margin-right: 10px; }
.inline { display: inline; }
.linkish {
  background: none; border: none; color: var(--accent);
  cursor: pointer; padding: 0; font-size: 13px; font-weight: 600;
}
.linkish.danger { color: var(--danger); }
.check {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0; font-size: 13px; color: var(--text-2); font-weight: 500;
}
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.quick .btn { margin-right: 0; }

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #e8eef3;
  border-radius: 12px;
  margin: 0 0 18px;
}
.tabs a, .tabs .tab {
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.tabs a.on, .tabs .tab.on {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.hero-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
.hero {
  background:
    radial-gradient(500px 220px at 90% 0%, rgba(34, 211, 238, 0.2), transparent 55%),
    linear-gradient(145deg, #0b1220 0%, #123047 55%, #0e7490 140%);
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
  min-height: 160px;
}
.hero h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.hero p { margin: 0; color: #94a3b8; font-size: 13.5px; max-width: 460px; }
.hero .hero-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .btn {
  margin: 0;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.16);
  color: #fff;
}
.hero .btn.primary {
  background: #fff;
  color: #0f172a;
  border-color: transparent;
  box-shadow: none;
}
.side-note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.side-note h3 { margin: 0 0 10px; font-size: 15px; }
.side-note ul {
  margin: 0; padding-left: 1.1em; color: var(--muted); font-size: 13px; line-height: 1.7;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.product-card .panel-hd .tag { margin: 0; }

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 420px at 15% 10%, rgba(14, 116, 144, 0.25), transparent 55%),
    radial-gradient(700px 400px at 90% 90%, rgba(15, 23, 42, 0.45), transparent 50%),
    linear-gradient(160deg, #0b1220 0%, #0f172a 45%, #123047 100%);
}
.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.login-visual {
  padding: 42px 36px;
  background:
    radial-gradient(420px 240px at 30% 20%, rgba(34, 211, 238, 0.18), transparent 60%),
    linear-gradient(160deg, rgba(15, 23, 42, 0.2), rgba(14, 116, 144, 0.15));
  color: #cbd5e1;
}
.login-visual .mark {
  width: 56px; height: 56px; border-radius: 16px;
  object-fit: cover; display: block; margin-bottom: 22px;
}
.login-visual h1 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.login-visual p { margin: 0; line-height: 1.7; font-size: 14px; color: #94a3b8; }
.login-visual ul {
  margin: 28px 0 0; padding: 0; list-style: none;
  display: grid; gap: 10px;
}
.login-visual li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: #cbd5e1;
}
.login-visual li::before {
  content: "";
  width: 8px; height: 8px; margin-top: 6px; border-radius: 50%;
  background: #22d3ee; flex-shrink: 0;
}
.login-card {
  width: auto;
  background: #fff;
  border-radius: 0;
  padding: 40px 36px 32px;
  box-shadow: none;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.login-card .btn.primary { width: 100%; margin-top: 18px; }

.slider-box { margin-top: 4px; }
.slider-stage {
  position: relative; width: 320px; height: 160px; border-radius: 10px; overflow: hidden;
  background: #e5e6eb; user-select: none;
}
.slider-stage img { display: block; width: 320px; height: 160px; pointer-events: none; }
.slider-piece {
  position: absolute !important; left: 0; top: 0; width: 48px !important; height: 48px !important;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.35));
}
.slider-track {
  position: relative; margin-top: 12px; height: 40px; border-radius: 20px; background: #f2f3f5;
  border: 1px solid var(--line); overflow: hidden; user-select: none;
}
.slider-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #cfeef3; }
.slider-thumb {
  position: absolute; left: 0; top: 0; width: 42px; height: 38px; margin: 1px;
  border-radius: 19px; background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; cursor: grab;
  color: var(--accent); font-weight: 700; z-index: 2;
}
.slider-tip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; pointer-events: none;
}
#refreshSlider { margin-top: 8px; }
.slider-modal[hidden] { display: none !important; }
.slider-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.slider-modal-backdrop {
  position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55);
}
.slider-modal-card {
  position: relative; z-index: 1; width: min(380px, 94vw);
  background: #fff; border-radius: 16px; padding: 18px 18px 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}
.slider-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.slider-modal-head strong { font-size: 16px; color: var(--text); }
.slider-modal-close {
  border: none; background: transparent; color: var(--muted);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.slider-modal-hint { margin: 0 0 12px; font-size: 13px; }
body.slider-modal-open { overflow: hidden; }

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 4px;
  padding: 4px 0;
  font-size: 13px;
}
.pager-btn, .pager-num, .pager-jump button {
  height: 36px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  background: #eef2ff;
  color: #334155;
  font-weight: 500;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.pager-num { min-width: 36px; padding: 0 12px; }
.pager a.pager-btn:hover, .pager a.pager-num:hover {
  background: #e0e7ff;
  color: #1e1b4b;
}
.pager-num.on {
  background: #4338ca;
  color: #fff;
  font-weight: 700;
}
.pager-btn.off {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}
.pager-jump input[type=number] {
  width: 56px;
  min-height: 36px;
  height: 36px;
  margin: 0;
  padding: 0 10px;
  border-radius: 999px;
  border: none;
  background: #eef2ff;
  text-align: center;
  font-size: 13px;
  box-shadow: none;
}
.pager-jump input[type=number]:focus {
  border: none;
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.18);
}
.pager-jump button {
  cursor: pointer;
  background: #eef2ff;
}
.pager-jump button:hover { background: #e0e7ff; }

@media (max-width: 960px) {
  .admin-body { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: relative;
  }
  .sidebar-nav {
    display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 10px 12px;
  }
  .nav-group { display: contents; }
  .nav-group-title { display: none; }
  .sidebar-nav a { white-space: nowrap; margin: 0; }
  .sidebar-foot { display: none; }
  .hero-card { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}
@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .wrap { padding: 18px 16px 36px; }
  .topbar { padding: 0 16px; }
  .slider-stage, .slider-stage img { width: 100%; }
}
