/* 运营后台：抽屉、弹窗、Toast、补充组件与响应式（基础布局见 styles.css） */

/* ---------- 抽屉 ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 15, 11, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: 470px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  transform: translateX(102%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 16px;
  background: rgba(255, 253, 249, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.4px;
}

.drawer-head .sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.drawer-body {
  padding: 18px 22px 40px;
}

.detail-section {
  margin-top: 20px;
}

.detail-section:first-child {
  margin-top: 0;
}

.detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.detail-item .span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.detail-item .b {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.detail-note {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
}

.timeline {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.tl-item {
  position: relative;
  padding: 0 0 14px 14px;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item::before {
  content: '';
  position: absolute;
  left: -4.5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line-2);
}

.tl-item.done::before {
  background: var(--jade);
  border-color: var(--jade);
}

.tl-item.active::before {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.tl-item b {
  display: block;
  font-size: 12.5px;
}

.tl-item span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 服务节点进度 ---------- */

.svc-phases {
  display: flex;
  gap: 12px;
  padding: 4px 0;
}

.svc-phase {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
}

.svc-phase.done {
  background: var(--jade-soft);
  border-color: var(--jade);
}

.svc-phase.active {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.svc-phase-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.svc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
}

.svc-phase.done .svc-dot {
  background: var(--jade);
}

.svc-phase.active .svc-dot {
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.svc-phase-head b {
  font-weight: 600;
  color: var(--ink);
}

.svc-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.svc-item {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}

.svc-item.done {
  background: var(--jade);
  border-color: var(--jade);
  color: #fff;
}

.svc-item.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ---------- 批量操作 ---------- */

.batch-col {
  width: 40px;
  text-align: center;
}

.batch-check,
.batch-check-all {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

.batch-table tr:hover {
  background: var(--surface-sunk);
}

.batch-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-2);
}

.batch-count {
  font-size: 13px;
  font-weight: 600;
}

.batch-count b {
  color: var(--brand);
}

.batch-actions {
  display: flex;
  gap: 8px;
}

.batch-actions .btn-sm {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.batch-actions .btn-sm:hover {
  background: rgba(255, 255, 255, 0.15);
}

.batch-actions .danger-soft {
  background: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.3);
  color: #ff6b6b;
}

.batch-actions .danger-soft:hover {
  background: rgba(220, 53, 69, 0.3);
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.drawer-actions .btn {
  flex: 1;
  min-width: 100px;
}

/* ---------- 弹窗 ---------- */

.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 15, 11, 0.4);
}

.modal-wrap.open {
  display: flex;
}

.modal {
  width: 460px;
  max-width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.modal h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.4px;
}

.modal .modal-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.modal .fields {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 18px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
  font-size: 13px;
}

.field textarea {
  height: 76px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(252, 104, 0, 0.11);
}

.modal-actions {
  display: flex;
  gap: 9px;
  margin-top: 20px;
}

.modal-actions .btn {
  flex: 1;
}

.call-record {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
}

.call-record .btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.call-record .dim {
  font-size: 12px;
  color: var(--muted);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  cursor: pointer;
}

.checkbox input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 120;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 10px;
  background: #1d1712;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-2);
}

.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 其他 ---------- */

