:root {
  --bg: #f7f4f2;
  --card: #ffffff;
  --line: #e8ddda;
  --text: #2f2a28;
  --muted: #7a6f6a;
  --primary: #d6132d;
  --primary-soft: #f8dfe3;
  --header: #da9694;
  --label: #f2f2f2;
  --shadow: 0 18px 60px rgba(120, 73, 64, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fcfaf9 0%, #f6f0ee 100%);
  color: var(--text);
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', Arial, sans-serif;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  font-family: inherit;
}

.page-shell {
  width: min(1500px, calc(100vw - 40px));
  margin: 28px auto 40px;
}

.hero-card,
.panel,
.tabs-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-card h1 {
  margin: 14px 0 10px;
  font-size: 34px;
}

.hero-card p {
  margin: 0;
  max-width: 820px;
  color: var(--muted);
  line-height: 1.7;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
}

.hero-copy {
  min-width: 0;
}

.hero-logo-wrap {
  flex: 0 0 auto;
  width:192px;
  height: 192px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(120, 73, 64, 0.08);
  overflow: hidden;
}

.hero-logo {
  display: block;
  max-width: 168px;
  max-height: 168px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.hero-meta {
  display: grid;
  gap: 12px;
  min-width: 220px;
}

.meta-pill {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.meta-pill.muted {
  background: #faf8f7;
}

.meta-label {
  color: var(--muted);
  font-size: 12px;
}

.control-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(380px, 1.1fr) minmax(300px, 0.9fr);
  gap: 22px;
}

.panel {
  padding: 22px 24px;
}

.panel-title-row,
.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.panel-title-row h2,
.table-toolbar h2 {
  margin: 0;
  font-size: 22px;
}

.panel-note,
.table-toolbar p,
.selected-plan-base,
.subtle-empty,
.placeholder-card p,
.proposal-export-card p,
.modal-note {
  color: var(--muted);
  line-height: 1.6;
}

.plan-library-row {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.mmb-insured-count-panel {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(300px, 380px) auto;
  gap: 14px;
  align-items: end;
  padding: 0;
  border: 0;
  background: transparent;
}

.mmb-input-card {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(20px, auto) 42px;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  align-content: end;
}

.field-label.mmb-input-card {
  gap: 8px;
}

.mmb-input-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  flex-wrap: wrap;
}

.transfer-adjustment-discount-field {
  min-width: 0;
}

.field-inline-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.percent-input-wrapper {
  position: relative;
  display: block;
}

.percent-input-wrapper .inline-input {
  padding-right: 42px;
}

.percent-input-suffix {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

.inline-input {
  min-height: 42px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d9ceca;
  border-radius: 12px;
  background: #fffdfa;
  color: var(--text);
}

.mmb-insured-count-status {
  grid-column: 1 / -1;
  align-self: start;
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  min-width: 0;
  width: 100%;
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: normal;
  overflow-wrap: break-word;
}

#estimated-insured-count-status.notice-success,
#estimated-insured-count-status.notice-info,
#estimated-insured-count-status.notice-error {
  border: 0;
  background: transparent;
  padding: 0;
}

#estimated-insured-count-status.notice-success {
  color: #25623a;
}

#estimated-insured-count-status.notice-info {
  color: #34496d;
}

#estimated-insured-count-status.notice-error {
  color: #b4233b;
}

.mmb-insured-count-panel > button {
  align-self: end;
  width: auto;
  min-width: 76px;
  min-height: 42px;
  border-radius: 8px;
}

.mmb-plan-selector {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.mmb-selector-empty {
  grid-column: 1 / -1;
  width: 100%;
}

.mmb-selector-lock-note {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid #f0c6ce;
  border-radius: 12px;
  background: #fff4f6;
  color: #9f1024;
  font-size: 13px;
  line-height: 1.5;
}

.mmb-selector-step {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e5d7d9;
  border-radius: 12px;
  background: #fffdfc;
}

.mmb-selector-step.is-current {
  border-color: rgba(214, 19, 45, 0.36);
  background: #fff8f9;
}

.mmb-selector-step.is-complete {
  border-color: rgba(28, 126, 84, 0.3);
  background: #f8fdfb;
}

.mmb-selector-step.is-pending {
  background: #fbfaf9;
}

.mmb-selector-step-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 10px;
}

