.pniel-photo-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:7px 0;color:var(--ws-text-muted,#64748b);font-size:.78rem}
.pniel-photo-toolbar[hidden],.pniel-photo-preview[hidden]{display:none!important}
.pniel-photo-toolbar button,.pniel-photo-preview button{font:inherit;font-weight:600;border:1px solid var(--ws-border,#dbe5f5);border-radius:9px;padding:6px 10px;background:var(--ws-bg-card,#fff);color:var(--ws-text-primary,#172554);cursor:pointer}
.pniel-photo-toolbar button:disabled{opacity:.55;cursor:default}
.pniel-photo-preview{display:flex;align-items:center;gap:10px;border:1px solid var(--ws-border,#dbe5f5);border-radius:12px;padding:8px;margin-top:7px;font-size:.8rem;color:var(--ws-text-primary,#172554)}
.pniel-photo-preview img{width:64px;height:54px;object-fit:contain;border-radius:6px;background:white}
.pniel-photo-preview button{margin-inline-start:auto}
.pniel-photo-dialog{box-sizing:border-box;width:min(680px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:1px solid var(--ws-border,#dbe5f5);border-radius:20px;padding:22px;background:var(--ws-bg-card,#fff);color:var(--ws-text-primary,#172554);font-family:inherit;box-shadow:0 20px 80px rgba(15,23,42,.25)}
.pniel-photo-dialog::backdrop{background:rgba(15,23,42,.55);backdrop-filter:blur(4px)}
.pniel-photo-dialog h2{font-size:1.35rem;margin:0 0 10px}.pniel-photo-dialog p{font-size:.9rem;line-height:1.7;margin:9px 0}.pniel-photo-dialog a{color:#2563eb}
.pniel-photo-canvas{display:block;max-width:100%;max-height:42dvh;width:auto;height:auto;margin:auto;touch-action:none;cursor:crosshair;border-radius:8px;background:#eef4ff}
.pniel-photo-bounds{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0;font-size:.75rem}
.pniel-photo-bounds label{display:grid;gap:4px}.pniel-photo-bounds input{box-sizing:border-box;width:100%;font:inherit;padding:7px;border:1px solid var(--ws-border,#dbe5f5);border-radius:8px;background:var(--ws-bg-card,#fff);color:inherit;direction:ltr}
.pniel-photo-dialog details{font-size:.82rem;background:rgba(37,99,235,.06);padding:10px;border-radius:10px;margin:10px 0}.pniel-photo-dialog summary{cursor:pointer;font-weight:600}
.pniel-photo-consent{display:flex;align-items:flex-start;gap:9px;font-size:.83rem;line-height:1.65}.pniel-photo-consent input{flex-shrink:0;accent-color:#2563eb;margin-top:5px;width:18px;height:18px}
.pniel-photo-status{min-height:1.5em;color:var(--ws-text-muted,#64748b)}.pniel-photo-actions{display:flex;gap:10px}.pniel-photo-actions button{font:inherit;font-weight:600;padding:10px 16px;border-radius:10px;cursor:pointer;background:var(--ws-bg-card,#fff);color:inherit;border:1px solid var(--ws-border,#dbe5f5)}
.pniel-photo-actions button[data-photo="apply"]{background:#2455ed;color:white;border-color:#2455ed}.pniel-photo-actions button:disabled{opacity:.5;cursor:default}.pniel-photo-chat-image{display:block;width:auto;max-width:min(360px,100%);max-height:260px;object-fit:contain;border-radius:12px;margin-top:10px;background:white}
@media(max-width:480px){.pniel-photo-dialog{padding:16px}.pniel-photo-bounds{grid-template-columns:repeat(2,1fr)}.pniel-photo-toolbar span{flex-basis:100%}.pniel-photo-preview{flex-wrap:wrap}}
.pniel-photo-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}.pniel-photo-header h2{margin:0;font-size:1.1rem}.pniel-photo-header button{border:0;background:transparent;color:inherit;border-radius:50%;width:36px;height:36px;cursor:pointer;font:inherit}
.pniel-photo-hint{color:var(--ws-text-muted,#64748b);font-size:.8rem!important}.pniel-photo-dialog{padding:18px}.pniel-photo-canvas{max-height:55dvh}.pniel-photo-dialog .pniel-photo-keyboard{background:transparent;margin:4px 0;padding:4px;font-size:.7rem;color:var(--ws-text-muted,#64748b)}
.pniel-photo-actions{position:sticky;bottom:-18px;background:var(--ws-bg-card,#fff);padding:10px 0}.pniel-photo-actions button[data-photo="apply"]{flex:1;border-radius:12px}.pniel-photo-actions button[data-photo="cancel"]{background:transparent;border:0}
.pniel-photo-status:empty{display:none}.pniel-photo-preview{display:inline-flex;border:0;padding:0;margin:6px 0;position:relative}.pniel-photo-preview img{width:64px;height:58px;border:1px solid var(--ws-border,#dbe5f5)}.pniel-photo-preview button{position:absolute;top:-5px;inset-inline-end:-8px;width:24px;height:24px;border-radius:50%;padding:0;font-size:.65rem}
.pniel-photo-toolbar button{display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;padding:0;border-radius:50%;background:transparent;border-color:transparent}.pniel-photo-toolbar button:hover{color:#2455ed;background:rgba(37,99,235,.08)}.pniel-photo-toolbar button:focus-visible,.pniel-photo-header button:focus-visible{outline:2px solid #2455ed;outline-offset:2px}
.pniel-photo-permission{max-width:440px}.pniel-photo-permission p{font-size:.85rem}.pniel-photo-permission-actions{display:flex;flex-wrap:wrap;gap:8px}.pniel-photo-permission-actions button{font:inherit;font-size:.85rem;font-weight:600;padding:11px 14px;cursor:pointer;border:1px solid var(--ws-border,#dbe5f5);border-radius:11px;color:inherit;background:var(--ws-bg-card,#fff)}.pniel-photo-permission-actions button[data-permission="always"]{color:white;background:#2455ed;border-color:#2455ed}.pniel-photo-permission-actions button[data-permission="deny"]{border-color:transparent;margin-inline-start:auto;font-weight:400}
@media(max-width:480px){.pniel-photo-dialog{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:14px;border-radius:18px}.pniel-photo-canvas{max-height:60dvh}.pniel-photo-toolbar span{display:none}.pniel-photo-permission-actions button{flex:1}.pniel-photo-permission-actions button[data-permission="deny"]{flex-basis:100%}}

/* Composer layout: full-width text, send on the right, attachments on the left. */
#pnielAiForm[data-composer-mode="ai_tutor"]{box-sizing:border-box;grid-template-columns:44px minmax(0,1fr) 44px;grid-template-rows:auto 44px;gap:5px 8px!important;direction:ltr!important;position:relative;overflow:visible;min-height:126px;padding:12px 14px!important;border-radius:24px!important;background:var(--ws-bg-soft,#f4f7fc)!important;border:1px solid var(--ws-border,#dbe5f5)!important}
#pnielAiForm[data-composer-mode="ai_tutor"]:not([style*="display:none"]):not([style*="display: none"]){display:grid!important}
#pnielAiForm[data-composer-mode="ai_tutor"] #pnielAiInput{grid-column:1/-1;grid-row:1;direction:rtl;text-align:right;width:100%;min-height:52px;max-height:180px;box-sizing:border-box;padding:5px 4px!important;margin:0;border:0;background:transparent;resize:none;font:inherit;font-size:1rem!important;line-height:1.6;box-shadow:none;outline:none}
#pnielAiForm[data-composer-mode="ai_tutor"] #pnielAiSendBtn{grid-column:3;grid-row:2;position:static;align-self:end;justify-self:end;width:42px!important;height:42px!important;border-radius:50%;padding:0;display:flex;align-items:center;justify-content:center}
#pnielAiForm[data-composer-mode="ai_tutor"] #pnielAiCharCount{grid-column:2;grid-row:2;position:static;align-self:center;justify-self:center;width:auto;direction:ltr;font-size:.65rem;opacity:.55}
#pnielAiPhotoHost{grid-column:1;grid-row:2;position:relative;align-self:end;direction:rtl}
.pniel-photo-toolbar{position:relative;display:block;margin:0;direction:rtl;font-size:.86rem;color:var(--ws-text-primary,#172554)}
.pniel-photo-toolbar button{font:inherit;color:inherit;cursor:pointer}
.pniel-photo-toolbar .pniel-photo-plus{width:42px;height:42px;padding:10px;border:0;border-radius:50%;background:rgba(100,116,139,.12);display:flex;align-items:center;justify-content:center}
.pniel-photo-plus svg{width:24px;height:24px}.pniel-photo-plus[aria-expanded="true"]{background:rgba(37,99,235,.12);color:#2455ed}
.pniel-photo-flyout{position:absolute;left:0;bottom:calc(100% + 10px);display:flex;flex-direction:row-reverse;align-items:flex-end;gap:8px;z-index:90;overflow:auto;overscroll-behavior:contain;padding:2px;box-sizing:border-box;width:max-content;max-width:calc(100vw - 24px)}
.pniel-photo-flyout[hidden],.pniel-photo-flyout [hidden]{display:none!important}
.pniel-photo-menu,.pniel-photo-permission,.pniel-photo-settings,.pniel-photo-local-error{box-sizing:border-box;background:var(--ws-bg-card,#fff);color:var(--ws-text-primary,#172554);border:1px solid var(--ws-border,#dbe5f5);box-shadow:0 6px 24px rgba(15,23,42,.12);border-radius:16px}
.pniel-photo-menu{padding:6px;width:158px;flex-shrink:0}
.pniel-photo-menu button{display:flex;width:100%;height:auto;min-height:43px;padding:10px 11px;border:0;border-radius:10px;gap:10px;align-items:center;justify-content:flex-start;background:transparent;text-align:right;white-space:nowrap;font-size:.86rem}
.pniel-photo-menu svg{width:21px;height:21px;flex-shrink:0}.pniel-photo-menu span{display:inline!important}
.pniel-photo-menu .pniel-photo-manage{border-top:1px solid var(--ws-border,#dbe5f5);border-radius:0 0 10px 10px;font-size:.73rem;color:var(--ws-text-muted,#64748b);margin-top:4px;min-height:34px}
.pniel-photo-permission,.pniel-photo-settings{width:330px;flex-shrink:1;padding:16px;font-family:inherit;text-align:right;line-height:1.6}
.pniel-photo-permission p,.pniel-photo-settings p{font-size:.79rem;margin:8px 0;line-height:1.65}.pniel-photo-permission h2,.pniel-photo-settings h2{font-size:.97rem;margin:0}
.pniel-photo-permission .pniel-photo-header button,.pniel-photo-settings .pniel-photo-header button{width:28px;height:28px;padding:0;border:0;background:transparent}
.pniel-photo-permission details{font-size:.73rem;margin:8px 0}.pniel-photo-permission summary{cursor:pointer;color:var(--ws-text-muted,#64748b)}
.pniel-photo-permission details p{font-size:.73rem}.pniel-photo-permission a,.pniel-photo-settings a{color:#2455ed;text-decoration:underline;text-underline-offset:2px}
.pniel-photo-permission .pniel-photo-legal{font-size:.73rem;color:var(--ws-text-muted,#64748b)}
.pniel-photo-permission .pniel-photo-permission-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:10px}
.pniel-photo-permission-actions button{width:auto;height:auto;font-size:.78rem;padding:9px 7px;border-radius:10px}
.pniel-photo-permission-actions button[data-permission="deny"]{grid-column:1/-1;padding:5px;border:0;background:transparent;font-weight:400}
.pniel-photo-setting{display:flex;gap:10px;align-items:center;justify-content:space-between;padding:11px 0;border-bottom:1px solid var(--ws-border,#dbe5f5)}
.pniel-photo-setting strong,.pniel-photo-setting span{display:block}.pniel-photo-setting span{font-size:.71rem;color:var(--ws-text-muted,#64748b)}
.pniel-photo-setting button{width:auto;height:auto;padding:6px 9px;font-size:.72rem;border-radius:8px;background:transparent;border:1px solid var(--ws-border,#dbe5f5)}
.pniel-photo-permission-status:empty,.pniel-photo-settings [role="status"]:empty{display:none}
.pniel-photo-local-error{max-width:290px;padding:12px;font-size:.8rem;line-height:1.6;margin:0}
#pnielAiPhotoHost .pniel-photo-preview{position:absolute;left:51px;bottom:1px;margin:0}
#pnielAiPhotoHost .pniel-photo-preview img{width:42px;height:42px}
:is([data-mode="dark"],[data-theme-mode="dark"],html[data-theme="dark"],body.dark-mode) #pnielAiForm[data-composer-mode="ai_tutor"]{background:var(--ws-bg-soft,#252b36)!important}
:is([data-mode="dark"],[data-theme-mode="dark"],html[data-theme="dark"],body.dark-mode) :is(.pniel-photo-menu,.pniel-photo-permission,.pniel-photo-settings,.pniel-photo-local-error){background:var(--ws-bg-card,#1e293b);color:var(--ws-text-primary,#e2e8f0);border-color:var(--ws-border,#374151)}
@media(max-width:700px){.pniel-photo-flyout{align-items:flex-start}.pniel-photo-flyout.has-panel .pniel-photo-menu{display:none}.pniel-photo-permission,.pniel-photo-settings{width:min(330px,calc(100vw - 48px));max-width:100%;min-width:0;flex-shrink:1}#pnielAiForm[data-composer-mode="ai_tutor"]{padding:10px 12px!important;min-height:122px}.pniel-photo-permission-actions button{flex:unset}.pniel-photo-permission-actions button[data-permission="deny"]{flex-basis:auto}}

/* A visible attachment above the text, with a compact crop/camera surface. */
#pnielAiForm[data-composer-mode="ai_tutor"].has-photo{grid-template-rows:auto auto 44px}
#pnielAiForm[data-composer-mode="ai_tutor"].has-photo #pnielAiInput{grid-row:2}
#pnielAiForm[data-composer-mode="ai_tutor"].has-photo :is(#pnielAiSendBtn,#pnielAiCharCount,#pnielAiPhotoHost){grid-row:3}
#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview{grid-column:1/-1;grid-row:1;justify-self:end;position:relative;display:block;margin:2px 2px 6px;padding:0;border:0;line-height:0}
#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview img{display:block;width:136px;height:100px;object-fit:contain;background:var(--ws-bg-card,#fff);border:1px solid var(--ws-border,#dbe5f5);border-radius:12px}
#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview button{top:5px;inset-inline-end:5px;width:26px;height:26px;background:var(--ws-bg-card,#fff);box-shadow:0 1px 6px rgba(15,23,42,.15);color:var(--ws-text-primary,#172554)}
.pniel-photo-sr{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap;border:0!important}
.pniel-photo-dialog{position:fixed;inset:0;margin:auto;width:fit-content;max-width:calc(100vw - 28px);max-height:calc(100dvh - 28px);padding:12px;border-radius:20px;overflow:auto}
.pniel-photo-dialog .pniel-photo-header{justify-content:flex-end;margin:0 0 6px}
.pniel-photo-canvas,.pniel-photo-video{display:block;width:auto;height:auto;max-width:min(480px,calc(100vw - 54px));max-height:64dvh;margin:auto;border-radius:12px;background:#111827;object-fit:contain}
.pniel-photo-dialog [hidden]{display:none!important}
.pniel-photo-dialog .pniel-photo-actions{position:static;justify-content:center;margin:0;padding:10px 0 0;background:transparent}
.pniel-photo-dialog .pniel-photo-actions button[data-photo="apply"]{flex:0 0 auto;min-width:120px;padding:9px 24px;border-radius:12px}
.pniel-photo-dialog .pniel-photo-actions button[data-photo="capture"]{display:flex;align-items:center;justify-content:center;width:54px;height:54px;padding:0;background:#2455ed;color:white;border:0;border-radius:50%}
.pniel-photo-actions button[data-photo="capture"] svg{width:38px;height:38px}
.pniel-photo-setting button:disabled{opacity:1;color:var(--ws-text-muted,#64748b);cursor:default;background:rgba(100,116,139,.06)}
:is([data-mode="dark"],[data-theme-mode="dark"],html[data-theme="dark"],body.dark-mode) .pniel-photo-dialog{background:var(--ws-bg-card,#1e293b);color:var(--ws-text-primary,#e2e8f0);border-color:var(--ws-border,#374151)}
@media(max-width:480px){#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview img{width:116px;height:88px}.pniel-photo-dialog{padding:10px;border-radius:18px}.pniel-photo-canvas,.pniel-photo-video{max-width:calc(100vw - 50px);max-height:62dvh}}

#pnielAiForm[data-composer-mode="content_assistant"] #pnielAiPhotoHost{display:none!important}

/* Pending photos only; sent photos live in their message bubbles. */
#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview{display:flex;flex-wrap:nowrap;gap:6px;max-width:100%;justify-self:stretch;overflow-x:auto;padding:4px 2px}
#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview img{width:72px;height:54px;border-radius:8px}
#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview button{width:24px;height:24px;top:2px;inset-inline-end:2px;font-size:.6rem}
.pniel-photo-preview-item{position:relative;flex:0 0 auto}
@media(max-width:480px){#pnielAiForm[data-composer-mode="ai_tutor"]>.pniel-photo-preview img{width:56px;height:44px}}
