/* ======================================================================
   DRIVE WINDOW — Google Drive-style layout (Cloudinary-backed).
   Scoped to #driveOverlay so the editor's Drive tab (.bin-drive-*) is untouched.
   Colours come from the app's own variables; the light theme gets its own tokens.
   ====================================================================== */
#driveOverlay{
  --gd-surface:var(--panel);
  --gd-side:var(--bg);
  --gd-chip:var(--panel2);
  --gd-hover:rgba(255,255,255,.06);
  --gd-sel:rgba(201,154,63,.22);
  --gd-line:var(--line);
  --gd-field:var(--panel2);
  --gd-text:var(--text);
  --gd-muted:var(--muted);
}
body.light-mode #driveOverlay{
  --gd-surface:#ffffff;
  --gd-side:#f6f3ea;
  --gd-chip:#f3f0e6;
  --gd-hover:rgba(60,50,20,.07);
  --gd-sel:rgba(201,154,63,.22);
  --gd-line:#e4e0d4;
  --gd-field:#ebe8dc;
  --gd-text:#2b2a22;
  --gd-muted:#6b665a;
}

#driveOverlay .gd-shell{
  width:min(1320px, 98vw); height:min(860px, 95vh);
  background:var(--gd-side); border:1px solid var(--gd-line); border-radius:18px;
  display:flex; flex-direction:column; overflow:hidden; position:relative; color:var(--gd-text);
}

/* ---------- top bar ---------- */
#driveOverlay .gd-top{
  display:grid; grid-template-columns:minmax(150px,240px) minmax(0,720px) 1fr; align-items:center; gap:12px;
  padding:10px 16px; border:0; background:transparent; flex-wrap:nowrap;
}
#driveOverlay .gd-brand{ display:flex; align-items:center; gap:10px; }
#driveOverlay .gd-brand h2{ margin:0; font-size:22px; font-weight:500; letter-spacing:0; color:var(--gd-text); }
#driveOverlay .gd-search{
  display:flex; align-items:center; gap:12px; height:48px; padding:0 18px;
  background:var(--gd-field); border:1px solid transparent; border-radius:26px; color:var(--gd-muted);
  transition:background .15s, box-shadow .15s, border-color .15s; cursor:text;
}
#driveOverlay .gd-search:focus-within{ background:var(--gd-surface); border-color:var(--gold); box-shadow:0 2px 10px rgba(0,0,0,.2); color:var(--gd-text); }
#driveOverlay .gd-search input{
  flex:1; min-width:0; width:auto; background:none; border:0; outline:0; padding:0; border-radius:0;
  font-size:15px; color:var(--gd-text); box-shadow:none;
}
#driveOverlay .gd-search input::placeholder{ color:var(--gd-muted); }
#driveOverlay .gd-top-right{ display:flex; align-items:center; justify-content:flex-end; gap:10px; }
#driveOverlay .gd-close{
  width:40px; height:40px; border-radius:50%; border:0; background:none; color:var(--gd-muted);
  font-size:26px; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0;
}
#driveOverlay .gd-close:hover{ background:var(--gd-hover); color:var(--gd-text); }
#driveOverlay .drive-status{ margin:0 16px 8px; }

