:root{
  --brand-900:#27458e;
  --brand-700:#2f6bb7;
  --brand-500:#5fa9d6;
  --brand-200:#bfe7f2;

  --bg:#f6f7fb;
  --card:#ffffff;
  --surface:#ffffff;
  --surface-2:#f2f4f8;
  --text:#0f172a;
  --muted:#556071;
  --border:#e6e8f0;
  --header-bg:#ffffff;
  --sidebar-bg:#ffffff;
  --menu-bg:#ffffff;
  --menu-hover:#f1f3f4;
  --input-bg:#ffffff;
  --input-text:#0f172a;
  --tile-bg:transparent;
  --tile-hover:#f1f3f4;
  --tab-text:#5f6368;
  --tab-active:#3c4043;
  --accent:#1a73e8;
  --accent-2:#27458e;
  --meter-track:#e0e0e0;
  --meter-fill:#1a73e8;

  --shadow: 0 10px 28px rgba(16,24,40,.10);
  --shadow-sm: 0 6px 16px rgba(16,24,40,.08);

  --radius:14px;
  --radius-sm:10px;
  --focus: 0 0 0 4px rgba(95,169,214,.25);
}

html[data-theme="dark"]{
  --bg:#0b1220;
  --card:#101a2e;
  --surface:#0f1626;
  --surface-2:#0c1322;
  --text:#e5e7eb;
  --muted:#a7b0c0;
  --border:rgba(255,255,255,.12);
  --header-bg:#0f1626;
  --sidebar-bg:#0f1626;
  --menu-bg:#101a2e;
  --menu-hover:rgba(255,255,255,.06);
  --input-bg:#0f1626;
  --input-text:#e5e7eb;
  --tile-bg:transparent;
  --tile-hover:rgba(255,255,255,.06);
  --tab-text:#a7b0c0;
  --tab-active:#e5e7eb;
  --accent:#7ab4ff;
  --accent-2:#5fa9d6;
  --meter-track:rgba(255,255,255,.12);
  --meter-fill:#7ab4ff;
  --shadow: 0 10px 28px rgba(0,0,0,.35);
  --shadow-sm: 0 6px 16px rgba(0,0,0,.25);
  --focus: 0 0 0 4px rgba(95,169,214,.30);
}

@media (prefers-color-scheme: dark){
  html[data-theme="device"]{
    --bg:#0b1220;
    --card:#101a2e;
    --surface:#0f1626;
    --surface-2:#0c1322;
    --text:#e5e7eb;
    --muted:#a7b0c0;
    --border:rgba(255,255,255,.12);
    --header-bg:#0f1626;
    --sidebar-bg:#0f1626;
    --menu-bg:#101a2e;
    --menu-hover:rgba(255,255,255,.06);
    --input-bg:#0f1626;
    --input-text:#e5e7eb;
    --tile-bg:transparent;
    --tile-hover:rgba(255,255,255,.06);
    --tab-text:#a7b0c0;
    --tab-active:#e5e7eb;
    --accent:#7ab4ff;
    --accent-2:#5fa9d6;
    --meter-track:rgba(255,255,255,.12);
    --meter-fill:#7ab4ff;
    --shadow: 0 10px 28px rgba(0,0,0,.35);
    --shadow-sm: 0 6px 16px rgba(0,0,0,.25);
    --focus: 0 0 0 4px rgba(95,169,214,.30);
  }
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  background:var(--bg);
  color:var(--text);
}

.hidden{display:none !important}
.mobileOnly{display:none}
a{color:var(--brand-500); text-decoration:none}
a:hover{text-decoration:underline}

.appShell{overflow:hidden}

.topbar{
  position:sticky; top:0; z-index:30;
  height:56px;
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:14px;
  padding:8px 14px;
  background:var(--header-bg);
  border-bottom:1px solid var(--border);
}

.hdrLeft{display:flex; align-items:center; gap:14px; min-width:0;}
.hdrCenter{display:flex; justify-content:center; align-items:center; min-width:0;}
.hdrRight{display:flex; align-items:center; gap:12px; justify-content:flex-end; min-width:0;}

