/* 店长工作台 — 布局与组件 */
.workspace {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--dq-background);
}

/* ============ 左侧图标栏 ============ */
.rail {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-direction: column; height: 100vh;
  border-right: 1px solid var(--dq-line);
  background: #fff;
  padding: .75rem .5rem;
}
.rail-logo { display: grid; place-items: center; padding: .25rem .25rem 1rem; }
.rail-logo img { width: 40px; height: 40px; border-radius: 12px; display: block; }

.rail-nav { display: grid; gap: 2px; min-height: 0; overflow-y: auto; padding: .25rem; scrollbar-width: thin; }
.rail-item {
  display: grid; place-items: center; gap: .25rem;
  border: 0; background: transparent; border-radius: 10px;
  padding: .5rem .1rem; cursor: pointer; color: var(--dq-text);
  transition: background-color .15s ease, color .15s ease;
}
.rail-item svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail-item .label { display: none; font-size: 10px; line-height: 1.2; font-weight: 600; text-align: center; }
.rail-item:hover { background: var(--dq-metric); }
.rail-item.active { background: var(--dq-tint); color: var(--dq-brand); }
.rail-item.active .label { display: block; }

.rail-license { margin-top: .5rem; padding: .4rem .1rem; text-align: center; font-size: 11px; line-height: 1.5; color: var(--dq-muted); }
.rail-actions { margin-top: auto; display: grid; justify-items: center; gap: .25rem; border-top: 1px solid var(--dq-line); padding-top: .5rem; }
.rail-button {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem;
  border: 0; border-radius: .5rem; background: transparent; color: var(--dq-brand); cursor: pointer;
}
.rail-button:hover { background: var(--dq-tint); }
.rail-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ============ 右侧主区 ============ */
.console { display: flex; flex-direction: column; min-width: 0; }

.bugline { padding: 6px 22px 0; text-align: right; font-size: 11.5px; color: var(--dq-muted); }
.bugline b { font-weight: 600; color: #5a6b55; }

.topbar { display: flex; align-items: center; gap: 1rem; padding: 10px 22px 4px; }
.global-search {
  display: flex; align-items: center; gap: .5rem;
  background: #fff; border: 1px solid var(--dq-line); border-radius: 12px;
  padding: .3rem .3rem .3rem .85rem; width: min(560px, 48vw);
}
.global-search svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--dq-muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.global-search input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; padding: .35rem 0; font-size: 13.5px; }
.global-search input:focus { outline: none; box-shadow: none; }
.global-search button { border: 0; border-radius: 8px; background: var(--dq-brand); color: #fff; font-size: 13px; font-weight: 600; padding: .4rem 1rem; cursor: pointer; white-space: nowrap; flex: none; }
.global-search button:hover { background: var(--dq-hover); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; font-size: 13.5px; color: var(--dq-text); }
.topbar-action { display: inline-flex; align-items: center; gap: .4rem; background: transparent; border: 0; cursor: pointer; padding: 0; color: inherit; }
.topbar-action svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.topbar-action:hover { color: var(--dq-brand); }

.content { padding: 1.1rem 22px 3rem; }
.content-inner { max-width: 1560px; margin: 0 auto; display: grid; gap: 1.4rem; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.page-head h1 { font-size: clamp(25px, 3vw, 36px); font-weight: 700; line-height: 1.25; letter-spacing: -.025em; }
.page-head p { margin-top: .35rem; font-size: 13.5px; color: var(--dq-muted); }
.page-head-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }

/* ============ 概览 ============ */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, .95fr) minmax(0, .82fr); gap: 1.2rem; align-items: start; }
.overview-col { display: grid; gap: 1.2rem; }

