html:has(#brief[open]) { overflow: hidden; }
#brief {
  --brief-line: #e3dfdf;
  --brief-ink: #292129;
  --brief-muted: #605964;
  color: var(--brief-ink);
  width: min(960px, calc(100% - 40px));
  max-width: none;
  max-height: min(88dvh, 860px);
  box-sizing: border-box;
  padding: 0;
  border: 1px solid #ffffffb0;
  border-radius: 30px;
  margin: auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 30px 100px -32px #2519275c;
}
#brief::backdrop { background: #20182766; backdrop-filter: blur(6px); }
#brief-form { margin:0; max-height:inherit; display:flex; flex-direction:column; }
.brief-head, .brief-actions { flex: none; padding: 19px 28px; }
.brief-head {display:flex; align-items:start; justify-content:space-between; gap:18px; border-bottom:1px solid var(--brief-line);}
.brief-head h2 { margin:0; width:fit-content; font-size:clamp(24px,3.2vw,39px); line-height:1.4; letter-spacing:-.045em; font-weight:650; outline:0; }
.brief-head p { margin:3px 0 0; color:var(--brief-muted); font-size:14px; line-height:1.7; }
#brief .brief-close { display:grid; place-items:center; width:42px; height:42px; flex:none; border:1px solid var(--brief-line); border-radius:50%; background:#f6f5f6; color:var(--brief-ink); font:27px/1 Arial,sans-serif; cursor:pointer; }
.brief-body { min-height:0; overflow:auto; overscroll-behavior:contain; }
#brief .brief-layout { padding:24px 28px; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,.96fr); grid-template-areas:"fields preview"; align-items:start; gap:clamp(20px,3vw,36px); }
#brief .brief-fields { grid-area:fields; display:grid; gap:16px; }
.brief-pair { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
#brief .brief-fields label { display:block; margin:0 0 5px; font-size:14px; font-weight:600; line-height:1.65; }
#brief .brief-fields label[hidden] { display:none; }
#brief .brief-fields :is(input:not([type=file]), select, textarea) {
  display:block; box-sizing:border-box; width:100%; margin-top:5px; padding:10px 13px;
  font:inherit; font-size:15px; font-weight:420; line-height:1.55; color:var(--brief-ink);
  background:#faf9fa; border:1px solid var(--brief-line); border-radius:13px;
}
#brief .bitter-pick-search input:not([type=file]) {margin:0; padding:9px 38px 9px 12px; font-weight:400; font-size:16px;}
#brief .brief-fields input::placeholder, #brief .brief-fields textarea::placeholder { color:#756e76; opacity:1; }
#brief .brief-fields textarea { resize:vertical; min-height:74px; }
#brief label.brief-cover { position:relative; display:flex; align-items:center; gap:12px; padding:12px; border:1px dashed #d6cfd4; border-radius:15px; cursor:pointer; }
#brief label.brief-cover[hidden] { display:none; }
.brief-file-button { flex:none; background:#efedef; color:var(--brief-ink); padding:7px 12px; border-radius:9px; font-size:12px; }
.brief-file-text { display:grid; min-width:0; gap:2px; }
.brief-file-text strong { font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.brief-file-text small { font-size:11px; color:var(--brief-muted); font-weight:450; }
#brief .brief-cover input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
#brief .brief-cover:focus-within { outline:2px solid #7f5791; outline-offset:2px; }
#brief .brief-sample {
  grid-area:preview; margin:0; padding:15px; align-self:start; position:sticky; top:18px;
  border:1px solid #241c2712; border-radius:22px; background:color-mix(in srgb, var(--sample-tone,#e8e2db) 45%, #f8f7f6);
}
#brief .brief-sample figcaption { display:flex; align-items:center; justify-content:space-between; color:#453f46; font-size:12px; margin:0 3px 10px; font-weight:600; }
.brief-preview-indicator { width:7px; height:7px; border-radius:100%; background:#22805e; box-shadow:0 0 0 4px #2586571a; }
#brief .brief-face { margin:0; max-width:none; border:1px solid #20192512; border-radius:13px; overflow:hidden; isolation:isolate; }
.brief-caption { display:flex; align-items:baseline; justify-content:space-between; gap:8px; padding:12px 3px 0; }
.brief-caption strong { font-size:20px; line-height:1.5; font-weight:650; }
.brief-caption span { color:#524c55; font-size:12px; }
.brief-actions {display:flex; align-items:center; gap:18px; border-top:1px solid var(--brief-line); background:#fff; }
.brief-actions .pill { gap:18px; background:#2c232d; color:#fff; border:0; font-size:15px; min-height:48px; padding-inline:22px; }
.brief-actions .pill span { font:20px/1 system-ui; }
.brief-download { color:var(--brief-muted); background:transparent; border:0; padding:10px 2px; font:inherit; font-size:14px; cursor:pointer; text-underline-offset:5px; }
.brief-download:hover { text-decoration:underline; }
#brief :is(button,input,select,textarea):focus-visible { outline:2px solid #7f5791; outline-offset:2px; }
#brief .brief-fields .brief-pair select[hidden] { display:none; }
#brief #saved { margin:0; padding:0 28px 12px; color:#116341; font-size:13px; }
#brief #saved:empty { display:none; }
@media (max-width:700px) {
  #brief {width:min(520px,calc(100% - 16px)); max-height:calc(100dvh - 20px); border-radius:23px;}
  .brief-head, .brief-actions {padding:14px 16px;}
  #brief .brief-layout {padding:14px 16px 18px; grid-template-columns:minmax(0,1fr); grid-template-areas:"preview" "fields"; gap:16px;}
  #brief .brief-sample {position:static; display:grid; grid-template-columns:minmax(0,1.6fr) minmax(80px,1fr); grid-template-rows:auto 1fr; column-gap:13px; align-items:start; padding:10px; border-radius:15px;}
  #brief .brief-sample .brief-face {grid-column:1;grid-row:1/3; border-radius:8px;}
  #brief .brief-face.live-template {
    --brief-height:844px;
    width:min(100%,150px);
    justify-self:center;
    aspect-ratio:390/844;
  }
  #brief .brief-sample figcaption {grid-row:1;grid-column:2;justify-content:start;gap:9px;margin:4px 0 2px;}
  .brief-caption {grid-column:2;grid-row:2;display:grid;gap:0;align-content:start;padding:3px 0;}
  .brief-caption strong {font-size:18px;}
  #brief .brief-fields {gap:12px;}
  .brief-actions {padding-bottom:max(12px,env(safe-area-inset-bottom));}
  .brief-actions .pill {flex:1;}
}
@media (prefers-reduced-motion:no-preference) {
  #brief[open] { animation:brief-arrive .26s cubic-bezier(.16,1,.3,1); }
  @keyframes brief-arrive { from { opacity:0; transform:translateY(10px) scale(.985); } to { opacity:1; transform:none; } }
}