#pe-brief, #pe-brief .ba-field, #pe-brief .ba-box { min-width: 0; max-width: 100%; }
#pe-brief [data-chips] { display: flex; flex-wrap: wrap; gap: 8px; overflow: visible; max-width: 100%; }
#pe-brief [data-chips] button { max-width: 100%; white-space: normal; }

.ba-field > label { display: block; margin: 0 0 8px; font-weight: 700; }
.ba-box { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: #1e1e20; color: #f5f2ec; box-sizing: border-box; }
.ba-box:focus-within { outline: 1px solid #77736f; outline-offset: 1px; }
.ba-box.ba-dragover { outline: 2px dashed var(--brand-red); background: color-mix(in srgb, var(--brand-red) 10%, var(--panel, #1e1e20)); }
.pe .ba-box textarea { display: block; box-sizing: border-box; width: 100%; min-width: 0; min-height: 60px; margin: 0; padding: 4px 2px; border: 0; border-radius: 0; resize: none; background: transparent; color: #f5f2ec; font: inherit; font-size: 16px; line-height: 1.45; outline: 0; box-shadow: none; }
.ba-box textarea::placeholder { color: #a9a6a0; opacity: 1; }
.ba-box input[hidden], .ba-pages[hidden] { display: none !important; }
.ba-pages { display: flex; gap: 8px; min-width: 0; max-width: 100%; margin: 0; padding: 6px 4px; overflow-x: auto; list-style: none; scrollbar-width: thin; }
.ba-pages li { position: relative; flex: 0 0 64px; width: 64px; height: 64px; padding: 0; margin: 0; }
.pe .ba-pages .ba-open { display: block; width: 64px; height: 64px; min-width: 0; min-height: 0; padding: 0; position: relative; overflow: hidden; border: 0; border-radius: 10px; color: #f5f2ec; background: #2a2a2d; -webkit-touch-callout: none; user-select: none; }
.ba-pages .ba-open img { width: 100%; height: 100%; display: block; object-fit: cover; user-select: none; -webkit-touch-callout: none; }
.pe .ba-pages .ba-remove { display: grid; place-items: center; position: absolute; right: -3px; top: -4px; z-index: 1; width: 24px; height: 24px; min-width: 24px; min-height: 24px; padding: 0; border: 1px solid #797673; border-radius: 50%; background: #1e1e20; color: #fff; }
.ba-remove svg { width: 13px; height: 13px; }
.ba-index { position: absolute; bottom: 3px; left: 3px; min-width: 17px; padding: 1px 3px; box-sizing: border-box; border-radius: 5px; background: #121212dc; color: #fff; text-align: center; font-size: 11px; font-weight: 700; line-height: 15px; }
.ba-spinner { position: absolute; top: 50%; left: 50%; width: 21px; height: 21px; margin: -11px; box-sizing: border-box; border: 3px solid #f5f2ec; border-top-color: var(--brand-red); border-radius: 50%; background: #1e1e20bb; box-shadow: 0 0 0 2px #1e1e20bb; animation: ba-spin .8s linear infinite; }
.ba-dragging { user-select: none; }
.ba-destination .ba-open { outline: 2px solid var(--brand-red); }
.ba-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.pe .ba-actions button.ba-icon { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: 0; padding: 0; box-sizing: border-box; border: 0; border-radius: 50%; background: #2a2a2d; color: #f5f2ec; }
.pe .ba-actions button[data-record] { background: var(--brand-red); color: #121212; }
.ba-actions svg { width: 22px; height: 22px; }
.ba-box button:focus-visible, .ba-view button:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }
.ba-status { font-size: .85rem; margin: 6px 0 0; color: #a9a6a0; }
.ba-status:empty { display: none; }
.ba-status.ba-error { color: #f2b33d; }
#pe-brief.ba-keyboard .pe-bottom { position: static; transform: none; width: 100%; max-width: 100%; margin-top: 12px; }
.ba-view { position: fixed; inset: 0; margin: 0; padding: 0; box-sizing: border-box; width: 100%; max-width: 100%; height: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; color: #f5f2ec; background: #121212; }
.ba-view[open] { display: flex; flex-direction: column; }
.ba-view::backdrop { background: #121212; }
.ba-view-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: #1e1e20; }
.ba-view-tools > div { display: flex; gap: 4px; }
.ba-view-tools button { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: #2a2a2d; color: #f5f2ec; }
.ba-view-tools button:disabled { opacity: .35; }
.ba-view-port { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; }
.ba-view .ba-zoom { display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: zoom-in; }
.ba-view .ba-zoom img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.ba-view.ba-zoomed .ba-zoom { width: 200%; height: 200%; cursor: zoom-out; }
@keyframes ba-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ba-spinner { animation: none; } }

.pe .az-voice {
  display:flex; align-items:center; gap:6px; min-width:0; padding:6px 8px;
  background:#1e1e20; border:1px solid #38383b; border-radius:18px;
}
.pe .az-voice[hidden], .pe .az-voice button[hidden] { display:none; }
.az-voice-time { color:#f5f2ec; font-size:.85rem; font-variant-numeric:tabular-nums; }
.az-voice-wave { display:flex; align-items:center; gap:2px; height:30px; flex:1; min-width:0; overflow:hidden; }
.az-voice-wave i { flex:1 0 2px; max-width:4px; height:100%; border-radius:8px; background:var(--brand-red); transform:scaleY(var(--level,.12)); transition:transform 65ms linear; }
.az-voice:not([data-phase=recording]) .az-voice-wave { opacity:.48; }
.pe .az-voice button { display:grid; place-items:center; flex:0 0 44px; width:44px; padding:0; margin:0; touch-action:manipulation; }
.pe .az-voice [data-send] { border-radius:50%; }
.pe .az-voice [data-stop] { border-radius:10px; }
html[data-keyboard-open] .pe .az-voice { position:sticky; bottom:calc(var(--voice-inset,0px) + 8px); z-index:6; }
.pe [data-draft-busy]::before { content:''; display:inline-block; width:.75em; height:.75em; margin-right:.5em; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:ba-spin .8s linear infinite; vertical-align:-.12em; }
.pe [data-record-status]:empty, .pe [data-error]:empty { display:none; }
@media (prefers-reduced-motion:reduce) {
  .az-voice-wave i { transition:none; }
  .pe [data-draft-busy]::before { animation:none; }
}

.pe .az-voice { border-radius:24px; gap:4px; }
.pe .az-voice [data-discard-voice] { border-radius:50%; font-size:1.35rem; }
.pe .az-voice [data-send] { background:#ee6a68; color:#121212; }
.az-voice-wave i { flex-basis:1px; max-width:2px; background:#ee6a68; }
.pe textarea.az-voice-notes { field-sizing:content; max-height: min(260px, 45dvh); overflow-y:auto; }

.pe.pb-build { max-width:760px; margin-inline:auto; padding-bottom:102px; }
.pb-build [hidden] { display:none !important; }
.pb-build svg { width:22px; height:22px; flex:none; }
.pb-heading { display:flex; align-items:center; gap:8px; min-height:44px; margin:0; }
.pb-heading h2 { font-family:Oswald,sans-serif; font-weight:700; text-transform:uppercase; }
.pb-build .pb-heading button { display:grid; place-items:center; border:0; background:none; padding:0; width:36px; min-height:44px; }
.pb-client,.pb-kit { background:#1e1e20; border-radius:16px; padding:14px; min-width:0; }
.pb-client { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:10px; align-items:center; }
.pb-avatar { display:grid; place-items:center; width:44px; height:44px; border-radius:50%; background:var(--brand-red); color:#121212; font-size:1rem; font-weight:800; }
.pb-client strong,.pb-client small { display:block; overflow-wrap:anywhere; }
.pb-client select { width:auto; min-width:0; max-width:143px; margin:0; }
.pb-fields { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.pb-fields label { display:flex; align-items:center; gap:9px; min-width:0; margin:0; border-radius:13px; padding:8px 10px; border:1px solid #333337; background:#1e1e20; font-size:.78rem; font-weight:700; }
.pb-fields label>svg,.pb-kit-group summary svg,.pb-kit-photos>strong svg { color:var(--brand-red); }
.pb-fields label>span { flex:1; min-width:0; }
.pb-build .pb-fields select { display:block; background:transparent; border:0; margin:0; padding:0 14px 0 0; color:inherit; font-weight:800; min-height:30px; }
.pb-build .pb-client select { border:1px solid #55555a; border-radius:10px; padding:7px 24px 7px 7px; min-height:44px; background-color:#232326; color:inherit; }
.pb-build select { font-size:16px; }
.pb-build select:disabled { opacity:1; appearance:none; }
.pb-kit h3 { margin:0; font:800 1.18rem/1.2 'DM Sans',sans-serif; }
.pb-kit-head { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; flex-wrap:wrap; margin-bottom:6px; }
.pb-kit-head p { margin:5px 0 0; color:#c8c5bf; font-size:.82rem; }
.pb-kit-head p i,.pb-kit-pills i { display:inline-grid; place-items:center; width:17px; height:17px; border-radius:50%; background:#5bc489; color:#121212; font-style:normal; font-size:.72rem; font-weight:900; vertical-align:middle; flex:none; }
.pb-build .pb-kit-head button { display:flex; align-items:center; gap:5px; border:1px solid #55555a; padding:5px 8px; min-height:44px; border-radius:10px; font-size:.76rem; }
.pb-kit-head button svg { width:16px; height:16px; }
.pb-kit-group+.pb-kit-group,.pb-kit-photos { border-top:1px solid #38383b; }
.pb-kit-group summary { display:flex; align-items:center; gap:10px; padding:7px 0; min-height:44px; list-style:none; font-size:.94rem; cursor:pointer; }
.pb-kit-group summary::-webkit-details-marker { display:none; }
.pb-kit-group summary::after { content:''; width:7px; height:7px; border:solid #b8b4af; border-width:0 1.5px 1.5px 0; transform:rotate(45deg); margin-inline-start:auto; margin-inline-end:4px; }
.pb-kit-group[open] summary::after { transform:rotate(225deg); }
.pb-kit-pills { display:flex; flex-wrap:wrap; gap:6px; padding:0 0 10px 31px; }
.pb-kit-pills span { display:inline-flex; align-items:center; gap:6px; max-width:100%; padding:4px 9px; border-radius:999px; border:1px solid #49494d; background:#262629; font-size:.78rem; font-weight:700; overflow-wrap:anywhere; min-width:0; }
.pb-kit-pills i { background:var(--brand-red); }
.pb-kit-photos { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:7px; padding-top:6px; }
.pb-kit-photos>strong { display:flex; align-items:center; gap:10px; font-size:.94rem; }
.pb-kit-photos .kit-gallery { flex:1 1 130px; min-width:0; padding-block:4px; }
.pb-kit-photos .kit-gallery a { flex-basis:66px; }
.pb-kit-photos .kit-gallery img { width:66px; height:46px; border-radius:8px; }
.pb-build .pe-bottom button[type=submit] { flex:1 1 55%; }
.pb-build .pe-bottom button[data-scratch] { flex:1 1 40%; }
[data-brief-kit-editor] .kit-screen { padding-bottom:12px; }
@media(max-width:380px){
  .pb-client { padding:10px; gap:7px; }
  .pb-avatar { width:36px; height:36px; }
  .pb-build .pb-client select { max-width:120px; font-size:14px; padding-inline:5px; }
  .pb-kit-pills { padding-inline-start:0; }
}