.range-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.range-tabs button {
  border: 1px solid var(--dq-line); background: #fff; border-radius: 8px;
  padding: .35rem .8rem; font-size: 12.5px; cursor: pointer; color: var(--dq-muted);
}
.range-tabs button.active { background: var(--dq-tint); border-color: #bcd3ab; color: var(--dq-brand); font-weight: 600; }

.date-range { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: .6rem; align-items: end; }
.date-range .field > label { font-size: 12.5px; }
.date-range .field input { padding: .5rem .6rem; font-size: 13px; }
.date-range .to { padding-bottom: .7rem; color: var(--dq-muted); font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.metric {
  background: var(--dq-metric); border-radius: 12px; padding: .7rem .85rem;
}
.metric label { display: block; font-size: 12.5px; color: var(--dq-muted); }
.metric strong { display: block; margin-top: .25rem; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.metric small { display: block; margin-top: .2rem; font-size: 11.5px; color: var(--dq-muted); }
.metric.brand strong { color: var(--dq-brand); }

.ring-row { display: flex; justify-content: center; gap: 1.4rem; padding: .8rem 0 1.2rem; }
.ring-wrap { display: grid; justify-items: center; gap: .5rem; }
.ring { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; }
.ring > div {
  width: 74px; height: 74px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: 13.5px; font-weight: 700;
}
.ring-wrap span { font-size: 12px; color: var(--dq-muted); }

.subsection { border-top: 1px solid var(--dq-line); padding-top: 1rem; margin-top: 1rem; }
.subsection-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.subsection-head h2 { font-size: 15px; font-weight: 700; }
.subsection-head span { font-size: 12px; color: var(--dq-muted); }
.summary-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--dq-metric); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .45rem;
}
.summary-row span { font-size: 12.5px; color: var(--dq-muted); }
.summary-row b { font-size: 14px; font-weight: 700; }

.kv { display: grid; gap: .2rem; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--dq-line); }
.kv-row:last-child { border-bottom: 0; }
.kv-row span { font-size: 12.5px; color: var(--dq-muted); }
.kv-row b { font-size: 13px; font-weight: 600; text-align: right; max-width: 66%; line-height: 1.55; }

.amount-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--dq-tint); border-radius: 10px; padding: .75rem 1rem; margin: .5rem 0 .7rem;
}
.amount-strip span { font-size: 13px; color: #3d5238; }
.amount-strip b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }

.staff-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--dq-metric); border-radius: 12px; padding: .75rem .9rem; }
.staff-card b { font-size: 13.5px; }
.staff-card .meta { display: flex; gap: 1.2rem; font-size: 12px; color: var(--dq-muted); }

/* ============ 订单管理 ============ */
.filter-panel { display: grid; gap: 1rem; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr 1.4fr 1fr 1fr; gap: .8rem; }
.filter-actions { display: flex; gap: .6rem; }

