/* One reserved preview column; resizing changes the transcript's available width. */
@media(min-width:800px){
 body.artifact-open .chat-active .main-content{display:grid;grid-template-columns:minmax(0,1fr) clamp(280px,var(--preview-width,min(45vw,640px)),calc(100% - 340px));grid-template-rows:minmax(0,1fr);gap:16px;padding-block:0;padding-right:0;overflow:hidden}
 body.artifact-open .chat-view{grid-column:1;grid-row:1;width:100%;min-width:0;margin:0}
 body.artifact-open .artifact-panel:not(.preview-expanded){position:relative;inset:auto;grid-column:2;grid-row:1;width:100%;min-width:0;height:100%;max-height:100%;box-shadow:none;border-left:1px solid var(--line)}
 body.artifact-open .chat-header{right:calc(min(var(--preview-width,min(45vw,640px)),calc(100vw - var(--sidebar) - 364px)) + 24px)}
 body.artifact-open .sidebar-collapsed .chat-header{right:calc(var(--preview-width,min(45vw,640px)) + 24px)}
}
.artifact-panel-header{gap:8px;background:var(--paper);border-bottom:1px solid var(--line)}
.artifact-panel-header>div:first-child{min-width:0;flex:1}.artifact-panel-header strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500!important}
.artifact-panel-actions{display:flex;align-items:center;gap:3px;flex:none}
.artifact-panel:has(.archive-browser){grid-template-rows:40px minmax(0,1fr)}.artifact-panel:has(.archive-browser) .artifact-tabs{display:none}.artifact-panel:has(.archive-browser) #artifact-body{grid-row:2}
.file-viewer:has(.archive-browser) .file-viewer-toolbar{display:none}.file-viewer:has(.archive-browser){grid-template-rows:minmax(0,1fr)}
#project-download{display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:4px 8px;font-size:10px;white-space:nowrap;border-radius:7px}
.artifact-panel:has(.project-file-toggle) .artifact-tabs{display:flex;align-items:center;justify-content:space-between;gap:8px;overflow:visible;padding:4px 10px;background:#f4f3ef}
.project-file-toggle{display:flex;align-items:center;gap:7px;min-width:0;max-width:65%;height:30px;padding:4px 7px;background:transparent;border:1px solid transparent;border-radius:6px;font-size:11px;cursor:pointer}
.project-file-toggle:hover,.project-file-toggle[aria-expanded=true]{background:white;border-color:#ddd7ca}.project-file-toggle>span:first-of-type{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.project-view-modes{display:flex;flex:none;gap:2px;border:1px solid #dedbd3;border-radius:7px;padding:2px;background:#eceae3}
.project-view-modes .artifact-tab{min-height:25px;padding:3px 10px;border:0;border-radius:5px;font-size:10px;line-height:1.4;color:#787266}
.project-view-modes .artifact-tab.active{background:white;color:#28251f;box-shadow:0 1px 3px #0001}
.project-file-menu{position:absolute;z-index:20;left:10px;top:78px;width:min(300px,calc(100% - 20px));max-height:calc(100% - 94px);overflow:auto;background:#fafaf8;border:1px solid #d8cfbd;border-radius:12px;padding:10px;box-shadow:0 10px 35px #0002}
.file-tree{list-style:none;margin:0;padding:0;min-width:0}.file-tree .file-tree{margin-left:10px;padding-left:9px;border-left:1px solid #e5e1d8}
.file-tree li{margin:1px 0;padding:0;min-width:0}.file-tree summary,.file-tree button{display:flex;align-items:center;gap:8px;min-width:0;width:100%;padding:7px 8px;min-height:32px;border:0;border-radius:6px;background:none;font:12px/1.4 var(--font-ui,system-ui);color:#4e4a42;text-align:left;cursor:pointer}
.file-tree summary{list-style:none;font-weight:500}.file-tree summary::-webkit-details-marker{display:none}.file-tree summary::before{content:'›';color:#8b8170}.file-tree details[open]>summary::before{transform:rotate(90deg)}
.file-tree button>span,.file-tree summary>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.file-tree button[aria-selected=true]{background:#f0e8d5;color:#775513}.file-tree button:hover,.file-tree summary:hover{background:#f1eee6}
.archive-browser{display:flex;flex-direction:column;height:100%;min-height:0;background:#fafaf8}.archive-browser>header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;border-bottom:1px solid var(--line);font-size:11px;color:#777064;flex:none}
.archive-browser>header a{display:inline-flex;align-items:center;gap:6px;font-size:11px}.archive-browser-content{display:grid;grid-template-columns:minmax(160px,34%) minmax(0,1fr);flex:1;min-height:0}
.archive-toolbar-actions{display:flex;align-items:center;gap:6px}
.archive-tree{padding:12px 8px;border-right:1px solid var(--line);overflow:auto}.archive-selected{overflow:auto;min-width:0;min-height:0;padding:14px;background:white}.archive-selected>p{font-size:12px;color:#827a6c}.archive-selected pre{margin:0;font-size:12px;line-height:1.6;white-space:pre}
.chat-header-actions{position:relative;display:flex;flex-direction:row;align-items:center;gap:4px!important;flex-shrink:0}.chat-header .chat-header-actions .icon-button{width:36px;height:36px;min-height:36px;padding:8px;flex:none}
.chat-header{height:56px}.chat-files-popup{position:fixed;z-index:90;width:min(360px,calc(100vw - 20px));max-height:min(520px,calc(var(--app-height,100dvh) - 120px));display:flex;flex-direction:column;padding:12px;border:1px solid #d5cbb8;border-radius:14px;background:#fafaf8;box-shadow:0 15px 48px #0002}
.chat-files-popup header{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12px}.chat-files-popup header strong{font-weight:500}.chat-files-popup header span{font-size:10px;color:#8d8068;margin-left:5px}
.chat-files-popup input{margin:8px 0;padding:8px 10px;border:1px solid #ddd8cd;border-radius:8px;font-size:12px;min-width:0}.chat-files-list{overflow:auto;min-height:0;overscroll-behavior:contain;padding:4px 0;font-size:12px;color:#80796d}
.chat-file-row{display:flex;gap:10px;align-items:center;width:100%;padding:10px 7px;background:none;border:0;border-radius:8px;text-align:left;cursor:pointer}.chat-file-row:hover{background:#f0ece2}.chat-file-row>span{min-width:0}.chat-file-row strong{display:block;font-weight:500;font-size:12px;overflow-wrap:anywhere}.chat-file-row small{display:block;margin-top:3px;font-size:10px;color:#8b8272}
@media(max-width:799px){body.artifact-open .chat-active .main-content{padding-right:10px}body.artifact-open #view-chat{visibility:hidden;pointer-events:none}.artifact-panel{position:fixed;left:0;right:0;top:calc(var(--app-top,0px) + 48px);width:100%;min-width:0;height:calc(var(--app-height,100dvh) - 48px)}.preview-resizer{display:none}.chat-header-actions{flex-direction:row!important}.chat-header{height:auto}.chat-files-popup{right:10px!important}.archive-browser-content{grid-template-columns:minmax(130px,42%) minmax(0,1fr)}.file-tree button,.file-tree summary{min-height:40px}.archive-selected{padding:8px}}
@media(max-width:799px){body.artifact-open .question-cards{display:none}}

/* Working draft: readable chrome and immediate feedback, independent of project CSS. */
.artifact-panel{grid-template-rows:48px 42px minmax(0,1fr)}
.artifact-panel:has(.archive-browser){grid-template-rows:48px minmax(0,1fr)}
.artifact-panel-header{padding-inline:14px;gap:12px;background:#fafaf8}
.artifact-panel-header strong{font-size:14px;font-weight:650!important;line-height:1.4;color:#24282d}
.artifact-panel-actions .icon-button{width:32px;height:32px;color:#454a52}
#project-download{font-size:13px;font-weight:600;min-height:32px;padding:5px 9px;gap:5px;color:#30363d}
.project-file-toggle{font-size:13px;height:34px;color:#424850;font-weight:500}
.project-view-modes .artifact-tab{min-height:30px;font-size:12px;font-weight:500;color:#535b63}
.project-view-modes .artifact-tab.active{font-weight:650;color:#20252b}
.project-file-menu{top:92px;max-height:calc(100% - 108px)}
.project-delivery{padding:18px;background:#fff;border-color:#d6d8d0}
.project-delivery-heading strong{font-size:16px;font-weight:650;line-height:1.4;color:#25292d}
.project-delivery-heading small{font-size:13px;color:#555d65;margin-top:4px}
.project-state{font-size:12px;font-weight:600;color:#584c2b;background:#f2ead7}
.project-state.ready{color:#294d31;background:#e6f0e7}
.project-delivery-actions .button{font-size:13px;font-weight:600;min-height:36px}
.file-project-group>summary{font-size:14px;font-weight:650;color:#30363d}
.file-project-group>summary small,.files-revision-note{font-size:12px;color:#58616a}
.chat-files-popup header strong{font-size:15px;font-weight:650;color:#25292d}
.chat-file-row strong{font-size:13px;font-weight:600;color:#30363d}
.chat-file-row small{font-size:12px;color:#58616a}
.archive-browser>header{font-size:13px;font-weight:600;color:#454e58}
.archive-browser>header a{font-size:13px;color:#30363d}
.file-tree button,.file-tree summary{font-size:13px;color:#414b54}
.file-tree button[aria-selected=true]{color:#584114;font-weight:600}
.viewer-loading{display:flex;min-height:200px;height:100%;box-sizing:border-box;align-items:center;justify-content:center;flex-direction:column;gap:12px;padding:24px;text-align:center;background:#fafaf8;color:#58616a;font-size:13px;line-height:1.6}
.viewer-loading strong{font-size:16px;font-weight:650;color:#25292d}
.viewer-loading p{margin:0;max-width:38ch;overflow-wrap:anywhere}
.viewer-spinner{display:block;width:24px;height:24px;border:2px solid #e0d9c5;border-top-color:#9b741f;border-radius:50%;animation:kryyt-working .85s linear infinite}
#artifact-body{position:relative}
.viewer-frame-loading{position:absolute;inset:0;z-index:1;min-height:0}
#artifact-open[aria-disabled=true]{opacity:.4;pointer-events:none}
@media(max-width:799px){.chat-header{min-height:48px}.chat-header .chat-header-actions .icon-button{width:40px;height:40px;min-height:40px;padding:10px}.artifact-panel-header{padding-inline:8px;gap:6px}.artifact-panel-header strong{font-size:13px}.artifact-panel-actions{gap:1px}.artifact-panel-actions .icon-button{width:30px}.project-file-toggle{max-width:58%}.project-delivery{padding:14px}}
@media(prefers-reduced-motion:reduce){.viewer-spinner{animation:none;border-top-color:#9b741f;border-right-color:#9b741f}}
