@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

/* ========== 全站设计变量（SaaS 蓝）========== */
:root {
  --bg: #f5f7fa;
  --bg-deep: #0f172a;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: rgba(15, 23, 42, 0.07);
  --line-strong: rgba(15, 23, 42, 0.12);
  --text: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --accent: #2563eb;
  --accent-hi: #3b82f6;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-rgb: 37, 99, 235;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.14);
  --r: 12px;
  --r-lg: 16px;
  --font: "Sora", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --top: 56px;
  --sidebar: 232px;
  --chat-max: 460px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
#app { min-height: 100%; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hi); }
button, input, textarea, select { font: inherit; }
img { max-width: 100%; }
svg { display: block; flex-shrink: 0; }

/* —— Toast —— */
.cs-toast {
  position: fixed; left: 50%; top: 20px; z-index: 9999;
  transform: translateX(-50%) translateY(-10px);
  background: var(--bg-deep); color: #fff;
  padding: 11px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  box-shadow: var(--shadow-lg);
  transition: .28s cubic-bezier(.2,.8,.2,1);
}
.cs-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cs-toast.err { background: var(--danger); }

/* —— Buttons（覆盖浏览器默认） —— */
button { appearance: none; -webkit-appearance: none; background: none; border: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600;
  transition: transform .12s, background .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--accent-hi); box-shadow: 0 6px 16px rgba(var(--accent-rgb), .28); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.success { background: var(--ok); }
.btn.success:hover { background: #059669; box-shadow: 0 6px 16px rgba(16,185,129,.28); }
.btn.warning { background: var(--warn); color: #fff; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #dc2626; }
.btn.ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn.ghost:hover { background: var(--panel-2); box-shadow: none; }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn .ico, .btn .ico svg { width: 15px; height: 15px; }

/* —— Fields —— */
.input, .textarea, .select {
  appearance: none; -webkit-appearance: none;
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; color: var(--text); outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(var(--accent-rgb), .5);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.is-error, .textarea.is-error, .select.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}
.field-error {
  margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--danger);
}
.textarea { resize: none; min-height: 60px; }

select.select,
select.lang-select,
select.lang-select-inline,
.toolbar select,
.trans-lang select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  font-weight: 600; letter-spacing: -0.01em; padding-right: 40px;
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 11px;
  background-color: #fff;
  background-image:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.98)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  background-size: 100% 100%, 14px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, .05),
    0 4px 14px rgba(37, 99, 235, .05),
    inset 0 1px 0 rgba(255,255,255,.9);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
select.select:hover, select.lang-select-inline:hover, .toolbar select:hover {
  border-color: rgba(var(--accent-rgb), .4);
  box-shadow:
    0 2px 4px rgba(15, 23, 42, .06),
    0 6px 16px rgba(37, 99, 235, .08),
    inset 0 1px 0 rgba(255,255,255,.95);
}
select.select:focus, select.lang-select-inline:focus, .toolbar select:focus {
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 4px 14px rgba(37, 99, 235, .08);
}
select option { color: var(--text); background: #fff; font-weight: 500; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  background: var(--danger); color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 700;
}

.field-wrap { position: relative; }
.field-wrap .field-ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none;
}
.field-wrap .field-ico svg { width: 17px; height: 17px; }
.field-wrap .input { padding-left: 40px; }

