/* 有依智康运营后台 · 样式（对齐运营后台视觉：深色侧栏 + 白卡片 + 翡翠绿主色） */
:root {
  --c-primary: #0E9F6E;
  --c-primary-dark: #0B8A5F;
  --c-primary-soft: rgba(14, 159, 110, 0.08);
  --c-text: #1F2D3D;
  --c-muted: #8A919E;
  --c-border: #EDEFF2;
  --c-bg: #F0F2F5;
  --c-danger: #D64545;
  --sidebar-bg: #0C2E33;
  --sidebar-bg-active: #11453F;
  --sidebar-text: #AFC4C1;
  --sidebar-dim: #6E8B89;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 13px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }

.muted { color: var(--c-muted); }
.small { font-size: 12px; }
.inline { display: inline; }

code {
  padding: 1px 5px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 12px;
  color: #4A5568;
  background: #F4F7FB;
  border-radius: 3px;
}

/* ---------- 布局：侧栏 + 顶栏 + 内容 ---------- */
.layout { display: flex; min-height: 100vh; }
.layout-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  width: 168px;
  flex: 0 0 168px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand .logo {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 4px;
  background: var(--c-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-nav { padding: 10px 0; }

.sidebar-group { margin-bottom: 6px; }

.sidebar-group-title {
  padding: 8px 16px 4px;
  font-size: 12px;
  color: var(--sidebar-dim);
}

.sidebar-item {
  display: block;
  padding: 8px 16px 8px 24px;
  font-size: 13px;
  color: var(--sidebar-text);
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar-item.active {
  background: var(--sidebar-bg-active);
  color: #fff;
  border-left-color: #17C08A;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--sidebar-dim);
}

.topbar {
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.topbar-title { font-size: 13px; font-weight: 600; color: var(--c-text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.container { padding: 18px 20px 40px; width: 100%; }
/* 保留 .narrow 类名做兼容，但不再限宽：内容区始终自适应铺满 */
.container.narrow { max-width: none; }

/* ---------- 页头 ---------- */
.crumb { font-size: 12px; color: var(--c-muted); margin-bottom: 4px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.page-head h2 { margin: 0; font-size: 22px; font-weight: 600; color: var(--c-text); }
.page-desc { margin: 0 0 16px; font-size: 12px; color: var(--c-muted); }
.page-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 卡片 ---------- */
.card-form,
.panel {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 4px 18px 18px;
}

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--c-muted); }
/* 表单输入不跟着铺满到底：单行控件限宽，避免大屏上拉得过长 */
.card-form .field > input,
.card-form .field > select,
.card-form .field > textarea { max-width: 680px; }
.card-form .field-row .field > input { max-width: none; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--c-text);
  background: #fff;
  border: 1px solid #DCE0E6;
  border-radius: 4px;
  outline: none;
}
input:focus,
select:focus,
textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-soft); }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.field-inline { display: flex; align-items: center; gap: 8px; }
.field-inline > span { color: #5A6572; font-size: 12px; white-space: nowrap; }
.field-inline input,
.field-inline select { width: 150px; }
.filter-bar .field-inline.grow { flex: 1 1 320px; }
.filter-bar .field-inline.grow select { width: 100%; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 7px 14px;
  font-size: 13px;
  line-height: 1.2;
  color: var(--c-text);
  background: #fff;
  border: 1px solid #DCE0E6;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }

.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; }

.btn-danger { background: #fff; border-color: var(--c-danger); color: var(--c-danger); }
.btn-danger:hover { background: rgba(214, 69, 69, 0.06); color: var(--c-danger); }

.btn-link { border: none; background: none; color: var(--c-muted); padding: 4px 6px; }
.btn-link:hover { color: var(--c-primary); }

.btn-block { width: 100%; text-align: center; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-listed { background: var(--c-primary-soft); border-color: rgba(14, 159, 110, 0.35); color: var(--c-primary); }

/* 操作列：不要在 <td> 上直接 flex —— 会让列宽脱离 table-cell 计算，
   同一列里「两个按钮的行」和「一个按钮的行」就错位了。
   改成 inline-block 排列，列宽与表头自然左对齐。 */
.ops { white-space: nowrap; text-align: left; }
.ops > * { display: inline-block; vertical-align: middle; margin: 0 10px 0 0; }
.ops > *:last-child { margin-right: 0; }
.ops > form { display: inline-block; margin: 0 10px 0 0; }
.ops > form:last-child { margin-right: 0; }
.op-link {
  padding: 0;
  font-size: 13px;
  color: var(--c-primary);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.op-link:hover { color: var(--c-primary-dark); text-decoration: underline; }
.op-link-danger { color: var(--c-danger); }
.op-link-danger:hover { color: var(--c-danger); }
.sort-form { display: inline-flex; align-items: center; gap: 4px; }
.sort-input { width: 64px; padding: 4px 8px; font-size: 12px; border: 1px solid #DCE0E6; border-radius: 4px; }

/* ---------- 表格 ---------- */
/* 表格：容器内横向滚动（列多/窄屏时不撑破页面，操作列可滚到） */
.table-scroll { width: 100%; overflow-x: auto; }
.table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th,
.table td {
  padding: 10px;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--c-border);
}
.table th { background: #F7F9FA; color: #5A6572; font-weight: 500; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FAFCFB; }
.table .empty { padding: 40px 0; text-align: center; color: var(--c-muted); }
.table a { color: var(--c-primary); }

/* ---------- 状态标签 ---------- */
.tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 18px;
  border-radius: 3px;
  background: #F0F2F5;
  color: #5A6572;
}
.tag-live { background: #FDECEC; color: var(--c-danger); }
.tag-preview { background: #E6F6EF; color: var(--c-primary); }
.tag-replay { background: #F0F2F5; color: #5A6572; }
.tag-paused { background: #FDF3E2; color: #B7791F; }

/* ---------- 提示条 ---------- */
.alert { padding: 8px 12px; margin-bottom: 14px; border-radius: 4px; font-size: 13px; }
.alert-error { background: #FDECEC; color: var(--c-danger); }
.alert-success { background: #E6F6EF; color: var(--c-primary-dark); }
.alert-info { background: #F4F7FB; color: #5A6572; }

/* ---------- 缩略图 / 小标题 ---------- */
.thumb {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  background: #fff;
}
.section-title { margin: 20px 0 10px; font-size: 14px; font-weight: 600; color: var(--c-text); }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--c-muted);
}
.pager select { width: auto; padding: 4px 8px; }
/* 统一分页条：总数 + 每页条数 + 上一页/下一页（对齐运营后台原型） */
.pager-bar { flex-wrap: wrap; }
.pager-bar .muted { margin-right: 4px; }
.pager-size { display: inline-flex; align-items: center; gap: 6px; color: var(--c-muted); }
.pager-size select { width: 72px; }
.pager-bar .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------- 编辑表单 ---------- */
.form-section { padding: 16px 0; border-bottom: 1px solid var(--c-border); }
.form-section:last-of-type { border-bottom: none; }
.form-section h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--c-text); }

.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }

.checkbox-field { display: flex; align-items: center; gap: 8px; }
.checkbox-field input { width: auto; }
.checkbox-field > span { margin: 0; color: var(--c-text); font-size: 13px; }

.readonly-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.readonly-grid > div > div { margin-top: 4px; }

.preview-cover { margin-top: 8px; }
.preview-cover img {
  width: 180px;
  height: 220px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}
.preview-cover[hidden] { display: none; }

.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.impact-list { margin: 0 0 8px 18px; padding: 0; }
.impact-list li { margin-bottom: 6px; }

/* ---------- 素材上传（OSS） ---------- */
.upload-line { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.upload-status { min-height: 18px; word-break: break-all; }

/* ---------- 商品多规格 / 多图 ---------- */
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--c-text);
}
.check-line input { width: auto; margin: 0; }
.check-line > span { color: var(--c-text); }

.thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.thumb-item {
  position: relative;
  width: 84px;
  height: 84px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  overflow: hidden;
  background: #fafafa;
}
.thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.thumb-del:hover { background: rgba(214, 69, 69, 0.9); }

.sku-block { margin-top: 14px; }
.sku-block h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--c-text); }
.sku-table { width: 100%; }
.sku-table td { vertical-align: middle; }
.sku-table td input {
  width: 100%;
  max-width: 160px;
  padding: 5px 8px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  font-size: 13px;
}
.sku-table .sku-price, .sku-table .sku-subtotal { color: #d4380d; font-weight: 600; }

/* ---------- 编辑弹窗 ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  overflow-y: auto;
}
.modal-mask { position: fixed; inset: 0; background: rgba(12, 30, 34, 0.45); }
.modal-panel {
  position: relative;
  width: 920px;
  max-width: 100%;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--c-border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: #fff;
  color: #5A6572;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: #F5F7F9; }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 6px 22px 4px; overflow-y: auto; }
/* panel 的直接子项是包裹容器，必须也做成 flex 容器，否则 body 的收缩设置无效、内容会被撑出弹窗 */
.modal-panel > form,
.modal-panel > #edit-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--c-border);
}
.modal-section { padding: 16px 0; border-bottom: 1px solid #F1F3F5; }
.modal-section:last-child { border-bottom: none; }
.modal-section > h4 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }

.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 20px; }
.info-grid > div > span { display: block; color: var(--c-muted); font-size: 12px; margin-bottom: 4px; }
.info-grid > div > b { font-weight: 500; font-size: 13px; word-break: break-all; }

.media-row { display: flex; gap: 48px; flex-wrap: wrap; }
.media-pick { display: flex; gap: 12px; }
.media-box {
  position: relative;
  width: 108px;
  height: 132px;
  border: 1px dashed #C8CED6;
  border-radius: 6px;
  background: #FAFBFC;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}
.media-box:hover { border-color: var(--c-primary); }
.media-box img { width: 100%; height: 100%; object-fit: cover; }
.media-box .media-plus { font-size: 26px; color: #B4BBC6; font-weight: 300; }
.media-box.is-video { width: 132px; height: 88px; }
.media-box.is-video .media-plus { font-size: 20px; }
.media-box video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.media-side { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.media-hint { color: var(--c-muted); font-size: 12px; line-height: 1.7; }
.media-line { display: flex; gap: 8px; align-items: center; }
.media-line input[type="text"] { width: 220px; padding: 6px 10px; font-size: 12px; border: 1px solid #DCE0E6; border-radius: 4px; }
.media-check { display: flex; align-items: center; gap: 6px; color: var(--c-text); font-size: 12px; }
.media-check input { width: auto; }

.section-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head-row h4 { margin: 0; }

.table-compact th, .table-compact td { padding: 6px 8px; font-size: 12px; }
.table-compact .thumb { width: 34px; height: 34px; }
.table-compact .sort-input { width: 74px; }

.goods-picker {
  background: #F7F9FA;
  border: 1px solid #EDEFF2;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.goods-picker[hidden] { display: none; }

/* 预约人员弹窗 */
.modal-panel.is-booking { width: 880px; }
.booking-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; }
.booking-filter input {
  width: 200px;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #DCE0E6;
  border-radius: 4px;
}
.booking-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
}
.booking-pager select, .booking-pager input {
  width: 84px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #DCE0E6;
  border-radius: 4px;
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0C2E33 0%, #134A45 55%, #0E9F6E 145%);
}
.login-box {
  width: 360px;
  padding: 32px 28px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.login-box h1 { margin: 0 0 4px; font-size: 18px; }
.login-box p { margin: 0 0 18px; }

/* ---------- 窄屏：侧栏变顶部横条 ---------- */
@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar { width: auto; flex: none; }
  .sidebar-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  .sidebar-group { margin: 0; }
  .sidebar-group-title { display: none; }
  .sidebar-item {
    padding: 6px 12px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  .sidebar-item.active { border-left: none; border-bottom-color: #17C08A; }
  .sidebar-foot { display: none; }
}

/* ---------- 二级分销：推广员数据概况（对齐可交互原型） ---------- */
.po-card {
  padding: 18px 20px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.po-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.po-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--c-text); }
.po-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-text);
  cursor: pointer;
  white-space: nowrap;
}
.po-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.po-stat {
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: #fff;
}
.po-stat span { display: block; margin-bottom: 8px; font-size: 12px; color: var(--c-muted); }
.po-stat strong { display: block; font-size: 24px; line-height: 1.2; font-weight: 600; color: var(--c-text); }
.pager .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
@media (max-width: 900px) {
  .po-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .po-grid { grid-template-columns: 1fr; }
}

/* ---------- 工作台 / 经营统计 / 操作日志（对齐运营后台原型） ---------- */
.ov-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ov-card {
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
}
.ov-card span { display: block; margin-bottom: 8px; font-size: 12px; color: var(--c-muted); }
.ov-card strong { display: block; font-size: 24px; line-height: 1.2; font-weight: 600; color: var(--c-text); }
.ov-section {
  padding: 18px 20px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.ov-section h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; color: var(--c-text); }
.todo-links { display: flex; flex-wrap: wrap; gap: 10px; }
.todo-links .btn { padding: 8px 14px; }
.log-detail {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-muted);
  font-size: 12px;
}
@media (max-width: 900px) {
  .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .ov-grid { grid-template-columns: 1fr; }
}