.hdr-left{justify-self:start;}
.hdr-center{
  justify-self:center;
  position:relative;
  padding-left:clamp(140px, 16vw, 180px);
  padding-right:clamp(140px, 16vw, 180px);
}
.hdr-right{justify-self:end;}
.hdr-toggle{
  position:absolute;
  left:0;
  top:50%;
  transform:translateY(-50%);
}

.brand{display:flex; align-items:center; gap:10px;}
.brandLogo{max-height:48px; display:block}
/* tagline removed */
.brandText, .brandTag{display:none !important;}

.topTabs{
  display:flex; align-items:center;
  gap:10px;
  padding:0;
  background:transparent;
  border:0;
  border-radius:0;
}
.tabBtn{
  border:none;
  padding:6px 2px;
  border-radius:0;
  background:transparent;
  color:var(--tab-text);
  font-weight:500;
  border-bottom:2px solid transparent;
  cursor:pointer;
}
.tabBtn.active{
  background:transparent;
  border:0;
  box-shadow:none;
  color:var(--tab-active);
  border-bottom:2px solid var(--accent);
}

.searchBox{
  width: min(420px, 34vw);
  display:flex; align-items:center; gap:10px;
  border:1px solid var(--border);
  background:var(--input-bg);
  border-radius:8px;
  padding:6px 10px;
}
.searchIcon{opacity:.65; font-size:16px}
.searchBox input{
  flex:1;
  border:none;
  background:transparent;
  outline:none;
  font-size:15px;
  color:var(--text);
}
.searchBox input::placeholder{color:color-mix(in srgb, var(--muted) 70%, var(--text) 30%)}

.iconBtn{
  width:32px; height:32px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--input-bg);
  cursor:pointer;
  color:var(--text);
}
.iconBtnSm{width:30px;height:30px;border-radius:10px}
.iconBtnLg{
  width:36px;height:36px;border-radius:8px;
  font-size:18px;
  display:flex;align-items:center;justify-content:center;
}
.iconBtn:focus, .ghostBtn:focus, .primaryBtn:focus, input:focus, select:focus, button:focus{
  outline:none; box-shadow:var(--focus);
}

.hdrUserName{
  font-size:14px;
  font-weight:600;
  color:var(--tab-active);
  white-space:nowrap;
  max-width:260px;
  overflow:hidden;
  text-overflow:ellipsis;
}

.avatarBtn{
  width:36px; height:36px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--input-bg);
  cursor:pointer;
  position:relative;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}
.avatarInitial{font-weight:900; color:var(--brand-900);}
html[data-theme="dark"] .avatarInitial{color:var(--brand-200)}
.avatarImg{width:100%;height:100%;object-fit:cover;}

/* Dark mode scrollbar (global) */
html[data-theme="dark"] *,
html[data-theme-resolved="dark"] *{
  scrollbar-color: #2a2f3a #0f141b;
}
html[data-theme="dark"] ::-webkit-scrollbar,
html[data-theme-resolved="dark"] ::-webkit-scrollbar{
  width: 10px;
  height: 10px;
}
html[data-theme="dark"] ::-webkit-scrollbar-track,
html[data-theme-resolved="dark"] ::-webkit-scrollbar-track{
  background: #0f141b;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb,
html[data-theme-resolved="dark"] ::-webkit-scrollbar-thumb{
  background: #2a2f3a;
  border-radius: 10px;
  border: 2px solid #0f141b;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
html[data-theme-resolved="dark"] ::-webkit-scrollbar-thumb:hover{
  background: #3a4352;
}

.layout{
  display:grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 64px);
}

.sidebar{
  padding:10px 10px;
  border-right:1px solid var(--border);
  background:var(--sidebar-bg);
  overflow:auto;
  z-index:40;
}

.content{
  padding:14px 16px;
  overflow:auto;
  min-width:0;
}

.primaryBtn{
  border:none;
  border-radius:999px;
  padding:8px 12px;
  font-weight:700;
  cursor:pointer;
  background:linear-gradient(90deg, var(--brand-700), var(--brand-900));
  color:#fff;
}
.primaryBtn:hover{filter:brightness(.98)}
.primaryBtn .plus{font-size:16px; margin-right:8px}

.ghostBtn{
  border:1px solid var(--border);
  background:var(--surface);
  border-radius:10px;
  padding:7px 10px;
  cursor:pointer;
  font-weight:600;
  color:var(--text);
}

.sideIdentity{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 8px;
  margin-bottom:10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface);
}
.idAvatar{
  width:32px; height:32px;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  color:var(--text);
  background:var(--menu-hover);
  border:1px solid var(--border);
}
.idMeta{min-width:0}
.idName{font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.idSub{font-size:12px; color:var(--muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}

.navGroup{margin-top:14px}
.navHdr{font-size:12px; color:var(--muted); margin:10px 8px}

.navItem{
  width:100%;
  border:none;
  background:transparent;
  text-align:left;
  padding:8px 8px;
  border-radius:6px;
  cursor:pointer;
  font-weight:500;
  color:var(--text);
  display:flex;
  align-items:center;
  gap:10px;
}
.navIco{width:18px; display:inline-flex; justify-content:center}
.navItem:hover{background:var(--menu-hover)}
.navItem.active{background:color-mix(in srgb, var(--accent) 18%, transparent);}

.storageBox{
  margin-top:14px;
  padding:10px;
  border:1px solid var(--border);
  border-radius:10px;
}
.storageHdr{font-weight:900}
.storageMeta{
  font-size:13px;
  color:var(--text);
  margin-top:8px;
  font-weight:750;
}
.meter{
  height:8px;
  border-radius:999px;
  background:var(--meter-track);
  margin-top:10px;
  overflow:hidden;
}
.meterFill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, var(--brand-500), var(--brand-900));
}
.storageNote{font-size:11px; color:var(--muted); margin-top:8px}

