/* Prompt Library — light, catchy, unique */
#pl-root.pl-shell{
  position:relative;
  font-family:var(--pl-font);
  color:var(--pl-text);
  background:var(--pl-bg);
  padding:32px clamp(16px,4vw,40px);
  border-radius:calc(var(--pl-radius) + 8px);
  overflow:hidden;
  isolation:isolate;
}
#pl-root *,#pl-root *::before,#pl-root *::after{box-sizing:border-box}
#pl-root button{font-family:inherit}

/* Decorative blobs */
#pl-root .pl-bg{position:absolute;inset:0;z-index:-1;overflow:hidden;pointer-events:none}
#pl-root .pl-blob{position:absolute;filter:blur(70px);opacity:.35;border-radius:50%}
#pl-root .pl-blob-1{width:380px;height:380px;background:var(--pl-primary);top:-120px;left:-100px}
#pl-root .pl-blob-2{width:320px;height:320px;background:var(--pl-accent);top:20%;right:-100px;opacity:.28}
#pl-root .pl-blob-3{width:260px;height:260px;background:var(--pl-primary);bottom:-120px;left:30%;opacity:.18}

/* Header */
#pl-root .pl-header{display:flex;flex-wrap:wrap;gap:16px;justify-content:space-between;align-items:center;margin-bottom:24px}
#pl-root .pl-brand{display:flex;gap:14px;align-items:center}
#pl-root .pl-logo{width:44px;height:44px;display:grid;place-items:center;font-size:22px;color:#fff;
  background:linear-gradient(135deg,var(--pl-primary),var(--pl-accent));
  border-radius:14px;box-shadow:0 10px 24px -12px var(--pl-primary)}
#pl-root .pl-title{margin:0;font-size:26px;font-weight:800;letter-spacing:-.02em;line-height:1.1;color:var(--pl-text)}
#pl-root .pl-sub{font-size:13px;color:var(--pl-muted);margin-top:2px}

#pl-root .pl-actions{display:flex;gap:8px;flex-wrap:wrap}
#pl-root .pl-actions .pl-view-btn{display:inline-flex;align-items:center;justify-content:center}
#pl-root .pl-btn{border:1px solid var(--pl-border);background:var(--pl-card);color:var(--pl-text);
  padding:9px 14px;border-radius:12px;font-size:13.5px;font-weight:600;cursor:pointer;
  transition:transform .12s ease, box-shadow .2s ease, background .2s ease;}
#pl-root .pl-btn:hover{transform:translateY(-1px);box-shadow:0 8px 20px -12px rgba(0,0,0,.18)}
#pl-root .pl-btn-primary{background:linear-gradient(135deg,var(--pl-primary),var(--pl-accent));color:#fff;border-color:transparent}
#pl-root .pl-btn-ghost.active{background:color-mix(in oklab,var(--pl-primary) 12%, var(--pl-card));border-color:color-mix(in oklab,var(--pl-primary) 40%, var(--pl-border))}

/* Controls */
#pl-root .pl-controls{display:flex;flex-direction:column;gap:14px;margin-bottom:var(--pl-filters-gap, 20px)}
#pl-root .pl-search{position:relative;background:var(--pl-card);border:1px solid var(--pl-border);border-radius:var(--pl-input-radius,14px);padding:10px 14px 10px 40px}
#pl-root .pl-search:focus-within{border-color:var(--pl-primary);box-shadow:0 0 0 4px color-mix(in oklab,var(--pl-primary) 18%, transparent)}
#pl-root .pl-search input{width:100%;border:0;outline:0;background:transparent;color:var(--pl-text);font-size:15px}
#pl-root .pl-search-icon{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:var(--pl-muted);font-size:16px}
#pl-root .pl-chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
#pl-root .pl-chip{border:1px solid var(--pl-border);
  background:var(--pl-chip-bg, var(--pl-card));
  color:var(--pl-chip-text, var(--pl-text));
  padding:6px 12px;border-radius:999px;font-size:12.5px;cursor:pointer;font-weight:500}
#pl-root .pl-chip.active{
  background:var(--pl-chip-active-bg, var(--pl-text));
  color:var(--pl-chip-active-text, var(--pl-card));
  border-color:var(--pl-chip-active-bg, var(--pl-text))}
#pl-root .pl-chip-more{border:1px dashed var(--pl-border);background:transparent;color:var(--pl-primary);
  padding:6px 12px;border-radius:999px;font-size:12.5px;cursor:pointer;font-weight:600}

/* Cards */
#pl-root .pl-loading{padding:24px;color:var(--pl-muted);text-align:center}
#pl-root .pl-empty{padding:40px;text-align:center;color:var(--pl-muted);background:var(--pl-card);border:1px dashed var(--pl-border);border-radius:var(--pl-radius)}
#pl-root .pl-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
#pl-root .pl-card{position:relative;background:var(--pl-card);border:1px solid var(--pl-border);border-radius:var(--pl-card-radius,var(--pl-radius));
  padding:18px;display:flex;flex-direction:column;gap:10px;
  transition:transform .15s ease, box-shadow .2s ease, border-color .2s ease;cursor:pointer}
#pl-root .pl-card::before{content:"";position:absolute;inset:0;border-radius:inherit;padding:1px;
  background:linear-gradient(135deg,var(--pl-primary),var(--pl-accent));
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;mask-composite:exclude;opacity:0;transition:opacity .2s ease;pointer-events:none}
#pl-root .pl-card:hover{transform:translateY(-2px);box-shadow:0 20px 40px -24px rgba(30,27,75,.25)}
#pl-root .pl-card:hover::before{opacity:1}
#pl-root .pl-card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
#pl-root .pl-card-title{margin:0;font-size:16px;font-weight:700;letter-spacing:-.01em}
#pl-root .pl-fav{background:transparent;border:0;font-size:20px;cursor:pointer;color:var(--pl-muted);line-height:1}
#pl-root .pl-fav.on{color:var(--pl-accent)}
#pl-root .pl-card-body{margin:0;color:var(--pl-muted);font-size:13.5px;line-height:1.55;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
#pl-root .pl-card-meta{display:flex;flex-wrap:wrap;gap:6px}
#pl-root .pl-tag{font-size:11px;padding:3px 8px;border-radius:999px;
  background:var(--pl-tag-bg, color-mix(in oklab,var(--pl-primary) 8%, var(--pl-card)));
  border:1px solid var(--pl-border);
  color:var(--pl-tag-text, var(--pl-text))}
#pl-root .pl-tag.cat{
  background:var(--pl-cat-bg, color-mix(in oklab,var(--pl-accent) 15%, var(--pl-card)));
  border-color:var(--pl-cat-bg, color-mix(in oklab,var(--pl-accent) 30%, var(--pl-border)));
  color:var(--pl-cat-text, var(--pl-text))}
#pl-root .pl-tag.model{
  background:var(--pl-model-bg, color-mix(in oklab,var(--pl-primary) 15%, var(--pl-card)));
  border-color:var(--pl-model-bg, color-mix(in oklab,var(--pl-primary) 30%, var(--pl-border)));
  color:var(--pl-model-text, var(--pl-text))}
#pl-root .pl-card-foot{display:flex;justify-content:space-between;align-items:center;margin-top:auto;padding-top:6px;border-top:1px dashed var(--pl-border)}
#pl-root .pl-author{font-size:12px;color:var(--pl-muted)}
#pl-root .pl-card-btns{display:flex;gap:6px}
#pl-root .pl-copy,#pl-root .pl-edit{background:transparent;border:1px solid var(--pl-border);color:var(--pl-text);padding:5px 10px;border-radius:8px;font-size:12px;cursor:pointer;font-weight:600}
#pl-root .pl-copy:hover,#pl-root .pl-edit:hover{background:color-mix(in oklab,var(--pl-primary) 8%, var(--pl-card));border-color:var(--pl-primary)}
#pl-root .pl-copy.done{background:var(--pl-primary);color:#fff;border-color:var(--pl-primary)}

/* Pager */
#pl-root .pl-pager{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin-top:var(--pl-pager-top, 22px);margin-bottom:var(--pl-pager-bot, 0)}
#pl-root .pl-cards{margin-bottom:var(--pl-grid-gap-b, 0)}
#pl-root .pl-pager button{background:var(--pl-card);border:1px solid var(--pl-border);color:var(--pl-text);padding:6px 12px;border-radius:8px;cursor:pointer;font-size:13px}
#pl-root .pl-pager button.active{background:var(--pl-primary);color:#fff;border-color:var(--pl-primary)}
#pl-root .pl-pager button:disabled{opacity:.4;cursor:not-allowed}

/* Modals — bullet-proof hide via [hidden] and .pl-open */
#pl-root .pl-modal{position:fixed;inset:0;background:rgba(15,15,35,.55);backdrop-filter:blur(6px);
  z-index:99999;align-items:center;justify-content:center;padding:20px;overflow-y:auto}
#pl-root .pl-modal[hidden]{display:none !important}
#pl-root .pl-modal.pl-open{display:flex !important}
#pl-root .pl-modal-card{position:relative;background:var(--pl-card);color:var(--pl-text);
  border-radius:calc(var(--pl-radius) + 6px);padding:28px;max-width:680px;width:100%;
  max-height:calc(100vh - 40px);overflow-y:auto;box-shadow:0 30px 80px -20px rgba(0,0,0,.35);
  border:1px solid var(--pl-border)}
