/* PROMPTORA AI — application layout & tool UI */
.app {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  background: rgba(8, 8, 14, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 40;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 22px;
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: 0.04em;
}
.brand img {
  width: 32px;
  height: 32px;
}
.brand span b {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav-group {
  margin-bottom: 18px;
}
.nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 700;
  padding: 0 12px 8px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 11px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.92rem;
  position: relative;
  transition: background 0.2s, color 0.2s;
}
.nav a svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
  flex-shrink: 0;
}
.nav a:hover {
  background: rgba(var(--fg-rgb), 0.05);
  color: var(--heading);
}
.nav a.active {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.06));
  color: var(--heading);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.28);
}
.nav a.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--grad);
}
.nav a .lock {
  margin-left: auto;
  opacity: 0.6;
}
.nav a .lock svg {
  width: 13px;
  height: 13px;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
}
.plan-card {
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.18), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.meter {
  height: 6px;
  border-radius: 6px;
  background: rgba(var(--fg-rgb), 0.08);
  overflow: hidden;
  margin: 6px 0 10px;
}
.meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.6s var(--ease);
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 5, 10, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.topbar h1 {
  font-size: 1.12rem;
  margin: 0;
}
.menu-btn {
  display: none;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(var(--fg-rgb), 0.2);
  cursor: pointer;
  flex-shrink: 0;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 230px;
  padding: 8px;
  background: rgba(16, 16, 26, 0.97);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: pop 0.2s var(--ease);
  z-index: 50;
}
.dropdown-menu a,
.dropdown-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text-2);
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: rgba(var(--fg-rgb), 0.06);
  color: var(--heading);
}
.dropdown-menu svg {
  width: 16px;
  height: 16px;
}
.content {
  padding: 28px 32px 60px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  animation: view-in 0.45s var(--ease);
}
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.page-head {
  margin-bottom: 24px;
}
.page-head h2 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  margin-bottom: 6px;
}
.page-head p {
  color: var(--muted);
  margin: 0;
  max-width: 720px;
}
.mobile-scrim {
  display: none;
}

