/* ==========================================================
   青禾直播 · 管理后台样式 v2 「墨玉」
   深墨侧栏 + 玉色主色 + 纸白内容区
   ========================================================== */

:root {
  --ink: #070B12;
  --ink-1: #0B1119;
  --ink-2: #121A26;
  --ink-3: #1B2534;

  --paper: #F5F7FA;
  --card: #FFFFFF;

  --line: rgba(11, 20, 34, .09);
  --line-soft: rgba(11, 20, 34, .055);
  --line-strong: rgba(11, 20, 34, .14);
  --hair-dark: rgba(255, 255, 255, .09);

  --text: #0B1422;
  --text-2: #35435A;
  --muted: #6A798E;
  --faint: #93A1B3;

  --brand: #0BA678;
  --brand-dark: #08835D;
  --brand-light: #3EDDA8;
  --brand-soft: #E9F8F3;

  --gold: #C9A063;
  --gold-soft: #FBF5EA;

  --live: #FF4D64;
  --warn: #B45309;
  --danger: #C7362F;

  --radius: 16px;
  --r-sm: 10px;
  --r-xs: 8px;

  --shadow: 0 1px 2px rgba(9, 17, 29, .04), 0 10px 28px -12px rgba(9, 17, 29, .1);
  --shadow-lg: 0 2px 8px rgba(9, 17, 29, .05), 0 28px 60px -24px rgba(9, 17, 29, .2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "SF Pro Text", system-ui, -apple-system, "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: rgba(11, 20, 34, .16); border-radius: 99px;
  border: 2px solid transparent; background-clip: content-box;
}

.shell { display: grid; grid-template-columns: 234px 1fr; min-height: 100vh; }

/* ---------- 侧栏 ---------- */
.side {
  background:
    radial-gradient(420px 260px at 50% -12%, rgba(11, 166, 120, .16), transparent 68%),
    linear-gradient(180deg, #0A1018, #070B12);
  color: #fff;
  padding: 18px 12px 16px;
  display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, .06);
  overflow-y: auto;
}
.side::-webkit-scrollbar { width: 4px; }
.side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border: 0; }

.side .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.side .mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(145deg, rgba(62, 221, 168, .24), rgba(11, 166, 120, .1));
  border: 1px solid rgba(62, 221, 168, .3);
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
  flex: 0 0 auto;
  overflow: hidden;
}
.side .mark img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.side .name { font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: #fff; line-height: 1.25; }
.side .sub { font-size: 9.5px; color: rgba(255, 255, 255, .34); letter-spacing: .14em; text-transform: uppercase; }

.side .group {
  font-size: 10px; color: rgba(255, 255, 255, .28);
  padding: 16px 11px 6px; letter-spacing: .12em; text-transform: uppercase;
}

.side a.item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  font-size: 13px; color: rgba(255, 255, 255, .6);
  transition: .18s;
  position: relative;
}
.side a.item:hover { background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .92); }
.side a.item svg { opacity: .72; flex: 0 0 auto; transition: .18s; }
.side a.item.active {
  background: linear-gradient(90deg, rgba(62, 221, 168, .16), rgba(62, 221, 168, .05));
  color: #B7F0DF;
  font-weight: 500;
}
.side a.item.active svg { opacity: 1; color: var(--brand-light); }
.side a.item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2.5px; height: 16px; border-radius: 0 2px 2px 0;
  background: var(--brand-light);
  box-shadow: 0 0 10px rgba(62, 221, 168, .7);
}

