/* 页面专属样式（03 §2.1）：客户与席位 .pg-subscriptions、席位详情 .pg-subscription、客户详情 .pg-customer，以及席位域弹窗内容 .dlg-sub
   （弹窗渲染在页面根元素之外，所以用弹窗内容自己的根类）。归属 WP-F5。只用令牌变量；不写颜色值；不写 prefers-color-scheme
   （主题只由令牌切换）。三个页面共用的表格单元格（SubTable / SubLedger）用 :is(...) 限定在本域页面根类下。 */

/* ================================================================ 共用：席位表格单元格 */
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .sd-cell { min-width: 0; line-height: 1.45; gap: 2px; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .sd-cell .ellipsis { display: block; max-width: 100%; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .sd-cell .pill { height: 20px; font-size: var(--fs-xs); }
.sd-email { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; max-width: 100%; }
.sd-email a { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .sd-actions { justify-content: flex-end; flex-wrap: wrap; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .sd-actions .el-button + .el-button { margin-left: 0; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .sd-intent { display: inline-flex; justify-content: center; width: 100%; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .card-row .sd-cell { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .card-row .cr-amount .sd-cell { flex-direction: column; align-items: flex-end; gap: 2px; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .card-row .cr-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
:is(.pg-subscriptions, .pg-subscription, .pg-customer) .card-row .cr-title a { overflow: hidden; text-overflow: ellipsis; }
.sx-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: var(--r-pill); background: var(--c-warn-soft); color: var(--c-warn-ink); font-size: var(--fs-xs); font-weight: 600;
}
.pg-customer .sx-count { background: var(--c-surface-3); color: var(--c-text-2); }

/* 流水合计（SubLedger 顶部） */
:is(.pg-subscription, .pg-customer) .sd-totals {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--c-border);
  border-radius: var(--r-md); overflow: hidden; background: var(--c-border);
}
:is(.pg-subscription, .pg-customer) .sd-total { background: var(--c-surface-2); padding: 10px 14px; min-width: 0; }

/* ================================================================ 客户与席位 */
.pg-subscriptions .sp-list { overflow: hidden; }
.pg-subscriptions .sp-list > .filter-chips { padding-top: 10px; border-bottom: 1px solid var(--c-border); }
.pg-subscriptions .sp-seats { padding: 4px 8px 12px 48px; }
.pg-subscriptions .sp-seats.compact { padding: 6px 0 0; border-top: 1px dashed var(--c-border); margin-top: 4px; }
.pg-subscriptions .sp-seats-empty { padding: 8px 0; }
.pg-subscriptions .sp-seat-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.pg-subscriptions .sp-seat-table th {
  text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--c-text-3); padding: 6px 8px; border-bottom: 1px solid var(--c-border);
}
.pg-subscriptions .sp-seat-table td { padding: 6px 8px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.pg-subscriptions .sp-seat-table tr:last-child td { border-bottom: 0; }
.pg-subscriptions .sp-seat-table tr.row-muted td { color: var(--c-text-3); }
.pg-subscriptions .sp-seat-line { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: 4px 0; font-size: var(--fs-sm); min-width: 0; }
.pg-subscriptions .sp-seat-line a { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pg-subscriptions .sp-toggle { align-self: flex-start; padding: 0; height: 22px; }

/* 日常操作：常用分类和始终可见的所选席位工具栏。 */
.sp-quick-views { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border); }
.sp-quick-view { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); background: var(--c-surface); color: var(--c-text-2); cursor: pointer; font: inherit; font-weight: 600; }
.sp-quick-view:hover, .sp-quick-view.on { border-color: var(--c-brand); color: var(--c-brand-ink); background: var(--c-brand-soft); }
.sp-quick-view.today, .sp-quick-view.overdue { color: var(--c-danger-ink); }
.sp-quick-view.tomorrow { color: var(--c-warn-ink); }
.sp-quick-view.today.on, .sp-quick-view.overdue.on { border-color: var(--c-danger); background: var(--c-danger-soft); }
.sp-quick-view.tomorrow.on { border-color: var(--c-warn); background: var(--c-warn-soft); }
.sd-bulk-hint { flex-basis: 100%; color: var(--c-text-3); font-size: var(--fs-xs); }
.sd-table.has-seat-selection { padding-bottom: 110px; }
.sd-table .bulk-bar { position: fixed; left: calc(var(--side-w) + var(--sp-4)); right: var(--sp-4); bottom: var(--sp-4); z-index: 20; border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); max-height: 35vh; overflow-y: auto; }
.sd-table .bulk-bar .el-button + .el-button { margin-left: 0; }
.dlg-correct-batch .dlg-correct-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.dlg-correct-batch .dlg-correct-table th, .dlg-correct-batch .dlg-correct-table td { text-align: left; padding: var(--sp-2); border-bottom: 1px solid var(--c-border); vertical-align: top; word-break: break-word; }
.dlg-correct-batch .dlg-correct-table th { color: var(--c-text-3); font-weight: 500; }
.dlg-correct-batch .dlg-correct-rows { max-height: 280px; overflow: auto; }
@media (max-width: 900px) {
  .pg-subscriptions .page-head > .grow { flex-basis: 100%; }
  .pg-subscriptions .page-head > .actions { margin-left: 0; }
  .sd-table .bulk-bar { left: 0; right: 0; bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom)); }
  :is(.pg-subscriptions, .pg-customer) .sd-actions { flex-wrap: wrap; }
}

/* 选择字段导出（el-dialog 渲染在页面根之外，用内容根类） */
.sp-export .sp-export-group { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 10px 12px; }
.sp-export .sp-export-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; margin-top: 6px; }
.sp-export .sp-export-items .el-checkbox { margin-right: 0; min-width: 0; }

/* ================================================================ 席位详情 */
.pg-subscription .sd-main > .card + .card, .pg-subscription .sd-side > .card + .card { margin-top: 0; }
:is(.pg-subscription, .pg-customer) .sd-alert .el-alert__content { flex: 1; min-width: 0; }
:is(.pg-subscription, .pg-customer) .sd-alert .el-alert__title { display: block; line-height: 1.6; }
:is(.pg-subscription, .pg-customer) .sd-alert-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.pg-subscription .detail-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.pg-subscription .detail-meta .el-switch { height: 20px; }
.pg-subscription .sd-tabs { overflow: hidden; }
.pg-subscription .sd-tabs > .el-tabs > .el-tabs__header { margin: 0; padding: 0 16px; }
.pg-subscription .sd-tabs .el-tabs__nav-wrap::after { height: 1px; background: var(--c-border); }
.pg-subscription .sd-pane { padding: 14px 16px 16px; }
.pg-subscription .sd-pane .c-data-table { border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden; }
.pg-subscription .sd-pane .c-data-table .toolbar { padding: 8px 12px; }
.pg-subscription .sd-paid { justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.pg-subscription .sd-focus { border-color: var(--c-brand); box-shadow: var(--focus-ring); }
.pg-subscription .sd-focus + .card, .pg-subscription .card + .sd-focus { margin-top: 0; }
.pg-subscription .sd-period-detail { padding: 4px 8px 8px; }
.pg-subscription .sd-focus .sd-period-detail { padding: 0; }
.pg-subscription .sd-mini-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.pg-subscription .sd-mini-table th {
  text-align: left; font-weight: 500; color: var(--c-text-3); padding: 4px 8px; border-bottom: 1px solid var(--c-border);
}
.pg-subscription .sd-mini-table td { padding: 4px 8px; border-bottom: 1px solid var(--c-border); }
.pg-subscription .sd-mini-table tr:last-child td { border-bottom: 0; }
.pg-subscription .sd-side .dl { grid-template-columns: 84px minmax(0, 1fr); margin: 0; }
:is(.pg-subscription, .pg-customer) .dl { margin: 0; }
.pg-subscription .sd-note { white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.pg-subscription .c-period-bar { height: 14px; }

/* ================================================================ 客户详情 */
.pg-customer .cd-tabs > .el-tabs__header { margin: 0; padding: 0 16px; }
.pg-customer .cd-tabs .el-tabs__nav-wrap::after { height: 1px; background: var(--c-border); }
.pg-customer .cd-pane { padding: 14px 16px 16px; }
.pg-customer .cd-seats > .c-filter-bar .filter-bar { border-bottom: 1px solid var(--c-border); }

/* ================================================================ 席位域弹窗（.dlg-sub） */
.dlg-sub .dlg-sub-head {
  padding: 10px 12px; border-radius: var(--r-md); background: var(--c-surface-2); border: 1px solid var(--c-border); min-width: 0;
}
.dlg-sub .dlg-sub-head .ellipsis { max-width: 220px; }
.dlg-sub .el-form-item { margin-bottom: 14px; }
.dlg-sub .el-form-item__content > .form-hint, .dlg-sub .el-form-item__content > .c-money-input + .form-hint { flex-basis: 100%; }
.dlg-sub .el-form-item__content > .c-money-input { width: 100%; max-width: 260px; }
.dlg-sub .form-grid .el-form-item__content > .c-money-input { max-width: none; }
.dlg-sub .el-date-editor.el-input, .dlg-sub .el-date-editor.el-input__wrapper { width: 100%; }
.dlg-sub .el-select { width: 100%; }
.dlg-sub .el-input-number { width: 160px; }
.dlg-sub .alt-card .strong { font-size: var(--fs-md); }
.dlg-sub .dlg-sub-list { padding: 4px 12px; max-height: 220px; overflow-y: auto; }
.dlg-sub .dlg-sub-line { padding: 6px 0; border-bottom: 1px solid var(--c-border); min-width: 0; }
.dlg-sub .dlg-sub-line:last-child { border-bottom: 0; }
.dlg-sub .dlg-renew-table .el-input-number { width: 100%; }
.dlg-sub .dlg-renew-total {
  padding: 8px 12px; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface-2);
}
.dlg-sub .card-list.card { overflow: hidden; }
.dlg-sub .dlg-renew-line { padding: 8px 12px; border-bottom: 1px solid var(--c-border); }
.dlg-sub .dlg-renew-line:last-child { border-bottom: 0; }
.dlg-sub .dlg-deliver .card-body { background: var(--c-surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.dlg-sell .form-section-title {
  margin: var(--sp-3) 0 var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--c-border); font-size: var(--fs-sm);
}
.dlg-sell .form-section-title:first-of-type { border-top: 0; padding-top: 0; }
.dlg-sell .c-workspace-picker { width: 100%; }

/* 中等宽度（侧栏展开时主区不足以并排放 340px 右栏与 10 列周期表）：右栏改为标签页上方的三列卡片 */
@media (min-width: 901px) and (max-width: 1499px) {
  .pg-subscription .sd-layout { grid-template-columns: minmax(0, 1fr); }
  .pg-subscription .sd-side { order: -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .pg-subscription .sd-side > .card:first-child { grid-row: span 2; }
}

@media (max-width: 900px) {
  /* 席位详情：右栏（概要 / 客户 / 备注）移到标签页上方 */
  .pg-subscription .sd-side { order: -1; }
  .pg-subscription .sd-side .card-body .dl { grid-template-columns: 84px minmax(0, 1fr); }
  .pg-subscription .sd-tabs > .el-tabs > .el-tabs__header,
  .pg-customer .cd-tabs > .el-tabs__header { padding: 0 8px; }
  .pg-subscription .sd-pane, .pg-customer .cd-pane { padding: 12px; }
  .pg-subscription .detail-actions .el-button, .pg-customer .detail-actions .el-button { margin-left: 0; }
  :is(.pg-subscription, .pg-customer) .sd-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-subscriptions .sp-seats { padding: 4px 0 8px; }
  .sp-export .sp-export-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dlg-sub .dlg-sub-head .ellipsis { max-width: 140px; }
}

/* 开号先选择主号，随后选择所属空间；其它空间选择器保留原布局。 */
.dlg-sell .wp-account-choice { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); width: 100%; }
.dlg-sell .wp-account-choice .el-select { width: 100%; }
.dlg-sell .wp-selection-summary { padding: var(--sp-3); border: 1px solid var(--c-brand); border-radius: var(--r-md); background: var(--c-brand-soft); font-size: var(--fs-sm); line-height: 1.7; overflow-wrap: anywhere; }
.dlg-sell .wp-selection-summary .form-hint { margin-top: var(--sp-1); }
.dlg-sell .wp-main-account-option { display: flex; flex-direction: column; gap: var(--sp-1); line-height: 1.4; min-width: 0; }
.dlg-sell.wp-account-popper .el-select-dropdown__item { height: auto; min-height: 52px; padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.dlg-sell .wp-pick-account { padding: var(--sp-4); border: 1px dashed var(--c-border-strong); border-radius: var(--r-md); background: var(--c-surface-2); }
