/* ===== 品牌色板：取自公众号头像「焦糖小牛」=====
   焦糖身体 #D8AC64 → 品牌金；牛角 / 巧克力 #7C381C → 可可棕；
   小牛脸 #FCFCF8 → 奶油白底；杯身 #E4D0BC → 燕麦米。
   整体走暖焦糖奶茶调，对应站点名「安闲」的松弛感。 */
:root {
  --brand: #d89a4e;          /* 焦糖金：品牌识别、图标、选中态 */
  --brand-soft: #f6ead8;     /* 焦糖浅调：浅色底、标签底 */
  --primary: #c2732a;        /* 焦糖橙：主色 */
  --primary-dark: #a85a1e;   /* 深焦糖：按钮深端、选中态（白字 4.9:1）*/
  --cocoa: #7c381c;          /* 可可棕：页头深端、深色强调（白字 8.6:1）*/
  --cream: #fbf7f1;          /* 奶油白：页面底色 */
  --oat: #e2cfbb;            /* 燕麦米：次级底色 */
  --grad-brand: linear-gradient(135deg, #c2732a, #9e5312);
  --grad-header: linear-gradient(135deg, #b5702e, #7c381c);

  --bg: #fbf7f1;
  --card: #ffffff;
  --text: #3a2a1e;
  --muted: #83705f;
  --line: #f0e4d6;
  --ok: #2e9e5b;
  --warn: #c08a2e;
  --danger: #b5482f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(124, 56, 28, .08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 隐藏滚动条但保留滚动能力：兼容微信内置浏览器（iOS WKWebView / 安卓 X5 内核，走
   ::-webkit-scrollbar）、Safari/Chrome（同）、Firefox（scrollbar-width）、旧 Edge（-ms-）。
   只隐藏「滚动条」这个装饰，滚动本身（含微信里的惯性滑动）不受影响。 */
html, body { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch; /* 微信/移动端惯性滚动 */
}

a { color: inherit; text-decoration: none; }

/* 顶部栏：左标题 + 右公众号二维码（同一行、同高，吸顶常驻） */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--grad-header);
  color: #fff; padding: 12px 16px;
  box-shadow: 0 2px 12px rgba(124, 56, 28, .18);
}
/* 内容对齐到与正文相同的 720px 列宽，桌面端标题/二维码不会拉到屏幕两端 */
.appbar__inner {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.appbar__text { min-width: 0; }
.appbar h1 { margin: 0; font-size: 18px; font-weight: 700; }
.appbar p { margin: 2px 0 0; font-size: 12px; opacity: .92; }
.appbar__oa {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 3px 3px 2px; border-radius: 12px; cursor: pointer; font: inherit; color: #fff;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .38);
  transition: transform .08s ease;
}
.appbar__oa:active { transform: scale(.95); }
.appbar__oa img { width: 44px; height: 44px; display: block; border-radius: 7px; background: #fff; }
.appbar__oa span { font-size: 9px; line-height: 1; opacity: .95; letter-spacing: .3px; }

/* 平台 Tab */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
/* 宽屏时让 Tab 与正文列（720px）对齐；窄屏/微信内不触发，观感不变 */
@media (min-width: 752px) {
  .tabs { padding-left: calc((100vw - 720px) / 2 + 16px); padding-right: calc((100vw - 720px) / 2 + 16px); }
}
.tab {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }

/* 维度 / 区块 */
.container { padding: 12px 12px 40px; max-width: 720px; margin: 0 auto; }
.dim { margin-bottom: 18px; }
.dim-title { font-size: 15px; font-weight: 700; margin: 8px 4px; }
.block { background: var(--card); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.block-head { display: flex; align-items: center; gap: 8px; }
.block-icon {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 10px; background: var(--brand-soft);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary-dark); /* 线性图标用 currentColor 着色，跟随主题焦糖色 */
}
.block-icon svg { width: 18px; height: 18px; display: block; }
.block-icon__emoji { font-size: 15px; line-height: 1; } /* 兼容后台自定义 emoji */
/* Ant 图标（sprite 注入）：跟随父级 color 着色；默认 1em，各场景再用 18/22px 覆盖 */
.i-svg { width: 1em; height: 1em; fill: currentColor; flex: none; }
.block-title { font-size: 15px; font-weight: 700; color: var(--cocoa); }
.block-desc { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.cat { margin-top: 10px; }
.cat-name { font-size: 13px; color: var(--muted); margin: 8px 2px 6px; font-weight: 600; }
.cards { display: grid; grid-template-columns: 1fr; gap: 8px; }

/* 领券卡片 */
.card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  transition: transform .05s ease; cursor: pointer;
}
.card:active { transform: scale(.99); }
.card-main { min-width: 0; }
.card-title { font-weight: 600; font-size: 14px; }
.card-desc { color: var(--muted); font-size: 12px; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-btn {
  flex: 0 0 auto; background: var(--grad-brand); color: #fff; font-size: 13px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; box-shadow: 0 2px 8px rgba(168, 90, 30, .26);
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }

/* ---------- 后台管理 ---------- */
.auth-wrap { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.auth-card { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 16px; font-size: 18px; color: var(--cocoa); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
  background: var(--card); color: var(--text); font-family: inherit; outline: none;
  transition: border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.field textarea { resize: vertical; min-height: 56px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: none; border-radius: 10px; background: var(--grad-brand); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn.ghost { background: var(--card); color: var(--primary-dark); border: 1px solid var(--brand); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); }
.nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.nav button { padding: 6px 12px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--muted); }
.nav button.active { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.nav .spacer { flex: 1; }
.panel { padding: 12px; max-width: 920px; margin: 0 auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.toolbar .field { margin: 0; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf5ee; color: var(--muted); font-weight: 600; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: #f4efe7; color: var(--muted); }
.tag.exp { background: #fbebe6; color: var(--danger); }
.tag.soon { background: #fbf1dc; color: var(--warn); }
.tag.biz { background: var(--brand-soft); color: #8c4a16; }
.tag.scn { background: #eaf3de; color: #4b6b2a; }
.modal-mask { position: fixed; inset: 0; background: rgba(58, 42, 30, .45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-mask.show { display: flex; }
.modal { background: var(--card); border-radius: var(--radius); padding: 18px; width: 100%; max-width: 460px; max-height: 86vh; overflow: auto; }
.modal h3 { margin: 0 0 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .n { font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 4px; }
.bar-track { flex: 1; height: 10px; background: #f4efe7; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--grad-brand); }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: rgba(58, 42, 30, .9); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; z-index: 99; display: none; }
.toast.show { display: block; }

/* ---------- 公众号二维码 ----------
   二维码已从页面底部移到顶部 .appbar__oa（与系统标题同高、吸顶常驻），
   原先底部的 .follow-oa 专区已删除，避免同一个二维码在一页里出现两次。 */

/* ---------- 二维码灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(58, 42, 30, .82); align-items: center; justify-content: center; flex-direction: column;
  padding: 24px;
}
.lightbox.show { display: flex; }
.lightbox__img {
  width: 78vw; max-width: 320px; height: auto; background: #fff; padding: 14px;
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.lightbox__tip { margin-top: 16px; color: #fff; font-size: 13px; opacity: .9; }

/* 中转页(/frame)的公众号引流条样式在 handler.go 的 frameHTML 内联 <style> 里——
   中转页是自包含单页，不加载本文件，所以不要在这里改 .oa-banner。 */

/* ===== 后台图标选择器（阿里 Ant Design 图标库）===== */
.icon-pick-row { display: flex; align-items: center; gap: 10px; }
.icon-preview {
  width: 42px; height: 42px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 10px; color: var(--primary-dark); background: var(--brand-soft);
}
.icon-preview .i-svg { width: 22px; height: 22px; }
.icon-preview .ip { font-size: 10px; line-height: 1.2; text-align: center; padding: 0 3px; }
.icon-preview .ip.auto { color: var(--primary); font-size: 11px; }
.icon-preview .ip.txt { color: var(--muted); font-size: 11px; }

.overlay {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(40, 28, 18, .45);
}
.overlay.show { display: flex; }
.picker {
  width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.picker-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--text); }
.picker-x { border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.picker-x:hover { color: var(--text); }
.picker-bar { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.picker-search { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; outline: none; }
.picker-search:focus { border-color: var(--primary); }
.picker-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  padding: 14px 16px; overflow-y: auto; min-height: 220px; max-height: 50vh;
}
.pick-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
  color: var(--text); transition: border-color .12s, background .12s;
}
.pick-cell:hover { border-color: var(--primary); background: var(--brand-soft); }
.pick-cell.sel { border-color: var(--primary); background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.pick-cell .i-svg { width: 22px; height: 22px; }
.pick-cell span { font-size: 10px; color: var(--muted); text-align: center; word-break: break-all; line-height: 1.2; }
.picker-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }
.picker-info { font-size: 12px; color: var(--muted); }
.picker-foot .spacer { flex: 1; }
