/* Refined balance - setup page + description editor.
   Shared GLOBAL stylesheet. Load once after component/theme/app styles.
   Independent of the previous DCF styles; no generic .ff-refined overrides. */
.ff-refined.ff-setup {
    --ff-setup-accent: #236f70;
    --ff-setup-text: #203c40;
    --ff-setup-muted: #607579;
    --ff-setup-border: #dfe8e5;
    --ff-setup-panel: #fafbfc;
    --ff-setup-focus: #946348;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: clamp(16px, 2vw, 28px);
    border: 1px solid var(--ff-setup-border);
    border-radius: 12px;
    background: #fff;
    color: var(--ff-setup-text);
    font-family: Inter, var(--rz-text-font-family, system-ui), sans-serif;
    font-size: 13px;
    line-height: 1.6;
    container-type: inline-size;
    container-name: ff-setup-page;
}
.ff-setup, .ff-setup *, .ff-description-editor, .ff-description-editor * {
    box-sizing: border-box;
}
.ff-setup .ff-setup-page-heading {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ff-setup-border);
}
.ff-setup .ff-setup-eyebrow {
    margin: 0 0 18px;
    font-size: 11px;
    line-height: 1.6;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ff-setup-muted);
}
.ff-setup .ff-setup-page-heading .ff-setup-eyebrow { margin-bottom: 10px; }
.ff-setup .ff-setup-page-heading h2 {
    margin: 0 0 7px;
    font-size: 23px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -.025em;
}
.ff-setup .ff-setup-page-heading > p:last-child,
.ff-setup .ff-setup-description-heading > p:last-child {
    margin: 0;
    color: var(--ff-setup-muted);
    font-size: 12px;
    line-height: 1.8;
}
.ff-setup .ff-setup-notices {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 24px;
}
/* Native HTML owns the CSS grid. No RadzenRow display utility conflict. */
.ff-setup .ff-setup-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 26px;
    width: 100%;
    min-width: 0;
}
.ff-setup .ff-setup-settings {
    min-width: 0;
    width: 100%;
    padding: 24px;
    border: 1px solid var(--ff-setup-border);
    border-radius: 8px;
    background: var(--ff-setup-panel);
    height: auto;
    max-height: none;
    overflow: visible;
    container-type: inline-size;
    container-name: ff-setup-settings;
}
.ff-setup .ff-setup-section + .ff-setup-section {
    padding-top: 25px;
    margin-top: 25px;
    border-top: 1px solid var(--ff-setup-border);
}
.ff-setup .ff-setup-section-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 22px;
}
.ff-setup .ff-setup-section-heading > span {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 23px;
    height: 23px;
    border: 1px solid #ccdfd2;
    border-radius: 4px;
    color: #557566;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}
.ff-setup .ff-setup-section-heading h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
}
.ff-setup .ff-setup-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 22px 18px;
    width: 100%;
    min-width: 0;
}
/* Conditional RadzenColumn wrappers retain original Visible semantics.
   Explicit dimensions prevent theme column rules from setting width: 0. */
.ff-setup .ff-setup-fields > .ff-setup-field-cell {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    padding: 0;
    margin: 0;
    flex: initial;
    align-self: start;
}
.ff-setup .ff-setup-fields > .ff-setup-goodwill-fields {
    grid-column: 1 / -1;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    padding: 0;
    margin: 0;
    flex: initial;
}
.ff-setup .ff-setup-field {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    /* Deliberately preserve the inline guidance shadow. */
}
.ff-setup .ff-setup-field .rz-form-field-content {
    width: 100%;
    min-width: 0;
}
.ff-setup .ff-setup-field .rz-dropdown,
.ff-setup .ff-setup-field .rz-datepicker,
.ff-setup .ff-setup-field .rz-numeric {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 0%;
}
.ff-setup .ff-setup-field .rz-numeric-input,
.ff-setup .ff-setup-field .rz-datepicker > input {
    width: 100%;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}
.ff-setup .ff-setup-field .rz-dropdown-label {
    min-width: 0;
}
/* Labels use Radzen's nonfloating mode so longer captions have more room.
   Browser-test your theme's label presentation at 200% zoom. */