html.pl-modal-lock,
body.pl-modal-lock{overflow:hidden !important;overscroll-behavior:none !important;touch-action:none}
#pl-root .pl-modal.pl-open{overscroll-behavior:contain;touch-action:auto}
#pl-root .pl-modal-card{overscroll-behavior:contain;touch-action:auto}
#pl-root #pl-modal-view .pl-modal-card{max-width:760px}
#pl-root .pl-x{position:absolute;top:12px;right:12px;background:transparent;border:0;font-size:26px;line-height:1;cursor:pointer;color:var(--pl-muted)}
#pl-root .pl-modal-toolbar{display:flex;align-items:center;gap:12px;min-height:34px;margin:-6px 0 16px}
#pl-root .pl-modal-toolbar .pl-x{position:static;margin-left:auto;width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;font-size:24px}
#pl-root .pl-modal-toolbar .pl-x:hover{background:color-mix(in oklab,var(--pl-primary) 8%, var(--pl-card));color:var(--pl-text)}
#pl-root .pl-modal-card h3{margin:0 0 8px;font-size:20px;font-weight:800}
#pl-root .pl-modal-card label{display:block;margin:12px 0;font-size:13px;font-weight:600;color:var(--pl-text)}
#pl-root .pl-modal-card input,#pl-root .pl-modal-card textarea{width:100%;margin-top:6px;padding:10px 12px;
  border:1px solid var(--pl-border);border-radius:10px;background:var(--pl-bg);color:var(--pl-text);
  font-family:inherit;font-size:14px;font-weight:400}
#pl-root .pl-modal-card input:focus,#pl-root .pl-modal-card textarea:focus{outline:0;border-color:var(--pl-primary);box-shadow:0 0 0 3px color-mix(in oklab,var(--pl-primary) 20%, transparent)}
#pl-root .pl-modal-card textarea{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;line-height:1.5}
#pl-root .pl-muted{color:var(--pl-muted);font-size:13px;margin:0 0 4px}
#pl-root .pl-msg{margin-top:10px;font-size:13px}
#pl-root .pl-msg.ok{color:#059669}
#pl-root .pl-msg.err{color:#dc2626}

/* View modal content */
#pl-root .pl-view-head{margin:0 0 14px}
#pl-root .pl-view-title{margin:0 0 4px;font-size:24px;font-weight:800;letter-spacing:-.015em;line-height:1.2;word-break:break-word}
#pl-root .pl-view-byline{margin:0;font-size:12.5px;color:var(--pl-muted)}
#pl-root .pl-view-meta{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 14px}
#pl-root .pl-view-content{background:var(--pl-bg);border:1px solid var(--pl-border);border-radius:12px;
  padding:16px 18px;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:13.5px;line-height:1.65;color:var(--pl-text);max-height:50vh;overflow:auto;
  box-shadow:inset 0 1px 0 color-mix(in oklab,var(--pl-text) 4%, transparent)}
#pl-root .pl-view-actions{display:flex;gap:8px;margin-top:16px;flex-wrap:wrap;
  padding-top:14px;border-top:1px dashed var(--pl-border)}

/* ---------- Extended customization ---------- */
#pl-root .pl-inner{max-width:var(--pl-max-w,1200px);margin:0 auto;position:relative}
#pl-root{font-size:var(--pl-font-size,15px)}
#pl-root .pl-cards{grid-template-columns:repeat(auto-fill,minmax(var(--pl-card-min,280px),1fr));gap:var(--pl-card-gap,16px)}
#pl-root .pl-btn{border-radius:var(--pl-btn-radius,12px)}
#pl-root .pl-logo{background:linear-gradient(var(--pl-grad,135deg),var(--pl-primary),var(--pl-accent))}
#pl-root .pl-btn-primary{background:linear-gradient(var(--pl-grad,135deg),var(--pl-primary),var(--pl-accent))}
#pl-root .pl-card::before{background:linear-gradient(var(--pl-grad,135deg),var(--pl-primary),var(--pl-accent))}

/* Header alignment */
#pl-root.pl-align-center .pl-header{flex-direction:column;text-align:center;align-items:center}
#pl-root.pl-align-center .pl-brand{flex-direction:column;text-align:center}
#pl-root.pl-align-center .pl-actions{justify-content:center}

/* Card style variants */
#pl-root.pl-card-flat .pl-card{box-shadow:none;background:color-mix(in oklab,var(--pl-card) 96%, var(--pl-primary));border-color:transparent}
#pl-root.pl-card-flat .pl-card:hover{box-shadow:none}
#pl-root.pl-card-outline .pl-card{background:transparent;border-width:1.5px}
#pl-root.pl-card-gradient .pl-card{border-color:transparent}
#pl-root.pl-card-gradient .pl-card::before{opacity:1}

/* Background variants */
#pl-root.pl-bg-plain{background:var(--pl-bg)}
#pl-root.pl-bg-dots{background:
  radial-gradient(circle,color-mix(in oklab,var(--pl-text) 12%, transparent) 1px,transparent 1px) 0 0/22px 22px,
  var(--pl-bg)}
#pl-root.pl-bg-grid{background:
  linear-gradient(color-mix(in oklab,var(--pl-text) 8%, transparent) 1px,transparent 1px) 0 0/28px 28px,
  linear-gradient(90deg,color-mix(in oklab,var(--pl-text) 8%, transparent) 1px,transparent 1px) 0 0/28px 28px,
  var(--pl-bg)}

/* Hover effect variants */
#pl-root.pl-hover-none .pl-card:hover{transform:none;box-shadow:none}
#pl-root.pl-hover-none .pl-card:hover::before{opacity:0}
#pl-root.pl-hover-glow .pl-card:hover{transform:none;box-shadow:0 0 0 3px color-mix(in oklab,var(--pl-primary) 25%, transparent), 0 20px 40px -24px color-mix(in oklab,var(--pl-primary) 40%, transparent)}

/* Footer */
#pl-root .pl-footer{margin-top:28px;padding-top:16px;border-top:1px solid var(--pl-border);text-align:center;color:var(--pl-muted);font-size:12.5px}

/* Clickable tag/category chips on cards (visually identical to old spans, keyboard-friendly) */
.pl-tag { cursor: pointer; background: none; font: inherit; }
.pl-tag:focus-visible { outline: 2px solid var(--pl-primary); outline-offset: 2px; }

/* Active filters bar */
.pl-active-filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:8px 0 4px; }
.pl-active-chip { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px;
  background: color-mix(in srgb, var(--pl-primary) 10%, transparent);
  color: var(--pl-text); font-size: 13px; border: 1px solid color-mix(in srgb, var(--pl-primary) 25%, transparent); }
.pl-active-chip strong { font-weight: 600; }
.pl-active-x { border:0; background:transparent; cursor:pointer; font-size:16px; line-height:1; color:var(--pl-muted); padding:0 2px; }
.pl-active-x:hover { color: var(--pl-text); }
.pl-active-clear { border:0; background:transparent; cursor:pointer; color:var(--pl-primary); font-size:12px; text-decoration:underline; }

/* Outer background container corners (Settings → Background corners) */
#pl-root.pl-corners-square{border-radius:0}
#pl-root.pl-corners-rounded{border-radius:calc(var(--pl-radius) + 8px)}

/* --- Type tabs (Prompts / Images / Videos) --- */
#pl-root .pl-type-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 12px;padding:4px;background:var(--pl-chip-bg,rgba(255,255,255,0.06));border:1px solid color-mix(in oklab,var(--pl-border) 75%, transparent);border-radius:var(--pl-input-radius,12px);width:fit-content;max-width:100%}
#pl-root .pl-type-tab{border:0;background:transparent;padding:8px 14px;font-size:13px;font-weight:600;color:var(--pl-text);opacity:.72;border-radius:var(--pl-btn-radius,10px);cursor:pointer;transition:background .15s ease,color .15s ease,opacity .15s ease}
#pl-root .pl-type-tab:hover{opacity:1;background:color-mix(in oklab,var(--pl-primary) 8%, transparent)}
#pl-root .pl-type-tab.active{background:var(--pl-chip-active-bg,var(--pl-primary));color:var(--pl-chip-active-text,#fff);opacity:1}
#pl-root .pl-type-tabs-with-toggle{align-items:center;width:fit-content}
#pl-root .pl-type-tabs-with-toggle .pl-view-toggle{margin:0;flex:0 0 auto;align-self:center}
#pl-root .pl-type-tabs-toggle-left .pl-view-toggle{order:-2;margin-right:2px}
#pl-root .pl-type-tabs-toggle-right .pl-view-toggle{order:20;margin-left:2px}

/* Row placement: tabs pill on the left, Grid/List toggle on the far right of the same row, vertically centered */
#pl-root .pl-tabs-row{display:flex;align-items:center;gap:12px;margin:10px 0 12px;width:100%;flex-wrap:wrap}
#pl-root .pl-tabs-row .pl-type-tabs{margin:0}
#pl-root .pl-tabs-row .pl-view-toggle{margin:0 0 0 auto !important;flex:0 0 auto;align-self:center}
/* v4.51 — right-side group: count badge + view toggle sit together on the far
   right of the type-bar row. Keeps the tabs bar the same height as before. */
