/* segment-portal · 样式复刻自 workbench/static/crm.css（:root 变量 + wpool 表格手感） */
:root {
  --bg: #fff;
  --surface: #fbfbfb;
  --surface-2: #f7f7f7;
  --fg: #000;
  --muted: #898a8d;
  --muted-2: #a7a8ab;
  --border: #e6e7ea;
  --border-strong: #d9dade;
  --accent: #ff8849;
  --accent-dark: #e2703a;
  --accent-soft: #fff2e9;
  --green: #00a86b;
  --orange: #f47b20;
  --purple: #9b69ff;
  --danger: #b3261e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .08);
  --radius: 8px;
  --ease: cubic-bezier(.23, 1, .32, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 18px;
}
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
a { color: inherit; }

/* ---- 顶栏 ---- */
.portal-topbar {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.portal-brand { font-weight: 600; font-size: 13px; }
.portal-subtitle { color: var(--muted); }
.topbar-spacer { flex: 1; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.user-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.user-role { color: var(--muted); }

/* ---- 按钮/徽章 ---- */
.toolbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg);
}
.toolbar-chip:hover { background: var(--surface-2); }
.toolbar-chip.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.toolbar-chip.primary:hover { background: var(--accent-dark); }
.toolbar-chip:disabled { opacity: .5; cursor: not-allowed; }
.badge-standard {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.badge-danger { background: #fbeeea; border-color: #e5b8b0; color: var(--danger); }
.badge-green { background: #e6f6ef; border-color: #9ed8bf; color: #00795a; }
.badge-purple { background: #f1ecff; border-color: #cbb8ff; color: #6a3df5; }

/* ---- 登录门 ---- */
.login-wrap {
  min-height: calc(100vh - 46px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}
.login-card {
  width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
  text-align: center;
}
.login-card h1 { font-size: 16px; margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 20px; }
.login-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 17px;
  text-align: left;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.note-error {
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid #e5b8b0;
  background: #fbeeea;
  color: var(--danger);
  border-radius: var(--radius);
  text-align: left;
}

/* ---- 主体布局 ---- */
.portal-main { padding: 16px; max-width: 1280px; margin: 0 auto; }
.portal-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.portal-head h1 { font-size: 15px; margin: 0; }
.portal-updated { color: var(--muted-2); }
.seed-line { color: var(--muted); margin: 2px 0 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--muted);
}
.tab.active {
  background: var(--bg);
  border-color: var(--border);
  color: var(--fg);
  font-weight: 600;
  position: relative;
  top: 1px;
}

/* ---- 客群切换 ---- */
.seg-switch { display: flex; gap: 8px; margin: 4px 0 12px; flex-wrap: wrap; }
.seg-btn {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--bg);
  color: var(--muted);
}
.seg-btn:hover { background: var(--surface-2); }
.seg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pool-filters { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pool-filters input[type="text"], .pool-filters select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}
.pool-filters input[type="text"] { width: 240px; }

/* ---- 表格（wpool 手感） ---- */
.wpool-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.wpool-row {
  display: grid;
  align-items: center;
  border-bottom: 1px solid var(--border);
  min-height: 36px;
  padding: 2px 0;
}
.wpool-row:last-child { border-bottom: none; }
.wpool-row.wpool-head {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  min-height: 30px;
}
.wpool-row:not(.wpool-head):hover { background: var(--accent-soft); }
.wpool-cell { padding: 2px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpool-cell.check { display: flex; align-items: center; justify-content: center; }
.wpool-cell.check input { width: 14px; height: 14px; cursor: pointer; }
.cell-name { font-weight: 600; cursor: pointer; }
.cell-name:hover { color: var(--accent-dark); }
.cell-code { color: var(--muted-2); font-size: 11px; margin-left: 6px; font-weight: 400; }
.cell-muted { color: var(--muted); }
.col-tail { text-align: right; padding-right: 12px; }
.row-claim-btn {
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 6px;
}
.row-claim-btn:hover { background: var(--accent); color: #fff; }
.empty-block { padding: 40px 0; text-align: center; color: var(--muted); }

/* ---- 选择条 ---- */
.pool-select-bar {
  position: sticky;
  bottom: 16px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.select-count { font-weight: 600; }
.select-clear { color: var(--muted); background: none; border: none; text-decoration: underline; }

/* ---- 提示条 ---- */
.notice {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.notice.ok { border-color: #9ed8bf; background: #e6f6ef; color: #00795a; }
.notice.err { border-color: #e5b8b0; background: #fbeeea; color: var(--danger); }
.readonly-banner {
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
}

/* ---- 抽屉 ---- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .28);
  z-index: 40;
}
aside.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(480px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 41;
  display: flex;
  flex-direction: column;
  animation: drawer-in .18s var(--ease);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head .title { font-weight: 600; font-size: 13px; flex: 1; }
.drawer-close { background: none; border: none; color: var(--muted); font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 10px 16px; display: flex; gap: 8px; justify-content: flex-end; }
.drawer-section { margin-bottom: 14px; }
.drawer-section h3 {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.detail-line { display: grid; grid-template-columns: 92px 1fr; gap: 8px; padding: 3px 0; }
.detail-line .k { color: var(--muted); }
.detail-line .v { overflow-wrap: anywhere; }

.btn-primary {
  height: 30px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.btn-primary:disabled { opacity: .5; }

/* ---- 左侧栏：照搬 workbench crm.css 原版样式 ---- */
:root { --sidebar: 235px; }
.app-shell { min-height: 100vh; display: flex; background: var(--bg); }
.main-portal { margin-left: var(--sidebar); width: calc(100% - var(--sidebar)); min-width: 0; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar);
  border-right: 1px solid var(--border); background: var(--bg);
  display: flex; flex-direction: column;
}
.brand-row { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 8px; flex: 0 0 auto; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: #f59a0b; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.brand-name { font-weight: 700; font-size: 13px; letter-spacing: -.1px; white-space: nowrap; }
.sidebar-scroll { overflow: auto; padding: 4px 8px 12px; scrollbar-width: thin; flex: 1 1 auto; }
.nav-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.nav-link { min-height: 32px; width: 100%; display: flex; align-items: center; gap: 8px; border-radius: 9px; padding: 0 8px; color: #111; background: transparent; text-align: left; cursor: pointer; border: 0; font-size: 12px; }
.nav-link:hover { background: #f3f3f3; }
.nav-link.active { background: #f0f0f0; }
.nav-link svg { flex: 0 0 auto; color: #202124; }
.nav-link .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link .count { margin-left: auto; color: var(--muted); font-size: 11px; }
.nav-separator { height: 1px; background: var(--border); margin: 8px 8px; }
.nav-section-title { height: 24px; display: flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--muted); font-size: 11px; margin-top: 4px; }
.nav-section-title .chev { font-size: 12px; }
.boundary-row { margin-top: auto; min-height: 40px; border-top: 1px solid var(--border); padding: 0 8px; display: flex; align-items: center; gap: 7px; }
.boundary-copy { font-weight: 700; font-size: 11px; white-space: nowrap; }