.stat-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .55rem; }
.stat-tile { background: #fff; border: 1px solid var(--dq-line); border-radius: 12px; padding: .6rem .8rem; }
.stat-tile.lead { background: var(--dq-tint); border-color: #cfe2c0; }
.stat-tile label { display: block; font-size: 12px; color: var(--dq-muted); }
.stat-tile strong { display: block; margin-top: .2rem; font-size: 20px; font-weight: 700; }
.stat-tile small { display: block; margin-top: .1rem; font-size: 11.5px; color: var(--dq-muted); }

.table-card { padding: 1.1rem 1.35rem 1.4rem; }
.table-card-head { display: flex; align-items: center; gap: .8rem; padding-bottom: .8rem; flex-wrap: wrap; }
.table-card-head h2 { font-size: 15px; font-weight: 700; }
.table-card-head .meta { font-size: 12px; color: var(--dq-muted); }
.table-card-head .actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: 12px; color: var(--dq-muted); }
.table-scroll { overflow-x: auto; }
.order-no { display: grid; gap: 2px; }
.order-no b { font-size: 13px; font-weight: 600; }
.order-no small { font-size: 11.5px; color: var(--dq-muted); }

/* ============ 自主录单 ============ */
.qr-panel { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.4rem; flex-wrap: wrap; }
.qr-frame {
  width: 132px; height: 132px; border: 1px dashed #cfd9cb; border-radius: 12px;
  display: grid; place-items: center; gap: .35rem; color: var(--dq-muted); font-size: 11.5px; text-align: center;
  background: #fbfcf9;
}
.qr-panel .right { display: grid; justify-items: end; gap: .6rem; }
.qr-panel .actions { display: flex; gap: .5rem; }

.manual-panel { max-width: 1010px; display: grid; gap: 1.1rem; }
.manual-section { display: grid; gap: .7rem; }
.manual-block { border: 1px solid #efe4cf; background: var(--dq-cream); border-radius: 12px; padding: .9rem 1rem; display: grid; gap: .6rem; }
.quick-amounts { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.quick-amounts span { font-size: 12.5px; color: var(--dq-muted); }
.phrase-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.assign-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.assign-option { text-align: left; border: 1px solid var(--dq-line); background: #fff; border-radius: 10px; padding: .65rem .8rem; cursor: pointer; }
.assign-option b { display: block; font-size: 13px; font-weight: 600; }
.assign-option small { display: block; margin-top: .15rem; font-size: 11.5px; color: var(--dq-muted); }
.assign-option.selected { border-color: #c8a06a; background: #fdf6e7; }
.assign-option.selected b { color: #8a6126; }

.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 12px; color: var(--dq-muted); border-top: 1px solid var(--dq-line); padding-top: .9rem; }

/* ============ 独立财务 ============ */
.finance-split { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.finance-block { border-radius: 14px; padding: 1rem 1.1rem; border: 1px solid #eadfc6; background: var(--dq-cream); }
.finance-block.transferred { border-color: #dbe5f3; background: var(--dq-blue-tint); }
.finance-block header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.finance-block header small { font-size: 11px; letter-spacing: .14em; font-weight: 700; color: var(--dq-muted); }
.finance-block header h3 { font-size: 15px; font-weight: 700; margin-top: .15rem; }
.finance-block header .total { font-size: 21px; font-weight: 700; color: #9a6b21; }
.finance-block.transferred header .total { color: var(--dq-blue); }
.finance-meta { margin-top: .45rem; font-size: 12px; color: var(--dq-muted); }
.finance-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: .8rem; }
.finance-cols > div label { display: block; font-size: 12px; color: var(--dq-muted); }
.finance-cols > div b { display: block; margin-top: .2rem; font-size: 16px; font-weight: 700; }
.finance-total-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--dq-cream); border: 1px solid #eadfc6; border-radius: 10px; padding: .65rem 1rem; margin-top: .9rem;
}
.finance-total-bar b { font-size: 17px; font-weight: 700; color: #8a6126; }
.finance-total-bar small { font-size: 12px; color: var(--dq-muted); }

.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-top: .4rem; flex-wrap: wrap; }
.section-head > div { display: grid; gap: .15rem; }
.section-head small { font-size: 11px; letter-spacing: .14em; font-weight: 700; color: var(--dq-muted); }
.section-head h2 { font-size: 15px; font-weight: 700; }
.section-head .controls { display: flex; gap: .5rem; align-items: center; }

/* ============ 客服管理 ============ */
.two-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 1.1rem; align-items: start; }
.staff-row { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--dq-line); border-radius: 12px; padding: .7rem .9rem; margin-top: .6rem; }
.avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--dq-amber-tint); color: var(--dq-amber-text); display: grid; place-items: center; font-size: 14px; font-weight: 700; flex: none; }
.staff-row .grow b { font-size: 13.5px; }
.staff-row .grow small { display: block; font-size: 12px; color: var(--dq-muted); }
.info-box { background: #f6f8f4; border-radius: 10px; padding: .75rem .9rem; font-size: 12.5px; color: var(--dq-muted); display: grid; gap: .35rem; }
.info-box ul { margin: 0; padding-left: 1.1rem; }

/* ============ 币损计算 ============ */
.summary-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.summary-tile { background: #fff; border: 1px solid var(--dq-line); border-radius: 12px; padding: .75rem .9rem; }
.summary-tile label { font-size: 12.5px; color: var(--dq-muted); }
.summary-tile strong { display: block; margin-top: .2rem; font-size: 20px; font-weight: 700; }
.summary-tile small { display: block; margin-top: .15rem; font-size: 11.5px; color: var(--dq-muted); }

/* ============ 外包代练员 ============ */
.pager { display: flex; align-items: center; justify-content: center; gap: .7rem; padding-top: .9rem; font-size: 12.5px; color: var(--dq-muted); }
.pager button { border: 1px solid var(--dq-line); background: #fff; border-radius: 8px; padding: .35rem .8rem; font-size: 12.5px; cursor: pointer; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager .page-info { font-weight: 600; color: var(--dq-text); }
.coach-item { display: grid; grid-template-columns: 40px 1fr 1fr auto; align-items: center; gap: .8rem; }

.worker-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .8rem; align-items: end; }

/* ============ 外部渠道 ============ */
.channel-note { background: var(--dq-amber-tint); border: 1px solid #ecd9b5; border-radius: 10px; padding: .7rem .85rem; font-size: 12.5px; color: var(--dq-amber-text); line-height: 1.6; }
.steps { display: grid; gap: .5rem; font-size: 13px; color: var(--dq-muted); }
.steps li { list-style: none; }

/* ============ 订单池子 ============ */
.pool-grid { display: grid; gap: .9rem; max-width: 940px; }
.pool-card { background: #fff; border: 1px solid var(--dq-line); border-radius: 16px; padding: 1.2rem 1.4rem; }
.pool-card h2 { font-size: 17px; font-weight: 700; }
.pool-card p { margin-top: .6rem; font-size: 13px; color: var(--dq-muted); }

/* ============ 通用提示 ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: #22281f; color: #fff; border-radius: 10px; padding: .6rem 1.1rem; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-mask { position: fixed; inset: 0; background: rgba(24, 32, 24, .42); z-index: 50; display: grid; place-items: center; padding: 1.5rem; }
.modal { background: #fff; border-radius: 18px; width: min(620px, 100%); max-height: 86vh; overflow: auto; padding: 1.4rem 1.5rem; box-shadow: 0 30px 60px -30px rgba(20, 30, 20, .5); }
.modal header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.modal header h3 { font-size: 17px; font-weight: 700; }
.modal .close { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--dq-muted); }

@media (max-width: 1200px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .overview-grid > .overview-col:last-child { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-panel, .finance-split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: sticky; top: 0; height: auto; flex-direction: row; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--dq-line); padding: .5rem .75rem; overflow-x: auto;
  }
  .rail-logo { padding: 0 .6rem 0 0; }
  .rail-logo img { width: 32px; height: 32px; }
  .rail-nav { display: flex; gap: 2px; overflow-x: auto; padding: 0; }
  .rail-item { padding: .4rem .5rem; }
  .rail-item .label { display: none !important; }
  .rail-license, .rail-actions { display: none; }
  .overview-grid, .overview-grid > .overview-col:last-child { grid-template-columns: 1fr; }
  .filter-grid, .stat-strip, .assign-grid, .two-col, .phrase-row, .finance-cols, .summary-tiles { grid-template-columns: 1fr 1fr; }
  .global-search { width: 100%; }
  .topbar { flex-wrap: wrap; }
  .rail { min-width: 0; }
  .content-inner > * { min-width: 0; }
}

@media (max-width: 640px) {
  .content { padding: .8rem 12px 2.2rem; }
  .topbar { padding: 8px 12px 0; }
  .bugline { padding: 6px 12px 0; }
  .panel { padding: 1.1rem 1rem; }
  .date-range { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
  .date-range .to { display: none; }
  .date-range > button { grid-column: 1 / -1; }
  .page-head { flex-wrap: wrap; }
  .page-head-actions { justify-content: flex-start; }
  .metric-grid, .stat-strip, .summary-tiles, .finance-cols { grid-template-columns: 1fr 1fr; }
  .filter-grid, .assign-grid, .two-col, .phrase-row, .worker-form { grid-template-columns: 1fr; }
  .ring-row { gap: .8rem; }
  .ring { width: 78px; height: 78px; }
  .ring > div { width: 62px; height: 62px; font-size: 12px; }
  .table-card { padding: .9rem .8rem 1rem; }
  .hide-sm { display: none !important; }
  .table tbody td, .table thead th { padding: .6rem .5rem; }
  .table tbody td { font-size: 12.5px; }
  .table-card-head .actions { margin-left: 0; }
}

/* ============ 平台后台（卡密 / 工作室） ============ */
.admin-topbar {
  display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap;
  padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--dq-line);
  position: sticky; top: 0; z-index: 30;
}
.admin-brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 16px; font-weight: 700; }
.admin-brand img { border-radius: 8px; display: block; }
.admin-brand b { font-weight: 600; color: var(--dq-muted); font-size: 12px; letter-spacing: .05em;
  background: var(--dq-tint); color: var(--dq-brand); padding: 2px 8px; border-radius: 999px; }
.admin-nav { display: flex; gap: .4rem; }
.admin-nav a {
  padding: .4rem .9rem; border-radius: 9px; font-size: 13.5px; color: var(--dq-muted);
}
.admin-nav a:hover { background: var(--dq-metric); }
.admin-nav a.active { background: var(--dq-tint); color: var(--dq-brand); font-weight: 600; }
.admin-top-actions { margin-left: auto; display: flex; align-items: center; gap: 1rem; }

@media (max-width: 640px) {
  .admin-topbar { padding: 10px 12px; gap: .8rem; }
  .admin-nav a { padding: .35rem .6rem; font-size: 12.5px; }
  .admin-top-actions .tiny { display: none; }
}