/* AI Design Space — Resources page (v2, visual-first)
   Goals from screenshots:
   - clean premium dark UI
   - square thumbnails
   - hover-only controls (checkbox/like/menu)
   - remove Tiles/Table toggle (slider only)
   - compact filters
   - bottom bulk bar (like Higgsfield) when selecting
*/

:root{
  --rv2-bg: #0d0e10;
  --rv2-card: rgba(255,255,255,.04);
  --rv2-card2: rgba(255,255,255,.06);
  --rv2-stroke: rgba(255,255,255,.10);
  --rv2-stroke2: rgba(255,255,255,.16);
  --rv2-text: rgba(255,255,255,.90);
  --rv2-text2: rgba(255,255,255,.65);
  --rv2-pink: #ff4fc3;
  --rv2-cyan: #53d3ff;

  /* 1..10 from slider */
  --rv2-size-step: 6;
  --rv2-thumb-min: 120;
  --rv2-thumb-max: 520;
}

/* Map size-step -> px without JS math (approx) */
.rv2-card-menu{
  position: fixed;
  z-index: 1200;
  display: none;
  min-width: 180px;
  background: var(--resource-dropdown-bg, #1e1f21);
  border-radius: var(--resource-control-radius, 10px);
  padding: 8px;
  list-style:none;
  margin:0;
  /* match filter menu shadow and subtle backdrop */
  box-shadow: 0 10px 30px rgba(0,0,0,0.7), 0 0 20px rgba(0,0,0,0.25);
  border:1px solid rgba(255,255,255,0.08);
  transform-origin: top right;
  transition: opacity 160ms ease, transform 170ms ease;
}
.rv2-card-menu.is-open{ display:block; opacity:1; transform:scaleY(1); }
.rv2-card-menu[hidden]{ display:none; opacity:0; transform:scaleY(0.96); }
.rv2-card-menu__list{ list-style:none; margin:0; padding:0; }
.rv2-card-menu__list li{ padding:6px 12px; margin:2px 0; border-radius:8px; color:var(--resource-text, #eae8ee); cursor:pointer; display:flex; align-items:center; gap:8px; user-select:none; font-size:13px; }
.rv2-card-menu__list li:hover{ background:rgba(255,255,255,0.02); }
.rv2-card-menu__list li:focus{ outline:none; box-shadow: 0 0 8px rgba(255,0,255,0.08); background:rgba(255,255,255,0.02); }
.rv2-card-menu__list li[data-action="delete"]{ color: #ff6b6b; }
.rv2-card-menu__list li[data-action="open"]{ font-weight:600; }
/* scrollbar removed — menu fits all items without scroll */
.rv2-card-menu{ overflow: visible; }
/* Top controls */
.rv2-topbar{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px);
}

.rv2-topbar__left,
.rv2-topbar__right{
  display:flex;
  align-items:center;
  min-width:0;
}

.rv2-topbar__left{
  gap:8px;
}

.rv2-topbar__right{
  gap:12px;
  flex-wrap:wrap;
  margin-left:auto;
}

/* ── Storage usage indicator ───────────────────────────────────── */
.rv2-storage{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.78);
  white-space: nowrap;
  cursor: default;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.rv2-storage:hover{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.95);
}
.rv2-storage[data-loading="true"] .rv2-storage__bar{ opacity:.4; }
.rv2-storage__icon{ flex-shrink:0; opacity:.85; }
.rv2-storage__text{ font-variant-numeric: tabular-nums; }
.rv2-storage__bar{
  position:relative;
  width: 70px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  overflow: hidden;
}
.rv2-storage__bar-fill{
  position:absolute; left:0; top:0; bottom:0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22D3EE 0%, #8B5CF6 60%, #FF2D9B 100%);
  transition: width .3s ease, background .3s ease;
}
.rv2-storage[data-state="warn"] .rv2-storage__bar-fill{ background: #F6C24A; }
.rv2-storage[data-state="critical"] .rv2-storage__bar-fill{ background: #FF4D5E; }
.rv2-storage[data-state="critical"]{ color:#FF8A95; border-color: rgba(255,77,94,0.35); }
.rv2-storage[data-state="unlimited"] .rv2-storage__bar{ display:none; }
.rv2-storage__byo{
  display:inline-flex;
  align-items:center;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34,211,238,0.18), rgba(139,92,246,0.18));
  border: 1px solid rgba(34,211,238,0.35);
  color: #B6F0FF;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.rv2-storage__cleanup{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  min-width:0;
  min-height:0;
  height:auto;
  margin-left:2px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(246,194,74,.42);
  background:rgba(246,194,74,.12);
  color:#F6C24A;
  font-family:inherit;
  font-size:11px;
  font-weight:600;
  line-height:1.2;
  letter-spacing:.02em;
  white-space:nowrap;
  cursor:pointer;
  appearance:none;
  -webkit-appearance:none;
  transition:background .15s ease, border-color .15s ease, color .15s ease;
}
.rv2-storage__cleanup:hover{
  background:rgba(246,194,74,.2);
  border-color:rgba(246,194,74,.65);
  color:#FFD978;
}
.rv2-storage__cleanup:focus-visible{
  outline:2px solid rgba(246,194,74,.75);
  outline-offset:2px;
}
@media (max-width: 900px){
  .rv2-storage__bar{ display:none; }
  .rv2-storage{ height: 30px; padding: 4px 8px; }
}

/* Ensure filters/selects and enhanced select buttons match the search field height
   so controls look visually aligned in the topbar. This targets elements inside
   the page-scoped topbar only to avoid breaking header/global toolbars. */
.rv2-topbar select.rv2-filter,
.rv2-topbar .aidc-select__btn,
.rv2-topbar .tg-dropdown__toggle {
  height: 34px; /* same as .rv2-search */
  min-height: 34px;
  padding: 0 12px; /* horizontal padding only to vertically center label */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px; /* slightly rounded to visually match other controls */
  box-sizing: border-box;
}

/* Smaller screens: keep compact but aligned */
@media (max-width: 480px) {
  .rv2-topbar select.rv2-filter,
  .rv2-topbar .aidc-select__btn,
  .rv2-topbar .tg-dropdown__toggle { height: 32px; min-height:32px; }
}
/* Responsive: reflow complete toolbar groups before they can overflow.
   The groups themselves must wrap; moving only their children is not enough. */
@media (max-width: 1200px) {
  .rv2-topbar{
    flex-wrap:wrap;
    align-items:flex-start;
    gap:8px;
    padding:10px;
    overflow:visible;
  }

  .rv2-topbar__left{
    order:1;
    flex:1 1 100%;
    width:100%;
    max-width:100%;
    flex-wrap:wrap;
  }

  .rv2-tabs{
    display:flex;
    flex:1 1 100%;
    width:100%;
    min-width:0;
    flex-wrap:wrap;
    gap:8px;
  }

  .rv2-tab-actions{
    margin-left:0 !important;
  }

  .rv2-storage{
    order:2;
    max-width:100%;
  }

  .rv2-topbar__right{
    order:3;
    flex:1 1 100%;
    width:100%;
    max-width:100%;
    min-width:0;
    margin-left:0 !important;
    flex-wrap:wrap;
  }

  .rv2-topbar__right .aidc-filter{
    flex:1 1 calc(50% - 6px);
    min-width:0;
    max-width:calc(50% - 6px);
    margin:0;
    box-sizing:border-box;
  }

  .rv2-topbar__right .aidc-filter__trigger{
    width:100%;
    max-width:100%;
    min-width:0;
  }

  .rv2-topbar__right .aidc-filter__label{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .rv2-search{
    order:2;
    flex:1 1 100%;
    width:100%;
    min-width:0;
    max-width:none;
  }

  .rv2-icon-btn,
  .rv2-size{
    order:4;
  }

  .rv2-icon-btn{
    flex:0 0 36px;
  }

  .rv2-size{
    flex:1 1 120px;
    width:auto;
    min-width:96px;
    max-width:220px;
  }

  .rv2-topbar .rv2-chip{
    flex:1 1 auto;
    min-width:0;
  }
}

/* Very small screens: keep every control inside the viewport. */
@media (max-width: 560px) {
  .rv2-layout{
    padding:8px;
  }

  .rv2-main{
    padding:8px;
    border-radius:16px;
  }

  .aidc-resources-page .rv2-topbar{
    padding:8px;
    border-radius:16px;
  }

  .rv2-tabs .rv2-chip{
    flex:1 1 calc(50% - 4px);
  }

  .rv2-storage{
    width:100%;
    justify-content:center;
  }

  .rv2-topbar__right .aidc-filter{
    flex-basis:calc(50% - 6px);
  }

  .rv2-search{
    min-width:0;
  }

  .rv2-icon-btn{
    width:34px;
    height:34px;
    flex-basis:34px;
  }

  .rv2-btn--small{
    padding:6px;
    height:28px;
    font-size:12px;
  }
}
/* Topbar actions grouping (create button, date, slider) */
.rv2-tab-actions{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:8px;
}

/* Small variant of rv2-btn used for compact actions */
.rv2-btn--small{
  padding:6px 8px;
  height:30px;
  font-size:12px;
  border-radius:8px;
  min-width: 44px;
}

/* Icon button style used across resources topbar */
.rv2-icon-btn{
  width:36px;
  height:36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
}
.rv2-icon-btn:hover{ background: rgba(255,255,255,0.04); }
/* active state for small icon buttons (used for trash filter toggle) */
.rv2-icon-btn.is-active{ background: linear-gradient(120deg, rgba(255,79,195,0.12), rgba(83,211,255,0.06)); border-color: rgba(255,79,195,0.35); color: #fff; }

/* Icon sizing helpers */
.icon{ display:block; width:18px; height:18px; }
.icon.icon--calendar{ width:18px; height:18px; }

.prompt-templates-modal,
.prompt-template-editor,
.prompt-template-folder-picker{
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
}
.prompt-templates-modal[hidden],
.prompt-template-editor[hidden],
.prompt-template-folder-picker[hidden]{ display:none !important; }
.prompt-templates-modal.is-open,
.prompt-template-editor.is-open,
.prompt-template-folder-picker.is-open{ display:block; }

.prompt-templates-modal__backdrop,
.prompt-template-editor__backdrop,
.prompt-template-folder-picker__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.prompt-templates-modal__dialog,
.prompt-template-editor__dialog,
.prompt-template-folder-picker__dialog{
  position: relative;
  width: min(1200px, 95vw);
  max-height: 86vh;
  margin: 6vh auto;
  background: rgba(14,14,22,0.97);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.02);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
  color: #e8ebff;
}

.prompt-template-editor__dialog{
  width: min(720px, 92vw);
}

.prompt-template-folder-picker__dialog{
  width: min(560px, 92vw);
}

.prompt-templates-modal__header,
.prompt-template-editor__header,
.prompt-template-folder-picker__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 20px 12px;
  border-bottom:1px solid rgba(255,255,255,0.06);
}

.prompt-templates-modal__title,
.prompt-template-editor__title,
.prompt-template-folder-picker__title{
  font-size:16px;
  font-weight:700;
  color:#f1eef7;
  letter-spacing:.5px;
}

.prompt-templates-modal__close,
.prompt-template-editor__close,
.prompt-template-folder-picker__close{
  width:32px;
  height:32px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.10);
  background:rgba(255,255,255,0.04);
  color:rgba(240,242,255,0.7);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.prompt-templates-modal__body{
  padding: 18px 20px 20px;
  max-height: calc(86vh - 64px);
  overflow: auto;
}

.prompt-template-folder-picker__body{
  padding: 18px 20px 20px;
}

.prompt-template-folder-picker__actions{
  display:flex;
  justify-content:flex-end;
  margin-bottom:12px;
}

.prompt-template-folder-picker__list{
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height:50vh;
  overflow:auto;
}

.prompt-template-folder-picker__item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  color:#f2f4ff;
  cursor:pointer;
}

.prompt-template-folder-picker__item:hover{
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.14);
}

.prompt-template-folder-picker__item.is-active{
  border-color:rgba(130,90,255,.55);
  box-shadow:0 0 0 1px rgba(130,90,255,.25) inset;
}

.prompt-template-folder-picker__item-title{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.prompt-template-folder-picker__item-name{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.prompt-template-editor__form{
  display:flex;
  flex-direction:column;
  gap:18px;
  padding:18px 20px 20px;
}

.prompt-template-editor__field{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.prompt-template-editor__label{
  font-size:13px;
  color:rgba(255,255,255,.76);
}

.prompt-template-editor__input,
.prompt-template-editor__textarea{
  width:100%;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:#f3f4ff;
  padding:12px 14px;
  outline:none;
}

.prompt-template-editor__textarea{
  min-height: 220px;
  resize: vertical;
  line-height: 1.55;
}

.prompt-template-editor__actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

.prompt-templates-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:16px;
}

.prompt-templates-empty{
  padding: 36px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,.12);
  background: rgba(255,255,255,.02);
  color: rgba(255,255,255,.72);
  text-align:center;
}

.prompt-tpl-card{
  display:flex;
  flex-direction:column;
  min-height: 220px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025));
  overflow:hidden;
}

