/* ============================================================
 * 无界AI智服 · 公共 Layout（低精度外壳）
 * 结构：顶栏 + 左侧店铺列表栏 + 主内容区
 * 低精度原则：不做阴影/渐变/精细动画，只保证信息架构与可点击
 * ============================================================ */
:root {
  --primary: #2f7ff0;
  --primary-soft: #eaf2ff;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e6eaf0;
  --text: #1f2a37;
  --soft: #6b7280;
  --mute: #9ca3af;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --sidebar-w: 220px;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---------- 外壳 ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px; flex: 0 0 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 200px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.brand b { font-size: 15px; letter-spacing: .5px; }
.brand span { display: block; font-size: 10.5px; color: var(--mute); }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.top-btn {
  height: 34px; min-width: 34px; padding: 0 10px;
  border: 1px solid transparent; background: transparent; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--soft); font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.top-btn:hover { background: #f2f5f9; }
.top-btn.primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
  font-weight: 600; padding: 0 14px;
}
.top-btn.primary:hover { background: #2570db; }
.top-btn .badge {
  background: var(--red); color: #fff; font-size: 10px;
  padding: 0 5px; border-radius: 999px; font-weight: 700; line-height: 15px;
}
.quota-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--soft);
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer;
}
.quota-chip b { color: var(--primary); }
.user-chip { display: flex; align-items: center; gap: 7px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.user-chip:hover { background: #f2f5f9; }
.user-chip .avatar { width: 26px; height: 26px; border-radius: 50%; background: #e5eaf2; display: grid; place-items: center; font-size: 13px; }
/* ---------- 顶部：头像 + 脱敏手机号 + 套餐/版本 ---------- */
.tb-left { display: flex; align-items: center; }
.tb-left .user-chip { gap: 9px; padding: 4px 10px; }
.tb-left .uc-txt { line-height: 1.25; }
.tb-left .uc-txt b { display: block; font-size: 13px; }
.tb-left .uc-txt span { display: block; font-size: 10.5px; color: var(--mute); }

/* ---------- 左侧店铺条目（重做：名称单行 + 简短标签 + AI 开关） ---------- */
.store-item { align-items: flex-start; gap: 10px; padding: 10px 10px 10px 9px; }
.store-item .s-main { min-width: 0; }
.store-item .s-name {
  font-size: 13px; font-weight: 600; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 118px;
}
.store-item .s-meta { font-size: 11px; color: var(--mute); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 118px; }
.store-item .s-tags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.t-tag { font-size: 10px; border-radius: 4px; padding: 0 5px; line-height: 15px; border: 1px solid transparent; white-space: nowrap; }
.t-tag.green { background: #e7f9ee; color: #16a34a; border-color: #b7ebc9; }
.t-tag.orange { background: #fff4e5; color: #d97706; border-color: #ffd591; }
.t-tag.red { background: #feecec; color: var(--red); border-color: #ffccc7; }
.t-tag.blue { background: var(--primary-soft); color: var(--primary); border-color: #b9d2fb; }
.t-tag.gray { background: #f1f3f7; color: var(--soft); border-color: #e3e7ee; }
/* 右侧：铃铛 + AI 胶囊开关 + 最后消息时间（紧凑排列） */
.s-ai-sw { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-top: 2px; }
.s-ai-row { display: flex; align-items: center; gap: 6px; }
.s-bell { font-size: 13px; line-height: 1; opacity: .28; filter: grayscale(1); }
.s-bell.alert { opacity: 1; filter: none; color: var(--red); }
.s-time { font-size: 10.5px; color: var(--mute); white-space: nowrap; }

/* AI 胶囊开关（参考图样式：蓝底 + 左侧 AI + 右侧白色圆形滑块） */
.ai-pill {
  position: relative; width: 46px; height: 24px; border-radius: 999px;
  border: none; cursor: pointer; padding: 0; display: inline-flex; align-items: center;
  transition: background .15s ease;
}
.ai-pill .ai-txt {
  font-size: 10px; font-weight: 800; letter-spacing: .5px; color: #fff;
  position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
}
.ai-pill .knob {
  position: absolute; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s ease;
}
.ai-pill.on { background: var(--primary); }
.ai-pill.on .knob { left: 25px; }
.ai-pill.off { background: #c3cad6; }
.ai-pill.off .ai-txt { opacity: .85; }
.ai-pill.off .knob { left: 3px; }
.ai-pill:hover { filter: brightness(1.05); }

/* ---------- 顶部推广入口（醒目胶囊，位于购物车前） ---------- */
.top-btn.promo-pill {
  background: linear-gradient(90deg, #fff2e0, #ffe8cc);
  border-color: #ffc078; color: #b45309; font-weight: 700; padding: 0 12px;
}
.top-btn.promo-pill:hover { background: #ffe0b8; }
.top-btn.promo-pill .mini {
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 0 6px; line-height: 15px; margin-left: 2px;
}

/* ---------- 左侧店铺：待完成基础设置 ---------- */
.store-item .s-pending {
  background: #fff4e5; color: #d97706; border: 1px solid #ffd591;
  font-size: 10px; font-weight: 700; border-radius: 999px; padding: 0 6px; margin-left: 4px;
}
.store-item.not-ready .s-ava { background: #fdf2e3; }

/* ---------- 头像下拉菜单 ---------- */
.user-menu-wrap { position: relative; }
.user-menu {
  display: none; position: absolute; right: 0; top: 40px; width: 268px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,.14); z-index: 9500; padding: 6px 0; text-align: left;
}
.user-menu.show { display: block; }
.user-menu .um-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.user-menu .um-head .ava { width: 34px; height: 34px; border-radius: 50%; background: #eef1f6; display: grid; place-items: center; font-size: 15px; }
.user-menu .um-head .acc { font-size: 13px; font-weight: 700; }
.user-menu .um-head .sub { font-size: 11.5px; color: var(--mute); margin-top: 2px; }
.user-menu .um-row { display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 12.5px; color: var(--soft); }
.user-menu .um-row .v { margin-left: auto; color: var(--text); font-weight: 600; }
.user-menu .um-sync { padding: 10px 14px; background: #f7f9fc; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.user-menu .um-sync .t { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.user-menu .um-sync .t .v { margin-left: auto; font-weight: 600; }
.user-menu .um-sync .s { font-size: 11.5px; color: var(--mute); margin-top: 4px; }
.user-menu .um-sync .ok { color: var(--green); }
.user-menu .um-sync .fail { color: var(--red); }
.user-menu .um-sync .syncing { color: var(--primary); }
.user-menu .um-sync button { margin-top: 8px; }
.user-menu .um-sep { border-top: 1px solid var(--border); margin: 6px 0; }
.user-menu .um-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px; cursor: pointer; color: var(--text); }
.user-menu .um-item:hover { background: #f7f9fc; }
.user-menu .um-item.danger { color: var(--red); }

.win-btns { display: flex; gap: 2px; margin-left: 6px; }
.win-btns button { width: 30px; height: 26px; border: none; background: transparent; cursor: pointer; color: var(--soft); border-radius: 5px; }
.win-btns button:hover { background: #f2f5f9; }

/* ---------- 主体 ---------- */
.shell-body { flex: 1; display: flex; min-height: 0; }

/* ---------- 左侧店铺栏 ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.side-tabs { display: flex; border-bottom: 1px solid var(--border); }
.side-tabs button {
  flex: 1; height: 40px; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--soft);
  border-bottom: 2px solid transparent;
}
.side-tabs button.active { color: var(--primary); font-weight: 700; border-bottom-color: var(--primary); }
.store-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.store-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; cursor: pointer; border-left: 3px solid transparent;
}
.store-item:hover { background: #f7f9fc; }
.store-item.active { background: var(--primary-soft); border-left-color: var(--primary); }
.store-item .s-ava { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 7px; background: #eef1f6; display: grid; place-items: center; font-size: 13px; color: var(--soft); }
.store-item .s-main { flex: 1; min-width: 0; }
.store-item .s-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.store-item .s-name .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: 0 0 6px; }
.store-item .s-sub { font-size: 11px; color: var(--mute); margin-top: 2px; display: flex; gap: 8px; }
.store-item .s-right { text-align: right; font-size: 11px; color: var(--mute); }
.store-item .s-badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 6px; font-weight: 700; }
.store-item .s-ai { font-size: 10px; color: var(--primary); border: 1px solid var(--primary); border-radius: 4px; padding: 0 4px; }
.side-bottom { border-top: 1px solid var(--border); padding: 6px 0; }
.side-bottom a {
  display: flex; align-items: center; gap: 9px; padding: 9px 14px;
  font-size: 13px; color: var(--soft); border-left: 3px solid transparent;
}
.side-bottom a:hover { background: #f7f9fc; }
.side-bottom a.active { color: var(--primary); font-weight: 700; background: var(--primary-soft); border-left-color: var(--primary); }

/* ---------- 主内容 ---------- */
.main { flex: 1; overflow-y: auto; padding: 18px 22px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.page-head h1 { font-size: 21px; }
.page-head .sub { color: var(--soft); font-size: 12.5px; margin-top: 5px; }
.page-head .head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; }
.card-head .more { margin-left: auto; font-size: 12.5px; color: var(--primary); cursor: pointer; }
.card-body { padding: 14px 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; background: #fff; color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #2570db; }
.btn-ghost { border-color: #cfd8e3; color: var(--soft); }
.btn-ghost:hover { background: #f7f9fc; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: #e7f9ee; color: #16a34a; }
.badge-orange { background: #fff4e5; color: #d97706; }
.badge-red { background: #feecec; color: var(--red); }
.badge-gray { background: #f1f3f7; color: var(--soft); }

.seg { display: inline-flex; border: 1px solid #cfd8e3; border-radius: 8px; overflow: hidden; }
.seg button { height: 32px; padding: 0 14px; border: none; background: #fff; cursor: pointer; font-family: inherit; font-size: 12.5px; color: var(--soft); }
.seg button.active { background: var(--primary); color: #fff; font-weight: 700; }

select, input[type="text"], input[type="number"], textarea {
  height: 32px; padding: 0 10px; border: 1px solid #cfd8e3; border-radius: 7px;
  font-family: inherit; font-size: 13px; background: #fff; color: var(--text);
}
textarea { height: auto; min-height: 62px; padding: 8px 10px; resize: vertical; }
label.field { display: block; font-size: 12px; color: var(--soft); margin: 10px 0 4px; }
.field-row { margin-bottom: 6px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { width: 16px; height: 16px; }
.radio-row, .check-row { display: flex; flex-wrap: wrap; gap: 14px; }
.radio-row label, .check-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.muted { color: var(--mute); font-size: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(8px);
  background: rgba(15,23,42,.92); color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; align-items: center; justify-content: center; z-index: 9000;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 460px; max-width: 92vw; max-height: calc(100vh - 32px); overflow: hidden; display: flex; flex-direction: column; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; flex: 0 0 auto; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--mute); }
.modal-body { padding: 16px 18px; overflow-y: auto; min-height: 0; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex: 0 0 auto; background: #fff; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.empty-view { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; padding: 80px 0; color: var(--mute); }
