/* COTY 小程序运营后台 —— 服务端渲染，无构建步骤 */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #e3e6ea;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #1f6feb;
  --primary-dark: #1552b8;
  --ok: #12805c;
  --warn: #a16207;
  --error: #c0392b;
  --info: #2563eb;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, pre { font-family: ui-monospace, Consolas, "Courier New", monospace; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

h1 { font-size: 22px; margin: 24px 0 14px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 14px; margin: 0 0 10px; color: #374151; }
h4 { font-size: 13px; margin: 14px 0 6px; }

/* ---------- 顶栏 ---------- */
.topbar { background: #101828; color: #fff; }
.topbar-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; height: 52px;
}
.brand { font-weight: 600; letter-spacing: .3px; }
.brand span { font-weight: 400; color: #9aa4b2; font-size: 12px; margin-left: 6px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #cbd5e1; padding: 6px 12px; border-radius: 6px; font-size: 13px;
}
.topbar nav a:hover { background: #1f2937; color: #fff; text-decoration: none; }
.topbar nav a.active { background: #1f6feb; color: #fff; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.topbar .muted { color: #9aa4b2; }

/* ---------- 布局 ---------- */
.container { max-width: 1360px; margin: 0 auto; padding: 0 20px 60px; }
.container.narrow { max-width: 520px; padding-top: 60px; }
.page-head { display: flex; flex-direction: column; gap: 2px; }
.page-head h1 { margin-bottom: 2px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
p { margin: 0 0 10px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card.no-pad { padding: 0; overflow: hidden; }
.card.stat { text-align: center; padding: 18px 10px; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 12px; font-weight: 600; color: #4b5563;
  background: #f8fafc; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid #f1f3f5; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
.table-scroll { max-height: 420px; overflow: auto; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* ---------- 标签 / 徽标 ---------- */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; line-height: 18px; white-space: nowrap;
}
.tag-ok { background: #dcfce7; color: var(--ok); }
.tag-warn { background: #fef3c7; color: var(--warn); }
.tag-error { background: #fee2e2; color: var(--error); }
.tag-info { background: #dbeafe; color: var(--info); }
.tag-muted { background: #eceff3; color: var(--muted); }

/* ---------- 表单 ---------- */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px; align-items: start;
}
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #374151; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid .checks, .form-grid .actions { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; }
.form-grid .actions { gap: 10px; }

input[type="text"], input[type="password"], input[type="number"],
input[type="datetime-local"], select, textarea {
  border: 1px solid #cfd6e0; border-radius: 6px; padding: 7px 9px;
  font: inherit; font-size: 13px; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
textarea { resize: vertical; }
.check { flex-direction: row !important; align-items: center; gap: 6px; }
.check input { width: auto; }
.hint { color: var(--muted); font-size: 11px; }
.req { color: var(--error); margin-left: 2px; }

/* ---------- 按钮 ---------- */
button, .btn {
  display: inline-block; border: 1px solid #cfd6e0; background: #fff; color: var(--text);
  border-radius: 6px; padding: 7px 14px; font: inherit; font-size: 13px;
  cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: #f4f6f9; text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--primary-dark); }
button.danger, .btn.danger { color: var(--error); border-color: #f3c9c4; background: #fff; }
button.danger:hover, .btn.danger:hover { background: #fdf2f1; }
button.small, .btn.small { padding: 3px 9px; font-size: 12px; }
button.block { width: 100%; margin-top: 6px; }
form.inline { display: inline; }
.link-btn { border: none; background: none; color: #9aa4b2; padding: 0; cursor: pointer; font-size: 13px; }
.link-btn:hover { color: #fff; background: none; }

/* ---------- 提示条 ---------- */
.flash-list { margin: 14px 0; }
.flash { padding: 9px 12px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.flash-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }

/* ---------- 其它 ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 0 0 10px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; word-break: break-all; }
.code-block {
  background: #0f172a; color: #d7e0ec; padding: 12px; border-radius: 6px;
  overflow: auto; font-size: 12px; max-height: 340px; line-height: 1.5;
}
.footer { max-width: 1360px; margin: 0 auto; padding: 16px 20px 40px; font-size: 12px; }
.pager { display: flex; align-items: center; gap: 12px; margin: 14px 0; }

details.inline-details { display: inline-block; }
details.inline-details summary { list-style: none; display: inline-block; }
details.inline-details summary::-webkit-details-marker { display: none; }
.popover-form {
  margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 6px;
  background: #fafbfc; min-width: min(760px, 80vw); text-align: left;
}

/* ---------- 登录页 ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; padding: 26px; }
.login-card h1 { margin: 0 0 4px; font-size: 19px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #374151; margin-bottom: 12px; }

/* ---------- 礼遇配置页（/rewards）表格里的窄输入框 ---------- */
table.rewards-table td { vertical-align: top; }
table.rewards-table input[type="text"], table.rewards-table input[type="number"],
table.rewards-table select { padding: 4px 6px; font-size: 12px; }
table.rewards-table input.num { width: 84px; }
table.rewards-table input.code { width: 132px; }
table.rewards-table td.center input { width: auto; }
table.rewards-table .hint { display: block; }