.mmb-selector-step-index {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.mmb-selector-step-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.mmb-selector-step-status {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1ecea;
  color: #756963;
  font-size: 12px;
  white-space: nowrap;
}

.mmb-selector-step.is-current .mmb-selector-step-status {
  background: #ffe8ec;
  color: #b11126;
}

.mmb-selector-step.is-complete .mmb-selector-step-status {
  background: #e8f6ef;
  color: #176b48;
}

.mmb-selector-step .inline-select {
  width: 100%;
  min-width: 0;
}

.mmb-selector-value-preview {
  position: relative;
  margin-top: 8px;
  color: #5f5651;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.mmb-selector-value-preview-text {
  display: -webkit-box;
  max-height: 44px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mmb-selector-value-preview:hover::after,
.mmb-selector-value-preview:focus-visible::after {
  content: attr(data-full-value);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 45;
  width: min(440px, calc(100vw - 48px));
  max-height: 260px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid #d7cbc7;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 42px rgba(71, 53, 48, 0.18);
  white-space: pre-wrap;
  text-align: left;
}

.plan-library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.plan-library-preview-tip {
  margin-top: 12px;
  border: 1px solid #eee3e6;
  border-radius: 14px;
  background: #fffafa;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.tab-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  padding: 11px 18px;
  background: linear-gradient(135deg, #d6132d 0%, #f03f56 100%);
  color: #fff;
  box-shadow: 0 14px 30px rgba(214, 19, 45, 0.22);
}

.secondary-button {
  padding: 11px 18px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  border-color: #e7bcc3;
  color: #b4233b;
}

.danger-button:hover {
  background: #fff4f6;
}

.ghost-button {
  padding: 9px 14px;
  background: #f8f5f4;
  color: var(--text);
}

.icon-button {
  width: 38px;
  height: 38px;
  background: #f7f2f0;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.selected-plan-list {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.selected-plan-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.selected-plan-meta {
  display: grid;
  gap: 8px;
}

.selected-plan-name {
  font-weight: 700;
  line-height: 1.45;
}

.selected-plan-base-button {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  line-height: 1.6;
}

.selected-plan-base-button:hover,
.selected-plan-base-button:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.checkbox-grid {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.checkbox-card input {
  width: 18px;
  height: 18px;
}

.tabs-card {
  margin-top: 22px;
  padding: 14px;
}

.tab-bar {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: #f3ece9;
  border-radius: 18px;
}

.tab-button {
  border: 0;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab-button.is-active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 8px 18px rgba(122, 111, 106, 0.12);
}

.tab-panel {
  display: none;
  padding: 18px 10px 8px;
}

.tab-panel.is-active {
  display: block;
}

.table-frame {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
  background: #fff;
}

.benefit-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

.benefit-table th,
.benefit-table td {
  border: 1px solid #d7d0cd;
  padding: 10px 12px;
  vertical-align: middle;
  word-break: break-word;
}

.benefit-table .title-row th {
  background: #fff;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 14px 12px;
}

.benefit-table .plan-type-row th {
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.benefit-table .plan-type-row th:first-child,
.row-label,
.row-header-label {
  text-align: left;
}

.benefit-table .plan-type-row th:not(:first-child),
.row-value,
.row-header-value {
  text-align: center;
}

.row-header-label,
.row-header-value {
  background: var(--header);
  color: #fff;
  font-size: 10pt;
  font-weight: 600;
}

.row-label {
  background: var(--label);
  font-size: 10pt;
}

.row-value {
  background: #fff;
  font-size: 10pt;
}

.cell-multiline {
  white-space: normal;
  line-height: 1.45;
}

.cell-multiline.centered {
  text-align: center;
}

.editable-plan-name {
  cursor: pointer;
}

.editable-plan-name:hover {
  background: #bb0f27 !important;
}

.value-dropdown {
  position: relative;
}

.value-dropdown-toggle {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d9ceca;
  border-radius: 10px;
  background: #fffdfa;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
}

.value-dropdown-text {
  flex: 1;
  min-width: 0;
  white-space: normal;
  text-align: center;
  line-height: 1.45;
}

.value-dropdown-arrow {
  flex: 0 0 auto;
  color: #7c726d;
}

.value-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #ded3cf;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(71, 53, 48, 0.14);
}

.value-dropdown.is-open .value-dropdown-menu {
  display: grid;
  gap: 8px;
}

.value-option {
  width: 100%;
  border: 1px solid #eadfdb;
  border-radius: 12px;
  background: #fffdfa;
  padding: 10px 12px;
  text-align: center;
  color: var(--text);
}

.value-option:hover {
  border-color: #d8a1aa;
  background: #fff5f6;
}

.value-option.is-selected {
  border-color: #d6132d;
  background: #fff1f3;
}

.value-option-text {
  display: block;
  white-space: normal;
  line-height: 1.45;
}

.empty-state,
.placeholder-card,
.fatal-error {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.placeholder-card {
  border: 1px dashed #d8c9c4;
  border-radius: 18px;
  background: #fcfbfb;
}

.placeholder-card h3 {
  margin-top: 0;
  color: var(--text);
}

.proposal-export-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fcfbfb;
}

.proposal-export-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.proposal-export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.proposal-export-header h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.proposal-export-card p {
  margin: 0;
}

.client-verifier-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}

.plan-config-client-verifier-panel {
  margin: 18px 0 10px;
}

.client-verifier-field {
  gap: 8px;
}

.client-verifier-english-field {
  grid-column: 1 / 2;
}

.client-verifier-panel > #client-verifier-query-button {
  grid-column: 2;
  grid-row: 1;
}

.client-verifier-field input,
.broker-combobox-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.client-verifier-field input:focus,
.broker-combobox-input:focus {
  outline: 2px solid rgba(214, 19, 45, 0.16);
  border-color: var(--primary);
}

.broker-combobox-input.is-invalid {
  border-color: #d89a31;
  background: #fffaf0;
}

.broker-select-panel {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 20px;
  max-width: 620px;
}

.broker-select-field {
  gap: 8px;
}

.proposal-export-options {
  display: grid;
  margin-top: 20px;
  max-width: 260px;
}

.effective-date-field {
  gap: 8px;
}

.effective-date-field .text-input {
  min-height: 42px;
}

.broker-combobox-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(44, 27, 33, 0.14);
}

.broker-combobox-option,
.broker-combobox-empty {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.broker-combobox-option {
  cursor: pointer;
}

.broker-combobox-option:hover,
.broker-combobox-option.is-selected {
  background: #fff1f3;
  color: var(--primary);
}

.broker-combobox-empty {
  color: var(--muted);
}

.client-verifier-modal-message {
  color: var(--text);
  font-weight: 700;
  line-height: 1.7;
}

.client-verifier-modal-card {
  max-width: 560px;
}

.proposal-export-hint {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.proposal-export-status {
  margin-top: 14px;
}

@media (max-width: 760px) {
  .proposal-export-header {
    flex-direction: column;
  }

  .proposal-export-actions {
    justify-content: flex-start;
  }

  .client-verifier-panel {
    grid-template-columns: 1fr;
  }

  .client-verifier-english-field {
    grid-column: auto;
  }

  .client-verifier-panel > #client-verifier-query-button {
    grid-column: auto;
    grid-row: auto;
  }

  .broker-select-panel {
    max-width: none;
  }
}

.fatal-error {
  max-width: 680px;
  margin: 60px auto;
  border: 1px solid #f3c7ce;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(40, 30, 28, 0.42);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(560px, calc(100vw - 32px));
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(57, 37, 32, 0.22);
  padding: 22px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 24px;
}

.plan-name-textarea {
  width: 100%;
  min-height: 140px;
  margin-top: 14px;
  resize: vertical;
  border: 1px solid #d8cbc7;
  border-radius: 16px;
  padding: 14px 16px;
  line-height: 1.6;
  background: #fffdfa;
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.user-notice-modal-card {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.user-notice-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  display: grid;
  gap: 12px;
  line-height: 1.7;
}

.user-notice-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

.user-notice-index {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.user-notice-empty {
  grid-column: 1 / -1;
  display: block;
  padding: 14px 16px;
}

@media (max-width: 1180px) {
  .control-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-card {
    flex-direction: column;
  }

  .hero-meta {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    margin-top: 14px;
  }

  .hero-card,
  .panel,
  .tabs-card {
    border-radius: 18px;
  }

  .hero-card,
  .panel {
    padding: 18px;
  }

  .hero-card h1 {
    font-size: 28px;
  }

  .hero-brand {
    gap: 12px;
    align-items: center;
  }

  .hero-logo-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }

  .hero-logo {
    max-width: 34px;
    max-height: 34px;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .plan-library-row,
  .table-toolbar,
  .panel-title-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .mmb-insured-count-panel,
  .mmb-plan-selector {
    grid-template-columns: 1fr;
  }

  .mmb-insured-count-panel > button {
    width: 100%;
  }

  .plan-library-actions {
    justify-content: stretch;
  }

  .plan-library-actions > button {
    width: 100%;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions > button {
    width: 100%;
  }

  .tab-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .selected-plan-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }
}


.modal-backdrop[hidden] {
  display: none !important;
}

.cell-value-stack {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.cell-lock-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f7e6ca;
  color: #8a5a12;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

/* 费率表阶段：上传、分配、固定费率生成、费率预览 */
.rate-workspace {
  display: grid;
  gap: 18px;
}

.rate-step-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.rate-step-card.is-disabled {
  background: #f7f7f8;
  border-color: #e4dddd;
  opacity: 0.76;
}

.rate-step-card.is-disabled .step-kicker {
  background: #ece8e6;
  color: #756a66;
}

.rate-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.rate-step-header h3 {
  margin: 6px 0 6px;
  font-size: 22px;
}

.rate-step-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.rate-preview-actions {
  display: grid;
  gap: 10px;
  min-width: 220px;
}

.rate-preview-actions > button {
  width: 100%;
}

.step-kicker {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.upload-row,
.assignment-toolbar,
.commission-actions,
.admin-password-row,
.inline-checkbox-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.upload-row {
  margin-top: 16px;
}

.inline-checkbox-card {
  margin-top: 12px;
  width: fit-content;
}

.rate-skip-card {
  align-items: center;
}


.file-display-pill {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px dashed #d9ceca;
  border-radius: 14px;
  background: #fffdfa;
  color: var(--muted);
  min-width: 260px;
}

.file-display-pill.has-file {
  border-style: solid;
  color: var(--text);
  background: #fff;
}

.file-display-pill.is-empty {
  color: var(--muted);
}

.file-display-pill.is-skip {
  border-style: solid;
  background: #f5f8ff;
  color: #34496d;
}

.notice-info {
  border: 1px solid #d9e6f7;
  background: #f4f8ff;
  color: #265b9c;
}


#insured-file-input {
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #d9ceca;
  border-radius: 14px;
  background: #fffdfa;
}

.rate-feedback {
  margin-top: 16px;
}

.notice-card {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  line-height: 1.6;
}

.notice-success {
  border: 1px solid #cce8d5;
  background: #f0fbf4;
  color: #25623a;
}

.notice-error {
  border: 1px solid #f1b8c0;
  background: #fff1f3;
  color: #a30f23;
}

.notice-warning {
  border: 1px solid #f1d6a9;
  background: #fff8ea;
  color: #7b540c;
}

.notice-info {
  border: 1px solid #d9e1f2;
  background: #f5f8ff;
  color: #34496d;
}

.message-list {
  margin: 12px 0 0;
  padding: 12px 18px 12px 34px;
  border-radius: 14px;
  line-height: 1.7;
}

.error-list {
  border: 1px solid #f1b8c0;
  background: #fff5f6;
  color: #9f1022;
}

.warning-list {
  border: 1px solid #f1d6a9;
  background: #fffaf0;
  color: #7b540c;
}

.mini-table-frame,
.rate-table-frame {
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.mini-table,
.rate-table {
  width: 100%;
  border-collapse: collapse;
}

.mini-table {
  min-width: 900px;
  font-size: 13px;
}

.mini-table th,
.mini-table td,
.rate-table th,
.rate-table td {
  border: 1px solid #ded6d3;
  padding: 9px 10px;
  vertical-align: middle;
  text-align: center;
  word-break: break-word;
}

.mini-table th {
  background: #f2f2f2;
  color: #000;
  font-weight: 700;
}

.mini-table td {
  color: #4d4541;
}

.mini-table tr.has-error td {
  background: #fff1f3;
}

.mini-table tr.has-warning td {
  background: #fffaf0;
}

.file-explorer-shell {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
}

.file-explorer-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.file-root-tabs,
.file-breadcrumb,
.file-bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.file-root-tab,
.file-crumb-button {
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--text);
  cursor: pointer;
}

.file-root-tab {
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}

.file-root-tab.is-active {
  background: var(--primary-soft);
  border-color: #efb7c0;
  color: var(--primary);
}

.file-crumb-button {
  border-radius: 10px;
  padding: 7px 10px;
}

.file-crumb-separator {
  color: var(--muted);
}

.file-bulk-toolbar {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

.file-selection-count {
  color: var(--muted);
  font-weight: 700;
  margin-right: auto;
}

.file-entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.file-entry-card {
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  padding: 14px;
  display: grid;
  gap: 8px;
  align-content: start;
  color: var(--text);
  text-align: left;
}

.file-select-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.file-select-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

button.file-entry-card {
  cursor: pointer;
}

.file-entry-card:hover {
  border-color: #efb7c0;
  box-shadow: 0 10px 24px rgba(120, 73, 64, 0.08);
}

.file-entry-icon {
  width: max-content;
  min-width: 42px;
  border-radius: 8px;
  padding: 4px 7px;
  background: var(--label);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.file-entry-card.is-folder .file-entry-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.file-entry-name {
  font-weight: 700;
  word-break: break-word;
}

.file-entry-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.file-entry-actions {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-delete-button {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 10px;
}

.file-empty-state {
  grid-column: 1 / -1;
}

.compact {
  padding: 14px;
}

.assignment-toolbar {
  margin-top: 16px;
}

.inline-select {
  min-height: 42px;
  min-width: 190px;
  padding: 9px 12px;
  border: 1px solid #d9ceca;
  border-radius: 12px;
  background: #fffdfa;
}

.assignment-summary-grid,
.premium-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.assignment-card,
.premium-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfbfb;
}

.assignment-card-title,
.premium-card span {
  color: var(--muted);
  line-height: 1.45;
}

.assignment-card-count,
.premium-card strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

.premium-card.total {
  border-color: #efb5be;
  background: #fff4f6;
}

.assignment-meta-row {
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.assignment-table-frame {
  max-height: 520px;
}

.assignment-table .select-col {
  width: 72px;
}

.assignment-table select {
  width: 100%;
}

.commission-input {
  min-height: 42px;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid #d9ceca;
  border-radius: 12px;
  background: #fffdfa;
}

.rate-table {
  min-width: 920px;
  table-layout: fixed;
}

.rate-table .rate-title-row th {
  background: #d6132d;
  color: #fff;
  font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
  font-weight: 700;
  text-align: center;
}

.core-rate-table .rate-title-row th {
  font-size: 16px;
  padding: 14px 12px;
}

.optional-rate-table .rate-title-row th {
  font-size: 14px;
  padding: 12px 10px;
}

.rate-table .rate-header-row th {
  background: #f2f2f2;
  color: #000;
  font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
  font-weight: 700;
  text-align: center;
}

.core-rate-table .rate-header-row th {
  font-size: 11px;
}

.optional-rate-table .rate-header-row th {
  font-size: 9px;
}

.rate-table tbody td {
  background: #fff;
  color: #808080;
  font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
  font-weight: 400;
  text-align: center;
}

.core-rate-table tbody td {
  font-size: 10px;
}

.optional-rate-table tbody td {
  font-size: 9px;
}

.rate-table tbody tr.rate-total-row td {
  background: #f2f2f2;
  color: #000000;
  font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
  font-weight: 400;
  text-align: center;
}

.core-rate-table tbody tr.rate-total-row td,
.optional-rate-table tbody tr.rate-total-row td {
  font-size: 9px;
}

.number-cell {
  font-variant-numeric: tabular-nums;
}

.rate-table-total {
  padding: 10px 14px 12px;
  color: var(--muted);
  text-align: right;
  font-weight: 700;
}

.admin-modal-card {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.admin-password-row {
  margin-top: 14px;
}

.admin-feedback {
  min-height: 22px;
  margin-top: 10px;
  color: #a30f23;
}

.admin-preview-content {
  margin-top: 12px;
  display: grid;
  gap: 16px;
}

.admin-plan-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfbfb;
}

.admin-plan-block h4 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.45;
}

.admin-discount-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  color: var(--muted);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 760px) {
  .rate-step-header,
  .commission-actions,
  .plan-preview-rate-toolbar,
  .admin-password-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rate-step-header > button,
  .commission-actions > button,
  .rate-preview-actions,
  .commission-input,
  .secondary-link,
  .upload-row > button,
  #insured-file-input {
    width: 100%;
  }
}


.panel-lock-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(214, 19, 45, 0.08);
  border: 1px solid rgba(214, 19, 45, 0.18);
  color: #a11931;
  font-size: 13px;
  font-weight: 700;
}

.panel.is-locked {
  position: relative;
}

.panel.is-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.panel.is-locked .panel-note {
  color: #8b94a7;
}

.panel.is-locked select,
.panel.is-locked button,
.panel.is-locked input[type="checkbox"] {
  cursor: not-allowed;
}

.panel.is-locked .selected-plan-item,
.panel.is-locked .checkbox-card {
  opacity: 0.72;
}

.panel.is-locked #open-plan-preview-button,
.panel.is-locked .selected-plan-base-button {
  cursor: pointer;
}

/* V1.5 server deployment, auth, project and admin UI */
.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: rgba(214, 19, 45, 0.1);
  color: #d6132d;
  vertical-align: middle;
}

.hero-card {
  gap: 1rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-actions form {
  margin: 0;
}

.signed-user-pill {
  border: 1px solid #eadfe1;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: #fff;
  color: #4a3840;
  font-size: 0.85rem;
  white-space: nowrap;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fff7f8 0%, #f8f9fb 100%);
  padding: 2rem;
}

.auth-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid #eadfe1;
  box-shadow: 0 24px 70px rgba(44, 27, 33, 0.12);
  border-radius: 24px;
  padding: 2rem;
}

.wide-auth-card {
  width: min(620px, 100%);
}

.auth-card h1 {
  margin: 0.35rem 0 0.75rem;
}

.login-success-card {
  text-align: center;
}

.login-success-progress {
  position: relative;
  overflow: hidden;
  height: 8px;
  margin: 1.25rem 0 1rem;
  border-radius: 999px;
  background: #f3e8eb;
}

.login-success-progress span {
  position: absolute;
  inset: 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(135deg, #d6132d 0%, #f03f56 100%);
  animation: login-success-progress 1.2s ease-in-out infinite;
}

.login-success-link {
  display: inline-flex;
  text-decoration: none;
}

@keyframes login-success-progress {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(240%);
  }
}

.auth-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.auth-form label,
.field-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: #5d4b52;
  font-weight: 600;
}

.auth-form input,
.auth-form textarea,
.text-input {
  border: 1px solid #ded3d6;
  border-radius: 12px;
  padding: 0.72rem 0.85rem;
  font: inherit;
  color: #2f2428;
  background: #fff;
}

.auth-form textarea {
  resize: vertical;
}

.auth-form .auth-remember-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  cursor: pointer;
}

.auth-form .auth-remember-row input {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 5px;
  accent-color: var(--primary);
}

.auth-remember-row span {
  line-height: 1.5;
}

.auth-footer {
  margin-top: 1.2rem;
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  color: #6c5a61;
}


.password-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.password-input-row input {
  width: 100%;
}

.password-toggle-button {
  min-width: 74px;
}

.inline-hint {
  margin-top: -0.35rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
}

.inline-hint.is-error {
  color: #a30f23;
}

.inline-hint.is-success {
  color: #25623a;
}

.plan-preview-rate-panel {
  margin-top: 16px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.plan-preview-rate-header {
  display: grid;
  gap: 14px;
}

.plan-preview-rate-header h3 {
  margin: 6px 0;
  font-size: 22px;
}

.plan-preview-rate-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.plan-preview-rate-toolbar {
  justify-content: flex-start;
}

.rate-preview-modal-card {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  display: grid;
  grid-template-rows: auto auto minmax(240px, 1fr) auto;
  gap: 14px;
  overflow: hidden;
}

.rate-preview-modal-body {
  overflow: auto;
  padding-right: 4px;
}

.is-preview-rate-table {
  min-width: 720px;
}

.admin-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-role-pill {
  background: #f6eef0;
  color: #6d4652;
}

.admin-status-pill {
  background: #eef5ff;
  color: #35507a;
}

.admin-channel-text {
  color: #6d5961;
}

.admin-role-field {
  display: grid;
  gap: 0.35rem;
  color: #5d4b52;
  font-size: 0.88rem;
  font-weight: 600;
}

.admin-role-select {
  min-width: 180px;
}

.project-panel {
  grid-column: 1 / -1;
}

.project-library-entry {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.project-library-entry > div:first-child {
  min-width: 0;
}

#project-name-input {
  width: 100%;
  box-sizing: border-box;
}

.project-current-label {
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.project-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  align-items: center;
  align-self: start;
  margin-top: 1.8rem;
}

.project-actions button {
  white-space: nowrap;
}

.project-status {
  margin-top: 0.9rem;
}

.project-library-modal-card {
  width: min(1180px, calc(100vw - 32px));
  height: min(860px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
}

.project-library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.project-library-toolbar .text-input {
  flex: 1 1 auto;
}

.project-library-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1rem;
}

.project-library-list,
.project-library-detail {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.project-library-list {
  padding: 0.65rem;
  display: grid;
  align-content: start;
  gap: 0.55rem;
}

.project-library-item {
  position: relative;
  width: 100%;
  display: grid;
  gap: 0.3rem;
  padding: 0.85rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f8f8f8;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.project-library-item:hover,
.project-library-item.is-active {
  border-color: var(--primary);
  background: #fff;
}

.project-library-item-title {
  font-weight: 800;
}

.project-library-item-meta,
.project-detail-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.project-library-current-pill {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
}

.project-library-detail {
  padding: 1rem;
}

.project-detail-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.project-detail-header h4 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  cursor: text;
}

.project-detail-header h4:hover {
  color: var(--primary);
}

.nested-modal {
  z-index: 140;
}

.compact-modal-card {
  width: min(480px, calc(100vw - 32px));
}

.platform-dialog-card {
  width: min(460px, calc(100vw - 32px));
}

.platform-dialog-message {
  margin-top: 8px;
  line-height: 1.7;
}

.benefit-table-format-card {
  width: min(460px, calc(100vw - 32px));
}

.benefit-table-format-body {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffafa;
}

.benefit-table-format-value {
  justify-self: center;
  min-width: 48px;
  padding: 6px 14px;
  border: 1px solid #f1d7dc;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.benefit-table-format-range {
  width: 100%;
  accent-color: var(--primary);
}

.benefit-table-format-scale {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.inline-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pagination-button {
  min-width: 36px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.pagination-button:hover,
.pagination-button.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.pagination-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.pagination-status {
  color: var(--muted);
  font-size: 0.86rem;
}

.project-detail-actions,
.project-note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.project-note-editor {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfbfb;
}

.project-note-textarea {
  min-height: 96px;
  resize: vertical;
}

.project-flow-title {
  margin: 0.25rem 0 0.85rem;
  font-weight: 800;
}

.project-flow-line {
  display: grid;
  gap: 0.85rem;
}

.project-flow-node {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 0.75rem;
}

.project-flow-node-marker {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.project-flow-node-body {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.project-flow-node-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.project-flow-node-body ul {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
}

.project-flow-detail-list {
  color: var(--muted);
  font-size: 0.9rem;
}

.project-flow-note {
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: #f7f4f2;
  color: var(--text);
}

.plan-select-wrapper {
  position: relative;
  flex: 1 1 auto;
  min-width: 220px;
}

.plan-select-wrapper select {
  width: 100%;
}

.plan-preview-modal-card {
  width: min(1020px, calc(100vw - 32px));
  height: min(860px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  display: grid;
  grid-template-rows: auto auto auto minmax(180px, 1fr) auto;
  gap: 14px;
  overflow: hidden;
}

.plan-preview-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
}

.plan-preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.plan-preview-summary-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfbfb;
}

.plan-preview-summary-label {
  color: var(--muted);
  font-size: 12px;
}

.plan-preview-summary-value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}


.plan-preview-modal-body {
  min-height: 180px;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  align-content: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-right: 4px;
}

.plan-preview-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #ede3e7;
  border-radius: 18px;
  background: #fffdfa;
}

.plan-preview-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.plan-preview-card-title {
  font-weight: 700;
  color: #47343b;
  line-height: 1.55;
}

.plan-preview-card-value {
  color: #2f2428;
  line-height: 1.65;
  word-break: break-word;
}

.plan-preview-card-value.is-empty {
  color: var(--muted);
  font-style: italic;
}

.plan-preview-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.plan-preview-badge.is-core {
  background: #fdecef;
  color: #b31b32;
}

.plan-preview-badge.is-optional {
  background: #f3eef0;
  color: #6d5961;
}

.plan-preview-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plan-preview-meta-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f7f1f3;
  color: #6d5961;
  font-size: 12px;
  line-height: 1.2;
}

.plan-preview-meta-tag.is-editable {
  background: #eef7f1;
  color: #206040;
}

.admin-shell .admin-panel {
  margin-top: 1rem;
}

.admin-list {
  display: grid;
  gap: 0.85rem;
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 0.9fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #eadfe1;
  border-radius: 16px;
  background: #fff;
}

.admin-user-card div:first-child {
  display: grid;
  gap: 0.3rem;
}

.admin-user-card span,
.admin-user-card small {
  color: #6d5961;
}

.admin-actions {
  display: grid;
  gap: 0.55rem;
}

.commission-field-slot {
  min-width: 220px;
  flex: 0 1 240px;
}

.commission-field-slot .inline-select,
.commission-field-slot .commission-input {
  width: 100%;
  min-width: 0;
}

.audit-detail-card {
  min-width: 220px;
}

.audit-detail-card summary {
  cursor: pointer;
  color: #8f1a2a;
  font-weight: 700;
}

.audit-detail-card[open] summary {
  margin-bottom: 10px;
}

.audit-json-block {
  margin: 0;
  padding: 12px;
  border: 1px solid #eadfe1;
  border-radius: 12px;
  background: #faf7f8;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.6;
  color: #573e48;
  max-height: 280px;
  overflow: auto;
}

.audit-json-block.compact {
  max-height: 180px;
}

.db-browser-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.db-toolbar-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: #5c4750;
  font-weight: 700;
}

.db-toolbar-field.is-wide {
  grid-column: span 2;
}

.db-toolbar-field .commission-input,
.db-toolbar-field .inline-select {
  min-width: 0;
  width: 100%;
}

.db-toolbar-actions {
  align-self: end;
}

.db-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.db-meta-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfbfb;
}

.db-meta-label {
  font-size: 12px;
  color: var(--muted);
}

.db-meta-value {
  font-size: 18px;
  color: #35282e;
}

.db-path-text {
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
}

.db-schema-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 14px;
}