.split-line {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.summary-strip {
  display: flex;
  gap: 28px;
  padding: 13px 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.summary-strip .item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.summary-strip .item b {
  display: block;
  margin-top: 3px;
  font-size: 19px;
  letter-spacing: -0.5px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-bar {
  width: 88px;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.mini-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--jade);
}

.mini-bar i.warn {
  background: var(--gold);
}

.mini-bar i.danger {
  background: var(--danger);
}

.mono-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dim {
  color: var(--muted);
}

/* ---------- 补充：筛选、目标与对比 ---------- */

.strip-unit {
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.seg-count {
  margin-left: 3px;
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 500;
}

.seg button.on .seg-count {
  color: var(--brand-deep);
}

.chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.section-gap {
  margin-top: 16px;
}

.todo[data-action] {
  cursor: pointer;
  transition: background 0.12s;
}

.todo[data-action]:hover {
  background: #fbf6ef;
}

.risk-note {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}

.danger-text {
  color: var(--danger) !important;
}

.bar-text {
  margin-left: 7px;
  font-size: 12px;
  color: var(--muted);
}

.target-foot {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}

.target-form {
  display: flex;
  flex-direction: column;
}

.target-edit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.target-edit:first-child {
  padding-top: 2px;
}

.target-edit:last-child {
  padding-bottom: 2px;
  border-bottom: none;
}

.target-edit b {
  display: block;
  font-size: 13.5px;
}

.target-edit span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.target-input {
  display: flex;
  align-items: center;
  flex: none;
  gap: 6px;
}

.target-input input {
  width: 78px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  outline: none;
  font-size: 17px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.target-input input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(252, 104, 0, 0.11);
}

.target-input em {
  width: 16px;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.rule-list {
  display: flex;
  flex-direction: column;
}

.rule {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.rule:last-child {
  border-bottom: none;
}

.rule b {
  display: block;
  font-size: 13px;
}

.rule p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}

.duty-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.duty {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.duty:nth-child(2n) {
  border-right: none;
}

.duty:nth-last-child(-n + 2) {
  border-bottom: none;
}

.duty b {
  display: block;
  font-size: 12.5px;
}

.duty p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.small-grid {
  grid-template-columns: 1fr;
}

.small-grid .duty {
  border-right: none;
}

.small-grid .duty:nth-last-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

.small-grid .duty:last-child {
  border-bottom: none;
}

.callout {
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
}

.callout.danger {
  padding: 12px 14px;
  border-color: rgba(184, 69, 44, 0.2);
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.callout b {
  display: block;
  font-size: 12px;
}

.callout p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
}

.callout.danger p {
  color: #7d3323;
}

.detail-item.wide {
  grid-column: 1 / -1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.compare-item {
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.compare-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.compare-item b {
  display: block;
  margin-top: 5px;
  font-size: 19px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.compare-item em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 12px;
  color: var(--muted-2);
}

.compare-item.danger {
  border-color: rgba(184, 69, 44, 0.22);
  background: var(--danger-soft);
}

.compare-item.danger b {
  color: var(--danger);
}

.drawer .table {
  font-size: 12px;
}

.drawer .table th {
  background: var(--surface-2);
}

.drawer .table td {
  padding: 9px 10px;
}

.drawer .table th {
  padding: 8px 10px;
}

.drawer .empty {
  padding: 26px 12px;
}

/* ---------- 宽度自适应 ---------- */

/* 宽屏：内容随视口放大，上限 1800 并居中，左右留白对称 */
@media (min-width: 1600px) {
  :root {
    --page-pad: 40px;
    --grid-gap: 20px;
  }

  .view {
    padding-top: 30px;
    padding-bottom: 78px;
  }

  .page-head h1 {
    font-size: 28px;
  }

  .kpi {
    padding: 18px 20px 19px;
  }

  .kpi-num {
    font-size: 28px;
  }

  .panel-head {
    padding: 16px 22px;
  }

  .panel-body {
    padding: 16px 22px;
  }

  .panel > .target-list,
  .panel > .district-cards {
    padding: 18px 22px 20px;
  }

  .alert-banner {
    padding: 16px 20px;
  }

  .table th {
    padding: 11px 16px;
  }

  .table td {
    padding: 13px 16px;
  }

  .todo {
    padding: 14px 22px;
  }

  .alert-item {
    padding: 14px 22px;
  }

  .target-edit {
    padding: 16px 0;
  }
}

/* 超宽屏：运营总览 6 个指标改为单行，避免三列卡片过宽 */
@media (min-width: 1700px) {
  .metric-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .metric {
    padding: 17px 18px;
  }

  .metric-foot {
    margin-top: 10px;
  }
}

/* 双栏均为数据表时提前改单栏，避免窄屏表格逐字换行 */
@media (max-width: 1440px) {
  .grid-2.dense-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) {
  :root {
    --page-pad: 22px;
    --grid-gap: 16px;
  }

  .view {
    padding: 20px var(--page-pad) 54px;
  }

  .topbar-inner {
    padding: 0 var(--page-pad);
  }

  .snapshot {
    display: none;
  }

  .drawer {
    width: 430px;
  }
}

/* 笔记本：双栏视图改为单栏，商圈与指标卡片降为两列 */
@media (max-width: 1180px) {
  .rail {
    width: 216px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .main {
    margin-left: 216px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .district-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-user em {
    display: none;
  }
}

@media (max-width: 980px) {
  .rail {
    width: 196px;
  }

  .main {
    margin-left: 196px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .page-actions {
    flex-wrap: wrap;
  }

  .summary-strip {
    flex-wrap: wrap;
    gap: 14px 22px;
  }

  .top-user > div {
    display: none;
  }

  .drawer {
    width: 100%;
    max-width: 430px;
  }
}

/* ---------- 记录类视图：标签页、席位、服务节点与筛选下拉 ---------- */

.case-toolbar {
  align-items: center;
  flex-wrap: wrap;
}

.case-tabs {
  flex-wrap: wrap;
}

.case-comment {
  max-width: 360px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
}

.filter-select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
}

.seat-list {
  display: flex;
  flex-direction: column;
}

.seat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.seat-row:last-child {
  border-bottom: none;
}

.seat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.seat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.seat-main b {
  display: block;
  font-size: 13px;
}

.seat-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.node-list {
  display: flex;
  flex-direction: column;
}

.node-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.node-row:last-child {
  border-bottom: none;
}

.node-index {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-sunk);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.node-row.done .node-index {
  background: var(--jade-soft);
  color: var(--jade);
}

.node-row.active .node-index {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.node-row.skipped .node-index {
  background: var(--gold-soft);
  color: var(--gold);
}

.node-body {
  flex: 1;
  min-width: 0;
}

.node-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.node-line b {
  font-size: 13px;
}

.node-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.node-note {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
}

/* 详情网格兼容新视图：无 .span/.b 类名时也保持标签与值分行 */
.detail-item > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-item > b {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

/* 指派餐厅：候选门店单选卡 */
.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.candidate:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.candidate:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.candidate input {
  accent-color: var(--brand);
}

.candidate-main {
  flex: 1;
  min-width: 0;
}

.candidate-main b {
  display: block;
  font-size: 13px;
}

.candidate-main span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.candidate em {
  font-style: normal;
  font-weight: 600;
  font-size: 13px;
}