.contentHdr{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:8px;
}
.contentHdr h1{
  margin:0;
  font-size:18px;
  font-weight:700;
  letter-spacing:-0.3px;
}
.hdrRight2{display:flex; align-items:center; gap:10px}
.sortWrap{position:relative}

.viewModeWrap{display:flex; gap:8px; align-items:center}
.viewModeWrap .ghostBtn[aria-pressed="true"]{
  background:rgba(95,169,214,.16);
  border-color:rgba(95,169,214,.35);
}

.crumbs{display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 12px 0;}
.crumb{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
}
.crumb:hover{opacity:.9}

.tableCard{
  background:color-mix(in srgb, var(--card) 96%, var(--bg) 4%);
  border:1px solid var(--border);
  border-radius:8px;
  box-shadow:none;
  overflow:hidden;
  position:relative;
}

.fileTable{width:100%; border-collapse:collapse;}
.fileTable thead th{
  font-size:12px;
  color:var(--muted);
  font-weight:600;
  text-align:left;
  padding:8px 12px;
  border-bottom:1px solid var(--border);
  background:transparent;
}
.fileTable thead th.colSelect{
  width:28px;
  padding:8px 6px;
}
.fileTable tbody td{
  padding:8px 12px;
  border-bottom:1px solid var(--border);
  vertical-align:middle;
  font-size:14px;
}
.fileTable tbody td.colSelect{
  width:28px;
  padding:8px 6px;
}
.fileTable input.rowCheck,
.fileTable #selectAll{
  width:16px;
  height:16px;
  accent-color:var(--accent);
}
.fileRow{height:40px;}
.fileRow:hover{background:var(--menu-hover)}
.fileRow.selected td{background:color-mix(in srgb, var(--accent) 18%, transparent);}
.fileNameCell{display:flex; align-items:center; gap:10px; cursor:pointer;}
.ico{
  width:20px; height:20px;
  border-radius:0;
  display:flex; align-items:center; justify-content:center;
  border:0;
  background:transparent;
  font-weight:600;
}
.nameMain{font-weight:600}
.nameSub{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
  line-height:1.2;
}

/* Selection action bar */
.selectionBar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface);
  margin-bottom:8px;
  font-size:13px;
  color:var(--text);
}
.selectionLeft{
  display:flex;
  align-items:center;
  gap:8px;
}
.selectionClear{
  border:0;
  background:transparent;
  cursor:pointer;
  color:var(--muted);
  font-size:14px;
}
.selectionActions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.selectionActions button{
  border:1px solid var(--border);
  background:var(--input-bg);
  border-radius:6px;
  padding:4px 8px;
  font-size:12px;
  color:var(--text);
  cursor:pointer;
}
.selectionActions button:disabled{
  opacity:.5;
  cursor:not-allowed;
}
.sharePill{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card);
  font-size:12px;
  font-weight:800;
  color:var(--muted);
}