#pl-root .pl-tabs-row .pl-tabs-right{
  display:flex;align-items:center;gap:8px;margin-left:auto;flex:0 0 auto;
}
#pl-root .pl-tabs-row .pl-tabs-right .pl-view-toggle{margin:0 !important}
#pl-root .pl-tabs-row .pl-type-tabs,
#pl-root .pl-tabs-row .pl-view-toggle{min-height:40px;box-sizing:border-box}
#pl-root .pl-tabs-row .pl-tabs-count{align-self:center;margin:0}
@media (max-width:640px){
  /* Mobile polish: stack the tabs bar on line 1 (scrollable) and put the
     count badge + Grid/List toggle on line 2 aligned to the right. This
     avoids the squeezed / overflowing single-line layout on phones. */
  #pl-root .pl-tabs-row{gap:8px;flex-wrap:wrap;align-items:center;width:100%}
  #pl-root .pl-tabs-row .pl-type-tabs{flex:1 1 100%;min-width:0;overflow-x:auto;-webkit-overflow-scrolling:touch;width:100%;max-width:100%}
  #pl-root .pl-tabs-row .pl-tabs-right{flex:1 1 100%;justify-content:flex-end;margin-left:0;gap:6px}
  #pl-root .pl-tabs-row .pl-view-toggle{flex:0 0 auto;margin:0 !important}
  /* Compact the badge + toggle text on small screens */
  #pl-root .pl-tabs-row .pl-tabs-count{font-size:11.5px;padding:6px 10px}
  #pl-root .pl-type-tabs .pl-view-mode-btn{padding:4px 8px;font-size:10.5px}
  #pl-root .pl-type-tabs{min-height:36px}
  #pl-root .pl-tabs-row .pl-type-tabs,
  #pl-root .pl-tabs-row .pl-view-toggle{min-height:36px}
}

/* --- Media on cards (uniform thumbnail across every image/video card) --- */
#pl-root .pl-card .pl-media{
  position:relative;margin:0 0 12px;overflow:hidden;
  border-radius:calc(var(--pl-card-radius,var(--pl-radius)) - 6px);
  background:color-mix(in oklab,var(--pl-text) 6%, var(--pl-card));
  aspect-ratio:4/3;width:100%;max-width:100%;
  border:1px solid color-mix(in oklab,var(--pl-text) 8%, transparent);
}
#pl-root .pl-card{padding:14px}
#pl-root .pl-card .pl-media img,
#pl-root .pl-card .pl-media video,
#pl-root .pl-card .pl-media iframe{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;object-position:center;display:block;
  max-width:100%;max-height:100%;background:transparent;border:0;
}
.pl-card .pl-media .pl-play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:44px;color:#fff;text-shadow:0 2px 8px rgba(0,0,0,.6);pointer-events:none}
.pl-card-image .pl-card-body,.pl-card-video .pl-card-body{display:none}

/* --- Media in view modal — image behaves exactly like video ---
   Fixed container (16/9), image scaled with object-fit:contain,
   letterboxed background so any aspect ratio looks clean.        */
#pl-root .pl-view-media{
  position:relative;margin:0 0 14px;
  border-radius:var(--pl-card-radius,var(--pl-radius));overflow:hidden;
  background:color-mix(in oklab,var(--pl-text) 12%, var(--pl-card));
  display:flex;align-items:center;justify-content:center;
  width:100%;max-width:100%;
  aspect-ratio:16/9;
}
#pl-root .pl-view-media.pl-image,
#pl-root .pl-view-media.pl-video{aspect-ratio:16/9}
#pl-root .pl-view-media img,
#pl-root .pl-view-media iframe,
#pl-root .pl-view-media video{
  position:absolute;inset:0;
  width:100%;height:100%;max-width:100%;max-height:100%;
  display:block;border:0;margin:0;
  object-fit:contain;object-position:center;background:transparent;
}


/* Delete button — visually consistent with existing card buttons */
#pl-root .pl-delete{background:transparent;border:1px solid var(--pl-border);color:var(--pl-text);padding:5px 9px;border-radius:8px;font-size:12px;cursor:pointer;font-weight:600;line-height:1}
#pl-root .pl-delete:hover{background:color-mix(in oklab,#ef4444 12%, var(--pl-card));border-color:#ef4444;color:#ef4444}
#pl-root .pl-btn-danger{border-color:#ef4444;color:#ef4444}
#pl-root .pl-btn-danger:hover{background:#ef4444;color:#fff}
#pl-root .pl-card-del{background:transparent;border:0;font-size:16px;cursor:pointer;color:var(--pl-muted);line-height:1;padding:2px 4px;border-radius:6px;transition:color .15s,background .15s}
#pl-root .pl-card-del:hover{color:#ef4444;background:rgba(239,68,68,.08)}

#pl-root .pl-signout,#pl-root .pl-signin{text-decoration:none}

