/* ============================================================
   图灵编程 · 管理后台样式：浅色紧凑表格风（设计 token 对齐 web/styles.css）
   零依赖、无构建；语义化标签 + 渐进增强（无 JS 时给出提示）。
   ============================================================ */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --line: #e6eaf3;
  --ink: #182034;
  --ink-2: #5a6580;
  --ink-3: #939db4;
  --primary: #ed6a08;
  --primary-press: #d15a02;
  --primary-soft: #fff1e4;
  --ok: #12a06a;
  --ok-soft: #e3f6ee;
  --danger: #d8404c;
  --danger-soft: #fdeaec;
  --star: #f5a623;
  --r-md: 10px;
  --r-sm: 7px;
  --shadow-1: 0 1px 2px rgba(23, 33, 59, .04), 0 4px 14px rgba(23, 33, 59, .055);
  --shadow-2: 0 4px 10px rgba(23, 33, 59, .06), 0 18px 42px rgba(23, 33, 59, .1);
  --font: "Manrope", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.55 var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
code {
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); padding: 1px 6px; border-radius: 4px;
}
:focus-visible { outline: 2px solid rgba(237, 106, 8, .5); outline-offset: 1px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; border: 0;
  font: 600 13px/18px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(237, 106, 8, .25); }
.btn-primary:hover { background: var(--primary-press); }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.btn-ghost:hover { background: #fff; box-shadow: var(--shadow-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f9d7da; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }

/* ---------- 输入 ---------- */
input[type="text"], input[type="password"], input[type="search"], input[type="number"] {
  font: 500 13px/1.4 var(--font); color: var(--ink);
  padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(237, 106, 8, .12); }
input::placeholder { color: var(--ink-3); }
.cell-input { width: 100%; padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.cell-input.num { width: 58px; text-align: center; }

/* ---------- 登录页 ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(560px 360px at 8% 0%, var(--primary-soft), transparent 60%),
    radial-gradient(480px 320px at 100% 100%, #e2eaff, transparent 60%),
    var(--bg);
}
.login-card {
  width: 380px; max-width: 100%;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-2);
  padding: 34px 32px 28px;
}
.login-card h1 { font-size: 20px; }
.login-sub { margin: 8px 0 20px; color: var(--ink-2); font-size: 13px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-msg { margin-top: 14px; font-size: 13px; line-height: 1.6; min-height: 1em; }
.login-msg.err { color: var(--danger); }
.login-msg.hint { color: var(--ink-2); }
.login-msg ul { margin: 6px 0 0; padding-left: 18px; text-align: left; }

/* ---------- 布局：左侧栏 + 内容 ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 208px; flex: none;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 12px;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.side-mark {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(237, 106, 8, .3);
}
.side-brand b { display: block; font-size: 15px; line-height: 1.2; }
.side-brand span { font-size: 11px; color: var(--ink-3); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  text-align: left; padding: 8px 12px; border: 0; border-radius: var(--r-sm);
  background: none; font: 600 13.5px/1.4 var(--font); color: var(--ink-2); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.side-link:hover { background: var(--bg); color: var(--ink); }
.side-link.active { background: var(--primary-soft); color: var(--primary); }
.side-foot { margin-top: auto; padding: 12px 8px 0; }

.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }

/* ---------- 面板 ---------- */
.panel { max-width: 1060px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 17px; }
.panel-tip { margin: -6px 0 14px; font-size: 12.5px; color: var(--ink-3); }
.sub-head { margin: 22px 0 10px; font-size: 14px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar input { width: 280px; max-width: 100%; }

/* ---------- 数字卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1);
  padding: 14px 16px;
}
.card b { display: block; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; }
.card span { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-2); }
.skeleton {
  position: relative; overflow: hidden; min-height: 64px;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(23, 33, 59, .06), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1);
  overflow: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  text-align: left; padding: 9px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em;
  background: #fafbfe; position: sticky; top: 0;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table td.wrap-cell { white-space: normal; min-width: 160px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; align-items: center; }
.table .row-title { font-weight: 600; }
.table .dim { color: var(--ink-3); }
.table .ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.table-empty { padding: 26px 14px; text-align: center; color: var(--ink-3); }

/* ---------- 徽标 / 状态 ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.5;
  background: var(--bg); color: var(--ink-2);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: var(--danger-soft); color: var(--danger); }
.badge.seed { background: #e2eaff; color: #3b6bff; }
.badge.feat { background: var(--primary-soft); color: var(--primary); }

/* ---------- 上下架开关 ---------- */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; vertical-align: middle; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; background: #d4dae6;
  transition: background .15s ease; pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(23, 33, 59, .3);
  transition: transform .15s ease;
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:disabled + i { opacity: .5; }

/* ---------- 推荐星标 ---------- */
.star {
  border: 0; background: none; cursor: pointer; padding: 2px 4px;
  font-size: 15px; line-height: 1; color: #d4dae6;
  transition: color .12s ease, transform .12s ease;
}
.star:hover { transform: scale(1.15); }
.star.on { color: var(--star); }

/* ---------- 反馈列表 ---------- */
.fb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fb-item {
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1);
  padding: 12px 16px;
}
.fb-item .fb-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.fb-item time { font-size: 12px; color: var(--ink-3); }
.fb-item .fb-text { white-space: pre-wrap; word-break: break-word; }
.fb-item.skeleton { min-height: 56px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(24, 32, 52, .4);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 400px; max-width: 100%;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-2);
  padding: 22px 24px 18px;
}
.modal h3 { font-size: 15px; margin-bottom: 14px; }
.modal .field input, .modal .field textarea { width: 100%; }
.modal textarea {
  font: 500 13px/1.5 var(--font); color: var(--ink);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); resize: vertical;
}
.modal textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(237, 106, 8, .12); }
.modal-tip { margin: -6px 0 12px; font-size: 12px; color: var(--ink-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  z-index: 99; max-width: 78vw;
  background: var(--ink); color: #fff;
  font-size: 13px; font-weight: 500; line-height: 1.5;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-2);
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { width: 100%; flex-direction: row; align-items: center; padding: 10px 14px; }
  .side-brand { padding: 0 10px 0 0; }
  .side-brand span { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; }
  .side-link { white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .main { padding: 16px 14px 30px; }
  .toolbar input { flex: 1; width: auto; }
}