.db-column-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #eadfe1;
  border-radius: 999px;
  background: #fff;
  color: #5c4750;
  font-size: 12px;
}

.db-column-chip strong {
  color: #35282e;
}

.db-column-chip span {
  color: var(--muted);
}

.db-column-chip em {
  font-style: normal;
  color: #8f1a2a;
  font-weight: 700;
}

.db-browser-table td {
  min-width: 160px;
  vertical-align: top;
  word-break: break-word;
}

.db-row-actions {
  min-width: 120px;
}

.db-row-action-button {
  padding: 7px 12px;
  white-space: nowrap;
}

.db-null-value,
.db-empty-value {
  color: var(--muted);
  font-style: italic;
}

.db-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

#db-pagination-status {
  color: #5c4750;
  font-weight: 700;
}


@media (max-width: 780px) {
  .project-library-entry,
  .project-library-layout,
  .admin-user-card,
  .plan-preview-toolbar,
  .plan-preview-modal-body {
    grid-template-columns: 1fr;
  }

  .project-actions,
  .project-detail-header {
    flex-wrap: wrap;
  }

  .project-actions {
    margin-top: 0;
  }

  .db-browser-toolbar {
    grid-template-columns: 1fr;
  }

  .db-toolbar-field.is-wide {
    grid-column: span 1;
  }

  .db-pagination {
    justify-content: stretch;
  }

  .db-pagination > button {
    flex: 1 1 140px;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .plan-preview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .plan-preview-summary-card {
    min-width: 0;
  }

  .plan-preview-summary-value {
    font-size: 20px;
  }

  .plan-preview-modal-card {
    width: min(100vw - 12px, 100%);
    height: min(92dvh, calc(100dvh - 8px));
    max-height: min(92dvh, calc(100dvh - 8px));
    align-self: end;
    border-radius: 24px 24px 0 0;
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
  }

  .plan-preview-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
    flex: 0 0 auto;
  }


  .plan-preview-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0;
    padding-bottom: 4px;
    align-content: start;
  }

  .modal-actions {
    flex: 0 0 auto;
    margin-top: 4px;
  }
}


