:root {
  color-scheme: dark light;
  /* Pensiya35 design system tokens */
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-light: #c7d2fe;
  --accent-ink: #4f46e5;
  --text-primary: #e0e0f0;
  --text-secondary: #8888a0;
  --text-muted: #6a6a90;
  --text-on-card: #1a1a2e;
  --text-on-card-sub: #4a4a6a;
  --card-bg: #fff;
  --card-shadow: 0 8px 32px rgba(0,0,0,.12);
  --card-radius: 18px;
  --card-dark-bg: rgba(99,102,241,.08);
  --card-dark-border: rgba(99,102,241,.15);
  --card-dark-bg-hover: rgba(99,102,241,.16);
  --html-bg: #0f0f1a;
  --bg-gradient: linear-gradient(165deg,#0f0f1a 0%,#1a1a2e 40%,#16213e 100%);
  --topbar-bg: rgba(15,15,26,.85);
  --topbar-border: rgba(99,102,241,.12);
  --surface-overlay: rgba(15,15,26,.7);
  --surface-strong: rgba(15,15,26,.95);
  --input-bg: rgba(255,255,255,.04);
  --input-border: rgba(255,255,255,.08);
  --title-gradient: linear-gradient(135deg,#c7d2fe 0%,#818cf8 50%,#6366f1 100%);
}
[data-theme="light"] {
  color-scheme: light;
  --accent-primary: #4f46e5;
  --accent-secondary: #4f46e5;
  --accent-light: #4338ca;
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a72;
  --text-muted: #8a8aa0;
  --card-bg: #fff;
  --card-shadow: 0 6px 22px rgba(31,35,80,.08);
  --card-dark-bg: rgba(99,102,241,.06);
  --card-dark-border: rgba(99,102,241,.22);
  --card-dark-bg-hover: rgba(99,102,241,.12);
  --html-bg: #f5f7fb;
  --bg-gradient: linear-gradient(165deg,#f5f7fb 0%,#eef0f8 40%,#e8edf6 100%);
  --topbar-bg: rgba(245,247,251,.85);
  --topbar-border: rgba(99,102,241,.22);
  --surface-overlay: rgba(31,35,80,.35);
  --surface-strong: rgba(255,255,255,.96);
  --input-bg: rgba(31,35,80,.04);
  --input-border: rgba(99,102,241,.22);
  --title-gradient: linear-gradient(135deg,#4f46e5 0%,#4338ca 50%,#312e81 100%);
}

/* === Pensiya35 typography === */
.micro-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent-secondary);
  text-transform: uppercase;
  margin-bottom: 18px;
  display: block;
}
.gradient-title {
  font-weight: 800;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,15,26,0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-dark-border);
}
[data-theme="light"] .topbar { background: rgba(250,250,254,0.7); }
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  font-weight: 700; font-size: 16px; color: var(--text-primary);
  text-decoration: none; letter-spacing: -0.02em;
}
.theme-toggle {
  width: 36px; height: 36px; border: 1px solid var(--card-dark-border);
  background: var(--card-dark-bg); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-primary);
}
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }
.container {
  max-width: 1100px; margin: 0 auto; padding: 32px 20px 60px;
}
h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -0.03em; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lead {
  font-size: 16px; color: var(--text-secondary);
  line-height: 1.55; margin-bottom: 28px;
  max-width: 720px;
}
.toolbar {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 28px;
}
.search {
  width: 100%; padding: 14px 18px;
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 12px;
  color: var(--text-primary); font-family: inherit; font-size: 15px;
  outline: none; transition: border-color 0.15s;
}
.search:focus { border-color: var(--accent-primary); }
.cats {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.cat-chip {
  padding: 8px 14px;
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s; font-family: inherit;
}
.cat-chip:hover { color: var(--text-primary); border-color: var(--accent-primary); }
.cat-chip.active {
  background: var(--accent-secondary); color: #fff; border-color: var(--accent-secondary);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; flex-direction: column;
  min-height: 140px;
}
.card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.12);
}
.card-cat {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent-primary);
  margin-bottom: 8px;
  display: inline-flex; align-items: center; gap: 6px;
}
.card-title {
  font-size: 16px; font-weight: 700; line-height: 1.3;
  margin-bottom: 8px; color: var(--text-primary);
}
.card-when {
  font-size: 13px; color: var(--text-muted); line-height: 1.45;
  margin-top: auto;
}
.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s;
}
.modal {
  background: var(--html-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 18px;
  max-width: 760px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  padding: 28px;
  position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--card-dark-bg); border: 1px solid var(--card-dark-border);
  color: var(--text-primary); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.modal-cat {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent-primary);
  margin-bottom: 10px;
}
.modal-title {
  font-size: 22px; font-weight: 800; line-height: 1.25;
  margin-bottom: 14px; color: var(--text-primary);
}
.modal-when {
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 18px; padding: 12px 16px;
  background: rgba(99,102,241,0.08);
  border-left: 3px solid var(--accent-primary);
  border-radius: 6px;
}
.modal-best {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 16px;
}
.modal-best span {
  display: inline-block; padding: 3px 8px;
  background: var(--card-dark-bg); border-radius: 4px;
  margin-right: 6px; color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}
