/* Shared feedback roles keep forms, service notices and toasts consistent. */
:root{
  --feedback-info-text:#172f40;
  --feedback-info-background:#edf2f3;
  --feedback-info-border:#718895;
  --feedback-progress-text:#485d6b;
  --feedback-progress-background:#edf2f3;
  --feedback-progress-border:#718895;
  --feedback-success-text:#276842;
  --feedback-success-background:#edf6ef;
  --feedback-success-border:#376b50;
  --feedback-warning-text:#7f451f;
  --feedback-warning-background:#fff4e9;
  --feedback-warning-border:#a15b2c;
  --feedback-error-text:#9b3525;
  --feedback-error-background:#fff2ed;
  --feedback-error-border:#9b3525;
  --feedback-focus:#a64b24;
  --feedback-hover:#e1e8eb;
}
html.portal-dark{
  --feedback-info-text:#f5f5f5;
  --feedback-info-background:#2a2a2a;
  --feedback-info-border:#9e9e9e;
  --feedback-progress-text:#c4c4c4;
  --feedback-progress-background:#2a2a2a;
  --feedback-progress-border:#9e9e9e;
  --feedback-success-text:#a1e7b5;
  --feedback-success-background:#203e32;
  --feedback-success-border:#a1e7b5;
  --feedback-warning-text:#ffda8b;
  --feedback-warning-background:#4b3520;
  --feedback-warning-border:#ffda8b;
  --feedback-error-text:#ffb6a3;
  --feedback-error-background:#472c29;
  --feedback-error-border:#ffb6a3;
  --feedback-focus:#ffda8b;
  --feedback-hover:#383838;
}

html body.visual-refresh :is(.error-text,.account-error,.discover-error,.admin-main>#admin-error):not(:empty),
html body.visual-refresh #modal :is(#auth-error,#email-error,#ad-error):not(:empty){
  --feedback-current-text:var(--feedback-error-text);
  --feedback-current-background:var(--feedback-error-background);
  --feedback-current-border:var(--feedback-error-border);
}
html body.visual-refresh :is(.account-success,.discover-form-success,.comm-form [data-comm-status]):not(:empty){
  --feedback-current-text:var(--feedback-success-text);
  --feedback-current-background:var(--feedback-success-background);
  --feedback-current-border:var(--feedback-success-border);
}
html body.visual-refresh :is(.notice,.finance-warning,.backend-status,.account-moderation-notice):not(:empty){
  --feedback-current-text:var(--feedback-warning-text);
  --feedback-current-background:var(--feedback-warning-background);
  --feedback-current-border:var(--feedback-warning-border);
}
html body.visual-refresh :is(.error-text,.account-error,.discover-error,.admin-main>#admin-error,.account-success,.discover-form-success,.comm-form [data-comm-status],.notice,.finance-warning,.backend-status,.account-moderation-notice):not(:empty),
html body.visual-refresh #modal :is(#auth-error,#email-error,#ad-error,.notice,.finance-warning):not(:empty){
  box-sizing:border-box;
  min-width:0;
  max-width:100%;
  padding:12px 16px;
  margin-block:16px;
  border:1px solid var(--feedback-current-border);
  border-left-width:3px;
  border-radius:10px;
  background:var(--feedback-current-background);
  color:var(--feedback-current-text);
  font-size:14px;
  line-height:1.7;
  overflow-wrap:anywhere;
  text-align:start;
  opacity:1;
}
html body.visual-refresh :is(.error-text,.account-success,.discover-form-success,.comm-form [data-comm-status],.backend-status):empty{display:none}
html body.visual-refresh :is(.account-error,.discover-error) :is(p,h3,h4){color:inherit}
html body.visual-refresh :is(.account-error,.discover-error)>:first-child{margin-top:0}
html body.visual-refresh :is(.account-error,.discover-error)>:last-child{margin-bottom:0}
html body.visual-refresh :is(.error-text,.account-error,.discover-error,.account-success,.discover-form-success,.notice,.finance-warning,.backend-status,.account-moderation-notice) a:not(.button){color:inherit;text-decoration:underline;text-underline-offset:3px}
html body.visual-refresh :is(.error-text,.account-error,.discover-error,.account-success,.discover-form-success,.notice,.finance-warning,.backend-status,.account-moderation-notice):focus-visible{
  outline:3px solid var(--feedback-focus);
  outline-offset:3px;
}
/* Legacy moderation cards pin these properties with !important. */
html body.visual-refresh .account-page .account-content .account-moderation-notice{
  padding:12px 16px!important;
  color:var(--feedback-warning-text)!important;
}