/* ---------- dashboard ---------- */
.welcome {
  padding: 30px;
  overflow: hidden;
  background: radial-gradient(600px 240px at 90% 0%, rgba(99, 102, 241, 0.35), transparent 70%),
    radial-gradient(500px 240px at 0% 100%, rgba(168, 85, 247, 0.25), transparent 70%), linear-gradient(180deg, rgba(var(--fg-rgb), 0.05), rgba(var(--fg-rgb), 0.015));
}
.welcome h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}
.quick {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  cursor: pointer;
  color: inherit;
}
.quick .qi {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.8);
}
.quick .qi svg {
  width: 22px;
  height: 22px;
}
.quick h4 {
  margin: 0;
  font-size: 1rem;
}
.quick p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.quick.locked .qi {
  background: rgba(var(--fg-rgb), 0.08);
  box-shadow: none;
}
.stat .v {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.1;
}
.stat .l {
  color: var(--muted);
  font-size: 0.82rem;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding-top: 8px;
}
.bars .b {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.bars .b i {
  width: 100%;
  max-width: 34px;
  border-radius: 8px 8px 4px 4px;
  background: var(--grad);
  min-height: 3px;
  opacity: 0.9;
  transition: height 0.6s var(--ease);
}
.bars .b span {
  font-size: 0.68rem;
  color: var(--muted);
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.list-item:hover {
  background: rgba(var(--fg-rgb), 0.04);
}
.thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent-text);
}
.thumb svg {
  width: 20px;
  height: 20px;
}
.list-item .t {
  font-weight: 600;
  color: var(--heading);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .s {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- tool layout ---------- */
.tool {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.tool.wide-input {
  grid-template-columns: minmax(340px, 480px) minmax(0, 1fr);
}
/* Grid children must be allowed to shrink, or wide content (format tabs) stretches the page on phones. */
.tool > *,
.lib > *,
.grid > * {
  min-width: 0;
}
.tool .panel {
  position: sticky;
  top: 86px;
}
.dropzone {
  position: relative;
  border: 1.5px dashed rgba(139, 92, 246, 0.45);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: radial-gradient(400px 200px at 50% 0%, rgba(139, 92, 246, 0.12), transparent 70%), rgba(0, 0, 0, 0.25);
  transition: border-color 0.25s, background 0.25s, transform 0.25s var(--ease);
}
.dropzone:hover,
.dropzone.drag {
  border-color: #a78bfa;
  background: radial-gradient(400px 200px at 50% 0%, rgba(139, 92, 246, 0.22), transparent 70%), rgba(0, 0, 0, 0.3);
}
.dropzone.drag {
  transform: scale(1.01);
}
.dropzone .di {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 30px -8px rgba(99, 102, 241, 0.8);
}
.dropzone .di svg {
  width: 24px;
  height: 24px;
}
.dropzone b {
  color: var(--heading);
}
.preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-2);
  background: repeating-conic-gradient(#14141e 0% 25%, #0e0e16 0% 50%) 50% / 20px 20px;
}
.preview img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}
.preview .meta {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 6px;
}
.preview .rm {
  position: absolute;
  top: 10px;
  right: 10px;
}
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 16px 0;
}
.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- results ---------- */
.result-empty {
  min-height: 420px;
  display: grid;
  place-items: center;
}
.result-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.result-head h3 {
  margin: 0;
  font-size: 1.25rem;
}
.prompt-box {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 18px 18px 16px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.prompt-box.neg {
  border-color: rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.04);
  color: var(--err-text);
  font-size: 0.88rem;
}
.prompt-box.mono {
  font-family: var(--mono);
  font-size: 0.84rem;
}
.box-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.box-label .spacer {
  flex: 1;
}
.ftabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  scrollbar-width: none;
}
.ftabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 13px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.ftabs button:hover {
  color: var(--heading);
}
.ftabs button.active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 20px -8px rgba(99, 102, 241, 0.9);
}
.params {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(var(--fg-rgb), 0.025);
  border: 1px solid var(--border);
}
.note {
  font-size: 0.84rem;
  color: var(--warn-text);
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.25);
  margin-top: 10px;
}
.analysis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.analysis .a {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(var(--fg-rgb), 0.025);
  border: 1px solid var(--border);
}
.analysis .a b {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 4px;
}
.analysis .a span {
  font-size: 0.87rem;
  color: var(--text-2);
}
.palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  background: rgba(var(--fg-rgb), 0.04);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  cursor: pointer;
}
.swatch i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(var(--fg-rgb), 0.2);
}
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.compare .prompt-box.orig {
  color: var(--muted);
}
.improve li {
  margin-bottom: 6px;
  color: var(--text-2);
}
.improve li::marker {
  color: var(--accent-text);
}
.lock-card {
  text-align: center;
  padding: 50px 24px;
}
.lock-card .ico {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--warn-text);
}
.lock-card .ico svg {
  width: 28px;
  height: 28px;
}
details.adv summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.adv summary::-webkit-details-marker {
  display: none;
}
details.adv summary svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}
details.adv[open] summary svg {
  transform: rotate(90deg);
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.cat {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(var(--fg-rgb), 0.025);
  cursor: pointer;
  text-align: left;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
  position: relative;
}
.cat .e {
  font-size: 1.3rem;
  line-height: 1;
}
.cat:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}
.cat.active {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.12);
  color: var(--heading);
}
.cat.locked {
  opacity: 0.55;
}
.cat .lk {
  position: absolute;
  top: 8px;
  right: 8px;
}
.cat .lk svg {
  width: 12px;
  height: 12px;
}

