/* ===========================================================
   小黑课堂 · 课程管理后台
   =========================================================== */

:root {
  --brand: #0fb981;
  --brand-dark: #0a9d6e;
  --brand-soft: #e7faf3;
  --ink: #14181c;
  --ink-2: #4b5563;
  --ink-3: #8a94a0;
  --line: #e6eaee;
  --bg: #f4f6f8;
  --card: #fff;
  --danger: #e5384b;
  --side: #101418;
  --side-2: #1a2027;
  --r: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px -12px rgba(16, 24, 40, .18);
  --ease: cubic-bezier(.22, .68, .28, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; }
img { display: block; max-width: 100%; }

/* ---------------- 按钮 / 表单控件 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, box-shadow .18s, border-color .18s, transform .18s, color .18s;
}
.btn:active { transform: translateY(1px); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: linear-gradient(135deg, #16c98f, var(--brand-dark)); color: #fff; box-shadow: 0 8px 16px -10px rgba(15, 185, 129, .9); }
.btn-primary:hover { box-shadow: 0 10px 20px -10px rgba(15, 185, 129, 1); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); font-weight: 600; }
.btn-ghost:hover { border-color: #cfd6dd; color: var(--ink); background: #fbfcfd; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 8px 16px -10px rgba(229, 56, 75, .9); }
.btn-danger:hover { background: #cf2b3e; }
.btn-block { width: 100%; height: 44px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.link-btn { background: none; border: 0; color: var(--brand-dark); font-weight: 700; font-size: 13px; cursor: pointer; padding: 4px; }
.link-btn:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); letter-spacing: .2px; }
.field-label i { color: var(--danger); font-style: normal; }
.field input, .field select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
}
.field input::placeholder { color: #b3bcc5; }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 185, 129, .13);
}
.field input.is-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229, 56, 75, .1); }
.field-hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

/* ---------------- 登录 ---------------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  position: relative;
  overflow: hidden;
  background: #f4f6f8;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 55% at 18% 12%, rgba(15, 185, 129, .22), transparent 70%),
    radial-gradient(50% 50% at 88% 82%, rgba(255, 122, 24, .18), transparent 70%),
    linear-gradient(135deg, #f7faf9, #eef2f5);
}
.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(16, 24, 40, .07) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at 50% 45%, #000, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000, transparent 72%);
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 404px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 20px;
  padding: 30px 30px 24px;
  box-shadow: 0 30px 60px -30px rgba(16, 24, 40, .35), 0 2px 6px rgba(16, 24, 40, .05);
  animation: cardUp .45s var(--ease) both;
}
@keyframes cardUp { from { opacity: 0; transform: translateY(14px); } }

.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-brand img { width: 40px; height: 40px; border-radius: 12px; }
.login-brand strong { display: block; font-size: 16px; font-weight: 800; line-height: 1.3; }
.login-brand span { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: .6px; }

.login-card h1 { font-size: 22px; font-weight: 900; letter-spacing: .3px; }
.login-sub { margin: 6px 0 20px; font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }

.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 58px; }
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.pw-eye:hover { background: #f1f4f6; color: var(--ink); }

.login-error {
  margin: 10px 0 0;
  padding: 9px 12px;
  background: #fdeef0;
  border: 1px solid #f8d5da;
  border-radius: 8px;
  color: #c0243a;
  font-size: 12.5px;
  line-height: 1.5;
  animation: shake .3s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
#loginBtn { margin-top: 18px; }

.login-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.login-foot a { color: var(--ink-2); font-weight: 600; }
.login-foot a:hover { color: var(--brand-dark); }

/* ---------------- 布局 ---------------- */

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: var(--side);
  color: #cfd7df;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid #232a32; }
.side-brand img { border-radius: 10px; }
.side-brand strong { display: block; font-size: 14.5px; color: #fff; font-weight: 800; line-height: 1.3; }
.side-brand span { display: block; font-size: 10.5px; color: #6e7a86; letter-spacing: .8px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #a8b4c0;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .16s, color .16s;
}
.side-nav button svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.side-nav button:hover { background: #1a2027; color: #e8eef4; }
.side-nav button.is-active { background: linear-gradient(135deg, rgba(22, 201, 143, .18), rgba(10, 157, 110, .1)); color: #fff; box-shadow: inset 0 0 0 1px rgba(22, 201, 143, .28); }
.side-nav button.is-active svg { color: #16c98f; opacity: 1; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 14px; border-top: 1px solid #232a32; }
.side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #9aa6b2;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.side-link svg { width: 16px; height: 16px; }
.side-link:hover { background: #1a2027; color: #fff; }
.side-link.danger:hover { background: rgba(229, 56, 75, .14); color: #ff8b98; }

.main { flex: 1 1 auto; min-width: 0; margin-left: 232px; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(244, 246, 248, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { font-size: 19px; font-weight: 900; letter-spacing: .2px; }
.topbar p { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex: none; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #0a8f66;
  background: var(--brand-soft);
  border: 1px solid #c9f0e2;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.live i { width: 6px; height: 6px; border-radius: 50%; background: #0fb981; animation: live 2s ease-out infinite; }
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(15, 185, 129, .5); }
  70% { box-shadow: 0 0 0 6px rgba(15, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 185, 129, 0); }
}
.menu-btn {
  display: none;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; color: var(--ink-2);
}

.content { padding: 22px 28px 40px; }
.view { display: flex; flex-direction: column; gap: 18px; animation: fadeUp .35s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- KPI ---------------- */

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
}
.kpi::after {
  content: "";
  position: absolute;
  right: -30px; top: -40px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 185, 129, .14), transparent 70%);
}
.kpi-b::after { background: radial-gradient(circle, rgba(255, 138, 24, .16), transparent 70%); }
.kpi-c::after { background: radial-gradient(circle, rgba(59, 130, 246, .14), transparent 70%); }
.kpi-d::after { background: radial-gradient(circle, rgba(168, 85, 247, .14), transparent 70%); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-head span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.kpi-head em { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--brand-dark); background: var(--brand-soft); padding: 1px 6px; border-radius: 4px; }
.kpi-b .kpi-head em { color: #c2410c; background: #fff3e6; }
.kpi-c .kpi-head em { color: #1d4ed8; background: #eaf1ff; }
.kpi-d .kpi-head em { color: #7e22ce; background: #f6ecff; }
.kpi strong { display: block; margin-top: 8px; font-size: 30px; font-weight: 900; letter-spacing: -.8px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi strong.kpi-top { font-size: 15px; font-weight: 800; letter-spacing: 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 44px; }
.kpi small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.kpi strong.flash { animation: flash .7s ease; }
@keyframes flash {
  0% { color: var(--brand-dark); transform: scale(1.06); }
  100% { color: inherit; transform: scale(1); }
}

/* ---------------- 面板 ---------------- */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head-wrap { flex-wrap: wrap; }
.panel-head-l { display: flex; align-items: center; gap: 8px; }
.panel-head h2 { font-size: 15.5px; font-weight: 800; }
.panel-tag { font-size: 11.5px; color: var(--ink-3); background: #f2f5f7; border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; font-weight: 600; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 176px;
  padding-top: 8px;
  background-image: repeating-linear-gradient(to top, rgba(16, 24, 40, .05) 0 1px, transparent 1px 44px);
  background-position: bottom;
}
.chart-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bar-wrap { flex: 1 1 auto; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, #2fd8a6, #0a9d6e);
  transition: height .5s var(--ease), filter .16s;
  position: relative;
}
.chart-col:hover .chart-bar { filter: brightness(1.1) saturate(1.1); }
.chart-col.is-zero .chart-bar { background: #e9edf1; }
.chart-col.is-today .chart-bar { background: linear-gradient(180deg, #ffb020, #ff6a1f); }
.chart-x { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.chart-col.is-today .chart-x { color: #c2410c; font-weight: 700; }

.rank { display: flex; flex-direction: column; gap: 2px; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px dashed #eef1f4; }
.rank li:last-child { border-bottom: 0; }
.rank-no {
  flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800; color: var(--ink-3); background: #f1f4f7;
}
.rank li:nth-child(1) .rank-no { background: linear-gradient(135deg, #ffd166, #ff9f1a); color: #7a3c00; }
.rank li:nth-child(2) .rank-no { background: #e6ebf1; color: #5b6674; }
.rank li:nth-child(3) .rank-no { background: #ffe6d5; color: #b45309; }
.rank-title { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-cat { flex: none; font-size: 11px; color: var(--ink-3); }
.rank-count { flex: none; font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------------- 表格 ---------------- */

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { position: relative; display: inline-flex; align-items: center; }
.search svg { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; }
.search input {
  height: 34px;
  width: 210px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  background: #fbfcfd;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.search input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(15, 185, 129, .12); }

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; min-width: 940px; }
.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  letter-spacing: .3px;
}
.table td { padding: 11px 10px; border-bottom: 1px solid #f1f4f6; vertical-align: middle; }
.table tbody tr:hover { background: #fafcfd; }
.table tbody tr.is-hidden-row { background: #fcfcfd; }
.table tbody tr.is-hidden-row .c-title { color: var(--ink-3); }

.c-idx { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.c-course { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.c-thumb { width: 62px; height: 40px; border-radius: 7px; object-fit: cover; background: #eef1f4; flex: none; border: 1px solid #eef1f4; }
.c-title { font-size: 13px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 340px; }
.c-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.c-cat { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 5px; background: #f1f4f7; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.c-price { font-size: 13px; font-weight: 800; color: #ff3b30; white-space: nowrap; }
.c-price s { display: block; font-size: 10.5px; font-weight: 500; color: #b3bcc5; }
.c-link { max-width: 190px; }
.c-link a { display: block; font-size: 11.5px; color: #2563eb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-link a:hover { text-decoration: underline; }
.c-count { font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--ink); }
.c-count.flash { animation: flash .8s ease; }
.c-count small { font-size: 10px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }

.badge-on, .badge-off {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.badge-on { color: #0a8f66; background: var(--brand-soft); }
.badge-off { color: #7b8794; background: #f0f3f6; }

.row-actions { display: flex; align-items: center; gap: 4px; }
.act {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 9px;
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  transition: all .16s;
}
.act:hover { border-color: #cfd6dd; color: var(--ink); background: #fbfcfd; }
.act-icon { width: 28px; padding: 0; }
.act-icon svg { width: 14px; height: 14px; }
.act-danger:hover { border-color: #f6c9cf; color: var(--danger); background: #fdf2f3; }

.table-empty { text-align: center; padding: 34px 0 20px; color: var(--ink-3); font-size: 13px; }

/* ---------------- 设置表单 ---------------- */

.settings .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------------- 弹窗 ---------------- */

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(12, 17, 22, .5); backdrop-filter: blur(3px); animation: fadeIn .2s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 660px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 40px 80px -30px rgba(10, 15, 20, .55);
  animation: modalUp .28s var(--ease) both;
  overflow: hidden;
}
@keyframes modalUp { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.modal-sm .modal-card { max-width: 400px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h2 { font-size: 16px; font-weight: 800; }
.modal-close { border: 0; background: #f3f6f8; width: 28px; height: 28px; border-radius: 8px; color: var(--ink-3); cursor: pointer; }
.modal-close:hover { background: #e9eef2; color: var(--ink); }
.modal-body { padding: 18px 20px 6px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfcfd; flex: none; }

.upload-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.upload-box {
  position: relative;
  aspect-ratio: 8 / 5;
  border: 1.5px dashed #d5dde4;
  border-radius: 12px;
  background: #fafbfc;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.upload-box:hover, .upload-box.is-drag { border-color: var(--brand); background: var(--brand-soft); }
.upload-box img { width: 100%; height: 100%; object-fit: cover; }
.upload-empty { text-align: center; color: var(--ink-3); padding: 10px; }
.upload-empty svg { margin: 0 auto 6px; color: #9fb0bd; }
.upload-empty strong { display: block; font-size: 12px; color: var(--ink-2); }
.upload-empty small { display: block; font-size: 10.5px; margin-top: 3px; line-height: 1.4; }
.upload-busy {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, .82); font-size: 12.5px; font-weight: 700; color: var(--brand-dark);
}
.upload-side { display: flex; flex-direction: column; gap: 10px; }
.upload-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 9px; height: 40px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; width: 42px; height: 24px; border-radius: 999px; background: #d9e0e7;
  transition: background .2s; flex: none; cursor: pointer;
}
.switch-dot {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s var(--ease);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track .switch-dot { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(15, 185, 129, .25); }
.switch-text { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.switch-field { justify-content: flex-start; }

.form-error {
  margin: 0 0 10px;
  padding: 9px 12px;
  background: #fdeef0;
  border: 1px solid #f8d5da;
  border-radius: 8px;
  color: #c0243a;
  font-size: 12.5px;
}

.confirm-body { padding: 24px 22px 6px; text-align: center; }
.confirm-ic {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; font-weight: 900;
  background: #fdeef0; color: var(--danger);
}
.confirm-body h3 { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.confirm-body p { font-size: 13px; color: var(--ink-2); line-height: 1.6; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  max-width: min(92vw, 400px);
  padding: 11px 18px;
  border-radius: 11px;
  background: rgba(20, 24, 28, .94);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s var(--ease);
  z-index: 200;
  box-shadow: 0 18px 36px -18px rgba(0, 0, 0, .6);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: rgba(200, 30, 46, .96); }
.toast.is-ok { background: rgba(12, 140, 100, .96); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .col-link { display: none; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .26s var(--ease);
    box-shadow: 20px 0 40px -20px rgba(10, 15, 20, .5);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 32px; }
  .topbar { padding: 12px 16px; }
  .topbar-actions .live { display: none; }
  .topbar p { display: none; }
  .settings .form-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .col-cat, .col-price { display: none; }
  .table { min-width: 660px; }
  .c-course { min-width: 180px; }
  .c-title, .c-sub { max-width: 200px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px 12px; }
  .kpi strong { font-size: 24px; }
  .kpi strong.kpi-top { font-size: 13px; min-height: 0; -webkit-line-clamp: 2; }
  .chart { height: 140px; gap: 3px; }
  .chart-x { font-size: 9px; transform: rotate(-45deg); transform-origin: center; }
  .upload-row { grid-template-columns: 1fr; }
  .upload-box { max-width: 260px; }
  .modal-body { padding: 14px 14px 4px; }
  .modal-head, .modal-foot { padding: 13px 14px; }
  .chart-col:nth-child(odd) .chart-x { opacity: 0; }
}

@media (max-width: 520px) {
  .login-card { padding: 24px 20px 20px; border-radius: 16px; }
  .login-card h1 { font-size: 20px; }
  .topbar h1 { font-size: 16.5px; }
  .topbar-actions .btn-primary { display: none; }
  .panel { padding: 14px 14px 16px; border-radius: 12px; }
  .search input { width: 100%; }
  .toolbar { width: 100%; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .toast { bottom: 18px; }
}
