/* 运营后台：确认层、就地校验、Toast、红灯清单、目标进度、记录类组件与焦点样式 */

/* ---------- 焦点与数字 ---------- */

:focus-visible {
  outline: 2px solid rgba(252, 104, 0, 0.7);
  outline-offset: 2px;
}

.search:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
}

.num {
  font-variant-numeric: tabular-nums;
}

.table td.num,
.table th.num {
  white-space: nowrap;
}

.warn-text {
  color: var(--gold);
}

.danger-text {
  color: var(--danger);
}

.toolbar-spacer {
  flex: 1;
}

/* ---------- 页头与面板 ---------- */

.page-head {
  align-items: center;
}

.page-head h1 .page-date {
  margin-left: 14px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.panel-head h3 .panel-count {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.panel-head .link,
.link {
  font-size: 13px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 44px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

.empty p {
  margin: 0;
}

.empty .btn {
  height: 32px;
}

.select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}

.select-wrap .filter-select {
  height: 30px;
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--ink);
}

.select-wrap .filter-select:focus-visible {
  outline: 2px solid rgba(252, 104, 0, 0.5);
}

.summary-strip .link-item {
  text-align: left;
  cursor: pointer;
}

.summary-strip .link-item:hover b {
  color: var(--brand-deep);
}

.link-cell {
  text-align: left;
  cursor: pointer;
}

.link-cell:hover .strong {
  color: var(--brand-deep);
}

/* ---------- 顶栏 ---------- */

.crumbs .crumb {
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.crumbs .crumb:hover {
  color: var(--ink);
}

.crumbs .crumb-text {
  font-size: 13px;
  color: var(--ink-2);
}

.crumbs b {
  font-size: 13px;
}

.top-scope {
  display: flex;
  align-items: center;
}

.scope-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}

.scope-pick select {
  height: 30px;
  border: none;
  background: transparent;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.scope-fixed {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- 工作台 ---------- */

.red-list {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--grid-gap);
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid rgba(184, 69, 44, 0.18);
  border-left: 3px solid var(--danger);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.red-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.red-row:last-child {
  border-bottom: none;
}

.red-row .sev {
  flex: none;
  width: 56px;
  color: var(--danger);
}

.red-main {
  flex: 1;
  min-width: 0;
}

.red-main b {
  display: block;
  font-size: 14px;
}

.red-main span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.calm-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--grid-gap);
  padding: 13px 18px;
  border-radius: 16px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 14px;
  font-weight: 600;
}

.sev.jade .dot {
  background: var(--jade);
}

.kpi-item {
  display: block;
  width: 100%;
  padding: 6px 4px;
  margin: -6px -4px;
  border-radius: 10px;
  text-align: left;
}

.kpi-item:hover {
  background: var(--surface-2);
}

.kpi-num.warn-text {
  color: var(--gold);
}

.kpi-num.danger-text {
  color: var(--danger);
}

.kpi-label {
  font-size: 12.5px;
}

.kpi-head b {
  font-size: 14px;
}

.target-row {
  padding: 0;
}

.target-row .line {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
}

.target-row .line span {
  font-size: 13px;
  color: var(--ink-2);
}

.target-row .line b {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.target-row .line b em {
  font-style: normal;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.target-row .line:hover span {
  color: var(--brand-deep);
}

.progress {
  position: relative;
  overflow: visible;
}

.progress .bar {
  position: relative;
}

.progress .bar.gold {
  background: var(--gold);
}

.progress .bar.mute {
  background: #a89c8c;
}

.progress .pace {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--ink);
  opacity: 0.55;
}

.target-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.target-foot .link {
  font-size: 12.5px;
}

.metric {
  display: block;
  width: 100%;
  text-align: left;
}

.metric-top span {
  font-size: 13px;
}

.metric-value.danger-text {
  color: var(--danger);
}

.metric-foot {
  min-height: 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.alert-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
  align-items: center;
}

.alert-item:hover {
  background: #fbf6ef;
}

.alert-item .body b {
  font-size: 13.5px;
}

.alert-item .body p {
  font-size: 12.5px;
}

.district-card {
  text-align: left;
}

.district-card .owner {
  font-size: 12.5px;
}

.district-card .nums span {
  font-size: 12px;
}

.guard-list {
  display: flex;
  flex-direction: column;
}

.guard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
  text-align: left;
}

.guard-item:last-child {
  border-bottom: none;
}

.guard-item:hover {
  background: #fbf6ef;
}

.guard-item b {
  font-size: 18px;
  color: var(--ink);
}

.guard-item b em {
  margin-left: 3px;
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.todo {
  width: 100%;
  text-align: left;
  align-items: center;
}

.todo .tag-pill {
  flex: none;
  min-width: 64px;
  padding: 2px 8px;
  border-radius: 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--muted);
}

.todo .tag-pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.todo .tag-pill.gold {
  background: var(--gold-soft);
  color: var(--gold);
}

.todo .tag-pill.brand {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.todo b {
  font-size: 13.5px;
  font-weight: 600;
}

.line-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 18px;
}

.line-grid div {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}

.line-grid span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
}

