/* 분배금 계산기 — memento-cube.css 공용 스타일 위에 덧씀 */

/* ---------- 입력 ---------- */

.ps-input{
  display: grid;
  gap: 22px;
}

.ps-step{
  display: grid;
  gap: 10px;
  justify-items: start;
}

.ps-label{
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--title);
}

.ps-step .mc-mode{
  flex-wrap: wrap;
}

.ps-items,
.ps-members{
  display: grid;
  gap: 8px;
  width: 100%;
}

.ps-item{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 8px;
  align-items: start;
}

.ps-item .mc-input,
.ps-member .mc-input{
  padding: 10px 12px;
  font-size: 15px;
}

.ps-amount-wrap{
  display: grid;
  gap: 4px;
}

.ps-amount{
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ps-amount-read{
  min-height: 1.2em;
  padding-right: 4px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.ps-total{
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--title);
}

.ps-total:empty{
  display: none;
}

.ps-ghost-btn,
.ps-del-btn{
  cursor: pointer;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 10px;
}

.ps-ghost-btn:hover,
.ps-del-btn:hover{
  border-color: var(--gold-mid);
  color: var(--title);
}

.ps-del-btn{
  border-style: solid;
  padding: 10px 12px;
}

.ps-link-btn{
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* 파티원 줄 */

.ps-member{
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-sub);
}

.ps-members.is-ratio .ps-member{
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
}

.ps-member .mc-input{
  background: var(--card);
}

.ps-member-tag{
  justify-self: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.ps-member.is-seller .ps-member-tag{
  color: var(--primary);
}

.ps-member .ps-weight input{
  width: 64px;
  background: var(--card);
}

.ps-benefit,
.ps-seller-note{
  font-size: 14px;
  white-space: nowrap;
}

.ps-seller-note{
  color: var(--muted);
}

/* 수수료율 */

.ps-rates{
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}

.ps-rates summary{
  cursor: pointer;
  padding: 10px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.ps-rate-grid{
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 6px 0 10px;
}

/* ---------- 결과 ---------- */

.ps-result{
  display: grid;
  gap: 14px;
}

.ps-result .h2{
  margin: 0;
}

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

.ps-summary-box{
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-sub);
  border-top: 4px solid var(--primary);
}

.ps-summary-box:last-child{
  border-top-color: var(--line);
}

.ps-summary-name{
  font-size: 13px;
  color: var(--muted);
}

.ps-summary-num{
  font-size: 20px;
  color: var(--title);
  word-break: keep-all;
}

.ps-table-wrap{
  overflow-x: auto;
}

.ps-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.ps-table th,
.ps-table td{
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.ps-table thead th{
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.ps-table tbody th{
  font-weight: 700;
  color: var(--title);
  word-break: break-all;
}

.ps-table .ps-num{
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ps-table thead th:nth-child(3),
.ps-table thead th:nth-child(4){
  text-align: right;
}

.ps-table .ps-num strong{
  color: var(--title);
}

.ps-read{
  display: block;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.ps-badge{
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  vertical-align: 1px;
}

.ps-how-tag{
  font-weight: 700;
  color: var(--text);
}

.ps-how-tag.is-auction{
  color: var(--primary);
}

.ps-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 760px){
  .ps-summary{
    grid-template-columns: 1fr;
  }

  .ps-item{
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ps-item .ps-amount-wrap{
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .ps-member,
  .ps-members.is-ratio .ps-member{
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .ps-member .ps-benefit,
  .ps-member .ps-seller-note{
    grid-column: 2 / -1;
  }
}

/* 좁은 화면: 표 대신 파티원마다 한 덩어리 */
@media (max-width: 560px){
  .ps-summary-box{
    padding: 10px 14px;
  }

  .ps-table thead{
    display: none;
  }

  .ps-table tbody tr{
    display: grid;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .ps-table th,
  .ps-table td{
    padding: 0;
    border: none;
  }

  .ps-table tbody th{
    font-size: 16px;
  }

  .ps-table td.ps-empty{
    display: none;
  }

  /* 왼쪽에 칸 이름, 오른쪽에 값(두 줄) */
  .ps-table td[data-label],
  .ps-table tr.is-seller td.ps-num:last-child{
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 12px;
    text-align: right;
  }

  .ps-table td[data-label]::before,
  .ps-table tr.is-seller td.ps-num:last-child::before{
    content: attr(data-label);
    grid-row: 1 / span 2;
    font-size: 13px;
    color: var(--muted);
    text-align: left;
    padding-top: 2px;
  }

  .ps-table tr.is-seller td.ps-num:last-child::before{
    content: "남는 금액";
  }
}

/* ---------- 작은 숫자 입력칸 (몫·수수료율) ---------- */

.ps-field{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
}

.ps-field input{
  width: 72px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: right;
}

.ps-field input:focus{
  outline: none;
  border-color: var(--gold-mid);
}

.ps-unit{
  color: var(--muted);
}

.ps-input .mc-hint,
.ps-result .mc-notice{
  word-break: keep-all;
}
