/* ==========================================================================
   HomeBiz Zim - dialogs.css
   Dialogs, forms, toasts
   Load order: 6 of 7
   ========================================================================== */

/* ---------- Dialog ---------- */
dialog {
  width: calc(100% - 28px);
  max-width: 566px;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
dialog#dlg-confirm { max-width: 430px; }
dialog::backdrop { background: rgba(16, 10, 24, 0.55); backdrop-filter: blur(3px); }
body:has(dialog[open]) { overflow: hidden; }
dialog[open] { animation: pop 0.2s ease; }
.dialog-card {
  max-height: min(86vh, 780px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.dialog-head .eyebrow { margin-bottom: 2px; }
.dialog-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
.dialog-head p { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field > label, .field-label { color: var(--text-2); font-size: 11.5px; font-weight: 650; }
.field input, .field select {
  width: 100%;
  height: 41px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: var(--muted); opacity: 0.8; }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.field-msg { color: var(--red); font-size: 10.8px; line-height: 1.4; }
.field-msg:empty { display: none; }
.hint { color: var(--muted); font-size: 10.8px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.margin-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
  padding: 9px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
}
.margin-preview strong { color: var(--green); font-size: 12px; font-weight: 650; text-align: right; }
.margin-preview.neg strong { color: var(--red); }
.stepper { display: flex; align-items: center; height: 41px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.stepper button { width: 37px; height: 100%; flex: none; border: 0; background: transparent; color: var(--text-2); font-size: 18px; line-height: 1; }
.stepper button:hover { background: var(--surface-3); }
.stepper input {
  width: 100%;
  min-width: 0;
  height: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  font-weight: 650;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.stepper input:focus { box-shadow: none !important; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.pay-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.pay-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.pay-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pay-option .icon { width: 15px; height: 15px; color: var(--muted); }
.pay-option:hover { border-color: var(--line-strong); }
.pay-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.pay-option:has(input:checked) .icon { color: var(--brand); }
.pay-option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.sale-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-2));
}
.sale-total span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.sale-total small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.sale-total strong { color: var(--brand-text); font-size: 24px; font-weight: 750; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.settings-section { margin-bottom: 17px; }
.settings-section h3 { margin-bottom: 9px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.data-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.data-actions .btn { justify-content: flex-start; }
.confirm-card { padding: 22px; }
.confirm-ico {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
}
.confirm-ico .icon { width: 20px; height: 20px; }
.confirm-card h2 { margin-bottom: 4px; font-size: 17px; font-weight: 700; letter-spacing: -0.025em; }
.confirm-card p { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.confirm-card .dialog-foot { margin-top: 18px; }

/* ---------- Toasts ---------- */
#toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(354px, calc(100% - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast-ico { display: flex; padding-top: 1px; color: var(--green); }
.toast-ico .icon { width: 15px; height: 15px; }
.toast p { color: var(--text-2); font-size: 12px; line-height: 1.45; }
.toast-error { border-left-color: var(--red); }
.toast-error .toast-ico { color: var(--red); }
.toast-info { border-left-color: var(--blue); }
.toast-info .toast-ico { color: var(--blue); }