/* ==================== LOGIN ==================== */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(var(--accent-rgb), .28), transparent 55%),
    radial-gradient(700px 400px at 95% 8%, rgba(59, 130, 246, .12), transparent 50%),
    linear-gradient(165deg, #0b1220 0%, #111827 52%, #0f172a 100%);
}
.login-page::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 70%);
  pointer-events: none;
}
.login-card {
  width: 100%; max-width: 400px; position: relative; z-index: 1;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 22px; padding: 36px 30px 26px;
  box-shadow: var(--shadow-lg);
  animation: rise .45s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .mark {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #1d4ed8);
  color: #fff; box-shadow: 0 12px 28px rgba(var(--accent-rgb), .35);
}
.login-brand .mark svg { width: 24px; height: 24px; }
.login-card h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.03em; }
.login-card .sub { margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.form-item { margin-bottom: 13px; }
.form-item label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.hint { margin-top: 14px; text-align: center; font-size: 12px; color: var(--muted-2); }
.hint a { font-weight: 650; }

/* ==================== CHAT (visitor) ==================== */
.chat-wrap {
  min-height: 100%; display: flex; justify-content: center; align-items: stretch;
  background:
    radial-gradient(800px 420px at 20% 0%, rgba(var(--accent-rgb), .18), transparent 55%),
    radial-gradient(600px 360px at 90% 5%, rgba(56, 189, 248, .1), transparent 50%),
    linear-gradient(180deg, #0f172a 0%, #1e293b 38%, var(--bg) 38%);
}
.chat-card {
  width: 100%; max-width: var(--chat-max); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--panel);
  position: relative;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 768px) {
  .chat-wrap { padding: 32px 16px; align-items: center; }
  .chat-card {
    height: min(820px, calc(100vh - 64px));
    border-radius: 20px; overflow: hidden;
  }
}
.chat-hd {
  height: 58px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 16px;
  padding-top: env(safe-area-inset-top, 0);
  background: linear-gradient(120deg, #1e3a8a, var(--accent));
  color: #fff;
}
.chat-hd .hd-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-hd .hd-titles { display: flex; flex-direction: column; min-width: 0; }
.chat-hd .hd-titles .sub {
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,.7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-ws-banner {
  border-radius: 0; position: sticky; top: 0; z-index: 5;
}
.chat-empty {
  text-align: center; padding: 48px 16px; color: var(--muted);
}
.chat-empty svg { width: 28px; height: 28px; margin: 0 auto 10px; color: var(--accent); }
.chat-empty p { font-size: 13px; font-weight: 500; }
.chat-hd .hd-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .16); color: #fff;
}
.chat-hd .hd-icon svg { width: 17px; height: 17px; }
.chat-hd .title { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; }
.chat-hd .lang-select {
  max-width: 140px; min-height: 34px;
  padding: 7px 32px 7px 11px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12); color: #fff; font-size: 12px; font-weight: 500;
  background-color: rgba(255,255,255,.07);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23bfdbfe' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
}
.chat-hd .lang-select:hover { background-color: rgba(255,255,255,.11); }
.chat-hd .lang-select option { color: #111; background: #fff; }

.chat-bd {
  flex: 1; overflow-y: auto; padding: 18px 16px;
  background: linear-gradient(180deg, #f4f6f8, #eef1f5);
  -webkit-overflow-scrolling: touch;
}
.chat-ft {
  flex-shrink: 0; background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 12px 14px;
}
.tool-row { display: flex; gap: 6px; margin-bottom: 8px; }
.tool-btn {
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--panel-2); color: #374151;
  transition: .15s;
}
.tool-btn:hover, .tool-btn.on {
  background: var(--accent-soft); color: var(--accent); border-color: rgba(var(--accent-rgb), .25);
}
.tool-btn svg { width: 17px; height: 17px; }
.send-row { display: flex; gap: 8px; align-items: flex-end; }
.send-row .textarea {
  flex: 1; min-height: 42px; max-height: 110px;
  background: var(--panel-2); border-radius: 12px; padding: 10px 12px;
}
.send-row .btn { height: 42px; min-width: 78px; border-radius: 12px; }

.msg {
  display: flex; align-items: flex-end; gap: 8px;
  width: 100%; box-sizing: border-box;
  margin: 11px 0; animation: msgIn .25s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
.msg.mine { justify-content: flex-end; flex-direction: row-reverse; }
.msg:not(.mine):not(.sys) { justify-content: flex-start; }
.msg.sys { justify-content: center; }
.msg.mine .bubble { margin-left: auto; }
.msg:not(.mine):not(.sys) .bubble { margin-right: auto; }
.msg .msg-avatar {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: #e2e8f0; color: #475569;
}
.msg .msg-avatar svg { width: 14px; height: 14px; }
.msg.mine .msg-avatar {
  background: rgba(var(--accent-rgb), .15); color: var(--accent);
}
.bubble {
  max-width: 72%; padding: 10px 13px;
  border-radius: 16px 16px 16px 5px;
  background: #f1f5f9; border: 1px solid transparent;
  line-height: 1.55; word-break: break-word;
  box-shadow: none;
  font-size: 14px; color: var(--text);
}
.msg.mine .bubble {
  color: #fff; border: 0;
  background: linear-gradient(145deg, var(--accent), #1d4ed8);
  border-radius: 16px 16px 5px 16px;
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), .28);
}
.msg.sys .bubble {
  background: transparent; border: 0; box-shadow: none;
  color: var(--muted); font-size: 12px; padding: 2px 8px;
}
.bubble img,
.bubble .chat-img {
  max-width: 176px; border-radius: 10px; display: block; cursor: zoom-in;
  transition: transform .15s, box-shadow .15s;
}
.bubble .chat-img:hover {
  box-shadow: 0 6px 18px rgba(15, 23, 42, .18);
  transform: scale(1.02);
}
.img-lightbox {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  margin: 0; padding: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 20, .88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: maskIn .18s ease;
  cursor: zoom-out;
  box-sizing: border-box;
}
.img-lightbox .img-lightbox-pic,
.img-lightbox img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 92vw !important;
  max-height: 85vh !important;
  max-height: 85dvh !important;
  margin: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
  object-fit: contain;
  cursor: default;
  background: #0f172a;
  transform: none !important;
}
.img-lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.12); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: .15s;
  z-index: 1;
}
.img-lightbox-close:hover { background: rgba(255,255,255,.22); }
.img-lightbox-close svg { width: 18px; height: 18px; }
.img-lightbox-open {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,.12); color: #e2e8f0;
  font-size: 12px; font-weight: 600; text-decoration: none;
  backdrop-filter: blur(6px);
  z-index: 1;
}
.img-lightbox-open:hover { background: rgba(255,255,255,.2); color: #fff; }
.msg-meta { margin-top: 5px; font-size: 10px; color: var(--muted-2); font-weight: 500; }
.msg.mine .msg-meta { color: rgba(255,255,255,.55); text-align: end; }

.tip-box {
  text-align: center; margin-bottom: 12px; padding: 13px 14px;
  border-radius: 13px; font-size: 13px; font-weight: 500;
  background: #fff; color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), .14);
  box-shadow: var(--shadow-sm);
}
.tip-box.warn { color: var(--warn); border-color: rgba(217,119,6,.2); background: #fffbeb; }
.mask {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 18px;
  background: rgba(8,12,20,.5); backdrop-filter: blur(6px);
}
.mask-box {
  width: 100%; max-width: 320px; text-align: center;
  background: #fff; border-radius: 18px; padding: 28px 22px 24px;
  box-shadow: var(--shadow-lg);
  animation: rise .4s cubic-bezier(.2,.8,.2,1);
}
.mask-box .welcome-mark {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #1d4ed8);
  color: #fff; box-shadow: 0 10px 24px rgba(var(--accent-rgb), .3);
}
.mask-box .welcome-mark svg { width: 24px; height: 24px; }
.mask-box p { margin-bottom: 18px; line-height: 1.65; font-size: 14px; color: #374151; }
.mask-box .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.sticker-panel {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  margin-bottom: 8px; padding: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
}
.sticker-panel button {
  height: 38px; border: 0; border-radius: 10px; cursor: pointer;
  background: #fff; color: #374151; display: grid; place-items: center;
  transition: .12s;
}
.sticker-panel button:hover { background: var(--accent-soft); color: var(--accent); }
.sticker-panel button svg { width: 18px; height: 18px; }
.sticker-panel.emoji-panel {
  grid-template-columns: repeat(8, 1fr);
  max-height: 168px; overflow-y: auto;
}
.sticker-panel .emoji-btn {
  font-size: 22px; line-height: 1;
  height: 40px; background: transparent;
}
.sticker-panel .emoji-btn:hover {
  background: rgba(var(--accent-rgb), .1);
  transform: scale(1.08);
}

[dir="rtl"] .msg.mine { justify-content: flex-start; flex-direction: row; }
[dir="rtl"] .msg:not(.mine):not(.sys) { justify-content: flex-end; flex-direction: row-reverse; }
[dir="rtl"] .send-row { flex-direction: row-reverse; }
[dir="rtl"] .field-wrap .field-ico { left: auto; right: 13px; }
[dir="rtl"] .field-wrap .input { padding-left: 13px; padding-right: 40px; }

/* ==================== AGENT SHELL ==================== */
.shell {
  height: 100vh; display: flex; flex-direction: column;
  background: var(--bg);
}
.topbar {
  height: var(--top); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: var(--bg-deep); color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 650; font-size: 14px; letter-spacing: -0.02em;
}
.topbar .brand svg { color: #93c5fd; }
.topbar .right {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #94a3b8;
}
.topbar .btn.ghost {
  border-color: rgba(255,255,255,.12); color: #e2e8f0;
}
.topbar .btn.ghost:hover { background: rgba(255,255,255,.06); }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 650;
  background: rgba(255,255,255,.08); color: #94a3b8;
}
.status-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.status-pill.live { background: rgba(16,185,129,.18); color: #6ee7b7; }
.status-pill.idle { background: rgba(255,255,255,.06); color: #94a3b8; }

.shell-body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
}
.shell-body.has-profile {
  grid-template-columns: 300px minmax(0, 1fr) 280px;
}

/* left rail */
.agent-side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.agent-side .pad {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fafbfc);
}
.agent-side .pad .btn.block { margin-bottom: 10px; }
.side-section-title {
  font-size: 10px; font-weight: 700; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 10px 0 8px;
}
.auto-trans {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 8px; font-size: 12px; color: #4b5563;
  cursor: pointer; line-height: 1.4; user-select: none;
}
.auto-trans input { margin-top: 2px; accent-color: var(--accent); }
.trans-setting-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 4px;
}

/* 接待设置：顶部分组，一次只看一块 */
.settings-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
}
.settings-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px;
  margin: -4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.settings-tab:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), .28);
  background: var(--accent-soft);
}
.settings-tab.on {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), .28);
}
.settings-tab-ico {
  display: inline-grid;
  place-items: center;
  opacity: .9;
}
.settings-tab-ico svg { width: 15px; height: 15px; display: block; }
.settings-panel { min-width: 0; }
.settings-card { margin: 0; }
.settings-card-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.settings-card-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.settings-card-head p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.trans-lang {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; font-size: 12px; color: #4b5563;
}
.trans-lang .select { flex: 1; min-height: 34px; padding: 7px 34px 7px 10px; font-size: 12px; }
.btn.trans-toggle.trans-on {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), .28);
  box-shadow: none;
}
.btn.trans-toggle.trans-on:hover {
  background: rgba(var(--accent-rgb), .16);
}