/* ---------- body: sidebar + main panel ---------- */
#driveOverlay .gd-layout{ flex:1; min-height:0; display:flex; gap:0; padding:0 12px 12px 0; }
#driveOverlay .gd-side{
  width:248px; flex:none; display:flex; flex-direction:column; gap:2px; padding:4px 12px 12px 12px; overflow-y:auto;
}
#driveOverlay .gd-new-wrap{ position:relative; margin:4px 0 14px 0; }
#driveOverlay .gd-new{
  display:inline-flex; align-items:center; gap:12px; height:56px; padding:0 24px 0 16px; border:0; border-radius:18px;
  background:var(--gd-surface); color:var(--gd-text); font-size:15px; font-weight:600; cursor:pointer;
  box-shadow:0 1px 3px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2); transition:box-shadow .15s, background .15s;
}
#driveOverlay .gd-new svg{ color:var(--gold); }
#driveOverlay .gd-new:hover{ box-shadow:0 2px 6px rgba(0,0,0,.4), 0 6px 16px rgba(0,0,0,.25); background:var(--gd-chip); }
body.light-mode #driveOverlay .gd-new{ box-shadow:0 1px 3px rgba(70,60,20,.25), 0 2px 8px rgba(70,60,20,.12); }
#driveOverlay .gd-new-menu{
  position:absolute; top:62px; left:0; z-index:30; min-width:236px; padding:8px 0;
  background:var(--gd-surface); border:1px solid var(--gd-line); border-radius:12px; box-shadow:0 12px 36px rgba(0,0,0,.45);
}
#driveOverlay .gd-new-menu[hidden]{ display:none; }
#driveOverlay .gd-new-menu hr{ border:0; border-top:1px solid var(--gd-line); margin:6px 0; }
#driveOverlay .gd-new-menu button{
  display:flex; align-items:center; gap:14px; width:100%; padding:10px 18px; border:0; background:none;
  color:var(--gd-text); font-size:14px; text-align:left; cursor:pointer; border-radius:0;
}
#driveOverlay .gd-new-menu button:hover{ background:var(--gd-hover); }
#driveOverlay .gd-new-menu svg{ color:var(--gd-muted); flex:none; }

#driveOverlay .gd-nav{ display:flex; flex-direction:column; gap:2px; padding:0; flex-wrap:nowrap; }
#driveOverlay .gd-nav button, #driveOverlay .gd-side-link{
  display:flex; align-items:center; gap:16px; width:100%; height:40px; padding:0 16px; border:0; border-radius:20px;
  background:none; color:var(--gd-text); font-size:14px; font-weight:500; text-align:left; cursor:pointer;
}
#driveOverlay .gd-nav button svg, #driveOverlay .gd-side-link svg{ flex:none; color:var(--gd-muted); }
#driveOverlay .gd-nav button:hover, #driveOverlay .gd-side-link:hover{ background:var(--gd-hover); color:var(--gd-text); border:0; }
#driveOverlay .gd-nav button.active{ background:var(--gd-sel); color:var(--gd-text); font-weight:700; border:0; }
#driveOverlay .gd-nav button.active svg{ color:var(--gold); }
#driveOverlay .gd-nav button.drop-target{ box-shadow:0 0 0 2px var(--gold) !important; background:var(--gd-sel) !important; }
#driveOverlay .gd-side-sep{ height:1px; background:var(--gd-line); margin:10px 8px; }
#driveOverlay .gd-side-foot{ margin-top:auto; padding:14px 16px 4px; font-size:12px; line-height:1.5; color:var(--gd-muted); }
#driveOverlay .gd-side-foot b{ color:var(--gd-text); font-weight:600; }

#driveOverlay .gd-main{
  flex:1; min-width:0; display:flex; flex-direction:column;
  background:var(--gd-surface); border-radius:16px; overflow:hidden; position:relative;
}

/* ---------- toolbar: breadcrumb + sort + layout ---------- */
#driveOverlay .gd-toolbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:56px; padding:6px 16px 6px 10px;
  border-bottom:1px solid var(--gd-line);
}
#driveOverlay .gd-main.has-sel .gd-toolbar{ display:none; }
#driveOverlay .gd-crumbs{ display:flex; align-items:center; flex-wrap:wrap; gap:0; padding:0; min-width:0; font-size:18px; }
#driveOverlay .gd-crumbs .drive-crumb{
  background:none; border:0; border-radius:20px; padding:6px 12px; font-size:18px; color:var(--gd-muted); cursor:pointer;
  max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
