/* 基差管理 · 点价配置 — 终态原型（区域×合约×提货月） */

:root {
  --color-primary: #fe6612;
  --color-primary-press: #e85a0e;
  --color-page: #fafafa;
  --color-white: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #999999;
  --color-text-hint: #adadad;
  --color-border: #eeeeee;
  --color-divider: #f0f0f0;
  --color-radio-off: #d0d0d0;
  --color-disabled: #c8c8c8;
  --color-disabled-check: #bdbdbd;
  --radius-btn: 4px;
  --app-max: 375px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  background: #e8e8e8;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---------- 页面壳 ---------- */
.page {
  width: 100%;
  max-width: var(--app-max);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--color-page);
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* ---------- 状态栏 ---------- */
.status-bar {
  height: 24px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-white);
  font-size: 12px;
  font-weight: 600;
  color: #000;
  flex-shrink: 0;
}

.status-bar__icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-bar__icons svg {
  display: block;
}

/* ---------- 导航栏 ---------- */
.nav-bar {
  height: 44px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-white);
  flex-shrink: 0;
}

.nav-bar__left,
.nav-bar__right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 72px;
}

.nav-bar__right {
  justify-content: flex-end;
}

.nav-bar__btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}

.nav-bar__title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: #000;
  letter-spacing: 0.5px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.tabs__item {
  flex: 1;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 15px;
  color: var(--color-text-secondary);
}

.tabs__item.is-active {
  color: var(--color-text);
  font-weight: 500;
}

.tabs__item.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 56px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 1.5px 1.5px 0 0;
}

/* ---------- 主内容 ---------- */
.main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.section {
  background: var(--color-white);
  margin-top: 10px;
  padding: 14px 16px 16px;
}

.section:first-child {
  margin-top: 0;
}

.section__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.section__bar {
  width: 3px;
  height: 14px;
  background: var(--color-primary);
  border-radius: 1px;
  flex-shrink: 0;
}

.section__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.section__desc {
  margin: 0 0 12px 9px;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.section__desc.use-guide {
  margin: 6px 0 12px 9px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.55;
  color: #666;
  background: #fff7f0;
  border-radius: 4px;
  border-left: 3px solid var(--color-primary);
}

/* ---------- 单选组（行内） ---------- */
.radio-row {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-left: 9px;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.radio input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.radio__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--color-radio-off);
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.radio__dot svg {
  width: 10px;
  height: 10px;
  opacity: 0;
  color: #fff;
}

.radio input:checked + .radio__dot {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.radio input:checked + .radio__dot svg {
  opacity: 1;
}

.radio__label {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.4;
}

/* 禁用态（买卖方式） */
.radio.is-disabled {
  cursor: default;
  pointer-events: none;
}

.radio.is-disabled .radio__dot {
  border-color: var(--color-disabled);
  background: #f5f5f5;
}

.radio.is-disabled input:checked + .radio__dot {
  border-color: var(--color-disabled-check);
  background: var(--color-disabled-check);
}

.radio.is-disabled .radio__label {
  color: var(--color-disabled);
}

/* ---------- 说明文案 ---------- */
.hint {
  margin: 12px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--color-text-hint);
  line-height: 1.7;
  word-break: break-all;
}

/* ---------- 区域芯片 ---------- */
.section--matrix {
  padding-bottom: 12px;
}

.region-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 10px;
  margin: 0 -4px;
  scrollbar-width: none;
}

.region-chips::-webkit-scrollbar {
  display: none;
}

.region-chip {
  flex-shrink: 0;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-white);
  font-size: 13px;
  color: var(--color-text);
}

.region-chip.is-active {
  border-color: var(--color-primary);
  background: #fff3eb;
  color: var(--color-primary);
  font-weight: 500;
}

/* ---------- 开平表 ---------- */
.matrix-scroll {
  margin: 0 -16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.oc-table {
  width: 100%;
  min-width: 300px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.oc-table th,
.oc-table td {
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
  padding: 10px 8px;
}

.oc-table thead th {
  position: sticky;
  top: 0;
  background: #fafafa;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.oc-table__contract {
  width: 72px;
  padding-left: 16px !important;
  font-weight: 500;
  color: var(--color-text);
}

.oc-table__close {
  padding-right: 16px !important;
}

.oc-table thead .oc-table__close {
  color: var(--color-primary);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 24px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid transparent;
}

.chip--readonly {
  background: #f5f5f5;
  color: #888;
  border-color: #ebebeb;
}

.chip--close {
  background: #fff3eb;
  color: var(--color-primary);
  border-color: #ffd4b8;
  cursor: pointer;
  max-width: 100%;
}

.chip--close:active {
  opacity: 0.85;
}

.chip--add {
  width: 24px;
  height: 24px;
  padding: 0;
  justify-content: center;
  border: 1px dashed #ffb380;
  color: var(--color-primary);
  background: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.chip-muted {
  font-size: 11px;
  color: var(--color-text-hint);
}

.list-empty {
  margin: 24px 0 8px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ---------- 底部弹层 ---------- */
.sheet[hidden] {
  display: none !important;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet__mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.sheet__panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max);
  padding: 16px 16px calc(16px + var(--safe-bottom));
  background: var(--color-white);
  border-radius: 12px 12px 0 0;
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sheet__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.sheet__close {
  width: 32px;
  height: 32px;
  font-size: 22px;
  line-height: 1;
  color: #999;
}

.sheet__desc {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.sheet__empty {
  margin: 8px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.month-pick-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.month-pick-toolbar__btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-white);
  font-size: 12px;
  color: var(--color-text);
}

.month-pick-toolbar__btn:active {
  background: var(--color-page);
}

.month-pick-toolbar__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.month-pick {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.month-pick__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 4px;
  text-align: left;
  font-size: 15px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  user-select: none;
}

.month-pick__item.is-checked {
  color: var(--color-primary);
}

.month-pick__item.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--color-text-secondary);
}

.month-pick__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.month-pick__note {
  font-size: 11px;
  color: var(--color-text-hint);
}

.month-pick__check {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1.5px solid var(--color-radio-off);
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.month-pick__item.is-checked .month-pick__check {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.month-pick__check svg {
  width: 10px;
  height: 10px;
  opacity: 0;
}

.month-pick__item.is-checked .month-pick__check svg {
  opacity: 1;
}

.sheet__confirm {
  margin-top: 0;
}

.sheet__confirm:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* 弹层内确认按钮复用主色样式 */
.btn-save {
  display: block;
  width: 100%;
  height: 44px;
  background: var(--color-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-btn);
  letter-spacing: 2px;
}

.btn-save:active {
  background: var(--color-primary-press);
}

/* 隐藏面板（基差报价占位） */
.panel[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 6px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.is-show {
  opacity: 1;
}
