/* ==========================================================================
   WechatApi 智能控制台 — 样式表
   设计：浅色主题 / 微信绿主色 / 卡片化 / 圆角柔和阴影
   ========================================================================== */
:root {
    --bg: #f4f6f9;
    --bg-deep: #eef1f6;
    --panel: #ffffff;
    --panel-2: #fafbfd;
    --border: #e6e9ef;
    --border-2: #dfe3ea;
    --text: #1f2329;
    --text-2: #61676f;
    --text-3: #9097a1;
    --brand: #07c160;
    --brand-dark: #06a552;
    --brand-soft: #e9f9f0;
    --blue: #10aeff;
    --blue-soft: #e9f5ff;
    --warn: #ff9f0a;
    --warn-soft: #fff6e8;
    --danger: #f5222d;
    --danger-soft: #ffedec;
    --purple: #7c5cff;
    --purple-soft: #f0edff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .05), 0 10px 28px -14px rgba(16, 24, 40, .16);
    --shadow-lg: 0 12px 40px -8px rgba(16, 24, 40, .22);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* --------------------------------------------------------------------------
   SVG 图标统一渲染
   sprite（#i-*）全部是描边型图形，路径本身不带 fill/stroke 属性。
   若不显式声明，SVG 会套用默认的 fill:black → 所有图标变成实心黑块。
   这里统一为「细线圆角描边 + 继承文字色」，并给出默认尺寸。
   -------------------------------------------------------------------------- */
.ico,
svg.ico {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

/* 需要实心观感的小标记（如状态点、圆点）单独声明 */
.ico.fill { fill: currentColor; stroke: none; }

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d3d8e0; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #bcc3ce; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 布局 */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
}
.brand-logo {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #07c160, #10aeff);
    display: grid; place-items: center;
    color: #fff; font-size: 17px; flex: 0 0 34px;
    box-shadow: 0 4px 12px -3px rgba(7, 193, 96, .5);
}
.brand-text b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: var(--text-3); }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.nav-group { margin: 12px 8px 4px; font-size: 11px; color: var(--text-3); letter-spacing: .6px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--text-2); cursor: pointer; user-select: none;
    font-size: 13.5px; transition: background .15s, color .15s;
    margin-bottom: 1px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-item .ico { width: 18px; height: 18px; flex: 0 0 18px; display: block; }
.nav-item .tag {
    margin-left: auto; font-size: 10px; padding: 1px 6px;
    border-radius: 20px; background: var(--bg-deep); color: var(--text-3);
}
.nav-item.active .tag { background: #fff; color: var(--brand-dark); }

.sidebar-foot {
    padding: 12px 16px; border-top: 1px solid var(--border);
    font-size: 11.5px; color: var(--text-3); display: flex;
    align-items: center; gap: 6px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: 0 0 7px; }
.dot.on { background: var(--brand); box-shadow: 0 0 0 3px rgba(7, 193, 96, .16); }
.dot.off { background: #c9ced6; }
.dot.err { background: var(--danger); box-shadow: 0 0 0 3px rgba(245, 34, 45, .16); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 62px; flex: 0 0 62px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px; position: sticky; top: 0; z-index: 15;
}
.topbar h1 { font-size: 16px; font-weight: 600; }
.topbar .sub { font-size: 12px; color: var(--text-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.account-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 12px 5px 6px; border-radius: 30px;
    background: var(--bg); border: 1px solid var(--border);
    font-size: 12.5px; color: var(--text-2);
    cursor: pointer; position: relative;
    transition: background .15s;
}
.account-chip:hover { background: var(--brand-soft); }
.account-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px); right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
    padding: 6px 0;
    z-index: 100;
}
.account-menu.open { display: block; }
.account-menu-head {
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}
.account-menu-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    background: none; border: none;
    padding: 8px 14px;
    font-size: 13px; color: var(--text);
    cursor: pointer; text-align: left;
}
.account-menu-item:hover { background: var(--bg-deep); }
.avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, #07c160, #10aeff);
    color: #fff; display: grid; place-items: center;
    font-size: 12px; flex: 0 0 26px;
}

