/* ===========================================================
   SocialProof 控制台样式（无框架依赖）
   -----------------------------------------------------------
   第 49 轮 · 视觉打磨阶段 1：
     1) 自托管 Inter 可变字体（7 个 woff2 子集，浏览器按 unicode-range
        只下载当前页面真正用到的那几个，英文字段典型只拉 latin 48KB）
     2) 设计令牌补齐：颜色 / 字体 / 圆角 / 阴影 / 过渡 / 焦点环
     3) 交互态统一：键盘焦点环、hover 过渡、减少动效降级、滚动条
   =========================================================== */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter-greek-ext.woff2") format("woff2");
    unicode-range: U+1F00-1FFF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter-greek.woff2") format("woff2");
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* ---- 颜色 ---- */
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f9fafb;          /* 次级底色：hover 行、ghost 按钮 */
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #111827;
    --muted: #6b7280;
    --muted-soft: #9ca3af;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: #eef2ff;
    --success: #16a34a;
    --success-soft: #ecfdf5;
    --error: #dc2626;
    --error-soft: #fef2f2;

    /* 语义色（第 52 轮）：一直写死在各条规则里的提示色，
       现在收成令牌，暗色模式只要改这里就行。 */
    --accent-border: #c7d2fe;
    --hover-border: #c7cbd4;
    --success-ink: #166534;
    --success-border: #bbf7d0;
    --error-ink: #991b1b;
    --error-border: #fecaca;
    --warn-soft: #fef3c7;
    --warn-ink: #92400e;
    --warn-border: #fde68a;
    --info-ink: #1e3a8a;
    --info-border: #bfdbfe;
    --code-bg: #0f172a;
    --code-ink: #e2e8f0;

    /* 第 52 轮补：半透明遮罩条 / 顶部公告 / 预览条，暗色下各有一套 */
    --overlay: rgba(255, 255, 255, .94);
    --notice-bg: #111827;
    --notice-ink: #f9fafb;
    --preview-bar-bg: #111827;

    /* ---- 字体 ---- */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    /* ---- 圆角 ---- */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* ---- 阴影：四档，越往下越"浮" ---- */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-md: 0 2px 4px -1px rgba(16, 24, 40, .06), 0 4px 12px -2px rgba(16, 24, 40, .08);
    --shadow-lg: 0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px -2px rgba(16, 24, 40, .06);

    /* ---- 过渡与焦点环 ---- */
    --t: .16s;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --ring: 0 0 0 3px var(--accent-soft);
    /* 顶栏高度。后台的吸顶栏（左侧栏、设置页子导航、标签栏）都按它算 top。
       第 42 轮顶栏能变两行，写死的 66px 会把吸顶栏塞进顶栏底下，
       所以真值由 layout.php 里的脚本量出来覆盖，这里只是没 JS 时的兜底。 */
    --nav-h: 66px;
}

/* 登录后顶栏换成「站点名一行 + 链接条一行」，两行共 104px。
   没 JS 时按这个值兜底，免得吸顶栏被顶栏压住。 */
html:has(.nav.has-subnav) { --nav-h: 104px; }

/* ===========================================================
   暗色模式（第 52 轮 · 阶段 3）
   只在 <html data-theme="dark"> 时生效。选哪个主题由 layout.php 里那段
   「先于绘制」的小脚本决定：localStorage.sp-theme = light / dark / system。
   这里只改令牌，不改任何一条具体规则 —— 所以以后新加的组件自动就能跟着变。
   =========================================================== */
:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0b1020;
    --surface: #151b2e;
    --surface-2: #1c2340;
    --border: #2a3350;
    --border-strong: #3d4767;
    --text: #e8ecf6;
    --muted: #9aa4c0;
    --muted-soft: #737d9c;

    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #232a4d;

    --success: #34d399;
    --success-soft: #10312b;
    --error: #f87171;
    --error-soft: #3a1720;

    --accent-border: #3b4585;
    --hover-border: var(--border-strong);
    --success-ink: #6ee7b7;
    --success-border: #14532d;
    --error-ink: #fca5a5;
    --error-border: #7f1d1d;
    --warn-soft: #3a2c12;
    --warn-ink: #fcd34d;
    --warn-border: #78350f;
    --info-ink: #93c5fd;
    --info-border: #1e3a8a;
    --code-bg: #0b1020;
    --code-ink: #dbe2f0;

    --overlay: rgba(21, 27, 46, .94);
    --notice-bg: #1c2340;
    --notice-ink: #e8ecf6;
    --preview-bar-bg: #262d47;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, .55), 0 4px 12px -2px rgba(0, 0, 0, .5);
    --shadow-lg: 0 8px 24px -6px rgba(0, 0, 0, .65), 0 2px 6px -2px rgba(0, 0, 0, .45);
    --ring: 0 0 0 3px rgba(129, 140, 248, .28);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    /* Inter 在 14px 上字距偏松，收一点点更紧凑；中文由后面的回退字体接管，几乎无感 */
    letter-spacing: -.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t) var(--ease); }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.3; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 .75rem; }

/* ---------- 内联 SVG 图标（第 49 轮 · 阶段 2） ----------
   尺寸默认 1em，跟着所在元素的 font-size 走（.empty .big 是 30px，
   .feature .ico 是 24px），所以换字号不用改图标。
   vertical-align 的负值让图标压在文字基线上，和字混排时不会浮起来。 */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -.125em; flex: none; }
/* 空状态里的大图标：比 emoji 收敛，浅灰不抢标题 */
.empty .big .icon { color: var(--muted-soft); }