/* ---------- library ---------- */
.lib {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.coll a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 0.9rem;
  cursor: pointer;
}
.coll a:hover {
  background: rgba(var(--fg-rgb), 0.04);
  color: var(--heading);
}
.coll a.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--heading);
}
.coll a svg {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}
.coll a .n {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
}
.pcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.pcard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}
.pcard .top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.pcard h4 {
  margin: 0;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcard .txt {
  font-size: 0.85rem;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.55;
}
.pcard .acts {
  display: flex;
  gap: 4px;
  margin-top: auto;
}
.star.on {
  color: #fbbf24;
}
.star.on svg {
  fill: #fbbf24;
}

/* ---------- pricing ---------- */
.price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}
.price {
  display: flex;
  flex-direction: column;
  padding: 28px;
}
.price.featured {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: var(--glow);
  background: radial-gradient(400px 200px at 50% 0%, rgba(139, 92, 246, 0.2), transparent 70%), linear-gradient(180deg, rgba(var(--fg-rgb), 0.05), rgba(var(--fg-rgb), 0.02));
}
.price .amt {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1;
}
.price .amt small {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}
.price ul {
  list-style: none;
  padding: 0;
  margin: 18px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.price li {
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-2);
}
.price li svg {
  width: 17px;
  height: 17px;
  color: var(--accent-text);
  flex-shrink: 0;
  margin-top: 3px;
}
.price li.off {
  opacity: 0.45;
}
.price li.off svg {
  color: var(--muted);
}
.price .btn {
  margin-top: auto;
}
.ribbon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 6px 20px -6px rgba(99, 102, 241, 0.9);
}

/* ---------- auth ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth-side {
  position: relative;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: radial-gradient(700px 400px at 20% 20%, rgba(139, 92, 246, 0.3), transparent 60%), radial-gradient(600px 400px at 80% 90%, rgba(59, 130, 246, 0.25), transparent 60%);
}
.auth-side h2 {
  font-size: clamp(2rem, 3.4vw, 3rem);
  max-width: 520px;
}
.auth-form {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}
.auth-card {
  width: min(420px, 100%);
}
.auth-card h3 {
  font-size: 1.7rem;
  margin-bottom: 6px;
}
.oauth {
  width: 100%;
  background: #fff;
  color: #1f1f2e;
  border-color: #fff;
}
.oauth:hover {
  background: #f1f1f6;
  color: #111;
}
.float-card {
  padding: 16px;
  max-width: 420px;
  animation: float 9s var(--ease) infinite alternate;
}

/* ---------- admin ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tabs button {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs button.active {
  color: var(--heading);
  border-bottom-color: #8b5cf6;
}
.err-row pre {
  white-space: pre-wrap;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 6px 0 0;
  max-height: 160px;
  overflow: auto;
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.on {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .tool,
  .tool.wide-input {
    grid-template-columns: minmax(0, 1fr);
  }
  .tool .panel {
    position: static;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 272px;
    transform: translateX(-100%);
    transition: transform 0.35s var(--ease);
  }
  .app.nav-open .sidebar {
    transform: none;
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.6);
  }
  .app.nav-open .mobile-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.5);
  }
  .menu-btn {
    display: inline-flex;
  }
  .topbar,
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .price-grid {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
  }
  .lib {
    grid-template-columns: 1fr;
  }
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-side {
    display: none;
  }
}
@media (max-width: 640px) {
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .kpis,
  .compare {
    grid-template-columns: 1fr;
  }
  .content {
    padding-top: 20px;
  }
  .card {
    padding: 18px;
  }
  .topbar .hide-sm {
    display: none;
  }
}

/* inline icons inside text blocks */
.params svg,
.note svg,
.form-ok svg,
.form-error svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  display: inline-block;
}
[data-out] {
  scroll-margin-top: 90px;
}

.card-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-text);
}
.kpis .stat svg {
  width: 18px;
  height: 18px;
}