.content { padding: 22px; flex: 1; }
.page { display: none; animation: fade .22s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 卡片 */
.card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    margin-bottom: 16px; overflow: hidden;
}
.card-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 14.5px; font-weight: 600; }
.card-head .desc { font-size: 12px; color: var(--text-3); }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: 320px minmax(0, 1fr); }
.grid.side-r { grid-template-columns: minmax(0, 1fr) 340px; }

@media (max-width: 1240px) {
    .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.side, .grid.side-r { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .sidebar { width: 64px; flex: 0 0 64px; }
    .brand-text, .nav-item span.label, .nav-group, .nav-item .tag, .sidebar-foot span { display: none; }
    .nav-item { justify-content: center; }
    .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- 统计卡 */
.stat {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.stat::after {
    content: ""; position: absolute; right: -18px; top: -18px;
    width: 68px; height: 68px; border-radius: 50%; background: var(--brand-soft); opacity: .7;
}
.stat .k { font-size: 12px; color: var(--text-3); margin-bottom: 6px; position: relative; }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.5px; position: relative; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .f { font-size: 11.5px; color: var(--text-3); margin-top: 4px; position: relative; }
.stat.blue::after { background: var(--blue-soft); }
.stat.warn::after { background: var(--warn-soft); }
.stat.purple::after { background: var(--purple-soft); }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 14px; }
.field > label {
    display: block; font-size: 12.5px; color: var(--text-2);
    margin-bottom: 6px; font-weight: 500;
}
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local],
input[type=time], input[type=url], select, textarea {
    width: 100%; padding: 9px 11px; font-size: 13.5px;
    border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    background: #fff; color: var(--text); font-family: inherit;
    transition: border-color .15s, box-shadow .15s; outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7, 193, 96, .12);
}
textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4.5L6 8.5L10 4.5' stroke='%239097a1' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.row.tight { gap: 8px; }
.row .fixed { flex: 0 0 auto; min-width: 0; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.switch input { display: none; }
.switch .track {
    width: 40px; height: 22px; border-radius: 20px; background: #d5dae2;
    position: relative; transition: background .2s; flex: 0 0 40px;
}
.switch .track::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---------------------------------------------------------------- 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; font-size: 13px; font-weight: 500; font-family: inherit;
    border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    background: #fff; color: var(--text); cursor: pointer;
    transition: all .15s; white-space: nowrap; line-height: 1.4;
}
.btn:hover { border-color: #c8d0da; background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px -4px rgba(7, 193, 96, .55); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: #0d9ee6; border-color: #0d9ee6; }
.btn-danger { color: var(--danger); border-color: #f7c6c4; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #f0a9a6; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }

/* ---- 按钮内嵌 SVG 图标 ---- */
.btn .ico { width: 14px; height: 14px; stroke-width: 2; }
.btn-xs .ico { width: 13px; height: 13px; }
.btn.icon-btn { padding-left: 7px; padding-right: 9px; }
.btn.icon-only { padding: 0; width: 24px; min-width: 24px; }
.btn.icon-only .ico { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 徽章 */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 20px; font-size: 11.5px;
    font-weight: 500; line-height: 1.7; white-space: nowrap;
}
.badge.ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: #b26a00; }
.badge.info { background: var(--blue-soft); color: #0b7fc0; }
.badge.gray { background: var(--bg-deep); color: var(--text-2); }
.badge.purple { background: var(--purple-soft); color: #5a3fd6; }

.pill { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--bg-deep); font-size: 11.5px; color: var(--text-2); font-family: var(--mono); }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
    text-align: left; font-weight: 600; color: var(--text-2); font-size: 12px;
    padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--border);
    white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.tbl td { padding: 10px 14px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
table.tbl tbody tr:hover { background: #fafbfd; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.mono, table.tbl th.mono { font-family: var(--mono); font-size: 12px; }
table.tbl td.nowrap { white-space: nowrap; }
table.tbl td.ellip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.tbl .acts { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }
/* 含徽章/按钮组的单元格不参与收缩，避免「启用」被压成两行、按钮换行 */
table.tbl td:has(.badge), table.tbl td:has(.acts) { white-space: nowrap; }
table.tbl td:has(.acts) { width: 1%; }
table.tbl td:has(.badge) { width: 1%; }
.badge { flex-shrink: 0; }
/* 列宽微调：长文本列单行省略，避免关键词被拆成难看的孤字 */
table.tbl th.col-kw { width: 20%; }
table.tbl th.col-ans { width: 38%; }
table.tbl .clip1 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scroll-y { max-height: 420px; overflow-y: auto; }
.scroll-y.tall { max-height: 620px; }

/* ---------------------------------------------------------------- 其他组件 */
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty .big { font-size: 34px; opacity: .55; margin-bottom: 10px; }
.empty p { font-size: 13px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
    padding: 8px 14px; font-size: 13px; color: var(--text-2); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

pre.code {
    background: #1f2329; color: #e6e8eb; padding: 14px 16px; border-radius: var(--radius-sm);
    font-family: var(--mono); font-size: 12px; line-height: 1.65; overflow: auto;
    max-height: 420px; white-space: pre-wrap; word-break: break-all;
}
pre.code.light { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
code.inline { font-family: var(--mono); font-size: 12px; background: var(--bg-deep); padding: 1.5px 5px; border-radius: 5px; }

.log-list { font-family: var(--mono); font-size: 12px; }
.log-line { display: flex; gap: 10px; padding: 7px 12px; border-bottom: 1px solid #f2f4f7; align-items: flex-start; }
.log-line:hover { background: var(--panel-2); }
.log-line .t { color: var(--text-3); flex: 0 0 66px; }
.log-line .p { flex: 0 0 190px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-line .m { flex: 1; word-break: break-all; }
.log-line .e { color: var(--text-3); flex: 0 0 56px; text-align: right; }

.qr-box {
    display: grid; place-items: center; padding: 20px;
    background: var(--panel-2); border: 1px dashed var(--border-2);
    border-radius: var(--radius); min-height: 240px;
}
.qr-box img { max-width: 220px; border-radius: 10px; background: #fff; padding: 8px; box-shadow: var(--shadow-sm); }

.kv { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 9px 14px; font-size: 13px; }
.kv .k { color: var(--text-3); }
.kv .v { word-break: break-all; }

.rule-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
    font-size: 12px; color: var(--text-2);
}

.mini-note { font-size: 11.5px; color: var(--text-3); line-height: 1.6; }

.warn-box {
    background: var(--warn-soft); border: 1px solid #ffe0b2; color: #8c5600;
    padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.65;
    margin-bottom: 14px;
}
.warn-box b { color: #6d4200; }
.info-box {
    background: var(--blue-soft); border: 1px solid #cbe8ff; color: #0b5c8a;
    padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.65;
}
.ok-box {
    background: var(--brand-soft); border: 1px solid #b7e7c9; color: #14672f;
    padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.65;
}
.ok-box b { color: #0f5223; }
.err-box {
    background: var(--danger-soft); border: 1px solid #f6c4c0; color: #9a2a22;
    padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.65;
}
.err-box b { color: #81211a; }

/* ---------------------------------------------------------------- 文件上传 */
.up-zone {
    border: 1.5px dashed var(--border-2); border-radius: var(--radius);
    background: var(--panel-2); padding: 26px 18px; text-align: center;
    cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.up-zone:hover, .up-zone.over { border-color: var(--brand); background: var(--brand-soft); }
.up-zone .up-ico { width: 30px; height: 30px; color: var(--brand); display: block; margin: 0 auto 8px; }
.up-zone .up-main { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.up-zone .up-sub { font-size: 11.5px; color: var(--text-3); line-height: 1.6; }

/* ---------------------------------------------------------------- 弹窗 */
.modal-mask {
    position: fixed; inset: 0; background: rgba(24, 28, 35, .42);
    backdrop-filter: blur(2px); display: none; place-items: center;
    z-index: 100; padding: 24px; animation: fade .16s ease;
}
.modal-mask.show { display: grid; }
.modal {
    background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 460px; max-height: 86vh; display: flex; flex-direction: column;
    animation: pop .2s cubic-bezier(.2, .9, .28, 1.1);
}
.modal.wide { max-width: 720px; }
.modal.xwide { max-width: 960px; }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 20px 12px; display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-size: 15.5px; font-weight: 600; }
.modal-head .close { margin-left: auto; cursor: pointer; color: var(--text-3); font-size: 19px; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.modal-head .close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 0 20px 4px; overflow-y: auto; flex: 1; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-foot { padding: 16px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }
.modal-foot .left { margin-right: auto; }

/* Toast */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast {
    background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--brand);
    box-shadow: var(--shadow-lg); border-radius: 10px; padding: 11px 15px; min-width: 240px;
    max-width: 380px; font-size: 13px; animation: slide .22s ease; pointer-events: auto;
    display: flex; gap: 9px; align-items: flex-start;
}
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.info { border-left-color: var(--blue); }
.toast .ti { font-size: 15px; line-height: 1.3; }
.toast .tt { flex: 1; word-break: break-word; }
.toast .tt b { display: block; margin-bottom: 1px; }
@keyframes slide { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

/* Spin */
.spin { width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
.spin.dark { border-color: rgba(0, 0, 0, .18); border-top-color: var(--brand); }
@keyframes rot { to { transform: rotate(360deg); } }

.loading-block { padding: 30px; text-align: center; color: var(--text-3); font-size: 13px; }
.loading-block .spin { border-color: rgba(7, 193, 96, .22); border-top-color: var(--brand); }

/* 结果面板 */
.result-panel { margin-top: 12px; }
.result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12.5px; color: var(--text-2); }
.result-head .right { margin-left: auto; }

/* 事件流 */
.ev-item {
    display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f2f4f7;
    align-items: flex-start; transition: background .15s;
}
.ev-item:hover { background: var(--panel-2); }
.ev-item .ic {
    width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand-dark); font-size: 14px; flex: 0 0 32px;
}
.ev-item .ic.g { background: var(--blue-soft); color: #0b7fc0; }
.ev-item .ic.s { background: var(--purple-soft); color: #5a3fd6; }
.ev-item .meta { flex: 1; min-width: 0; }
.ev-item .meta .top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.ev-item .meta .txt { font-size: 13px; color: var(--text); word-break: break-word; }
.ev-item .meta .who { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.ev-item .when { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* 消息预览气泡 */
.bubble {
    background: var(--brand-soft); border-radius: 10px; padding: 9px 13px;
    font-size: 13px; color: #14532d; display: inline-block; max-width: 100%;
    word-break: break-word; white-space: pre-wrap;
}
.bubble.reply { background: var(--bg-deep); color: var(--text); }

.chat-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.chat-row .who { font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.chat-row.me { align-items: flex-end; }

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* 小工具 */
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ==========================================================================
   微信式聊天界面（消息中心）
   ========================================================================== */
.nav-item .tag.unread { background: #fa5151; color: #fff; }
.nav-item.active .tag.unread { background: #fa5151; color: #fff; }

.chat-shell {
    display: flex;
    height: calc(100vh - 172px);
    min-height: 460px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
/* 首页：顶部有统计卡片，聊天区需要自适应剩余高度 */
.chat-shell.chat-home {
    height: calc(100vh - 232px);
    min-height: 380px;
}

/* ---------------- 左：会话列表 ---------------- */
.chat-side {
    width: 272px; flex: 0 0 272px;
    display: flex; flex-direction: column;
    background: #fafbfc; border-right: 1px solid var(--border);
}
.chat-side-head { padding: 12px; border-bottom: 1px solid var(--border); }
.chat-search {
    width: 100%; padding: 8px 12px; font-size: 13px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #fff; outline: none; transition: all .15s;
}
.chat-search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.chat-list { flex: 1; overflow-y: auto; padding: 6px; }

.chat-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px; cursor: pointer;
    transition: background .12s; user-select: none;
}
.chat-item:hover { background: #f0f2f5; }
.chat-item.active { background: var(--brand-soft); }
.chat-item-main { flex: 1; min-width: 0; }
.chat-item-top { display: flex; align-items: baseline; gap: 8px; }
.chat-item-name {
    flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item-time { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.chat-item-bottom { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chat-item-last {
    flex: 1; min-width: 0; font-size: 12px; color: var(--text-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-unread {
    flex-shrink: 0; min-width: 17px; height: 17px; padding: 0 5px;
    background: #fa5151; color: #fff; border-radius: 9px;
    font-size: 10.5px; line-height: 17px; text-align: center; font-weight: 500;
}

.chat-avatar-wrap { position: relative; width: 40px; height: 40px; flex: 0 0 40px; }
.chat-avatar { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; display: block; }
.chat-avatar-fb {
    width: 40px; height: 40px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 15px; font-weight: 600;
}
.chat-tip {
    padding: 34px 18px; text-align: center;
    font-size: 12.5px; color: var(--text-3); line-height: 1.9;
}

/* ---------------- 右：聊天窗口 ---------------- */
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #f5f6f7; }
.chat-placeholder {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
}
.chat-ph-icon { font-size: 44px; opacity: .45; line-height: 1; }
.chat-ph-title { font-size: 14.5px; color: var(--text-2); }
.chat-ph-sub { font-size: 12.5px; color: var(--text-3); }

.chat-conv { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
    flex: 0 0 58px; height: 58px; padding: 0 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fff; border-bottom: 1px solid var(--border);
}
.chat-head-info { min-width: 0; text-align: center; flex: 1; }
.chat-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-desc { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.chat-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-head-btn {
    padding: 5px 12px; font-size: 12px; cursor: pointer;
    border: 1px solid var(--border-2); border-radius: 6px;
    background: #fff; color: var(--text-2);
    transition: all .14s;
}
.chat-head-btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }

.chat-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.chat-body.drag-over {
    background: var(--brand-soft);
    outline: 2px dashed var(--brand);
    outline-offset: -4px;
}
.chat-time { text-align: center; font-size: 11.5px; color: var(--text-3); margin: 14px 0 10px; }
.chat-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.chat-row.out { flex-direction: row-reverse; }
.chat-bubble-col { display: flex; flex-direction: column; max-width: 62%; min-width: 0; }
.chat-row.out .chat-bubble-col { align-items: flex-end; }
.chat-sender { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.chat-bubble {
    padding: 9px 13px; border-radius: 8px; font-size: 13.5px; line-height: 1.62;
    background: #fff; color: var(--text); word-break: break-word; white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(31, 35, 41, .05);
}
.chat-row.out .chat-bubble { background: #95ec69; }
.chat-img { display: block; max-width: 190px; max-height: 200px; border-radius: 6px; }
.chat-voice-wrap { display: inline-flex; align-items: center; gap: 6px; }
.chat-voice-t2t { font-size: 11px; color: var(--brand); background: var(--brand-soft);
  border: 1px solid var(--brand); border-radius: 10px; padding: 2px 8px; cursor: pointer; }
.chat-voice-t2t:hover { opacity: .85; }
.chat-voice-text { font-size: 12px; color: var(--text-2); background: var(--bg-soft, #f5f6f8);
  border-radius: 6px; padding: 5px 8px; margin-top: 4px; max-width: 260px; word-break: break-all; }
.chat-failed { font-size: 11px; color: var(--danger); margin-top: 3px; }
.chat-ai-tag { font-size: 11px; color: var(--text-3); margin-top: 3px; padding: 0 2px; }

/* 语音气泡：点击解码播放 */
.chat-voice {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font: inherit; color: var(--text-1); background: transparent; border: none; padding: 2px 0;
}
.chat-row.out .chat-voice { color: #14532d; }
.chat-voice .ico-voice { font-size: 13px; }
.chat-voice:hover { color: var(--brand-dark); text-decoration: underline; }
.chat-voice:disabled { opacity: .7; cursor: default; }
.chat-audio { width: 220px; max-width: 100%; height: 36px; margin: 2px 0; outline: none; }

.chat-foot {
    flex: 0 0 auto; padding: 10px 16px 12px;
    display: flex; align-items: flex-end; gap: 10px;
    background: #fff; border-top: 1px solid var(--border);
}
.chat-input-row { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.chat-attach { display: flex; gap: 6px; }
.chat-attach-btn {
    padding: 3px 11px; font-size: 12px; cursor: pointer;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--panel-2); color: var(--text-2);
    font-family: inherit; transition: all .14s;
}
.chat-attach-btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
#chatInput {
    width: 100%; min-height: 40px; max-height: 120px; padding: 10px 13px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 13.5px; font-family: inherit; line-height: 1.6;
    resize: none; outline: none; transition: all .15s;
}
#chatInput:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.chat-send-btn { height: 40px; padding: 0 24px; flex-shrink: 0; }

/* 常用表情面板 */
.emoji-panel {
    position: absolute; bottom: 64px; left: 16px; z-index: 30;
    width: 296px; max-height: 200px; overflow-y: auto;
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
    padding: 8px; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow-md);
}
.emoji-panel.hidden { display: none; }
.emoji-item {
    font-size: 19px; line-height: 1; padding: 5px 0; cursor: pointer;
    border: none; background: transparent; border-radius: 6px; transition: background .12s;
}
.emoji-item:hover { background: var(--brand-soft); }

/* 消息悬浮「收藏」 */
.chat-msg-actions { margin-top: 2px; height: 0; overflow: hidden; transition: height .12s; }
.chat-row:hover .chat-msg-actions { height: 22px; }
.chat-msg-act {
    font-size: 11px; padding: 1px 8px; cursor: pointer; color: var(--text-3);
    border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.9);
}
.chat-msg-act:hover { color: var(--brand-dark); border-color: var(--brand); }

/* 收藏列表 */
.fav-list { display: flex; flex-direction: column; gap: 10px; max-height: 64vh; }
.fav-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
.fav-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.fav-content { font-size: 13.5px; line-height: 1.7; word-break: break-word; white-space: pre-wrap; }
.fav-img { max-width: 160px; max-height: 160px; border-radius: 6px; display: block; }
.fav-acts { margin-top: 6px; display: flex; gap: 6px; }

/* 定时任务：联系人选择器 */
.tf-pick {
    max-height: 220px; overflow-y: auto; border: 1px solid var(--border);
    border-radius: 8px; padding: 6px; background: var(--panel); margin-bottom: 6px;
}
.tf-opt {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
    cursor: pointer; font-size: 13px;
}
.tf-opt:hover { background: var(--brand-soft); }
.tf-opt .tf-name { font-weight: 500; }
.tf-opt .tf-wx { margin-left: auto; }

/* ==========================================================================
   朋友圈信息流（对齐微信「朋友圈」视觉）
   ========================================================================== */
.sns-feed-wrap {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; display: flex; flex-direction: column;
}
.sns-feed-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.sns-feed-list { background: #ededed; }
.sns-feed-list.tall { max-height: calc(100vh - 300px); min-height: 320px; }

/* 滚动到底自动加载更多 */
.sns-loadmore {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 14px 0 10px; font-size: 12px; color: var(--text-3);
}
.sns-loadmore.end { opacity: .7; }
.sns-spin {
    width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, .1); border-top-color: var(--brand);
    animation: sns-spin .7s linear infinite;
}
@keyframes sns-spin { to { transform: rotate(360deg); } }
.sns-op.liked { color: var(--brand); }

/* 单条动态：左头像 + 右内容（微信朋友圈是左图右文，头像为小圆角方形） */
.sns-card {
    display: flex; gap: 10px; padding: 16px 16px 14px;
    background: #fff; border-bottom: 1px solid #f0f0f0;
}
.sns-card:last-child { border-bottom: none; }
.sns-avatar {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 17px; font-weight: 600; user-select: none;
}
.sns-main { flex: 1; min-width: 0; }
.sns-name { color: #576b95; font-size: 15px; font-weight: 600; line-height: 1.3; }
.sns-text {
    margin-top: 4px; color: #191919; font-size: 15px; line-height: 1.55;
    word-break: break-word;
}

/* 图片九宫格：1 张大图、4 张两列、其余三列 */
.sns-media { display: grid; gap: 4px; margin-top: 8px; grid-template-columns: repeat(3, 86px); }
.sns-media.one { grid-template-columns: 1fr; max-width: 200px; }
.sns-media.two { grid-template-columns: repeat(2, 118px); }
.sns-media .m-item {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: 3px; background: #f2f2f2; display: block; cursor: zoom-in;
}
/* 单图保持原比例完整显示（微信不裁切），最大边长受限 */
.sns-media.one .m-item {
    width: auto; height: auto; max-width: 100%; max-height: 260px;
    aspect-ratio: auto; object-fit: contain;
}
.sns-media .m-item.failed { opacity: .35; cursor: default; }

/* 视频：封面 + 播放按钮 */
.sns-media.video { grid-template-columns: 1fr; max-width: 190px; }
.sns-media .m-item.video {
    aspect-ratio: 1 / 1; position: relative; background-color: #000;
    background-size: cover; background-position: center; cursor: pointer;
}
.sns-media .m-item.video .play {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 30px; height: 30px; border-radius: 50%; padding-left: 2px;
    background: rgba(0, 0, 0, .5); color: #fff; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}

/* 底部：时间 + 操作按钮 */
.sns-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.sns-when { color: #b2b2b2; font-size: 12px; }
.sns-private {
    margin-left: 6px; color: #b2b2b2; border: 1px solid #e0e0e0;
    border-radius: 3px; padding: 0 4px; font-size: 11px;
}
.sns-ops { display: flex; align-items: center; gap: 2px; }
.sns-op {
    background: none; border: 0; color: #576b95; font-size: 13px;
    padding: 3px 7px; border-radius: 4px; cursor: pointer; line-height: 1.4; font-family: inherit;
}
.sns-op:hover { background: rgba(87, 107, 149, .1); }
.sns-op.danger { color: #c96a6a; }

/* 点赞 / 评论区（微信是浅灰圆角块） */
.sns-comment-box { margin-top: 8px; background: #f7f7f7; border-radius: 4px; padding: 8px 10px; }
.sns-likes { color: #576b95; font-size: 13px; line-height: 1.7; }
.sns-likes b, .sns-comment b { color: #576b95; font-weight: 600; }
.sns-comment { color: #191919; font-size: 13px; line-height: 1.7; word-break: break-word; }
.sns-empty { color: #b2b2b2; font-size: 12px; }
.sns-comment-input { display: flex; gap: 6px; margin-top: 8px; }
.sns-comment-input input {
    flex: 1; min-width: 0; padding: 5px 8px; font-size: 13px;
    border: 1px solid #e0e0e0; border-radius: 4px; background: #fff; color: #191919;
}

@media (max-width: 900px) {
    .chat-side { width: 200px; flex-basis: 200px; }
    .chat-bubble-col { max-width: 78%; }
    .sns-media { grid-template-columns: repeat(3, 76px); }
    .sns-media.two { grid-template-columns: repeat(2, 100px); }
}

/* 账号信息卡（设置页）—— 仿微信式终端与登录概览 */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 28px;
}
.info-row {
    display: flex;
    align-items: center;
    min-height: 26px;
    font-size: 13.5px;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 8px;
}
.info-row:last-child { border-bottom: none; }
.info-k {
    flex: 0 0 auto;
    min-width: 78px;
    color: var(--text-2);
    margin-right: 12px;
}
.info-v {
    flex: 1 1 auto;
    color: var(--text);
    word-break: break-all;
    text-align: right;
    line-height: 1.5;
}
.info-v.mono { font-family: ui-monospace, Consolas, "Liberation Mono", monospace; font-size: 12.5px; }
@media (max-width: 900px) {
    .info-grid { grid-template-columns: 1fr; gap: 10px; }
}
