.upload-capsule{min-width:0;align-self:start}
.upload-capsule-bar{height:42px;display:flex;align-items:center;gap:8px;min-width:0;padding:4px 5px 4px 7px;border:1px solid #dbe3eb;border-radius:999px;background:linear-gradient(135deg,#fff,#f7fafc);box-shadow:0 2px 8px rgba(39,63,88,.06)}
.upload-capsule.has-file .upload-capsule-bar{border-color:#bfd3e8;background:#f6faff}
.upload-capsule.has-file .upload-capsule-icon{display:none}
.upload-capsule-main{flex:1 1 auto;min-width:0;height:32px;display:flex;align-items:center;gap:8px;padding:0 6px;border:0;background:transparent;color:#607286;text-align:left;cursor:pointer}
.upload-capsule-icon{width:25px;height:25px;flex:none;display:grid;place-items:center;border-radius:50%;background:#eaf2fa;color:#4e7ba8;font-size:15px}
.upload-capsule-thumb{width:27px;height:27px;flex:none;border-radius:50%;object-fit:cover;background:#eaf0f5}
.upload-capsule-copy{min-width:0;display:flex;flex-direction:column;line-height:1.15}
.upload-capsule-copy b,.upload-capsule-copy small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.upload-capsule-copy b{color:#53687d;font-size:11px;font-weight:700}
.upload-capsule-copy small{margin-top:2px;color:#8a96a3;font-size:9px}
.upload-capsule-actions{display:flex;align-items:center;gap:2px;flex:none}
.upload-capsule-action{height:30px;min-width:30px;padding:0 8px;border:0;border-radius:999px;background:transparent;color:#718094;font-size:10px;cursor:pointer}
.upload-capsule-action:hover,.upload-capsule-action:focus-visible{background:#eaf2fa;color:#3e6f9f;outline:none}
.upload-capsule-action.is-remove{color:#a66461}
.upload-capsule:not(.has-file) .upload-file-action{display:none}
.upload-preview-overlay{position:fixed;inset:0;z-index:10040;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(16,24,40,.32);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
.upload-preview-overlay.hidden{display:none}
.upload-preview-card{width:min(920px,calc(100vw - 32px));max-height:calc(100dvh - 32px);display:flex;flex-direction:column;overflow:hidden;border:1px solid rgba(222,229,236,.94);border-radius:18px;background:rgba(255,255,255,.98);box-shadow:0 28px 75px rgba(15,23,42,.24)}
.upload-preview-head{height:48px;flex:none;display:flex;align-items:center;gap:10px;padding:0 13px;border-bottom:1px solid #e8edf2}
.upload-preview-title{min-width:0;flex:1;color:#536476;font-size:12px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.upload-preview-head .upload-capsule-action{border:1px solid #e1e7ed;background:#fff}
.upload-preview-stage{position:relative!important;width:100%!important;height:min(70dvh,680px)!important;min-height:300px!important;margin:0!important;border:0!important;border-radius:0!important;background:#202831!important;overflow:hidden!important}
.upload-preview-stage .upload-preview-blur{position:absolute!important;inset:-22px!important;z-index:0!important;width:calc(100% + 44px)!important;height:calc(100% + 44px)!important;min-height:0!important;max-height:none!important;object-fit:cover!important;filter:blur(24px) saturate(.78)!important;opacity:.42!important;transform:scale(1.05)}
.upload-preview-stage .upload-preview-foreground{position:relative!important;z-index:1!important;width:100%!important;height:100%!important;min-height:0!important;max-height:none!important;object-fit:contain!important}
.upload-preview-stage [id$="-drop-tip"]{position:relative;z-index:2;color:#dfe8f1!important}
.upload-preview-stage .vision-detection-layer{z-index:3}
.reasoning-input-slot{width:100%;min-width:0}
.reasoning-upload{--reasoning-capsule-height:52px;flex:0 0 auto;width:100%;min-width:0;margin:0}
.reasoning-upload .upload-capsule-bar{width:100%;height:var(--reasoning-capsule-height);min-height:var(--reasoning-capsule-height);max-height:var(--reasoning-capsule-height);padding:5px 6px;border-radius:17px;box-sizing:border-box}
.reasoning-upload .upload-capsule-main{height:42px;min-height:42px}
.reasoning-upload .upload-capsule-icon,.reasoning-upload .upload-capsule-thumb{width:42px;height:42px;flex:0 0 42px}
.reasoning-user-attachment{display:flex;align-items:center;gap:7px;margin-bottom:6px;padding:5px 8px;border-radius:9px;background:rgba(255,255,255,.58);font-size:10px}
.reasoning-user-attachment img{width:25px;height:25px;border-radius:6px;object-fit:cover}
.reasoning-user-attachment span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.flock-canvas-wrap>#flock-canvas-empty{box-sizing:border-box;width:min(360px,calc(100% - 36px));min-width:0;padding:20px 24px;overflow-wrap:break-word;word-break:normal}

/* I01: photo and environment fields are one shared, overlaying storage capsule. */
.input-capsule-slot{position:relative;z-index:32;flex:0 0 auto;min-width:0}
/* The input bar stays in the shell's normal flow. Its card overlays the
   following conversation or workspace in both portrait and landscape. */
:is(.ai-shell,.flock-shell)>.input-capsule-slot{position:relative;z-index:90;align-self:stretch;flex:0 0 auto}
:is(.ai-shell,.flock-shell)>.input-capsule-slot~*{position:relative;z-index:0}
:is(.ai-shell,.flock-shell)>.input-capsule-slot .environment-capsule-panel{position:absolute;z-index:100}
.environment-capsule{position:relative;width:100%;align-self:stretch}
.environment-capsule .upload-capsule-bar{height:52px;padding:5px 6px;border-radius:17px;background:linear-gradient(135deg,rgba(255,255,255,.99),rgba(246,249,252,.98));box-shadow:0 4px 16px rgba(39,63,88,.07)}
.environment-capsule.has-file .upload-capsule-bar{border-color:#b8cee5;background:linear-gradient(135deg,#fbfdff,#f2f7fc)}
.environment-capsule.has-folder-batch .environment-capsule-thumb-button{background:#e7f1fb;color:#4778a7}
.environment-capsule.has-folder-batch .environment-capsule-thumb-button::after{content:'▦';font-size:20px;font-weight:700}
.environment-capsule.has-folder-batch .environment-capsule-thumb-button .upload-capsule-icon{display:none}
.environment-capsule-thumb-button{width:42px;height:42px;flex:0 0 42px;display:grid;place-items:center;padding:0;border:0;border-radius:12px;background:#edf3f8;overflow:hidden;cursor:pointer}
.environment-capsule-thumb-button:focus-visible,.environment-capsule-summary:focus-visible{outline:2px solid #79a4d3;outline-offset:2px}
.environment-capsule .upload-capsule-icon{width:100%;height:100%;border-radius:12px;font-size:18px}
.environment-capsule .upload-capsule-thumb{width:42px;height:42px;border-radius:12px;object-fit:cover;object-position:center;background:#e8eef4}
.environment-capsule-summary{height:42px;flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:10px;padding:0 7px;border:0;background:transparent;color:#607286;text-align:left;cursor:pointer}
.environment-capsule-summary .upload-capsule-copy{flex:1 1 auto}
.environment-capsule-summary .upload-capsule-copy b{font-size:12px;color:#445a70}
.environment-capsule-summary .upload-capsule-copy small{font-size:10px;color:#7f8d9d}
.environment-capsule-state{flex:none;color:#71849a;font-size:10px}
.environment-capsule-toggle{font-size:15px;transition:transform .18s ease}
.environment-capsule.is-expanded .environment-capsule-toggle{transform:rotate(180deg)}
.environment-capsule-panel{position:absolute;left:0;right:0;top:calc(100% + 7px);z-index:80;display:none;max-height:min(520px,calc(100dvh - 126px));padding:12px 14px;overflow:auto;overscroll-behavior:contain;container-type:inline-size;border:1px solid #dce4ec;border-radius:17px;background:#fff;box-shadow:0 24px 60px rgba(25,42,60,.20)}
.environment-capsule.is-expanded .environment-capsule-panel{display:block;animation:input-capsule-in .16s ease-out}
.environment-capsule.is-expanded .environment-capsule-panel{
  background:rgba(251,253,255,.98)!important;
  box-shadow:0 24px 58px rgba(25,48,72,.22),0 2px 9px rgba(25,48,72,.08)!important;
}
.environment-capsule-layout{display:grid;grid-template-columns:293px minmax(0,1fr);gap:14px;align-items:stretch}
.environment-photo-picker{position:relative;min-width:0;min-height:188px;display:grid;place-items:center;padding:0;overflow:hidden;border:1px dashed #b8c7d6;border-radius:13px;background:#f7fafc;color:#738397;font-size:12px;cursor:pointer}
.environment-photo-picker:hover{border-color:#82a8cf;background:#f2f7fc}
.environment-photo-picker img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center}
.environment-photo-empty{max-width:100%;padding:18px;text-align:center;line-height:1.55;white-space:normal;overflow-wrap:anywhere}
.environment-capsule.has-file .environment-photo-empty{display:none}
.environment-condition-area{min-width:0}
.environment-capsule .vision-habitat-row{align-items:end}
.environment-capsule .vision-choice{touch-action:manipulation}
.folder-batch-progress{width:100%;display:grid;grid-template-columns:minmax(0,1fr);gap:6px;color:#637589;font-size:10.5px;line-height:1.45}
.folder-batch-progress>span{display:block;overflow-wrap:anywhere}
.folder-batch-progress>i{display:block;width:100%;height:5px;overflow:hidden;border-radius:999px;background:#e5ebf1}
.folder-batch-progress>i>b{display:block;height:100%;border-radius:inherit;background:#5b8fc7;transition:width .18s ease}
.folder-batch-progress.is-done>i>b{background:#55a47a}.folder-batch-progress.is-error{color:#a6524c}.folder-batch-progress.is-error>i>b{background:#d55d52}
@keyframes input-capsule-in{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:none}}

@media(max-width:900px){
  #page-vision .upload-capsule,#page-flock .upload-capsule{width:100%}
  .environment-capsule-layout{grid-template-columns:230px minmax(0,1fr);align-items:start}
  .environment-photo-picker{height:clamp(148px,20cqi,188px);min-height:148px;max-height:188px;align-self:start}
  .environment-capsule .vision-habitat-row{align-items:stretch}
  .environment-capsule .vision-habitat-row .vision-choice-grid{width:100%}
  .upload-preview-card{width:min(760px,calc(100vw - 20px));max-height:calc(100dvh - 20px)}
  .upload-preview-stage{height:min(72dvh,620px)!important}
}

/* Reflow the input from its own available width, independently of the nav. */
@container(max-width:680px){
  .environment-capsule-layout{grid-template-columns:minmax(0,1fr)}
  .environment-photo-picker{height:148px;min-height:148px;max-height:148px}
}

@media(min-width:641px) and (max-width:900px){
  html:not([data-brand-visual-mode="phone"]) .environment-capsule .vision-habitat-row :is(.vision-run,.flock-run){align-self:flex-end;width:auto}
}

@media(max-width:640px){
  .environment-capsule .upload-capsule-bar{height:60px;padding:7px}
  .environment-capsule-thumb-button,.environment-capsule .upload-capsule-thumb{width:44px;height:44px;flex-basis:44px}
  .environment-capsule-summary{height:44px;min-height:44px}
  .environment-capsule-summary{padding:0 5px}
  .environment-capsule-state{display:none}
  .environment-capsule .upload-capsule-actions{gap:0}
  .environment-capsule .upload-capsule-action{width:44px;min-width:44px;height:44px;padding:0 6px;touch-action:manipulation}
  .environment-capsule .upload-file-action{font-size:0}
  .environment-capsule .upload-file-action::after{content:'↻';font-size:15px}
  .environment-capsule-panel{top:calc(100% + 5px);max-height:calc(100dvh - 138px);padding:9px;border-radius:14px;scrollbar-gutter:auto}
  .environment-capsule-layout{grid-template-columns:1fr;gap:9px}
  .environment-photo-picker{min-height:148px;max-height:172px;touch-action:manipulation}
  .environment-capsule .vision-habitat-row{align-items:stretch;flex-direction:column}
  .environment-capsule .vision-choice{height:44px;min-height:44px;touch-action:manipulation}
  .environment-capsule .vision-habitat-row .vision-run,.environment-capsule .flock-run{align-self:stretch;width:100%;height:44px;min-height:44px;margin-top:3px;touch-action:manipulation}
  .upload-preview-overlay{align-items:flex-start;padding:max(8px,env(safe-area-inset-top)) 8px 8px}
  .upload-preview-card{width:100%;max-height:calc(100dvh - 16px);border-radius:15px}
  .upload-preview-head{height:56px;min-height:56px}
  .upload-preview-stage{height:min(68dvh,570px)!important;min-height:240px!important}
  .upload-capsule-bar{height:auto;min-height:52px}
  .upload-capsule-main{height:44px;min-height:44px;touch-action:manipulation}
  .upload-capsule-action{min-width:44px;height:44px;touch-action:manipulation}
  .upload-capsule-action .wide-label{display:none}
  .reasoning-upload{--reasoning-capsule-height:60px;margin:0}
  .reasoning-upload .upload-capsule-bar{height:var(--reasoning-capsule-height);min-height:var(--reasoning-capsule-height);max-height:var(--reasoning-capsule-height);padding:7px}
  .reasoning-upload .upload-capsule-main{height:44px;min-height:44px}
  .reasoning-upload .upload-capsule-icon,.reasoning-upload .upload-capsule-thumb{width:44px;height:44px;flex-basis:44px}
  #page-reasoning .reasoning-chat-panel{padding-bottom:max(10px,env(safe-area-inset-bottom))}
}

/* Portrait input controls: compact like the top navigation, while retaining
   the existing 44px landscape touch layout above. */
@media(max-width:640px) and (orientation:portrait){
  .environment-capsule .vision-choice-grid{
    display:flex;
    flex-wrap:wrap;
    justify-content:flex-start;
    gap:4px;
  }
  .environment-capsule .vision-choice{
    flex:0 1 auto;
    width:auto;
    min-width:44px;
    max-width:100%;
    height:auto;
    min-height:32px;
    padding:4px 8px;
    line-height:1.15;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  .environment-capsule :is(#vision-province,#flock-province)>.vision-choice{
    flex:0 0 54px;
    width:54px;
    min-width:54px;
    max-width:54px;
    padding-inline:4px;
    white-space:nowrap;
  }
  .environment-capsule .vision-habitat-row{
    align-items:flex-start;
    flex-direction:column;
    gap:6px;
  }
  .environment-capsule .vision-habitat-row .vision-choice-grid{flex:0 1 auto}
  .environment-capsule .vision-habitat-row .vision-run,
  .environment-capsule .flock-run{
    align-self:flex-start;
    width:auto;
    min-width:76px;
    height:32px;
    min-height:32px;
    margin:2px 0 0;
    padding:0 10px;
  }
  .environment-capsule .flock-run{min-width:98px}
  .vision-city-branch{align-items:start;gap:4px;padding:8px}
  .vision-city-branch-head{top:-8px;min-height:30px;margin:-8px -8px 2px;padding:7px 8px 6px}
  .vision-city-choice{
    height:auto;
    min-height:32px;
    padding:4px 6px;
    line-height:1.15;
    white-space:normal;
    overflow-wrap:anywhere;
    text-overflow:clip;
  }
}