/* ===========================================================
   通用弹窗（第 52 轮 · 阶段 3）
   桌面居中、手机贴底（提手就够得到关闭按钮），
   内部可以是 iframe（小部件预览）也可以是普通 HTML。
   =========================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(17, 24, 39, .48);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.modal-backdrop[hidden] { display: none; }

body.modal-lock { overflow: hidden; }

.modal {
    width: min(940px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-title { margin: 0; font-size: 16px; }
.modal-x {
    flex: none;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; background: var(--surface-2); }
.modal-note {
    margin: 0;
    padding: 9px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 12.5px;
}
.modal-frame {
    display: block;
    width: 100%;
    height: min(68vh, 620px);
    border: 0;
    background: #fff;
}
.modal-pad { padding: 18px; }
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.modal-foot[hidden] { display: none; }

@media (max-width: 640px) {
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal { width: 100%; max-height: 94vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .modal-title { font-size: 15px; }
    .modal-frame { height: 54vh; }
    .modal-foot { flex-wrap: wrap; }
    .modal-foot .btn { flex: 1 1 100%; }
}

/* 图标 + 文字并排：SVG 不吃 baseline 空隙，用 inline-flex 对齐 */
.with-icon { display: inline-flex; align-items: center; gap: .4em; }
.with-icon > span { min-width: 0; }

/* 收件箱条目左侧的图标块：替代原来的小圆点 */
.inbox-mark {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 16px;
}
.inbox-mark.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); }
/* 落地页功能卡的图标用品牌色 */
.feature .ico .icon { color: var(--accent); }

::selection { background: var(--accent-soft); color: var(--accent); }