.side .bottom {
  margin-top: auto; padding: 14px 11px 4px;
  font-size: 11.5px; color: rgba(255, 255, 255, .3);
  border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.side .bottom a { color: rgba(255, 255, 255, .58); transition: .16s; }
.side .bottom a:hover { color: #fff; }

/* ---------- 主区 ---------- */
.main { padding: 26px 30px 56px; max-width: 1260px; width: 100%; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 21px; font-weight: 600; letter-spacing: -.025em; margin: 0 0 4px; }
.page-head p { margin: 0; font-size: 12.5px; color: var(--muted); }

.who { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.who .av {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand-soft), #F4FBF8);
  border: 1px solid rgba(11, 166, 120, .18);
  color: var(--brand-dark);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-pad { padding: 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.card-head .muted { font-size: 12px; color: var(--muted); }

/* ---------- 统计 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat {
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -20px; top: -20px;
  width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(11, 166, 120, .08), transparent 70%);
  pointer-events: none;
}
.stat .k { font-size: 12px; color: var(--muted); margin-bottom: 9px; letter-spacing: .01em; }
.stat .v {
  font-size: 27px; font-weight: 600; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; letter-spacing: 0; }
.stat .trend { font-size: 11.5px; color: var(--brand-dark); margin-top: 7px; display: flex; align-items: center; gap: 4px; }
.stat .trend.down { color: var(--danger); }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 500; color: var(--muted);
  padding: 11px 18px; background: #FAFBFC;
  border-bottom: 1px solid var(--line);
  white-space: nowrap; letter-spacing: .04em;
}
.tbl td {
  padding: 13px 18px; border-bottom: 1px solid var(--line-soft);
  font-size: 13px; vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .14s; }
.tbl tbody tr:hover td { background: #FBFCFE; }
.tbl .title-cell { font-weight: 500; }
.tbl .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tbl .empty-row { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 13px; }
.tbl .num { font-variant-numeric: tabular-nums; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  background: #F1F4F9; color: #4F5E73;
  white-space: nowrap; font-weight: 500;
}
.badge.live { background: #FDECEF; color: #C02A40; }
.badge.off { background: #EEF2F7; color: #7A8798; }
.badge.ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge.warn { background: #FFF4E5; color: var(--warn); }
.badge.gold { background: var(--gold-soft); color: #96692C; }
.badge.dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  font-size: 12.5px; padding: 7px 13px; border-radius: var(--r-xs);
  cursor: pointer; transition: .18s; white-space: nowrap;
  font-weight: 500;
}
.btn:hover { border-color: rgba(11, 166, 120, .42); background: #FBFEFD; color: var(--brand-dark); }
.btn.primary {
  background: linear-gradient(180deg, #17B583, var(--brand));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px -5px rgba(11, 166, 120, .55), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn.primary:hover { filter: brightness(1.05); color: #fff; background: linear-gradient(180deg, #17B583, var(--brand)); }
.btn.ghost-danger { color: #B42318; border-color: #F3D6D3; }
.btn.ghost-danger:hover { background: #FEF4F3; border-color: #E7A9A3; }
.btn.danger { color: var(--danger); border-color: #F0C9C5; }
.btn.danger:hover { background: #FDF3F2; border-color: #E7A9A3; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { flex: 0 0 auto; }

/* ---------- 表单 ---------- */
.form-card { padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field-row { margin-bottom: 17px; }
.field-row:last-child { margin-bottom: 0; }
.field-row label {
  display: block; font-size: 12.5px; color: #35435A;
  margin-bottom: 7px; font-weight: 500;
}
.field-row .hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.65; }

.input, select.input, textarea.input {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r-xs);
  font: inherit; font-size: 13.5px; color: var(--text);
  background: #fff; outline: 0; transition: .18s;
}
.input::placeholder { color: #A9B5C4; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px rgba(11, 166, 120, .12); }
textarea.input { resize: vertical; min-height: 88px; line-height: 1.65; }
select.input { appearance: none; background-image: none; cursor: pointer; }

.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand); }

.form-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-soft);
}