/* V1.8: split plan configuration, preview rate entry, and full export workflow */
.tab-intro-card {
  margin: 4px 0 16px;
  padding: 18px 20px;
  border: 1px solid #efe2e5;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(214, 19, 45, 0.06), rgba(255, 255, 255, 0.96));
}

.tab-intro-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.tab-intro-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.config-table-toolbar {
  margin-top: 20px;
  padding-top: 4px;
}

.import-feedback {
  min-height: 0;
  margin: 10px 0 0;
  padding: 0;
  border-radius: 14px;
  line-height: 1.6;
}

.import-feedback:not(:empty) {
  padding: 10px 14px;
}

.config-confirm-button {
  max-width: 260px;
  white-space: normal;
  line-height: 1.45;
}

.plan-preview-readonly-note {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(214, 19, 45, 0.16);
  border-radius: 14px;
  background: rgba(214, 19, 45, 0.06);
  color: #8f1a2a;
  font-size: 13px;
  font-weight: 700;
}

.readonly-plan-name {
  cursor: default;
}

.plan-select-wrapper {
  position: relative;
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 260px;
}

.plan-select-wrapper::after {
  content: '▾';
  position: absolute;
  top: 12px;
  right: 14px;
  pointer-events: none;
  color: var(--primary);
  font-size: 14px;
  line-height: 1;
}