.prompt-body {
  background: rgba(15,15,26,0.5);
  border: 1px solid var(--card-dark-border);
  border-radius: 10px;
  padding: 18px;
  font-family: 'JetBrains Mono', monospace, system-ui;
  font-size: 13px; line-height: 1.6;
  white-space: pre-wrap; word-wrap: break-word;
  color: var(--text-secondary);
  max-height: 50vh; overflow-y: auto;
  margin-bottom: 16px;
}
[data-theme="light"] .prompt-body { background: rgba(245,245,250,0.8); color: #2a2a4e; }
.btn-copy {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
  color: #fff; font-weight: 600; font-size: 15px;
  border: none; border-radius: 10px;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-copy:hover { transform: translateY(-1px); }
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: #10b981; color: #fff;
  border-radius: 10px; font-weight: 600; font-size: 14px;
  z-index: 200;
  animation: slideUp 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (max-width: 600px) {
  .container { padding: 20px 16px 40px; }
  .modal { padding: 22px 20px; max-height: 85vh; }
  .modal-title { font-size: 19px; }
  .prompt-body { font-size: 12px; padding: 14px; }
}

/* hidden attribute must override CSS display */
[hidden] { display: none !important; }

/* === New UI elements === */

/* Favorite button on cards */
.fav-btn {
  position: absolute;
  top: 12px; right: 12px;
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--card-dark-border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.fav-btn:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.fav-btn.active {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fbbf24;
}
.card { position: relative; }
.card-used {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}

/* Favorites chip */
.cat-chip.cat-fav { margin-left: auto; }
.cat-chip.cat-fav.active {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}

/* Export row */
.export-row { display: flex; justify-content: flex-end; }
.btn-export {
  font-size: 12px;
  padding: 8px 14px;
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.btn-export:hover { color: var(--text-primary); border-color: var(--accent-primary); }

/* Modal favorite */
.modal-title { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.modal-fav { position: static; flex-shrink: 0; }

/* Placeholder highlighting in prompt body */
.placeholder {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}
[data-theme="light"] .placeholder {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

/* Cross-promo to assistants gallery */
.cross-promo {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.cross-promo a {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: underline dotted;
}
.cross-promo a:hover { text-decoration: underline; }

/* Modal meta footer with share */
.modal-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.share-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--card-dark-border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.share-btn:hover { color: var(--text-primary); border-color: var(--accent-primary); }

/* === v0.3 additions === */

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--card-dark-border);
  padding-bottom: 2px;
}
.tab {
  padding: 10px 18px;
  background: transparent; border: none;
  color: var(--text-secondary); cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}
.tab-count {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--card-dark-bg);
  border-radius: 999px;
  color: var(--text-muted);
}
.tab.active .tab-count {
  background: rgba(99,102,241,0.15);
  color: var(--accent-primary);
}

/* Search row with icon button + sort */
.search-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.search-row .search { flex: 1; margin: 0; }
.btn-icon {
  width: 48px; flex-shrink: 0;
  background: var(--card-dark-bg); border: 1px solid var(--card-dark-border);
  border-radius: 12px; cursor: pointer;
  font-size: 20px; color: var(--text-primary);
  transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--accent-primary); transform: scale(1.05); }
.sort-sel {
  background: var(--card-dark-bg); border: 1px solid var(--card-dark-border);
  border-radius: 12px; color: var(--text-secondary);
  padding: 0 14px; font-family: inherit; font-size: 13px;
  cursor: pointer; outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

/* New chip + NEW badge */
.cat-chip.cat-new.active {
  background: rgba(34,211,238,0.15);
  color: #22d3ee;
  border-color: rgba(34,211,238,0.4);
}
.new-badge {
  margin-left: 6px;
  display: inline-block;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg,#22d3ee,#06b6d4);
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

/* Tags */
.tags-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px; min-height: 8px;
}
.tag-chip {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--card-dark-border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer; font-size: 11px; font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
}
.tag-chip:hover { color: var(--text-secondary); border-color: var(--accent-primary); }
.tag-chip.active {
  background: rgba(99,102,241,0.2);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.card-tag {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: rgba(99,102,241,0.08);
  border-radius: 4px;
}
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.modal-tag {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 10px;
  background: rgba(99,102,241,0.1);
  border-radius: 6px;
  border: 1px solid rgba(99,102,241,0.2);
}

/* Highlighted search results */
mark {
  background: rgba(251,191,36,0.35);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* Modal title row with star */
.modal-title-row {
  display: flex; align-items: flex-start;
  gap: 12px; justify-content: space-between;
  margin-bottom: 10px;
}
.modal-title {
  font-size: 22px; font-weight: 800;
  line-height: 1.25; color: var(--text-primary);
  margin-bottom: 0; flex: 1;
}
.modal-fav { position: static; flex-shrink: 0; }

/* Sectioned prompt body */
.prompt-body.sectioned {
  background: transparent;
  border: none;
  padding: 0;
  max-height: none;
  display: flex; flex-direction: column; gap: 14px;
}
.sec-intro {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  padding: 14px 16px;
  background: rgba(99,102,241,0.06);
  border-left: 3px solid var(--accent-primary);
  border-radius: 6px;
}
.sec-block {
  background: rgba(15,15,26,0.4);
  border: 1px solid var(--card-dark-border);
  border-radius: 10px;
  padding: 14px 18px;
}
[data-theme="light"] .sec-block { background: rgba(245,245,250,0.7); }
[data-theme="light"] .sec-intro { background: rgba(99,102,241,0.06); }
.sec-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 10px;
}
.sec-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre-wrap; word-wrap: break-word;
}

/* Related prompts */
.related-block { margin-top: 18px; }
.related-title {
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-primary); margin-bottom: 10px;
}
.related-list { display: flex; flex-direction: column; gap: 6px; }
.related-item {
  padding: 10px 14px;
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.related-item:hover {
  border-color: var(--accent-primary);
  transform: translateX(2px);
}
.related-item-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 2px;
}
.related-item-when {
  font-size: 11px; color: var(--text-muted);
}

/* Workflows view */
.workflows-list {
  display: flex; flex-direction: column; gap: 18px;
}
.wf-card {
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 16px;
  padding: 24px 26px;
}
.wf-icon { font-size: 32px; margin-bottom: 10px; }
.wf-title {
  font-size: 20px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 8px;
}
.wf-desc {
  font-size: 14px; color: var(--text-secondary);
  line-height: 1.55; margin-bottom: 18px;
}
.wf-steps {
  display: flex; flex-direction: column; gap: 8px;
}
.wf-step {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(15,15,26,0.5);
  border: 1px solid var(--card-dark-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
[data-theme="light"] .wf-step { background: rgba(245,245,250,0.7); }
.wf-step:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px);
}
.wf-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.wf-step-label {
  font-size: 14px; color: var(--text-primary);
  font-weight: 500;
}

/* === v0.4 Model compatibility === */
.compat-block {
  margin-bottom: 18px;
  background: rgba(15,15,26,0.35);
  border: 1px solid var(--card-dark-border);
  border-radius: 10px;
  padding: 14px 16px;
}
[data-theme="light"] .compat-block { background: rgba(245,245,250,0.7); }
.compat-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-primary); margin-bottom: 10px;
}
.compat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.compat-item {
  padding: 8px 12px;
  background: var(--card-dark-bg);
  border-radius: 6px;
  border-left: 3px solid var(--card-dark-border);
}
.compat-item.lvl-full { border-left-color: #22c55e; }
.compat-item.lvl-partial { border-left-color: #fbbf24; }
.compat-item.lvl-limited { border-left-color: #ef4444; }
.compat-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
}
.compat-note {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px; line-height: 1.4;
}


/* === Pensiya35 unified overrides === */
.card {
  border-radius: var(--card-radius) !important;
}
.btn-copy {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%) !important;
  border: none !important;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35) !important;
}
.btn-copy:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45) !important;
}

/* Skeleton */
.skeleton-wrap { padding: 40px 0; }
.skeleton-title, .skeleton-sub, .skeleton-filters, .skeleton-card { background: linear-gradient(90deg, var(--panel-bg) 0%, rgba(255,255,255,0.05) 50%, var(--panel-bg) 100%); background-size: 200% 100%; animation: skel 1.5s ease-in-out infinite; border-radius: 12px; }
.skeleton-title { height: 40px; width: 60%; margin-bottom: 12px; }
.skeleton-sub { height: 20px; width: 80%; margin-bottom: 24px; }
.skeleton-filters { height: 48px; width: 100%; margin-bottom: 32px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.skeleton-card { height: 180px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