html body.visual-refresh #ad-form :is(#upload-status,#pdf-upload-status)[data-feedback-tone]:not(:empty),
html body.visual-refresh #ad-form .draft-save-state[data-error=true]:not(:empty){
  box-sizing:border-box;
  min-width:0;
  max-width:100%;
  padding:12px 16px;
  margin-block:16px;
  border:1px solid var(--feedback-current-border);
  border-left-width:3px;
  border-radius:10px;
  background:var(--feedback-current-background);
  color:var(--feedback-current-text);
  font-size:14px;
  line-height:1.7;
  overflow-wrap:anywhere;
  opacity:1;
}
html body.visual-refresh #ad-form :is(#upload-status,#pdf-upload-status)[data-feedback-tone=error],
html body.visual-refresh #ad-form .draft-save-state[data-error=true]{
  --feedback-current-text:var(--feedback-error-text);
  --feedback-current-background:var(--feedback-error-background);
  --feedback-current-border:var(--feedback-error-border);
}
html body.visual-refresh #ad-form :is(#upload-status,#pdf-upload-status)[data-feedback-tone=success]{
  --feedback-current-text:var(--feedback-success-text);
  --feedback-current-background:var(--feedback-success-background);
  --feedback-current-border:var(--feedback-success-border);
}
html body.visual-refresh #ad-form :is(#upload-status,#pdf-upload-status)[data-feedback-tone=progress]{
  --feedback-current-text:var(--feedback-progress-text);
  --feedback-current-background:var(--feedback-progress-background);
  --feedback-current-border:var(--feedback-progress-border);
}
html body.visual-refresh #ad-form :is(#upload-status,#pdf-upload-status,.draft-save-state):empty{display:none}

html body.visual-refresh .toast{
  --feedback-current-text:var(--feedback-info-text);
  --feedback-current-background:var(--feedback-info-background);
  --feedback-current-border:var(--feedback-info-border);
  display:grid;
  grid-template-columns:minmax(0,1fr) 44px;
  align-items:center;
  gap:12px;
  box-sizing:border-box;
  width:max-content;
  max-width:min(560px,calc(100% - 32px));
  max-height:min(50dvh,360px);
  overflow-y:auto;
  overscroll-behavior:contain;
  min-width:0;
  position:fixed;
  z-index:50;
  left:50%;
  bottom:max(16px,env(safe-area-inset-bottom));
  transform:translateX(-50%);
  padding:12px;
  border:1px solid var(--feedback-current-border);
  border-left-width:3px;
  border-radius:10px;
  background:var(--feedback-current-background);
  color:var(--feedback-current-text);
  box-shadow:0 8px 28px #00000026;
  font-size:14px;
  line-height:1.65;
  overflow-wrap:anywhere;
  pointer-events:auto;
}
html body.visual-refresh .toast[data-tone=success]{
  --feedback-current-text:var(--feedback-success-text);
  --feedback-current-background:var(--feedback-success-background);
  --feedback-current-border:var(--feedback-success-border);
}
html body.visual-refresh .toast[data-tone=warning]{
  --feedback-current-text:var(--feedback-warning-text);
  --feedback-current-background:var(--feedback-warning-background);
  --feedback-current-border:var(--feedback-warning-border);
}
html body.visual-refresh .toast[data-tone=error]{
  --feedback-current-text:var(--feedback-error-text);
  --feedback-current-background:var(--feedback-error-background);
  --feedback-current-border:var(--feedback-error-border);
}
html body.visual-refresh .toast.in-dialog{
  flex:0 0 auto;
  max-height:min(28dvh,240px);
  position:sticky;
  left:auto;
  right:auto;
  bottom:12px;
  transform:none;
  margin:12px auto;
  max-width:min(560px,calc(100% - 32px));
}
html body.visual-refresh .toast[hidden]{display:none}
html body.visual-refresh .toast-message{min-width:0;overflow-wrap:anywhere;white-space:pre-line}
html body.visual-refresh .toast-close{
  position:sticky;
  top:0;
  align-self:start;
  display:grid;
  place-items:center;
  width:44px;
  height:44px;
  min-width:44px;
  min-height:44px;
  padding:0;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:inherit;
  cursor:pointer;
}
html body.visual-refresh .toast-close :is(svg,.icon){display:block;width:18px;height:18px;margin:0;pointer-events:none}
html body.visual-refresh .toast-close:hover{background:var(--feedback-hover);color:var(--feedback-current-text)}
html body.visual-refresh .toast-close:focus-visible{outline:3px solid var(--feedback-focus);outline-offset:2px}

/* These scoped declarations outrank older dark component palettes loaded later. */
html.portal-dark body.visual-refresh :is(.error-text,.account-error,.discover-error,.admin-main>#admin-error,.account-success,.discover-form-success,.comm-form [data-comm-status],.notice,.finance-warning,.backend-status,.account-moderation-notice):not(:empty),
html.portal-dark body.visual-refresh .toast{
  background:var(--feedback-current-background);
  color:var(--feedback-current-text);
  border-color:var(--feedback-current-border);
}
html.portal-dark body.visual-refresh :is(.account-error,.discover-error) :is(p,h3,h4){color:inherit}
html.portal-dark body.visual-refresh #ad-form :is(#upload-status,#pdf-upload-status)[data-feedback-tone]:not(:empty),
html.portal-dark body.visual-refresh #ad-form .draft-save-state[data-error=true]:not(:empty){
  background:var(--feedback-current-background);
  color:var(--feedback-current-text);
  border-color:var(--feedback-current-border);
}