/* 数字等宽：统计数字、表格里的计数和金额不会随数字宽度左右跳动 */
.stat-value, .table td, .table th { font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.wrap { flex-wrap: wrap; }

/* ---------- 布局 ---------- */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 9px 20px;
    display: flex;
    align-items: center;
    gap: 10px 22px;
    flex-wrap: wrap;              /* 菜单是后台可配的，链接一多必须能换行，不能顶出横向滚动条 */
    min-height: 58px;             /* 单行时高度与以前一致（58px） */
}
.brand { font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.nav-links { display: flex; gap: 10px 18px; flex: 1 1 auto; flex-wrap: wrap; min-width: 0; }
.nav-links a { color: var(--muted); font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

/* ---------- 手机端折叠菜单（第 38 轮）----------
   以前窄屏是把 .nav-links 换行铺开，站点菜单一多导航就撑成三五行。
   现在 900px 以内收进汉堡按钮，点开才展开。
   按钮默认 display:none，只有 JS 加上 data-nav-collapsed 才出现 ——
   所以关掉 JS 时仍然按老样子换行铺开，不会丢掉入口。 */
.nav-toggle { display: none; }
.nav-toggle-box {
    display: block; position: relative;
    width: 17px; height: 2px; border-radius: 2px; background: currentColor;
}
.nav-toggle-box::before, .nav-toggle-box::after {
    content: ""; position: absolute; left: 0;
    width: 17px; height: 2px; border-radius: 2px; background: currentColor;
}
.nav-toggle-box::before { top: -6px; }
.nav-toggle-box::after { top: 6px; }

/* 语言切换：两个紧凑的文本按钮，当前语言高亮 */
/* 后台设置卡片里的分组小标题（第 17 轮） */
.card h3 { margin: 24px 0 10px; font-size: 15px; letter-spacing: -.01em; }
.card h3:first-of-type { margin-top: 18px; }
.quick-code { margin: 4px 0 18px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 10px; background: rgba(17, 24, 39, .02); }
.quick-code .field-row { margin-bottom: 10px; }
.quick-code .help { margin-top: 8px; }

/* ---------- 语言下拉（第 17 轮：取代原来那一排语言链接） ---------- */
.lang-select-form { display: inline-flex; align-items: center; gap: 6px; }
.lang-select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    padding: 5px 26px 5px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background-color: var(--surface);
    /* 箭头用内联 SVG：不依赖任何图标字体，图片被禁用也不影响 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 10px 7px;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
    max-width: 168px;
    text-overflow: ellipsis;
}
.lang-select:hover { border-color: var(--accent); color: var(--text); }
.lang-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 品牌区：后台填了 logo 就用图，没填继续用文字 */
.brand-inner { display: inline-flex; align-items: center; gap: 9px; }
.brand-logo { display: block; height: 26px; width: auto; }
.brand .brand-name { color: var(--text); }

/* 顶部公告条（后台可选） */
.site-notice {
    background: var(--notice-bg); color: var(--notice-ink);
    font-size: 13px; line-height: 1.5;
    padding: 9px 18px; text-align: center;
}
.site-notice a { color: var(--notice-ink); text-decoration: underline; }

.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface-2); }
.lang-switch a { padding: 3px 9px; border-radius: 999px; font-size: 12px; line-height: 1.4; color: var(--muted); text-decoration: none; white-space: nowrap; }
.lang-switch a:hover { color: var(--text); }
.lang-switch a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.narrow { max-width: 460px; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.card.tight { padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.stat-sub { color: var(--muted); font-size: 12px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
/* 表格里的长串（服务器路径、密钥、URL）允许断行，否则一样会把页面撑宽 */
.table th, .table td { overflow-wrap: anywhere; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
    background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit; text-decoration: none; white-space: nowrap;
    transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease),
                color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:hover { background: var(--accent-hover); text-decoration: none; box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn.danger { background: var(--error); }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; padding: 6px 8px; }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); filter: none; }
/* 第 63 轮：后台「删账号」的危险区（红框），与普通卡片一眼分开 */
.card.danger { border-color: var(--error-soft); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.input.sm, .select.sm { padding: 6px 9px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.input, .select, .textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
    font-size: 14px; font-family: inherit; color: var(--text); background: var(--surface);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
.textarea { min-height: 90px; resize: vertical; }
.input[type="color"] { padding: 3px; height: 38px; cursor: pointer; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px;
    font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.badge.on { background: var(--success-soft); color: var(--success); }
.badge.off { background: var(--error-soft); color: var(--error); }
.badge.info { background: var(--accent-soft); color: var(--accent); }

/* ---------- 提示 ---------- */
.alert { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; }
.alert.success { background: var(--success-soft); color: var(--success-ink); border: 1px solid var(--success-border); }
.alert.error { background: var(--error-soft); color: var(--error-ink); border: 1px solid var(--error-border); }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- 图表 ---------- */
/* 第 49 轮：网格线和折线留在 SVG 里（横向拉伸正好实现「随容器自适应」），
   所有文字搬到 HTML 覆盖层 —— SVG 里的 text 会被 preserveAspectRatio="none"
   拉变形，覆盖层里的字是真实字号。两层用同一套百分比坐标，见 app/chart.php。 */
.chart-box { position: relative; }
/* 网格线走 CSS 变量：SVG 属性里写不了 var()，但 class 里能写 */
.chart-grid { stroke: var(--border); }
/* 暗色下把图表整体提亮：系列颜色是 PHP 传进来的，改不到，
   brightness 是最省事又不会把颜色弄串的办法。 */
:root[data-theme="dark"] .chart { filter: brightness(1.5) saturate(1.05); }
.chart { display: block; width: 100%; height: 100%; }
.chart-x, .chart-y { position: absolute; inset: 0; pointer-events: none; }
.chart-x span, .chart-y span {
    position: absolute; font-size: 11px; line-height: 1; color: var(--muted-soft); white-space: nowrap;
}
/* Y 轴刻度：右边缘贴在绘图区左边缘再让开 6px */
.chart-y span { right: calc(100% - var(--plot-left, 5%) - 6px); transform: translateY(-50%); }
/* X 轴日期：首尾两个改成左/右对齐，否则一半会跑到画布外面被裁掉 */
.chart-x span { bottom: 4px; transform: translateX(-50%); }
.chart-x span:first-child { transform: none; }
.chart-x span:last-child { transform: translateX(-100%); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ---------- 代码块 ---------- */
.code {
    background: var(--code-bg); color: var(--code-ink); padding: 13px 15px; border-radius: 9px;
    font-family: var(--font-mono); font-size: 12.5px;
    /* 折行而不是横向滚动（第 37 轮）：安装代码里是一整条带 key 的 URL，
       nowrap 会把 380px 的右栏撑出滚动条，首尾都被切掉看不全。 */
    overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0;
}

/* 标签 / 值成对的一行（安装代码卡里的 «Conversion webhook + 长 URL»）：
   flex 子项默认 min-width:auto，长 URL 断不开就会把左侧标签压成一列一个字。 */
.kv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kv-row > * { min-width: 0; }
.kv-row > .mono { overflow-wrap: anywhere; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 8px; }

/* ---------- 首页 ---------- */
.hero { padding: 70px 20px 50px; text-align: center; }
.hero h1 { font-size: 38px; letter-spacing: -.03em; margin-bottom: 14px; }
.hero p { font-size: 17px; color: var(--muted); max-width: 620px; margin: 0 auto 26px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature .ico { font-size: 24px; margin-bottom: 8px; }

/* ---------- 预览 ---------- */
.preview-frame {
    width: 100%; height: 560px; border: 1px solid var(--border); border-radius: var(--radius);
    background: #fff;
}

/* ---------- 分栏 ---------- */
.split { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
/* 网格子项默认 min-width:auto，里面只要有一个不可断行的东西（代码块、
   长密钥、nowrap 的标签栏），整列就会按「最小内容宽度」撑开，
   窄屏直接整页横向滚动：/notifications/{id} 在 390px 上被撑到 764px。 */
.split > * { min-width: 0; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ---------- 仪表盘「实时事件」 ----------
   一行一条事件，右列「时间 + 落地页」并排不换行；列表自身限高内滚，
   这样右卡片的高度和左边「表现最好的小部件」大致齐平，不会拖出半屏空白。 */
.live-feed { max-height: 366px; overflow-y: auto; padding-right: 4px; margin-right: -4px; }
.live-item {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border);
}
.live-item:last-child { border-bottom: 0; }
.live-item-main { display: flex; align-items: baseline; gap: 8px; flex: 1 1 auto; min-width: 0; }
.live-item-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-item-meta { display: flex; align-items: baseline; gap: 8px; flex: 0 0 auto; }
@media (max-width: 900px) {
    .live-feed { max-height: none; overflow: visible; padding-right: 0; margin-right: 0; }
}

/* ---------- 导航换行（平板 / 窄窗口 / 手机） ----------
   两个都不能少：
     1. 以前窄屏直接把 .nav-links 藏了，等于手机上没有任何入口；
     2. 720~900 这一段（768 的平板最典型）一行放不下，会把
        「Start free / 用户名」挤出屏幕，出现横向滚动条。
   所以从 900px 起就允许换行：品牌 + 账号区一行，导航链接铺第二行。 */
@media (max-width: 900px) {
    .nav-inner {
        height: auto;
        min-height: 58px;
        flex-wrap: wrap;
        row-gap: 4px;
        padding: 8px 16px;
    }
    .nav-links {
        order: 3;
        flex: 1 0 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2px 14px;
        font-size: 13px;
    }
    .nav-links a { padding: 2px 0; }
    .nav-user { margin-left: auto; }

    /* 折叠态：链接整块收起，按钮接管 */
    .nav[data-nav-collapsed] .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        flex: 0 0 auto; width: 34px; height: 34px;
        margin-left: 2px; padding: 0;
        border: 1px solid var(--border); border-radius: 9px;
        background: var(--surface); color: var(--text); cursor: pointer;
    }
    .nav[data-nav-collapsed] .nav-toggle:hover { background: var(--bg); }
    .nav[data-nav-collapsed] .nav-links { display: none; }
    .nav[data-nav-collapsed].nav-open .nav-links {
        display: flex; flex-direction: column; flex-wrap: nowrap;
        align-items: stretch; justify-content: flex-start;
        gap: 0; padding-top: 6px;
        border-top: 1px solid var(--border);
    }
    .nav[data-nav-collapsed].nav-open .nav-links a {
        padding: 10px 8px; border-radius: 9px; font-size: 15px;
    }
    .nav[data-nav-collapsed].nav-open .nav-links a:hover,
    .nav[data-nav-collapsed].nav-open .nav-links a.active { background: var(--bg); color: var(--text); }
}

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
    .hero h1 { font-size: 28px; }
    .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
    /* 窄屏只剩 3 列，宽度够：不让表头拆词（overflow-wrap:anywhere 会把 STATUS 断成 STATU / S）。
       宽屏不加这条 —— 7 列全开时 nowrap 会把表格的最小宽度顶大，反而撑破页面。 */
    .table th { white-space: nowrap; }
    /* 嵌入代码里有很长的 URL，窄屏折行比横向滚动好读 */
    pre.code { white-space: pre-wrap; overflow-wrap: anywhere; }
}

/* ===========================================================
   套餐 / 定价 / 配额
   =========================================================== */

.hero { padding: 18px 0 6px; }
.hero h1 { font-size: 26px; }

.plans-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
    align-items: stretch;
    margin-top: 6px;
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.plan-flag { position: absolute; top: -11px; right: 16px; }
.plan-name { font-size: 17px; font-weight: 650; }
.plan-price { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.plan-price small { font-size: 13px; font-weight: 500; opacity: .6; }

.plan-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.plan-features li { display: flex; gap: 8px; align-items: flex-start; }
.plan-features .tick { color: var(--success); font-weight: 700; flex: 0 0 auto; }
.plan-cta { margin-top: auto; }

.price-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    margin-top: 8px;
}
.price-toggle a { padding: 7px 16px; border-radius: 999px; font-size: 13px; color: inherit; }
.price-toggle a:hover { text-decoration: none; }
.price-toggle a.active { background: var(--accent); color: #fff; }

.usage-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.usage-bar { height: 8px; border-radius: 999px; background: rgba(127, 127, 127, .16); overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.usage-full { color: var(--error); font-weight: 600; }

/* ---------- 区间选择条（第 37 轮：统计页自定义时间） ---------- */
.range-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.range-bar .range-field { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
/* .input 默认 width:100%，日期框会把整条撑开 */
.range-bar .input { width: auto; }

/* ===========================================================
   后台外壳：左侧固定导航栏 + 右侧内容（第 37 轮）
   -----------------------------------------------------------
   后台有 24 个入口，之前平铺在顶栏，1024~1440 一律换成两行，
   再窄一点就三行，把正文顶下去一大截。
   宽屏改成左侧竖栏；窄屏退回「一条可横向滚动的横条」，
   比换行堆叠好找，也不占高度。
   =========================================================== */

.admin-shell {
    display: grid;
    grid-template-columns: 226px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.admin-rail { position: sticky; top: calc(var(--nav-h) + 12px); max-height: calc(100vh - var(--nav-h) - 30px); overflow-y: auto; }
.admin-rail-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); font-weight: 700; margin: 0 0 8px 12px;
}

.admin-subnav {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.admin-subnav a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
}
.admin-subnav a:hover { background: var(--bg); text-decoration: none; }
.admin-subnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- 设置页子导航（第 38 轮）----------
   设置页有二十多张卡片。宽屏让标签换行会占掉三四行，吸顶就太占高度，
   所以一律「单行 + 横向滚动」，当前节由脚本高亮并自动滚进可视区。 */
.settings-nav {
    /* top 必须正好等于顶栏高度：早先写成 nav-h + 12px，吸顶时顶栏和这条之间
       留出 12px 透明缝，正文会从缝里透出来（站长报的「顶部被遮盖」）。
       静止时的间距改由 margin-top 给，位置一样，但吸顶时严丝合缝。 */
    position: sticky; top: var(--nav-h); z-index: 30;
    margin-top: 12px;
    display: flex; gap: 6px; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
    padding: 8px 10px; margin: 0 0 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* 二十多个标签排成一条，装不下就横滚。系统滚动条会在吸顶栏底下压出一条
       灰杠（看着像被盖住了），所以整条隐藏，交给脚本把当前项滚进视野。 */
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* 左右还有内容时压一层渐隐，提示还能滚；class 由脚本按滚动位置切 */
    --toc-fade-l: 0px;
    --toc-fade-r: 0px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--toc-fade-l), #000 calc(100% - var(--toc-fade-r)), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 var(--toc-fade-l), #000 calc(100% - var(--toc-fade-r)), transparent 100%);
}
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav.can-left { --toc-fade-l: 26px; }
.settings-nav.can-right { --toc-fade-r: 26px; }
.settings-nav a {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px; font-weight: 500; color: var(--muted);
    white-space: nowrap;
}
.settings-nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.settings-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
/* 点锚点跳过去时，别让目标卡片被顶部导航和这条吸顶栏盖住。
   留白 = 顶栏高度 + 吸顶栏自身（约 60px，含横向滚动条）+ 一点余量。 */
.settings-nav ~ .card { scroll-margin-top: calc(var(--nav-h) + 96px); }

.admin-main { min-width: 0; }
/* 后台正文自己不带 container（外壳已经给了内边距和宽度） */
.admin-main > main { padding: 0; margin: 0; max-width: none; }

@media (max-width: 1000px) {
    .admin-shell { grid-template-columns: 1fr; gap: 14px; padding: 16px 20px 50px; }
    /* min-width:0 不能少：格子项默认 min-width:auto，横条的 max-content 宽度
       （26 个子菜单一行）会把整格撑到 1600 多像素，手机上一屏只能看到左上角。 */
    .admin-rail { position: static; max-height: none; overflow: hidden; min-width: 0; }
    .admin-rail-title { display: none; }
    .admin-subnav {
        flex-direction: row; flex-wrap: nowrap; gap: 4px;
        overflow-x: auto; padding: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .admin-subnav a { white-space: nowrap; flex: 0 0 auto; }
}

/* ===========================================================
   小部件编辑器：分组标签页 / 吸底操作栏 / 字段分组
   -----------------------------------------------------------
   用 :checked 做纯 CSS 标签页，不依赖 JS：
   面板始终在 DOM 里，所以提交时所有字段都会带上，
   没有 JS 也不会丢数据。
   =========================================================== */

.tab-radio { position: absolute; opacity: 0; pointer-events: none; }

.tabs-bar {
    display: flex; gap: 4px; flex-wrap: wrap;
    padding: 4px; margin-bottom: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; box-shadow: var(--shadow);
    position: sticky; top: calc(var(--nav-h) + 12px); z-index: 20;
}
.tabs-bar label {
    flex: 1 1 auto; text-align: center; cursor: pointer;
    padding: 8px 14px; border-radius: 999px;
    font-size: 13px; font-weight: 600; color: var(--muted);
    white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.tabs-bar label:hover { color: var(--text); background: var(--bg); }
.tabs-bar .tab-count { font-weight: 500; opacity: .65; margin-left: 4px; }

.tab-panel { display: none; }

#tab-basic:checked ~ .tabs-bar label[for="tab-basic"],
#tab-content:checked ~ .tabs-bar label[for="tab-content"],
#tab-display:checked ~ .tabs-bar label[for="tab-display"],
#tab-appearance:checked ~ .tabs-bar label[for="tab-appearance"] {
    background: var(--accent); color: #fff;
}
#tab-basic:checked ~ .tab-panels > .tab-panel[data-tab="basic"],
#tab-content:checked ~ .tab-panels > .tab-panel[data-tab="content"],
#tab-display:checked ~ .tab-panels > .tab-panel[data-tab="display"],
#tab-appearance:checked ~ .tab-panels > .tab-panel[data-tab="appearance"] {
    display: block;
}

/* 没有 JS 时也能看到全部内容：CSS 若被禁用则所有面板本来就可见 */

/* 内容分组：把 12 个字段拆成「文案 / 素材 / 数据池 / 行为 / 链接」 */
.field-group { margin-bottom: 22px; }
.field-group:last-child { margin-bottom: 0; }
.field-group > h3 {
    font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin: 0 0 10px; padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
}

/* 吸底操作栏：长表单滚到哪都能保存 */
.action-bar {
    position: sticky; bottom: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: 4px 0 20px; padding: 12px 16px;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 -1px 12px rgba(16, 24, 40, .07);
}
.action-bar .spacer { flex: 1 1 auto; }

/* 预览卡片头部的小按钮 */
.preview-tools { display: flex; gap: 6px; align-items: center; }

/* textarea / 素材 / 池子类字段内容长，横跨整行更易读 */
.field-grid > .field.wide { grid-column: 1 / -1; }

/* 类型选择卡：选中时整张卡高亮，不用去找那个小圆点 */
/* 类型色块的软底：由 --tint 现算 —— 浅色主题得到淡彩、暗色主题得到深彩，
   所以同一个 --tint 在两种主题下都好看。视图里只写 --tint 就够了。 */
.type-card, .tint-mark {
    --tint-soft: color-mix(in srgb, var(--tint, var(--accent)) 13%, var(--surface));
}

.feature:has(input[type="radio"]:checked) {
    border-color: var(--tint, var(--accent));
    box-shadow: 0 0 0 1px var(--tint, var(--accent)), var(--shadow);
    background: var(--tint-soft, var(--accent-soft));
}
.feature:has(input[type="radio"]) { transition: border-color .15s ease, background .15s ease; }
.feature:hover { border-color: var(--hover-border); }

/* ---------- 第 52 轮：每个部件类型自己的颜色 ----------
   类型卡上会带 --tint / --tint-soft 两个自定义属性（视图里写死成类型的默认色），
   没带的话就回落成系统主色，所以老页面、站长自建类型照旧。 */
.tint-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--tint-soft, var(--accent-soft));
    color: var(--tint, var(--accent));
    font-size: 16px;
}

.type-card .ico {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tint-soft, var(--accent-soft));
    color: var(--tint, var(--accent));
    font-size: 22px;
    margin-bottom: 10px;
}
.type-card .ico .icon { color: inherit; }

/* 字段较多的类型：两列排布，减少滚动 */
@media (min-width: 700px) {
    .field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
}

/* 登出按钮等需要 POST 表单包装的位置，让它与其他导航项对齐 */
.inline-form {
    display: inline-flex;
    margin: 0;
}
.inline-form button {
    font: inherit;
}

/* ===========================================================
   公开落地页（未登录首页 / 营销页）
   =========================================================== */

.landing-hero { padding: 74px 20px 44px; text-align: center; }
.landing-hero h1 { font-size: 40px; letter-spacing: -.03em; margin-bottom: 14px; line-height: 1.15; }
.landing-hero p { font-size: 17px; color: var(--muted); max-width: 640px; margin: 0 auto 26px; }

.public-nav .nav-links { justify-content: center; }

.trust-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    text-align: center;
}
.trust-bar > div { display: flex; flex-direction: column; gap: 2px; }
.trust-bar strong { font-size: 18px; letter-spacing: -.01em; }

.section-title { font-size: 26px; letter-spacing: -.02em; margin-bottom: 6px; }
.section-sub { color: var(--muted); font-size: 15px; margin-bottom: 22px; max-width: 760px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
}
.chip.on { border-color: var(--accent-border); background: var(--accent-soft); }
.chip .muted { margin-left: 4px; }

.cta-band {
    display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 24px 26px;
}
.cta-band h2 { margin: 0 0 4px; }
.cta-band.final { background: var(--accent-soft); border-color: var(--accent-border); }

.faq { display: grid; gap: 10px; max-width: 860px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 8px; }
.faq p { margin: 0; color: var(--muted); }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 44px; }
.site-footer .container { padding: 34px 20px 26px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.footer-grid h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.footer-grid a { display: block; padding: 3px 0; font-size: 13px; color: var(--text); }
.footer-grid a:hover { color: var(--accent); }
.footer-grid .brand { display: inline-block; margin-bottom: 8px; }
.footer-bottom {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    border-top: 1px solid var(--border); margin-top: 26px; padding-top: 16px;
}

/* ---------- 博客 / 独立页面（前台） ---------- */
.blog-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.blog-head h1 { font-size: 30px; letter-spacing: -.02em; }

.post-shell { max-width: 720px; margin: 0 auto; }   /* 正文单栏居中，1440 下不会贴在左边 */
.post-crumbs a { color: var(--muted); }
.post-title { font-size: 32px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 10px; }
.post-lede { font-size: 17px; color: var(--muted); margin: 0 0 10px; }
.post-meta { margin: 0 0 18px; }
.post-cover { display: block; width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 4px; }

/* 正文：Markdown 渲染出来的元素只有这几种，逐一给样式就够了 */
.post-body { font-size: 16px; line-height: 1.75; overflow-wrap: anywhere; }
.post-body > * + * { margin-top: 1em; }
.post-body h2 { font-size: 22px; letter-spacing: -.01em; margin-top: 1.5em; }
.post-body h3 { font-size: 18px; margin-top: 1.3em; }
.post-body ul, .post-body ol { padding-left: 22px; }
.post-body li + li { margin-top: .35em; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; }
.post-body blockquote { margin: 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--border); color: var(--muted); }
.post-body code { background: rgba(17, 24, 39, .07); padding: 1px 5px; border-radius: 5px; font-size: 14px; }
.post-body pre.code { background: var(--code-bg); color: var(--code-ink); padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
.post-body pre.code code { background: none; color: inherit; padding: 0; }
.post-body hr { border: 0; border-top: 1px solid var(--border); }

.post-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.post-card {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    color: inherit;
}
.post-card:hover { text-decoration: none; border-color: var(--hover-border); }
.post-thumb {
    flex: 0 0 auto;
    height: 150px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
    font-size: 40px; font-weight: 700; color: var(--accent);
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.post-card-body h2 { font-size: 17px; letter-spacing: -.01em; margin: 0; }
.post-card-body p { margin: 0; }
.post-card.featured { display: grid; grid-template-columns: 1.05fr 1fr; margin-bottom: 20px; }
.post-card.featured .post-thumb { min-height: 210px; height: 100%; font-size: 56px; }
.post-card.featured h2 { font-size: 22px; }

.pager { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 26px; }
.pager a { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font-size: 13px; }
.pager a:hover { text-decoration: none; border-color: var(--accent); }
.pager a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 编辑器里的译文卡片：折叠时一行，展开后是一个逐字段对照的表单 */
.lang-block { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.lang-block summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.lang-block[open] summary { margin-bottom: 10px; }
.lang-block form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }

/* 预览 iframe 里的顶部提示条 */
.preview-bar { position: sticky; top: 0; z-index: 5; background: var(--preview-bar-bg); color: #fff; font-size: 12px; padding: 7px 14px; text-align: center; }

@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
    .post-title { font-size: 25px; }
    .post-lede { font-size: 15px; }
    .post-card.featured { grid-template-columns: 1fr; }
    .post-card.featured .post-thumb { min-height: 150px; font-size: 44px; }
    .landing-hero { padding: 44px 18px 30px; }
    .landing-hero h1 { font-size: 30px; }
    .section-title { font-size: 21px; }
    .cta-band { flex-direction: column; align-items: flex-start; }
}

/* ---------- growth: inbox, badges, payouts ---------- */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 5px;
    margin-left: 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.inbox-list { display: block; }
.inbox-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.inbox-item:last-child { border-bottom: 0; }
.inbox-item.unread { background: var(--accent-soft); }
.inbox-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--border);
}
.inbox-dot.on { background: var(--accent); }
.inbox-body { flex: 1 1 auto; min-width: 0; }
.inbox-title { font-weight: 600; }
.inbox-text { color: var(--text); font-size: 13px; }
.inbox-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.usage-row { display: flex; align-items: center; gap: 10px; }
.usage-row .usage-bar { flex: 1 1 auto; }

/* ---------- Round 23: email marketing, reports and logs ---------- */
.stack { display: flex; flex-direction: column; gap: 18px; }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.alert.info { background: var(--accent-soft); color: var(--info-ink); border: 1px solid var(--info-border); }
.alert.warn { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-border); }

