/* Janelas do sistema (ui-dialog.js) — substituem as caixas nativas do navegador. */
.rt-dialog {
  border: 0;
  padding: 0;
  border-radius: 18px;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  color: var(--ink, #16182b);
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .35), 0 0 0 1px rgba(15, 23, 42, .04);
  font-family: inherit;
  animation: rt-dialog-in .16s ease-out;
}
.rt-dialog.wide { width: min(640px, calc(100vw - 32px)); }
.rt-dialog.closing { animation: rt-dialog-out .12s ease-in forwards; }
.rt-dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); animation: rt-fade .16s ease-out; }
@keyframes rt-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rt-dialog-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes rt-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rt-dialog, .rt-dialog::backdrop, .rt-dialog.closing { animation: none; } }

.rt-dialog form { display: flex; flex-direction: column; max-height: inherit; }
.rt-dialog-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 4px; }
.rt-dialog-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; }
.rt-dialog-icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-soft, #eef2ff);
  color: var(--primary, #4338ca);
}
.tone-danger .rt-dialog-icon { background: var(--danger-bg, #fef2f2); color: var(--danger, #dc2626); }
.rt-dialog-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.rt-dialog-body { padding: 10px 24px 4px 76px; overflow-y: auto; display: grid; gap: 14px; }
.rt-dialog-message { margin: 0; color: #4b5068; line-height: 1.55; font-size: 14.5px; white-space: pre-line; }
.rt-dialog-details { margin: 0; padding: 12px 14px 12px 30px; background: #f6f7fb; border-radius: 12px; display: grid; gap: 6px; font-size: 13.5px; color: #4b5068; line-height: 1.5; }

.rt-field { display: grid; gap: 6px; }
.rt-field-label { font-size: 13px; font-weight: 700; color: var(--ink, #16182b); }
.rt-field input, .rt-field select {
  font: inherit; font-size: 15px;
  padding: 11px 13px;
  border: 1.5px solid var(--line, #e4e6ef);
  border-radius: 11px;
  background: #fff;
  color: inherit;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.rt-field input:focus, .rt-field select:focus { outline: none; border-color: var(--primary, #4338ca); box-shadow: 0 0 0 4px rgba(67, 56, 202, .12); }
.rt-field input[aria-invalid="true"] { border-color: var(--danger, #dc2626); box-shadow: 0 0 0 4px rgba(220, 38, 38, .1); }
.rt-input-group { display: flex; align-items: stretch; }
.rt-input-prefix {
  display: grid; place-items: center;
  padding: 0 13px;
  border: 1.5px solid var(--line, #e4e6ef); border-right: 0;
  border-radius: 11px 0 0 11px;
  background: #f6f7fb; color: #6c7186;
  font-weight: 700; font-size: 14px;
}
.rt-input-group input { border-radius: 0 11px 11px 0; font-variant-numeric: tabular-nums; }
.rt-field-hint { font-size: 12px; color: #6c7186; }
.rt-field-error { font-size: 12.5px; font-weight: 600; color: var(--danger, #dc2626); min-height: 0; }
.rt-field-error:empty { display: none; }

.rt-compare-wrap { overflow-x: auto; border: 1px solid var(--line, #e4e6ef); border-radius: 12px; }
.rt-compare { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rt-compare th, .rt-compare td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line, #e4e6ef); word-break: break-word; }
.rt-compare tbody tr:last-child th, .rt-compare tbody tr:last-child td { border-bottom: 0; }
.rt-compare thead th { background: #f6f7fb; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: #6c7186; }
.rt-compare tbody th { font-weight: 700; color: var(--ink, #16182b); white-space: nowrap; }
.rt-compare td { color: #4b5068; }
.rt-compare tr.changed td:last-child { background: #ecfdf5; color: #065f46; font-weight: 700; }
.rt-compare-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: #10b981; color: #fff; font-size: 10.5px; font-weight: 800; text-transform: uppercase; vertical-align: 1px; }
.rt-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 24px 22px; }
.rt-btn {
  font: inherit; font-weight: 700; font-size: 14px;
  border-radius: 11px;
  padding: 10px 18px;
  min-width: 104px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.rt-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(67, 56, 202, .18); }
.rt-btn-ghost { background: #fff; border-color: var(--line, #e4e6ef); color: #3b4057; }
.rt-btn-ghost:hover { background: #f6f7fb; }
.rt-btn-primary { background: var(--primary, #4338ca); color: #fff; }
.rt-btn-primary:hover { background: #3730a3; }
.rt-btn-danger { background: var(--danger, #dc2626); color: #fff; }
.rt-btn-danger:hover { background: #b91c1c; }
.rt-btn-danger:focus-visible { box-shadow: 0 0 0 4px rgba(220, 38, 38, .2); }

@media (max-width: 520px) {
  .rt-dialog-body { padding-left: 24px; }
  .rt-dialog-actions { flex-direction: column-reverse; }
  .rt-btn { width: 100%; }
}