.emptyState{padding:26px}
.emptyTitle{font-weight:900; font-size:16px}
.emptySub{color:var(--muted); margin-top:6px; font-size:13px}
.emptyActions{display:flex; gap:10px; margin-top:12px; flex-wrap:wrap;}

.menu{position:relative}
.menuPop{
  position:absolute;
  right:0;
  top:52px;
  min-width:240px;
  background:var(--menu-bg);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:var(--shadow);
  overflow:hidden;
  z-index:60;
  color:var(--text);
}
.menuItem{
  width:100%;
  border:none;
  background:transparent;
  padding:11px 12px;
  text-align:left;
  cursor:pointer;
  font-weight:750;
  color:var(--text);
}
.menuItem:hover{background:var(--menu-hover)}

.sidebarCreatePop{position:relative; top:10px; right:auto; width:100%; min-width:unset;}
.createItem{
  width:100%;
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  border:none;
  background:transparent;
  cursor:pointer;
  font-size:16px;
  font-weight:750;
  color:var(--text);
}
.createDivider{height:1px; background:var(--border); margin:6px 0}
.createItem:hover{background:var(--menu-hover)}
.createIco{width:22px; display:inline-flex; justify-content:center}

.toastArea{
  position:fixed;
  inset:auto 18px 18px auto;
  width:min(380px, 92vw);
  display:grid;
  gap:10px;
  z-index:80
}
.toast{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
  padding:10px 12px;
}
.toastTitle{font-weight:900}
.toastSub{font-size:12px; color:var(--muted); margin-top:4px}

