/* ==========================================================================
   全局 Bootstrap 组件皮肤（对话框 / Toast）
   —— 后台、下单页共用同一套，保证视觉一致
   ========================================================================== */

/* ---------- 对话框（<dialog class="dialog">） ---------- */
.dialog {
  --bs-dialog-width: 560px;
  --bs-dialog-border-radius: 18px;
  --bs-dialog-backdrop-bg: rgba(16, 24, 40, 0.45);
  --bs-dialog-backdrop-blur: 3px;
  overflow: hidden;
}

.dialog > .dialog-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.dialog .dialog-header {
  gap: 12px;
  padding: 18px 22px;
}

.dialog .dialog-title {
  margin: 0;
  flex: 1 1 auto;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dialog .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 22px;
  overflow-y: auto;
}

.dialog .dialog-footer {
  padding: 14px 22px;
  gap: 10px;
  background: #fbfcfe;
}

/* 弹窗内按钮：与后台弹窗保持一致 */
.dialog .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  height: auto;
  min-height: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.dialog .btn-primary {
  background: var(--accent);
  color: #fff;
}

.dialog .btn-primary:hover {
  background: var(--accent-dark);
}

.dialog .btn-line {
  background: #fff;
  border-color: var(--line-2);
  color: var(--ink-2);
}

.dialog .btn-line:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.dialog .btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.dialog .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.dialog .form-grid .span-2 { grid-column: 1 / -1; }

.dialog .form-grid > * { min-width: 0; }

.dialog .input[type="file"] { overflow: hidden; }

/* 确认 / 提示类对话框 */
.dialog--confirm {
  --bs-dialog-width: 420px;
}

.dialog--confirm .confirm__text,
.dialog--alert .alert__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-2);
}

.dialog--alert {
  --bs-dialog-width: 420px;
}

/* ---------- Toast ---------- */
[data-flash] {
  position: fixed;
  inset-block-end: 24px;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: calc(100% - 32px);
  z-index: 1090;
  pointer-events: none;
}

[data-flash][hidden] { display: none; }

[data-flash] .toast {
  display: block;
  width: 100%;
  min-width: 220px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 40px -24px rgba(16, 24, 40, 0.5);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

[data-flash] .toast.show {
  opacity: 1;
  transform: none;
}

[data-flash] .toast-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--ink);
}

[data-flash] .toast-body > span {
  flex: 1 1 auto;
  min-width: 0;
}

[data-flash] .toast-body .btn-close {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  padding: 4px;
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.18s ease, background-color 0.18s ease;
}

[data-flash] .toast-body .btn-close:hover,
[data-flash] .toast-body .btn-close:focus-visible {
  opacity: 0.9;
}

[data-flash] .toast-body .btn-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 提示类别：成功 / 错误 / 警告 */
[data-flash] .toast--ok {
  border-color: #bfe6cd;
  background: #f4fcf7;
}

[data-flash] .toast--ok .toast-body { color: #17693c; }

[data-flash] .toast--error {
  border-color: #f3c9c9;
  background: #fff7f7;
}

[data-flash] .toast--error .toast-body { color: #a3252b; }

[data-flash] .toast--warn {
  border-color: #f2ddb4;
  background: #fffaf0;
}

[data-flash] .toast--warn .toast-body { color: #8a5b0d; }

@media (max-width: 640px) {
  .dialog .form-grid { grid-template-columns: 1fr; }
  .dialog .form-grid .span-2 { grid-column: auto; }
}