.pl-access-denied{max-width:560px;margin:32px auto;padding:24px;border:1px solid var(--pl-border,#e5e7eb);border-radius:12px;background:var(--pl-card,#fff);color:var(--pl-text,#111827);text-align:center}
.pl-access-denied p{margin:0 0 14px;color:var(--pl-muted,#64748b)}

/* --- Account modal --- */
#pl-root .pl-account-btn{font-weight:600}
.pl-account-card{max-width:640px}
.pl-tabs{display:flex;gap:4px;border-bottom:1px solid var(--pl-border);margin:8px 0 16px;flex-wrap:wrap}
.pl-tabs .pl-tab{background:transparent;border:0;border-bottom:2px solid transparent;padding:10px 14px;cursor:pointer;color:var(--pl-muted);font-weight:600;font-size:14px}
.pl-tabs .pl-tab.active{color:var(--pl-text);border-bottom-color:var(--pl-primary)}
.pl-account-panel{min-height:200px}
.pl-account-foot{margin-top:18px;padding-top:14px;border-top:1px solid var(--pl-border);display:flex;justify-content:flex-end}
.pl-account-posts{display:flex;flex-direction:column;gap:8px;max-height:50vh;overflow-y:auto}

/* Dashboard rows: icon actions + pager (themed via CSS vars) */
.pl-mypost{display:flex;gap:12px;align-items:center;padding:10px;border:1px solid var(--pl-border);border-radius:10px;margin-bottom:8px;cursor:pointer;background:var(--pl-card);transition:border-color .15s,background .15s}
.pl-mypost:hover{border-color:var(--pl-primary);background:color-mix(in oklab,var(--pl-primary) 5%, var(--pl-card))}
.pl-mypost-thumb{width:56px;height:56px;object-fit:cover;border-radius:8px;flex:0 0 56px;background:color-mix(in oklab,var(--pl-text) 6%, var(--pl-card))}
.pl-mypost-thumb-empty{background:linear-gradient(135deg,color-mix(in oklab,var(--pl-text) 10%, var(--pl-card)),var(--pl-card))}
.pl-mypost-body{flex:1;min-width:0}
.pl-mypost-title{font-weight:600;color:var(--pl-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pl-mypost-meta{font-size:12px;color:var(--pl-muted);margin-top:2px;text-transform:capitalize}
.pl-mypost-actions{display:flex;gap:4px;flex-shrink:0}
.pl-status-badge{display:inline-block;font-size:10px;font-weight:700;padding:2px 6px;border-radius:6px;background:rgba(234,179,8,.15);color:#a16207;margin-left:6px;text-transform:uppercase;letter-spacing:.03em;vertical-align:middle}
.pl-icon-btn{background:transparent;border:1px solid transparent;border-radius:6px;width:32px;height:32px;cursor:pointer;font-size:15px;line-height:1;display:inline-flex;align-items:center;justify-content:center;color:var(--pl-muted);transition:background .15s,color .15s,border-color .15s}
.pl-icon-btn:hover{background:color-mix(in oklab,var(--pl-primary) 8%, var(--pl-card));border-color:var(--pl-border);color:var(--pl-text)}
.pl-icon-btn.pl-icon-danger:hover{background:color-mix(in oklab,#ef4444 10%, var(--pl-card));color:#ef4444;border-color:color-mix(in oklab,#ef4444 30%, var(--pl-border))}
.pl-mypost-pager{display:flex;gap:6px;justify-content:center;margin-top:14px;flex-wrap:wrap}
.pl-page-btn{min-width:32px;height:32px;padding:0 10px;border:1px solid var(--pl-border);border-radius:6px;background:var(--pl-card);cursor:pointer;font-size:13px;color:var(--pl-text)}
.pl-page-btn:hover{background:color-mix(in oklab,var(--pl-primary) 8%, var(--pl-card))}
.pl-page-btn.active{background:var(--pl-primary);color:#fff;border-color:var(--pl-primary)}

/* Back button in modals (dashboard flow) */
#pl-root .pl-back { position:static; display:inline-flex; align-items:center; justify-content:center; min-height:34px; background:var(--pl-card); border:1px solid var(--pl-border); color:var(--pl-text); border-radius:8px; padding:6px 12px; font-size:13px; font-weight:600; cursor:pointer; line-height:1; }
#pl-root .pl-back:hover { background:color-mix(in oklab,var(--pl-primary) 8%, var(--pl-card)); border-color:color-mix(in oklab,var(--pl-primary) 35%, var(--pl-border)); }

/* ============================================================
   Mobile responsiveness & UI polish (v4.20)
   ============================================================ */

/* Modal cards: safe padding, full-height sheet on small screens */
#pl-root .pl-modal{padding:12px}
#pl-root .pl-modal-card{padding:22px 20px}
#pl-root .pl-modal-toolbar{gap:8px;flex-wrap:wrap;margin:-4px 0 14px}

/* View modal: better readability of the content block */
#pl-root .pl-view-content{max-height:55vh}
#pl-root .pl-view-title{font-size:20px;line-height:1.25;word-break:break-word}
#pl-root .pl-view-actions .pl-btn{flex:0 1 auto}

/* Dashboard rows already have flex; make thumbnails shrink safely */
.pl-mypost{flex-wrap:nowrap}
.pl-mypost-body{min-width:0}
.pl-mypost-title{overflow:hidden;text-overflow:ellipsis}

@media (max-width: 640px){
  #pl-root.pl-shell{padding:20px 14px;border-radius:calc(var(--pl-radius) + 4px)}
  #pl-root.pl-shell.pl-corners-square{border-radius:0}
  #pl-root .pl-title{font-size:22px}
  #pl-root .pl-sub{font-size:12.5px}
  #pl-root .pl-header{gap:10px;margin-bottom:16px}
  #pl-root .pl-actions{width:100%;justify-content:flex-start}
  #pl-root .pl-btn{padding:8px 12px;font-size:13px}
  #pl-root .pl-controls{gap:10px;margin-bottom:var(--pl-filters-gap, 14px)}
  #pl-root .pl-search input{font-size:16px} /* prevents iOS zoom */
  #pl-root .pl-cards{grid-template-columns:1fr;gap:12px}
  #pl-root .pl-card{padding:14px}
  #pl-root .pl-card-title{font-size:15px}
  #pl-root .pl-card-body{-webkit-line-clamp:2}

  /* Modal → full-screen sheet */
  #pl-root .pl-modal{padding:0;align-items:stretch}
  #pl-root .pl-modal-card{
    max-width:100%;width:100%;
    max-height:100vh;min-height:100vh;
    border-radius:0;padding:16px 14px 24px;
    display:flex;flex-direction:column;
  }
  #pl-root .pl-modal-toolbar{position:sticky;top:0;background:var(--pl-card);
    z-index:2;padding:6px 0;margin:0 0 10px;border-bottom:1px solid var(--pl-border)}
  #pl-root .pl-modal-toolbar .pl-x{width:38px;height:38px;font-size:26px}
  #pl-root .pl-back{padding:8px 12px;font-size:13px}
  #pl-root .pl-view-title{font-size:18px}
  #pl-root .pl-view-content{max-height:none;font-size:13px;padding:12px}
  #pl-root .pl-view-actions{flex-direction:column;align-items:stretch}
  #pl-root .pl-view-actions .pl-btn{width:100%;text-align:center}
  #pl-root .pl-modal-card input,
  #pl-root .pl-modal-card textarea{font-size:16px} /* iOS: no autozoom */

  /* Dashboard tabs + rows */
  .pl-tabs{gap:2px;overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch}
  .pl-tabs .pl-tab{white-space:nowrap;padding:10px 12px;font-size:13px}
  .pl-account-posts{max-height:none}
  .pl-mypost{padding:8px;gap:10px}
  .pl-mypost-thumb{width:44px;height:44px;flex:0 0 44px}
  .pl-mypost-title{font-size:14px}
  .pl-mypost-meta{font-size:11.5px}
  .pl-icon-btn{width:34px;height:34px} /* larger tap target */

  /* Chips scroll horizontally instead of wrapping into tall stack */
  #pl-root .pl-chips{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;
    padding-bottom:4px;scrollbar-width:none}
  #pl-root .pl-chips::-webkit-scrollbar{display:none}
  #pl-root .pl-chip,#pl-root .pl-chip-more{white-space:nowrap;flex:0 0 auto}

  #pl-root .pl-type-tabs{width:100%;justify-content:space-between}
  #pl-root .pl-type-tab{flex:1;text-align:center;padding:8px 6px}

  /* Media in view modal */
  #pl-root #pl-modal-view .pl-modal-card{overflow-y:auto}
  #pl-root #pl-view-body{width:100%}
  #pl-root .pl-view-media{margin:0 0 12px;border-radius:var(--pl-card-radius,var(--pl-radius))}
  #pl-root .pl-view-media.pl-image,
  #pl-root .pl-view-media.pl-video{aspect-ratio:16/9;max-height:50vh}

}

/* Tablet: keep image bounded so it never pushes the modal wider */
@media (min-width: 641px) and (max-width: 900px){
  #pl-root #pl-modal-view .pl-modal-card{max-width:92vw}
  #pl-root .pl-view-media.pl-image,
  #pl-root .pl-view-media.pl-video{max-height:55vh}

}

@media (max-width: 380px){
  #pl-root .pl-title{font-size:20px}
  #pl-root .pl-logo{width:38px;height:38px;font-size:18px}
}

/* Larger tap targets across the board on touch devices */
@media (hover:none) and (pointer:coarse){
  #pl-root .pl-fav,#pl-root .pl-card-del{padding:6px;min-width:34px;min-height:34px}
  #pl-root .pl-copy,#pl-root .pl-edit,#pl-root .pl-delete{padding:8px 12px}
}

/* ============================================================
   Layout Templates (v4.22)
   Selected via body class pl-tpl-{name} from admin → Design → Layout Template
   All templates are fully mobile-responsive.
   ============================================================ */

/* --- Search Hero: big centered search on top, filters below --- */
#pl-root.pl-tpl-search-hero .pl-controls{gap:18px;align-items:stretch}
#pl-root.pl-tpl-search-hero .pl-search{
  max-width:640px;width:100%;margin:6px auto 4px;padding:14px 18px 14px 46px;
  font-size:16px;box-shadow:0 12px 40px -20px color-mix(in oklab,var(--pl-primary) 50%,transparent);
  border-width:2px;
}
#pl-root.pl-tpl-search-hero .pl-search input{font-size:16px}
#pl-root.pl-tpl-search-hero .pl-search-icon{left:18px;font-size:20px}
#pl-root.pl-tpl-search-hero .pl-chips{justify-content:center}
#pl-root.pl-tpl-search-hero .pl-type-tabs{margin-left:auto;margin-right:auto}

/* --- Filter Focus: prominent chips, small right-aligned search --- */
#pl-root.pl-tpl-filter-focus .pl-controls{gap:12px}
#pl-root.pl-tpl-filter-focus .pl-chips{gap:10px}
#pl-root.pl-tpl-filter-focus .pl-chip{padding:8px 16px;font-size:13.5px;font-weight:600;border-width:1.5px}
#pl-root.pl-tpl-filter-focus .pl-chip.active{transform:scale(1.04);box-shadow:0 6px 16px -8px color-mix(in oklab,var(--pl-primary) 60%,transparent)}
@media (min-width:720px){
  #pl-root.pl-tpl-filter-focus .pl-search{max-width:320px;margin-left:auto;padding:8px 14px 8px 34px}
  #pl-root.pl-tpl-filter-focus .pl-search-icon{left:12px;font-size:14px}
  #pl-root.pl-tpl-filter-focus .pl-search input{font-size:13.5px}
}

/* --- Compact Toolbar: search + chips in one row on desktop, stacked on mobile --- */
@media (min-width: 720px){
  #pl-root.pl-tpl-compact-toolbar .pl-controls{flex-direction:row;flex-wrap:wrap;align-items:center;gap:10px}
  #pl-root.pl-tpl-compact-toolbar .pl-search{flex:0 0 260px;padding:8px 12px 8px 34px}
  #pl-root.pl-tpl-compact-toolbar .pl-search-icon{left:12px;font-size:14px}
  #pl-root.pl-tpl-compact-toolbar .pl-chips{flex:1;min-width:0}
  #pl-root.pl-tpl-compact-toolbar .pl-chips-models{flex-basis:100%}
}

/* --- Magazine: 2-column masonry-like on desktop, denser cards --- */
@media (min-width: 900px){
  #pl-root.pl-tpl-magazine .pl-cards{grid-template-columns:repeat(2,1fr);gap:20px}
  #pl-root.pl-tpl-magazine .pl-card{padding:22px}
  #pl-root.pl-tpl-magazine .pl-card-title{font-size:18px}
  #pl-root.pl-tpl-magazine .pl-card-body{-webkit-line-clamp:4}
}

/* --- Minimal: cards only — hide search bar, filter chips and active-filter chips.
   Type tabs remain so users can still switch Prompts/Images/Videos. --- */
#pl-root.pl-tpl-minimal .pl-controls,
#pl-root.pl-tpl-minimal #pl-active-filters{display:none !important}
#pl-root.pl-tpl-minimal .pl-type-tabs{margin:0 auto 14px}

/* --- Search + Dropdowns: search bar and 3 dropdown selects in one row --- */
#pl-root.pl-tpl-search-dropdowns .pl-controls{
  display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:10px;
}
#pl-root.pl-tpl-search-dropdowns .pl-search{flex:1 1 260px;min-width:220px}
#pl-root.pl-tpl-search-dropdowns .pl-chips.pl-dd{
  flex:0 1 auto;display:inline-flex;overflow:visible;padding:0;background:transparent;border:0;
}
#pl-root.pl-tpl-search-dropdowns .pl-dd-select{
  min-width:160px;padding:10px 34px 10px 14px;font:inherit;color:var(--pl-text);
  background:var(--pl-card);border:1px solid var(--pl-border);
  border-radius:var(--pl-input-radius,12px);cursor:pointer;line-height:1.2;
  appearance:none;-webkit-appearance:none;-moz-appearance:none;
  background-image:linear-gradient(45deg, transparent 50%, var(--pl-muted) 50%),
                   linear-gradient(135deg, var(--pl-muted) 50%, transparent 50%);
  background-position:calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size:6px 6px, 6px 6px;background-repeat:no-repeat;
}
#pl-root.pl-tpl-search-dropdowns .pl-dd-select:focus{
  outline:0;border-color:var(--pl-primary);
  box-shadow:0 0 0 4px color-mix(in oklab, var(--pl-primary) 18%, transparent);
}
#pl-root.pl-tpl-search-dropdowns .pl-active-filters{flex-basis:100%}
@media (max-width:640px){
  #pl-root.pl-tpl-search-dropdowns .pl-controls{flex-direction:column;align-items:stretch}
  #pl-root.pl-tpl-search-dropdowns .pl-dd-select{width:100%;min-width:0}
}


/* Mobile overrides for every template — force stacked, full-width controls */
@media (max-width: 640px){
  #pl-root[class*="pl-tpl-"] .pl-controls{flex-direction:column;align-items:stretch;gap:10px}
  /* CRITICAL: reset flex so `flex-basis:260px` (set on desktop) does not
     become a 260px MIN-HEIGHT once the parent flex switches to column. */
  #pl-root[class*="pl-tpl-"] .pl-search{
    flex:0 0 auto;align-self:stretch;
    max-width:none;width:100%;min-height:0;height:auto;
    margin:0;padding:10px 14px 10px 40px;font-size:15px;
    border-width:1px;box-shadow:none;
    display:block;
  }
  #pl-root[class*="pl-tpl-"] .pl-search-icon{left:14px;top:50%;transform:translateY(-50%);font-size:16px}
  #pl-root[class*="pl-tpl-"] .pl-search input{width:100%;height:auto;font-size:16px;line-height:1.4}
  #pl-root.pl-tpl-filter-focus .pl-chip{padding:6px 12px;font-size:12.5px}
  #pl-root.pl-tpl-magazine .pl-cards{grid-template-columns:1fr}
}

/* Pagination window: sliding page numbers with prev/next + ellipsis */
#pl-root .pl-pager{display:flex;flex-wrap:wrap;gap:6px;align-items:center;justify-content:center}
#pl-root .pl-pager .pl-ellipsis{padding:6px 4px;color:var(--pl-muted);user-select:none}

/* ============================================================
   Design token wiring (v4.27)
   Route Design tab tokens to every element that ships with a
   hardcoded radius/shape so admin changes reflect on the frontend.
   ============================================================ */

/* Button shape (--pl-btn-radius) — cards, dashboard, pager, back, delete */
#pl-root .pl-copy,
#pl-root .pl-edit,
#pl-root .pl-delete,
#pl-root .pl-back,
#pl-root .pl-pager button,
.pl-icon-btn,
.pl-page-btn{border-radius:var(--pl-btn-radius,8px)}

/* Input / search radius (--pl-input-radius) — modal fields, view content, mypost rows */
#pl-root .pl-modal-card input,
#pl-root .pl-modal-card textarea,
#pl-root .pl-modal-card select{border-radius:var(--pl-input-radius,10px)}
#pl-root .pl-view-content{border-radius:var(--pl-input-radius,12px)}
.pl-mypost{border-radius:var(--pl-input-radius,10px)}
.pl-mypost-thumb{border-radius:calc(var(--pl-input-radius,10px) - 2px)}

/* Card radius (--pl-card-radius) — modal card, empty state track cards */
#pl-root .pl-modal-card{border-radius:calc(var(--pl-card-radius,var(--pl-radius)) + 6px)}
#pl-root .pl-empty{border-radius:var(--pl-card-radius,var(--pl-radius))}

/* Square background corners must win on mobile too */
#pl-root.pl-corners-square,
#pl-root.pl-corners-square.pl-shell{border-radius:0}

/* Card style: elevated (default) gets an explicit resting shadow so the
   selector isn't a no-op vs. flat/outline/gradient. */
#pl-root.pl-card-elevated .pl-card{box-shadow:0 8px 24px -18px rgba(15,15,35,.25)}

/* Flat cards: remove the gradient hover ring too, for a truly flat look */
#pl-root.pl-card-flat .pl-card::before{display:none}

/* Chips honor the active-chip palette when set (already wired via CSS vars) */

/* ============================================================
   Responsive polish (v4.28)
   Fixes: broken layouts, spacing, misalignment, overflow, card
   sizing and grid consistency across desktop / tablet / mobile.
   ============================================================ */

/* 1) Grid never overflows — clamp min column width to container width */
#pl-root .pl-cards{
  grid-template-columns:repeat(auto-fill,minmax(min(var(--pl-card-min,280px),100%),1fr));
}

