/* Project file manager shares the workspace palette and works as a narrow PWA. */
.qpf-workspace { --qpf-line:var(--line); --qpf-soft:var(--soft); min-width:0; border:1px solid var(--qpf-line); border-radius:16px; background:var(--panel); overflow:visible; }
.qpf-heading { display:flex; justify-content:space-between; gap:20px; padding:25px 26px 19px; align-items:center; }
.qpf-heading-copy { min-width:0; }
.qpf-heading h2 { margin:6px 0; font-size:24px; overflow-wrap:anywhere; }
.qpf-heading p { margin:0; color:var(--muted); font-size:13px; }
.qpf-heading-actions { display:flex; gap:9px; flex-shrink:0; }
.qpf-tabs { display:flex; gap:24px; border-bottom:1px solid var(--qpf-line); padding:0 26px; }
.qpf-tabs>button { border:0; border-bottom:3px solid transparent; background:transparent; color:var(--muted); padding:14px 2px; font:inherit; font-weight:700; cursor:pointer; }
.qpf-tabs>button[aria-selected="true"] { color:var(--green); border-bottom-color:var(--green); }
.qpf-tabs>button>span { background:var(--qpf-soft); border-radius:6px; padding:2px 6px; font-size:11px; margin-left:5px; }
.qpf-browser { display:grid; grid-template-columns:210px minmax(0,1fr); }
.qpf-tree { padding:22px 12px; border-right:1px solid var(--qpf-line); min-width:0; }
.qpf-tree h3 { color:var(--muted); text-transform:uppercase; letter-spacing:.1em; font-size:10px; margin:0 12px 13px; }
.qpf-tree>button { display:flex; align-items:center; gap:9px; border:0; background:transparent; color:inherit; width:100%; font:inherit; text-align:left; font-size:12px; padding:10px 10px 10px calc(10px + var(--folder-depth,0)*9px); border-radius:8px; cursor:pointer; }
.qpf-tree>button.active { background:var(--accent-soft); color:var(--green); }
.qpf-tree>button:hover { background:var(--qpf-soft); }
.qpf-tree>button>span:not(.qpf-icon) { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.qpf-tree>button>small { margin-left:auto; color:var(--muted); }
.qpf-tree .qpf-icon { width:19px; height:20px; flex:0 0 19px; }
.qpf-tree>p { font-size:11px; color:var(--muted); padding:12px; line-height:1.7; }
.qpf-content { padding:18px 23px 15px; min-width:0; }
.qpf-path { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:20px; min-height:24px; color:var(--muted); font-size:12px; }
.qpf-path>button { border:0; background:transparent; color:inherit; padding:3px 0; font:inherit; cursor:pointer; max-width:100%; overflow-wrap:anywhere; text-align:left; }
.qpf-path>button:last-child { color:var(--ink); font-weight:600; }
.qpf-filters { display:grid; grid-template-columns:minmax(170px,1fr) 130px 140px auto; gap:12px; align-items:end; margin-bottom:25px; }
.qpf-filters .field { min-width:0; }
.qpf-filters label { display:flex; align-items:center; justify-content:space-between; font-size:10px; letter-spacing:.04em; }
.qpf-filters input,.qpf-filters select { min-height:41px; padding:9px 10px; font-size:12px; }
.qpf-layout-toggle { display:flex; border:1px solid var(--qpf-line); border-radius:8px; overflow:hidden; height:41px; }
.qpf-layout-toggle>button { border:0; background:transparent; color:var(--muted); width:34px; font-size:19px; cursor:pointer; }
.qpf-layout-toggle>button[aria-pressed="true"] { background:var(--accent-soft); color:var(--green); }
.qpf-folder-heading { display:flex; justify-content:space-between; gap:10px; margin:0 0 10px; font-size:13px; }
.qpf-folder-heading span { font-size:11px; color:var(--muted); }
.qpf-folder-heading strong { overflow-wrap:anywhere; }
.qpf-items { min-height:240px; border:1px solid var(--qpf-line); border-radius:10px; transition:background .15s; }
.qpf-items.dragover { background:var(--accent-soft); outline:2px dashed var(--green); outline-offset:-2px; }
.qpf-row { display:grid; grid-template-columns:minmax(120px,1fr) 94px 74px auto; align-items:center; gap:14px; padding:16px 14px; border-bottom:1px solid var(--qpf-line); }
.qpf-row:last-child { border-bottom:0; }
.qpf-row:hover { background:var(--qpf-soft); }
.qpf-row-name { min-width:0; display:flex; gap:12px; align-items:center; }
.qpf-row-name>div { min-width:0; }
.qpf-name { border:0; padding:0; font:inherit; font-size:13px; line-height:1.5; font-weight:650; color:inherit; text-align:left; background:transparent; text-decoration:none; cursor:pointer; overflow-wrap:anywhere; }
.qpf-name:hover { color:var(--green); }
.qpf-row-name small { display:block; color:var(--muted); margin-top:3px; font-size:11px; line-height:1.5; overflow-wrap:anywhere; }
.qpf-icon { display:inline-flex; align-items:center; justify-content:center; width:34px; height:40px; flex:0 0 34px; }
.qpf-icon svg { width:100%; height:auto; }
.qpf-icon.folder { color:var(--green); }
.qpf-icon.file { background:var(--blue-soft); border:1px solid var(--line); color:var(--steel); border-radius:5px 10px 5px 5px; font-size:8px; letter-spacing:.01em; font-weight:800; }
.qpf-icon.pdf { background:var(--danger-soft); border-color:var(--line); color:var(--danger); }
.qpf-row-date,.qpf-row-size { color:var(--muted); font-size:11px; white-space:nowrap; }
.qpf-row-date small { display:block; font-size:9px; text-transform:uppercase; letter-spacing:.03em; margin-bottom:4px; }
.qpf-row-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.qpf-row-actions>.button { font-size:10px; padding:7px 9px; white-space:nowrap; }
.qpf-menu { position:relative; }
.qpf-menu>summary { cursor:pointer; list-style:none; letter-spacing:2px; padding:9px 4px; line-height:1; color:var(--muted); font-size:10px; }
.qpf-menu>summary::-webkit-details-marker { display:none; }
.qpf-menu>div { position:absolute; z-index:15; top:100%; right:0; width:172px; border:1px solid var(--line); border-radius:9px; background:var(--panel); padding:5px; box-shadow:var(--shadow); }
.qpf-menu[open]>summary { color:var(--green); }
.qpf-menu>div>* { display:block; width:100%; border:0; border-radius:5px; background:transparent; padding:10px; font:inherit; text-align:left; color:inherit; font-size:12px; text-decoration:none; cursor:pointer; }
.qpf-menu>div>*:hover { background:var(--soft); }
.qpf-danger,.qpf-menu>div>.qpf-danger { color:var(--danger); }
.qpf-items.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:14px; border:0; align-content:start; }
.qpf-items.grid .qpf-row { display:flex; flex-wrap:wrap; border:1px solid var(--qpf-line); border-radius:10px; padding:18px; gap:14px 12px; }
.qpf-items.grid .qpf-row-name { width:100%; align-items:flex-start; }
.qpf-items.grid .qpf-row-date { flex:1; }
.qpf-items.grid .qpf-row-actions { width:100%; justify-content:space-between; border-top:1px solid var(--qpf-line); padding-top:10px; }
.qpf-items.grid .qpf-menu>summary { padding-left:14px; }
.qpf-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:50px 20px; text-align:center; grid-column:1/-1; min-height:240px; }
.qpf-empty .qpf-icon { width:53px; height:45px; flex-basis:45px; opacity:.8; }
.qpf-empty h3 { margin:15px 0 6px; font-size:16px; }
.qpf-empty p { color:var(--muted); font-size:12px; margin:0 0 20px; line-height:1.6; }
.qpf-drop-hint { font-size:11px; color:var(--muted); margin:14px 0 0; }
.qpf-takeoffs { padding:22px; }
.qpf-takeoff-intro { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:18px; }
.qpf-takeoff-intro h2 { font-size:19px; margin:0 0 5px; }
.qpf-takeoff-intro p { margin:0; font-size:12px; color:var(--muted); }
.qpf-tool-panel { margin-bottom:14px; }
.qpf-tool-panel>summary { cursor:pointer; padding:3px; }
.qpf-tool-panel>summary>strong { margin-left:5px; }
.qpf-tool-panel>summary>span { display:inline-block; color:var(--muted); margin-left:12px; font-size:12px; }
.qpf-tool-panel[open]>summary { margin-bottom:20px; }
.qpf-tool-panel .actions { margin-top:16px; }
.qpf-modal-backdrop { position:fixed; z-index:130; inset:0; background:var(--backdrop,rgba(15,23,42,.58)); backdrop-filter:blur(3px); display:flex; justify-content:center; align-items:center; padding:24px; }
.qpf-modal { background:var(--panel); border:1px solid var(--line); border-radius:16px; width:min(570px,100%); max-height:calc(100dvh - 48px); overflow:auto; padding:25px; box-shadow:var(--shadow); }
.qpf-modal .panel-head { margin-bottom:18px; }
.qpf-modal h2 { font-size:23px; margin:5px 0 0; }
.qpf-modal .field { margin-bottom:18px; }
.qpf-modal label { display:flex; align-items:center; justify-content:space-between; }
.qpf-modal input:not([type="hidden"]),.qpf-modal select,.qpf-modal textarea { width:100%; box-sizing:border-box; }
.qpf-modal small,.qpf-modal-path { color:var(--muted); font-size:12px; line-height:1.6; }
.qpf-modal p { overflow-wrap:anywhere; }
.qpf-modal .actions { justify-content:flex-end; margin-top:18px; }
.qpf-modal-error { color:var(--danger); font-size:13px; }
.qpf-modal-error:empty { display:none; }
.qpf-selected-files { list-style:none; margin:10px 0; padding:8px 12px; border-radius:8px; background:var(--soft); max-height:150px; overflow:auto; }
.qpf-selected-files li { display:flex; justify-content:space-between; gap:15px; margin:5px 0; font-size:11px; overflow-wrap:anywhere; }
.qpf-selected-files span { color:var(--muted); white-space:nowrap; }
.qpf-preview-loading { width:min(560px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); padding:24px; border:1px solid var(--line); border-radius:16px; background:var(--panel); color:var(--ink); box-shadow:var(--shadow); }
.qpf-preview-loading::backdrop { background:var(--backdrop,rgba(15,23,42,.58)); backdrop-filter:blur(3px); }
.qpf-preview-loading header { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.qpf-preview-loading header>div { min-width:0; }
.qpf-preview-loading h2 { margin:6px 0 0; font-size:19px; overflow-wrap:anywhere; }
.qpf-preview-loading [role=status] { margin:22px 0; line-height:1.7; color:var(--muted); overflow-wrap:anywhere; }
@media(max-width:1250px) {
  .qpf-browser { grid-template-columns:170px minmax(0,1fr); }
  .qpf-content { padding:18px 16px; }
  .qpf-filters { grid-template-columns:minmax(150px,1fr) 110px; }
  .qpf-layout-toggle { justify-self:end; }
  .qpf-row { grid-template-columns:minmax(130px,1fr) 88px auto; gap:10px; }
  .qpf-row-size { display:none; }
}
@media(max-width:820px) {
  .qpf-browser { display:block; }
  .qpf-tree { display:none; }
  .qpf-heading { padding:20px; align-items:flex-start; flex-direction:column; gap:16px; }
  .qpf-heading-actions { width:100%; }
  .qpf-heading-actions>.button { flex:1; }
  .qpf-tabs { padding:0 20px; }
  .qpf-row { grid-template-columns:minmax(0,1fr) auto; }
  .qpf-row-date { grid-column:1; padding-left:46px; font-size:10px; }
  .qpf-row-date small { display:inline; font-size:10px; margin-right:4px; text-transform:none; }
  .qpf-row-actions { grid-column:2; grid-row:1 / 3; }
  .qpf-items.grid .qpf-row-date { padding-left:0; }
  .qpf-items.grid { grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); }
  .qpf-takeoff-intro { flex-direction:column; align-items:flex-start; }
}
@media(max-width:500px) {
  .qpf-heading h2 { font-size:21px; }
  .qpf-heading-actions>.button { font-size:12px; padding:10px; min-height:42px; }
  .qpf-content { padding:16px 11px; }
  .qpf-filters { grid-template-columns:minmax(0,1fr) auto; gap:10px; }
  .qpf-filters .qpf-search { grid-column:1/-1; }
  .qpf-filters input,.qpf-filters select { font-size:16px; }
  .qpf-layout-toggle { grid-column:2; grid-row:3; }
  .qpf-filters>.field:nth-child(2) { grid-column:1/-1; }
  .qpf-row { padding:14px 10px; }
  .qpf-row-name { gap:9px; }
  .qpf-name { font-size:12px; }
  .qpf-icon { width:29px; flex-basis:29px; height:35px; }
  .qpf-row-actions { flex-direction:column; align-items:flex-end; gap:3px; }
  .qpf-menu>summary { padding:8px; }
  .qpf-row-date { padding-left:38px; }
  .qpf-items.grid { grid-template-columns:1fr; }
  .qpf-items.grid .qpf-row-actions { flex-direction:row; }
  .qpf-folder-heading { flex-wrap:wrap; }
  .qpf-drop-hint { display:none; }
  .qpf-modal-backdrop { padding:12px; }
  .qpf-modal { padding:20px; max-height:calc(100dvh - 24px); }
  .qpf-modal input,.qpf-modal select { font-size:16px; }
  .qpf-takeoffs { padding:14px; }
}