#driveOverlay .gd-crumbs .drive-crumb:hover{ background:var(--gd-hover); color:var(--gd-text); border:0; }
#driveOverlay .gd-crumbs .drive-crumb.current{ color:var(--gd-text); font-weight:500; border:0; }
#driveOverlay .gd-crumbs .drive-sep{ color:var(--gd-muted); font-size:20px; line-height:1; }
#driveOverlay .gd-view{ display:flex; align-items:center; gap:10px; flex:none; }
#driveOverlay .gd-view select{
  height:34px; border:1px solid var(--gd-line); border-radius:18px; padding:0 12px; font-size:13px;
  background:var(--gd-surface); color:var(--gd-text); cursor:pointer; width:auto;
}
#driveOverlay .gd-seg{ display:inline-flex; border:1px solid var(--gd-line); border-radius:18px; overflow:hidden; }
#driveOverlay .gd-seg button{
  width:44px; height:34px; border:0; background:none; color:var(--gd-muted); cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0;
}
#driveOverlay .gd-seg button + button{ border-left:1px solid var(--gd-line); }
#driveOverlay .gd-seg button:hover{ background:var(--gd-hover); }
#driveOverlay .gd-seg button.active{ background:var(--gd-sel); color:var(--gd-text); }

/* ---------- selection bar (replaces the toolbar, like Drive) ---------- */
#driveOverlay .gd-batch{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:8px 12px; padding:6px 10px; min-height:44px;
  background:var(--gd-sel); border:0; border-radius:24px; box-shadow:none;
}
#driveOverlay .gd-batch[hidden]{ display:none; }
#driveOverlay .gd-batch b{ font-size:14px; font-weight:600; color:var(--gd-text); margin-right:8px; }
#driveOverlay .gd-batch-x{
  width:32px; height:32px; border-radius:50%; border:0; background:none; color:var(--gd-text); font-size:22px; line-height:1; cursor:pointer; padding:0;
}
#driveOverlay .gd-batch-x:hover{ background:var(--gd-hover); }
#driveOverlay .gd-batch .drive-batch-actions{ display:flex; gap:4px; flex-wrap:wrap; }
#driveOverlay .gd-batch .drive-batch-actions button{
  background:none; border:0; border-radius:18px; padding:7px 14px; font-size:13px; font-weight:500; color:var(--gd-text);
}
#driveOverlay .gd-batch .drive-batch-actions button:hover{ background:var(--gd-hover); color:var(--gd-text); border:0; }
#driveOverlay .gd-batch .drive-batch-actions button.danger{ color:var(--danger); border:0; }
#driveOverlay .gd-batch .drive-batch-actions button.danger:hover{ background:rgba(200,60,60,.15); }

/* ---------- content ---------- */
#driveOverlay .gd-body{ flex:1; min-height:0; overflow:auto; padding:4px 16px 24px; position:relative; }
#driveOverlay .gd-content{ display:block; }
#driveOverlay .gd-sec h3{ margin:18px 0 10px 2px; font-size:14px; font-weight:600; color:var(--gd-muted); letter-spacing:0; text-transform:none; }
#driveOverlay .gd-cards{ display:grid; gap:12px; }
#driveOverlay .gd-folders{ grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); }
#driveOverlay .gd-files{ grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:16px; }