/* 2) Prevent long titles / meta from breaking layout */
#pl-root .pl-card-title,
#pl-root .pl-view-title,
#pl-root .pl-title,
.pl-mypost-title{overflow-wrap:anywhere;word-break:break-word}
#pl-root .pl-card-body,
#pl-root .pl-view-content,
#pl-root .pl-author,
#pl-root .pl-sub{overflow-wrap:anywhere}

/* 3) Header: keep brand shrinkable so actions never clip it */
#pl-root .pl-header{align-items:flex-start}
#pl-root .pl-brand{min-width:0;flex:1 1 auto}
#pl-root .pl-brand > *{min-width:0}
#pl-root .pl-title{overflow-wrap:anywhere}
#pl-root .pl-actions{flex-shrink:0}

/* 4) Card head: title truncates gracefully next to fav/delete icons */
#pl-root .pl-card-head{min-width:0}
#pl-root .pl-card-head > .pl-card-title{flex:1 1 auto;min-width:0}
#pl-root .pl-card-foot{gap:8px;flex-wrap:wrap}
#pl-root .pl-author{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto}
#pl-root .pl-card-btns{flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}

/* 5) Card media never exceeds card width (prevents right-edge overflow) */
#pl-root .pl-card .pl-media{max-width:100%}
#pl-root .pl-card .pl-media img{max-width:100%}

/* 6) View modal content: images/embeds fit */
#pl-root .pl-view-content img,
#pl-root .pl-view-content video,
#pl-root .pl-view-content iframe{max-width:100%;height:auto;display:block;margin:8px 0}

/* 7) Modal card: never wider than viewport, always safe padding */
#pl-root .pl-modal-card{max-width:min(760px,calc(100vw - 24px))}
#pl-root #pl-modal-view .pl-modal-card{max-width:min(820px,calc(100vw - 24px))}

/* 8) Dashboard rows: allow actions to wrap under title on narrow widths */
.pl-mypost{flex-wrap:wrap}
.pl-mypost-body{flex:1 1 60%}
.pl-mypost-actions{flex-wrap:wrap;justify-content:flex-end}

/* 9) Tabs (account modal) scroll gracefully on any width when they overflow */
.pl-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
.pl-tabs .pl-tab{white-space:nowrap}

/* 10) Tablet breakpoint (641–1024): dial spacing between mobile & desktop */
@media (min-width: 641px) and (max-width: 1024px){
  #pl-root.pl-shell{padding:24px clamp(16px,3vw,28px)}
  #pl-root .pl-header{gap:12px;margin-bottom:20px}
  #pl-root .pl-title{font-size:24px}
  #pl-root .pl-cards{gap:14px}
  #pl-root .pl-card{padding:16px}
  #pl-root .pl-modal-card{padding:22px 20px}
  #pl-root .pl-view-title{font-size:22px}
  #pl-root .pl-view-content{max-height:52vh}
  /* Header actions never push past viewport */
  #pl-root .pl-actions{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  #pl-root .pl-actions::-webkit-scrollbar{display:none}
  #pl-root .pl-actions > *{flex:0 0 auto}
}

/* 11) Small mobile: type tabs must not force horizontal scroll of page */
@media (max-width: 480px){
  #pl-root .pl-type-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch;flex-wrap:nowrap;width:100%}
  #pl-root .pl-type-tabs::-webkit-scrollbar{display:none}
  #pl-root .pl-type-tab{flex:0 0 auto}
  #pl-root .pl-actions{width:100%;flex-wrap:wrap}
  #pl-root .pl-actions .pl-btn{flex:1 1 auto;text-align:center}
  .pl-account-foot{flex-direction:column;align-items:stretch}
  .pl-account-foot .pl-btn{width:100%;text-align:center}
}

/* 12) Very narrow (<360px): tighten paddings, keep icon buttons tappable */
@media (max-width: 360px){
  #pl-root.pl-shell{padding:16px 10px}
  #pl-root .pl-card{padding:12px}
  #pl-root .pl-modal-card{padding:14px 12px 20px}
  .pl-mypost{padding:8px;gap:8px}
  .pl-mypost-thumb{width:40px;height:40px;flex:0 0 40px}
}

/* 13) Prevent shell horizontal scroll caused by decorative blobs on narrow */
#pl-root.pl-shell{max-width:100%}

/* 14) Modal toolbar wraps cleanly when both Back and X are present */
#pl-root .pl-modal-toolbar{flex-wrap:wrap;row-gap:6px}
#pl-root .pl-modal-toolbar .pl-back{flex:0 0 auto}



/* ============================================================
   Final mobile polish (v4.30)
   ============================================================ */