.subscriptionPill{
  padding:6px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  letter-spacing:0.4px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
}
.subscriptionPill.hidden{display:none;}
.subscriptionPill.trialing{background:#fff7ed; color:#9a3412; border-color:#fdba74;}
.subscriptionPill.active{background:#ecfdf5; color:#065f46; border-color:#6ee7b7;}
.subscriptionPill.expired{background:#fef2f2; color:#991b1b; border-color:#fca5a5;}

.subscriptionBlockOverlay{
  position:fixed;
  inset:0;
  z-index:95;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(10,15,25,0.62);
}
.subscriptionBlockOverlay.hidden{display:none;}
.subscriptionBlockCard{
  width:min(560px, 94vw);
  background:var(--card);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:20px 22px;
}
.subscriptionBlockCard h2{
  margin:0 0 8px 0;
  font-size:22px;
  line-height:1.2;
}
.subscriptionBlockCard p{
  margin:0;
  color:var(--muted);
}
.subscriptionBlockActions{
  display:flex;
  gap:10px;
  margin-top:16px;
  flex-wrap:wrap;
}

/* Files tiles (smaller + clean, no names) */
.tilesWrap{background:transparent;}
.tilesGrid{
  padding:8px;
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap:16px 18px;
  align-items:start;
}
.tileCard{
  border:0;
  background:transparent;
  cursor:pointer;
  padding:6px;
  text-align:center;
}
.tileCard:hover{background:transparent}
.tileVisual{
  display:flex;
  align-items:center;
  justify-content:center;
}
.tileFrame{
  width:120px;
  height:120px;
  background:transparent;
  border-radius:0;
  border:0;
  display:flex;
  align-items:center;
  justify-content:center;
}
.tileThumbImg{
  width:120px;
  height:120px;
  object-fit:contain;
  border-radius:0;
}
.tileIcon{
  width:120px;
  height:120px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
}
.tileIcon.folder{
  color:#f6b93b;
}
.tileIcon.pdf{color:#d93025;}
.tileIcon.doc{color:#1a73e8;}
.tileIcon.xls{color:#188038;}
.tileIcon.ppt{color:#d56e0c;}
.tileIcon.txt{color:var(--muted);}
.tileIcon.zip{color:#8d6e63;}
.tileIcon.video{color:var(--muted);}
.tileIcon.audio{color:var(--muted);}
.tileIcon svg{width:110px;height:110px}
.tileMeta{margin-top:8px; text-align:center}
.tileName{
  font-size:16px;
  font-weight:500;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tileDate{
  font-size:13px;
  color:var(--muted);
  margin-top:4px;
}

@media (max-width: 1400px){
  .tilesGrid{grid-template-columns: repeat(5, minmax(0, 1fr));}
}
@media (max-width: 1200px){
  .tilesGrid{grid-template-columns: repeat(4, minmax(0, 1fr));}
}
@media (max-width: 980px){
  .tilesGrid{grid-template-columns: repeat(3, minmax(0, 1fr));}
}
@media (max-width: 720px){
  .tilesGrid{grid-template-columns: repeat(2, minmax(0, 1fr));}
}

/* Photos gallery: masonry columns, no labels */
.photosWrap{padding:12px 24px 24px 24px;}
.photosWrap.withTimeline{padding-right:84px; position:relative;}
.photosNote{color:var(--muted); margin:6px 0 12px 0; font-weight:600;}
.photosGridContainer{
  display:grid;
  grid-auto-flow: dense;
  grid-auto-rows: 180px;
  grid-template-columns: repeat(auto-fill, 100px);
  gap:4px;
  width:100%;
}
#photoGrid.photosGridContainer{
  display:block;
}

.photoItem{
  width:100%;
  padding:0;
  border:0;
  background:transparent;
  cursor:pointer;
  margin:0;
  border-radius:0;
  overflow:hidden;
  box-shadow:none;
}
.photoTile{
  border-radius:0;
  overflow:hidden;
  background:transparent;
  width:auto;
}
.photoTile.tile-portrait{ grid-column: span 1; height: 180px; width: 100px; }
.photoTile.tile-landscape{ grid-column: span 3; height: 180px; width: auto; }
.photoItem img{
  width:100%;
  height:100%;
  display:block;
  object-fit: cover;
  image-orientation: from-image;
  border-radius: 0;
  object-position: center;
  opacity: 0;
  transition: opacity .25s ease, transform .2s ease;
}
.photoItem img.loaded{opacity:1;}
.photoItem:hover img{transform: scale(1.02);}

.photoGroup{
  margin-bottom:14px;
}
.photoGroupHdr{
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  margin:10px 0 6px 0;
}
.photoGroupGrid{
  margin-bottom:8px;
}

.photoTimeline{
  position:fixed;
  right:18px;
  top:120px;
  display:flex;
  flex-direction:column;
  gap:6px;
  z-index:50;
  align-items:flex-end;
}
.timelineYear{
  border:0;
  background:transparent;
  color:var(--muted);
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  cursor:pointer;
}
.timelineYear.active{
  background:color-mix(in srgb, var(--accent) 18%, transparent);
  color:var(--text);
}
.timelineBubble{
  position:fixed;
  right:64px;
  top:140px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--menu-bg);
  border:1px solid var(--border);
  color:var(--text);
  font-size:12px;
  box-shadow:var(--shadow-sm);
  z-index:60;
}

@media (max-width: 900px){
  .photosWrap.withTimeline{padding-right:56px;}
  .photoTimeline{right:10px;}
}
@media (max-width: 640px){
  .photosWrap.withTimeline{padding-right:12px;}
  .photoTimeline{display:none !important;}
}

body.mode-photos .sidebar{display:none;}
body.mode-photos .layout{grid-template-columns: 1fr;}
body.mode-photos .content{padding:0;}
body.mode-photos .contentHdr{
  max-width:none;
  margin:0;
  padding:16px 24px 8px 24px;
}
body.mode-photos .contentHdr > div{
  display:flex;
  align-items:center;
  gap:12px;
}
body.mode-photos #viewTitle{
  font-size:22px;
  font-weight:600;
}
body.mode-photos #viewSub{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
  margin-top:0;
}
body.mode-photos #photosToolbar{
  display:flex;
  align-items:center;
  gap:8px;
}
body.mode-photos .photosWrap{
  max-width:1800px;
  margin:0 auto;
  width:100%;
}
body.mode-photos .tableCard{border:none; box-shadow:none; background:transparent;}
body.mode-photos #filesToolbar{display:none;}

/* Backdrop */
.mobileBackdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.35);
  z-index:35;
}

/* Viewer modal (in-app preview) */
body.modalOpen #mobileBackdrop{display:block !important;}
.viewerModal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.85);
  z-index:90;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  justify-content:flex-start;
  padding:0;
}
.viewerPanel{
  width:100%;
  height:100%;
  background:transparent;
  border:0;
  border-radius:0;
  box-shadow:none;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.viewerTop{
  display:flex;
  align-items:center;
  gap:12px;
  padding:4px 8px;
  min-height:21px;
  background:rgba(0,0,0,.45);
  color:#fff;
  position:sticky;
  top:0;
  z-index:2;
  justify-content:space-between;
}
.viewerTopLeft,
.viewerTopRight{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}
.viewerIcon{
  width:40px;height:40px;
  border-radius:0;
  border:0;
  background:transparent;
  color:#fff;
  cursor:pointer;
}
.viewerIcon.active{
  background:rgba(255,255,255,.18);
}
.viewerPreviewLabel{
  font-size:14px;
  font-weight:600;
  color:#fff;
  opacity:.9;
  margin-left:6px;
  white-space:nowrap;
}
.viewerLogoWrap{
  display:flex;
  align-items:center;
  gap:8px;
}
.viewerLogo{
  height:26px;
  width:auto;
}
.viewerLogoFallback{
  font-weight:700;
  color:#fff;
}
.viewerTitleWrap{min-width:0; flex:1;}
.viewerTitle{font-weight:900; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.viewerSub{opacity:.8; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.viewerBtn{
  border:1px solid rgba(255,255,255,.20);
  background:rgba(255,255,255,.08);
  color:#fff;
  border-radius:12px;
  padding:9px 12px;
  font-weight:800;
  cursor:pointer;
}
.viewerProgressBar{
  height:1px;
  background:rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(0,0,0,.35);
}
.viewerProgress{height:100%; width:0%; background:rgba(255,255,255,.22);}
.viewerBody{
  position:relative;
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  height:calc(100vh - 21px);
  overflow:hidden;
}
.viewerStage{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
}
.viewerImg{
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  object-fit:contain;
  image-orientation: from-image;
  border-radius:0;
}
.viewerMedia{
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
}
.viewerFrame{
  width:100%;
  height:100%;
  border:0;
  background:#fff;
  border-radius:10px;
}
.viewerNav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:69px;height:69px;
  border-radius:0;
  border:0;
  background:transparent;
  color:#fff;
  cursor:pointer;
  font-size:28px;
  line-height:1;
}
.viewerNav.left{left:12px;}
.viewerNav.right{right:12px;}

.viewerInfoPanel{
  position:absolute;
  top:21px;
  right:0;
  width:min(320px, 92vw);
  height:calc(100% - 21px);
  background:rgba(15,18,24,.92);
  border-left:1px solid rgba(255,255,255,.12);
  color:#fff;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:3;
}
.viewerInfoPanel.hidden{display:none;}
.viewerInfoTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.viewerInfoTitle{
  font-size:14px;
  font-weight:700;
}
.viewerInfoBody{
  display:flex;
  flex-direction:column;
  gap:10px;
  font-size:12px;
  color:#d1d5db;
}
.viewerInfoRow{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.viewerInfoLabel{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:#9aa4b2;
}
.viewerInfoValue{
  word-break:break-word;
  color:#fff;
}

@media (max-width: 720px){
  .viewerInfoPanel{
    width:100%;
  }
}

/* Mobile */
@media (max-width: 840px){
  .mobileOnly{display:inline-flex}
  .layout{grid-template-columns:1fr; height: calc(100vh - 64px); position:relative;}
  .hdrUserName{display:none}
  .searchBox{width:min(420px, 70vw)}
  .hdr-center{
    padding-left:0;
    padding-right:0;
    flex-direction:column;
    gap:6px;
  }
  .hdr-toggle{
    position:static;
    transform:none;
  }
  .sidebar{
    position:fixed;
    top:64px; left:0; bottom:0;
    width:min(320px, 86vw);
    transform:translateX(-105%);
    transition:transform .18s ease;
    box-shadow:var(--shadow);
  }
  body.navOpen .sidebar{ transform:translateX(0); }
  #mobileBackdrop.hidden{display:none !important}
  body.navOpen #mobileBackdrop{display:block !important}
  .content{ padding:14px 12px; }
  .tilesGrid{grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding:12px;}
}

/* Details panel (right side) */
.details{
  border-left:1px solid var(--border);
  background:var(--card);
  overflow:auto;
  padding:14px 12px;
}

/* 3-column layout when Details is open */
body.detailsOpen .layout{
  grid-template-columns: 260px 1fr 340px;
}

/* On mobile: details becomes a slide-over panel */
@media (max-width: 840px){
  .details{
    position:fixed;
    top:64px;
    right:0;
    bottom:0;
    width:min(360px, 92vw);
    box-shadow:var(--shadow);
    z-index:50;
  }
  body.detailsOpen #mobileBackdrop{display:block !important;}
}
/* ==========================================================
   Settings -> Feedback modal (Your Response)
   ========================================================== */
.bbModal{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  z-index:95;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.bbModalPanel{
  width:min(720px, 96vw);
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.bbModalTop{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg, color-mix(in srgb, var(--bg) 75%, var(--card) 25%), var(--card));
}
.bbModalIcon{
  width:40px;height:40px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  cursor:pointer;
  font-weight:900;
}
.bbModalTitleWrap{min-width:0; flex:1;}
.bbModalTitle{font-weight:900;}
.bbModalSub{font-size:12px; color:var(--muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.bbModalBody{padding:14px 12px;}
.bbField{display:block;}
.bbFieldLabel{font-weight:900; margin-bottom:8px;}
.bbTextarea{
  width:100%;
  resize:vertical;
  min-height:160px;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  font: inherit;
  background:color-mix(in srgb, var(--bg) 90%, var(--card) 10%);
  color:var(--text);
  outline:none;
}
.bbTextarea:focus{box-shadow:var(--focus);}
.bbModalActions{
  display:flex;
  justify-content:flex-end;
  margin-top:12px;
}
.bbModalHint{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
}
/* ==========================================================
   SETTINGS POPUP (compact + subtle)
   ========================================================== */

.settingsPop{
  width: 300px;
  min-width: 300px;
  max-width: min(92vw, 320px);
  padding: 14px 14px 12px 14px;
  border-radius: 14px;
  background: var(--menu-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--text);
}

/* top storage section */
.settingsPop .popSection{
  padding: 0 0 8px 0;
}

.settingsPop .storageLine{
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.settingsPop .popMeter{
  height: 5px;
  border-radius: 999px;
  background: var(--meter-track);
  overflow: hidden;
  margin-top: 6px;
  margin-bottom: 10px;
}

.settingsPop .popMeterFill{
  height: 100%;
  border-radius: 999px;
  background: var(--meter-fill);
}

/* Manage | Subscription as text tabs */
.settingsPop .popTabs{
  display: flex;
  gap: 10px;
  padding: 6px 0 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  min-height: 30px;
  align-items: center;
}

.settingsPop .popTab{
  border: 0;
  background: transparent;
  padding: 0 0 6px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--tab-text);
  cursor: pointer;
  position: relative;
}

.settingsPop .popTab.active{
  color: var(--tab-active);
}
.settingsPop .popTab.active::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
}

.settingsPop .popTab:not(:last-child)::after{
  content: "";
}

/* Theme row */
.settingsPop .popRow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  line-height: 1.25;
}

.settingsPop .popLabel{
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.settingsPop .popSelect{
  width: 140px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 600;
  font-size: 12px;
  padding: 0 10px;
}

/* checkbox row */
.settingsPop .popCheck{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
}

.settingsPop .popCheck input{
  width: 14px;
  height: 14px;
}

/* divider */
.settingsPop .popDivider{
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* link rows (Settings / Help / Response) */
.settingsPop .popLink{
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  min-height: 34px;
  line-height: 1.25;
}

.settingsPop .popLink:hover{
  background: var(--menu-hover);
}

.settingsPop .popIco{
  width: 18px;
  display: inline-flex;
  justify-content: center;
  opacity: .9;
  font-size: 16px;
  color: var(--muted);
}

.settingsPop .popLink.muted{
  color: var(--muted);
}

#settingsMenu,
.settingsPop,
.menuPop.settingsPop{
  width: 300px !important;
  min-width: 300px !important;
  max-width: min(92vw, 320px) !important;
  max-height: min(420px, calc(100vh - 96px)) !important;
  box-sizing: border-box !important;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ==========================================================
   PROFILE POPUP (match Settings popup sizing/feel)
   ========================================================== */
.profilePop{
  width: 280px;
  min-width: 280px;
  max-width: calc(100vw - 16px);
  max-height: min(360px, calc(100vh - 88px));
  padding: 12px;
  border-radius: 16px;
  background: var(--menu-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--text);
}
.profilePop .profileTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:8px;
}
.profilePop .blLogo{
  height:36px;
  width:auto;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.7));
}
.profilePop .profileSignout{
  border:0;
  background:transparent;
  color:var(--text);
  font-size:14px;
  padding:6px 8px;
  border-radius:8px;
  cursor:pointer;
}
.profilePop .profileSignout:hover{background:var(--menu-hover);}
.profilePop .profileMain{
  display:flex;
  gap:10px;
  align-items:center;
  padding:6px 0 8px 0;
}
.profilePop .profilePicWrap{
  width:36px;height:36px;
  border-radius:999px;
  overflow:hidden;
  background:var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.profilePop .profilePic,
.profilePop .profilePicFallback{
  width:100%;height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:500;
  color:var(--text);
  font-size:14px;
}
.profilePop .profileMeta{min-width:0;}
.profilePop .profileName{
  font-weight:500;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.profilePop .profileEmail{
  color:var(--muted);
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.profilePop .profileLink{
  border:0;
  background:transparent;
  color:var(--accent);
  font-size:13px;
  padding:4px 0;
  cursor:pointer;
}
.profilePop .profileDivider{
  height:1px;
  background:var(--border);
  margin:6px 0;
}
.profilePop .profileAcct{
  display:flex;
  gap:10px;
  align-items:center;
  padding:6px 6px;
  border-radius:8px;
}
.profilePop .acctIcon{
  width:18px;
  display:inline-flex;
  justify-content:center;
  color:var(--muted);
}
.profilePop .acctName{font-weight:500; color:var(--text); font-size:14px;}
.profilePop .acctEmail{font-size:13px; color:var(--muted);}
.profilePop .profileSwitch{
  width:100%;
  border:0;
  background:transparent;
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 6px;
  border-radius:8px;
  cursor:pointer;
  color:var(--text);
  font-size:14px;
  text-align:left;
}
.profilePop .profileSwitch:hover{background:var(--menu-hover);}

.accountsPanel{display:flex; flex-direction:column; gap:8px;}
.accountsList{display:flex; flex-direction:column; gap:6px;}
.accountRow{
  display:flex;
  gap:10px;
  align-items:center;
  padding:6px 6px;
  border-radius:8px;
  cursor:pointer;
}
.accountRow:hover{background:var(--menu-hover);}
.accountRow.active{background:color-mix(in srgb, var(--accent) 18%, transparent);}
.accountMeta{min-width:0;}
.accountName{font-size:14px; font-weight:500; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.accountEmail{font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.accountsNote{font-size:12px; color:var(--muted); margin:2px 0;}
.accountsForm{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:6px 0;
}
.accountsForm input{
  height:30px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--input-bg);
  color:var(--input-text);
  padding:0 10px;
  font-size:13px;
}
.accountsForm button{
  height:30px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--input-bg);
  color:var(--input-text);
  cursor:pointer;
  font-size:13px;
}

.accountModal{
  position:fixed;
  inset:0;
  z-index:96;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(10,15,25,0.62);
}
.accountModal.hidden{display:none;}
.accountModalCard{
  width:min(420px, 94vw);
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
  padding:16px;
}
.accountModalCard h3{
  margin:0 0 10px 0;
  font-size:18px;
}
.accountModalBody{
  display:flex;
  flex-direction:column;
  gap:7px;
}
.accountModalBody label{
  font-size:12px;
  color:var(--muted);
}
.accountModalBody input{
  height:34px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--input-bg);
  color:var(--input-text);
  padding:0 10px;
}
.accountModalActions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:12px;
}

@media (max-width: 520px){
  .profilePop{
    width: calc(100vw - 16px);
    min-width: unset;
    right: 8px;
  }
}

@media (max-width: 520px){
  .hdr-center{
    width:100%;
  }
  .hdr-center .searchBox{
    width:min(360px, 90vw);
  }
  .hdr-toggle{
    display:flex;
    gap:12px;
  }
}