/* shared item reset: every old .drive-item rule is overridden here (ID specificity) */
#driveOverlay .gd-item{
  position:relative; background:var(--gd-chip); border:1px solid transparent; border-radius:12px; padding:0;
  text-align:left; cursor:default; transition:background .12s, border-color .12s, box-shadow .12s; transform:none;
  user-select:none; -webkit-user-select:none; min-width:0;
}
#driveOverlay .gd-item:hover{ background:var(--gd-hover); border-color:transparent; transform:none; box-shadow:none; }
#driveOverlay .gd-card:hover, #driveOverlay .gd-chip:hover{ background:var(--gd-hover); }
#driveOverlay .gd-item.selected{
  background:var(--gd-sel) !important; border-color:var(--gold) !important; box-shadow:none !important;
}
#driveOverlay .gd-item.selected .drive-thumb{ outline:0; }
#driveOverlay .gd-item.drop-target{ border-color:var(--gold) !important; box-shadow:0 0 0 2px var(--gold) !important; transform:none; }
#driveOverlay .gd-item .drive-name{
  flex:1; min-width:0; padding:0; font-size:14px; font-weight:500; color:var(--gd-text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#driveOverlay .gd-item .drive-ic{ display:flex; align-items:center; justify-content:center; filter:none; color:var(--gd-muted); }
#driveOverlay .gd-item .drive-ic svg{ display:block; }

/* folder chip (grid layout) */
#driveOverlay .gd-item.dir.gd-card{ display:flex; align-items:center; gap:14px; height:52px; padding:0 8px 0 16px; }
#driveOverlay .gd-item.dir .gd-chip-ic svg{ width:24px; height:24px; fill:currentColor; stroke:none; }
#driveOverlay .gd-item.dir .gd-chip-ic{ color:var(--gd-muted); }
#driveOverlay .gd-item.dir .drive-check{ display:none; }

/* file card (grid layout) */
#driveOverlay .gd-item.gd-card:not(.dir){ display:flex; flex-direction:column; padding:10px 8px 8px; gap:10px; border-radius:14px; }
#driveOverlay .gd-card-head{ display:flex; align-items:center; gap:10px; padding:0 34px 0 6px; min-height:24px; }
#driveOverlay .gd-kind svg{ width:20px; height:20px; }
#driveOverlay .gd-item.k-audio .gd-kind{ color:#d96b5f; }
#driveOverlay .gd-item.k-image .gd-kind{ color:#d9534f; }
#driveOverlay .gd-item.k-text .gd-kind{ color:#4f7fc4; }
#driveOverlay .gd-item.k-other .gd-kind{ color:var(--gd-muted); }
#driveOverlay .gd-item.k-audio .gd-kind{ color:#e0a23a; }
#driveOverlay .gd-item.k-image .gd-kind{ color:#d9534f; }
#driveOverlay .gd-card-thumb{
  position:relative; height:150px; margin:0; border-radius:8px; overflow:hidden; display:flex; align-items:center; justify-content:center;
  background:var(--gd-surface); border:1px solid var(--gd-line);
}
#driveOverlay .gd-card-thumb .drive-ic svg{ width:54px; height:54px; stroke-width:1.3; opacity:.75; }
#driveOverlay .gd-item.k-audio .gd-card-thumb .drive-ic{ color:#e0a23a; }
#driveOverlay .gd-item.k-text .gd-card-thumb .drive-ic{ color:#4f7fc4; }
#driveOverlay .gd-img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transition:opacity .25s; }
#driveOverlay .gd-img.ok{ opacity:1; }
#driveOverlay .gd-card:not(.dir) .drive-check{ top:16px; left:14px; }

/* checkbox: shown on hover / when selected */
#driveOverlay .gd-item .drive-check{
  position:absolute; z-index:4; width:22px; height:22px; border-radius:50%; top:50%; left:8px; margin-top:-11px;
  background:var(--gd-surface); border:1px solid var(--gd-line); opacity:0; backdrop-filter:none;
}
#driveOverlay .gd-item:hover .drive-check, #driveOverlay .gd-item.selected .drive-check{ opacity:1; }
#driveOverlay .gd-item.selected .drive-check{ background:var(--gold); border-color:var(--gold); }

/* ⋮ actions button */
#driveOverlay .gd-item .drive-more{
  position:absolute; top:50%; right:6px; margin-top:-16px; width:32px; height:32px; border-radius:50%;
  background:none; color:var(--gd-muted); font-size:18px; line-height:1; opacity:0; display:flex; align-items:center; justify-content:center; padding:0;
}
#driveOverlay .gd-card:not(.dir) .drive-more{ top:14px; margin-top:0; right:8px; width:30px; height:30px; }
#driveOverlay .gd-item:hover .drive-more, #driveOverlay .gd-item.selected .drive-more, #driveOverlay .gd-item .drive-more:focus-visible{ opacity:1; }
#driveOverlay .gd-item .drive-more:hover{ background:var(--gd-hover); color:var(--gd-text); }