.line-grid b {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

/* ---------- 列表辅助 ---------- */

.risk-note.warn {
  color: var(--gold);
}

.linked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.linked-row + .linked-row {
  margin-top: 8px;
}

.handover-list {
  display: flex;
  flex-direction: column;
}

.handover-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.handover-item:last-child {
  border-bottom: none;
}

.handover-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.handover-head .dim {
  margin-left: auto;
  font-size: 12.5px;
}

.handover-item p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.section-gap-sm {
  margin-bottom: 14px;
}

/* ---------- 表单：必填与就地校验 ---------- */

.field label .req {
  margin-left: 3px;
  font-style: normal;
  color: var(--danger);
}

.field label {
  font-size: 12.5px;
}

.field-msg {
  min-height: 0;
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--danger);
}

.field-msg:empty {
  display: none;
}

.field.err input,
.field.err select,
.field.err textarea {
  border-color: var(--danger);
  background: #fffaf8;
  box-shadow: 0 0 0 3px rgba(184, 69, 44, 0.1);
}

.field-hint {
  margin-top: -4px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink-2);
}

.field input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

.field textarea.tall {
  height: 110px;
}

.field input,
.field select {
  font-size: 13.5px;
}

.field textarea {
  font-size: 13.5px;
}

.modal-effects {
  margin: 14px 0 0;
  padding: 12px 14px 12px 30px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 18px;
  font-size: 13.5px;
  cursor: pointer;
}

.radio input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.modal {
  width: 480px;
}

.modal .modal-inner.wide,
.modal:has(.wide) {
  width: 680px;
}

.modal h2 {
  font-size: 20px;
}

.modal .modal-sub {
  font-size: 13px;
  line-height: 1.5;
}

.modal-actions {
  justify-content: flex-end;
}

.modal-actions .btn {
  flex: none;
  min-width: 96px;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 20px -12px rgba(184, 69, 44, 0.8);
}

.btn.danger:hover {
  background: #a53b24;
}

.btn.sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn.danger-soft:hover {
  background: #f6dcd3;
}

/* ---------- 确认层 ---------- */

.confirm-wrap {
  z-index: 110;
  background: rgba(20, 15, 11, 0.5);
}

.confirm {
  width: 440px;
}

.confirm-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.confirm-head h2 {
  margin: 0;
  font-size: 19px;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 16px;
  font-weight: 800;
}

.confirm-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-target {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-all;
}

.confirm-effects {
  margin: 12px 0 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-2);
}

/* ---------- Toast ---------- */

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 48px));
  padding: 11px 16px;
  font-size: 13.5px;
  pointer-events: none;
  z-index: 130;
}

.toast.on {
  pointer-events: auto;
}

.toast-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4fc08d;
}

.toast.warn .toast-dot {
  background: #f1b24a;
}

.toast.err .toast-dot {
  background: #ee735a;
}

.toast-undo {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  color: #ffb27a;
  font-size: 13px;
  font-weight: 700;
}

.toast-undo:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------- 导入预检 ---------- */

.import-preview {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.import-sum {
  padding: 10px 14px;
  background: var(--surface-2);
  font-size: 13px;
}

.import-preview .table td,
.import-preview .table th {
  padding: 8px 12px;
}

.modal .candidate-main span {
  font-size: 12.5px;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 1366px) {
  .top-user em {
    display: none;
  }

  .search {
    width: 220px;
  }
}

@media (max-width: 1280px) {
  .scope-pick > span {
    display: none;
  }

  .red-row {
    flex-wrap: wrap;
  }
}

/* ---------- 补充 ---------- */

.target-row .line {
  padding: 0;
}

.district-cards + .kpi-grid,
.district-cards + .toolbar {
  margin-top: var(--grid-gap);
}

.page-head + .district-cards {
  margin-bottom: 0;
}

.grid-2.even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-top {
  margin-top: var(--grid-gap);
}

.grid-2 + .panel {
  margin-top: var(--grid-gap);
}

.panel + .panel,
.stack + .panel,
.grid-2 + .grid-2 {
  margin-top: var(--grid-gap);
}

.modal .fields > *,
.modal-inner {
  min-width: 0;
}

.import-preview .table-wrap {
  max-height: 260px;
  overflow: auto;
}

.import-preview .table td {
  white-space: normal;
}

.field label.radio {
  display: inline-flex;
  margin: 0 18px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

#chg-date,
#chg-people {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

#chg-date[hidden],
#chg-people[hidden],
#visit-next[hidden] {
  display: none;
}

.modal .fields {
  gap: 14px;
}
