/* 郵便（アイテム送付 / 代引き） */
body.postal-open { overflow: hidden; }

.postal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 21, 10, .58);
  backdrop-filter: blur(5px);
}

.postal-dialog {
  width: min(680px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid rgba(140, 101, 32, .45);
  border-radius: 18px;
  background: #fffaf0;
  color: #38290f;
  box-shadow: 0 24px 70px rgba(29, 19, 5, .35), inset 0 1px rgba(255, 255, 255, .9);
}

.postal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 15px;
  border-bottom: 1px solid rgba(140, 101, 32, .25);
  background: linear-gradient(135deg, #fff7dc 0%, #f4dfae 100%);
}

.postal-head h2 { margin: 2px 0 0; font-size: 1.25rem; letter-spacing: .03em; }
.postal-kicker { color: #956f24; font-size: .65rem; font-weight: 700; letter-spacing: .18em; }
.postal-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(114, 77, 16, .25);
  border-radius: 50%;
  background: rgba(255, 255, 255, .68);
  color: #5e4315;
  font-size: 1.45rem;
  cursor: pointer;
}

.postal-body { max-height: calc(min(820px, 100vh - 40px) - 82px); overflow: auto; padding: 20px 22px 24px; }
.postal-loading, .postal-empty { padding: 34px 16px; color: #7b6640; text-align: center; }
.postal-empty .g-btn { margin-top: 10px; }

.postal-compose-form { display: grid; gap: 16px; }
.postal-recipient {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border-radius: 10px;
  background: #f6e9c9;
}
.postal-recipient span { color: #8a6a2d; font-size: .8rem; }
.postal-recipient strong { font-size: 1.05rem; }
.postal-field { display: grid; gap: 7px; }
.postal-field > span { color: #72551d; font-size: .82rem; font-weight: 700; }
.postal-field select,
.postal-field input,
.postal-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d6bd83;
  border-radius: 9px;
  background: #fffdf7;
  color: #38290f;
  padding: 10px 12px;
  font: inherit;
}
.postal-field textarea { resize: vertical; }
.postal-field small { color: #88734d; line-height: 1.5; }
.postal-gold-input { position: relative; }
.postal-gold-input input { padding-right: 42px; }
.postal-gold-input b { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #9a6b12; }
.postal-disabled-note {
  padding: 12px 14px;
  border: 1px dashed #c9a65d;
  border-radius: 9px;
  background: #fff7df;
  color: #79633c;
  font-size: .82rem;
  line-height: 1.55;
}
.postal-actions, .postal-card-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.postal-notice { min-height: 1.4em; color: #3c7a48; font-size: .85rem; }
.postal-notice.is-error { color: #b33d31; }

.postal-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.postal-tab {
  border: 1px solid #d9c28e;
  border-radius: 9px;
  padding: 9px 12px;
  background: #fffdf7;
  color: #72551d;
  font-weight: 700;
  cursor: pointer;
}
.postal-tab.is-active { border-color: #a97819; background: #efdba9; color: #49330d; }
.postal-list { display: grid; gap: 12px; margin-top: 6px; }
.postal-mail-card {
  padding: 15px;
  border: 1px solid #dfc997;
  border-radius: 12px;
  background: rgba(255, 253, 247, .92);
  box-shadow: 0 3px 12px rgba(80, 55, 12, .06);
}
.postal-mail-card.status-pending { border-left: 4px solid #d49a24; }
.postal-mail-card.status-rejected { border-left: 4px solid #b85a4b; }
.postal-mail-top { display: flex; justify-content: space-between; gap: 12px; color: #5a4318; }
.postal-mail-top time { color: #99815a; font-size: .72rem; white-space: nowrap; }
.postal-item-line { margin: 12px 0 9px; padding: 10px 12px; border-radius: 8px; background: #f8edcf; }
.postal-quality { color: #86620d; }
.postal-mail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.postal-cod, .postal-status {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eee5d1;
  color: #725c35;
  font-size: .72rem;
  font-weight: 700;
}
.postal-cod.is-cod { background: #f4d488; color: #674300; }
.postal-message { margin-top: 10px; padding: 10px 12px; border-left: 3px solid #d2b269; background: #fff9ea; white-space: pre-wrap; }
.postal-card-actions { margin-top: 13px; }

.pf-mail-control { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pf-mail-btn {
  border: 1px solid #b8892d;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff3cc;
  color: #5d4312;
  font-weight: 700;
  cursor: pointer;
}
.pf-mail-btn:hover { background: #f5dda0; }
.pf-mail-note { color: #806b44; font-size: .72rem; }

/* ヘッダー郵便通知（未受取件数） */
.postal-notif-root {
  position: fixed;
  top: 10px;
  right: 62px;
  z-index: 8500;
  font-family: inherit;
}
.postal-notif-root.in-header {
  position: relative;
  top: auto;
  right: auto;
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
}
.postal-notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9c48f;
  border-radius: 50%;
  background: #fffdf6;
  box-shadow: 0 2px 8px rgba(120, 80, 10, .18);
  cursor: pointer;
  font-size: 18px;
}
.postal-notif-root.in-header .postal-notif-btn {
  width: 32px;
  height: 32px;
  box-shadow: none;
  font-size: 16px;
}
.postal-notif-btn:hover { background: #fff5d6; border-color: #c99a32; }
.postal-notif-icon { line-height: 1; }
.postal-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: content-box;
  border: 2px solid #fffdf6;
  border-radius: 9px;
  background: #c83a3a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}

@media (max-width: 600px) {
  .postal-overlay { padding: 0; place-items: end center; }
  .postal-dialog { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .postal-body { max-height: calc(92vh - 82px); padding: 16px 14px 22px; }
  .postal-head { padding: 15px 16px 13px; }
  .postal-mail-top { display: grid; gap: 3px; }
  .postal-actions .g-btn, .postal-card-actions .g-btn { flex: 1; }
}

[data-theme="dark"] .postal-notif-btn { background: #252017; color: #f0e1bd; border-color: #725827; }
[data-theme="dark"] .postal-notif-badge { border-color: #252017; }
[data-theme="dark"] .postal-dialog { background: #252017; color: #f0e1bd; border-color: #725827; }
[data-theme="dark"] .postal-head { background: linear-gradient(135deg, #332817, #4b3718); border-color: #6c5223; }
[data-theme="dark"] .postal-close,
[data-theme="dark"] .postal-field select,
[data-theme="dark"] .postal-field input,
[data-theme="dark"] .postal-field textarea,
[data-theme="dark"] .postal-tab,
[data-theme="dark"] .postal-mail-card { background: #201c15; color: #eadab6; border-color: #665026; }
[data-theme="dark"] .postal-recipient,
[data-theme="dark"] .postal-item-line { background: #3a2f1d; }
[data-theme="dark"] .postal-disabled-note,
[data-theme="dark"] .postal-message { background: #2f281a; }