/* ---------- list layout ---------- */
#driveOverlay .gd-row{
  display:flex; align-items:center; gap:14px; height:48px; padding:0 12px 0 44px; border-radius:0; background:none;
  border:0; border-bottom:1px solid var(--gd-line);
}
#driveOverlay .gd-row-head{ position:sticky; top:0; z-index:3; height:40px; background:var(--gd-surface); font-size:13px; color:var(--gd-muted); font-weight:600; }
#driveOverlay .gd-row-head .drive-name{ flex:1; min-width:0; font-size:13px; font-weight:600; color:var(--gd-muted); }
#driveOverlay .gd-row-head .gd-col{ font-weight:600; }
#driveOverlay .gd-row.gd-item{ border-radius:0; border:0; border-bottom:1px solid var(--gd-line); background:none; }
#driveOverlay .gd-row.gd-item:hover{ background:var(--gd-hover); }
#driveOverlay .gd-row.gd-item.selected{ border-bottom-color:var(--gd-line) !important; border-top:0; }
#driveOverlay .gd-row-ic{ width:24px; flex:none; }
#driveOverlay .gd-row-ic svg{ width:22px; height:22px; }
#driveOverlay .gd-row.dir .gd-row-ic svg{ fill:currentColor; stroke:none; }
#driveOverlay .gd-col{ flex:none; font-size:13px; color:var(--gd-muted); white-space:nowrap; }
#driveOverlay .gd-col-date{ width:150px; }
#driveOverlay .gd-col-size{ width:100px; text-align:right; margin-right:36px; }
#driveOverlay .gd-row-head .gd-col-size{ margin-right:36px; }
#driveOverlay .gd-row .drive-check{ left:12px; }
#driveOverlay .gd-row.dir .drive-check{ display:flex; }
#driveOverlay .gd-row .drive-more{ right:8px; }

/* ---------- empty state + drop overlay ---------- */
#driveOverlay .gd-empty{
  display:flex; flex-direction:column; align-items:center; text-align:center; padding:64px 20px; color:var(--gd-muted); font-size:14px; line-height:1.7;
}
#driveOverlay .gd-empty[hidden]{ display:none; }
#driveOverlay .gd-empty svg{ color:var(--gd-muted); opacity:.7; margin-bottom:10px; }
#driveOverlay .gd-empty b{ color:var(--gd-text); font-size:22px; font-weight:500; margin-bottom:6px; }
#driveOverlay .gd-dropzone{
  position:absolute; inset:8px; border:3px dashed var(--gold); border-radius:18px; background:rgba(201,154,63,.12);
  display:none; align-items:center; justify-content:center; font-size:20px; font-weight:600; color:var(--gold); pointer-events:none; z-index:50;
  backdrop-filter:blur(2px);
}
#driveOverlay.dragging .gd-dropzone{ display:flex; }

/* sign-in / set-up panel inside the main area */
#driveOverlay .drive-gate{ color:var(--gd-text); }
#driveOverlay .drive-gate b{ font-size:20px; font-weight:500; }