/* Field help must remain usable inside a file operation dialog. */
body:has(.qpf-modal-backdrop) .modal-backdrop { z-index:140; }

/* Fill the available workspace height without fixing the file list's height.
   Long folders, expanded takeoffs and upload notices still scroll with the page. */
@media screen {
  .layout[data-workspace-view="takeoff"] { min-height:100dvh; }
  .layout[data-workspace-view="takeoff"]>.main:has(>.qpf-workspace) {
    display:flex;
    flex-direction:column;
    padding-bottom:max(20px,var(--qps-safe-bottom,env(safe-area-inset-bottom,0px)));
  }
  .layout[data-workspace-view="takeoff"]>.main>.qpf-workspace {
    display:flex;
    flex-direction:column;
    flex:1 0 auto;
  }
  .qpf-workspace>.qpf-browser { flex:1 0 auto; }
  .qpf-content { display:flex; flex-direction:column; }
  .qpf-content>.qpf-items { flex:1 0 auto; }
  .qpf-items.list { display:flex; flex-direction:column; }
  .qpf-items.list>.qpf-row { flex:0 0 auto; }
  .qpf-items>.qpf-empty { flex:1 0 auto; }
  .qpf-items.grid:has(>.qpf-empty) { display:flex; flex-direction:column; }
  .qpf-workspace>.qpf-takeoffs { flex:1 0 auto; }
}
@media screen and (max-width:820px) {
  .qpf-workspace>.qpf-browser { display:flex; flex-direction:column; }
  .qpf-browser>.qpf-content { flex:1 0 auto; }
}
@media screen and (max-width:760px) {
  .layout[data-workspace-view="takeoff"]:has(>.main>.qpf-workspace) { display:flex; flex-direction:column; }
  .layout[data-workspace-view="takeoff"]>.main:has(>.qpf-workspace) { flex:1 0 auto; }
}