/* Honeypot field: bots fill it in, people never see it. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.footer-subscribe {
    border-top: 1px solid var(--border);
    margin-top: 22px;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-subscribe h4 { margin: 0 0 2px; }
.footer-subscribe form { margin: 0; }
.footer-subscribe .input { min-width: 220px; }

/* Activity log detail column */
.log-detail { color: var(--muted); font-size: 12px; word-break: break-word; }

/* ---------------------------------------------------------------- round 24
   Browser push: footer opt-in strip, the notification mock-up shown while an
   admin writes a campaign, and a couple of small helpers. */

.footer-push {
    border-top: 1px solid var(--border);
    margin-top: 22px;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
/* The newsletter strip above already draws the divider. */
.footer-subscribe + .footer-push { border-top: 0; margin-top: 10px; padding-top: 0; }
.footer-push h4 { margin: 0 0 2px; }
.footer-push [data-push-status] { max-width: 260px; }

.btn.is-busy { opacity: .6; pointer-events: none; }
.stat-value.small-value { font-size: 20px; }

.push-preview {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .06);
}
.push-preview-icon {
    width: 38px; height: 38px;
    flex: 0 0 38px;
    border-radius: 9px;
    background: var(--accent, #4f46e5);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.push-preview-icon img { width: 100%; height: 100%; object-fit: cover; }
.push-preview-dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .85); }
.push-preview-body { min-width: 0; }
.push-preview-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.push-preview-text { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.push-preview-host { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ===== Round 25: taxes, invoices & credit notes ===== */
.mt-0 { margin-top: 0; }
.tax-country {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.tax-country > label { font-size: 13px; color: var(--muted); }
.tax-country select { max-width: 260px; width: auto; }
.tax-line { font-size: 12px; margin-top: 2px; }
.invoice-totals { max-width: 340px; margin: 18px 0 0 auto; }
.invoice-totals .totals-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.invoice-totals .totals-row.total {
    font-weight: 700;
    font-size: 16px;
    border-top: 2px solid var(--border);
    border-bottom: 0;
    color: var(--accent);
    padding-top: 10px;
}
.invoice-totals .totals-row span:last-child { white-space: nowrap; }
.item-row .item-qty { max-width: 92px; }
.item-row .item-unit { max-width: 132px; }
.item-row .item-amount { font-variant-numeric: tabular-nums; }
.item-remove { line-height: 1; padding: 4px 9px; }
table .invoice-totals { margin-top: 10px; }
@media (max-width: 640px) {
    .invoice-totals { max-width: none; margin-left: 0; }
}

/* ===========================================================
   第 27 轮：入门清单（Spotlight）与 PWA
   =========================================================== */
.center-text { text-align: center; }
.ml-1 { margin-left: .35rem; }

/* 进度条 */
.progress {
    height: 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    background: var(--accent);
    transition: width .3s ease;
}

/* 入门清单 */
.spotlight-next {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-top: .85rem;
}
.spotlight-steps {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: grid;
    gap: .25rem;
}
.spotlight-steps li {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .5rem .25rem;
    border-top: 1px solid var(--border);
}
.spotlight-steps li:first-child { border-top: 0; }
.spotlight-steps .tick {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--muted);
}
.spotlight-steps li.done .tick {
    background: var(--success-soft);
    border-color: var(--success);
    color: var(--success);
}
.spotlight-steps li.done a { color: var(--muted); text-decoration: line-through; }
.spotlight-body { flex: 1 1 auto; }
.spotlight-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.spotlight-steps li.done .spotlight-state { color: var(--success); }
.spotlight-restore {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
    padding: .35rem .75rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* PWA 安装提示：只在浏览器主动给出安装机会时出现 */
.pwa-prompt {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: space-between;
    max-width: min(560px, calc(100vw - 24px));
    padding: .75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 60;
}
.pwa-prompt-body { display: flex; flex-direction: column; }
.pwa-prompt-actions { display: flex; gap: .5rem; }

/* 离线页 */
.offline-card { max-width: 520px; margin: 3rem auto; }
.offline-icon { font-size: 42px; line-height: 1; }

/* ===========================================================
   Cookie 同意横幅（第 30 轮）
   =========================================================== */
.sp-consent {
    position: fixed;
    z-index: 2147482000;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 18px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 34px rgba(16, 24, 40, .16);
    font-size: 13px;
    line-height: 1.55;
}
.sp-consent[hidden] { display: none; }
.sp-consent-text { flex: 1 1 320px; min-width: 0; }
.sp-consent-text p { margin: 0; }
.sp-consent-link { display: inline-block; margin-top: 4px; font-size: 12px; }
.sp-consent-actions { display: flex; gap: 8px; flex: 0 0 auto; margin-left: auto; }

/* 左下 / 右下：窄卡片，不横跨整屏 */
.sp-consent-bottom_left,
.sp-consent-bottom_right { max-width: 460px; }
.sp-consent-bottom_left { right: auto; }
.sp-consent-bottom_right { left: auto; }

@media (max-width: 640px) {
    .sp-consent,
    .sp-consent-bottom_left,
    .sp-consent-bottom_right {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
        padding: 12px 14px;
    }
    .sp-consent-actions { width: 100%; margin-left: 0; }
    .sp-consent-actions .btn { flex: 1 1 auto; }
}


/* ===========================================================
   第 32 轮：社交登录 / 站内公告 / 广告位
   =========================================================== */

/* ---- 社交登录按钮 ---- */
.social-auth { margin-top: 18px; }
.social-auth-or {
    display: flex; align-items: center; gap: 10px;
    color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    margin: 4px 0 12px;
}
.social-auth-or::before,
.social-auth-or::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.social-auth-list { display: grid; gap: 8px; }

.social-btn { display: flex; align-items: center; gap: 10px; text-align: left; }
.social-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 6px; flex: none;
    background: var(--brand, #4f46e5); color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: -.02em;
}

/* ---- 账户中心：已连接的账号 ---- */
.social-links { display: grid; gap: 10px; }
.social-link-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg);
}
.social-link-name { flex: 1; display: flex; flex-direction: column; line-height: 1.35; font-weight: 600; }
.social-link-name .muted { font-weight: 400; }

/* ---- 站内公告 ---- */
.announcement {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 10px 18px; font-size: 13px; color: #fff; background: #2563eb;
}
.announcement-inner {
    flex: 1; max-width: 1180px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
}
.announcement-text { text-align: center; }
.announcement-link { color: #fff; text-decoration: underline; font-weight: 600; white-space: nowrap; }
.announcement-close {
    background: transparent; border: 0; color: #fff; cursor: pointer;
    font-size: 20px; line-height: 1; padding: 0 4px; opacity: .75;
}
.announcement-close:hover { opacity: 1; }
.announcement-info { background: #2563eb; }
.announcement-success { background: #059669; }
.announcement-warning { background: #d97706; }
.announcement-promo { background: linear-gradient(90deg, #4f46e5, #9333ea 55%, #db2777); }

/* ---- 广告位 ---- */
.ad-slot { max-width: 1180px; margin: 0 auto 18px; padding: 0 20px; }
.ad-slot-bottom { margin: 24px auto 0; }
.ad-slot img, .ad-slot iframe { max-width: 100%; }

/* ---- 后台：公告译文分组 ---- */
.translation-block { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.translation-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* ---------- 第 36 轮：长列表页的固定动作条 ----------
   部件选型页有 30+ 张类型卡片，按钮固定在视口底部，
   不用滚到最后一行才知道要点哪里。 */
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
    padding: 12px 16px;
    background: var(--overlay);
    border-top: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -1px 2px rgba(16, 24, 40, .04);
    backdrop-filter: blur(6px);
}
@media (max-width: 640px) {
    .sticky-actions { padding: 10px 12px; }
}


/* ---------- 顶栏的子导航形态（第 39 轮）----------
   站长在「菜单」页把顶栏切成子导航后：Logo 行只留站点名和账号区，
   链接下移成一条独立的横条，单行不换行 —— 链接再多也不会把账号区挤到第二行。
   手机端（900px 以内）链接本来就收进汉堡按钮里，这里只负责把整条横条一起收起。 */
.nav.has-subnav .nav-inner { flex-wrap: nowrap; }

.subnav {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.subnav-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 7px 20px;
    display: flex;
    align-items: center;
}

.subnav .nav-links {
    flex: 1 1 auto;
    flex-wrap: nowrap;              /* 横条只有一行，装不下就横向滚，不换行 */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;          /* 滚动条本身不用露出来，能滑就行 */
    -ms-overflow-style: none;
    font-size: 14px;
    gap: 4px 18px;
}

.subnav .nav-links::-webkit-scrollbar { height: 0; }
.subnav .nav-links a { padding: 4px 0; white-space: nowrap; }

/* 单选项：和 .checkbox 一套皮肤，只是字多、要能对齐第一行 */
/* 选择项：.field label 是 display:block（0,1,1），所以这里写成 .field .radio（两个类）
   才盖得住它 —— 不然圆点会自己占一行，文字被挤到下一行。 */
.field .radio { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.field .radio input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }
.field .radio strong { font-weight: 600; }
.field .radio > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* 小笔记本（1024~1200）：字号和间距收一点，14 个链接也能装进一条横条不用横滑 */
@media (max-width: 1200px) {
    .subnav-inner { padding: 7px 16px; }
    .subnav .nav-links { font-size: 13px; gap: 4px 13px; }
}

@media (max-width: 900px) {
    /* 窄屏还是要能换行，否则账号区会被挤出屏幕（第 37 轮的教训） */
    .nav.has-subnav .nav-inner { flex-wrap: wrap; }

    /* 折叠态：整条子导航跟着链接一起收起，展开时才出现 */
    .nav[data-nav-collapsed] .subnav { display: none; }
    .nav[data-nav-collapsed].nav-open .subnav { display: block; }
    .nav[data-nav-collapsed].nav-open .subnav .nav-links {
        border-top: 0;
        padding-top: 0;
        overflow: visible;          /* 展开后是竖排列表，不需要横向滚 */
    }
}

/* ===========================================================
   第 49 轮 · 交互态统一
   =========================================================== */

/* 键盘焦点环：只在键盘操作时出现（:focus-visible），鼠标点击不会闪一下。
   输入类控件自己已经有 box-shadow 焦点环，这里显式排除，免得套两层。 */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
    outline: none;
    outline-offset: 0;
}

/* 可交互区域统一过渡：颜色/边框/阴影一起走，别有的渐变有的瞬变 */
.btn, .badge, .nav-links a, .table td, .card, .stat, .lang-switch a {
    transition: background-color var(--t) var(--ease),
                border-color var(--t) var(--ease),
                color var(--t) var(--ease),
                box-shadow var(--t) var(--ease);
}

/* 整张卡片就是链接时（套餐卡、博文卡）才抬起，纯展示的卡片不动，避免满屏乱晃 */
a.card:hover { box-shadow: var(--shadow-md); }

/* 滚动条：默认那条又宽又亮，和整体不搭 */
* { scrollbar-width: thin; scrollbar-color: var(--muted-soft) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--muted-soft);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }

/* 系统开了「减少动态效果」就把动画全关掉 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===========================================================
   主题切换按钮（第 52 轮）：一个圆按钮循环 light → dark → system，
   图标跟着当前偏好走（太阳 / 月亮 / 显示器）。
   =========================================================== */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--hover-border); }
.theme-toggle .t { display: none; align-items: center; }
:root[data-theme-pref="light"] .theme-toggle .t-light,
:root[data-theme-pref="dark"] .theme-toggle .t-dark,
:root[data-theme-pref="system"] .theme-toggle .t-system { display: inline-flex; }

/* ------------------------------------------------------------------ *
 * 素材字段（第 56 轮）
 *
 * 一个输入框 + 上传按钮 + 预览。输入框本身还是原来那个（name 没变），
 * 所以旧表单、旧数据都不用动；上传成功只是往里写 sp-media:xxx 标记。
 * ------------------------------------------------------------------ */
.media-field { display: flex; flex-direction: column; gap: 8px; }
.media-field .media-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.media-field .media-row .input { flex: 1 1 220px; min-width: 0; }
.media-field.is-dragover { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: var(--radius-sm); }

.media-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.media-preview.is-empty { display: none; }
.media-preview img {
    max-width: 168px; max-height: 112px; width: auto; height: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); object-fit: contain;
}
.media-preview .media-player { max-width: 260px; max-height: 150px; border-radius: var(--radius-sm); }
.media-preview .media-meta { display: flex; flex-direction: column; gap: 2px; }
.media-status.is-error { color: var(--error); }
.media-field.is-locked .media-row .input { border-style: dashed; }
.media-locked-note { color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-border);
    border-radius: var(--radius-sm); padding: 6px 10px; }

/* 手机上：地址独占一行，上传/清空并排。
   挤在一行的结果是把 sp-media:... 截成半截，站长看不出自己传的是哪张图。 */
@media (max-width: 560px) {
    .media-field .media-row { flex-wrap: wrap; }
    .media-field .media-row .input { flex: 1 1 100%; }
    .media-field .media-row .btn { flex: 1 1 0; justify-content: center; }
    .media-preview { gap: 10px; }
    .media-preview img { max-width: 100%; max-height: 168px; }
    .media-preview .media-player { max-width: 100%; }
}

/* ===== 第 71 轮：小部件外观的样式预设 =====
   每张卡按预设自己的取值现画一个小样（底色 / 圆角 / 阴影 / 标题色 / 按钮色），
   点之前就能看出会变成什么样。变量由视图里的行内 style 提供。 */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
}
.preset-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.preset-card:hover { border-color: var(--hover-border); transform: translateY(-1px); }
.preset-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.preset-swatch {
    display: block;
    aspect-ratio: 16 / 10;
    padding: 10px;
    border-radius: var(--p-radius, 9px);
    background: var(--p-bg, #fff);
    box-shadow: var(--p-shadow, none);
    overflow: hidden;
}
.preset-swatch-title { display: block; height: 7px; width: 62%; border-radius: 999px; background: var(--p-line, #111827); }
.preset-swatch-desc { display: block; height: 5px; width: 88%; border-radius: 999px; background: var(--p-text, #111827); opacity: .45; margin-top: 7px; }
.preset-swatch-btn { display: block; height: 12px; width: 44px; border-radius: 999px; background: var(--p-btn, #4f46e5); margin-top: 9px; }
.preset-name { font-size: 13px; font-weight: 600; }
.preset-hint { font-size: 11px; color: var(--muted); line-height: 1.35; }
.preset-card:hover .preset-hint { color: var(--text); }

/* 颜色字段的 Auto 勾选：跟色盘同一行，不占整行 */
.auto-toggle { font-size: 12px; color: var(--muted); white-space: nowrap; }
.auto-toggle input { width: 14px; height: 14px; }