/* ---------- Android app (Capacitor): edge-to-edge safe areas ---------- */
/* Capacitor's SystemBars plugin injects --safe-area-inset-*; env() is the fallback. */
html.native {
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sal: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --sar: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  -webkit-tap-highlight-color: transparent;
}
html.native .topbar {
  padding-top: calc(14px + var(--sat));
  padding-left: calc(18px + var(--sal));
  padding-right: calc(18px + var(--sar));
}
html.native .sidebar {
  padding-top: calc(20px + var(--sat));
  padding-bottom: calc(14px + var(--sab));
}
html.native .content {
  padding-bottom: calc(60px + var(--sab));
}
html.native .toasts {
  bottom: calc(20px + var(--sab));
}
html.native .auth-form {
  padding-top: calc(40px + var(--sat));
  padding-bottom: calc(40px + var(--sab));
}
html.native .modal-back {
  padding-top: calc(20px + var(--sat));
  padding-bottom: calc(20px + var(--sab));
}

/* =====================================================================
   PROMPTORA AI v2 — studio layout, credits, explorer, admin additions
   ===================================================================== */
.skip-link{position:absolute;left:-999px;top:8px;z-index:300;padding:8px 14px;border-radius:10px;background:var(--panel-solid);color:var(--heading)}
.skip-link:focus{left:12px}
.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hp{position:absolute!important;left:-9999px!important;width:1px;height:1px;opacity:0}
.link{color:var(--accent-text);text-decoration:underline;text-underline-offset:3px}
.dim{opacity:.55}