/* ---------- phones: sidebar becomes a scrolling tab strip ---------- */
@media (max-width:820px){
  #driveOverlay .gd-shell{ width:100vw; height:100dvh; max-height:100dvh; border-radius:0; border:0; }
  #driveOverlay .gd-top{ grid-template-columns:auto minmax(0,1fr) auto; gap:8px; padding:8px 10px; }
  #driveOverlay .gd-brand h2{ display:none; }
  #driveOverlay .gd-search{ height:42px; padding:0 14px; }
  #driveOverlay .gd-top-right .drive-mode{ display:none; }
  #driveOverlay .gd-layout{ flex-direction:column; padding:0 8px 8px; }
  #driveOverlay .gd-side{ width:auto; flex-direction:row; align-items:center; gap:8px; padding:0 4px 8px; overflow-x:auto; overflow-y:hidden; }
  #driveOverlay .gd-new-wrap{ margin:0; flex:none; }
  #driveOverlay .gd-new{ height:44px; padding:0 16px 0 12px; border-radius:14px; }
  #driveOverlay .gd-nav{ flex-direction:row; gap:6px; }
  #driveOverlay .gd-nav button, #driveOverlay .gd-side-link{ width:auto; height:36px; padding:0 14px; gap:8px; border:1px solid var(--gd-line); white-space:nowrap; flex:none; }
  #driveOverlay .gd-side-sep, #driveOverlay .gd-side-foot{ display:none; }
  #driveOverlay .gd-crumbs, #driveOverlay .gd-crumbs .drive-crumb{ font-size:15px; }
  #driveOverlay .gd-view select{ display:none; }
  #driveOverlay .gd-folders{ grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); }
  #driveOverlay .gd-files{ grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px; }
  #driveOverlay .gd-card-thumb{ height:110px; }
  #driveOverlay .gd-col-date{ display:none; }
  #driveOverlay .gd-item .drive-more{ opacity:1; }
}

/* ======================================================================
   TOUCH / PHONE: bigger targets, no hover-only controls, bottom-sheet menus,
   a floating "New" button and safe-area padding.
   ====================================================================== */
#driveOverlay .gd-item{ -webkit-touch-callout:none; -webkit-tap-highlight-color:transparent; }
@media (pointer:coarse), (max-width:820px){
  #driveOverlay .gd-shell{ padding-top:env(safe-area-inset-top, 0px); padding-bottom:env(safe-area-inset-bottom, 0px); }
  #driveOverlay .gd-search input{ font-size:16px; }            /* 16px stops iOS zooming the page on focus */
  #driveOverlay .gd-close{ width:44px; height:44px; }
  #driveOverlay .gd-nav button, #driveOverlay .gd-side-link{ min-height:44px; height:44px; }
  #driveOverlay .gd-seg button{ width:48px; height:40px; }

  /* nothing may depend on hover: actions are always visible */
  #driveOverlay .gd-item .drive-more{ opacity:1; width:40px; height:40px; font-size:20px; }
  #driveOverlay .gd-card:not(.dir) .drive-more{ top:10px; right:4px; width:40px; height:40px; margin-top:0; }
  #driveOverlay .gd-item.dir .drive-more{ margin-top:-20px; right:2px; }
  #driveOverlay .gd-item .drive-check{ width:26px; height:26px; margin-top:-13px; }
  #driveOverlay .gd-main.has-sel .gd-item .drive-check{ opacity:1; }
  #driveOverlay .gd-main.has-sel .gd-card.dir .drive-check{ display:flex; }
  #driveOverlay .gd-main.has-sel .gd-card.dir{ padding-left:44px; }
  #driveOverlay .gd-card:not(.dir) .drive-check{ top:20px; left:12px; margin-top:0; }
  #driveOverlay .gd-card-head{ padding-right:44px; }
  #driveOverlay .gd-item.dir.gd-card{ height:56px; }

  /* list rows: roomy, name + size only */
  #driveOverlay .gd-row{ height:60px; padding-left:16px; }
  #driveOverlay .gd-main.has-sel .gd-row{ padding-left:48px; }
  #driveOverlay .gd-col-size{ width:auto; margin-right:44px; }
  #driveOverlay .gd-row-head{ height:36px; }
  #driveOverlay .gd-row .drive-more{ right:4px; }

  /* breadcrumb scrolls sideways instead of wrapping */
  #driveOverlay .gd-crumbs{ flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
  #driveOverlay .gd-crumbs::-webkit-scrollbar{ display:none; }
  #driveOverlay .gd-crumbs .drive-crumb{ flex:none; padding:10px 12px; }

  /* selection bar: one scrolling row */
  #driveOverlay .gd-batch{ flex-wrap:nowrap; overflow-x:auto; margin:6px 8px; scrollbar-width:none; }
  #driveOverlay .gd-batch::-webkit-scrollbar{ display:none; }
  #driveOverlay .gd-batch .drive-batch-actions{ flex-wrap:nowrap; }
  #driveOverlay .gd-batch .drive-batch-actions button{ white-space:nowrap; min-height:40px; }
  #driveOverlay .gd-batch-x{ width:40px; height:40px; flex:none; }
  #driveOverlay .gd-batch b{ white-space:nowrap; }

  #driveOverlay .gd-body{ padding-bottom:104px; overscroll-behavior:contain; }
  #driveOverlay .gd-empty{ padding:40px 16px; }
  #driveOverlay .gd-empty svg{ width:110px; height:auto; }
}
@media (max-width:820px){
  /* "New" floats at the bottom-right like Drive's mobile app */
  #driveOverlay .gd-new-wrap{ position:fixed; right:16px; bottom:calc(18px + env(safe-area-inset-bottom, 0px)); margin:0; z-index:60; }
  #driveOverlay .gd-new{ height:56px; padding:0 22px 0 16px; border-radius:18px; background:var(--gold); color:#241c05; box-shadow:0 6px 18px rgba(0,0,0,.45); }
  #driveOverlay .gd-new svg{ color:#241c05; }
  #driveOverlay .gd-new:hover{ background:var(--gold); filter:brightness(1.06); }
  #driveOverlay .gd-new-menu{ top:auto; bottom:66px; left:auto; right:0; min-width:220px; }
  #driveOverlay .gd-new-menu button{ min-height:52px; font-size:15px; }
  #driveOverlay .gd-side{ padding-left:8px; }
}