.prompt-tpl-card__header,
.prompt-tpl-card__footer{
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 14px 12px;
}

.prompt-tpl-card__header{
  border-bottom:1px solid rgba(255,255,255,.06);
}

.prompt-tpl-card__footer{
  border-top:1px solid rgba(255,255,255,.06);
  color:rgba(255,255,255,.55);
  font-size:12px;
  margin-top:auto;
}

.prompt-tpl-card__title{
  min-width:0;
  flex:1 1 auto;
  color:#f5f5fe;
  font-size:14px;
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.prompt-tpl-card__body{
  padding:14px;
  color:rgba(255,255,255,.76);
  font-size:13px;
  line-height:1.6;
  display:-webkit-box;
  line-clamp:4;
  -webkit-line-clamp:4;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.prompt-tpl-card__icon-btn{
  width:30px;
  height:30px;
  min-width:30px;
  border-radius:9px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  color:rgba(255,255,255,.68);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}

.prompt-tpl-card__icon-btn.is-active{
  color:#ffd966;
  border-color:rgba(255,217,102,.35);
  background:rgba(255,217,102,.08);
}

.prompt-templates-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.prompt-templates-toolbar__meta{
  color:rgba(255,255,255,.62);
  font-size:12px;
}

/* Toolbar left group (count + view toggle side by side) */
.prompt-templates-toolbar__left{
  display:flex;
  align-items:center;
  gap:12px;
}

/* View toggle buttons */
.prompt-templates-toolbar__actions{
  display:flex;
  align-items:center;
  gap:4px;
}
.prompt-templates-toolbar__view-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:8px;
  background:transparent;
  color:rgba(255,255,255,.4);
  cursor:pointer;
  transition:all .15s;
}
.prompt-templates-toolbar__view-btn:hover{
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.7);
}
.prompt-templates-toolbar__view-btn.is-active{
  background:rgba(139,92,246,.15);
  color:#8b5cf6;
  border-color:rgba(139,92,246,.3);
}