/* studio (two-column workspace, stacks on mobile) */
.studio{display:grid;grid-template-columns:minmax(330px,460px) minmax(0,1fr);gap:22px;align-items:start}
.studio>*{min-width:0}
.studio-left{position:relative}
.step-label{display:flex;align-items:center;gap:8px;font-weight:600;color:var(--heading);font-size:.88rem;margin-bottom:10px}
.step-label span{width:22px;height:22px;border-radius:7px;display:grid;place-items:center;font-size:.72rem;background:var(--grad);color:#fff}
.style-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.style-opt{display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:12px;border:1px solid var(--border);background:var(--panel);cursor:pointer;text-align:left;font-size:.8rem;line-height:1.25;color:var(--text-2);transition:border-color .2s,background .2s,transform .2s var(--ease)}
.style-opt:hover{border-color:var(--border-2);transform:translateY(-1px)}
.style-opt.active{border-color:rgba(139,92,246,.7);background:rgba(139,92,246,.14);color:var(--heading);box-shadow:var(--glow)}
.style-opt .e{font-size:1.05rem;flex-shrink:0}
.seg.wrap{flex-wrap:wrap;height:auto}
.cost-line{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0;font-size:.8rem;color:var(--muted)}
.cost-line b{color:var(--heading)}
.preview-bar{display:flex;align-items:center;gap:8px;margin-top:10px}
.file-name{font-weight:600;color:var(--heading);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.url-box{margin-top:12px}
.result-wait{position:relative;overflow:hidden;min-height:320px}
.progress{width:min(280px,80%);height:6px;border-radius:99px;background:var(--panel-2);overflow:hidden;margin:4px auto}
.progress i{display:block;height:100%;background:var(--grad);transition:width .2s}
.progress.done i{width:100%!important;animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{50%{opacity:.45}}
.err-ico{background:rgba(248,113,113,.12)!important;border-color:rgba(248,113,113,.35)!important;color:var(--err-text)!important}

/* result panel */
.result-actions{display:flex;flex-wrap:wrap;gap:8px;padding:12px;margin:0 0 6px;border:1px solid var(--border);border-radius:14px;background:var(--panel)}
textarea.prompt-box{display:block;width:100%;resize:vertical;min-height:90px;font-family:inherit;outline:none;overflow:auto}
textarea.prompt-box.editing{border-color:rgba(139,92,246,.75);box-shadow:var(--glow);background:var(--panel-solid)}
textarea.prompt-box[readonly]{cursor:text}
.settings-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:8px}
.settings-grid>div{padding:10px 12px;border-radius:12px;border:1px solid var(--border);background:var(--panel)}
.settings-grid span{display:block;font-size:.72rem;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
.settings-grid b{font-size:.88rem;color:var(--heading);font-weight:600}
.desc{margin:0;color:var(--text-2);line-height:1.7}

/* credits */
.credit-pill{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;border-radius:99px;border:1px solid var(--border-2);background:var(--panel);color:var(--heading);font-size:.85rem}
.credit-pill:hover{color:var(--heading);border-color:rgba(139,92,246,.6)}
.credit-big{display:flex;align-items:baseline;gap:4px;margin:8px 0 2px}
.credit-big b{font-family:var(--font-display);font-size:1.5rem;color:var(--heading)}
.credit-hero{display:flex;align-items:baseline;gap:8px;margin:6px 0 10px;flex-wrap:wrap}
.credit-hero b{font-family:var(--font-display);font-size:2.4rem;color:var(--heading);line-height:1}
.credit-chip{display:inline-flex;align-items:center;gap:6px;margin:12px 0 4px;padding:5px 10px;border-radius:99px;background:rgba(139,92,246,.12);border:1px solid rgba(139,92,246,.3);color:var(--accent-text);font-size:.8rem;font-weight:600}

/* banners */
#banners:empty{display:none}
.banner{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:14px clamp(16px,3vw,32px) 0;padding:10px 14px;border-radius:12px;border:1px solid var(--border-2);background:var(--panel);font-size:.88rem;color:var(--text-2)}
.banner>span{flex:1;min-width:200px}
.banner.info{border-color:rgba(56,189,248,.35);background:rgba(56,189,248,.07)}
.banner.warn{border-color:rgba(251,191,36,.4);background:rgba(251,191,36,.08);color:var(--warn-text)}

/* tools grid / explorer / templates */
.search{position:relative;flex:1;min-width:220px;max-width:420px}
.search>span{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--muted);display:flex}
.search>span svg{width:18px;height:18px}
.search .input{padding-left:40px}
.chip{cursor:pointer;font:inherit}
.chip.active,.chips .chip[aria-pressed='true']{border-color:rgba(139,92,246,.65);background:rgba(139,92,246,.16);color:var(--heading)}
.chip.sm{font-size:.7rem;padding:2px 8px}
.tool-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
.tool-card{display:flex;flex-direction:column;gap:6px}
.tool-card h4{margin:12px 0 0}
.tool-card p{flex:1;margin:0 0 10px;color:var(--muted);font-size:.88rem}
.tool-card .btn{align-self:flex-start}
.tool-card .qi,.quick .qi{width:44px;height:44px;border-radius:13px;display:grid;place-items:center;color:#fff;background:var(--grad)}
.tool-card.flagship{border-color:rgba(139,92,246,.45);background:linear-gradient(160deg,rgba(139,92,246,.14),transparent 60%),var(--panel)}
.tool-card.locked{opacity:.8}
.style-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(290px,1fr));gap:16px}
.style-card .sw{height:84px;border-radius:12px;margin-bottom:14px;border:1px solid var(--border)}
.style-card h4{margin:0}
.frag{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;border:1px solid var(--border);background:var(--panel);font-size:.82rem;font-family:var(--mono);color:var(--text-2)}
.frag span{flex:1}
.tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}
.tpl{display:flex;flex-direction:column;gap:10px}
.tpl h4{margin:0;font-size:1rem}
.tpl .txt{font-size:.84rem;color:var(--text-2);line-height:1.6;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;flex:1}
.tpl .acts{display:flex;gap:6px;flex-wrap:wrap}
.star.on{color:var(--amber)}
.star.on svg{fill:currentColor}

/* faq inside the app */
.faq details{border-bottom:1px solid var(--border);padding:12px 0}
.faq summary{cursor:pointer;font-weight:600;color:var(--heading);list-style:none}
.faq summary::-webkit-details-marker{display:none}
.faq details p{margin:8px 0 0;color:var(--text-2);font-size:.9rem}