/* menus (item actions, "Move to…", account) become bottom sheets on touch screens */
@media (pointer:coarse), (max-width:820px){
  .drive-menu{
    left:0 !important; right:0 !important; top:auto !important; bottom:0 !important; width:auto; min-width:0;
    max-height:72vh; overflow-y:auto; border-radius:20px 20px 0 0; border-bottom:0;
    padding:10px 8px calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow:0 0 0 100vmax rgba(0,0,0,.5), 0 -10px 40px rgba(0,0,0,.4);
  }
  .drive-menu button{ min-height:50px; padding:0 18px; font-size:15.5px; border-radius:12px; }
  .drive-folder-pop .dfp-title{ font-size:11px; padding:6px 18px 8px; }
}

@media (pointer:coarse), (max-width:820px){
  /* names get two lines on cards; folder chips keep clear of the ⋮ button */
  #driveOverlay .gd-card-head{ align-items:flex-start; min-height:40px; }
  #driveOverlay .gd-card-head .gd-kind{ margin-top:2px; }
  #driveOverlay .gd-card-head .drive-name{
    white-space:normal; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; line-clamp:2;
    font-size:13.5px; line-height:1.3; overflow:hidden; overflow-wrap:anywhere;
  }
  #driveOverlay .gd-item.dir.gd-card{ padding-right:44px; }
  #driveOverlay .gd-item.dir.gd-card .drive-name{ font-size:14px; }
}

@media (pointer:coarse), (max-width:820px){
  /* selection mode: the checkbox takes the place of the icon so nothing overlaps */
  #driveOverlay .gd-main.has-sel .gd-card:not(.dir) .gd-card-head{ padding-left:36px; }
  #driveOverlay .gd-main.has-sel .gd-card:not(.dir) .gd-kind{ display:none; }
  #driveOverlay .gd-main.has-sel .gd-card.dir .gd-chip-ic{ display:none; }
  #driveOverlay .gd-main.has-sel .gd-card.dir{ padding-left:42px; }
}

@media (pointer:coarse), (max-width:820px){ .drive-menu button.danger{ color:var(--danger); } }


@media (pointer:coarse), (max-width:820px){
  .dpv-actions{ flex-wrap:wrap; gap:8px; padding-bottom:calc(12px + env(safe-area-inset-bottom, 0px)); }
  .dpv-actions button{ min-height:46px; padding:0 18px; font-size:14px; border-radius:12px; flex:1 1 auto; }
  .drive-preview-box header .x{ width:44px; height:44px; font-size:24px; }
}

