/* Shared form feedback uses the existing three-theme palette. */
:root{--form-error:#a51d32;--form-error-bg:#fff1f3;--form-error-border:#d58b96}
:root[data-theme="dark"]{--form-error:#ffbdc5;--form-error-bg:#38242d;--form-error-border:#b87b88}
:root[data-theme="paper"]{--form-error:#92213c;--form-error-bg:#fff1f4;--form-error-border:#cb8b9b}
.amis-field-error{margin:6px 0 0;max-width:72ch;color:var(--form-error);font-family:inherit;font-size:13px;font-weight:500;line-height:1.5;overflow-wrap:anywhere}
[data-amis-field-error]{border-color:var(--form-error)!important;outline-offset:3px}
[data-amis-field-error]:focus-visible{outline:2px solid var(--form-error)}
html body.experience-ui .amis-form-errors,.amis-form-errors{grid-column:1/-1;box-sizing:border-box;margin:0 0 20px;padding:16px 18px;border:1px solid var(--form-error-border);border-radius:10px;background:var(--form-error-bg);color:var(--form-error);line-height:1.5;max-width:80ch}
.amis-form-errors strong{font-size:15px}.amis-form-errors p{margin:6px 0 8px;font-size:14px}.amis-form-errors ul{margin:0;padding-left:20px}
.amis-form-errors button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-height:44px;width:100%;max-width:100%;padding:8px 4px;border:0;background:none;color:inherit;font:inherit;text-align:left;text-decoration:underline;text-underline-offset:3px;white-space:normal;cursor:pointer}
.amis-form-errors button:focus-visible{outline:2px solid currentColor;outline-offset:3px}
.experience-toast .amis-feedback-next{margin:8px 0 0;font-weight:500}.experience-toast details{margin-top:8px;font-size:12px;overflow-wrap:anywhere}.experience-toast summary{cursor:pointer}
.experience-toast [data-error-reference]{user-select:all;font-variant-numeric:tabular-nums}
.experience-ui label:has(>[data-amis-field-error]){align-self:start}
.experience-ui .workflow-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
@media(prefers-reduced-motion:no-preference){.amis-form-errors{animation:amis-feedback-reveal .16s ease-out}@keyframes amis-feedback-reveal{from{opacity:.7;transform:translateY(-3px)}to{opacity:1;transform:none}}}
@media(forced-colors:active){[data-amis-field-error],.amis-form-errors{border-color:CanvasText!important}.amis-field-error{color:CanvasText}}

.experience-ui #doMessage[data-feedback-tone="error"]{padding:12px 14px;border:1px solid var(--form-error-border);border-radius:8px;background:var(--form-error-bg);color:var(--form-error);line-height:1.5;overflow-wrap:anywhere}
.experience-ui #doMessage:empty{padding:0;border:0}

html body.experience-ui .amis-form-errors :is(strong,p,button,li){color:inherit}

html:root body.experience-ui .experience-toast.experience-status[data-kind="error"]{color:var(--form-error);background:var(--form-error-bg);border-color:var(--form-error-border)}
html:root body.experience-ui .experience-toast.experience-status[data-kind="error"] :is(p,strong,summary,details){color:inherit}

/* One spacing and interaction contract for form and calendar feedback. */
:root{--form-feedback-pad:16px;--form-feedback-gap:8px;--form-feedback-field-gap:6px;--form-feedback-radius:8px}
html body.experience-ui :is(.amis-form-errors,.rp-errors){display:grid;gap:var(--form-feedback-gap);width:100%;min-width:0;max-width:none;box-sizing:border-box;margin:0 0 16px;padding:var(--form-feedback-pad);border:1px solid var(--form-error-border);border-radius:var(--form-feedback-radius);background:var(--form-error-bg);color:var(--form-error);font:inherit;font-size:14px;line-height:1.5;overflow-wrap:anywhere}
html body.experience-ui :is(.amis-form-errors,.rp-errors)>strong{margin:0;font-size:16px;line-height:1.5}
html body.experience-ui :is(.amis-form-errors,.rp-errors)>p{margin:0;font-size:14px;line-height:1.5}
html body.experience-ui :is(.amis-form-errors,.rp-errors)>ul{display:grid;gap:0;margin:0;padding:0;list-style:none;max-block-size:320px;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
html body.experience-ui :is(.amis-form-errors,.rp-errors) li{min-width:0;margin:0;padding:0;color:inherit}
html body.experience-ui :is(.amis-form-errors,.rp-errors) li+li{border-top:1px solid var(--form-error-border)}
html body.experience-ui :is(.amis-form-errors button,.rp-errors .rp-error-link){display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:2px;width:100%;min-width:0;min-height:44px;box-sizing:border-box;padding:8px 4px;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;font-size:14px;line-height:1.5;text-align:start;white-space:normal;text-decoration:none;overflow-wrap:anywhere;cursor:pointer}
html body.experience-ui :is(.amis-form-errors button,.rp-errors .rp-error-link):hover{text-decoration:underline;text-underline-offset:3px}
html body.experience-ui :is(.amis-form-errors button,.rp-errors .rp-error-link):focus-visible{outline:2px solid currentColor;outline-offset:-2px}
.amis-error-label{font-weight:600;text-decoration:underline;text-underline-offset:3px}.amis-error-reason{font-weight:400}
html body.experience-ui :is(.amis-field-error,.rp-field-error,.rf-point-error,[data-date-entry-error]){display:block;flex-basis:100%;min-width:0;max-width:none;margin:6px 0 0;color:var(--form-error);font:inherit;font-size:14px;line-height:1.5;white-space:normal;overflow-wrap:anywhere}
html body.experience-ui [data-date-entry-error][hidden]{display:none}
html body.experience-ui :is(.stack,label,.workflow-field,.form-field,.form-group):has(>.amis-field-error){row-gap:6px}
html body.experience-ui :is(.stack,label,.workflow-field,.form-field,.form-group)>.amis-field-error,html body.experience-ui .rp-dialog label>.rp-field-error{margin-block-start:0}
html body.experience-ui .amis-date-entry [data-date-entry-years]{gap:8px;font-size:14px;line-height:1.5;align-items:center}
html body.experience-ui .amis-date-entry [data-date-entry-confirm]{min-height:44px;white-space:normal;line-height:1.4}
@media(max-width:600px){html body.experience-ui :is(.amis-form-errors,.rp-errors){padding:12px;gap:8px}html body.experience-ui :is(.amis-form-errors,.rp-errors)>ul{max-block-size:256px}}
@media(prefers-reduced-motion:reduce){html body.experience-ui :is(.amis-form-errors,.rp-errors){animation:none}}

html body.experience-ui .rp-dialog .rp-errors{margin-block-end:0}
html body.experience-ui .rp-dialog .rp-grid{align-items:start}

/* Standalone public forms use the same field corners and readable mobile type. */
[data-form-feedback] :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) {
  min-height: 44px;
  border-radius: 8px;
}
@media (max-width: 600px) {
  [data-form-feedback] :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) { font-size: 16px; }
}

/* Standalone forms share caption tracks, including captions with help buttons. */
[data-form-feedback] .field > :is(label,.context-help-label) {
  min-block-size: var(--context-help-target, 24px);
  align-items: center;
}
@supports (grid-template-rows: subgrid) {
  [data-form-feedback] .form-grid { row-gap: 0; }
  [data-form-feedback] .form-grid > .field {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
    row-gap: 7px;
    padding-block-end: 12px;
  }
}
[data-form-feedback] select:not([multiple]):not([size]) {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%23708095' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 12px;
  padding-inline-end: 40px;
}
@media (forced-colors: active) {
  [data-form-feedback] select:not([multiple]):not([size]) { appearance: auto; background-image: none; }
}