#pl-root .pl-card .pl-media{aspect-ratio:4/3;max-height:260px}
@media (max-width:640px){
  #pl-root.pl-shell{padding:16px 12px}
  #pl-root .pl-inner{padding:0}
  #pl-root .pl-header{flex-direction:column;align-items:stretch;gap:12px}
  #pl-root .pl-brand{width:100%}
  #pl-root .pl-actions{width:100%;justify-content:flex-start;flex-wrap:wrap;gap:6px}
  #pl-root .pl-actions .pl-btn{flex:1 1 auto;text-align:center;min-height:40px;white-space:normal}
  #pl-root .pl-card .pl-media{aspect-ratio:4/3;max-height:220px}
  #pl-root .pl-cards{grid-template-columns:1fr;gap:12px;padding:0}
  #pl-root .pl-modal{padding:0;overflow:hidden}
  #pl-root .pl-modal-card{padding:14px 14px 24px;border-radius:0;max-width:100%;width:100%;min-height:100vh;min-height:100dvh;max-height:100vh;max-height:100dvh;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch}
  #pl-root .pl-view-media{aspect-ratio:4/3;max-height:42vh;max-height:42dvh}
  #pl-root .pl-view-actions{position:static;background:transparent;margin:16px 0 0;padding:14px 0 0;border-top:1px solid var(--pl-border);display:grid;gap:10px}
  #pl-root .pl-view-actions .pl-btn{width:100%;min-height:46px;display:inline-flex;align-items:center;justify-content:center;text-align:center}
  #pl-root .pl-type-tabs{flex-wrap:nowrap;overflow-x:auto;width:100%;max-width:100%;scrollbar-width:none}
  #pl-root .pl-type-tabs::-webkit-scrollbar{display:none}
  #pl-root .pl-type-tab{flex:1 0 auto;min-width:33.3%;text-align:center}
}

/* v4.35: when a popup is open, only the popup scrolls — never the page/grid behind it. */
@media (max-width:640px){
  html.pl-modal-lock,
  body.pl-modal-lock{overflow:hidden !important;overscroll-behavior:none !important;touch-action:none}
  #pl-root .pl-modal.pl-open{position:fixed;inset:0;height:100vh;height:100dvh;overflow:hidden;overscroll-behavior:contain;touch-action:auto}
  #pl-root .pl-modal.pl-open .pl-modal-card{height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;touch-action:pan-y}
  #pl-root #pl-modal-view #pl-view-body{overflow:visible}
}

/* v4.48 mobile polish: filters, chips, pager, search */
@media (max-width:640px){
  #pl-root .pl-controls{gap:8px}
  #pl-root .pl-search input{min-height:0;height:100%;font-size:15px;padding:0 12px 0 34px;line-height:1;border-radius:12px}
  #pl-root .pl-search-icon{left:12px;top:50%;transform:translateY(-50%)}
  #pl-root .pl-chips{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding-bottom:2px;gap:6px;width:100%}
  #pl-root .pl-chips::-webkit-scrollbar{display:none}
  #pl-root .pl-chip{flex:0 0 auto;min-height:34px;padding:6px 10px;font-size:12.5px;white-space:nowrap}
  #pl-root .pl-active-filters{gap:6px;flex-wrap:wrap}
  #pl-root .pl-pager{flex-wrap:wrap;gap:6px;justify-content:center}
  #pl-root .pl-pager .pl-page-btn{min-height:38px;min-width:38px;padding:8px 10px}
  #pl-root .pl-view-toggle{margin:6px 0 8px}
  #pl-root .pl-view-mode-btn{min-height:36px;padding:6px 10px;font-size:12.5px}
  #pl-root .pl-tabs-count{font-size:11.5px;padding:5px 9px}
}
@media (min-width:641px) and (max-width:900px){
  #pl-root .pl-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  #pl-root .pl-card .pl-media{aspect-ratio:4/3;max-height:240px}
}

/* ============================================================
   Mobile image + view modal fixes (v4.34)
   ============================================================ */
#pl-root .pl-card,
#pl-root .pl-card .pl-media,
#pl-root .pl-view-media{min-width:0}

@media (max-width:640px){
  /* Image cards must always stay inside the one-column mobile grid. */
  #pl-root .pl-card{overflow:hidden}
  #pl-root .pl-card .pl-media{
    width:100%;max-width:100%;min-width:0;
    height:auto;aspect-ratio:4/3;max-height:220px;
    margin-left:auto;margin-right:auto;
  }
  #pl-root .pl-card .pl-media img,
  #pl-root .pl-card .pl-media video,
  #pl-root .pl-card .pl-media iframe{max-width:100%;max-height:100%}

  /* Popup image should fit the phone screen without sliding to one side. */
  #pl-root .pl-view-media,
  #pl-root .pl-view-media.pl-image{
    width:100%;max-width:100%;min-width:0;
    height:auto;aspect-ratio:4/3;max-height:42vh;max-height:42dvh;
    margin:0 0 12px;
  }
  #pl-root .pl-view-media img,
  #pl-root .pl-view-media video,
  #pl-root .pl-view-media iframe{max-width:100%;max-height:100%}

  /* Keep the Back / Close toolbar in its own row so it never covers the title. */
  #pl-root #pl-modal-view .pl-modal-card{
    display:flex;flex-direction:column;
    padding:12px 12px 20px;
    max-width:100%;width:100%;min-height:100vh;min-height:100dvh;max-height:100vh;max-height:100dvh;
    overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;border-radius:0;
  }
  #pl-root #pl-modal-view .pl-modal-toolbar{
    flex:0 0 auto;display:grid;grid-template-columns:minmax(0,1fr) auto;
    align-items:center;gap:8px;position:relative;top:auto;z-index:auto;
    margin:0 0 14px;padding:0 0 10px;
    background:var(--pl-card);border-bottom:1px solid var(--pl-border);
  }
  #pl-root #pl-modal-view .pl-modal-toolbar .pl-back{
    justify-self:start;max-width:100%;min-height:40px;padding:8px 12px;
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  }
  #pl-root #pl-modal-view .pl-modal-toolbar .pl-x{
    justify-self:end;margin-left:0;width:40px;height:40px;min-width:40px;
  }
  #pl-root #pl-view-body{flex:1 1 auto;min-height:0;padding-top:0;overflow:visible}
  #pl-root #pl-view-body .pl-view-head{margin-top:0;padding-top:0}
  #pl-root .pl-view-title{font-size:18px;line-height:1.3;margin:0 0 6px}
  #pl-root .pl-view-byline{font-size:12px;line-height:1.4}
  #pl-root .pl-view-meta{gap:5px;margin-bottom:12px}
  #pl-root .pl-tag{font-size:10.5px;line-height:1.2;padding:3px 7px}
  #pl-root .pl-view-content{font-size:13px;line-height:1.55;padding:12px;max-height:none;overflow:visible}
  #pl-root .pl-view-actions{position:static;background:transparent;margin:16px 0 0;padding:14px 0 0;border-top:1px solid var(--pl-border);display:grid;gap:10px}
  #pl-root .pl-view-actions .pl-btn{width:100%;min-height:46px;display:inline-flex;align-items:center;justify-content:center;text-align:center}
}

/* v4.34 mobile safety: no modal controls are sticky/overlayed on phones, so
   titles, prompt text, and action buttons never slide underneath each other. */
@media (max-width:640px){
  #pl-root #pl-modal-view .pl-modal-toolbar,
  #pl-root #pl-modal-view .pl-view-actions{
    position:static !important;
    top:auto !important;
    bottom:auto !important;
    z-index:auto !important;
  }
  #pl-root #pl-modal-view .pl-modal-card,
  #pl-root #pl-modal-view #pl-view-body,
  #pl-root #pl-modal-view .pl-view-head,
  #pl-root #pl-modal-view .pl-view-content,
  #pl-root #pl-modal-view .pl-view-actions{
    transform:none !important;
  }
  #pl-root #pl-modal-view .pl-view-content{
    max-height:none !important;
    padding-bottom:12px !important;
  }
}

/* ---------- Total prompts count ---------- */
.pl-total-count{
  font-size: 14px;
  color: var(--pl-muted, #64748b);
  margin: 4px 0 10px;
  padding: 4px 2px;
  line-height: 1.4;
}
.pl-total-count:empty{ display:none; }
.pl-total-count.pl-align-left   { text-align:left; }
.pl-total-count.pl-align-center { text-align:center; }
.pl-total-count.pl-align-right  { text-align:right; }
.pl-total-count-below-grid { margin: 12px 0 4px; }
.pl-total-count-above-pager { margin: 12px 0 4px; }
@media (max-width: 640px){
  .pl-total-count{ font-size: 13px; text-align:center !important; }
}

/* ---------- Total-count brown badge (matches type-tabs bar) ---------- */
#pl-root .pl-style-badge-brown{
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 16px;
  font-size:13px; font-weight:700; letter-spacing:.01em;
  color:#fff;
  background:linear-gradient(135deg,#3a2a10 0%, #6b4a1a 45%, #b8802a 100%);
  border:1px solid rgba(0,0,0,.18);
  border-radius:999px;
  box-shadow:0 6px 14px -8px rgba(120,80,20,.55), inset 0 1px 0 rgba(255,255,255,.15);
  line-height:1;
  white-space:nowrap;
}
/* Inline-with-tabs badge slot inside .pl-type-tabs */
#pl-root .pl-type-tabs .pl-tabs-count{
  margin-left:6px;
  align-self:center;
}
#pl-root .pl-type-tabs .pl-tabs-count[hidden]{ display:none; }
#pl-root .pl-total-count.pl-style-badge-brown{ margin:6px 0 10px; }