.plan-select-current-label {
  min-height: 38px;
  max-height: 88px;
  overflow: auto;
  padding: 9px 12px;
  border: 1px dashed #e4d7dc;
  border-radius: 12px;
  background: #fffdfd;
  color: #604d55;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.plan-preview-modal-card {
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
}

.plan-preview-summary {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(180px, 1.6fr);
}

.plan-preview-summary-value.small {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.selected-plan-meta {
  min-width: 0;
}

.selected-plan-base-button {
  max-width: 100%;
  word-break: break-word;
}

@media (max-width: 760px) {
  .config-confirm-button {
    max-width: none;
    width: 100%;
  }

  .plan-select-wrapper {
    min-width: 0;
  }

  .plan-preview-summary {
    grid-template-columns: 1fr;
  }
}


#rate-preview-close-x {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fbf6f4;
  border: 1px solid #dececa;
  color: #6a4c46;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(111, 75, 69, 0.08);
}

#rate-preview-close-x:hover,
#rate-preview-close-x:focus-visible {
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(111, 75, 69, 0.12);
}

#rate-preview-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
}

#rate-preview-close {
  flex: 0 0 auto;
  align-self: center;
  width: auto;
  min-width: 56px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  writing-mode: horizontal-tb;
  white-space: nowrap;
  border-radius: 8px;
  background: #faf7f6;
  border: 1px solid #ddcdc8;
  color: #5f4540;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  box-shadow: none;
}

#rate-preview-close:hover,
#rate-preview-close:focus-visible {
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(95, 69, 64, 0.10);
}
