/* The conversation owns the space. File tools and teaching controls open only on request. */
.pilot-chat-shell{padding:12px}
.pilot-chat-panel{box-sizing:border-box;width:min(1280px,100%);height:calc(100dvh - 24px);max-height:none;border-radius:18px;grid-template-rows:auto auto auto minmax(0,1fr) auto auto}
.pilot-chat-panel>.pilot-chat-top{grid-row:1}
.pilot-chat-panel>.chat-context{grid-row:2}
.pilot-chat-panel>#chat-pinned-question{grid-row:3}
.pilot-chat-panel>#chat-messages{grid-row:4}
.pilot-chat-panel>#chat-status{grid-row:5}
.pilot-chat-panel>.pilot-chat-composer{grid-row:6}
.chat-pinned-question[hidden]{display:none!important}
.chat-pinned-question{min-width:0;padding:7px clamp(12px,3vw,30px) 9px;background:#fffdf4;border-bottom:1px solid #e8dfb9;color:#273249}
.chat-pinned-question>div{display:flex;align-items:center;justify-content:space-between;gap:10px}
.chat-pinned-question strong{font-size:10px;letter-spacing:.04em;text-transform:uppercase;color:#77632b}
.chat-pinned-question button{min-height:28px;padding:4px 8px;border:1px solid #ddd3af;border-radius:7px;background:#fff;color:#5e4a12;font:750 11px system-ui;cursor:pointer}
.chat-pinned-question p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;margin:3px 0 0;font-size:14px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere}
.chat-pinned-question.question-expanded p{display:block;max-height:20dvh;overflow:auto;overscroll-behavior:contain}
.chat-pinned-question button:focus-visible,.chat-pinned-question p:focus-visible{outline:2px solid #9281e8;outline-offset:2px}
.pilot-chat-header{padding:10px 16px;gap:10px;min-height:60px;box-sizing:border-box}
.pilot-chat-header>div{flex:1;min-width:0}
.pilot-chat-header h2{font-size:18px;line-height:1.2}
.chat-title-row{display:flex;align-items:center;flex-wrap:wrap;gap:2px 12px;min-width:0}
.chat-title-row h2{min-width:0;overflow-wrap:anywhere}
.pilot-chat-header #rename-tutor{flex-shrink:0;min-height:32px;padding:4px 8px;border:1px solid #697593;border-radius:7px;background:#293453;color:#fff;font:650 12px/1.3 system-ui;cursor:pointer}
.pilot-chat-header .pilot-kicker{font-size:9px;margin:0 0 3px}
.pilot-chat-header .pilot-chat-avatar{width:32px;height:32px;border-radius:10px;flex-shrink:0}
.pilot-chat-header>#chat-search-open,.pilot-chat-header>#chat-expand,.pilot-chat-header>#chat-close{display:grid;place-items:center;width:38px;height:38px;min-width:38px;margin:0;padding:0;border:1px solid #536080;border-radius:9px;background:#222d4d;color:#fff;font:700 22px/1 system-ui;cursor:pointer}
.pilot-chat-header>#chat-close{font-size:26px}
.pilot-chat-header button:focus-visible,.chat-context>summary:focus-visible,.chat-options-menu>summary:focus-visible{outline:3px solid #b5adff;outline-offset:2px}
.pilot-chat-shell.chat-maximized{padding:0}
.chat-maximized .pilot-chat-panel{width:100%;height:100dvh;border-radius:0}
.chat-context{min-width:0;background:#f2f4ff;border-bottom:1px solid #d9dfef;color:#26334b}
.chat-context>summary{display:flex;align-items:center;gap:12px;padding:9px 18px;min-height:36px;box-sizing:border-box;cursor:pointer;font-size:12px;font-weight:750;list-style:none}
.chat-context>summary:before{content:'▸';color:#5146e5}
.chat-context[open]>summary:before{content:'▾'}
.chat-context>summary>span{flex-shrink:0}
.chat-context>summary>small{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;color:#5d6a84}
.chat-context-body{max-height:28dvh;overflow:auto;overscroll-behavior:contain}
.chat-context-body .chat-task-strip{border:0;padding:8px 18px 12px}
.chat-context-body #chat-free-reading{margin:0 12px 10px}
.chat-context-body #chat-free-reading .free-reading-body{max-height:none}
.pilot-chat-messages{padding:20px clamp(14px,3vw,40px);overscroll-behavior:contain;scrollbar-gutter:stable}
.pilot-chat-message>div{min-width:0;max-width:min(calc(100% - 42px),900px)}
.pilot-chat-message.user>div{max-width:min(85%,800px)}
.pilot-chat-message p{font-size:16px;line-height:1.6}
#chat-status{min-height:0;max-height:64px;overflow:auto;padding:4px 18px;font-size:12px}
#chat-status:empty{display:none}
.pilot-chat-composer{position:relative;padding:10px clamp(12px,3vw,30px) max(10px,env(safe-area-inset-bottom));min-width:0}
.pilot-chat-composer>#chat-input{display:block;box-sizing:border-box;width:100%;height:46px;min-height:46px;max-height:min(120px,20dvh);padding:10px 12px;border-radius:12px;font:inherit;font-size:16px;line-height:1.4;resize:none;overflow-y:auto}
.pilot-chat-composer>.pilot-chat-actions{display:flex;align-items:center;justify-content:flex-start;flex-wrap:nowrap;gap:8px;margin-top:7px}
.pilot-chat-composer .pilot-chat-actions>button{height:36px;min-height:36px;flex-shrink:0;font-size:12px}
.pilot-chat-composer #chat-attach{width:auto;flex:0 0 auto;padding:0 12px}
.pilot-chat-composer #chat-mic{width:38px;margin-left:auto}
.pilot-chat-composer #chat-send{min-width:66px;padding:0 14px}
.chat-options-menu{position:static;flex:0 0 auto;color:#26334b}
.chat-options-menu>summary{display:flex;align-items:center;gap:7px;box-sizing:border-box;min-height:36px;padding:7px 10px;border:1px solid #ccd4e2;border-radius:9px;font-size:12px;font-weight:750;cursor:pointer;list-style:none}
.chat-options-menu>summary:after{content:'⌃'}
.chat-options-menu[open]>summary{background:#eeebff;color:#4338ca}
.chat-options-body{position:absolute;z-index:6;bottom:54px;left:12px;box-sizing:border-box;width:min(400px,calc(100% - 24px));max-height:40dvh;overflow:auto;padding:15px;border:1px solid #cbd2e5;border-radius:14px;background:#fff;box-shadow:0 -8px 32px #17203b26}
.chat-options-body>strong{display:block;font-size:14px;margin-bottom:12px}
.chat-options-body .pilot-chat-options{display:grid;grid-template-columns:1fr 1fr;gap:10px;order:initial;width:100%;margin:0 0 12px}
.chat-options-body .pilot-chat-options label{min-width:0}
.chat-options-body .pilot-chat-options select{min-width:0;font-size:12px}
.chat-options-body>small{display:block;font-size:11px;line-height:1.45;margin-bottom:12px;color:#63708a}
.chat-options-body>button{min-height:36px;padding:7px 12px;border:1px solid #cbd3e3;background:#f5f4ff;color:#4338ca;font:750 12px system-ui}
.chat-options-body>#chat-options-done{float:right;background:#5146e5;color:#fff;border-color:#5146e5}
@media(max-width:600px){.pilot-chat-shell{padding:0}.pilot-chat-panel{width:100%;height:100dvh;border-radius:0}.pilot-chat-header{padding:8px 10px;gap:7px;min-height:56px}.pilot-chat-header h2{font-size:16px}.pilot-chat-header .pilot-chat-avatar{width:28px;height:28px}.pilot-chat-header>#chat-search-open,.pilot-chat-header>#chat-expand,.pilot-chat-header>#chat-close{width:34px;height:36px;min-width:34px}.chat-context>summary{padding:8px 12px;gap:8px}.pilot-chat-messages{padding:16px 10px}.pilot-chat-message>div{max-width:calc(100% - 40px)}.pilot-chat-message p{font-size:15px}.pilot-chat-composer{padding:8px 10px max(8px,env(safe-area-inset-bottom))}.pilot-chat-composer>.pilot-chat-actions{gap:6px}.pilot-chat-composer #chat-attach{padding:0 9px}.chat-options-menu>summary{padding:7px 9px}.pilot-chat-search{padding:8px 12px}.chat-context-body{max-height:26dvh}}
.tutor-rename-dialog{box-sizing:border-box;width:min(420px,calc(100% - 28px));max-height:calc(100dvh - 32px);overflow:auto;margin:auto;padding:24px;border:1px solid #d6dced;border-radius:18px;background:#fff;color:#19223e;box-shadow:0 20px 80px #10173155}
.tutor-rename-dialog::backdrop{background:#11193288}
.tutor-rename-dialog h2{margin:0 0 10px;font-size:23px;line-height:1.25}
.tutor-rename-dialog p{font-size:14px;line-height:1.5;color:#5d6881}
.tutor-rename-dialog label{display:block;margin:18px 0 7px;font-size:14px;font-weight:750}
.tutor-rename-dialog input{box-sizing:border-box;width:100%;min-height:46px;padding:10px 12px;border:1px solid #bcc6de;border-radius:10px;font:inherit;font-size:16px}
.tutor-rename-dialog form>div{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
.tutor-rename-dialog button{min-height:44px;padding:10px 16px;border:1px solid #cdd4e6;border-radius:10px;background:#f5f4ff;color:#4338ca;font:750 14px system-ui;cursor:pointer}
.tutor-rename-dialog #tutor-rename-save{background:#5146e5;border-color:#5146e5;color:#fff}
.tutor-rename-dialog #tutor-rename-error{color:#a82442}
.tutor-rename-dialog button:disabled{opacity:.6;cursor:wait}
.tutor-rename-dialog :focus-visible{outline:3px solid #ada3ff;outline-offset:2px}
@media(prefers-reduced-motion:reduce){.pilot-chat-panel{animation:none}}
