/* Isolate the native dialog from the app's global form rules. */
dialog.template-field-review {
  position: fixed; inset: 0; margin: auto; padding: 0;
  width: min(1080px, calc(100vw - 40px)); height: min(780px, calc(100dvh - 40px));
  max-width: none; max-height: none; overflow: hidden;
  border: 1px solid #d6dce3; border-radius: 8px; background: #fff; color: #20252b;
  font: 14px/1.5 'Inter', -apple-system, sans-serif; letter-spacing: 0;
  box-shadow: 0 20px 64px rgb(0 0 0 / 22%);
}
dialog.template-field-review[open] { display: flex; flex-direction: column; }
.template-field-review::backdrop { background: rgb(0 0 0 / 40%); }
.template-field-review header, .template-field-review footer { flex: 0 0 auto; padding: 20px 24px; background: #fff; }
.template-field-review header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid #e5e7eb; }
.template-field-review header > div { min-width: 0; }
.template-field-review h2 { font-size: 22px; line-height: 1.3; margin: 0; font-weight: 650; letter-spacing: 0; }
.template-field-review [data-filename] { margin: 6px 0 0; color: #58616c; overflow-wrap: anywhere; }
.template-field-review .template-review-steps { display: flex; flex: 0 0 auto; list-style: none; gap: 24px; padding: 16px 24px; margin: 0; border-bottom: 1px solid #e5e7eb; background: #f8f9fb; }
.template-review-steps li { display: flex; align-items: center; gap: 8px; color: #626970; font-weight: 600; }
.template-review-steps li span { display: grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; background: #e5e7eb; font-size: 12px; }
.template-review-steps li[data-active="true"] { color: #9f1c36; }
.template-review-steps li[data-active="true"] span { background: #9f1c36; color: #fff; }
.template-field-review .template-review-steps [data-review-sample] { display: flex; align-items: center; gap: 8px; min-height: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; }
.template-field-review .template-review-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: 12px; padding: 16px 24px; flex: 0 0 auto; }
.template-field-review [data-status] { margin: 0 24px 12px; overflow-wrap: anywhere; flex: 0 0 auto; }
.template-field-review [data-status]:empty { display: none; }
.template-field-review [data-matching-progress] { height: 6px; flex: 0 0 6px; margin: 0 24px 16px; overflow: hidden; border-radius: 3px; background: #eceef1; }
.template-field-review [data-matching-progress] span { display: block; width: 35%; height: 100%; border-radius: inherit; background: #9f1c36; animation: template-matching-progress 1.5s ease-in-out infinite alternate; }
@keyframes template-matching-progress { from { transform: translateX(0); } to { transform: translateX(185%); } }
@media (prefers-reduced-motion: reduce) { .template-field-review [data-matching-progress] span { animation: none; width: 100%; opacity: .65; } }
.template-field-review .template-review-auto { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 0 24px 12px; flex: 0 0 auto; color: #58616c; }
.template-field-review .template-review-columns, .template-field-review [data-slots] section { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; }
.template-field-review .template-review-columns { padding: 10px 24px; background: #f8f9fb; border-block: 1px solid #e5e7eb; font-size: 13px; font-weight: 600; color: #58616c; flex: 0 0 auto; }
.template-field-review [data-slots] { overflow: auto; min-height: 0; flex: 1 1 auto; padding: 0 24px; overscroll-behavior: contain; }
.template-field-review [data-slots] section { padding: 18px 0; border-bottom: 1px solid #e5e7eb; align-items: center; }
.template-field-review section p { margin: 6px 0 0; font-size: 14px; color: #58616c; overflow-wrap: anywhere; }
.template-field-review .template-review-target { min-width: 0; display: grid; gap: 8px; }
.template-field-review .template-review-empty { padding: 32px 0; text-align: center; color: #58616c; }
.template-field-review input:not([type=checkbox]), .template-field-review select { display: block; width: 100%; min-width: 0; max-width: 100%; height: 42px; margin: 0; padding: 8px 10px; border: 1px solid #cbd2da; border-radius: 4px; font: inherit; font-size: 16px; color: #20252b; background: #fff; box-shadow: none; }
.template-field-review button { display: inline-flex; align-items: center; justify-content: center; width: auto; flex: 0 0 auto; min-height: 40px; margin: 0; padding: 9px 14px; border: 1px solid #cbd2da; border-radius: 4px; background: #fff; color: #30363d; font: inherit; font-weight: 600; box-shadow: none; cursor: pointer; }
.template-field-review button:hover { background: #f4f5f7; transform: none; }
.template-field-review button:disabled { opacity: .5; cursor: default; }
.template-field-review [data-close] { width: 36px; height: 36px; min-height: 36px; padding: 0; border: 0; font-size: 24px; color: #626970; }
.template-field-review [data-publish] { background: #9f1c36; border-color: #9f1c36; color: #fff; }
.template-field-review [data-publish]:hover { background: #89192f; }
.template-field-review footer { border-top: 1px solid #d6dce3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.template-field-review .template-review-summary { display: grid; gap: 8px; color: #58616c; }
.template-field-review [data-publish-reason] { margin: 0; font-size: 13px; color: #9f1c36; }
.template-field-review [data-publish-reason]:empty { display: none; }
.template-field-review .template-review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.template-field-review label[data-approval], .template-field-review label[data-manual-approval] { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; font: inherit; color: #20252b; }
.template-field-review input[type=checkbox] { display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; margin: 0; padding: 0; accent-color: #9f1c36; }
.template-field-review [hidden] { display: none !important; }
.template-field-review.showing-sample .template-review-toolbar,
.template-field-review.showing-sample .template-review-auto,
.template-field-review.showing-sample .template-review-columns,
.template-field-review.showing-sample [data-slots] { display: none; }
.template-field-review [data-sample] { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; }
.template-field-review .template-sample-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; border-bottom: 1px solid #d6dce3; }
.template-field-review [data-viewer] { flex: 1 1 0; min-height: 0; }
.template-field-review [data-viewer] iframe { width: 100%; height: 100%; border: 0; }
.template-field-review .template-field-picker { width: 100%; min-width: 0; min-height: 42px; justify-content: space-between; gap: 12px; text-align: left; font-weight: 400; font-size: 16px; }
.template-field-picker span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-field-review .template-field-picker[aria-expanded="true"] { border-color: #9f1c36; box-shadow: 0 0 0 2px rgb(159 28 54 / 12%); }
.template-field-review .template-field-picker-menu { position: absolute; z-index: 10; display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid #cbd2da; border-radius: 6px; background: #fff; box-shadow: 0 8px 24px rgb(0 0 0 / 18%); }
.template-field-review .template-field-picker-menu input { flex: 0 0 42px; }
.template-field-review .template-field-picker-menu input:focus, .template-field-review .template-field-picker:focus-visible { outline: 2px solid #9f1c36; outline-offset: 1px; }
.template-field-picker-options { overflow: auto; min-height: 0; overscroll-behavior: contain; }
.template-field-picker-options [role="option"] { padding: 10px 12px; min-height: 40px; border-radius: 4px; overflow-wrap: anywhere; cursor: pointer; }
.template-field-picker-options [role="option"][aria-selected="true"] { color: #9f1c36; font-weight: 600; background: #faf0f2; }
.template-field-picker-options [role="option"]:hover, .template-field-picker-options [role="option"][data-active="true"] { background: #f3e3e7; color: #84172e; }
.template-field-picker-options p { margin: 12px; color: #58616c; }
@media (max-width: 600px) {
  dialog.template-field-review { width: calc(100vw - 24px); height: calc(100dvh - 24px); }
  .template-field-review header, .template-field-review footer { padding: 14px 16px; }
  .template-field-review h2 { font-size: 20px; }
  .template-field-review .template-review-steps { padding: 12px 16px; gap: 10px; justify-content: space-between; }
  .template-review-steps li { flex-direction: column; gap: 4px; font-size: 12px; text-align: center; }
  .template-field-review .template-review-steps [data-review-sample] { flex-direction: column; gap: 4px; }
  .template-field-review .template-review-toolbar { padding: 12px 16px; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .template-field-review [data-search] { grid-column: 1 / -1; }
  .template-field-review .template-review-columns { display: none; }
  .template-field-review [data-slots] { padding: 0 16px; }
  .template-field-review [data-slots] section { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .template-field-review .template-review-actions { width: 100%; }
  .template-field-review button { padding: 8px 10px; }
}
