/* Gridstack overrides */
.grid-stack { background: transparent; }
.grid-stack-item-content {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  container-type: size;
}
.grid-stack-item-content:hover { border-color: var(--line-strong); }
.grid-stack-item.starred .grid-stack-item-content {
  border-color: rgba(255,207,92,.45);
  box-shadow: 0 0 0 1px rgba(255,207,92,.15) inset;
}

.grid-stack > .grid-stack-item > .ui-resizable-handle {
  opacity: 0;
  transition: opacity var(--t-fast);
}
.grid-stack > .grid-stack-item:hover > .ui-resizable-handle { opacity: .8; }

/* Widget header */
.w-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.w-title {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.w-icn { color: var(--fg-3); }
.w-tools { display: flex; gap: 2px; }
.w-tools button {
  background: transparent;
  border: none;
  color: var(--fg-3);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.w-tools button:hover { background: var(--bg-4); color: var(--fg); }
.w-tools .star.on { color: var(--star); }

/* Widget body */
.w-body {
  flex: 1;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: var(--block-gap, 6px);
}

/* Block styles */
.block {
  background: var(--bg-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  font-size: 12px;
  color: var(--fg-2);
  position: relative;
}
.block.b-stat { flex-direction: column; gap: 4px; }
.block.b-stat .stat-num {
  font-size: clamp(16px, min(8cqh, 5cqw), 36px);
  font-weight: 600;
  color: var(--fg);
  line-height: 1.05;
}
.block.b-stat .stat-label { color: var(--fg-3); font-size: 11px; }
.block.b-spark { background: linear-gradient(180deg, var(--bg-4), var(--bg-3)); position: relative; }
.block.b-spark svg { width: 100%; height: 100%; }
.block.b-list { align-items: stretch; flex-direction: column; padding: 6px; }
.block.b-list .row {
  padding: 4px 6px;
  border-bottom: 1px dashed var(--line);
  display: flex;
  justify-content: space-between;
}
.block.b-list .row:last-child { border-bottom: none; }
.block.b-text { text-align: left; align-items: flex-start; }
.block.b-icon { font-size: 24px; }
.block.b-divider { background: transparent; border: none; padding: 0; }
.block.b-divider hr { width: 100%; border: none; border-top: 1px solid var(--line); }
.block .b-tag {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Drop preview */
.gs-drop-preview {
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--r-md);
}

/* Size picker popover */
.size-pop {
  position: fixed;
  z-index: 200;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 10px;
  min-width: 160px;
}
.size-pop .sp-title {
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.size-pop .sp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.size-pop button {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.size-pop button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.size-pop button span { color: var(--fg-3); }

/* Repack flash */
.repack-flash { animation: repackFlash 600ms ease-out; }
@keyframes repackFlash {
  0%   { box-shadow: 0 0 0 0 rgba(124,156,255,.55); }
  100% { box-shadow: 0 0 0 0 rgba(124,156,255,0); }
}
