/* Local export/crop dialogs, shared by desktop and phone StudyGuide views. */
.sg-extra-dialog{box-sizing:border-box;width:min(760px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:24px;border:1px solid #d7dfeb;border-radius:18px;background:#fff;color:#17273e;box-shadow:0 20px 80px #06112766;font-family:inherit;line-height:1.7}
.sg-extra-dialog::backdrop{background:#071126ad;backdrop-filter:blur(3px)}
.sg-extra-dialog h2{font-size:1.1rem;margin:0 0 12px;color:#17273e}
.sg-extra-dialog p{font-size:.9rem;margin:8px 0 14px}
.sg-extra-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px}
.sg-extra-dialog button{font:inherit;line-height:1.5;min-height:44px;border:1px solid #c9d2df;border-radius:9px;padding:9px 14px;background:#f5f7fa;color:#17273e;cursor:pointer}
.sg-extra-dialog button.primary{background:#132442;color:#fff;border-color:#132442}
.sg-extra-dialog button:disabled{opacity:.55;cursor:wait}
.sg-extra-dialog button:focus-visible,.sg-extra-dialog input:focus-visible{outline:3px solid #d5a823;outline-offset:3px}
.sg-extra-status{min-height:1.7em;color:#36516d}
.sg-image-editor[open]{display:flex;flex-direction:column;gap:12px;height:min(840px,calc(100dvh - 24px))}
.sg-image-editor .lms-dialog-header{flex:none;margin:0}
.sg-crop-viewport{position:relative;display:flex;align-items:center;justify-content:center;flex:1;min-height:0;padding:24px;overflow:hidden;border-radius:10px;background:#101622;box-sizing:border-box}
.sg-crop-stage{position:relative;flex:none;touch-action:none;user-select:none;cursor:crosshair}
.sg-image-crop-canvas{display:block;width:100%;height:100%;pointer-events:none}
.sg-crop-selection{position:absolute;box-sizing:border-box;border:1px solid #fff;box-shadow:0 0 0 2000px #050b15a8;cursor:move;touch-action:none}
.sg-crop-selection::before{content:"";position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(90deg,transparent calc(100% - 1px),#ffffff55 0),linear-gradient(transparent calc(100% - 1px),#ffffff55 0);background-size:33.333333% 33.333333%}
.sg-crop-selection:focus-visible{outline:2px solid #ffcf57;outline-offset:2px}
.sg-image-editor .sg-crop-handle{position:absolute;z-index:1;display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-radius:0;background:transparent;color:white;transform:translate(-50%,-50%);touch-action:none;outline-offset:-6px}
.sg-crop-handle::after{content:"";box-sizing:border-box;width:20px;height:20px;border:3px solid currentColor;pointer-events:none}
.sg-image-editor .sg-crop-handle:hover{color:#ffcf57;background:transparent}
.sg-crop-handle[data-crop-handle=nw]{left:0;top:0;cursor:nwse-resize}.sg-crop-handle[data-crop-handle=nw]::after{border-right:0;border-bottom:0;transform:translate(8px,8px)}
.sg-crop-handle[data-crop-handle=ne]{left:100%;top:0;cursor:nesw-resize}.sg-crop-handle[data-crop-handle=ne]::after{border-left:0;border-bottom:0;transform:translate(-8px,8px)}
.sg-crop-handle[data-crop-handle=sw]{left:0;top:100%;cursor:nesw-resize}.sg-crop-handle[data-crop-handle=sw]::after{border-right:0;border-top:0;transform:translate(8px,-8px)}
.sg-crop-handle[data-crop-handle=se]{left:100%;top:100%;cursor:nwse-resize}.sg-crop-handle[data-crop-handle=se]::after{border-left:0;border-top:0;transform:translate(-8px,-8px)}
.sg-crop-handle[data-crop-handle=n]{left:50%;top:0;cursor:ns-resize}.sg-crop-handle[data-crop-handle=s]{left:50%;top:100%;cursor:ns-resize}
.sg-crop-handle[data-crop-handle=n]::after,.sg-crop-handle[data-crop-handle=s]::after{width:20px;height:3px;border:0;background:currentColor}
.sg-crop-handle[data-crop-handle=w]{left:0;top:50%;cursor:ew-resize}.sg-crop-handle[data-crop-handle=e]{left:100%;top:50%;cursor:ew-resize}
.sg-crop-handle[data-crop-handle=w]::after,.sg-crop-handle[data-crop-handle=e]::after{width:3px;height:20px;border:0;background:currentColor}
.sg-crop-tools{display:flex;justify-content:center;align-items:center;gap:12px;flex:none}
.sg-image-editor .sg-crop-rotate{width:48px;padding:0;font:400 2rem/1 Arial,sans-serif}
.sg-crop-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;flex:none}
.sg-crop-actions>button{box-sizing:border-box;width:100%;height:44px;min-width:0;margin:0}
.sg-image-editor .sg-extra-status{margin:0;min-height:0;flex:none}
.sg-image-editor .sg-extra-status:empty{display:none}
#chatEditImage{flex:none;min-height:40px;padding:.45rem .85rem;border:1px solid #c1cbd9;border-radius:8px;background:#fff;color:#17273e;font-family:inherit;font-size:.85rem;font-weight:700;line-height:1.4;white-space:nowrap}
#chatEditImage:hover:not(:disabled),#chatEditImage:active{background:#fff2c6;border-color:#b48a15}
#chatEditImage:disabled{opacity:.55;cursor:wait}
@media(max-width:600px){.sg-extra-dialog{padding:18px;max-height:calc(100dvh - 16px);width:calc(100vw - 16px);border-radius:13px}.sg-extra-actions{display:grid;grid-template-columns:1fr 1fr}.sg-extra-actions button{padding:9px 7px;font-size:.85rem}.sg-image-editor[open]{height:calc(100dvh - 16px);padding:14px;gap:10px}}
@media(prefers-reduced-motion:reduce){.sg-extra-dialog::backdrop{backdrop-filter:none}}

.chat-image-preview:has(.chat-photo-list){display:block;min-width:0;padding:8px 4px;}
.chat-photo-list{display:flex;gap:10px;overflow-x:auto;max-width:100%;padding:6px 6px 4px;scroll-snap-type:x proximity;}
.chat-photo-card{position:relative;flex:0 0 112px;min-width:0;scroll-snap-align:start;}
.chat-photo-card .chat-photo-thumb{display:flex;align-items:center;justify-content:center;width:100%;height:96px;margin:0;padding:3px;background:#fff;border:1px solid #d5dbe3;border-radius:10px;overflow:hidden;color:#475569;font-size:12px;}
.chat-photo-card .chat-photo-thumb img{width:100%;height:100%;max-width:none;max-height:none;object-fit:contain;}
.chat-photo-card .chat-photo-number{position:absolute;top:5px;left:5px;min-width:19px;height:19px;border-radius:6px;background:#14243c;color:#fff;font-size:11px;line-height:19px;text-align:center;pointer-events:none;}
.chat-photo-card .chat-photo-remove{position:absolute;top:-4px;right:-4px;display:grid;place-items:center;width:28px;height:28px;min-width:28px;min-height:28px;margin:0;padding:0;border:1px solid #fff;border-radius:50%;background:#16243b;color:#fff;box-shadow:0 1px 4px #0003;font-size:23px;line-height:1;z-index:2;}
.chat-photo-card .chat-photo-edit{width:100%;min-height:32px;margin:4px 0 0;padding:3px 8px;border:1px solid #cbd5e1;border-radius:7px;background:#f8fafc;color:#14243c;font-size:13px;}
.chat-photo-count{margin:3px 7px 0;color:#526174;font-size:12px;}
.chat-message-photos{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px;}
.chat-message-photos .chat-saved-image{margin:0;}
@media(max-width:600px){.chat-photo-card{flex-basis:100px;}.chat-photo-card .chat-photo-thumb{height:84px;}.chat-photo-card .chat-photo-remove{width:30px;height:30px;}}