/* ---------- 提示 ---------- */
.flash {
  padding: 12px 15px; border-radius: var(--r-xs); font-size: 13px;
  margin-bottom: 16px; border: 1px solid; line-height: 1.65;
  display: flex; align-items: flex-start; gap: 8px;
}
.flash.ok { background: var(--brand-soft); border-color: #C9EEE2; color: #077052; }
.flash.err { background: #FEF3F2; border-color: #F5D5D2; color: #B42318; }

.notice-box {
  background: #FBFCFD; border: 1px solid var(--line-soft);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-xs); padding: 13px 15px;
  font-size: 12.5px; color: #43536A; line-height: 1.75;
  margin-bottom: 18px;
}
.notice-box code {
  background: #EEF5F2; padding: 1px 6px; border-radius: 4px;
  font-size: 11.5px; color: var(--brand-dark);
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(760px 420px at 50% -10%, rgba(11, 166, 120, .18), transparent 62%),
    radial-gradient(600px 400px at 90% 100%, rgba(41, 96, 168, .1), transparent 66%),
    #070B12;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(700px 460px at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(700px 460px at 50% 0%, #000 30%, transparent 78%);
  pointer-events: none;
}
.login-card {
  width: 100%; max-width: 392px;
  background: linear-gradient(170deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .022));
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 22px; padding: 32px 30px 26px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .1);
  position: relative; z-index: 1;
}
.login-card .mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(145deg, rgba(62, 221, 168, .24), rgba(11, 166, 120, .1));
  border: 1px solid rgba(62, 221, 168, .3);
  display: grid; place-items: center; margin-bottom: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.login-card h1 { font-size: 20px; font-weight: 600; margin: 0 0 7px; letter-spacing: -.02em; color: #fff; }
.login-card p.sub { margin: 0 0 24px; font-size: 12.5px; color: rgba(255, 255, 255, .42); line-height: 1.7; }
.login-card .input {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .13);
  color: #fff;
}
.login-card .input::placeholder { color: rgba(255, 255, 255, .3); }
.login-card .input:focus { border-color: rgba(62, 221, 168, .5); box-shadow: 0 0 0 3.5px rgba(62, 221, 168, .12); }
.login-card .field-row label { color: rgba(255, 255, 255, .6); }
.login-card .btn.primary { width: 100%; padding: 12px; font-size: 14px; margin-top: 8px; border-radius: var(--r-sm); }
.login-foot { margin-top: 18px; font-size: 11.5px; color: rgba(255, 255, 255, .3); text-align: center; }
.login-foot a { color: rgba(255, 255, 255, .55); }

/* ---------- chips ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #F3F6FA; border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 9px; font-size: 12px; color: #43536A;
}
.chip form { display: inline; }
.chip button {
  border: 0; background: none; cursor: pointer;
  color: #98A5B6; font-size: 13px; line-height: 1; padding: 0 0 0 2px;
}
.chip button:hover { color: #B42318; }
.chip label, label.chip { display: inline-flex; align-items: center; }
.chips label.chip input[type="checkbox"] { accent-color: var(--brand); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.tbl .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: static; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 10px 12px;
    border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .07);
  }
  .side .brand { padding: 0 10px 0 2px; margin: 0; border-bottom: 0; }
  .side .sub { display: none; }
  .side .group { display: none; }
  .side a.item { padding: 7px 10px; font-size: 12.5px; }
  .side a.item.active::before { display: none; }
  .side .bottom { margin: 0 0 0 auto; padding: 0; border: 0; font-size: 11px; }
  .main { padding: 18px 16px 44px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { margin-bottom: 16px; padding-bottom: 14px; }
  .page-head h1 { font-size: 18px; }
}

/* ===== 图片上传（封面 / Logo） ===== */
.upload-row { display: flex; gap: 14px; align-items: flex-start; }
.upload-preview {
  width: 168px; aspect-ratio: 16 / 9; flex: 0 0 auto;
  border: 1px dashed var(--line-strong); border-radius: var(--r-xs); overflow: hidden;
  background: #F5F8FB; display: flex; align-items: center; justify-content: center;
}
.upload-preview.square { aspect-ratio: 1 / 1; width: 108px; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-preview .ph { font-size: 12px; color: #98A5B6; }
.upload-ctl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.upload-ctl .input[type="file"] { padding: 8px 11px; font-size: 12.5px; }
.chk-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #43536A; cursor: pointer; user-select: none; }
.chk-row input { accent-color: var(--brand); }
.cover-thumb {
  width: 92px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); display: block; margin-bottom: 6px; background: #F5F8FB;
}
@media (max-width: 960px) { .upload-row { flex-direction: column; } }

/* ===== 商品多图编辑 ===== */
.imgset { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.imgset:empty { display: none; }
.imgset-item {
  position: relative; width: 88px; height: 88px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--line); background: #F7FAFD;
}
.imgset-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgset-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  border: none; border-radius: 50%; background: rgba(9, 15, 24, .66); color: #fff;
  font-size: 13px; line-height: 18px; cursor: pointer; padding: 0;
  transition: .16s;
}
.imgset-del:hover { background: var(--danger); }
.imgset-empty { font-size: 12.5px; color: var(--muted); padding: 14px 0; }