/* v4.51 — solid custom-color pill (colors applied inline from settings) */
#pl-root .pl-style-badge-solid{
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 16px;
  font-size:13px; font-weight:700; letter-spacing:.01em;
  border:1px solid rgba(0,0,0,.15);
  border-radius:999px;
  box-shadow:0 4px 10px -6px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.10);
  line-height:1; white-space:nowrap;
}
#pl-root .pl-type-tabs + .pl-tabs-right .pl-style-badge-brown,
#pl-root .pl-type-tabs + .pl-tabs-right .pl-style-badge-solid{
  padding:7px 14px; font-size:12.5px;
}

/* v4.52 — theme-synced badge: pulls colors from the site's design tokens
   (primary / primary-foreground) so the count badge automatically follows
   the active color preset. No inline styles applied by JS. */
#pl-root .pl-style-badge-theme{
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 16px;
  font-size:13px; font-weight:700; letter-spacing:.01em;
  background:var(--pl-primary, #111827);
  color:var(--pl-primary-foreground, var(--pl-chip-active-text, #fff));
  border:1px solid color-mix(in oklab, var(--pl-primary, #111827) 70%, transparent);
  border-radius:999px;
  box-shadow:0 4px 10px -6px color-mix(in oklab, var(--pl-primary, #000) 55%, transparent), inset 0 1px 0 rgba(255,255,255,.10);
  line-height:1; white-space:nowrap;
}
#pl-root .pl-style-badge-outline{
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 16px;
  font-size:13px; font-weight:700; letter-spacing:.01em;
  background:transparent;
  color:var(--pl-primary, var(--pl-text));
  border:1.5px solid color-mix(in oklab, var(--pl-primary, var(--pl-text)) 55%, transparent);
  border-radius:999px;
  line-height:1; white-space:nowrap;
}
#pl-root .pl-type-tabs + .pl-tabs-right .pl-style-badge-theme,
#pl-root .pl-type-tabs + .pl-tabs-right .pl-style-badge-outline{
  padding:7px 14px; font-size:12.5px;
}

/* ---------- Grid / List view toggle ---------- */
#pl-root .pl-view-toggle{
  display:inline-flex; gap:4px; align-items:center;
  padding:2px;
  margin:2px 0 var(--pl-toggle-gap, 6px);
  background:var(--pl-chip-bg, rgba(255,255,255,0.06));
  border:1px solid color-mix(in oklab,var(--pl-border) 75%, transparent);
  border-radius:999px;
  width:fit-content; max-width:100%;
}
#pl-root .pl-view-mode-btn{
  border:0; background:transparent;
  padding:4px 10px;
  font-size:11px; font-weight:600;
  color:var(--pl-text); opacity:.72;
  border-radius:999px;
  cursor:pointer;
  display:inline-flex; align-items:center; gap:6px;
  transition:background .15s ease, color .15s ease, opacity .15s ease;
}
#pl-root .pl-view-mode-btn:hover{ opacity:1; background:color-mix(in oklab,var(--pl-primary) 8%, transparent); }
#pl-root .pl-view-mode-btn.active{
  background:var(--pl-chip-active-bg, var(--pl-primary));
  color:var(--pl-chip-active-text, #fff);
  opacity:1;
}
#pl-root .pl-view-mode-ico{ font-size:13px; line-height:1; }
#pl-root .pl-type-tabs .pl-view-toggle{
  padding:2px;
  min-height:30px;
  background:color-mix(in oklab,var(--pl-card) 78%, transparent);
}
#pl-root .pl-type-tabs .pl-view-mode-btn{
  min-height:26px;
  padding:4px 8px;
  white-space:nowrap;
}

/* v4.53 — unify heights: count badge + view toggle match the tabs bar height
   on desktop, tablet, and mobile. Uses a shared --pl-bar-h variable. */
#pl-root{ --pl-bar-h:40px; }
#pl-root .pl-tabs-row{ align-items:stretch; }
#pl-root .pl-tabs-row .pl-type-tabs{ min-height:var(--pl-bar-h) !important; height:var(--pl-bar-h); box-sizing:border-box; align-items:center; }
#pl-root .pl-tabs-row .pl-tabs-right{ align-items:stretch; align-self:stretch; height:var(--pl-bar-h); }
#pl-root .pl-tabs-row .pl-tabs-right .pl-view-toggle,
#pl-root .pl-tabs-row .pl-tabs-right > .pl-total-count,
#pl-root .pl-tabs-row .pl-tabs-right > .pl-tabs-count,
#pl-root .pl-tabs-row .pl-tabs-right > .pl-style-badge-brown,
#pl-root .pl-tabs-row .pl-tabs-right > .pl-style-badge-solid,
#pl-root .pl-tabs-row .pl-tabs-right > .pl-style-badge-theme,
#pl-root .pl-tabs-row .pl-tabs-right > .pl-style-badge-outline{
  height:var(--pl-bar-h) !important;
  min-height:var(--pl-bar-h) !important;
  box-sizing:border-box;
  display:inline-flex; align-items:center; justify-content:center;
  padding-top:0; padding-bottom:0;
  margin-top:0 !important; margin-bottom:0 !important;
}
@media (max-width:640px){
  #pl-root{ --pl-bar-h:36px; }
  #pl-root .pl-tabs-row .pl-tabs-right{ height:auto; align-self:flex-end; }
}

/* v4.56 — search bar matches the tabs-bar height on all breakpoints. */
#pl-root .pl-search{
  height:var(--pl-bar-h) !important;
  min-height:var(--pl-bar-h) !important;
  box-sizing:border-box;
  display:flex; align-items:center;
  padding-top:0 !important; padding-bottom:0 !important;
}
#pl-root .pl-search input{
  height:100%;
  line-height:1;
  padding-top:0; padding-bottom:0;
  min-height:0;
  display:block;
  background:transparent;
}
#pl-root .pl-search-icon{ top:50%; transform:translateY(-50%); line-height:1; }

/* ---------- List mode grid ---------- */
#pl-root .pl-cards.pl-list-mode{
  grid-template-columns:repeat(var(--pl-list-cols,4), minmax(0,1fr));
  gap:var(--pl-list-gap, 10px);
}
#pl-root .pl-list-mode .pl-card{
  padding:14px 20px;
  min-height:0;
  min-width:0;              /* allow title truncation inside grid cell */
  border-radius:var(--pl-list-pill-radius, 999px);
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  background:var(--pl-card-bg,#fff);
  box-shadow:0 1px 2px rgba(15,23,42,.04), 0 4px 14px -10px rgba(15,23,42,.18);
}
#pl-root .pl-list-mode .pl-card::before{ display:none; }
#pl-root .pl-list-mode .pl-card:hover{ transform:none; box-shadow:0 2px 4px rgba(15,23,42,.06), 0 10px 22px -12px rgba(15,23,42,.25); }
/* Hide non-list elements */
#pl-root .pl-list-mode .pl-card .pl-media,
#pl-root .pl-list-mode .pl-card .pl-card-body,
#pl-root .pl-list-mode .pl-card .pl-card-foot .pl-author,
#pl-root .pl-list-mode .pl-card .pl-card-head-actions{ display:none !important; }
#pl-root .pl-list-mode .pl-card .pl-card-head{
  flex:1 1 auto; min-width:0; padding:0; margin:0; width:100%;
  display:block;
}
#pl-root .pl-list-mode .pl-card-title{
  font-family:inherit;
  font-size:14px; font-weight:500; letter-spacing:.005em;
  color:var(--pl-text,#0f172a);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  display:block; width:100%; max-width:100%;
  margin:0; padding:0;
  line-height:1.35;
}
/* Title alignment inside the list pill (also on card-head so single-child rows align correctly) */
#pl-root .pl-list-mode.pl-list-align-left   .pl-card-head,
#pl-root .pl-list-mode.pl-list-align-left   .pl-card-title{ text-align:left !important; }
#pl-root .pl-list-mode.pl-list-align-center .pl-card-head,
#pl-root .pl-list-mode.pl-list-align-center .pl-card-title{ text-align:center !important; }
#pl-root .pl-list-mode.pl-list-align-right  .pl-card-head,
#pl-root .pl-list-mode.pl-list-align-right  .pl-card-title{ text-align:right !important; }
#pl-root .pl-list-mode .pl-card-meta{
  display:none;
  flex:0 0 auto;
  gap:4px;
  max-width:35%;
  overflow:hidden;
}
#pl-root .pl-list-mode.pl-list-show-cat .pl-card-meta,
#pl-root .pl-list-mode.pl-list-show-tag .pl-card-meta,
#pl-root .pl-list-mode.pl-list-show-model .pl-card-meta{ display:flex; }
#pl-root .pl-list-mode:not(.pl-list-show-cat)   .pl-card-meta .pl-tag.cat,
#pl-root .pl-list-mode:not(.pl-list-show-model) .pl-card-meta .pl-tag.model,
#pl-root .pl-list-mode:not(.pl-list-show-tag)   .pl-card-meta .pl-tag:not(.cat):not(.model){ display:none; }
#pl-root .pl-list-mode .pl-card-foot{
  border:0; padding:0; margin:0;
  flex:0 0 auto;
}
#pl-root .pl-list-mode .pl-card-btns{ gap:6px; display:flex; align-items:center; }
#pl-root .pl-list-mode .pl-card-btns .pl-copy,
#pl-root .pl-list-mode .pl-card-btns .pl-edit{
  padding:5px 12px; font-size:11px; font-weight:600;
  letter-spacing:.06em; text-transform:uppercase;
  border-radius:999px; line-height:1;
}
/* Per-element list toggles (Edit / Copy). Hidden by default, revealed by opt-in class. */
#pl-root .pl-list-mode:not(.pl-list-show-edit) .pl-card-btns .pl-edit{ display:none !important; }
#pl-root .pl-list-mode:not(.pl-list-show-copy) .pl-card-btns .pl-copy{ display:none !important; }
/* Collapse the button wrapper entirely when nothing is visible so the title uses full width. */
#pl-root .pl-list-mode:not(.pl-list-show-edit):not(.pl-list-show-copy) .pl-card-foot{ display:none; }
/* Responsive list */
@media (max-width: 1024px){
  #pl-root .pl-cards.pl-list-mode{ grid-template-columns:repeat(min(var(--pl-list-cols,4), 3), minmax(0,1fr)); }
}
@media (max-width: 768px){
  #pl-root .pl-cards.pl-list-mode{ grid-template-columns:repeat(min(var(--pl-list-cols,4), 2), minmax(0,1fr)); gap:8px; }
  #pl-root .pl-list-mode .pl-card{ padding:12px 16px; gap:8px; }
  #pl-root .pl-list-mode .pl-card-title{ font-size:13px; }
  #pl-root .pl-list-mode .pl-card-btns .pl-copy,
  #pl-root .pl-list-mode .pl-card-btns .pl-edit{ padding:4px 10px; font-size:10px; }
  #pl-root .pl-view-toggle{ margin:4px 0 8px; }
  #pl-root .pl-type-tabs-with-toggle{display:flex;gap:5px;align-items:center;justify-content:flex-start;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;flex-wrap:nowrap}
  #pl-root .pl-type-tabs-with-toggle::-webkit-scrollbar{display:none}
  #pl-root .pl-type-tabs-with-toggle .pl-type-tab{flex:0 0 auto;min-width:auto;padding:8px 10px;white-space:nowrap}
  #pl-root .pl-type-tabs-with-toggle .pl-view-toggle{margin:0 !important;flex:0 0 auto}
  #pl-root .pl-type-tabs-with-toggle .pl-view-mode-btn{padding:5px 8px;font-size:10.5px}
}
@media (max-width: 520px){
  #pl-root .pl-cards.pl-list-mode{ grid-template-columns:1fr; }
  #pl-root .pl-list-mode .pl-card{ padding:12px 18px; }
  #pl-root .pl-style-badge-brown{ padding:7px 12px; font-size:12px; }
}

