/* =========================================================
   Library overlay (Space Library)
   (from home_style.css)
   ========================================================= */

.library-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 12000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.library-panel{
  width: min(980px, 98vw);
  height: min(78vh, 720px);
  background: var(--bg);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.library-top{
  padding: 12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: var(--card-bg);
}

.library-title{
  font-weight: 900;
  font-size: 16px;
}

.library-sub{
  margin-top: 4px;
  font-size: 12px;
  opacity: .75;
}

.library-actions{
  display:flex;
  gap: 8px;
  flex: 0 0 auto;
}

.library-body{
  flex: 1;
  overflow: auto;
  padding: 12px;
}

.library-grid{
  column-gap: 12px;
  column-width: 210px;
}

.asset-tile,
.asset-card{
  display: inline-block;
  width: 100%;
  margin: 0 0 12px;
  break-inside: avoid;
  background: var(--card-bg);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  overflow: hidden;
}

.asset-thumb{
  width: 100%;
  display: block;
  background: rgba(0,0,0,.05);
}

.asset-thumb img{
  width: 100%;
  height: auto;
  display: block;
}

.asset-info{
  padding: 10px 10px 12px;
}

.asset-card .asset-meta{
  padding: 10px 10px 0;
  opacity: 1;
  font-size: inherit;
}

.asset-name{
  font-weight: 800;
  font-size: 13px;
  margin: 0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.asset-meta{
  margin-top: 4px;
  font-size: 12px;
  opacity: .75;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.asset-sub{
  margin-top: 4px;
  font-size: 12px;
  opacity: .75;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.asset-actions{
  margin-top: 10px;
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-card .asset-actions{
  padding: 0 10px 12px;
}

.asset-danger{
  border-color: rgba(255,0,0,.25);
}

/* =========================================================
   My Library (taskbar + windows + filters)
   ========================================================= */

.mylib-view{
  position: fixed;
  inset: 0;
  display: none;
  background: var(--bg);
  color: var(--fg);
  min-height: 0;
}

.mylib-layout{
  height: 100%;
  width: 100%;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.mylib-sidebar{
  width: var(--sidebar-width, 280px);
  flex: 0 0 var(--sidebar-width, 280px);
  height: 100%;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
}

.mylib-sidebar-head{
  padding: 14px 12px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-subtle);
}

.mylib-sidebar-title{
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
}

.mylib-tree{
  flex: 1;
  padding: 8px 6px;
  overflow-y: auto;
  overflow-x: hidden;
}

.resize-handle{
  width: 6px;
  height: 100%;
  background: var(--border-subtle);
  cursor: col-resize;
  transition: background 0.2s;
  z-index: 10;
  flex: 0 0 6px;
}

.resize-handle:hover,
.resize-handle.active{
  background: var(--accent);
}

.mylib-main{
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

.mylib-head{
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
}

.mylib-title{
  margin: 0;
  font-size: 26px;
}

.mylib-sub{
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.mylib-titlebox{
  margin-bottom: 12px;
}

.mylib-quota{
  margin-top: 10px;
}

.mylib-quota-label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.mylib-quota-bar{
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0,0,0,0.10);
}

.mylib-quota-fill{
  height: 100%;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
}

.mylib-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.search-group{
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 2px 4px 2px 16px;
  flex: 1;
  max-width: 520px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: border-color 0.2s;
}

.search-group:focus-within{
  border-color: var(--accent);
}

/* Override global search input styles so the Library pill stays single-border. */
.search-group input.mylib-search{
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--fg);
  padding: 8px 0;
  min-width: 0;
  border-radius: 0;
  box-shadow: none;
}

.search-group input.mylib-search:focus{
  box-shadow: none;
}

.btn-filter-cycle{
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  border-radius: 50%;
  transition: background 0.1s;
  margin-left: 8px;
  border: none;
  background: transparent;
}

.btn-filter-cycle:hover{
  background: rgba(0,0,0,0.05);
  color: var(--fg);
}

.search-sep{
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 6px;
}

.btn-filter-adv{
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  border-radius: 50%;
  border: none;
  background: transparent;
}

.btn-filter-adv:hover{
  background: rgba(0,0,0,0.05);
  color: var(--fg);
}

.btn-filter-adv.active{
  color: var(--accent);
  background: #eff6ff;
}

.btn-circle{
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--card-bg);
  color: var(--muted-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: transform 0.1s, border-color 0.1s;
}

.btn-circle:hover{
  border-color: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-circle:active{
  transform: translateY(1px);
}

.btn-circle svg{
  width: 20px;
  height: 20px;
}

.mylib-toolbar{
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  gap: 6px;
  align-items: center;
}

.crumb-item{
  cursor: pointer;
  color: var(--muted-strong);
  text-decoration: none;
}

.crumb-item:hover{
  text-decoration: underline;
  color: var(--accent);
}

.crumb-sep{
  opacity: 0.5;
}

.mylib-taskbar{
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 10px;
  background: #f1f5f9;
  height: 0;
  overflow: hidden;
  transition: height 0.2s ease, opacity 0.2s ease;
  border-bottom: 1px solid transparent;
  opacity: 0;
}

.mylib-taskbar.has-tabs{
  height: 40px;
  padding-top: 6px;
  border-bottom-color: var(--border-subtle);
  opacity: 1;
}

.task-tab{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 100px;
  max-width: 240px;
  height: 34px;
  padding: 0 10px 0 12px;
  background: #e2e8f0;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  transform-origin: bottom;
}

.task-tab:hover{
  background: #eef2f6;
}

.task-tab.active{
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-bottom-color: var(--bg);
  font-weight: 600;
  color: var(--accent);
  z-index: 2;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}

.task-name{
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.task-close{
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.1s;
}

.task-tab:hover .task-close{
  opacity: 0.6;
}

.task-close:hover{
  background: rgba(0,0,0,0.1);
  opacity: 1;
  color: #dc2626;
}

.mylib-content{
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  position: relative;
}

.mylib-empty{
  margin-top: 20px;
  border: 1px dashed var(--border-subtle);
  border-radius: 16px;
  padding: 18px;
  color: var(--muted);
}

.mylib-grid{
  column-count: 5;
  column-gap: 16px;
  padding-bottom: 40px;
}

@media (max-width: 1400px){
  .mylib-grid{ column-count: 4; }
}

@media (max-width: 1100px){
  .mylib-grid{ column-count: 3; }
}

@media (max-width: 800px){
  .mylib-grid{ column-count: 2; }
  .mylib-layout{ flex-direction: column; }
  .mylib-sidebar{ width: 100%; flex: 0 0 auto; height: auto; }
  .resize-handle{ display: none; }
}

.mylib-pin{
  break-inside: avoid;
  margin-bottom: 24px;
  position: relative;
  user-select: none;
}

.pin-preview{
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s;
  z-index: 1;
}

.pin-preview:hover,
.pin-preview.programmatic-hover{
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.1);
  border-color: rgba(0,0,0,0.15);
}

.pin-preview.is-folder{
  border-color: transparent;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
}

.pin-preview.is-folder:hover{
  background: #f1f5f9;
  border-color: var(--accent-soft);
}

.mylib-file-hero{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  position: relative;
}

.mylib-file-hero.has-img{
  padding: 0;
  overflow: hidden;
}

.mylib-file-fallback-label{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  letter-spacing: .08em;
  opacity: 0;
}

.mylib-file-hero.preview-failed .mylib-file-fallback-label{
  opacity: 1;
}

.mylib-file-hero.preview-failed .mylib-file-img{
  display: none;
}

.mylib-file-img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.mylib-folder-hero{
  font-size: 40px;
  color: var(--muted);
}

.pin-star{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.05);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.1s;
  z-index: 5;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pin-preview:hover .pin-star{
  opacity: 1;
}

.pin-star:hover{
  background: #fff;
  color: #fbbf24;
  transform: scale(1.05);
}

.pin-meta{
  padding: 8px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pin-meta-top{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pin-title{
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
  line-height: 24px;
  flex: 1;
}

.pin-title:hover{
  color: var(--accent);
}

.meta-kebab{
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.1s;
  margin-top: 0;
}

.meta-kebab:hover{
  background: rgba(0,0,0,0.08);
  color: var(--fg);
}

.pin-sub{
  font-size: 11px;
  color: var(--muted);
  padding-left: 0;
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
}

.dropdown-menu{
  position: absolute;
  z-index: 99999;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  min-width: 160px;
  display: none;
  animation: menuPop 0.1s ease-out;
}

@keyframes menuPop{
  from{ opacity: 0; transform: scale(0.95); }
  to{ opacity: 1; transform: scale(1); }
}

.dropdown-item{
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--fg);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.dropdown-item:hover{
  background: rgba(0,0,0,0.05);
}

.dropdown-divider{
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.text-danger{
  color: #dc2626;
}

.view-window{
  position: absolute;
  width: 500px;
  height: 400px;
  min-height: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-window.animate-in{
  animation: winPop 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.view-window.hidden{
  display: none;
}

.view-window.stacked-hidden{
  display: none !important;
}

.view-window.maximized{
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

@keyframes winPop{
  from{ opacity: 0; transform: scale(0.95); }
  to{ opacity: 1; transform: scale(1); }
}

.view-header{
  padding: 10px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  user-select: none;
  height: 42px;
}

.view-header:active{
  cursor: grabbing;
}

.view-title{
  font-weight: 700;
  font-size: 13px;
}

.view-controls{
  display: flex;
  align-items: center;
  gap: 8px;
}

.win-btn{
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted-strong);
  transition: background 0.1s;
}

.win-btn:hover{
  background: rgba(0,0,0,0.06);
}

.win-btn.close-btn:hover{
  background: #fee2e2;
  color: #dc2626;
}

.view-body{
  flex: 1;
  min-height: 0;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--muted);
  overflow: auto;
  background: var(--bg);
}

.view-body.has-frame{
  display: flex;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  align-items: stretch;
  justify-content: stretch;
}

.view-body.has-frame .view-editor-host{
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
}

.view-preview-loading,
.view-preview-error{
  font-size: 13px;
  color: var(--muted);
}

.view-preview-error{
  color: #b91c1c;
}

.view-preview-image{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.view-preview-frame{
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.view-preview-media{
  width: min(100%, 900px);
  max-height: 100%;
}

.view-preview-fallback{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.view-preview-fallback-error{
  gap: 14px;
}

.view-preview-error-icon{
  width: 180px;
  height: 180px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .08em;
  background: #e2ebf6;
  color: #2563eb;
}

.view-details{
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--card-bg);
  display: none;
  flex-direction: column;
  gap: 20px;
}

.view-details.active{
  display: flex;
}

.detail-group{
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.detail-group:last-child{
  border-bottom: none;
}

.detail-label{
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.detail-value{
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
}

.history-list{
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.history-item{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  transition: background 0.1s;
}

.history-item:last-child{
  border-bottom: none;
}

.history-item:hover{
  background: #f8fafc;
}

.history-info{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-ver{
  font-weight: 600;
  color: var(--fg);
}

.history-date{
  font-size: 11px;
  color: var(--muted);
}

.restore-btn{
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted-strong);
}

.restore-btn:hover{
  border-color: var(--accent);
  color: var(--accent);
}

.current-badge{
  font-size: 10px;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.version-empty{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 20px;
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.version-warning{
  font-size: 11px;
  color: #b91c1c;
  margin: 15px 0;
  background: #fef2f2;
  padding: 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  max-width: 100%;
  line-height: 1.4;
}

.btn-enable{
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}

.btn-enable:hover{
  background: #1d4ed8;
}

.btn-del-ver{
  padding: 4px 8px;
  margin-left: 6px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  color: #dc2626;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}

.btn-del-ver:hover{
  background: #fee2e2;
  border-color: #fca5a5;
}

.storage-badge{
  font-size: 10px;
  color: var(--muted-strong);
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  font-weight: 600;
}

.version-confirm-box{
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.confirm-title{
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--fg);
}

.confirm-text{
  font-size: 12px;
  color: var(--muted-strong);
  margin-bottom: 16px;
  line-height: 1.5;
}

.confirm-actions{
  display: flex;
  justify-content: center;
  gap: 10px;
}

.btn-primary{
  padding: 6px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover{
  background: #1d4ed8;
}

.btn-danger{
  padding: 6px 14px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover{
  background: #b91c1c;
}

.btn-ghost{
  padding: 6px 14px;
  background: transparent;
  color: var(--muted-strong);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover{
  background: #f1f5f9;
}

.group-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.link-danger{
  font-size: 11px;
  color: #dc2626;
  cursor: pointer;
  text-decoration: underline;
}

.link-danger:hover{
  color: #b91c1c;
}

.details-nav{
  display: flex;
  gap: 4px;
  padding: 0 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.details-tab-btn{
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.1s;
}

.details-tab-btn:hover{
  color: var(--fg);
}

.details-tab-btn.active{
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tag-list{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-pill{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e0f2fe;
  color: #0284c7;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag-remove{
  cursor: pointer;
  font-weight: 700;
  opacity: 0.5;
}

.tag-remove:hover{
  opacity: 1;
}

.tag-add{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #f1f5f9;
  color: var(--muted-strong);
  cursor: pointer;
  border: 1px dashed var(--border-subtle);
}

.meta-notes{
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--fg);
  resize: vertical;
  min-height: 60px;
  margin-top: 4px;
}

.meta-notes:focus{
  outline: 2px solid var(--accent-soft);
  border-color: transparent;
}

.hash-box{
  font-family: monospace;
  font-size: 10px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 4px;
  word-break: break-all;
  color: var(--muted-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copy-icon{
  cursor: pointer;
  font-size: 12px;
  opacity: 0.6;
}

.copy-icon:hover{
  opacity: 1;
  color: var(--accent);
}

.activity-graph{
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 30px;
  margin: 10px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.bar{
  background: #cbd5e1;
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-width: 4px;
}

.bar.high{
  background: var(--accent);
}

.avatar-stack{
  display: flex;
  margin-left: 8px;
}

.avatar{
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ddd;
  border: 2px solid var(--card-bg);
  margin-left: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #555;
}

.avatar:first-child{
  margin-left: 0;
}

.share-box{
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px;
  margin-top: 8px;
}

.link-row{
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.link-input{
  flex: 1;
  font-family: monospace;
  font-size: 11px;
  color: var(--muted-strong);
  background: #fff;
  border: 1px solid var(--border-subtle);
  padding: 6px;
  border-radius: 4px;
  pointer-events: none;
}

.btn-copy{
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-copy:hover{
  border-color: var(--accent);
  color: var(--accent);
}

.toggle-wrapper{
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch{
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch input{
  opacity: 0;
  width: 0;
  height: 0;
}

.slider{
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before{
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.switch input:checked + .slider{
  background-color: var(--accent);
}

.switch input:checked + .slider:before{
  transform: translateX(14px);
}

.mylib-tree-row.selected{
  background: #e0f2fe;
  color: #0284c7;
  font-weight: 600;
}

.mylib-pin.selected .pin-preview{
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.cut-ghost{
  opacity: 0.5;
  filter: grayscale(100%);
}

.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-overlay.open{
  display: flex;
  opacity: 1;
}

.filter-modal{
  background: var(--card-bg);
  width: 500px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  padding: 24px;
  transform: scale(0.95);
  transition: transform 0.2s;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.open .filter-modal{
  transform: scale(1);
}

.modal-title{
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.filter-row{
  margin-bottom: 16px;
}

.filter-label{
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.filter-input,
.filter-select{
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: #f9fafb;
  font-size: 13px;
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s;
}

.filter-input:focus{
  border-color: var(--accent);
  background: #fff;
}

.filter-check-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f1f5f9;
  border-radius: 8px;
  margin-bottom: 16px;
}

.filter-check-row input{
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.filter-check-label{
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.reset-link{
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 400;
  background: none;
  border: none;
  padding: 0;
}

.reset-link:hover{
  color: var(--accent);
}

.modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.toast-container{
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast{
  background: #1e293b;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
  max-width: 300px;
}

.toast.show{
  opacity: 1;
  transform: translateY(0);
}

.mylib-modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10010;
}

.mylib-modal-card{
  width: min(540px, 92vw);
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 14px;
  color: var(--fg);
}

.mylib-modal-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mylib-modal-title{
  font-size: 18px;
  font-weight: 800;
}

.mylib-modal-sub{
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.mylib-modal-close{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--card-bg);
  cursor: pointer;
}

.mylib-modal-close:hover{
  background: rgba(0,0,0,0.06);
}

.mylib-modal-body{
  padding: 8px 2px 2px 2px;
}

.mylib-modal-label{
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.mylib-modal-select{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--fg);
}

.mylib-modal-note{
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(185, 28, 28, 0.35);
  background: rgba(185, 28, 28, 0.06);
  color: #7f1d1d;
  font-size: 13px;
}

.mylib-modal-actions{
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.tree-group{
  margin-left: 16px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 0;
}

.file-indent-fix{
  width: 20px;
  display: flex;
  justify-content: center;
  background: var(--card-bg);
  position: relative;
  z-index: 1;
  margin-right: 4px;
}

.mylib-tree-row{
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 6px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  color: var(--muted-strong);
  border: 2px solid transparent;
  white-space: nowrap;
}

.tree-root > .mylib-tree-row{
  margin-left: 0;
}

.mylib-tree-row:hover{
  background: rgba(0,0,0,0.05);
}

.mylib-tree-row.active{
  background: rgba(0,0,0,0.08);
  font-weight: 600;
  color: var(--fg);
}

.mylib-tree-row.drag-over{
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
}

.mylib-tree-row.tree-empty{
  cursor: default;
  color: var(--muted);
  opacity: 0.75;
  font-style: italic;
  pointer-events: none;
}

.mylib-tree-row.tree-empty:hover{
  background: transparent;
}

.mylib-tree-chevron,
.tree-spacer{
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.mylib-tree-chevron svg{
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

.mylib-tree-row.open .mylib-tree-chevron{
  transform: rotate(90deg);
}

.tree-icon{
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  flex-shrink: 0;
}

.tree-name{
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  margin-top: 1px;
  padding-right: 24px;
}

.rename-input{
  width: 100%;
  padding: 0 4px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  outline: none;
}

.tree-actions{
  display: none;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  align-items: center;
  gap: 2px;
  background: inherit;
}

.mylib-tree-row:hover .tree-actions{
  display: flex;
}

.action-btn{
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.1s;
  background: rgba(255,255,255,0.5);
}

.action-btn:hover{
  background: rgba(0,0,0,0.1);
  color: var(--fg);
}

.action-btn.delete:hover{
  color: #dc2626;
  background: #fee2e2;
}

.action-btn.star:hover{
  color: #fbbf24;
}

.action-btn.star.active{
  color: #fbbf24;
}

.mylib-tree-row.hover-state{
  background: rgba(0,0,0,0.05);
}

.mylib-pin.hover-state{
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.08);
}

.mylib-pin.is-folder.hover-state{
  border-color: var(--accent-soft);
  background: #f8fafc;
}