/* admin */
.tabs button svg{width:15px;height:15px;margin-right:6px;vertical-align:-2px}
.tabs{overflow-x:auto;flex-wrap:nowrap;scrollbar-width:thin}
.tabs button{white-space:nowrap}
.select.tight,.input.tight{padding:6px 30px 6px 10px;width:auto;height:auto}
.input.tight{padding:6px 10px}
.switch{position:relative;display:inline-block;width:42px;height:24px;cursor:pointer}
.switch input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer}
.switch span:not(.sr-only){position:absolute;inset:0;border-radius:99px;background:var(--panel-2);border:1px solid var(--border-2);transition:background .2s}
.switch span:not(.sr-only)::after{content:'';position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:var(--muted);transition:transform .2s var(--ease),background .2s}
.switch input:checked+span{background:rgba(139,92,246,.35);border-color:rgba(139,92,246,.6)}
.switch input:checked+span::after{transform:translateX(18px);background:#fff}
.switch input:focus-visible+span{outline:2px solid #a78bfa;outline-offset:2px}
.danger-card{border-color:rgba(248,113,113,.25)}
code{font-family:var(--mono);font-size:.85em;padding:1px 5px;border-radius:6px;background:var(--panel-2)}

/* light theme: surfaces that were tuned for dark backgrounds */
:root[data-theme='light'] .prompt-box{background:#f8f9fd}
:root[data-theme='light'] .prompt-box.neg{background:#fff6f6;border-color:rgba(220,38,38,.22)}
:root[data-theme='light'] .dropzone{background:radial-gradient(400px 200px at 50% 0%,rgba(139,92,246,.1),transparent 70%),#fbfbfe}
:root[data-theme='light'] .preview{background:repeating-conic-gradient(#eef0f6 0% 25%,#fff 0% 50%) 50%/20px 20px}
:root[data-theme='light'] .sidebar,:root[data-theme='light'] .topbar{background:rgba(255,255,255,.86)}
:root[data-theme='light'] .modal{background:#fff}
:root[data-theme='light'] .card{box-shadow:0 1px 2px rgba(15,23,42,.04),0 8px 24px -16px rgba(15,23,42,.18)}
:root[data-theme='light'] .ambient::after{opacity:.5}

@media (max-width:1100px){.studio{grid-template-columns:minmax(300px,400px) minmax(0,1fr)}}
@media (max-width:900px){
  .studio{grid-template-columns:1fr}
  .studio-left{position:static;max-height:none;overflow:visible}
  .result-actions .btn span{display:inline}
}
@media (max-width:560px){
  .style-grid{grid-template-columns:1fr 1fr}
  .style-opt{font-size:.74rem;padding:8px}
  .credit-pill{padding:0 9px}
  .result-actions{padding:8px;gap:6px}
  .banner{margin:10px 12px 0}
}
@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* ---------- billing & subscription ---------- */
.status-card{margin-bottom:6px}
.status-card .si{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;background:var(--panel-2);flex-shrink:0}
.status-card.ok .si{background:rgba(52,211,153,.14);color:var(--ok-text)}
.status-card.warn{border-color:rgba(251,191,36,.4)}
.status-card.warn .si{background:rgba(251,191,36,.14);color:var(--warn-text)}
.status-card.err{border-color:rgba(248,113,113,.45)}
.status-card.err .si{background:rgba(248,113,113,.14);color:var(--err-text)}
.facts{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;margin-top:16px}
.facts>div{padding:10px 12px;border-radius:12px;border:1px solid var(--border);background:var(--panel)}
.facts span{display:block;font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:4px}
.facts>div>div{color:var(--heading);font-size:.92rem}
.billing-toggle-row{display:flex;flex-direction:column;align-items:center;margin:22px 0 26px}
.config-note{border-color:rgba(251,191,36,.4)}
.price.featured{border-color:rgba(139,92,246,.6);box-shadow:var(--glow);background:linear-gradient(170deg,rgba(139,92,246,.12),transparent 55%),var(--panel)}