/* v4.57.1 — Mobile fix: vertically center search input placeholder & text */
@media (max-width:640px){
  #pl-root .pl-search{ align-items:center !important; }
  #pl-root .pl-search input{
    height:100% !important;
    line-height:var(--pl-bar-h,36px) !important;
    padding-top:0 !important;
    padding-bottom:0 !important;
    margin:0 !important;
    display:block;
    vertical-align:middle;
  }
  #pl-root .pl-search input::placeholder{
    line-height:var(--pl-bar-h,36px);
    vertical-align:middle;
  }
}

/* v4.57.2 — Mobile view-modal polish:
   1) Long prompt text scrolls inside its own box (like desktop) instead of scrolling the whole modal.
   2) A little more breathing room below the action buttons / bottom of the modal. */
@media (max-width:640px){
  #pl-root #pl-modal-view .pl-modal-card{
    padding-bottom:calc(28px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #pl-root .pl-view-content{
    max-height:55vh !important;
    overflow:auto !important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
  }
  #pl-root .pl-view-actions{
    margin-top:14px;
    padding-top:12px;
    padding-bottom:calc(8px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width:360px){
  #pl-root #pl-modal-view .pl-modal-card{
    padding-bottom:calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #pl-root .pl-view-content{ max-height:50vh !important; }
}

/* v4.57.3 — Smooth in-modal prompt scrolling on mobile.
   Isolates the prompt-text scroll so the modal background/layout stays put. */
@media (max-width:640px){
  #pl-root .pl-view-content{
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
    scroll-behavior:smooth;
    touch-action:pan-y;
    will-change:scroll-position;
  }
}

/* v4.57.4 — Themed, more-visible scrollbar for the prompt content area on mobile. */
@media (max-width:640px){
  #pl-root .pl-view-content{
    scrollbar-width:thin;
    scrollbar-color: color-mix(in oklab, var(--pl-primary) 55%, transparent) transparent;
  }
  #pl-root .pl-view-content::-webkit-scrollbar{
    width:8px;
    height:8px;
  }
  #pl-root .pl-view-content::-webkit-scrollbar-track{
    background: color-mix(in oklab, var(--pl-border) 45%, transparent);
    border-radius:8px;
    margin:4px 0;
  }
  #pl-root .pl-view-content::-webkit-scrollbar-thumb{
    background: color-mix(in oklab, var(--pl-primary) 60%, var(--pl-border));
    border-radius:8px;
    border:1px solid color-mix(in oklab, var(--pl-primary) 25%, transparent);
  }
  #pl-root .pl-view-content::-webkit-scrollbar-thumb:hover,
  #pl-root .pl-view-content::-webkit-scrollbar-thumb:active{
    background: var(--pl-primary);
  }
}

/* v4.57.5 — Mobile scroll reliability fix.
   Uses the same high-specificity selector as older mobile safety rules, so the
   prompt text box scrolls on phones while the view modal layout stays fixed. */
@media (max-width:640px){
  #pl-root #pl-modal-view .pl-modal-card{
    overflow:hidden !important;
  }
  #pl-root #pl-modal-view #pl-view-body{
    flex:1 1 auto;
    min-height:0 !important;
    overflow:hidden !important;
    display:flex;
    flex-direction:column;
  }
  #pl-root #pl-modal-view .pl-view-head,
  #pl-root #pl-modal-view .pl-view-meta,
  #pl-root #pl-modal-view .pl-view-actions{
    flex:0 0 auto;
  }
  #pl-root #pl-modal-view .pl-view-content{
    flex:1 1 auto;
    min-height:160px;
    max-height:55dvh !important;
    overflow-y:scroll !important;
    overflow-x:hidden !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior:contain !important;
    touch-action:pan-y !important;
    scrollbar-width:thin;
    scrollbar-color: color-mix(in oklab, var(--pl-primary) 55%, transparent) transparent;
  }
}
@media (max-width:360px){
  #pl-root #pl-modal-view .pl-view-content{
    max-height:48dvh !important;
    min-height:130px;
  }
}

/* v4.57 — extra inner breathing gap between the active pill and the
   container border on the type tabs AND the grid/list view toggle.
   The active pill shrinks slightly inside the bar so the container
   rounded border is visible around it. Applied on desktop and mobile. */
#pl-root .pl-type-tabs,
#pl-root .pl-view-toggle{
  padding:5px !important;
  box-sizing:border-box;
}
#pl-root .pl-type-tab,
#pl-root .pl-view-mode-btn{
  box-sizing:border-box;
  line-height:1;
}
#pl-root .pl-type-tab.active,
#pl-root .pl-view-mode-btn.active{
  height:calc(var(--pl-bar-h,40px) - 12px) !important;
  min-height:calc(var(--pl-bar-h,40px) - 12px) !important;
  max-height:calc(var(--pl-bar-h,40px) - 12px) !important;
  align-self:center;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding-top:0 !important;
  padding-bottom:0 !important;
  border-radius:calc(var(--pl-btn-radius,10px) - 2px);
}
@media (max-width:640px){
  #pl-root .pl-type-tabs,
  #pl-root .pl-view-toggle{
    padding:4px !important;
  }
  #pl-root .pl-type-tab.active,
  #pl-root .pl-view-mode-btn.active{
    height:calc(var(--pl-bar-h,36px) - 10px) !important;
    min-height:calc(var(--pl-bar-h,36px) - 10px) !important;
    max-height:calc(var(--pl-bar-h,36px) - 10px) !important;
    font-size:12px;
  }
  #pl-root .pl-type-tab,
  #pl-root .pl-view-mode-btn{
    font-size:12px;
  }
}

/* Searchable multi-select combobox (chips) for Category / Model / Tags. */
.pl-combo { position: relative; display: block; }
.pl-combo-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 8px;
  background: #fff; border: 1px solid #d6d6d6; border-radius: 6px;
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.pl-combo-box:focus-within {
  border-color: #4a90e2; box-shadow: 0 0 0 3px rgba(74,144,226,.15); outline: none;
}
.pl-combo-chips { display: contents; }
.pl-combo-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eef3fb; color: #223; border: 1px solid #d3ddea;
  border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; line-height: 1.4;
  max-width: 100%;
}
.pl-combo-chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-combo-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border: 0; background: transparent;
  border-radius: 50%; cursor: pointer; color: #667; font-size: 16px; line-height: 1; padding: 0;
}
.pl-combo-x:hover { background: #d3ddea; color: #223; }
.pl-combo-search {
  flex: 1 1 120px; min-width: 80px;
  border: 0 !important; outline: 0 !important; background: transparent !important;
  padding: 4px 2px !important; font: inherit; box-shadow: none !important;
}
.pl-combo-list {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px;
  z-index: 40; max-height: 260px; overflow-y: auto;
  background: #fff; border: 1px solid #d6d6d6;
  border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.pl-combo-opt {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; cursor: pointer;
  font: inherit; color: inherit;
}
.pl-combo-opt:hover, .pl-combo-opt.active { background: #eef3fb; }
.pl-combo-add { color: #1a56b8; font-weight: 500; }
.pl-combo-empty { padding: 8px 10px; color: #666; font-size: .9em; }
