/* U3 isolated gallery — two-pane on iPad/desktop; compact selector above preview on phones. */
#modal-root:has(.u3-gallery) .modal{width:min(1060px,calc(100vw - 28px))!important;max-width:none!important;max-height:min(88dvh,920px)!important;overflow:hidden!important;padding:0!important;border-radius:27px!important;background:rgba(247,250,249,.92)!important;-webkit-backdrop-filter:blur(30px);backdrop-filter:blur(30px)}
.u3-gallery{display:flex;flex-direction:column;height:min(85dvh,850px);min-height:480px;color:var(--text,#142c29)}
.u3-gallery-heading{display:flex;justify-content:space-between;align-items:center;padding:19px 22px 15px;border-bottom:1px solid rgba(95,124,116,.13)}
.u3-gallery-heading h2{font-size:22px;margin:0;letter-spacing:-.025em}.u3-gallery-close{width:38px;height:38px;min-width:38px;border:0;border-radius:50%;background:rgba(255,255,255,.73);font-size:25px;color:inherit;cursor:pointer}
.u3-gallery-body{display:grid;grid-template-columns:minmax(230px,33%) minmax(0,1fr);flex:1;min-height:0}
.u3-gallery-sidebar{display:flex;flex-direction:column;min-width:0;min-height:0;border-right:1px solid rgba(95,124,116,.17);background:rgba(227,237,234,.31)}
.u3-gallery-search-wrap{padding:15px 12px 10px}.u3-gallery-search-wrap input{width:100%;border:1px solid rgba(111,144,134,.22);border-radius:12px;background:rgba(255,255,255,.72);padding:12px;font-size:14px;color:inherit;outline-offset:1px}
.u3-gallery-sidebar-scroll{overflow-y:auto;min-height:0;overscroll-behavior:contain;padding:2px 9px 12px}.u3-gallery-list-title{display:flex;justify-content:space-between;gap:5px;align-items:center;padding:7px 9px 9px;font-size:12px;font-weight:800}.u3-gallery-list-title small{font-size:10px;color:var(--muted,#77817f);font-weight:500}
.u3-gallery-items{display:flex;flex-direction:column;gap:4px}.u3-gallery-option{display:flex;gap:10px;align-items:center;width:100%;min-height:61px;padding:8px 9px;border-radius:13px;border:1px solid transparent;background:transparent;color:inherit;text-align:left;cursor:pointer}.u3-gallery-option:hover,.u3-gallery-option.selected{background:rgba(255,255,255,.74);border-color:rgba(13,117,86,.24)}.u3-gallery-option.selected{box-shadow:inset 3px 0 #0c795c}.u3-gallery-option[hidden]{display:none!important}
.u3-gallery-list-icon{width:35px;height:35px;border-radius:11px;background:#d6ebe4;display:grid;place-items:center;color:#096a50;font-size:18px;flex-shrink:0}.u3-gallery-list-copy{min-width:0;flex:1;display:flex;flex-direction:column;gap:2px}.u3-gallery-list-copy b{font-size:12px;font-weight:740}.u3-gallery-list-copy small{font-size:10px;color:var(--muted,#667973);line-height:1.25}.u3-gallery-option em{font-size:9px;color:#096c55;white-space:nowrap;font-style:normal}
.u3-gallery-manage{margin:8px 12px 14px;padding:12px;border:1px solid rgba(12,101,76,.16);border-radius:11px;background:rgba(255,255,255,.75);color:#09664d;font-weight:720;font-size:12px;cursor:pointer}
.u3-gallery-inspector{min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:24px 26px;display:flex;flex-direction:column;gap:14px}
.u3-gallery-inspector-head{text-align:center}.u3-gallery-inspector-head b{font-size:19px}.u3-gallery-inspector-head p{color:var(--muted,#64746b);font-size:12px;margin:5px 0 0}
.u3-gallery-preview{border:1px solid rgba(143,165,159,.18);border-radius:20px;background:rgba(197,215,209,.23);min-height:155px;flex:1;display:grid;place-items:center;overflow:hidden;padding:19px 12px}
.u3-gallery-preview-frame{width:min(100%,500px);min-width:0;pointer-events:none}.u3-gallery-preview-frame.widget-small{max-width:230px}.u3-gallery-preview-frame.widget-medium{max-width:350px}.u3-gallery-preview-frame.widget-large{max-width:510px}.u3-gallery-preview-frame>.home-widget{width:100%;max-width:100%;grid-column:auto!important}.u3-gallery-preview-frame .card{margin:0!important}
.u3-gallery-size-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.u3-gallery-size-options button{background:rgba(255,255,255,.81);border:1px solid rgba(113,148,136,.19);border-radius:13px;color:inherit;font-size:12px;font-weight:700;padding:13px 8px;cursor:pointer}.u3-gallery-size-options button.chosen{background:#e4f6e9;border:2px solid #439a75;color:#08573f}
.u3-gallery-add-row{margin-top:auto;display:flex;flex-direction:column;gap:7px}.u3-gallery-add{width:100%;padding:14px 10px;border-radius:13px;background:#087354;border:0;color:#fff;font-size:14px;font-weight:750;cursor:pointer}.u3-gallery-add:disabled{background:#a9c5b8;color:#335d4e;cursor:default}.u3-gallery-feedback{min-height:15px;font-size:11px;text-align:center;color:#126c51}
@media(max-width:600px){#modal-root:has(.u3-gallery) .modal{width:calc(100vw - 16px)!important;max-height:94dvh!important;border-radius:22px!important}.u3-gallery{height:90dvh;min-height:0}.u3-gallery-heading{padding:12px 15px}.u3-gallery-heading h2{font-size:17px}.u3-gallery-body{display:flex;flex-direction:column}.u3-gallery-sidebar{border-right:0;border-bottom:1px solid rgba(95,124,116,.18);height:185px;flex-shrink:0}.u3-gallery-search-wrap{padding:7px 11px 5px}.u3-gallery-search-wrap input{font-size:12px;padding:8px 11px}.u3-gallery-sidebar-scroll{padding:0 8px;overflow-x:auto;overflow-y:hidden}.u3-gallery-list-title{display:none}.u3-gallery-items{flex-direction:row;width:max-content;gap:6px;padding-bottom:4px}.u3-gallery-option{width:146px;min-height:76px;align-items:start;padding:7px}.u3-gallery-list-icon{width:29px;height:29px;font-size:14px}.u3-gallery-list-copy b{font-size:11px}.u3-gallery-list-copy small{display:none}.u3-gallery-option em{position:absolute;margin-top:43px;margin-left:33px}.u3-gallery-manage{margin:2px 8px 7px;padding:5px;font-size:10px}.u3-gallery-inspector{padding:11px 12px;gap:9px}.u3-gallery-inspector-head b{font-size:15px}.u3-gallery-inspector-head p{font-size:11px}.u3-gallery-preview{min-height:115px;padding:10px}.u3-gallery-size-options button{padding:10px 6px}.u3-gallery-add{padding:11px}}
@media(prefers-reduced-motion:reduce){.u3-gallery *{transition:none!important}}
/* Keep the preview/action region full-height on phones rather than leaving a blank footer. */
@media(max-width:600px){.u3-gallery-inspector{flex:1 1 0;min-height:0}.u3-gallery-preview{flex:1 1 auto;min-height:130px}.u3-gallery-add-row{margin-top:0}}

/* U3 gallery: semantically relevant line artwork; accessible text remains the label. */
.u3-gallery-list-icon{background:rgba(10,115,84,.085);color:#176b53;border:1px solid rgba(17,114,84,.06)}
.u3-gallery-list-icon .u3-gallery-svg{display:block;flex:none;width:19px;height:19px}
.u3-gallery-option.selected .u3-gallery-list-icon{background:rgba(10,115,84,.15)}

/* Configure list depth at the point of adding a widget, without a second modal. */
.u3-gallery-items-option{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:12px;font-weight:720}
.u3-gallery-count-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;min-width:190px;flex:1}
.u3-gallery-count-options button{background:rgba(255,255,255,.84);border:1px solid rgba(113,148,136,.19);border-radius:12px;color:inherit;font-size:12px;font-weight:700;padding:11px 8px;cursor:pointer}
.u3-gallery-count-options button.chosen{background:#e4f6e9;border:2px solid #439a75;color:#08573f}
@media(max-width:600px){.u3-gallery-items-option{gap:6px}.u3-gallery-count-options button{padding:8px 5px}}

/* U3 iPhone QA: keep horizontal swipes within the widget rail. */
@media(max-width:600px){
 .u3-gallery,.u3-gallery-body,.u3-gallery-sidebar,.u3-gallery-inspector{width:100%;min-width:0;max-width:100%;box-sizing:border-box;overflow-x:hidden}
 .u3-gallery-sidebar-scroll{width:100%;box-sizing:border-box;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;touch-action:pan-x}
 .u3-gallery-option{position:relative;flex:0 0 148px;box-sizing:border-box;scroll-snap-align:start}
 .u3-gallery-option em{position:absolute;left:35px;bottom:8px;margin:0;font-size:10px}
 .u3-gallery-preview-frame{max-width:100%}
}

/* 2026-10-29 Home completion: stable, legible iPhone picker. */
@media(max-width:600px){
  #modal-root:has(.u3-gallery) .modal{max-width:calc(100vw - 16px)!important;overscroll-behavior-x:none!important;touch-action:pan-y}
  .u3-gallery{overflow-x:clip;overscroll-behavior-x:none}
  .u3-gallery-body{overflow-x:clip}
  .u3-gallery-sidebar{height:177px;flex:0 0 177px;overflow-x:clip}
  .u3-gallery-sidebar-scroll{overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scroll-snap-type:x proximity;touch-action:pan-x;-webkit-overflow-scrolling:touch}
  .u3-gallery-items{gap:8px;padding:2px 3px 8px}
  .u3-gallery-option{width:175px;flex:0 0 175px;min-height:80px;overflow:hidden;scroll-snap-align:start;padding:9px}
  .u3-gallery-list-copy b{font-size:12px;line-height:1.23;white-space:normal;overflow-wrap:anywhere}
  .u3-gallery-option .u3-gallery-added{left:44px;bottom:7px;font-size:10px;font-weight:750;line-height:1;color:#086849}
  .u3-gallery-inspector{overflow-x:clip;overscroll-behavior-y:contain;padding:11px 12px 15px;gap:9px}
  .u3-gallery-preview{flex:0 1 auto;min-height:175px;max-height:min(33dvh,270px);padding:12px 8px}
  .u3-gallery-preview-frame{max-height:100%;overflow:visible}
  .u3-gallery-add-row{margin-top:auto;flex-shrink:0}
}

/* Keep the phone sheet content-focused rather than forcing an empty, tall footer.
   Advanced settings live in the direct Home editing toolbar, not the picker. */
@media(max-width:600px){
  .u3-gallery{height:auto;max-height:90dvh;min-height:0}
  .u3-gallery-heading{flex-shrink:0}
  .u3-gallery-body{flex:0 1 auto;max-height:calc(90dvh - 65px);min-height:0;overflow:hidden}
  .u3-gallery-sidebar{height:144px;flex:0 0 144px}
  .u3-gallery-inspector{flex:1 1 auto;min-height:0;max-height:calc(90dvh - 210px);overflow-y:auto;overscroll-behavior-y:contain}
  .u3-gallery-preview{flex:0 1 auto;min-height:155px;max-height:245px}
  .u3-gallery-add-row{margin-top:6px;flex-shrink:0}
}
/* iOS Safari avoids focusing/zooming the entire page when inputs are >=16px. */
@media(max-width:600px){.u3-gallery-search-wrap input{font-size:16px!important}}