.link-box {
  margin: 12px 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(var(--accent-rgb), .18);
  font-size: 12px; color: #1e3a8a;
}
.link-box .url {
  margin: 7px 0; word-break: break-all;
  font-weight: 600; color: var(--accent); font-size: 11px;
}
.link-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.tabs {
  display: flex; gap: 2px; padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.tabs button {
  flex: 1; padding: 11px 6px; border: 0; background: 0; cursor: pointer;
  color: var(--muted); font-size: 12px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

.conv-list { flex: 1; overflow-y: auto; background: #fafbfc; }
.conv-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 13px 14px; cursor: pointer;
  border-bottom: 1px solid rgba(12,17,27,.04);
  transition: background .12s, box-shadow .12s;
}
.conv-item:hover { background: #fff; }
.conv-item.on {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.conv-item .name {
  font-size: 13px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}
.conv-item .meta { margin-top: 4px; font-size: 11px; color: var(--muted); }

/* center chat */
.agent-main {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: #eef1f5;
}
.agent-main .hd {
  min-height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 10px 16px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.agent-main .hd strong { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.lang-tag {
  display: inline-flex; align-items: center;
  margin-inline-start: 6px; padding: 3px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.lang-select-inline {
  width: auto; min-width: 132px; min-height: 34px;
  padding: 7px 38px 7px 12px; font-size: 12.5px; border-radius: 10px;
}
.agent-main .hd .lang-select-inline {
  background-color: #f8fafc;
  background-image:
    linear-gradient(180deg, #ffffff, #f1f5f9),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 11px center;
  background-size: 100% 100%, 13px;
  border-color: rgba(37, 99, 235, .18);
  color: #1e3a8a;
}
.agent-main .bd {
  flex: 1; overflow-y: auto; padding: 18px 20px;
  background:
    radial-gradient(600px 200px at 50% 0%, rgba(255,255,255,.7), transparent),
    #e8ecf1;
}
.agent-main .ft {
  flex-shrink: 0; background: #fff;
  border-top: 1px solid var(--line); padding: 12px 14px 14px;
}
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.quick span {
  font-size: 11px; padding: 5px 10px; cursor: pointer;
  border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--line); color: #374151; font-weight: 500;
}
.quick span:hover { border-color: rgba(var(--accent-rgb), .3); color: var(--accent); }
.agent-main .empty-stage {
  flex: 1; display: grid; place-items: center;
  color: var(--muted); font-size: 14px; font-weight: 500;
  background: #eef1f5;
}
.agent-main .empty-stage .empty-inner {
  text-align: center; padding: 28px;
  background: #fff; border-radius: 18px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  max-width: 320px;
}
.agent-main .empty-stage .empty-inner svg {
  width: 28px; height: 28px; margin: 0 auto 12px; color: var(--accent);
}

/* right profile */
.agent-profile {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
  overflow-y: auto;
}
.profile-head {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
}
.profile-head .avatar {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 10px;
  background: linear-gradient(145deg, var(--accent), #1d4ed8);
  color: #fff;
}
.profile-head .avatar svg { width: 20px; height: 20px; }
.profile-head h3 {
  font-size: 15px; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 4px; word-break: break-word;
}
.profile-head .sub { font-size: 12px; color: var(--muted); }
.profile-block { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.profile-block .label {
  font-size: 10px; font-weight: 700; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px;
}
.profile-kv {
  display: grid; grid-template-columns: 52px 1fr; gap: 6px 8px;
  font-size: 12px; align-items: start;
}
.profile-kv .k { color: var(--muted); font-weight: 600; }
.profile-kv .v { color: var(--text); font-weight: 500; word-break: break-all; }
.remark-input {
  margin-top: 0; padding: 9px 11px !important;
  font-size: 12px; border-radius: 10px !important;
}
.profile-actions { display: flex; gap: 6px; margin-top: 8px; }

/* legacy visitor-meta hidden when using profile */
.visitor-meta { display: none; }

.zh-line { font-size: 14px; font-weight: 500; line-height: 1.55; }
.orig-hint {
  margin-top: 6px; padding-top: 6px; font-size: 11px; line-height: 1.4;
  border-top: 1px dashed rgba(0,0,0,.1); opacity: .78;
}
.msg.mine .orig-hint { border-top-color: rgba(255,255,255,.3); opacity: .85; }
.trans-btn { margin-top: 8px; }

.mobile-toggle { display: none; }
@media (max-width: 1100px) {
  .shell-body,
  .shell-body.has-profile { grid-template-columns: 280px minmax(0, 1fr); }
  .agent-profile { display: none; }
  .visitor-meta {
    display: flex; flex-direction: column; gap: 8px;
    padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line);
  }
  .vm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
  .vm-label { color: var(--muted); font-weight: 650; min-width: 28px; }
  .vm-val { font-weight: 500; margin-right: 8px; word-break: break-all; }
  .remark-row { align-items: stretch; }
  .remark-row .remark-input { flex: 1; min-width: 120px; }
}
@media (max-width: 720px) {
  .shell-body { grid-template-columns: 1fr; position: relative; }
  .agent-side {
    position: absolute; inset: 0; z-index: 6; width: 100%;
  }
  .agent-side.hide-mobile { display: none; }
  .mobile-toggle { display: inline-flex !important; }
}

/* ==================== ADMIN ==================== */
.admin-layout {
  height: 100vh; display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  background: var(--bg);
}
.admin-nav {
  background: var(--bg-deep); color: #fff;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
}
.admin-nav .logo {
  height: var(--top);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 14px; letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.admin-nav .logo svg { color: #93c5fd; width: 18px; height: 18px; }
.admin-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; margin: 2px 10px; border-radius: 10px;
  color: #94a3b8; font-size: 13px; font-weight: 550;
  transition: .15s;
}
.admin-nav a .nav-ico {
  display: grid; place-items: center; opacity: .85;
}
.admin-nav a .nav-ico svg { width: 16px; height: 16px; }
.admin-nav a .badge { margin-inline-start: auto; }
.admin-nav a:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.admin-nav a.on {
  background: rgba(var(--accent-rgb), .22); color: #fff;
}
.admin-main .page-title {
  font-weight: 700; letter-spacing: -0.02em; font-size: 14px;
}
.admin-nav .ft {
  margin-top: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.admin-nav .ft a { margin: 0; justify-content: center; }
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-main .topbar {
  background: #fff; color: var(--text);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.admin-main .topbar .right { color: var(--muted); }
.admin-main .content { flex: 1; overflow: auto; padding: 20px; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: #fff; border-radius: 16px; padding: 18px 18px 16px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.stat-card::after {
  content: ""; position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent-soft);
}
.stat-card.tone-teal::after { background: rgba(var(--accent-rgb), .12); }
.stat-card.tone-amber::after { background: rgba(245,158,11,.12); }
.stat-card.tone-slate::after { background: rgba(71,85,105,.1); }
.stat-card.tone-blue::after { background: rgba(var(--accent-rgb), .12); }
.stat-card .n {
  position: relative; z-index: 1;
  font-size: 30px; font-weight: 700; letter-spacing: -0.04em;
  color: var(--text);
}
.stat-card.tone-teal .n { color: var(--accent); }
.stat-card.tone-amber .n { color: #b45309; }
.stat-card.tone-blue .n { color: #1d4ed8; }
.stat-card .l {
  position: relative; z-index: 1;
  margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--muted);
}

.panel {
  background: #fff; border-radius: 16px; padding: 18px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.panel h3 {
  font-size: 14px; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.panel .muted-p {
  font-size: 13px; color: var(--muted); line-height: 1.7;
}
.panel .muted-p code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; padding: 2px 6px; border-radius: 6px;
  background: #f1f5f9; color: #334155; font-weight: 600;
}
.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 128px; }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td {
  padding: 11px 12px; text-align: start; white-space: nowrap;
  border-bottom: 1px solid #f1f5f9;
}
table.data th {
  background: #f8fafc; color: #64748b; font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
}
table.data tbody tr:nth-child(even) td { background: #f8fafc; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--accent-soft); }

.dialog-mask {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 18px;
  background: rgba(8, 12, 20, .55);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  animation: maskIn .2s ease;
}
@keyframes maskIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.dialog {
  width: 100%; max-width: 440px;
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), #fff 40%),
    #fff;
  border-radius: 22px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.65);
  box-shadow:
    0 1px 0 rgba(255,255,255,.7) inset,
    0 24px 64px rgba(15, 23, 42, .22),
    0 8px 24px rgba(37, 99, 235, .08);
  animation: dialogIn .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.dialog::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #2563eb, #60a5fa 45%, #93c5fd);
}
.dialog.dialog-danger::before {
  background: linear-gradient(90deg, #dc2626, #f87171 50%, #fecaca);
}
.dialog.dialog-success::before {
  background: linear-gradient(90deg, #059669, #34d399 50%, #a7f3d0);
}
.dialog.dialog-lg { max-width: 580px; }
.dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 22px 22px 0;
}
.dialog-head .dialog-ico {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #1d4ed8);
  color: #fff; box-shadow: 0 10px 22px rgba(var(--accent-rgb), .28);
}
.dialog.dialog-danger .dialog-head .dialog-ico {
  background: linear-gradient(145deg, #ef4444, #b91c1c);
  box-shadow: 0 10px 22px rgba(239, 68, 68, .28);
}
.dialog.dialog-success .dialog-head .dialog-ico {
  background: linear-gradient(145deg, #10b981, #047857);
  box-shadow: 0 10px 22px rgba(16, 185, 129, .28);
}
.dialog-head .dialog-ico svg { width: 20px; height: 20px; }
.dialog-head .titles { flex: 1; min-width: 0; padding-top: 2px; }
.dialog h3,
.dialog-head h3 {
  margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.03em; color: var(--text);
}
.dialog-sub {
  margin-top: 5px; font-size: 12.5px; color: var(--muted); line-height: 1.5; font-weight: 500;
}
.dialog-close {
  width: 32px; height: 32px; border: 0; border-radius: 10px; cursor: pointer;
  background: #f1f5f9; color: #64748b; display: grid; place-items: center; flex-shrink: 0;
  transition: .15s;
}
.dialog-close:hover { background: #e2e8f0; color: #0f172a; }
.dialog-close svg { width: 16px; height: 16px; }
.dialog-body { padding: 18px 22px 6px; }
.dialog-body > .form-item:first-child { margin-top: 0; }
.dialog .actions,
.dialog-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0; padding: 16px 22px 20px;
  background: linear-gradient(180deg, transparent, #f8fafc 40%);
  border-top: 1px solid rgba(15, 23, 42, .05);
}
/* 兼容旧结构：无 head/body 时保持内边距 */
.dialog > h3:first-child { padding: 22px 22px 0; margin: 0 0 4px; }
.dialog > .form-item,
.dialog > .provision-lead,
.dialog > .provision-card,
.dialog > .audit-msg-list,
.dialog > .page-loading,
.dialog > .empty { margin-left: 22px; margin-right: 22px; }
.dialog > .actions { margin-top: 12px; }
.dialog-textarea {
  width: 100%; min-height: 96px; resize: vertical;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, .1);
  background: #f8fafc; color: var(--text); outline: 0;
  transition: border-color .15s, box-shadow .15s, background .15s;
  line-height: 1.55;
}
.dialog-textarea:focus {
  background: #fff;
  border-color: rgba(var(--accent-rgb), .5);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.dialog.dialog-danger .dialog-textarea:focus {
  border-color: rgba(239, 68, 68, .45);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row .input { flex: 1; }
.expire-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.expire-presets .chip {
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: .15s;
}
.expire-presets .chip:hover { border-color: rgba(var(--accent-rgb), .4); color: var(--accent); }
.expire-presets .chip.on {
  background: var(--accent-soft); border-color: rgba(var(--accent-rgb), .35); color: var(--accent);
}
.expire-bad { color: var(--danger); font-weight: 700; }
table.data tr.row-expired td { background: #fff1f2; }
table.data tr.row-banned td { background: #fef2f2; }
table.data tr.row-pending td { background: #fffbeb; }
.audit-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.audit-tag.st-0 { background: #fef3c7; color: #b45309; }
.audit-tag.st-1 { background: #d1fae5; color: #047857; }
.audit-tag.st-2 { background: #fee2e2; color: #b91c1c; }
.ban-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: #fee2e2; color: #b91c1c;
}
.ban-reason-tip {
  margin-top: 4px; max-width: 160px;
  font-size: 11px; color: #9f1239; line-height: 1.35;
  white-space: normal; word-break: break-word;
}
.provision-card {
  margin: 0; padding: 18px 16px;
  max-height: min(52vh, 420px); overflow: auto;
  border-radius: 14px;
  background:
    linear-gradient(165deg, #0b1220 0%, #111827 55%, #0f172a 100%);
  color: #e2e8f0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Microsoft YaHei", monospace;
  font-size: 12.5px; line-height: 1.7; letter-spacing: 0.01em;
  white-space: pre-wrap; word-break: break-word;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 12px 32px rgba(15,23,42,.18);
  user-select: text;
}
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-inline-end: 5px; vertical-align: middle;
}
.status-dot.on { background: var(--ok); }
.status-dot.pause { background: var(--warn); }
.status-dot.off { background: #94a3b8; }
.qr-box { text-align: center; padding: 10px; }
.qr-box canvas, .qr-box img { margin: 0 auto; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; font-size: 13px; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav {
    flex-direction: row; flex-wrap: wrap; align-items: center;
  }
  .admin-nav .logo { width: 100%; height: 48px; }
  .admin-nav a { margin: 2px 4px; padding: 8px 10px; font-size: 12px; }
  .admin-nav .ft {
    width: 100%; flex-direction: row; margin-top: 0;
  }
  .cards { grid-template-columns: 1fr 1fr; }
}

/* ========== 第二批新增：公共组件基础类 ========== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}
.page-loading {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.page-loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ws-banner {
  flex-shrink: 0;
  display: none; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 12px; font-size: 12px; font-weight: 600;
  background: #fff7ed; color: #c2410c;
  border-bottom: 1px solid rgba(245, 158, 11, .25);
}
.ws-banner.show { display: flex; }
.ws-banner.ok {
  background: #ecfdf5; color: #047857;
  border-bottom-color: rgba(16, 185, 129, .25);
}

.msg-read {
  margin-top: 4px; font-size: 10px; font-weight: 600;
  color: var(--muted-2); text-align: end;
}
.msg.mine .msg-read { color: rgba(255,255,255,.7); }
.msg-read.is-read { color: #93c5fd; }
.msg.mine .msg-read.is-read { color: #bfdbfe; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; margin-top: 2px;
  background: #e2e8f0; color: #475569; font-size: 11px; font-weight: 700;
}
.msg.mine .msg-avatar {
  background: rgba(var(--accent-rgb), .15); color: var(--accent);
}
.msg-day {
  text-align: center; margin: 14px 0 8px;
  font-size: 11px; font-weight: 600; color: var(--muted-2);
}

.pagination {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  margin-top: 14px; flex-wrap: wrap;
}
.pagination .btn { min-width: 32px; padding: 6px 10px; }
.pagination .info { font-size: 12px; color: var(--muted); margin-inline-end: auto; }

.chat-ft { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

/* ========== 第三批：客服 SaaS 壳 ========== */
.saas-shell {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  background: var(--bg);
}
.saas-nav {
  background: var(--bg-deep); color: #fff;
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid rgba(255,255,255,.04);
  z-index: 20;
}
.saas-logo {
  height: var(--top);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  font-weight: 700; font-size: 14px; letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.saas-logo .mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #1d4ed8);
  color: #fff;
}
.saas-logo .mark svg { width: 16px; height: 16px; }
.saas-menu { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.saas-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  color: #94a3b8; font-size: 13px; font-weight: 550;
  transition: .15s;
}
.saas-menu a:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.saas-menu a.on { background: rgba(var(--accent-rgb), .22); color: #fff; }
.saas-menu .nav-ico { display: grid; place-items: center; opacity: .9; }
.saas-menu .nav-ico svg { width: 16px; height: 16px; }
.saas-menu a .badge { margin-inline-start: auto; }
.saas-nav-ft {
  margin-top: auto; padding: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.saas-body { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.saas-top {
  height: var(--top); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.saas-top .left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.saas-top .page-title { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.saas-top .crumb { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.saas-top .right { display: flex; align-items: center; gap: 10px; }
.saas-top .status-pill.live { background: rgba(16,185,129,.12); color: #059669; }
.saas-top .status-pill.idle { background: #f1f5f9; color: #64748b; }
.saas-burger { display: none !important; }
.saas-mask {
  display: none; position: fixed; inset: 0; z-index: 18;
  background: rgba(15,23,42,.4);
}
.user-menu {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2);
}
.user-menu .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.user-menu .avatar svg { width: 14px; height: 14px; }
.user-menu .name { font-size: 12px; font-weight: 600; color: var(--text); max-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-drop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  min-width: 160px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.user-drop button, .user-drop a {
  display: block; width: 100%; text-align: start;
  padding: 9px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.user-drop button:hover, .user-drop a:hover { background: var(--panel-2); }
.user-drop .danger { color: var(--danger); }

.saas-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.saas-content.pad { padding: 18px; overflow: auto; }
.saas-content.desk { overflow: hidden; }
.saas-content.desk .shell-body { flex: 1; height: 100%; }

.qr-form { margin-bottom: 16px; }
.qr-form-actions { display: flex; gap: 8px; margin-top: 10px; }
.qr-manage-list { display: flex; flex-direction: column; gap: 8px; }
.qr-manage-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel-2);
}
.qr-manage-item.editing {
  border-color: rgba(var(--accent-rgb), .35);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1);
}
.qr-manage-item .txt { flex: 1; font-size: 13px; line-height: 1.55; color: var(--text); word-break: break-word; }
.qr-manage-item .tag {
  display: inline-flex; margin-inline-end: 6px; padding: 1px 6px;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); vertical-align: middle;
}
.qr-manage-item .tag-mine {
  background: #ecfdf5; color: #059669;
}
.qr-manage-item .ops { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }

@media (max-width: 900px) {
  .saas-shell { grid-template-columns: 1fr; }
  .saas-nav {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw);
    transform: translateX(-105%); transition: transform .2s ease;
  }
  .saas-nav.open { transform: translateX(0); }
  .saas-mask { display: block; }
  .saas-burger { display: inline-flex !important; }
  .user-menu .name { display: none; }
}

/* ========== 第四批：总后台补充 ========== */
.admin-saas .saas-menu a .badge { margin-inline-start: auto; }
.admin-content .card { margin-bottom: 14px; }
.admin-content .card h3 { letter-spacing: -0.02em; }
.code-chip {
  display: inline-block; margin-inline-start: 6px;
  padding: 2px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: #f1f5f9; vertical-align: middle;
}
.ops-cell { white-space: normal !important; }
.ops-cell .btn { margin: 2px; }
.audit-toolbar .select,
.audit-toolbar .input {
  width: auto; min-width: 128px; max-width: 180px;
}
.audit-msg-dialog {
  max-width: 560px; max-height: 80vh;
  display: flex; flex-direction: column;
}
.audit-msg-list {
  flex: 1; overflow: auto; margin: 8px 0 4px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2);
}
.audit-msg-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.audit-msg-item:last-child { border-bottom: 0; }
.audit-msg-item .meta {
  font-size: 11px; font-weight: 600; color: var(--muted-2); margin-bottom: 4px;
}
.audit-msg-item .body { color: var(--text); line-height: 1.5; word-break: break-word; }

/* 旧 admin-layout 保留兼容，新页已用 saas-shell */
.admin-layout .admin-main .content { background: var(--bg); }

/* ========== 第六批：官网 + 注册 ========== */
.site-body {
  background: #0b1220;
  color: #e2e8f0;
  min-height: 100%;
}
.site-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(11, 18, 32, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.site-nav .brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
}
.site-nav .brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #1d4ed8);
  color: #fff;
}
.site-nav .brand .mark svg { width: 16px; height: 16px; }
.site-nav .links {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.site-nav .links a {
  color: #94a3b8; font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-radius: 8px;
}
.site-nav .links a:hover { color: #fff; background: rgba(255,255,255,.05); }
.site-nav .links .btn { color: #fff; }

.site-hero {
  min-height: min(88vh, 820px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px; align-items: center;
  padding: clamp(36px, 8vh, 72px) clamp(16px, 4vw, 40px) 48px;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(var(--accent-rgb), .35), transparent 55%),
    radial-gradient(700px 420px at 90% 20%, rgba(59,130,246,.18), transparent 50%),
    linear-gradient(180deg, #0b1220 0%, #111827 100%);
  overflow: hidden;
}
.site-hero .eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #93c5fd; margin-bottom: 14px;
}
.site-hero h1 {
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 750; letter-spacing: -0.04em; line-height: 1.05;
  color: #fff; margin-bottom: 16px;
  animation: rise .55s cubic-bezier(.2,.8,.2,1);
}
.site-hero .lead {
  max-width: 34em; font-size: 16px; line-height: 1.7; color: #94a3b8;
  margin-bottom: 28px; animation: rise .65s cubic-bezier(.2,.8,.2,1);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; animation: rise .75s cubic-bezier(.2,.8,.2,1); }
.hero-cta.center { justify-content: center; margin-top: 28px; }
.hero-cta .btn.ghost {
  color: #e2e8f0; border-color: rgba(255,255,255,.2);
}
.hero-cta .btn.ghost:hover { background: rgba(255,255,255,.06); }
.hero-visual { position: relative; min-height: 320px; }
.hero-glow {
  position: absolute; inset: 10% 8%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .35), transparent 70%);
  filter: blur(20px); animation: pulseGlow 4s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: .55; transform: scale(1); }
  50% { opacity: .9; transform: scale(1.05); }
}
.hero-panel {
  position: relative; margin: 0 auto; max-width: 360px;
  padding: 18px; border-radius: 22px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  animation: rise .7s cubic-bezier(.2,.8,.2,1) .08s both;
}
.hero-panel .hp-bar { display: flex; gap: 6px; margin-bottom: 18px; }
.hero-panel .hp-bar span {
  width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.25);
}
.hero-panel .hp-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.hero-panel .hp-row i {
  width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.12);
}
.hero-panel .hp-row b {
  flex: 1; height: 36px; border-radius: 12px; background: rgba(255,255,255,.1);
}
.hero-panel .hp-row.me { flex-direction: row-reverse; }
.hero-panel .hp-row.me b {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .85), rgba(29,78,216,.75));
}

.site-section {
  padding: 72px clamp(16px, 4vw, 40px);
  background: #0f172a;
}
.site-section.alt { background: #111827; }
.site-section h2 {
  text-align: center; font-size: clamp(24px, 3vw, 32px);
  font-weight: 750; letter-spacing: -0.03em; color: #fff;
}
.section-lead {
  text-align: center; max-width: 36em; margin: 12px auto 36px;
  color: #94a3b8; line-height: 1.65; font-size: 15px;
}
.feature-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; max-width: 1080px; margin: 0 auto;
}
.feature-grid article {
  padding: 22px 20px; border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  transition: transform .2s, border-color .2s, background .2s;
}
.feature-grid article:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), .35);
  background: rgba(var(--accent-rgb), .08);
}
.feature-grid .fico {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 14px;
  display: grid; place-items: center;
  background: rgba(var(--accent-rgb), .18); color: #93c5fd;
}
.feature-grid .fico svg { width: 20px; height: 20px; }
.feature-grid h3 {
  font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 8px;
}
.feature-grid p { font-size: 13px; line-height: 1.65; color: #94a3b8; }

.steps {
  list-style: none; max-width: 720px; margin: 0 auto;
  display: grid; gap: 12px;
}
.steps li {
  display: grid; grid-template-columns: 140px 1fr; gap: 12px;
  padding: 16px 18px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
}
.steps strong { color: #fff; font-size: 14px; }
.steps span { color: #94a3b8; font-size: 13px; line-height: 1.5; }

.site-footer {
  padding: 36px clamp(16px, 4vw, 40px) 28px;
  border-top: 1px solid rgba(255,255,255,.06);
  text-align: center; background: #0b1220;
}
.foot-brand { font-weight: 750; color: #fff; margin-bottom: 12px; letter-spacing: -0.02em; }
.foot-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.foot-links a { color: #94a3b8; font-size: 13px; font-weight: 600; }
.foot-links a:hover { color: #fff; }
.site-footer .copy { font-size: 12px; color: #64748b; }

.register-card { max-width: 440px; }
.register-page .login-card { padding-top: 30px; }

.lang-checks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 2px 8px; max-height: 180px; overflow: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.schedule-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.schedule-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.schedule-row .select { width: 100px; min-width: 90px; }
.schedule-row .input[type="time"] { width: 120px; padding: 8px 10px; }

@media (max-width: 900px) {
  .site-hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-visual { order: -1; min-height: 240px; }
  .feature-grid { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 1fr; }
  .site-nav .links a:not(.btn) { display: none; }
}