/* ── List view ── */
.prompt-templates-list{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.prompt-tpl-row{
  display:grid;
  grid-template-columns: 28px 28px 1fr 2fr auto auto 28px;
  align-items:center;
  gap:12px;
  padding:10px 14px;
  background:rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.04);
  border-radius:10px;
  cursor:pointer;
  transition:background .15s, border-color .15s;
}
.prompt-tpl-row:hover{
  background:rgba(139,92,246,.05);
  border-color:rgba(139,92,246,.15);
}
.prompt-tpl-row__fav{
  display:flex;
  align-items:center;
  justify-content:center;
  border:none;
  background:none;
  color:rgba(255,255,255,.25);
  cursor:pointer;
  padding:0;
  transition:color .15s;
}
.prompt-tpl-row__fav.is-active{
  color:#fbbf24;
}
.prompt-tpl-row__fav:hover{
  color:#fbbf24;
}
.prompt-tpl-row__title{
  font-size:13px;
  font-weight:600;
  color:rgba(255,255,255,.9);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.prompt-tpl-row__text{
  font-size:12px;
  color:rgba(255,255,255,.45);
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  line-clamp:2;
  word-break:break-word;
}
.prompt-tpl-row__folder{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:11px;
  color:rgba(255,255,255,.35);
  white-space:nowrap;
}
.prompt-tpl-row__date{
  font-size:11px;
  color:rgba(255,255,255,.3);
  white-space:nowrap;
}
.prompt-tpl-row__menu{
  display:flex;
  align-items:center;
  justify-content:center;
  border:none;
  background:none;
  color:rgba(255,255,255,.3);
  cursor:pointer;
  padding:0;
  transition:color .15s;
}
.prompt-tpl-row__menu:hover{
  color:rgba(255,255,255,.7);
}

@media (max-width: 900px){
  .prompt-tpl-row{
    grid-template-columns: 28px 28px 1fr auto 28px;
  }
  .prompt-tpl-row__text,
  .prompt-tpl-row__date{
    display:none;
  }
}

@media (max-width: 1100px){
  .prompt-templates-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px){
  .prompt-templates-grid{ grid-template-columns: 1fr; }
  .prompt-template-editor__actions,
  .prompt-templates-toolbar{ flex-direction:column; align-items:stretch; }
  .prompt-template-editor__folder-row{ flex-direction:column; align-items:stretch; }
}

/* Prompt template editor — folder select */
.prompt-template-editor__select{
  width:100%;
  padding:9px 12px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:8px;
  background:#0f1018;
  color:#e9e9f4;
  font-size:14px;
  outline:none;
  cursor:pointer;
}
.prompt-template-editor__select:focus{
  border-color:rgba(130,90,255,.55);
}

.prompt-template-editor__folder-row{
  display:flex;
  gap:10px;
  align-items:center;
}

.prompt-template-editor__folder-row .prompt-template-editor__select{
  flex:1 1 auto;
}

.prompt-template-editor__folder-create{
  white-space:nowrap;
}

/* Prompt template card context menu */
.prompt-tpl-ctx-menu{
  min-width:180px;
  background:rgba(12,12,22,.97);
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  box-shadow:0 12px 36px rgba(0,0,0,.6);
  padding:4px 0;
  overflow:hidden;
}
.prompt-tpl-ctx-menu__item{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  padding:9px 14px;
  border:none;
  background:transparent;
  color:#e2e3f0;
  font-size:13px;
  cursor:pointer;
  white-space:nowrap;
}
.prompt-tpl-ctx-menu__item:hover{
  background:rgba(255,255,255,.07);
}
.prompt-tpl-ctx-menu__item.is-danger{
  color:#ff5c5c;
}
.prompt-tpl-ctx-menu__item.is-danger:hover{
  background:rgba(255,60,60,.12);
}
.prompt-tpl-ctx-menu__item svg{
  flex-shrink:0;
  opacity:.7;
}

/* ── Prompt template card checkbox ── */
.prompt-tpl-card__checkwrap{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.prompt-tpl-card__checkbox{
  position:absolute;
  opacity:0;
  width:0;
  height:0;
  pointer-events:none;
}
.prompt-tpl-card__checkui{
  display:flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  border-radius:6px;
  border:1.5px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.04);
  cursor:pointer;
  transition:all .15s;
}
.prompt-tpl-card__checkui:hover{
  border-color:rgba(139,92,246,.5);
  background:rgba(139,92,246,.08);
}
.prompt-tpl-card__checkbox:checked + .prompt-tpl-card__checkui{
  background:#8b5cf6;
  border-color:#8b5cf6;
}
.prompt-tpl-card__checkbox:checked + .prompt-tpl-card__checkui::after{
  content:'';
  display:block;
  width:10px;
  height:6px;
  border-left:2px solid #fff;
  border-bottom:2px solid #fff;
  transform:rotate(-45deg) translateY(-1px);
}
.prompt-tpl-card.is-selected{
  border-color:rgba(139,92,246,.4);
  background:linear-gradient(180deg, rgba(139,92,246,.1), rgba(139,92,246,.05));
  box-shadow:0 0 0 2px rgba(139,92,246,.15);
}

/* ── Prompt template row checkbox ── */
.prompt-tpl-row__checkwrap{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.prompt-tpl-row__checkbox{
  position:absolute;
  opacity:0;
  width:0;
  height:0;
  pointer-events:none;
}
.prompt-tpl-row__checkui{
  display:flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  border-radius:5px;
  border:1.5px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.04);
  cursor:pointer;
  transition:all .15s;
}
.prompt-tpl-row__checkui:hover{
  border-color:rgba(139,92,246,.5);
  background:rgba(139,92,246,.08);
}
.prompt-tpl-row__checkbox:checked + .prompt-tpl-row__checkui{
  background:#8b5cf6;
  border-color:#8b5cf6;
}
.prompt-tpl-row__checkbox:checked + .prompt-tpl-row__checkui::after{
  content:'';
  display:block;
  width:9px;
  height:5px;
  border-left:2px solid #fff;
  border-bottom:2px solid #fff;
  transform:rotate(-45deg) translateY(-1px);
}
.prompt-tpl-row.is-selected{
  background:rgba(139,92,246,.07);
  border-color:rgba(139,92,246,.25);
}

/* ── Prompt template bulk action bar ── */
.prompt-tpl-bulk{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 16px;
  margin-bottom:12px;
  border-radius:12px;
  background:rgba(139,92,246,.08);
  border:1px solid rgba(139,92,246,.2);
}
.prompt-tpl-bulk[hidden]{ display:none !important; }
.prompt-tpl-bulk__selectall-wrap{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
}
.prompt-tpl-bulk__selectall{
  width:18px;
  height:18px;
  cursor:pointer;
  accent-color:#8b5cf6;
}
.prompt-tpl-bulk__count{
  font-size:13px;
  font-weight:600;
  color:#c4b5fd;
  white-space:nowrap;
}
.prompt-tpl-bulk__btn{
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:6px 12px;
  border:1px solid rgba(255,255,255,.1);
  border-radius:8px;
  background:rgba(255,255,255,.05);
  color:rgba(255,255,255,.7);
  font-size:12px;
  cursor:pointer;
  transition:all .15s;
  white-space:nowrap;
}
.prompt-tpl-bulk__btn:hover{
  background:rgba(255,255,255,.1);
  color:#fff;
}
.prompt-tpl-bulk__btn--danger{
  color:#ff5c5c;
  border-color:rgba(255,60,60,.2);
}
.prompt-tpl-bulk__btn--danger:hover{
  background:rgba(255,60,60,.12);
  color:#ff6b6b;
}
.prompt-tpl-bulk__spacer{
  flex:1;
}
.prompt-tpl-bulk__btn--clear{
  color:rgba(255,255,255,.4);
  border-color:transparent;
  background:transparent;
}
.prompt-tpl-bulk__btn--clear:hover{
  color:rgba(255,255,255,.7);
  background:rgba(255,255,255,.05);
}

/* Reference-prompt icon-only buttons */
.refp-icon-btn{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  min-width:32px;
  padding:0 !important;
  border-radius:6px;
}
.refp-icon-btn span{ display:none; }

/* Date range popover (match projects page) */
.date-range-popover{
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(9,9,16,0.98);
  box-shadow: 0 18px 48px rgba(0,0,0,0.6);
  padding: 12px;
  display: none;
  min-width: 260px;
  color: #e9e9f4;
}
.date-range-popover.open{ display:block; }
.date-range-popover .dr-inline{ display:flex; align-items:center; gap:14px; }
.date-range-popover .dr-input{ display:flex; align-items:center; gap:8px; position:relative; }
.date-range-popover .dr-input label{ font-size:12px; color:#b9bacb; }
.date-range-popover .dr-text{
  width: 130px;
  background:#0f1018;
  color:#e9e9f4;
  border:1px solid rgba(255,255,255,0.14);
  border-radius:10px;
  padding:8px 30px 8px 10px;
  font-size:13px;
  letter-spacing:0.02em;
}
.date-range-popover .dr-text::placeholder{ color:#7f8398; }
.date-range-popover .cal-btn{
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  border:none;
  background:transparent;
  color:#cfd2e6;
  cursor:pointer;
  width:22px;
  height:22px;
  border-radius:6px;
  display:grid;
  place-items:center;
}
.date-range-popover .cal-btn:hover{ color:#00b4ff; }
.date-range-popover .cal-btn svg{
  width:16px;
  height:16px;
  stroke:#e9e9f4;
  stroke-width:1.6;
  fill:none;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.date-range-popover .dr-actions{ display:flex; gap:6px; margin-top:8px; }

.pill-btn{
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: #f5f5ff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.pill-btn.primary{
  border-color: rgba(255,0,140,0.6);
  background: linear-gradient(120deg, #ff62c5, #ff008c);
  color: #07040a;
  font-weight: 550;
}

/* Buttons inside popover */
.btn-secondary{
  height:34px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:#fff;
}
.btn-primary{
  height:34px;
  padding:0 12px;
  border-radius:12px;
  border:none;
  background:linear-gradient(120deg, #ff62c5, #ff008c);
  color:#fff;
  box-shadow:0 0 12px rgba(255,0,140,0.25);
}

/* Mini calendar panels use shared calendar-panel styles below */
.rv2-topbar .rv2-chip{
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--rv2-text2);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.rv2-topbar .rv2-chip.is-active{
  color: var(--rv2-text);
  border-color: rgba(255,79,195,.55);
  box-shadow: 0 0 0 1px rgba(255,79,195,.25) inset;
}

/* Search */
.rv2-search{
  flex:1;
  min-width: 260px;
  max-width: 520px;
  height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  outline: none;
  color: var(--rv2-text);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
}
.rv2-search::placeholder{ color: rgba(255,255,255,.40); }

/* Slider */
.rv2-size{
  width: 160px;
  height: 8px;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  outline: none;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(90,140,255,0.35), rgba(255,120,200,0.32));
}
.rv2-size::-webkit-slider-runnable-track{
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(90,140,255,0.35), rgba(255,120,200,0.32));
}
.rv2-size::-webkit-slider-thumb{
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f4ff6a;
  border: 2px solid #0b0b14;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
  cursor: pointer;
  margin-top: -4px;
}
.rv2-size::-moz-range-track{
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(90,140,255,0.35), rgba(255,120,200,0.32));
}
.rv2-size::-moz-range-thumb{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f4ff6a;
  border: 2px solid #0b0b14;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
  cursor: pointer;
}

/* Layout */
.rv2-layout{
  display:block; /* single column layout for Resources page */
  gap: 14px;
  padding: 12px;
}
@media (max-width: 1100px){
  .rv2-layout{ grid-template-columns: 1fr; }
}

/* Sidebar is removed in single-column layout — keep styles for potential modal/slideout */
.rv2-sidebar{
  display:none !important;
}
.rv2-sidebar h3{
  margin: 10px 0 6px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
}
.rv2-sidebar .rv2-pillrow{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
.rv2-sidebar .rv2-pill{
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--rv2-text2);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.rv2-sidebar .rv2-pill.is-active{
  color: var(--rv2-text);
  border-color: rgba(255,79,195,.55);
}

/* Main panel */
.rv2-main{
  border-radius: 22px;
  padding: 14px;
  background: var(--aidc-bg-panel);
  border: 1px solid rgba(255,255,255,.08);
  /* No min-height — panel hugs its content to avoid empty space below the grid */
}

/* Page-scoped visual polish for Resources (take styles from reference-prompt, text/audio pages and pricing hero) */
.aidc-resources-page #uploadZone {
  /* based on .refp-drop */
  position: relative;
  z-index: 0;
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  padding: 14px;
  text-align: center;
  color: #d9dcef;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.aidc-resources-page #uploadZone:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.aidc-resources-page #uploadZone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.aidc-resources-page #uploadZone strong{ color:#f6f7ff; }
.aidc-resources-page #uploadZone small{ display:block; margin-top:6px; color:#9fa3c1; }

/* Make main area look like other modules (text/audio) — panel-like visual */
.aidc-resources-page .rv2-main .aidc-scroll {
  border-radius: 24px;
  padding: 16px;
  /* No separate solid backdrop here — the main panel provides the single gradient.
     Keep subtle inner borders/shadow for depth. */
  /* Visual: remove the inner panel look so assets sit directly on the main container
     (user requested no extra visual container under assets). */
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0; /* let content flow flush into main panel */
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Topbar gradient similar to pricing hero / FAQ container */
.aidc-resources-page .rv2-topbar{
  flex: 0 0 auto; /* don't grow/shrink – keep topbar fixed-height so .aidc-scroll takes remaining space */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  position: relative;
  z-index: 5;
  border-radius: 20px;
  background: var(--aidc-bg-elevated, #212225);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.aidc-resources-page .aidc-filter__menu{
  z-index: 50;
}

/* Widen folder dropdown so long names fit on one line */
.aidc-resources-page .aidc-filter[data-filter="folder"] .aidc-filter__menu{
  min-width: 340px;
}

/* Resources page: natural document scroll (no viewport-frame).
   The panel hugs its content; sticky footer is handled by layout-single-column.css. */
body.aidc-resources-page{
  min-height: 100vh;
}
.aidc-resources-page .rv2-main{
  /* No overflow trickery — content flows naturally inside the panel */
  display:flex;
  flex-direction:column;
  min-height:0;
}
.aidc-resources-page .aidc-scroll{
  /* Inner container is just a content wrapper now — no inner scrollbar.
     The page scrolls naturally via the document. */
  min-height:0;
  margin-top: 16px;
}

/* Folder select: when custom-styled menu present, ensure internal menu scrolls if many items */
.rv2-folder-menu{ max-height: 320px; overflow:auto; scrollbar-width: thin; }
.rv2-folder-menu::-webkit-scrollbar{ width:8px; }
.rv2-folder-menu::-webkit-scrollbar-thumb{ background: linear-gradient(180deg,#ff62c5,#00b4ff); border-radius:999px; }

/* Style site-wide selects inside the resources topbar to match project look */
.aidc-resources-page .rv2-topbar select,
.aidc-resources-page .rv2-topbar .select,
.aidc-resources-page .rv2-topbar .rv2-filter{
  height:36px;
  padding:0 10px;
  border-radius:12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--rv2-text);
  appearance: none;
}
.aidc-resources-page .rv2-topbar select:focus{ border-color: rgba(255,98,197,0.45); box-shadow: 0 0 0 4px rgba(255,98,197,0.06) inset; }

.aidc-resources-page #rv2CreateFolder{ height:36px; padding:6px 10px; border-radius:12px; }

/* Keep these overrides local to Resources to avoid affecting other pages */
.aidc-resources-page .rv2-topbar .rv2-chip{ background: transparent; border-radius: 999px; }

/* Visual state when dragging files over the upload zone */
.aidc-resources-page #uploadZone.is-dragover{
  background: linear-gradient(120deg, rgba(255,98,197,0.06), rgba(0,180,255,0.04));
  border-color: rgba(255,98,197,0.5);
  box-shadow: 0 0 0 2px rgba(255,98,197,0.06) inset, 0 12px 36px rgba(0,0,0,0.5);
}


/* Upload dropzone placed at top of main content */
.rv2-uploadzone{
  border: 2px dashed rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.01);
  border-radius: 12px;
  padding: 28px;
  margin: 12px 0 18px 0;
  text-align: center;
}
.rv2-uploadzone__title{ color: var(--rv2-text2); font-size: 16px; margin-bottom: 8px; }
.rv2-uploadzone__actions { margin-top: 6px; }
.rv2-uploadzone .rv2-btn { padding: 8px 12px; border-radius: 8px; }

/* Day groups */
.rv2-day{ margin: 12px 0 18px; }
.rv2-day__head{
  display:flex;
  align-items:center;
  gap: 10px;
  margin: 6px 0 10px;
}
/* group select-all checkbox (header) */
.rv2-day__selectwrap{
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px; margin-left:4px; margin-right:4px;
  position: relative;
}
.rv2-day__selectall{
  position:absolute;
  width:18px; height:18px;
  opacity: 0;
  margin:0;
  cursor:pointer;
}
.rv2-day__selectui{
  width:18px; height:18px;
  border-radius:6px;
  border:2px solid rgba(255,255,255,.75);
  background: rgba(0,0,0,.25);
  display:inline-block;
}
.rv2-day__selectall:checked + .rv2-day__selectui{
  background: rgba(255,79,195,.24);
  border-color: rgba(255,79,195,.9);
}
.rv2-day__selectall:checked + .rv2-day__selectui::after{
  content:'✓';
  display:block;
  color:#fff;
  font-size:12px;
  text-align:center;
  line-height:18px;
}
.rv2-day__title{
  font-size: 13px;
  color: rgba(255,255,255,.75);
}
.rv2-day__grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--rv2-thumb), 1fr));
  gap: 12px;
}
.rv2-day.is-collapsed .rv2-day__grid{ display:none; }

/* Cards */
.rv2-card{
  border-radius: 18px;
  overflow:hidden;
  background: var(--aidc-workspace-stage-bg);
  border: 1px solid var(--aidc-border-default);
  transition: transform .12s ease, border-color .12s ease;
}
.rv2-card:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.16);
}
.rv2-card__media{
  position: relative;
  aspect-ratio: 1 / 1;
  background: rgba(255,255,255,.02);
}
.rv2-card__media.is-video .rv2-card__play{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.35);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(0,0,0,0.45);
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.rv2-card__media.is-video .rv2-card__play::before{
  content: "";
  display: block;
  margin-left: 2px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 14px solid #fff;
}
.rv2-card__img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.rv2-card__ph{
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--aidc-text-muted);
  font-size: 12px;
}