.ff-setup .ff-setup-field .rz-form-field-label {
    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    max-width: 100%;
}
.ff-setup .ff-setup-field-hint {
    margin: 0;
    color: var(--ff-setup-muted);
    font-size: 11px;
    line-height: 1.7;
}
/* Equal-height panels without a fixed 50vh or clipped form content. */
.ff-setup .ff-setup-description {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--ff-setup-border);
    border-radius: 8px;
    background: #fff;
}
.ff-setup .ff-setup-description-heading {
    padding: 24px;
    border-bottom: 1px solid var(--ff-setup-border);
}
.ff-setup .ff-setup-description-heading .ff-setup-eyebrow { margin-bottom: 10px; }
.ff-setup .ff-setup-description-heading h3 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: -.02em;
    margin: 0 0 7px;
}
.ff-setup .ff-setup-editor-host {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 480px;
}

/* The editor also works outside this page, using fallbacks instead of relying
   on setup-page inheritance. Original inline stretch-fix styles are replaced. */
.ff-description-editor {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 420px;
    color: var(--ff-setup-text, #203c40);
    font-family: Inter, var(--rz-text-font-family, system-ui), sans-serif;
}
.ff-description-editor .ff-description-editor-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 330px;
    padding: 20px 22px;
}
.ff-description-editor .ff-description-field {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100% !important;
    min-width: 0;
    min-height: 290px;
    margin: 0;
}
.ff-description-editor .ff-description-field .rz-form-field-content {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 290px;
}
.ff-description-editor .ff-description-textarea.rz-textarea {
    display: block;
    flex: 1 1 0%;
    align-self: stretch;
    width: 100% !important;
    min-width: 0;
    min-height: 290px;
    height: auto;
    max-height: none;
    padding: 16px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.9;
    color: var(--ff-setup-text, #203c40);
    background: #fff;
    overflow-y: auto;
}
.ff-description-editor .ff-description-loading {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    padding: 20px;
}
.ff-description-editor .ff-description-loading-label {
    display: block;
    margin-bottom: 20px;
    font-size: 12px;
    line-height: 1.7;
    color: var(--ff-setup-muted, #607579);
}
.ff-description-editor .ff-description-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    flex: 0 0 auto;
    gap: 10px;
    padding: 18px 22px 22px;
    border-top: 1px solid var(--ff-setup-border, #dfe8e5);
}
.ff-description-editor .ff-description-actions .rz-button {
    height: auto;
    min-height: 40px;
    max-width: 100%;
    padding: 10px 13px;
    border-radius: 5px;
    font-size: 12px;
    line-height: 1.5;
    /* Do not replace UiConstants.AiButtonColor or native disabled styling. */
}
.ff-description-editor .ff-description-actions .rz-button-text {
    white-space: normal;
    overflow-wrap: anywhere;
}
.ff-setup :focus-visible,
.ff-description-editor :focus-visible {
    outline: 2px solid var(--ff-setup-focus, #946348);
    outline-offset: 3px;
}
@container ff-setup-page (min-width: 920px) {
    .ff-setup .ff-setup-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container ff-setup-settings (min-width: 540px) {
    .ff-setup .ff-setup-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Below the breakpoints: one column, uniform widths, natural panel heights.
   Browsers without container queries also retain this safe default. */
@media (max-width: 600px) {
    .ff-refined.ff-setup { padding: 15px; border-radius: 8px; }
    .ff-setup .ff-setup-settings { padding: 18px; }
    .ff-setup .ff-setup-description-heading { padding: 20px; }
    .ff-setup .ff-setup-editor-host { min-height: 420px; }
    .ff-description-editor .ff-description-editor-body { padding: 18px; }
    .ff-description-editor .ff-description-actions { padding: 16px 18px 18px; flex-direction: column; }
    .ff-description-editor .ff-description-actions .rz-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .ff-description-editor .rz-skeleton,
    .ff-description-editor .rz-skeleton::before,
    .ff-description-editor .rz-skeleton::after { animation: none !important; }
}
