/* Settings use their available content width, including when the main menu is open.
   Keep this after the Vite styles in app.blade.php. No build step is required. */
main:has(> .flex #brand-settings) {
    container: settings-page / inline-size;
    min-width: 0;
}
main:has(> .flex #brand-settings) > .flex:has(#brand-settings) {
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}
main:has(> .flex #brand-settings) > .flex:has(#brand-settings) > div {
    width: 100%;
    min-width: 0;
}
/* Let the document scroll rather than trapping a form in a short scroll box. */
main:has(> .flex #brand-settings) > .flex:has(#brand-settings) > div:last-child > div {
    height: auto;
    min-height: 0;
    overflow: visible;
}
main:has(> .flex #brand-settings) section {
    min-width: 0;
    overflow-wrap: anywhere;
}
#brand-settings {
    container: settings-brand / inline-size;
}
#brand-settings > div > div:last-child > .grid {
    grid-template-columns: minmax(0, 1fr);
}
#brand-settings > div > div:last-child > .grid > div {
    grid-column: auto;
    min-width: 0;
}
#brand-settings [class~="md:grid-cols-2"] {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}
#brand-settings [class~="sm:flex-nowrap"] {
    flex-wrap: wrap;
}
#brand-settings [class~="sm:flex-nowrap"] > input {
    flex: 1 1 12rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
#brand-settings [class~="sm:flex-nowrap"] > div {
    flex-wrap: wrap;
    max-width: 100%;
}
#brand-settings .sticky {
    position: static;
}
#brand-settings img {
    max-width: 100%;
}
@container settings-page (min-width: 68rem) {
    main:has(> .flex #brand-settings) > .flex:has(#brand-settings) {
        flex-direction: row;
    }
    main:has(> .flex #brand-settings) > .flex:has(#brand-settings) > div:first-child {
        width: 15rem;
    }
    main:has(> .flex #brand-settings) > .flex:has(#brand-settings) > div:last-child {
        width: auto;
    }
}
@container settings-brand (min-width: 64rem) {
    #brand-settings > div > div:last-child > .grid {
        grid-template-columns: minmax(0, 2fr) minmax(17rem, 1fr);
    }
}
/* The desktop account header must wrap too on narrow phones. */
@media (max-width: 639px) {
    main:has(> main #brand-settings) > header {
        flex-wrap: wrap;
    }
    main:has(> .flex #brand-settings) {
        padding-inline: .75rem;
    }
    #brand-settings > div > div:first-child {
        flex-wrap: wrap;
    }
}