/* Audio placeholder card */
.rv2-card__audio-ph{
  height: 100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 8px;
  background: var(--aidc-workspace-stage-bg);
}
.rv2-card__audio-ph svg{
  opacity: 0.7;
}
.rv2-card__audio-name{
  color: var(--aidc-text-secondary);
  font-size: 11px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* Document placeholder card — colored frame with extension badge */
.rv2-card__doc-ph{
  /* inline style sets background tint per type */
  padding: 10px;
  gap: 14px !important;
}
.rv2-card__doc-icon{
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid currentColor;
  border-radius: 10px;
  opacity: 0.95;
}
.rv2-card__doc-icon svg{
  opacity: 0.9;
}
.rv2-card__doc-ext{
  position: absolute;
  bottom: -8px;
  right: -8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #0b0b14;
  color: currentColor;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  line-height: 1;
}
/* Имя документа — крупнее и заметнее, до 2 строк */
.rv2-card__doc-ph .rv2-card__audio-name{
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  max-width: 92%;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  text-align: center;
}
.rv2-card__video-ph svg{
  opacity: 0.75;
}

/* Hover controls (only on hover or selected) */
.rv2-card__checkwrap,
.rv2-card__like,
.rv2-card__pin,
.rv2-card__menu{
  position:absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

.rv2-card:hover .rv2-card__checkwrap,
.rv2-card:hover .rv2-card__like,
.rv2-card:hover .rv2-card__pin,
.rv2-card:hover .rv2-card__menu,
.rv2-card.is-selected .rv2-card__checkwrap,
.rv2-card__like.is-on,
.rv2-card__pin.is-on{
  opacity: 1;
  pointer-events: auto;
}

.rv2-card__checkwrap{
  left: 10px;
  top: 10px;
  width: 26px;
  height: 26px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.rv2-card__check{
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  appearance: none;
}
.rv2-card__checkui{
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid rgba(255,255,255,.75);
  background: rgba(0,0,0,.25);
}
.rv2-card.is-selected .rv2-card__checkui{
  background: rgba(255,79,195,.25);
  border-color: rgba(255,79,195,.85);
  box-shadow: 0 0 0 2px rgba(255,79,195,.20);
}
.rv2-card.is-selected .rv2-card__checkui::after{
  content:"✓";
  display:block;
  color: rgba(255,255,255,.95);
  font-size: 12px;
  line-height: 20px;
  text-align:center;
}

.rv2-card__like{
  left: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: rgba(255,255,255,.75);
  display:inline-grid;
  place-items:center;
  cursor:pointer;
}
.rv2-card__like svg{ width:16px; height:16px; fill:currentColor; stroke:none; }
.rv2-card__like.is-on{
  /* only color the star icon itself; keep the button chrome neutral */
  color: #FFD166; /* favorite yellow */
  background: rgba(0,0,0,0.25); /* keep original subtle dark background */
  border-color: rgba(255,255,255,0.12);
}

.rv2-card__like.is-on svg{ fill: #FFD166 !important; color: #FFD166 !important; }
.rv2-card__like.is-on svg path{ fill: #FFD166 !important; }

.rv2-card__pin{
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: rgba(255,255,255,.75);
  display:inline-grid;
  place-items:center;
  cursor:pointer;
  font-size: 14px;
  line-height: 1;
}
.rv2-card__pin.is-on{
  color: #8BE9FD;
  border-color: rgba(139,233,253,0.4);
}

/* Favorite card visual: thin yellow frame and subtle warm glow */
.rv2-card.is-favorite{
  /* make border warmer/yellow and add subtle inset/highlight */
  border-color: rgba(255,209,102,0.45);
  box-shadow: 0 10px 40px rgba(0,0,0,0.55), 0 8px 30px rgba(255,209,102,0.06);
}
.rv2-card.is-favorite .rv2-card__media{
  /* small inner outline to create thin framed look on dark background */
  box-shadow: 0 0 0 1px rgba(255,209,102,0.10) inset;
}
.rv2-card.is-favorite .rv2-card__like{
  /* keep the button shell neutral when card is favorite; only icon is highlighted */
  color: #FFD166;
}

.rv2-card.is-pinned{
  border-color: rgba(139,233,253,0.45);
  box-shadow: 0 10px 40px rgba(0,0,0,0.55), 0 8px 30px rgba(139,233,253,0.06);
}

.rv2-card__menu{
  right: 10px;
  top: 10px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.25);
  color: rgba(255,255,255,.80);
}

/* Quick-action overlay buttons (download/delete) on cards — shown on hover */
.rv2-card__quick-actions{
  position:absolute;
  bottom:8px;
  right:8px;
  display:flex;
  gap:4px;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s;
  z-index:3;
}
.rv2-card:hover .rv2-card__quick-actions{
  opacity:1;
  pointer-events:auto;
}
.rv2-card__qbtn{
  width:30px;
  height:30px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.55);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  padding:0;
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  transition:background .12s, transform .12s;
}
.rv2-card__qbtn:hover{background:rgba(255,255,255,.12);transform:translateY(-1px)}
.rv2-card__qbtn:active{transform:scale(.92)}
.rv2-card__qbtn--danger{border-color:rgba(255,80,80,.3)}
.rv2-card__qbtn--danger:hover{background:rgba(200,30,30,.7)}

/* Per-card context menu */
.rv2-card-menu{
  position: fixed;
  z-index: 12000;
  display: none;
  min-width: 180px;
  background: var(--resource-dropdown-bg, #1e1f21);
  border-radius: var(--resource-control-radius, 10px);
  padding: 8px;
  list-style:none;
  margin:0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7), 0 0 20px rgba(0,0,0,0.25);
  border:1px solid rgba(255,255,255,0.08);
  transform-origin: top right;
  transition: opacity 160ms ease, transform 170ms ease;
}
.rv2-card-menu.is-open{ display:block; opacity:1; transform:scaleY(1); }
.rv2-card-menu[hidden]{ display:none; opacity:0; transform:scaleY(0.96); }
.rv2-card-menu__list{ list-style:none; margin:0; padding:0; }
.rv2-card-menu__list li{ padding:6px 12px; margin:2px 0; border-radius:8px; color:var(--resource-text, #eae8ee); cursor:pointer; display:flex; align-items:center; gap:8px; font-size:13px; }
.rv2-card-menu__list li:hover{ background: rgba(255,255,255,0.02); }
.rv2-card-menu__list li[data-action="delete"]{ color: #ff6b6b; }
.rv2-card-menu__list li[data-action="open"]{ font-weight:600; }
/* scrollbar removed — menu fits all items without scroll */
.rv2-card-menu{ overflow: visible; }

@media (max-width:720px){
  .rv2-card-menu{ min-width:140px; }
}

/* Folder picker modal styles */
.rv2-folder-picker{
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: block;
}
.rv2-folder-picker[hidden]{ display:none; }
.rv2-folder-picker__backdrop{
  position: absolute; inset:0; background: rgba(2,2,4,0.6);
}
.rv2-folder-picker__panel{
  position: absolute; left:50%; top:50%; transform: translate(-50%,-50%);
  width: min(560px, calc(100% - 40px));
  max-height: 70vh;
  background: var(--resource-dropdown-bg, #1e1f21);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 14px 60px rgba(0,0,0,0.7);
  border:1px solid rgba(255,255,255,0.08);
  display:flex; flex-direction:column; gap:8px; overflow:hidden;
}
.rv2-folder-picker__head{ display:flex; align-items:center; justify-content:space-between; }
.rv2-folder-picker__title{ font-weight:600; color:var(--resource-text,#eae8ee); }
.rv2-folder-picker__close{ background:transparent; border:0; color:var(--resource-text); font-size:18px; cursor:pointer; }
.rv2-folder-picker__searchwrap{ padding:0 4px; }
.rv2-folder-picker__search{ width:100%; padding:8px 10px; border-radius:8px; border:1px solid rgba(255,255,255,0.04); background:rgba(0,0,0,0.2); color:var(--resource-text); }
.rv2-folder-picker__list{ list-style:none; margin:0; padding:6px; overflow:auto; max-height:46vh; }
.rv2-folder-picker__item{ padding:8px 10px; border-radius:8px; margin:4px 0; cursor:pointer; color:var(--resource-text); display:flex; align-items:center; gap:8px; transition: background .15s, box-shadow .15s; }
.rv2-folder-picker__item:hover{ background: rgba(255,255,255,0.07); box-shadow: inset 3px 0 0 rgba(200,77,255,0.35); }
.rv2-folder-picker__item:focus{ outline: 2px solid rgba(83,211,255,0.16); outline-offset: 2px; }
.rv2-folder-picker__item.is-focused{ background: rgba(255,255,255,0.07); box-shadow: inset 4px 0 0 rgba(255,0,255,0.25); }
.rv2-folder-picker__empty{ color: rgba(255,255,255,0.5); padding:8px 10px; }
.rv2-folder-picker__item{ display:flex; align-items:center; gap:8px; }
.rv2-folder-picker__icon{ display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; color:rgba(200,160,255,0.7); flex-shrink:0; }
.rv2-folder-picker__label{ flex:1; }
.rv2-folder-picker__count{ color: rgba(255,255,255,0.55); margin-left:6px; font-size:12px; }
.rv2-folder-picker__item--create{ font-weight:600; color: #7fd0ff; }
.rv2-folder-picker__item--error{ color: #ff8b8b; }
.rv2-folder-picker__actions{ display:flex; justify-content:flex-end; gap:8px; padding-top:6px; }

/* close button polish */
.rv2-folder-picker__close{ background:transparent; border:0; color:var(--resource-text); font-size:16px; width:36px; height:36px; border-radius:8px; cursor:pointer; }
.rv2-folder-picker__close:hover{ background: rgba(255,255,255,0.02); }

/* Bottom bulk bar */
.rv2-bulkbar{
  position: fixed;
  left: 0; right: 0; bottom: 14px;
  display:flex;
  justify-content:center;
  z-index: 9999;
  pointer-events:none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .14s ease, transform .14s ease;
}
.rv2-bulkbar.is-open{
  pointer-events:auto;
  opacity: 1;
  transform: translateY(0);
}
.rv2-bulkbar__inner{
  width: min(860px, calc(100vw - 24px));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(10,10,14,.82);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}
.rv2-bulkbar__left{
  display:flex;
  align-items:baseline;
  gap: 6px;
  color: rgba(255,255,255,.85);
}
.rv2-bulkbar__count{
  font-weight: 700;
  color: rgba(255,255,255,.95);
}
.rv2-bulkbar__label{
  font-size: 12px;
  color: rgba(255,255,255,.60);
}
.rv2-bulkbar__actions{
  display:flex;
  align-items:center;
  gap: 8px;
}
.rv2-btn{
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.86);
  font-size: 13px;
  line-height:1;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  height: 38px;
}
.rv2-btn--ghost:hover{
  border-color: rgba(255,79,195,.35);
  box-shadow: 0 0 0 1px rgba(255,79,195,.20) inset;
}
.rv2-btn__txt{ display:inline; }
@media (max-width: 560px){
  .rv2-btn__txt{ display:none; }
}
.rv2-bulkbar__close{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.75);
}

/* Loading/empty states */
.rv2-loading,
.rv2-empty{
  color: rgba(255,255,255,.65);
  font-size: 13px;
  padding: 18px 8px;
}

/* ====== Additional toolbar, gallery and bottom bar styles (from user patch) ====== */
/* ====== TOOLBAR (compact, premium) ====== */
.resources-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:14px 16px;
  border-radius:18px;
  background:rgba(10,12,18,.55);
  border:1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
}

.toolbar-group{position:relative; display:flex; align-items:center; gap:10px;}
.select{
  height:36px;
  padding:0 12px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  color:#fff;
}

.icon-btn{
  width:36px; height:36px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  color:#fff;
  display:grid; place-items:center;
  cursor:pointer;
}

.size-slider{
  display:flex;
  align-items:center;
  gap:10px;
  height:36px;
  padding:0 12px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
}
.size-slider input[type="range"]{width:220px;}

/* ====== POPOVER (calendar) ====== */
.popover{
  position:absolute;
  top:44px;
  left:0;
  min-width:280px;
  padding:12px;
  border-radius:16px;
  background:rgba(12,14,22,.92);
  border:1px solid rgba(255,255,255,.10);
  box-shadow:0 20px 60px rgba(0,0,0,.55);
  z-index:50;
}
.popover-title{font-weight:600; margin-bottom:10px; color:#fff;}
.popover-row{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px;}
.popover-row label{opacity:.8; font-size:13px;}
.input{
  height:34px;
  border-radius:12px;
  padding:0 10px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  color:#fff;
}
.popover-actions{display:flex; justify-content:flex-end; gap:10px; margin-top:6px;}
.btn-primary,.btn-secondary{
  height:34px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  cursor:pointer;
}
.btn-primary{background:linear-gradient(120deg, #ff62c5, #ff008c); color:#fff; border:none; box-shadow:0 0 16px rgba(255,0,140,0.3);}
.btn-secondary{background:rgba(255,255,255,.06); color:#fff;}

/* ====== GALLERY GRID (square previews like Higgsfield) ====== */
.resources-gallery{
  display:grid;
  gap:16px;
  padding:14px 0 120px; /* место под bottom bar */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.asset-card{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

/* квадрат */
.asset-card .thumb{
  width:100%;
  aspect-ratio: 1 / 1;
  display:block;
  object-fit:cover;
  background:rgba(255,255,255,.03);
}

/* hover glow */
.asset-card:hover{
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

/* ====== card overlay icons: appear only on hover ====== */
.card-ui{
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:0;
  transition:opacity .15s ease;
}
.asset-card:hover .card-ui{opacity:1;}

.card-ui .leftTop,
.card-ui .rightTop,
.card-ui .leftBottom{
  position:absolute;
  pointer-events:auto;
  display:flex;
  gap:8px;
}

.card-ui .leftTop{top:10px; left:10px;}
.card-ui .rightTop{top:10px; right:10px;}
.card-ui .leftBottom{bottom:10px; left:10px;}

.mini-ic{
  width:30px; height:30px;
  border-radius:999px;
  background:rgba(0,0,0,.45);
  border:1px solid rgba(255,255,255,.16);
  display:grid; place-items:center;
  color:#fff;
  font-size:14px;
  cursor:pointer;
}

/* selected state */
.asset-card.is-selected{
  outline:2px solid rgba(255,0,170,.55);
  outline-offset:0;
}

/* ====== bottom action bar (like Higgsfield) ====== */
.bottom-actions{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  height:52px;
  padding:0 12px;
  border-radius:18px;
  background:rgba(12,14,22,.86);
  border:1px solid rgba(255,255,255,.10);
  box-shadow:0 30px 80px rgba(0,0,0,.6);
  display:flex;
  align-items:center;
  gap:10px;
  z-index:80;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s ease;
}

/* покажем бар, когда на body есть класс has-selection (логику подключим позже) */
body.has-selection .bottom-actions{
  opacity:1;
  pointer-events:auto;
}

.bottom-actions .count{
  opacity:.85;
  padding:0 8px;
  font-size:13px;
}

.bottom-actions .action{
  height:36px;
  padding:0 10px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  color:#fff;
  cursor:pointer;
}

/* Calendar panel styles copied from projects to match visuals */
.calendar-panel, .gen-cal-panel{
  position:absolute;
  top:48px;
  left:0;
  background:#0c0e18;
  border:1px solid rgba(255,255,255,0.12);
  border-radius:12px;
  box-shadow:0 12px 36px rgba(0,0,0,0.55);
  padding:10px;
  min-width:260px;
  display:none;
  z-index:1200;
}
.calendar-panel.open, .gen-cal-panel.open{ display:block; }
.date-range-popover .calendar-panel,
.date-range-popover .gen-cal-panel{
  top: calc(100% + 8px);
  left: 0;
}
.cal-header{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; }
.cal-title{ font-size:13px; color:#e9ebff; letter-spacing:0.02em; display:flex; align-items:center; gap:8px; }
.cal-nav{ display:inline-flex; gap:6px; }
.cal-btn-nav{ width:26px; height:26px; border-radius:8px; border:1px solid rgba(255,255,255,0.14); background:rgba(255,255,255,0.04); color:#dfe2f7; display:grid; place-items:center; cursor:pointer; }
.cal-select, .cal-year{
  background:#0f1018; color:#e9e9f4; border:1px solid rgba(255,255,255,0.14); border-radius:8px;
  padding:6px 8px; font-size:12px; outline:none; appearance:none;
}
.cal-year{ width:84px; text-align:center; }
.cal-grid{ display:grid; grid-template-columns:repeat(7, 1fr); gap:4px; }
.cal-dow{ font-size:11px; color:#9aa0b8; text-align:center; padding:4px 0; }
.cal-day{ font-size:12px; color:#e9e9f6; text-align:center; padding:7px 0; border-radius:8px; cursor:pointer; border:1px solid rgba(255,255,255,0.06); background:rgba(255,255,255,0.02); }
.cal-day:hover{ border-color:rgba(0,180,255,0.6); }
.cal-day.muted{ color:#7d8196; opacity:0.6; }
.cal-day.today{ box-shadow:0 0 0 1px rgba(255,0,140,0.55); }
.cal-day.selected{ background: linear-gradient(120deg, #ff62c5, #ff008c); color:#0b0710; border-color:rgba(255,0,140,0.6); }

/* Sticky footer and resources page layout scoping: keep footer at bottom */
.aidc-resources-page{
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
/* .rv2-root is wrapped by #app > .shell — not a direct child of body,
   so we use a descendant selector and ensure the entire flex chain is intact.
   flex-basis:0% forces the element to grow from zero rather than from content
   height, which guarantees it fills the remaining space and pushes footer down. */
.aidc-resources-page .rv2-root{
  flex:1 1 0%;
  display:flex;
  flex-direction:column;
  min-height:0;
}
.aidc-resources-page main.rv2-layout{
  flex:1 1 0%;
  display:flex;
  flex-direction:column;
  min-height:0;
}
/* Ensure .rv2-main (aidc-scroll-host) participates in flex chain */
.aidc-resources-page .rv2-main{
  flex:1 1 0%;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

/* Remove/neutralize outer panel/background layers that create a second backdrop
   The site has generic .panel/.placeholder styles with radial gradients.
   Scope overrides to .aidc-resources-page so other pages keep their visuals. */
.aidc-resources-page .panel,
.aidc-resources-page .panel-block,
.aidc-resources-page .panel--center,
.aidc-resources-page .panel--left,
.aidc-resources-page .panel--right,
.aidc-resources-page .placeholder-card {
  background: var(--aidc-bg-panel) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: none !important;
  border-radius: 22px;
}

/* Also ensure any generic radial accents from core are hidden inside the resources page
   so only .rv2-main's gradient remains visible. */
.aidc-resources-page .panel::before,
.aidc-resources-page .panel::after,
.aidc-resources-page .placeholder-card::before,
.aidc-resources-page .placeholder-card::after{
  display:none !important;
}

/* ===============================
   Folder dropdown error & skeleton states
   Targeting aidc-filter__item used by resources.js
   =============================== */
.aidc-filter__item.is-error {
  cursor: default;
  pointer-events: none;
  opacity: 0.65;
  filter: grayscale(1);
  background: linear-gradient(90deg, rgba(255,80,80,0.08), rgba(255,80,80,0.02));
  border: 1px dashed rgba(255,120,120,0.35);
  border-radius: 10px;
  margin: 6px 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: rgba(255,180,180,0.85);
}
.aidc-filter__item.is-error:hover,
.aidc-filter__item.is-error:active {
  background: inherit;
  box-shadow: none;
}
.aidc-filter__item.is-error .aidc-filter__item__icon {
  margin-right: 10px;
  font-size: 14px;
  opacity: 0.85;
}
.aidc-filter__item.is-error .aidc-filter__item__label { display:inline-flex; align-items:center; gap:8px; }

.aidc-filter__item.is-skeleton {
  pointer-events: none;
  cursor: default;
  position: relative;
  margin: 6px 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
  overflow: hidden;
}
.aidc-filter__item.is-skeleton::before {
  content: "";
  position: absolute;
  top: 0; left: -60%; height: 100%; width: 60%;
  background: linear-gradient(90deg, rgba(255,255,255,0.00), rgba(255,255,255,0.10), rgba(255,255,255,0.00));
  animation: aidc-skeleton 1.2s ease-in-out infinite;
}
@keyframes aidc-skeleton { 0% { left: -60%; } 100% { left: 120%; } }
.aidc-filter__item.is-skeleton .aidc-filter__item__label { display:block; height:12px; width:70%; border-radius:999px; background: rgba(255,255,255,0.10); }

/* ====== Inline folder action buttons (rename / delete) ====== */
.aidc-filter__item.is-user-folder {
  display: flex;
  align-items: center;
  position: relative;
}
.aidc-filter__item__actions {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}
.aidc-filter__item.is-user-folder:hover .aidc-filter__item__actions,
.aidc-filter__item.is-user-folder:focus-within .aidc-filter__item__actions {
  display: inline-flex;
}
.aidc-filter__item__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.45);
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.aidc-filter__item__action-btn:hover {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
}
.aidc-filter__item__action-btn--danger:hover {
  background: rgba(255,80,100,0.14);
  color: #ff6b8a;
}
.aidc-filter__item__action-btn svg {
  pointer-events: none;
}

/* ====== Folder context menu (right-click) ====== */
.rv2-folder-ctx-menu {
  position: fixed;
  z-index: 100000;
  min-width: 180px;
  background: rgba(26, 22, 38, 0.97);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(200,77,255,0.08);
  padding: 5px;
  backdrop-filter: blur(12px);
  animation: rv2-ctx-in .12s ease;
}
@keyframes rv2-ctx-in { from { opacity:0; transform:scale(.95); } to { opacity:1; transform:scale(1); } }

.rv2-folder-ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: #eaeaf6;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 7px;
  transition: background .12s, color .12s;
  text-align: left;
}
.rv2-folder-ctx-menu__item:hover {
  background: rgba(255,255,255,0.07);
}
.rv2-folder-ctx-menu__item svg { flex-shrink: 0; opacity: 0.7; }
.rv2-folder-ctx-menu__item:hover svg { opacity: 1; }

.rv2-folder-ctx-menu__item--danger { color: #ff6b8a; }
.rv2-folder-ctx-menu__item--danger:hover { background: rgba(255,80,100,0.12); }

/* ====== Folder delete dialog ====== */
.rv2-folder-del-dialog {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rv2-ctx-in .15s ease;
}
.rv2-folder-del-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}
.rv2-folder-del-dialog__panel {
  position: relative;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: rgba(30, 24, 46, 0.98);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  padding: 28px 24px 20px;
}
.rv2-folder-del-dialog__title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}
.rv2-folder-del-dialog__body {
  font-size: 13.5px;
  color: rgba(234,234,246,0.65);
  margin-bottom: 20px;
  line-height: 1.45;
}
.rv2-folder-del-dialog__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.rv2-folder-del-dialog__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #eaeaf6;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.rv2-folder-del-dialog__btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
}
.rv2-folder-del-dialog__btn svg { flex-shrink: 0; opacity: 0.7; }
.rv2-folder-del-dialog__btn:hover svg { opacity: 1; }

.rv2-folder-del-dialog__btn--move:hover {
  border-color: rgba(200,77,255,0.35);
  color: #d4a0ff;
}
.rv2-folder-del-dialog__btn--danger {
  color: #ff6b8a;
  border-color: rgba(255,80,100,0.15);
}
.rv2-folder-del-dialog__btn--danger:hover {
  background: rgba(255,80,100,0.12);
  border-color: rgba(255,80,100,0.35);
}

.rv2-folder-del-dialog__cancel {
  display: block;
  width: 100%;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(234,234,246,0.45);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s;
  text-align: center;
}
.rv2-folder-del-dialog__cancel:hover { color: rgba(234,234,246,0.75); }

/* ─── Custom tooltip for elements with data-tooltip (zoom-safe, replaces native title) ─── */
.rv2-icon-btn[data-tooltip],
.prompt-tpl-card__icon-btn[data-tooltip] {
  position: relative;
}
.rv2-icon-btn[data-tooltip]::after,
.prompt-tpl-card__icon-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 6px;
  background: #0b0e16;
  border: 1px solid rgba(255,255,255,0.12);
  color: #f5f5f5;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10000;
}
.rv2-icon-btn[data-tooltip]:hover::after,
.prompt-tpl-card__icon-btn[data-tooltip]:hover::after {
  opacity: 1;
}

/* ─── Inline Template Picker (fallback for pages without resources.js) ─── */
.refp-tpl-picker {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
}
.refp-tpl-picker__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
}
.refp-tpl-picker__card {
  position: relative; z-index: 1;
  width: min(420px, 90vw); max-height: 70vh;
  background: #1a1c2e; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.refp-tpl-picker__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 600; font-size: 15px; color: #e4e8f8;
}
.refp-tpl-picker__close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 18px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.refp-tpl-picker__close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.refp-tpl-picker__list {
  overflow-y: auto; padding: 8px;
  flex: 1 1 auto;
}
.refp-tpl-picker__item {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; text-align: left;
  padding: 10px 14px; border: none; border-radius: 8px;
  background: transparent; color: #e4e8f8;
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: background 0.15s;
}
.refp-tpl-picker__item:hover { background: rgba(143,179,255,0.10); }
.refp-tpl-picker__item strong {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.refp-tpl-picker__item span {
  color: rgba(228,232,248,0.5); font-size: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ====== View mode toggle button ====== */
.rv2-view-toggle {
  position: relative;
  flex-shrink: 0;
}
.rv2-view-toggle.is-contain .rv2-view-toggle__cover { display: none; }
.rv2-view-toggle.is-contain .rv2-view-toggle__contain { display: inline !important; }

/* ====== Contain view mode ====== */
.rv2-grid--contain .rv2-card__img {
  object-fit: contain !important;
  background: rgba(0,0,0,0.35);
}
.rv2-grid--contain .rv2-card__media {
  background: rgba(0,0,0,0.35);
}

/* ====== Comments badge on card ====== */
.rv2-card__comments {
  position: absolute;
  bottom: 14px;
  left: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 12px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
  z-index: 4;
  white-space: nowrap;
}
.rv2-card__comments svg {
  flex-shrink: 0;
  opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AIDC Theme Overrides for resources (use vars from core.css :root)
   ═══════════════════════════════════════════════════════════════════════════ */
.prompt-template-editor__select,
.date-range-popover .dr-text,
.cal-grid {
  background: var(--aidc-bg-elevated, #212225) !important;
}
.rv2-card__doc-ext {
  background: var(--aidc-bg-panel) !important;
}
.refp-tpl-picker__card {
  background: var(--aidc-bg-card, #272829) !important;
}
.rv2-icon-btn[data-tooltip]::after,
.prompt-tpl-card__icon-btn[data-tooltip]::after {
  background: var(--aidc-bg-popover) !important;
}

/* Team names can be much longer than the compact toolbar slot. */
.aidc-filter[data-filter="team"] .aidc-filter__trigger{
  width:100%;
  min-width:0;
}
.aidc-filter[data-filter="team"] .aidc-filter__label{
  min-width:0;
}
.aidc-filter[data-filter="team"] .aidc-filter__menu{
  left:0;
  right:auto;
  max-width:calc(100vw - 48px);
}
