/* ============================================================
   START AI BUILDER — Refined Design System
   Type scale (1.200), proportional spacing, refined components
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700&family=JetBrains+Mono:wght@400;500;600&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Refined editorial palette — mint green system */
  --ink: #0E1F1A;
  --ink-2: #15302A;
  --ink-3: #1F4339;
  --paper: #FBFDF9;
  --paper-2: #F0F7F2;
  --paper-3: #E5F0E9;
  --line: #D4E5D9;
  --line-2: #E2EFE6;
  --muted: #5A6B62;
  --muted-2: #8B9D93;

  /* Accent — soft mint green primary */
  --accent: #6EE7B7;
  --accent-deep: #34D399;
  --accent-2: #22C9C0;          /* teal companion for gradients */
  --accent-soft: #DEF7EC;
  --accent-glow: rgba(110, 231, 183, 0.35);

  /* Gradients — used for hero accents and CTAs */
  --grad-mint: linear-gradient(135deg, #6EE7B7 0%, #22C9C0 100%);
  --grad-mint-deep: linear-gradient(135deg, #34D399 0%, #0FA3A0 100%);
  --grad-mint-soft: linear-gradient(135deg, #DEF7EC 0%, #C7EEEC 100%);
  --grad-dark: linear-gradient(135deg, #0E1F1A 0%, #1F4339 100%);
  --grad-glow: radial-gradient(circle at 30% 20%, rgba(110, 231, 183, 0.18), transparent 60%);

  /* Functional */
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --info: #0891B2;
  --info-soft: #CFFAFE;

  /* Typography */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Inter', 'Sukhumvit Set', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Geist', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Modular type scale — 1.2 ratio (minor third) */
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 19px;
  --fs-2xl: 22px;
  --fs-3xl: 26px;
  --fs-4xl: 32px;
  --fs-5xl: 40px;
  --fs-6xl: 52px;
  --fs-7xl: 68px;

  /* Spacing — 4px grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;
  --sp-10: 72px;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 32px;

  /* Shadows — soft & layered */
  --sh-1: 0 1px 2px rgba(14, 31, 26, 0.04);
  --sh-2: 0 2px 8px -1px rgba(14, 31, 26, 0.06), 0 1px 3px rgba(14, 31, 26, 0.04);
  --sh-3: 0 8px 24px -6px rgba(14, 31, 26, 0.10), 0 3px 8px -2px rgba(14, 31, 26, 0.04);
  --sh-4: 0 20px 48px -12px rgba(14, 31, 26, 0.18), 0 6px 16px -4px rgba(14, 31, 26, 0.06);
  --sh-glow: 0 0 0 4px rgba(110, 231, 183, 0.22);
  --sh-mint: 0 8px 24px -6px rgba(52, 211, 153, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

html, body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: var(--fs-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
}

.hidden { display: none !important; }
.page { min-height: 100vh; }

::selection { background: var(--accent); color: var(--ink); }

/* Custom scrollbar — subtle */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ============================================================
   AUTH PAGE — Editorial split-screen
   ============================================================ */
#auth-page {
  position: relative;
  display: block;
  padding: 0;
  background: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
}

.auth-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: orbFloat 20s ease-in-out infinite;
}
.auth-orb-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
  top: -120px; left: -100px;
}
.auth-orb-2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 60%);
  bottom: -80px; right: 10%;
  animation-delay: -7s;
}
.auth-orb-3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, var(--accent-deep) 0%, transparent 60%);
  top: 40%; left: 40%;
  animation-delay: -14s;
  opacity: 0.35;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: center;
  color: var(--paper);
}

.auth-side { padding: 24px 0; }

/* ============================================================
   LANDING PAGE — Top Nav, Sections, Pricing, Docs, FAQ, Footer
   ============================================================ */

/* Top nav (above hero) */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: rgba(8, 17, 14, 0.7);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.landing-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  gap: 24px;
}
.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.landing-nav-brand svg { flex-shrink: 0; }
.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.landing-nav-link {
  background: transparent;
  border: 0;
  color: rgba(226, 232, 240, 0.85);
  font: 600 14px/1 'Inter', 'Sarabun', sans-serif;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.landing-nav-link:hover { color: #6EE7B7; background: rgba(110, 231, 183, 0.06); }
.landing-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: #6EE7B7;
  color: #0E1F1A !important;
  border-radius: 99px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.4);
}
.landing-nav-cta:hover { background: #34D399; transform: translateY(-1px); box-shadow: 0 6px 18px -4px rgba(110, 231, 183, 0.5); }

@media (max-width: 768px) {
  .landing-nav-inner { padding: 12px 16px; }
  .landing-nav-links .landing-nav-link:not(.landing-nav-cta) { display: none; }
}

/* Generic landing section */
.landing-section {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 100px 32px 80px;
  color: #E2E8F0;
}
.landing-container {
  max-width: 1180px;
  margin: 0 auto;
}
.landing-section-head {
  text-align: center;
  margin-bottom: 56px;
}
.landing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.22);
  border-radius: 99px;
  color: #6EE7B7;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.landing-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6EE7B7;
  box-shadow: 0 0 12px #6EE7B7;
}
.landing-h2 {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 16px;
  color: #fff;
}
.landing-h2 em {
  font-style: normal;
  background: linear-gradient(135deg, #6EE7B7, #34D399);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.landing-sub {
  font-size: clamp(15px, 1.6vw, 18px);
  color: rgba(226, 232, 240, 0.7);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.65;
}

/* Features grid */
.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.landing-feat-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 28px 24px;
  transition: all 0.25s;
  overflow: hidden;
}
.landing-feat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgba(110, 231, 183, 0.08), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.landing-feat-card:hover { transform: translateY(-3px); border-color: rgba(110, 231, 183, 0.25); }
.landing-feat-card:hover::before { opacity: 1; }
.landing-feat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.15), rgba(52, 211, 153, 0.05));
  border: 1px solid rgba(110, 231, 183, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}
.landing-feat-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #fff;
  letter-spacing: -0.01em;
}
.landing-feat-card p {
  font-size: 13px;
  color: rgba(226, 232, 240, 0.65);
  line-height: 1.6;
  margin: 0;
}

/* Stats strip */
.landing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  padding: 40px 32px;
  background: linear-gradient(180deg, rgba(110, 231, 183, 0.05), rgba(110, 231, 183, 0.01));
  border: 1px solid rgba(110, 231, 183, 0.15);
  border-radius: 22px;
  margin-top: 56px;
}
.landing-stat { text-align: center; }
.landing-stat-num {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  background: linear-gradient(135deg, #6EE7B7, #34D399);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}
.landing-stat-label {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.6);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Pricing */
.landing-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
}
.landing-price-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: all 0.25s;
}
.landing-price-card:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.16); }
.landing-price-card.featured {
  background: linear-gradient(180deg, rgba(110, 231, 183, 0.08), rgba(52, 211, 153, 0.02));
  border-color: rgba(110, 231, 183, 0.4);
  box-shadow: 0 16px 48px -16px rgba(110, 231, 183, 0.3), 0 0 0 1px rgba(110, 231, 183, 0.15) inset;
}
.landing-price-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  background: linear-gradient(135deg, #6EE7B7, #34D399);
  color: #042F2A;
  font-size: 11px;
  font-weight: 800;
  border-radius: 99px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.landing-price-name {
  font-size: 14px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.7);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.landing-price-amount {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.landing-price-amount strong {
  font-size: 44px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
}
.landing-price-amount span { font-size: 14px; color: rgba(226, 232, 240, 0.5); }
.landing-price-desc {
  font-size: 13px;
  color: rgba(226, 232, 240, 0.65);
  line-height: 1.55;
}
.landing-price-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.landing-price-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: rgba(226, 232, 240, 0.85);
  line-height: 1.5;
}
.landing-price-features li::before {
  content: '✓';
  color: #6EE7B7;
  font-weight: 800;
  flex-shrink: 0;
  width: 16px;
  font-size: 14px;
}
.landing-price-features li.muted { color: rgba(226, 232, 240, 0.4); }
.landing-price-features li.muted::before { content: '○'; color: rgba(226, 232, 240, 0.3); }
.landing-price-cta {
  display: block;
  width: 100%;
  padding: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  text-align: center;
}
.landing-price-cta:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }
.landing-price-card.featured .landing-price-cta {
  background: #6EE7B7;
  color: #042F2A;
  border-color: #6EE7B7;
}
.landing-price-card.featured .landing-price-cta:hover { background: #34D399; transform: translateY(-1px); }

/* Docs */
.landing-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.landing-doc-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.005));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 22px;
  text-decoration: none;
  display: block;
  transition: all 0.2s;
  cursor: pointer;
}
.landing-doc-card:hover { border-color: rgba(110, 231, 183, 0.3); transform: translateY(-2px); }
.landing-doc-icon { font-size: 26px; margin-bottom: 10px; }
.landing-doc-card h4 { font-size: 15px; font-weight: 700; margin: 0 0 4px; color: #fff; }
.landing-doc-card p { font-size: 12px; color: rgba(226, 232, 240, 0.55); margin: 0 0 10px; line-height: 1.5; }
.landing-doc-card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6EE7B7;
  font-size: 12px;
  font-weight: 700;
}

/* FAQ */
.landing-faq { max-width: 760px; margin: 0 auto; }
.landing-faq-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px 0;
}
.landing-faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  font: 600 16px/1.4 inherit;
  color: #fff;
  padding: 4px 0;
  font-family: inherit;
}
.landing-faq-q::after {
  content: '+';
  font-size: 22px;
  color: #6EE7B7;
  font-weight: 300;
  transition: transform 0.2s;
}
.landing-faq-item.open .landing-faq-q::after { content: '−'; }
.landing-faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(226, 232, 240, 0.7);
}
.landing-faq-item.open .landing-faq-a { max-height: 300px; padding-top: 12px; }

/* CTA strip */
.landing-cta-strip {
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.12), rgba(52, 211, 153, 0.04));
  border: 1px solid rgba(110, 231, 183, 0.25);
  border-radius: 28px;
  padding: 48px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.landing-cta-strip::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(closest-side, rgba(110, 231, 183, 0.15), transparent);
  pointer-events: none;
}
.landing-cta-strip h3 {
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 800;
  margin: 0 0 12px;
  color: #fff;
  letter-spacing: -0.02em;
  position: relative;
}
.landing-cta-strip p { color: rgba(226, 232, 240, 0.7); margin: 0 0 24px; font-size: 16px; position: relative; }

/* Footer */
.landing-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 56px 32px 28px;
  position: relative;
  z-index: 1;
}
.landing-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}
@media (max-width: 768px) {
  .landing-footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; }
}
.landing-footer-col h5 {
  font-size: 12px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
}
.landing-footer-col a {
  display: block;
  color: rgba(226, 232, 240, 0.75);
  font-size: 13px;
  text-decoration: none;
  padding: 4px 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  font-family: inherit;
  text-align: left;
}
.landing-footer-col a:hover { color: #6EE7B7; }
.landing-footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}
.landing-footer-tagline {
  color: rgba(226, 232, 240, 0.55);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 16px;
  max-width: 280px;
}
.landing-footer-bottom {
  max-width: 1180px;
  margin: 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: rgba(226, 232, 240, 0.5);
}

/* Adjust auth-shell to be top section under nav */
.auth-shell {
  margin: 80px auto 40px;
  padding: 0 32px;
}

/* Mobile CSS for landing */
@media (max-width: 768px) {
  .landing-section { padding: 64px 16px 48px; }
  .landing-container { padding: 0; }
  .landing-stats { padding: 24px 18px; gap: 16px; }
  .landing-cta-strip { padding: 32px 20px; border-radius: 20px; }
  .landing-footer { padding: 40px 16px 20px; }
  .auth-shell { margin: 40px auto 20px; padding: 0 16px; gap: 32px; }
}


.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-row.compact { gap: 10px; }

.brand-mark {
  display: grid;
  place-items: center;
  border-radius: 11px;
}
.brand-mark.sm { width: 28px; height: 28px; }

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--paper);
}
.brand-wordmark.sm { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }

.auth-pitch { margin-top: 56px; }

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 28px;
  padding: 6px 12px;
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.2);
  border-radius: 20px;
}

.dot-pulse {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulseDot 2s ease-out infinite;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(110, 231, 183, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0); }
}

.auth-display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}
.auth-display em {
  font-style: italic;
  font-weight: 500;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-display .hl {
  position: relative;
  display: inline-block;
  font-style: italic;
}
.auth-display .hl::after {
  content: '';
  position: absolute;
  left: -4px; right: -4px;
  bottom: 6px;
  height: 14px;
  background: var(--accent);
  z-index: -1;
  transform: skew(-6deg);
}

.auth-sub {
  font-size: var(--fs-md);
  line-height: 1.6;
  color: rgba(251, 253, 249, 0.72);
  max-width: 460px;
  margin-bottom: 40px;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-feat {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  background: rgba(251, 253, 249, 0.04);
  border: 1px solid rgba(251, 253, 249, 0.08);
  border-radius: var(--r-md);
  transition: all 0.3s var(--ease);
}
.auth-feat:hover {
  background: rgba(251, 253, 249, 0.08);
  transform: translateX(4px);
  border-color: rgba(110, 231, 183, 0.3);
}
.auth-feat-num {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--accent);
  letter-spacing: 0.05em;
}
.auth-feat strong {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--paper);
  margin-bottom: 2px;
}
.auth-feat span {
  display: block;
  font-size: var(--fs-xs);
  color: rgba(251, 253, 249, 0.55);
}

/* Auth card */
.auth-form-side { display: flex; justify-content: center; }

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--r-xl);
  padding: 36px;
  box-shadow: var(--sh-4);
  position: relative;
}
.auth-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--r-xl);
  padding: 1px;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.4), transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.auth-tabs {
  position: relative;
  display: flex;
  gap: 0;
  background: var(--paper-2);
  border-radius: 99px;
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  position: relative;
  flex: 1;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  border-radius: 99px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.3s var(--ease);
  z-index: 2;
}
.auth-tab.active { color: var(--ink); }
.auth-tab-indicator {
  position: absolute;
  top: 4px; left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--paper);
  border-radius: 99px;
  box-shadow: var(--sh-1);
  transition: transform 0.4s var(--ease-out);
  z-index: 1;
}
.auth-tabs[data-active="register"] .auth-tab-indicator {
  transform: translateX(100%);
}

.auth-form { display: none; animation: formIn 0.4s var(--ease-out); }
.auth-form.active { display: block; }
@keyframes formIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-form-title {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.auth-form-sub {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.55;
}

.auth-hint {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--paper-2);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--muted);
}
.hint-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--ink);
  color: var(--accent);
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* ============================================================
   FIELDS & BUTTONS — refined
   ============================================================ */
.field { margin-bottom: 16px; }
.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
  letter-spacing: -0.005em;
}
.field-hint {
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.input-group input,
.select-min,
.search-box input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: var(--fs-base);
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }

.field input:focus,
.field select:focus,
.field textarea:focus,
.input-group input:focus,
.select-min:focus,
.search-box input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(14, 31, 26, 0.06);
}

.field textarea { resize: vertical; min-height: 88px; line-height: 1.55; }

.input-group {
  position: relative;
  display: flex;
}
.input-group input { padding-right: 44px; }
.input-suffix-btn {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  color: var(--muted);
  border-radius: var(--r-sm);
}
.input-suffix-btn:hover { background: var(--paper-2); color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  white-space: nowrap;
  letter-spacing: -0.005em;
  user-select: none;
  line-height: 1;
  position: relative;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-lg { padding: 13px 22px; font-size: var(--fs-base); border-radius: var(--r-md); gap: 7px; }
.btn-sm { padding: 8px 13px; font-size: var(--fs-xs); }
.btn-xs { padding: 5px 9px; font-size: var(--fs-2xs); border-radius: var(--r-sm); }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--grad-dark);
  color: var(--paper);
  box-shadow: 0 4px 14px -3px rgba(14, 31, 26, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:hover:not(:disabled) {
  background: var(--ink-2);
  transform: translateY(-1.5px);
  box-shadow: 0 8px 20px -4px rgba(14, 31, 26, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px -2px rgba(14, 31, 26, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-light {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 6px -1px rgba(14, 31, 26, 0.08), 0 0 0 1px rgba(14, 31, 26, 0.04);
}
.btn-light:hover:not(:disabled) {
  box-shadow: 0 8px 20px -4px rgba(14, 31, 26, 0.18), 0 0 0 1px rgba(14, 31, 26, 0.06);
  transform: translateY(-1.5px);
}
.btn-light:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(14, 31, 26, 0.02);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--paper-2);
  border-color: var(--ink-3);
  transform: translateY(-1px);
}
.btn-ghost:active:not(:disabled) { transform: translateY(0); }

.btn-ghost-light {
  background: rgba(251, 253, 249, 0.05);
  color: var(--paper);
  border: 1px solid rgba(251, 253, 249, 0.2);
  backdrop-filter: blur(8px);
}
.btn-ghost-light:hover:not(:disabled) {
  background: rgba(251, 253, 249, 0.12);
  border-color: rgba(251, 253, 249, 0.4);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: var(--paper);
  box-shadow: 0 4px 14px -3px rgba(220, 38, 38, 0.4);
}
.btn-danger:hover:not(:disabled) {
  background: #B91C1C;
  transform: translateY(-1.5px);
  box-shadow: 0 8px 20px -4px rgba(220, 38, 38, 0.5);
}

.btn-success {
  background: var(--success);
  color: var(--paper);
  box-shadow: 0 4px 14px -3px rgba(22, 163, 74, 0.35);
}
.btn-success:hover:not(:disabled) {
  background: #15803D;
  transform: translateY(-1.5px);
}

.btn-accent {
  background: var(--grad-mint);
  color: var(--ink);
  box-shadow: var(--sh-mint), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-accent:hover:not(:disabled) {
  background: var(--grad-mint-deep);
  color: var(--paper);
  transform: translateY(-1.5px);
  box-shadow: 0 10px 28px -4px rgba(52, 211, 153, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-accent:active:not(:disabled) { transform: translateY(0); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.icon-btn:hover { background: var(--paper-2); border-color: var(--line); }

.icon-btn-mini {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
}
.icon-btn-mini:hover { background: var(--paper-2); color: var(--ink); }

.link-btn {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-sm);
}
.link-btn:hover { color: var(--accent-deep); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(251, 253, 249, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-2);
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-divider {
  width: 1px; height: 18px;
  background: var(--line);
}
.topbar-context {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--paper-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink);
}
.user-chip-dot {
  width: 6px; height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--success-soft);
}
.admin-chip {
  background: var(--ink);
  color: var(--paper);
}
.admin-chip .user-chip-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.25);
}

/* ============================================================
   ADMIN SHELL — sidebar + main
   ============================================================ */
.admin-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: calc(100vh - 65px);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 14px;
  background: var(--paper-2);
  border-right: 1px solid var(--line-2);
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s var(--ease);
  letter-spacing: -0.005em;
}
.rail-item svg {
  width: 17px; height: 17px;
  flex-shrink: 0;
}
.rail-item:hover {
  color: var(--ink);
  background: var(--paper);
}
.rail-item.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--sh-2);
}

.rail-spacer { flex: 1; }

.rail-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.rail-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
}
.rail-status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.rail-status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.rail-status-info {
  display: flex;
  flex-direction: column;
  font-size: 11px;
}
.rail-status-info span { color: var(--muted); }
.rail-status-info strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.admin-main {
  padding: 32px 40px;
  overflow-x: auto;
}
.admin-section { display: none; animation: sectionIn 0.4s var(--ease-out); }
.admin-section.active { display: block; }
@keyframes sectionIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-2);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.eyebrow.light { color: rgba(251, 253, 249, 0.7); }

.page-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-4xl);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.page-title em { font-style: italic; font-weight: 400; color: var(--ink); }
.page-sub {
  margin-top: 6px;
  font-size: var(--fs-base);
  color: var(--muted);
}

.page-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.kpi-card {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-3);
  border-color: var(--ink);
}
.kpi-card-feat {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.kpi-card-feat::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(110, 231, 183, 0.12) 0%, transparent 50%);
  pointer-events: none;
}
.kpi-card-feat .kpi-label { color: rgba(251, 253, 249, 0.65); }
.kpi-card-feat .kpi-value { color: var(--accent); }
.kpi-card-feat .kpi-trend { color: rgba(251, 253, 249, 0.65); }

.kpi-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: var(--r);
  flex-shrink: 0;
}
.kpi-icon-1 { background: #E8E2F4; color: #5B3F8F; }
.kpi-icon-2 { background: #DCEEFB; color: #2563A8; }
.kpi-icon-3 { background: #F4E6D8; color: #8B5A2B; }
.kpi-icon-4 {
  background: rgba(110, 231, 183, 0.18);
  color: var(--accent-deep);
}

.kpi-meta { flex: 1; min-width: 0; }
.kpi-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.kpi-value {
  display: block;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.kpi-trend {
  display: block;
  font-size: var(--fs-2xs);
  font-weight: 500;
  color: var(--muted);
}
.kpi-trend.pos { color: var(--success); }

/* ============================================================
   PANELS
   ============================================================ */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-2);
}
.panel-head h3 {
  font-size: 14px;
  font-weight: 600;
}
.panel-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 4px;
  font-weight: 500;
}

/* Activity stream */
.activity-stream {
  max-height: 380px;
  overflow-y: auto;
}
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.2s var(--ease);
}
.activity-row:last-child { border-bottom: 0; }
.activity-row:hover { background: var(--paper-2); }
.activity-mark {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--paper-2);
  font-size: 14px;
  flex-shrink: 0;
}
.activity-text { flex: 1; font-size: var(--fs-sm); }
.activity-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.activity-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.recent-websites {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 380px;
  overflow-y: auto;
}
.recent-site-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.recent-site-row:hover { background: var(--paper-2); }
.recent-site-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 16px;
}
.recent-site-info { flex: 1; min-width: 0; }
.recent-site-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-site-meta {
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================
   TOOLBAR & SEARCH
   ============================================================ */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 360px;
}
.search-box.compact { max-width: 240px; }
.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  padding-left: 36px;
  padding-right: 14px;
  height: 38px;
}
.select-min {
  width: auto;
  padding: 8px 32px 8px 14px;
  height: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%236B6B70' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.view-toggle {
  display: flex;
  background: var(--paper-2);
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}
.view-btn {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}
.view-btn.active { background: var(--paper); color: var(--ink); box-shadow: var(--sh-1); }

/* ============================================================
   TABLE
   ============================================================ */
.table-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
  overflow-x: auto;
}
.table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table th, .data-table th {
  background: var(--paper-2);
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-2xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.table td, .data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.table tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }
.table tr, .data-table tr { transition: background 0.15s var(--ease); }
.table tbody tr:hover, .data-table tbody tr:hover { background: var(--paper-2); }

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  flex-shrink: 0;
}
.avatar.warm { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: var(--ink); }
.cell-username {
  font-weight: 600;
  color: var(--ink);
  font-size: var(--fs-sm);
}
.cell-id {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--muted);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.role-admin {
  background: var(--ink);
  color: var(--accent);
}
.role-user {
  background: var(--paper-2);
  color: var(--muted);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}
.status-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-dot.active { color: var(--success); }
.status-dot.inactive { color: var(--muted-2); }

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ============================================================
   CARD GRID — websites & templates
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  /* Make all rows align to tallest card so each row's cards are equal height */
  grid-auto-rows: 1fr;
}

.site-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
  position: relative;
  /* Equal-height card: stack thumb + body and let body fill remaining space */
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--sh-1);
  isolation: isolate;
}
.site-card::before {
  /* Subtle top hairline highlight for premium feel */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
}
.site-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-4);
  border-color: var(--ink-3);
}
.site-card:hover::before { opacity: 1; }

.site-thumb {
  /* Locked thumb height across web & app variants for visual rhythm */
  height: 200px;
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
  cursor: pointer;
  flex-shrink: 0;
}
.site-thumb-frame {
  width: 250%;
  height: 250%;
  border: 0;
  pointer-events: none;
  transform: scale(0.4);
  transform-origin: top left;
}
.site-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(14, 31, 26, 0);
  display: grid;
  place-items: center;
  transition: background 0.25s var(--ease);
}
.site-thumb:hover .site-thumb-overlay { background: rgba(14, 31, 26, 0.42); }
.site-thumb-overlay-btn {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s var(--ease);
  background: var(--paper);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--sh-3);
}
.site-thumb:hover .site-thumb-overlay-btn { opacity: 1; transform: translateY(0); }

.site-pub {
  position: absolute;
  top: 12px; left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.site-pub.published {
  background: var(--success);
  color: var(--paper);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}
.site-pub.published::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--paper);
  animation: pulseDot2 1.6s ease-out infinite;
}
@keyframes pulseDot2 {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.site-pub.draft {
  background: rgba(251, 253, 249, 0.92);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(14, 31, 26, 0.12);
}

.site-body {
  padding: 18px 20px 20px;
  /* Fill remaining card space and push actions to the bottom */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.site-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.site-title-icon { font-size: 17px; }
.site-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.site-desc {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Reserve exactly two lines so cards align even when desc is short */
  height: calc(1.55em * 2);
}
.site-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  /* Push the action row to the bottom of the card */
  margin-top: auto;
  margin-bottom: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}
.site-owner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.site-owner span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.site-owner-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}
.site-actions {
  display: flex;
  gap: 6px;
}
.site-actions .btn { flex: 1; }
.site-actions .icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
.site-actions .icon-btn svg { width: 14px; height: 14px; }

/* List view */
.site-list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  margin-bottom: 8px;
  transition: all 0.2s var(--ease);
}
.site-list-row:hover { border-color: var(--ink); transform: translateX(4px); }

/* ============================================================
   USER DASHBOARD HERO
   ============================================================ */
.user-shell { padding: 0; }

.user-hero {
  position: relative;
  padding: 72px 48px 96px;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  margin-bottom: -56px;
}
.user-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.user-hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 80%);
}
.user-hero-orb {
  position: absolute;
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
  filter: blur(100px);
  opacity: 0.35;
  top: -200px;
  right: -100px;
}

.user-hero-content {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-top: 14px;
  margin-bottom: 14px;
}
.hero-title em { font-style: italic; font-weight: 400; color: var(--accent); }
.hero-sub {
  font-size: var(--fs-md);
  line-height: 1.55;
  color: rgba(251, 253, 249, 0.72);
  margin-bottom: 32px;
  max-width: 520px;
}
.hero-sub em { font-style: italic; font-weight: 500; color: var(--accent); }

.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(251, 253, 249, 0.06);
  border: 1px solid rgba(251, 253, 249, 0.1);
  border-radius: var(--r-md);
  backdrop-filter: blur(10px);
}
.hero-stats > div {
  font-size: var(--fs-sm);
  color: rgba(251, 253, 249, 0.72);
}
.hero-stats strong {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--accent);
  margin-right: 5px;
  letter-spacing: -0.025em;
}
.hero-stat-divider {
  width: 1px; height: 16px;
  background: rgba(251, 253, 249, 0.15);
}

.user-sites-section {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px 64px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  background: var(--paper);
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.section-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  grid-column: 1 / -1;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 64px 32px;
  text-align: center;
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 14px;
  filter: grayscale(0.3);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.015em;
}
.empty-state p {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: 18px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}
.setting-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 24px;
}
.setting-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-2);
}
.setting-icon {
  width: 40px; height: 40px;
  background: var(--paper-2);
  border-radius: var(--r);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.setting-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.setting-card-head h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.setting-card-head p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.setting-card-head > div { flex: 1; }
.setting-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
}
.setting-danger { border-color: var(--danger-soft); }
.danger-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 4px 0;
}
.switch-row > span:first-child { display: block; }
.switch-row > span:first-child small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 99px;
  cursor: pointer;
  transition: 0.3s var(--ease);
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: var(--paper);
  border-radius: 50%;
  transition: 0.3s var(--ease-out);
  box-shadow: var(--sh-1);
}
.switch input:checked + .switch-slider { background: var(--ink); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* ============================================================
   EDITOR
   ============================================================ */
.editor-bar {
  height: 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-2);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
}
.editor-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.editor-bar-center {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
}
.editor-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.bar-divider { width: 1px; height: 22px; background: var(--line); }

.editor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.editor-name-input {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 4px 8px;
  color: var(--ink);
  outline: none;
  max-width: 260px;
  text-overflow: ellipsis;
}
.editor-name-input:hover { background: var(--paper-2); }
.editor-name-input:focus {
  background: var(--paper);
  border-color: var(--line);
  box-shadow: 0 0 0 3px rgba(14, 31, 26, 0.05);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-pill-dot {
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
}
.status-pill.unsaved {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}
.status-pill.saving {
  background: var(--paper-2);
  color: var(--muted);
}
.status-pill.saving .status-pill-dot { animation: pulseDot2 1s ease-out infinite; }

.device-switcher {
  display: flex;
  background: var(--paper-2);
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}
.device-btn {
  display: grid;
  place-items: center;
  width: 32px; height: 28px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s var(--ease);
}
.device-btn:hover { color: var(--ink); }
.device-btn.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--sh-1);
}

.zoom-control {
  display: inline-flex;
  align-items: center;
  background: var(--paper-2);
  border-radius: var(--r);
  padding: 3px;
}
.zoom-btn {
  width: 24px; height: 24px;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.zoom-btn:hover { color: var(--ink); background: var(--paper); }
.zoom-value {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  min-width: 38px;
  text-align: center;
}

/* Editor layout */
.editor-shell {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.editor-side {
  background: var(--paper);
  border-right: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-tabs {
  display: flex;
  border-bottom: 1px solid var(--line-2);
  background: var(--paper-2);
  padding: 0 6px;
}
.editor-tab {
  flex: 1;
  padding: 11px 6px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s var(--ease);
  letter-spacing: -0.005em;
}
.editor-tab:hover { color: var(--ink); }
.editor-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  background: var(--paper);
}

.editor-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
}
.editor-tab-content.active { display: flex; flex-direction: column; }

/* AI Panel */
.ai-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ai-quick {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
  background: var(--paper-2);
}
.ai-quick-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.ai-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pill {
  padding: 5px 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.pill:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  transform: translateY(-1px);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.ai-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: msgIn 0.3s var(--ease-out);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-msg-user { flex-direction: row-reverse; }
.ai-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--paper-2);
}
.ai-msg-user .ai-msg-avatar {
  background: var(--ink);
  color: var(--accent);
}
.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 82%;
  word-wrap: break-word;
}
.ai-msg-bot .ai-msg-bubble {
  background: var(--paper-2);
  color: var(--ink);
  border-top-left-radius: 4px;
}
.ai-msg-user .ai-msg-bubble {
  background: var(--ink);
  color: var(--paper);
  border-top-right-radius: 4px;
}
.ai-msg-bubble strong { font-weight: 600; }
.ai-msg-bubble ul { margin: 6px 0 0 18px; font-size: 12px; }
.ai-msg-bubble li { margin-bottom: 3px; }

.ai-typing {
  display: inline-flex;
  gap: 3px;
  padding: 2px 0;
}
.ai-typing span {
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-2);
  background: rgba(110, 231, 183, 0.04);
}
.ai-sug-label {
  flex-basis: 100%;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.sug-chip {
  padding: 4px 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: inherit;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.sug-chip:hover {
  background: var(--accent);
  border-color: var(--accent-deep);
}

.ai-input-shell {
  border-top: 1px solid var(--line-2);
  padding: 12px;
  background: var(--paper);
}
.ai-mode-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.ai-mode-select {
  flex: 1;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%236B6B70' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
#ai-prompt {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 13px;
  background: var(--paper);
  resize: none;
  margin-bottom: 8px;
  line-height: 1.5;
  transition: all 0.2s var(--ease);
}
#ai-prompt:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(14, 31, 26, 0.05);
}

/* Design Panel */
.design-panel {
  padding: 18px 16px;
}
.design-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-2);
}
.design-section:last-child { border-bottom: 0; }
.design-section h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.design-hint {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  color: var(--ink);
  transition: all 0.2s var(--ease);
}
.swatch span {
  display: block;
  width: 100%;
  height: 28px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--c1), var(--c2));
}
.swatch:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
  border-color: var(--ink);
}

.font-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.font-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  transition: all 0.2s var(--ease);
}
.font-option:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
  color: var(--ink);
}
.font-option > span:first-child {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.design-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.design-action {
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s var(--ease);
}
.design-action:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  transform: translateX(2px);
}

/* Code Panel */
.code-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
}
.code-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  align-items: center;
}
.code-tab {
  padding: 5px 12px;
  background: var(--paper-2);
  border: 0;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.code-tab:hover { color: var(--ink); }
.code-tab.active {
  background: var(--ink);
  color: var(--accent);
}
.code-area {
  display: none;
  flex: 1;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  resize: none;
  background: var(--ink);
  color: #E5E5E5;
  margin-bottom: 10px;
  outline: none;
  tab-size: 2;
}
.code-area::placeholder { color: var(--muted); }
.code-area.active { display: block; }
.code-area:focus { border-color: var(--accent); }

/* Settings Panel */
.settings-panel { padding: 18px 16px; }
.settings-divider {
  margin: 24px 0;
  height: 1px;
  background: var(--line-2);
}
.danger-zone h4 {
  font-size: 12px;
  color: var(--danger);
  margin-bottom: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Editor canvas */
.editor-canvas {
  background: var(--paper-2);
  background-image:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1px);
  background-size: 16px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}
.canvas-wrap {
  background: var(--paper);
  border-radius: var(--r);
  box-shadow: var(--sh-3);
  width: 100%;
  height: calc(100vh - 56px - 48px);
  max-width: 100%;
  transition: max-width 0.3s var(--ease);
  overflow: hidden;
}
.canvas-wrap.tablet { max-width: 768px; height: 1024px; max-height: calc(100vh - 56px - 48px); }
.canvas-wrap.mobile { max-width: 390px; height: 844px; max-height: calc(100vh - 56px - 48px); }
#preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--r);
  background: white;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 31, 26, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 24px;
  animation: overlayIn 0.25s var(--ease-out);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--paper);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--sh-4);
  animation: modalIn 0.35s var(--ease-out);
  display: flex;
  flex-direction: column;
}
.modal.modal-lg { max-width: 880px; }
.modal.modal-xl { max-width: 1100px; }
.modal.modal-xxl { max-width: 1400px; }
.modal.modal-preview { max-width: 1280px; max-height: 95vh; }

/* ===== Template Preview ===== */
.tpl-preview-wrap {
  background: #0a0a0a;
  padding: 0;
  margin: -20px -24px;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tpl-preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: linear-gradient(180deg, #1a1a1d, #0e0e10);
  border-bottom: 1px solid #2a2a2d;
}
.tpl-preview-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 13px;
}
.tpl-preview-info-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-size: 14px;
}
.tpl-preview-info-name {
  font-weight: 600;
}
.tpl-preview-info-type {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.tpl-preview-modes {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  border-radius: 99px;
}
.tpl-preview-mode {
  padding: 6px 14px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 500;
  border-radius: 99px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.tpl-preview-mode:hover {
  color: #fff;
}
.tpl-preview-mode.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.tpl-preview-actions {
  display: flex;
  gap: 8px;
}
.tpl-preview-stage {
  flex: 1;
  background: #0a0a0a;
  padding: 24px;
  display: grid;
  place-items: center;
  overflow: auto;
  min-height: 540px;
  max-height: 75vh;
}
.tpl-preview-frame-wrap {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
  transition: max-width 0.3s ease, aspect-ratio 0.3s ease;
}
.tpl-preview-frame-wrap.mode-desktop {
  max-width: 100%;
  min-height: 540px;
  aspect-ratio: 16 / 9;
}
.tpl-preview-frame-wrap.mode-tablet {
  max-width: 768px;
  min-height: 540px;
  aspect-ratio: 4 / 3;
}
.tpl-preview-frame-wrap.mode-mobile {
  max-width: 380px;
  min-height: 700px;
  aspect-ratio: 9 / 19;
  border-radius: 28px;
  border: 8px solid #1a1a1d;
  position: relative;
}
.tpl-preview-frame-wrap.mode-mobile::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 22px;
  background: #1a1a1d;
  border-radius: 0 0 14px 14px;
  z-index: 2;
}
.tpl-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.tpl-preview-frame-wrap.mode-mobile .tpl-preview-frame {
  border-radius: 20px;
}

@media (max-width: 720px) {
  .tpl-preview-toolbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .tpl-preview-frame-wrap.mode-desktop,
  .tpl-preview-frame-wrap.mode-tablet {
    aspect-ratio: auto;
    min-height: 60vh;
  }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-2);
}
.modal-head h3 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.modal-close {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.modal-close:hover { background: var(--paper-2); color: var(--ink); }
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--line-2);
  background: var(--paper-2);
}

/* Template chooser inside modal */
.tpl-chooser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.tpl-option {
  cursor: pointer;
  border: 2px solid var(--line);
  border-radius: var(--r);
  padding: 8px;
  background: var(--paper);
  transition: all 0.2s var(--ease);
  text-align: center;
}
.tpl-option:hover { border-color: var(--muted); }
.tpl-option.active {
  border-color: var(--ink);
  box-shadow: var(--sh-2);
}
.tpl-thumb {
  height: 80px;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 32px;
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
}
.tpl-thumb-frame {
  width: 100%; height: 100%;
  position: absolute; inset: 0;
  border: 0;
  pointer-events: none;
  transform: scale(0.3);
  transform-origin: top left;
  width: 333%;
  height: 333%;
}
.tpl-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

/* History list */
.history-list { max-height: 460px; overflow-y: auto; }
.history-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.history-row:last-child { border-bottom: 0; }
.history-row:hover { background: var(--paper-2); }
.history-mark {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}
.history-info { flex: 1; min-width: 0; }
.history-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}
.history-mode-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--paper-2);
  border-radius: 4px;
  color: var(--ink);
  font-weight: 500;
}
.history-prompt {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 3px;
}
.history-explain {
  font-size: 11px;
  color: var(--muted);
}

/* Actions ของ history row — ปุ่ม Restore + ลบ */
.history-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.history-delete-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
  opacity: 0.5;
}
.history-row:hover .history-delete-btn {
  opacity: 1;
}
.history-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger, #ef4444);
}

/* History modal sections */
.history-body-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* ไม่ตั้ง max-height/overflow ที่นี่ — ปล่อยให้ .modal-body จัดการ scroll
     เพื่อหลีกเลี่ยง nested scroll containers ที่ทำให้ user สับสน */
}
.history-section {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  /* ใช้ overflow: hidden แค่กับขอบ — ใช้ clip path หรือ contain แทนเพื่อไม่ตัดเนื้อหา */
}
.history-section > .history-list:first-of-type,
.history-section .history-section-head + .history-list {
  border-radius: 0 0 var(--r) var(--r);
}
.history-section-head {
  padding: 12px 16px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-section-head h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.history-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--paper);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
}
.history-section .history-list {
  /* ใน section: ไม่จำกัด max-height + ไม่ scroll inner
     ปล่อยให้ modal-body scroll ทั้งหมดเป็นชั้นเดียว
     (default .history-list ที่ใช้นอก section ยังมี max-height 460px) */
  max-height: none;
  overflow: visible;
}

/* Chat conversation list */
.history-chat {
  /* ไม่จำกัด max-height — ให้ modal-body scroll ทั้งหมดในชั้นเดียว */
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.history-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  flex-shrink: 0;
}
.history-chat-user .history-chat-avatar {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.history-chat-bot .history-chat-avatar {
  color: var(--accent-deep, #047857);
}
.history-chat-body {
  flex: 1;
  min-width: 0;
}
.history-chat-time {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.history-chat-content {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper-2);
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.history-chat-user .history-chat-content {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-md);
  padding: 12px 16px 12px 14px;
  box-shadow: var(--sh-4);
  font-size: var(--fs-sm);
  font-weight: 500;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.4s var(--ease-out);
  border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   LOADING
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 31, 26, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 3000;
}
.loader-shell {
  text-align: center;
  color: var(--paper);
}
.loader-rings {
  position: relative;
  width: 80px; height: 80px;
  margin: 0 auto 20px;
}
.loader-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  animation: ringSpin 2s linear infinite;
}
.loader-ring:nth-child(1) { border-top-color: var(--accent); }
.loader-ring:nth-child(2) {
  border-right-color: var(--rose);
  inset: 8px;
  animation-duration: 1.5s;
  animation-direction: reverse;
}
.loader-ring:nth-child(3) {
  border-bottom-color: var(--paper);
  inset: 16px;
  animation-duration: 1s;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }

.loader-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.loader-sub {
  font-size: 12px;
  color: rgba(251, 253, 249, 0.55);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .auth-shell { grid-template-columns: 1fr; gap: 32px; max-width: 480px; }
  .auth-side { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
  .rail {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line-2);
  }
  .rail-item { flex-shrink: 0; white-space: nowrap; }
  .rail-spacer, .rail-status { display: none; }
  .admin-main { padding: 24px 16px; }
  .page-title { font-size: 30px; }
  .editor-shell { grid-template-columns: 1fr; }
  .editor-side { height: 50vh; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .editor-bar { grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 8px; }
  .editor-bar-center { display: none; }
  .user-hero { padding: 48px 24px 80px; }
  .user-sites-section { padding: 0 24px 48px; }
  .section-head { flex-direction: column; align-items: stretch; gap: 14px; }
}

/* ============================================================
   APP BUILDER — Mobile preview, type-pill, plugins
   ============================================================ */

/* Type pill in editor bar */
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.type-pill.app {
  background: var(--ink);
  color: var(--accent);
  border-color: var(--ink);
}
.type-pill-icon { font-size: 12px; }

/* Type toggle on user dashboard */
.type-toggle {
  display: inline-flex;
  background: var(--paper-2);
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}
.type-toggle-btn {
  padding: 6px 14px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.type-toggle-btn:hover { color: var(--ink); }
.type-toggle-btn.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--sh-1);
}

/* App project card — proper phone mockup with notch & home indicator */
.site-card.is-app .site-thumb {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(110, 231, 183, 0.10), transparent 60%),
    linear-gradient(135deg, #1A1F2E 0%, #0E1F1A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  /* Match web thumb height — equal-height cards across the row */
  height: 200px;
}
.site-card.is-app .site-phone {
  position: relative;
  /* Slightly smaller phone so the 200px container has clean breathing room */
  width: 108px;
  height: 180px;
  background: #000;
  border-radius: 20px;
  border: 3px solid #2A2D38;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 14px 32px rgba(0,0,0,0.55),
    0 4px 10px rgba(0,0,0,0.35);
  overflow: hidden;
  flex-shrink: 0;
}
/* Phone notch (Dynamic Island style) */
.site-card.is-app .site-phone::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 8px;
  background: #000;
  border-radius: 99px;
  z-index: 3;
  border: 1px solid rgba(255,255,255,0.06);
}
/* Phone home indicator */
.site-card.is-app .site-phone::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: rgba(255,255,255,0.55);
  border-radius: 99px;
  z-index: 3;
  pointer-events: none;
}
.site-card.is-app .site-thumb-frame {
  width: 412px;
  height: 868px;
  border: 0;
  pointer-events: none;
  border-radius: 17px;
  background: #000;
  display: block;
  /* Scale a 412x868 viewport down into 102x174 (inside 108x180 phone shell minus 3px border) */
  transform: scale(0.2476);
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}
/* Subtle reflection on phone */
.site-card.is-app .site-phone-glare {
  position: absolute;
  inset: 0;
  border-radius: 17px;
  background: linear-gradient(125deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,0) 70%, rgba(255,255,255,0.04) 100%);
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: overlay;
}
/* Soft glow ring around phone on hover */
.site-card.is-app:hover .site-phone {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 18px 38px rgba(0,0,0,0.6),
    0 6px 14px rgba(0,0,0,0.4),
    0 0 0 5px rgba(110, 231, 183, 0.12);
  transform: translateY(-2px);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.site-card.is-app .site-phone {
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.site-card.is-app .site-thumb-overlay-btn {
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
}
.type-badge-on-card {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(14, 31, 26, 0.85);
  color: var(--paper);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Phone frame for app preview */
.phone-frame {
  position: relative;
  width: 412px;
  height: 868px;
  max-height: calc(100vh - 56px - 48px);
  background: #1A1A1F;
  border-radius: 48px;
  padding: 11px;
  box-shadow:
    0 0 0 2px #2A2A30,
    0 0 0 4px #1A1A1F,
    0 24px 48px -12px rgba(0, 0, 0, 0.45),
    0 8px 16px -4px rgba(0, 0, 0, 0.2);
  margin: 0 auto;
  flex-shrink: 0;
}
.phone-notch {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 30px;
  background: #000;
  border-radius: 0 0 18px 18px;
  z-index: 2;
}
.phone-screen {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 36px;
  overflow: hidden;
  position: relative;
}
.phone-home {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  z-index: 2;
  pointer-events: none;
}
#preview-frame-app {
  width: 100%;
  height: 100%;
  border: 0;
  background: #FFF;
}

/* When in app mode, hide device switcher */
.editor-bar.app-mode .device-switcher { display: none; }

/* Plugins panel */
.plugins-panel {
  padding: 18px 16px;
}
.plugins-head {
  margin-bottom: 18px;
}
.plugins-head h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.plugins-installed {
  margin-bottom: 22px;
}
.plugins-installed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 0 4px;
}
.plugins-installed-count {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  background: var(--accent);
  color: var(--ink);
  border-radius: 99px;
  letter-spacing: 0;
}
.plugins-installed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plugin-installed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
}
.plugin-installed-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--paper);
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.plugin-installed-info {
  flex: 1;
  min-width: 0;
}
.plugin-installed-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.plugin-installed-meta {
  font-size: 10px;
  color: var(--muted);
}
.plugin-installed-remove {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
}
.plugin-installed-remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
.plugins-empty-text {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.plugins-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}
.plugins-filter-btn {
  padding: 5px 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.plugins-filter-btn:hover { background: var(--paper-2); }
.plugins-filter-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.plugins-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plugin-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  transition: all 0.2s var(--ease);
  position: relative;
}
.plugin-card:hover {
  border-color: var(--ink);
  box-shadow: var(--sh-2);
}
.plugin-card.installed {
  background: var(--accent-soft);
  border-color: var(--accent-deep);
}
.plugin-card-icon {
  width: 38px;
  height: 38px;
  background: var(--paper-2);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.plugin-card.installed .plugin-card-icon {
  background: var(--accent);
}
.plugin-card-info {
  flex: 1;
  min-width: 0;
}
.plugin-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.plugin-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.plugin-card-cat {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 6px;
  background: var(--paper-2);
  border-radius: 4px;
  flex-shrink: 0;
}
.plugin-card.installed .plugin-card-cat {
  background: rgba(14, 31, 26, 0.08);
}
.plugin-card-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 8px;
}
.plugin-card.installed .plugin-card-desc { color: rgba(14, 31, 26, 0.65); }
.plugin-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.plugin-card-installed-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--success);
  letter-spacing: 0.03em;
}

/* Type badge — บอกว่าเป็น config หรือ AI plugin */
.plugin-type-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.plugin-type-badge.plugin-type-config {
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #78350F;
}
.plugin-type-badge.plugin-type-ai {
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  color: #fff;
}

/* Plugin action button — เพิ่ม/ถอด */
.plugin-card-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.plugin-action-btn {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.plugin-action-install {
  background: var(--ink);
  color: var(--paper);
}
.plugin-action-install:hover {
  background: var(--accent-deep, #047857);
  transform: scale(1.04);
}
.plugin-action-remove {
  background: transparent;
  color: var(--danger, #ef4444);
  border-color: rgba(239, 68, 68, 0.25);
}
.plugin-action-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger, #ef4444);
}

/* Project type chooser in create modal */
.type-chooser {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.type-chooser-card {
  padding: 18px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: left;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-family: inherit;
}
.type-chooser-card:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
}
.type-chooser-card.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--sh-3);
}
.type-chooser-card.active .type-chooser-name { color: var(--accent); }
.type-chooser-card.active .type-chooser-desc { color: rgba(251, 253, 249, 0.7); }
.type-chooser-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.type-chooser-card.active .type-chooser-icon {
  background: rgba(110, 231, 183, 0.2);
}
.type-chooser-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--ink);
}
.type-chooser-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .phone-frame {
    width: 100%;
    max-width: 380px;
    height: auto;
    aspect-ratio: 9 / 19;
  }
  .type-toggle { width: 100%; justify-content: center; }
}

/* ============================================================
   SUBSCRIPTION & BILLING
   ============================================================ */

/* Subscription banner — shown at top of dashboard */
.sub-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-radius: var(--r-md);
  margin: 0 0 24px 0;
  position: relative;
  overflow: hidden;
}
.sub-banner-warning {
  background: linear-gradient(135deg, #FFF4C2, #6EE7B7);
  color: var(--ink);
  border: 1px solid var(--accent-deep);
  box-shadow: 0 4px 16px -4px rgba(52, 211, 153, 0.4);
}
.sub-banner-danger {
  background: linear-gradient(135deg, #FFE5E0, #F8D0CA);
  color: #6B231C;
  border: 1px solid var(--danger);
  box-shadow: 0 4px 16px -4px rgba(200, 72, 61, 0.3);
}
.sub-banner-success {
  background: linear-gradient(135deg, #E0F4E9, #C6EBD2);
  color: #1B5C3A;
  border: 1px solid var(--success);
}
.sub-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.sub-banner-content {
  flex: 1;
  min-width: 0;
}
.sub-banner-title {
  font-size: var(--fs-base);
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}
.sub-banner-desc {
  font-size: var(--fs-sm);
  opacity: 0.85;
  line-height: 1.5;
}
.sub-banner-action {
  flex-shrink: 0;
}

/* Plan badge — small pill showing current plan */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}
.plan-badge.free { background: var(--paper-2); color: var(--muted); }
.plan-badge.pro {
  background: var(--accent-soft);
  color: #6B5410;
  border-color: var(--accent-deep);
}
.plan-badge.business {
  background: var(--ink);
  color: var(--accent);
  border-color: var(--ink);
}

/* Billing toggle */
.billing-toggle {
  display: inline-flex;
  background: var(--paper-2);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 32px;
  position: relative;
  border: 1px solid var(--line-2);
}
.billing-toggle-btn {
  padding: 9px 20px;
  border: 0;
  background: transparent;
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
}
.billing-toggle-btn.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 2px 8px rgba(14, 31, 26, 0.2);
}
.billing-toggle-saving {
  position: absolute;
  top: -10px;
  right: -8px;
  background: var(--accent);
  color: var(--ink);
  font-size: var(--fs-2xs);
  padding: 3px 7px;
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 2px solid var(--paper);
}

/* Pricing grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
}
.pricing-card {
  position: relative;
  padding: 32px 28px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  transition: transform 0.25s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  display: flex;
  flex-direction: column;
}
.pricing-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink-3);
  box-shadow: var(--sh-3);
}
.pricing-card.popular {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  transform: scale(1.03);
  box-shadow: var(--sh-4);
}
.pricing-card.popular:hover {
  transform: scale(1.03) translateY(-3px);
}
.pricing-card.popular .pricing-name { color: var(--accent); }
.pricing-card.popular .pricing-tagline { color: rgba(251, 253, 249, 0.6); }
.pricing-card.popular .pricing-price-amount { color: var(--paper); }
.pricing-card.popular .pricing-price-suffix { color: rgba(251, 253, 249, 0.6); }
.pricing-card.popular .pricing-feature { color: rgba(251, 253, 249, 0.85); border-top-color: rgba(251, 253, 249, 0.1); }
.pricing-card.popular .pricing-feature-check { background: var(--accent); color: var(--ink); }

.pricing-popular-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 99px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.4);
}

.pricing-name {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}
.pricing-tagline {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 18px;
}
.pricing-price {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-bottom: 4px;
}
.pricing-price-currency {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--muted);
}
.pricing-price-amount {
  font-family: var(--font-display);
  font-size: var(--fs-5xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.pricing-price-suffix {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.pricing-yearly-note {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 18px;
  min-height: 17px;
}
.pricing-card.popular .pricing-yearly-note { color: rgba(251, 253, 249, 0.55); }

.pricing-features {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 22px;
  flex: 1;
}
.pricing-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  font-size: 13.5px;
  border-top: 1px solid var(--line-2);
  color: var(--ink);
}
.pricing-feature:first-child { border-top: 0; padding-top: 0; }
.pricing-feature-check {
  width: 20px;
  height: 20px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 10px;
  margin-top: 1px;
}
.pricing-card .btn { width: 100%; padding: 13px; font-size: 14px; }

/* Subscription page header */
.pricing-page-head {
  text-align: center;
  margin-bottom: 28px;
  padding: 40px 24px 0;
}
.pricing-page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 48px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.pricing-page-head h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-deep);
}
.pricing-page-head p {
  font-size: var(--fs-md);
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.55;
}

/* Payment method picker */
.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.payment-method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  background: var(--paper);
  font-family: inherit;
  text-align: left;
  width: 100%;
}
.payment-method:hover {
  border-color: var(--ink-3);
  background: var(--paper-2);
}
.payment-method.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 0 0 3px rgba(14, 31, 26, 0.1);
}
.payment-method.active .payment-method-icon {
  background: rgba(110, 231, 183, 0.15);
}
.payment-method.active .payment-method-desc {
  color: rgba(251, 253, 249, 0.7);
}
.payment-method-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.payment-method-info { flex: 1; min-width: 0; }
.payment-method-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 2px;
}
.payment-method-desc {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.payment-method-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
}
.payment-method.active .payment-method-radio {
  border-color: var(--accent);
  background: var(--accent);
}
.payment-method.active .payment-method-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--ink);
  border-radius: 50%;
}

/* Order summary */
.order-summary {
  padding: 16px 20px;
  background: var(--paper-2);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: var(--fs-sm);
}
.order-row + .order-row { border-top: 1px solid var(--line-2); }
.order-row.total {
  font-size: var(--fs-lg);
  font-weight: 700;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 2px solid var(--ink);
  letter-spacing: -0.01em;
}
.order-row-label { color: var(--muted); }
.order-row.total .order-row-label { color: var(--ink); }
.order-row-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}

/* Credit card form */
.cc-form {
  background: var(--paper-2);
  padding: 18px;
  border-radius: var(--r-md);
  margin-bottom: 18px;
}
.cc-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cc-form .field { margin-bottom: 14px; }
.cc-form .field:last-child { margin-bottom: 0; }

/* QR PromptPay placeholder */
.qr-display {
  background: var(--paper-2);
  padding: 28px;
  border-radius: var(--r-md);
  text-align: center;
  margin-bottom: 18px;
}
.qr-img {
  width: 220px;
  height: 220px;
  background: linear-gradient(135deg, #FFF, #F4F3EE);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  font-size: 90px;
  position: relative;
}
.qr-img::before {
  content: '';
  position: absolute;
  inset: 12px;
  background-image: 
    repeating-linear-gradient(0deg, var(--ink) 0px, var(--ink) 4px, transparent 4px, transparent 12px),
    repeating-linear-gradient(90deg, var(--ink) 0px, var(--ink) 4px, transparent 4px, transparent 12px);
  opacity: 0.85;
  border-radius: 6px;
  -webkit-mask-image: radial-gradient(circle at center, transparent 32px, black 33px);
          mask-image: radial-gradient(circle at center, transparent 32px, black 33px);
}
.qr-img-icon {
  position: relative;
  z-index: 2;
  background: var(--paper);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
}
.qr-amount {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.qr-instr {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.55;
}

/* Bank transfer info */
.bank-info {
  background: var(--paper-2);
  padding: 16px 18px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: var(--fs-sm);
}
.bank-row + .bank-row { border-top: 1px solid var(--line-2); }
.bank-row strong { font-family: var(--font-mono); }

/* Subscription history list */
.billing-history {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
}
.billing-row {
  display: grid;
  grid-template-columns: 38px 1.5fr 1fr 1fr 100px;
  gap: 12px;
  padding: 13px 16px;
  align-items: center;
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-sm);
}
.billing-row:first-child { border-top: 0; }
.billing-row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 16px;
}
.billing-row-name {
  font-weight: 600;
  margin-bottom: 2px;
}
.billing-row-meta {
  font-size: 11px;
  color: var(--muted);
}
.billing-row-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
}
.billing-row-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--success-soft);
  color: var(--success);
}

/* Subscription page (admin overview of all subs) */
.sub-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.sub-stat-card {
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.sub-stat-card-label {
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.sub-stat-card-value {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 4px;
}
.sub-stat-card-trend {
  font-size: var(--fs-2xs);
  color: var(--muted);
}

/* Current plan card (on user's billing page) */
.current-plan-card {
  background: linear-gradient(135deg, var(--ink), var(--ink-2));
  color: var(--paper);
  padding: 24px 26px;
  border-radius: var(--r-lg);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.current-plan-card::after {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(110, 231, 183, 0.18), transparent 65%);
  top: -100px;
  right: -100px;
  pointer-events: none;
}
.current-plan-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  position: relative;
  flex-wrap: wrap;
}
.current-plan-info { flex: 1; min-width: 240px; }
.current-plan-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(251, 253, 249, 0.55);
  margin-bottom: 6px;
}
.current-plan-name {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
  margin-bottom: 12px;
  color: var(--accent);
}
.current-plan-detail {
  font-size: var(--fs-sm);
  color: rgba(251, 253, 249, 0.75);
  margin-bottom: 4px;
}
.current-plan-detail strong { color: var(--paper); font-weight: 600; }
.current-plan-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Expiry meter */
.expiry-meter {
  margin-top: 18px;
  position: relative;
}
.expiry-meter-track {
  height: 6px;
  background: rgba(251, 253, 249, 0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.expiry-meter-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s var(--ease-out);
}
.expiry-meter-fill.warning { background: var(--warning); }
.expiry-meter-fill.danger { background: var(--danger); }
.expiry-meter-text {
  font-size: 12px;
  color: rgba(251, 253, 249, 0.7);
  display: flex;
  justify-content: space-between;
}

/* Project quota bar */
.quota-card {
  padding: 18px 22px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  margin-bottom: 18px;
}
.quota-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.quota-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.quota-card-count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}
.quota-track {
  height: 8px;
  background: var(--paper-2);
  border-radius: 99px;
  overflow: hidden;
}
.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ink), var(--ink-2));
  border-radius: 99px;
  transition: width 0.4s var(--ease-out);
}
.quota-fill.warning { background: linear-gradient(90deg, var(--warning), #B85F05); }
.quota-fill.danger { background: linear-gradient(90deg, var(--danger), #B73A30); }

/* Common consistency overrides */
.field-hint, .design-hint, .ai-hint, .site-meta { font-size: var(--fs-xs); }
.modal-body { font-size: var(--fs-base); }


/* ============================================================
   TICKET / SUPPORT SYSTEM
   ============================================================ */

/* Rail badge for unread tickets */
.rail-badge {
  margin-left: auto;
  background: var(--grad-mint);
  color: var(--ink);
  font-size: var(--fs-2xs);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0;
  min-width: 20px;
  text-align: center;
  display: none;
}
.rail-badge.has-count { display: inline-block; }
.rail-item.active .rail-badge {
  background: var(--paper);
  color: var(--ink);
}

/* Ticket stats grid */
.ticket-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.ticket-stat {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s var(--ease);
}
.ticket-stat:hover {
  border-color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--sh-2);
}
.ticket-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ticket-stat-icon.open { background: var(--info-soft); color: var(--info); }
.ticket-stat-icon.progress { background: var(--warning-soft); color: var(--warning); }
.ticket-stat-icon.resolved { background: var(--success-soft); color: var(--success); }
.ticket-stat-icon.urgent { background: var(--danger-soft); color: var(--danger); }
.ticket-stat-info { flex: 1; min-width: 0; }
.ticket-stat-value {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
}
.ticket-stat-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 3px;
}

/* Tickets list */
.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ticket-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
}
.ticket-card:hover {
  border-color: var(--accent-deep);
  transform: translateX(2px);
  box-shadow: var(--sh-2);
}
.ticket-card.unread {
  border-left: 3px solid var(--accent-deep);
}
.ticket-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.ticket-card-info {
  flex: 1;
  min-width: 0;
}
.ticket-card-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ticket-card-number {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.ticket-card-subject {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ticket-card-row2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.ticket-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ticket-card-time {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--muted-2);
  flex-shrink: 0;
}
.ticket-card-preview {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* Ticket pills (status, priority, category) */
.tk-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.tk-pill.status-open { background: var(--info-soft); color: var(--info); }
.tk-pill.status-in-progress { background: var(--warning-soft); color: var(--warning); }
.tk-pill.status-resolved { background: var(--success-soft); color: var(--success); }
.tk-pill.status-closed { background: var(--paper-2); color: var(--muted); }

.tk-pill.priority-low { background: var(--paper-2); color: var(--muted); }
.tk-pill.priority-medium { background: var(--info-soft); color: var(--info); }
.tk-pill.priority-high { background: var(--warning-soft); color: var(--warning); }
.tk-pill.priority-urgent {
  background: var(--danger);
  color: var(--paper);
  animation: tk-pulse 2s var(--ease-in-out) infinite;
}

@keyframes tk-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

/* Ticket detail / thread */
.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 480px;
  overflow-y: auto;
  padding: 6px 4px;
}
.ticket-msg {
  display: flex;
  gap: 12px;
  animation: msgIn 0.3s var(--ease-out);
}
.ticket-msg.from-admin { flex-direction: row-reverse; }
.ticket-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--paper-2);
  color: var(--ink);
}
.ticket-msg.from-admin .ticket-msg-avatar {
  background: var(--grad-mint);
  color: var(--ink);
}
.ticket-msg-bubble {
  max-width: 78%;
  padding: 11px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.ticket-msg.from-admin .ticket-msg-bubble {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Attachments in messages */
.ticket-msg-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 78%;
}
.ticket-msg-attach img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  cursor: zoom-in;
  transition: transform 0.15s ease, border-color 0.2s ease;
  background: var(--paper-2);
}
.ticket-msg-attach img:hover {
  transform: scale(1.03);
  border-color: var(--accent);
}

/* User context card (admin side) */
.ticket-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  margin: 12px 0;
}
.ticket-user-avatar {
  width: 40px;
  height: 40px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.ticket-user-info {
  flex: 1;
  min-width: 0;
}
.ticket-user-name {
  font-weight: 600;
  font-size: var(--fs-sm);
  margin-bottom: 3px;
  color: var(--ink);
}
.ticket-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--fs-2xs);
  color: var(--muted);
}

/* Project info card */
.ticket-project-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--paper), var(--paper-2));
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--ink);
  border-radius: var(--r);
  margin: 8px 0 12px;
}
.ticket-project-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ticket-project-meta {
  flex: 1;
  min-width: 0;
}
.ticket-project-label {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 600;
}
.ticket-project-name {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink);
  margin-bottom: 3px;
}
.ticket-project-type {
  font-size: var(--fs-2xs);
  color: var(--muted);
}

/* Attach upload zone */
.tk-attach-zone {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tk-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tk-attach-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--paper-2);
}
.tk-attach-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tk-attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  font-family: inherit;
}
.tk-attach-remove:hover {
  background: var(--danger, #dc2626);
}

/* Image lightbox */
.img-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 40px;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.img-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.img-lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
  font-family: inherit;
  backdrop-filter: blur(10px);
}
.img-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}
.ticket-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: var(--fs-2xs);
  color: var(--muted);
}
.ticket-msg-author { font-weight: 600; color: var(--ink); }
.ticket-msg-tag {
  padding: 1px 6px;
  background: var(--ink);
  color: var(--accent);
  border-radius: 4px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ticket-reply-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  margin-top: 12px;
}
.ticket-reply-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--fs-sm);
  resize: vertical;
  min-height: 80px;
  background: var(--paper);
}
.ticket-reply-form textarea:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.ticket-reply-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Ticket detail header */
.ticket-detail-head {
  background: var(--paper-2);
  padding: 16px 20px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.ticket-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.ticket-detail-row:last-child { margin-bottom: 0; }
.ticket-detail-subject {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.ticket-detail-num {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.ticket-detail-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* Ticket category picker (in create modal) */
.tk-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.tk-cat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-family: inherit;
  text-align: left;
  font-size: var(--fs-sm);
}
.tk-cat-card:hover {
  border-color: var(--accent-deep);
  background: var(--paper-2);
}
.tk-cat-card.active {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
  font-weight: 600;
}
.tk-cat-card-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Empty ticket state */
.tickets-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
}
.tickets-empty-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.6; }
.tickets-empty-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

/* Update some general elements to use mint subtly */
.kpi-card-feat {
  background: var(--grad-dark);
}
.kpi-card-feat::after {
  background: var(--grad-glow);
}

/* Mint focus glow on inputs */
.field input:focus,
.field select:focus,
.field textarea:focus,
.input-group input:focus,
.select-min:focus,
.search-box input:focus {
  outline: none;
  border-color: var(--accent-deep);
  background: var(--paper);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ============================================================
   SOCIAL AUTH BUTTONS
   ============================================================ */
.social-auth {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.social-btn:hover { transform: translateY(-1.5px); box-shadow: var(--sh-2); }
.social-btn:active { transform: translateY(0); }

.social-google {
  background: #FFFFFF;
  color: #1F1F1F;
  border-color: #DADCE0;
}
.social-google:hover { background: #F8F9FA; }

.social-facebook {
  background: #1877F2;
  color: #FFFFFF;
}
.social-facebook:hover { filter: brightness(0.92); }

.social-line {
  background: #06C755;
  color: #FFFFFF;
}
.social-line:hover { filter: brightness(0.92); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 18px;
  color: var(--muted-2);
  font-size: var(--fs-xs);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-2);
}
.auth-divider span {
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* OAuth user badge — show on chip when user signed in via provider */
.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.provider-badge.google { background: #FFFFFF; color: #4285F4; border: 1px solid #DADCE0; }
.provider-badge.facebook { background: #1877F2; color: #FFFFFF; }
.provider-badge.line { background: #06C755; color: #FFFFFF; }

/* ============================================================
   MEMBER MANAGEMENT (Admin staff & User team)
   ============================================================ */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.member-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s var(--ease);
}
.member-card:hover {
  border-color: var(--accent-deep);
  box-shadow: var(--sh-2);
}
.member-card.inactive {
  opacity: 0.55;
  background: var(--paper-2);
}
.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grad-mint);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: var(--fs-md);
  font-weight: 700;
  flex-shrink: 0;
}
.member-avatar.staff { background: var(--grad-dark); color: var(--accent); }
.member-info {
  flex: 1;
  min-width: 0;
}
.member-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.member-email {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 6px;
}
.member-role-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: #1B5C3A;
  border: 1px solid var(--accent-deep);
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.member-permissions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.member-perm-chip {
  padding: 2px 7px;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.member-perm-chip.has { color: var(--ink); border-color: var(--accent-deep); background: var(--accent-soft); }
.member-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Permission picker grid */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 12px;
}
.perm-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  font-family: inherit;
  text-align: left;
  user-select: none;
  position: relative;
}
.perm-card:hover {
  border-color: var(--accent-deep);
  background: var(--paper-2);
}
.perm-card.selected {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
}
.perm-card-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 1px;
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: all 0.15s var(--ease);
}
.perm-card.selected .perm-card-check {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}
.perm-card.selected .perm-card-check::after {
  content: '';
  width: 6px;
  height: 9px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.perm-card-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.perm-card-info { flex: 1; min-width: 0; }
.perm-card-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.perm-card-desc {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.5;
}

.perm-section {
  margin-bottom: 8px;
}
.perm-section-head {
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 8px;
}
.perm-section-head:first-child { margin-top: 6px; }

.perm-quick-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.perm-quick-btn {
  padding: 5px 11px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.perm-quick-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-deep);
}

/* Empty members state */
.members-empty {
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 48px 24px;
  text-align: center;
}
.members-empty-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.5; }
.members-empty h3 {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.members-empty p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 16px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}


/* ============================================================
   OAUTH CONFIG CARDS (Admin Settings)
   ============================================================ */
.setting-card-wide {
  grid-column: 1 / -1;
}

.oauth-providers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.oauth-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  display: flex;
  flex-direction: column;
}
.oauth-card:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--sh-3);
}

.oauth-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 2px solid;
  position: relative;
}

.oauth-card-logo {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--r);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.oauth-card-titles {
  flex: 1;
  min-width: 0;
}
.oauth-card-name {
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.oauth-card-status {
  font-size: var(--fs-2xs);
  font-family: var(--font-mono);
}
.oauth-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.18);
}
.oauth-status.connected {
  background: rgba(255, 255, 255, 0.25);
}
.oauth-status.warning {
  background: rgba(255, 255, 255, 0.25);
}
.oauth-status.disabled {
  background: rgba(255, 255, 255, 0.15);
  opacity: 0.85;
}

.oauth-switch {
  flex-shrink: 0;
}

.oauth-card-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.oauth-card-body .field { margin-bottom: 12px; }
.oauth-card-body .field:last-of-type { margin-bottom: 14px; }

.oauth-callback {
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 11px 13px;
  margin-bottom: 14px;
}
.oauth-callback-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.oauth-callback-label .field-hint {
  font-weight: 400;
}
.oauth-callback-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.oauth-callback-url {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 6px 9px;
  overflow-x: auto;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.oauth-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--line-2);
  padding-top: 12px;
  margin-top: 4px;
}
.oauth-actions .btn-accent {
  margin-left: auto;
}


/* ============================================================
   PROJECT BACKEND (CMS)
   ============================================================ */

#backend-page {
  background: var(--paper-2);
  min-height: 100vh;
}

.bk-topbar {
  border-bottom: 1px solid var(--line-2);
  padding: 12px 24px;
}

.bk-project-info {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.bk-project-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}
.bk-project-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 2px;
  line-height: 1.2;
}
.bk-project-type-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  background: var(--accent-soft);
  color: #1B5C3A;
  border: 1px solid var(--accent-deep);
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-left: 6px;
}

.bk-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 64px);
}

.bk-rail {
  background: var(--paper);
  border-right: 1px solid var(--line-2);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.bk-tab {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  background: transparent;
  border: 0;
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s var(--ease);
  letter-spacing: -0.005em;
}
.bk-tab:hover {
  color: var(--ink);
  background: var(--paper-2);
}
.bk-tab.active {
  background: var(--grad-dark);
  color: var(--paper);
  box-shadow: var(--sh-2);
}
.bk-tab.active svg { color: var(--accent); }

/* Tab badge — แสดงตัวเลขข้อความใหม่ */
.bk-tab-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ef4444;
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
  animation: bkBadgePulse 1.5s ease-in-out infinite;
}
@keyframes bkBadgePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15); }
  50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.05); }
}
.bk-tab.active .bk-tab-badge {
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
  animation: none;
}

.bk-main {
  padding: 28px 32px;
  overflow-x: hidden;
}

.bk-section { display: none; }
.bk-section.active { display: block; animation: fadeIn 0.3s var(--ease-out); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bk-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.bk-page-title {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.15;
}
.bk-page-sub {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 4px;
}

/* Stats grid */
.bk-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.bk-stat-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s var(--ease);
}
.bk-stat-card:hover {
  border-color: var(--accent-deep);
  transform: translateY(-1.5px);
  box-shadow: var(--sh-2);
}
.bk-stat-card.attention {
  border-color: var(--warning);
  background: linear-gradient(135deg, var(--paper), var(--warning-soft));
}
.bk-stat-card.revenue {
  background: var(--grad-dark);
  color: var(--paper);
  border-color: var(--ink-3);
}
.bk-stat-card.revenue .bk-stat-label { color: rgba(251, 253, 249, 0.65); }
.bk-stat-card.revenue .bk-stat-value { color: var(--accent); }
.bk-stat-card.revenue .bk-stat-trend { color: rgba(251, 253, 249, 0.55); }

.bk-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--grad-mint);
  color: var(--ink);
}
.bk-stat-card.revenue .bk-stat-icon {
  background: rgba(110, 231, 183, 0.18);
}

.bk-stat-info { flex: 1; min-width: 0; }
.bk-stat-label {
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.bk-stat-value {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 3px;
}
.bk-stat-trend {
  font-size: var(--fs-2xs);
  color: var(--muted);
}

/* Overview panels */
.bk-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.bk-panel {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 18px 20px;
}
.bk-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.bk-panel-head h3 {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.bk-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bk-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper-2);
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.bk-recent-row:hover {
  background: var(--accent-soft);
  transform: translateX(2px);
}
.bk-recent-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--paper);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.bk-recent-info { flex: 1; min-width: 0; }
.bk-recent-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.bk-recent-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.bk-recent-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink);
}

.bk-empty-mini {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  background: var(--paper-2);
  border-radius: var(--r);
}

/* Empty state */
.bk-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
}
.bk-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.55;
}
.bk-empty h3 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}
.bk-empty p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 16px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

/* Categories grid */
.bk-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.bk-category-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition: all 0.2s var(--ease);
}
.bk-category-card:hover {
  border-color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--sh-2);
}
.bk-category-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r);
  background: var(--grad-mint-soft);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.bk-category-info { flex: 1; min-width: 0; }
.bk-category-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}
.bk-category-desc {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.4;
}
.bk-category-count {
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
}
.bk-category-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Products grid */
.bk-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.bk-product-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all 0.2s var(--ease);
}
.bk-product-card:hover {
  border-color: var(--accent-deep);
  transform: translateY(-2px);
  box-shadow: var(--sh-3);
}
.bk-product-card.inactive { opacity: 0.6; }

.bk-product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1.4 / 1;
  background: var(--paper-2);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.bk-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bk-product-no-image {
  font-size: 40px;
  opacity: 0.3;
}
.bk-product-overlay {
  position: absolute;
  inset: 0;
  background: rgba(14, 31, 26, 0.55);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.bk-product-body {
  padding: 14px 16px;
}
.bk-product-name {
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-product-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.bk-product-cat-tag {
  padding: 2px 7px;
  background: var(--paper-2);
  border-radius: 99px;
  font-size: var(--fs-2xs);
  color: var(--muted);
  font-weight: 500;
}
.bk-product-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.bk-product-price {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.bk-product-compare {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--muted);
  text-decoration: line-through;
  margin-left: 6px;
  font-weight: 400;
}
.bk-product-stock {
  font-size: var(--fs-2xs);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.stock-ok { background: var(--success-soft); color: var(--success); }
.stock-low { background: var(--warning-soft); color: var(--warning); }
.stock-out { background: var(--danger-soft); color: var(--danger); }

.bk-product-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Order status pills */
.bk-order-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.bk-order-status.status-pending { background: var(--warning-soft); color: var(--warning); }
.bk-order-status.status-paid { background: var(--info-soft); color: var(--info); }
.bk-order-status.status-processing { background: var(--info-soft); color: var(--info); }
.bk-order-status.status-shipped { background: var(--success-soft); color: var(--success); }
.bk-order-status.status-delivered { background: var(--success-soft); color: var(--success); }
.bk-order-status.status-cancelled { background: var(--danger-soft); color: var(--danger); }

/* Order detail */
.bk-order-detail-head {
  background: var(--paper-2);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.bk-order-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.bk-order-items-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--paper-2);
  border-radius: var(--r-md);
  margin-bottom: 14px;
}

/* Order items in form */
.bk-order-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--paper-2);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  min-height: 60px;
}
.bk-order-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--paper);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}

.bk-order-summary {
  background: var(--paper-2);
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bk-order-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.bk-order-sum-row.total {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink);
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
  margin-top: 4px;
}

/* Status picker */
.bk-status-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bk-status-btn {
  padding: 7px 13px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  color: var(--ink);
}
.bk-status-btn:hover {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
}
.bk-status-btn.active {
  background: var(--grad-dark);
  color: var(--paper);
  border-color: var(--ink);
}

@media (max-width: 900px) {
  .bk-shell { grid-template-columns: 1fr; }
  .bk-rail {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-2);
    padding: 10px 14px;
  }
  .bk-tab { white-space: nowrap; flex-shrink: 0; }
  .bk-overview-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PROJECT BACKEND — MENUS (Multi-level tree)
   ============================================================ */

.bk-rail-divider {
  height: 1px;
  background: var(--line-2);
  margin: 8px 4px;
}

.bk-rail-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3, #94A3B8);
  padding: 6px 12px 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bk-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  font-family: var(--font-sans, 'Sarabun', sans-serif);
}

.bk-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bk-form-grid label span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #0F172A);
}

.bk-form-grid input,
.bk-form-grid select,
.bk-form-grid textarea {
  padding: 10px 12px;
  border: 1px solid var(--line-2, #E5E7EB);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink, #0F172A);
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.bk-form-grid input:focus,
.bk-form-grid select:focus,
.bk-form-grid textarea:focus {
  outline: none;
  border-color: var(--accent, #0EA5E9);
}

.bk-form-grid textarea {
  resize: vertical;
  min-height: 60px;
}

.bk-form-grid .bk-form-grid-full {
  grid-column: 1 / -1;
}

/* ==========================================
   Property Management Table & Toolbar
   ========================================== */
.bk-toolbar {
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.bk-search {
  flex: 1;
  min-width: 240px;
  max-width: 360px;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--line-2, #E5E7EB);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'><circle cx='7' cy='7' r='5' stroke='%2394A3B8' stroke-width='1.6'/><path d='M11 11l3 3' stroke='%2394A3B8' stroke-width='1.6' stroke-linecap='round'/></svg>") no-repeat 12px center;
  color: var(--ink, #0F172A);
  transition: all 0.15s ease;
}

.bk-search:focus {
  outline: none;
  border-color: var(--accent, #0EA5E9);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.bk-search::placeholder {
  color: #94A3B8;
}

.bk-table-wrap {
  background: #fff;
  border: 1px solid var(--line-2, #E5E7EB);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.bk-table {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
  font-size: 14px;
}

.bk-table thead {
  background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
  border-bottom: 2px solid var(--line-2, #E5E7EB);
}

.bk-table thead th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  color: #475569;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bk-table tbody tr {
  border-bottom: 1px solid #F1F5F9;
  transition: background 0.15s ease;
}

.bk-table tbody tr:hover {
  background: #F8FAFC;
}

.bk-table tbody tr:last-child {
  border-bottom: 0;
}

.bk-table tbody td {
  padding: 14px 16px;
  color: var(--ink, #0F172A);
  vertical-align: middle;
}

.bk-table tbody td code {
  background: #F1F5F9;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #475569;
}

.bk-table .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #64748B;
  margin-left: 4px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.bk-table .icon-btn:hover {
  background: #F1F5F9;
  border-color: #E5E7EB;
  color: var(--ink, #0F172A);
}

.bk-table tbody tr td:last-child {
  text-align: right;
  white-space: nowrap;
}

/* Empty state */
.bk-empty {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border: 1px dashed var(--line-2, #E5E7EB);
  border-radius: 14px;
  margin-top: 16px;
}

.bk-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.bk-empty h3 {
  font-size: 16px;
  font-weight: 700;
  color: #475569;
  margin: 0;
}

/* Cards (App Store, etc.) */
.bk-card {
  background: #ffffff;
  border: 1px solid var(--line-2, #E5E7EB);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.bk-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.bk-card-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #0F172A);
  margin: 0;
}

.bk-img-uploader:hover {
  border-color: var(--accent, #0EA5E9) !important;
  background: #F0F9FF !important;
}

.bk-menu-info-bar {
  display: flex;
  gap: 18px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.bk-menu-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: auto;
}
.bk-menu-info-item:last-child { margin-right: 0; margin-left: auto; }
.bk-menu-info-label {
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.bk-menu-info-value {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}

.bk-menu-tree {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 12px 14px;
}

.bk-menu-node {
  position: relative;
}

.bk-menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: var(--r);
  margin-bottom: 4px;
  transition: all 0.15s var(--ease);
}
.bk-menu-row:hover {
  background: var(--paper-2);
  border-color: var(--line-2);
}
.bk-menu-row.hidden-menu { opacity: 0.55; }

.bk-menu-toggle {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s var(--ease);
}
.bk-menu-toggle:hover:not(:disabled) {
  background: var(--paper-3);
  color: var(--ink);
}
.bk-menu-toggle.no-children {
  cursor: default;
  opacity: 0.4;
}
.bk-menu-dot {
  font-size: 14px;
  line-height: 1;
}

.bk-menu-icon {
  font-size: 17px;
  width: 26px;
  height: 26px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bk-menu-icon img {
  display: block;
  border-radius: 6px;
  object-fit: cover;
}

.bk-menu-info {
  flex: 1;
  min-width: 0;
}
.bk-menu-label {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bk-menu-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
  flex-wrap: wrap;
}
.bk-menu-url {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--muted);
  background: var(--paper-2);
  padding: 1px 7px;
  border-radius: var(--r-sm);
  letter-spacing: -0.01em;
}

.bk-menu-lang-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.bk-menu-lang-status.complete {
  background: var(--success-soft);
  color: var(--success);
}
.bk-menu-lang-status.incomplete {
  background: var(--warning-soft);
  color: var(--warning);
}

.bk-menu-hidden-tag {
  padding: 1px 7px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: var(--fs-2xs);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.bk-menu-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.15s var(--ease);
}
.bk-menu-row:hover .bk-menu-actions { opacity: 1; }

/* Tree depth visual indicators with mint accent line */
.bk-menu-children {
  position: relative;
  padding-left: 4px;
}
.bk-menu-children::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 14px;
  width: 1.5px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.35;
  border-radius: 2px;
}

/* Translation modal helpers */
.bk-default-tag {
  padding: 1px 8px;
  background: var(--grad-mint);
  color: var(--ink);
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ============================================================
   PROJECT BACKEND — LANGUAGES
   ============================================================ */

.bk-lang-section {
  margin-bottom: 28px;
}

.bk-lang-section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
}
.bk-lang-section-count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.bk-lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.bk-lang-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
}
.bk-lang-card:hover {
  border-color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--sh-2);
}
.bk-lang-card.enabled {
  background: var(--paper);
  cursor: default;
  border-color: var(--line);
}
.bk-lang-card.enabled:hover {
  transform: none;
}
.bk-lang-card.is-default {
  border-color: var(--accent-deep);
  background: var(--grad-mint-soft);
  box-shadow: var(--sh-2);
}

.bk-lang-flag {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.bk-lang-info {
  flex: 1;
  min-width: 0;
}
.bk-lang-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.bk-lang-code {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.bk-lang-add {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent-deep);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.bk-lang-default-badge {
  padding: 4px 10px;
  background: var(--grad-mint);
  color: var(--ink);
  border-radius: 99px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.bk-lang-help {
  margin-top: 8px;
  padding: 14px 18px;
  background: var(--info-soft);
  border: 1px solid var(--info);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--ink);
  line-height: 1.55;
}
.bk-lang-help strong {
  color: var(--info);
}
.btn-link {
  display: inline;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0 2px;
  color: var(--info);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.btn-link:hover { color: var(--accent-deep); }

/* Template "ready with backend" badge */
.tpl-ready-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: var(--grad-mint);
  color: var(--ink);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 6px;
}

/* Template chooser — backend-ready badge */
.tpl-option.has-backend .tpl-thumb {
  border-color: var(--accent-deep);
}
.tpl-option.has-backend.active .tpl-thumb {
  box-shadow: 0 0 0 2px var(--accent-deep), 0 8px 20px -6px rgba(52, 211, 153, 0.3);
}
.tpl-thumb-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--grad-mint);
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(14, 31, 26, 0.15);
}

/* Preview button overlay on tpl-thumb */
.tpl-thumb {
  position: relative;
}
.tpl-preview-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: rgba(14, 31, 26, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 0;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  z-index: 3;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.tpl-option:hover .tpl-preview-btn {
  opacity: 1;
  transform: translateY(0);
}
.tpl-preview-btn:hover {
  background: var(--ink);
}
.tpl-option.active .tpl-preview-btn {
  opacity: 1;
  transform: translateY(0);
}
@media (hover: none) {
  /* Always show on touch devices */
  .tpl-preview-btn {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   FIREBASE BADGE & UI
   ============================================================ */
.firebase-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #9ca3af;
  color: #fff;
  white-space: nowrap;
  transition: background 0.2s ease;
}
.firebase-status-badge.connected {
  background: #10b981;
}
.firebase-status-badge.not-set {
  background: #9ca3af;
}

.bk-info-banner code {
  background: rgba(0,0,0,0.2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

#bk-firebase pre {
  font-family: 'JetBrains Mono', monospace !important;
}

/* Saved Firebase Configs Library */
.fb-saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fb-saved-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.fb-saved-card:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}
.fb-saved-card.active {
  border-color: #FBBF24;
  background: linear-gradient(135deg, #FFFBEB, var(--paper));
}
.fb-saved-info {
  flex: 1;
  min-width: 0;
}
.fb-saved-name {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink);
  margin-bottom: 4px;
}
.fb-saved-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: var(--fs-2xs);
  color: var(--muted);
  margin-bottom: 3px;
}
.fb-saved-meta code {
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.fb-saved-url {
  font-size: 10px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-saved-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.fb-saved-tag {
  padding: 4px 10px;
  background: #FBBF24;
  color: #0F172A;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-icon-sm {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-icon-sm:hover {
  background: var(--paper-2);
  border-color: var(--ink);
}

/* Data Namespace Card */
.fb-namespace-card {
  background: linear-gradient(135deg, #EFF6FF, #FEFCE8);
  border: 1px solid #FDE68A;
  border-radius: var(--r);
  padding: 14px 16px;
  margin: 12px 0;
}
.fb-namespace-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.fb-namespace-tag {
  padding: 3px 10px;
  background: #FBBF24;
  color: #0F172A;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  letter-spacing: 0.02em;
}
.fb-namespace-desc {
  font-size: var(--fs-2xs);
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.55;
}
.fb-namespace-card .field input {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 12px !important;
}

#firebase-config-form .field {
  margin-bottom: 14px;
}

#firebase-config-form input[type="text"] {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
}

#bk-firebase input[type="text"] {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
}

/* ============================================================
   FIREBASE BOOT SCREEN
   ============================================================ */
.fb-boot {
  position: fixed;
  inset: 0;
  background: #0E1F1A;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.fb-boot.hidden {
  display: none !important;
}
.fb-boot-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(110,231,183,0.15);
  border-radius: 20px;
  padding: 40px 36px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  backdrop-filter: blur(12px);
}
.fb-boot-flame {
  display: inline-flex;
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255,160,0,0.15), rgba(255,111,0,0.05));
  border: 1px solid rgba(255,160,0,0.3);
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: fbBootPulse 2s ease-in-out infinite;
}
@keyframes fbBootPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,160,0,0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 16px rgba(255,160,0,0); }
}
.fb-boot-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 28px;
  color: #fafaf7;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.fb-boot-sub {
  font-size: 14px;
  color: rgba(250,250,247,0.6);
  margin: 0 0 24px;
}
.fb-boot-progress {
  height: 3px;
  background: rgba(110,231,183,0.1);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.fb-boot-progress-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #6EE7B7, transparent);
  width: 30%;
  animation: fbBootSlide 1.2s ease-in-out infinite;
}
@keyframes fbBootSlide {
  0% { left: -30%; }
  100% { left: 100%; }
}
.fb-boot-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 12px;
  padding: 16px;
  margin-top: 20px;
  text-align: left;
}
.fb-boot-error-title {
  color: #fca5a5;
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 6px;
}
.fb-boot-error-msg {
  color: rgba(250,250,247,0.7);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
}
.fb-boot-retry {
  margin-top: 14px;
  padding: 8px 16px;
  background: #6EE7B7;
  color: #0E1F1A;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.fb-boot-retry:hover {
  background: #5dd9a4;
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  transition: .25s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  transition: .25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
  background: #10b981;
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ===== Template Update Banner ===== */
.tpl-update-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(255, 224, 114, 0.15), rgba(245, 200, 66, 0.08));
  border: 1px solid rgba(255, 224, 114, 0.4);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  font-size: 12px;
}
.tpl-update-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.tpl-update-text {
  flex: 1;
  min-width: 0;
}
.tpl-update-title {
  font-weight: 600;
  font-size: 12px;
  color: #92400E;
  margin-bottom: 1px;
}
.tpl-update-desc {
  font-size: 11px;
  color: #6B6B70;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-update-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.tpl-update-actions .btn-update {
  padding: 6px 12px;
  background: #0F0F12;
  color: #FFE072;
  border: 0;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.tpl-update-actions .btn-update:hover {
  background: #2A2A30;
}
.tpl-update-actions .btn-dismiss {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  color: #9A9A9F;
  display: grid;
  place-items: center;
  padding: 0;
  font-family: inherit;
}
.tpl-update-actions .btn-dismiss:hover {
  background: rgba(0,0,0,0.05);
  color: #0F0F12;
}

/* ===== Booking System (Backend tabs: Service Categories, Services, Bookings) ===== */
.bk-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.bk-cat-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.15s var(--ease);
}
.bk-cat-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--sh-2);
}
.bk-cat-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.bk-cat-card-icon {
  width: 40px;
  height: 40px;
  background: var(--paper-2);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.bk-cat-card-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
  color: var(--ink);
}
.bk-cat-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 8px;
}
.bk-cat-card-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bk-info-card {
  background: var(--paper-2);
  border-radius: 10px;
  padding: 12px 14px;
}
.bk-info-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.bk-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* ===== Icon Picker ===== */
.icon-pick-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.icon-pick-search {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s;
}
.icon-pick-search:focus {
  border-color: var(--ink);
}

.icon-pick-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
  scrollbar-width: thin;
}
.icon-pick-tabs::-webkit-scrollbar { height: 4px; }
.icon-pick-tabs::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.icon-pick-tab {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.icon-pick-tab:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.icon-pick-tab.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.icon-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
  background: var(--paper-2);
  border-radius: 10px;
}

.icon-pick-cell {
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 22px;
  display: grid;
  place-items: center;
  transition: all 0.1s ease;
  font-family: inherit;
}
.icon-pick-cell:hover {
  background: var(--paper);
  transform: scale(1.15);
  box-shadow: var(--sh-1);
}
.icon-pick-cell:active {
  transform: scale(0.95);
}

/* ===== Icon Picker — standalone overlay (ไม่ทับ modal เดิม) ===== */
.icon-pick-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;  /* สูงกว่า modal ปกติ (9000-9999) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: iconPickFadeIn 0.15s ease;
}
@keyframes iconPickFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.icon-pick-modal {
  background: var(--paper);
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: iconPickSlideIn 0.2s ease;
}
@keyframes iconPickSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.icon-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}
.icon-pick-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.icon-pick-close {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.icon-pick-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--ink);
}
.icon-pick-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  flex: 1;
}

/* ===== Social API tab ===== */
.bk-social-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bk-social-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.bk-social-card:hover {
  border-color: var(--line-3, var(--ink));
}
.bk-social-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}
.bk-social-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.bk-social-card-name {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.bk-social-card-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.bk-social-card-body {
  padding: 16px 20px;
}

/* Toggle switch (iOS-style) */
.bk-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.bk-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.bk-toggle-slider {
  position: absolute;
  inset: 0;
  background-color: #e5e7eb;
  border-radius: 99px;
  transition: 0.2s;
}
.bk-toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.bk-toggle input:checked + .bk-toggle-slider {
  background-color: var(--accent-deep, #10b981);
}
.bk-toggle input:checked + .bk-toggle-slider:before {
  transform: translateX(18px);
}

/* Status pills */
.bk-status-pill {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border: 2px solid;
}
.bk-status-pill.ready {
  background: #10b981;
  color: #fff;
  border-color: #059669;
}
.bk-status-pill.partial {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FCD34D;
}
.bk-status-pill.off {
  background: #F3F4F6;
  color: #9CA3AF;
  border-color: #E5E7EB;
}

/* ===== Backend Articles Tab ===== */
.bk-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.bk-article-card {
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.bk-article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  border-color: var(--ink);
}
.bk-article-card-cover {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--accent-soft, #d1fae5), var(--accent-deep, #10b981));
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  font-size: 36px;
  color: rgba(255,255,255,0.7);
}
.bk-aigen-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.95);
  color: var(--accent-deep, #065f46);
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.bk-article-card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.bk-article-card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 6px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-article-card-excerpt {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-article-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.bk-article-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
}

/* ===== Deploy Modal ===== */
.deploy-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.deploy-method-card {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  align-items: center;
}
.deploy-method-card:hover {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.deploy-method-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  flex-shrink: 0;
}
.deploy-method-info { flex: 1; min-width: 0; }
.deploy-method-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.deploy-recommended {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  background: var(--accent-deep);
  color: #fff;
  border-radius: 99px;
  text-transform: uppercase;
}
.deploy-method-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}
.deploy-method-features {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.deploy-method-arrow {
  font-size: 28px;
  color: var(--muted);
  flex-shrink: 0;
}

/* Deploy Steps (Firebase) */
.deploy-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.deploy-step {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--paper-2);
  border-radius: 10px;
}
.deploy-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-deep);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.deploy-step-content { flex: 1; min-width: 0; }
.deploy-step-title { font-weight: 700; margin-bottom: 4px; font-size: 14px; }
.deploy-step-desc { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.deploy-code-block {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1f2937;
  color: #f3f4f6;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  margin-top: 4px;
}
.deploy-code-block code {
  flex: 1;
  background: none;
  color: inherit;
  padding: 0;
  font-family: inherit;
}
.deploy-copy-btn {
  background: rgba(255,255,255,0.1);
  color: #f3f4f6;
  border: 0;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.deploy-copy-btn:hover { background: rgba(255,255,255,0.2); }

/* Custom Host Options (collapsible) */
.deploy-host-option {
  margin-bottom: 8px;
  background: var(--paper-2);
  border-radius: 10px;
  overflow: hidden;
}
.deploy-host-option summary {
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  user-select: none;
}
.deploy-host-option summary::-webkit-details-marker { display: none; }
.deploy-host-option[open] summary { border-bottom: 1px solid var(--line-2); }
.deploy-host-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.deploy-host-body { padding: 14px 16px 14px 18px; }
.deploy-ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
}
.deploy-ol li { margin-bottom: 4px; }
.deploy-ol code {
  background: var(--paper);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
}
.deploy-ol a { color: var(--accent-deep); }

/* Hosting Packages */
.deploy-pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.deploy-pkg-card {
  position: relative;
  padding: 18px;
  background: var(--paper);
  border: 2px solid var(--line-2);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
}
.deploy-pkg-card.popular {
  border-color: var(--accent-deep);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
}
.deploy-pkg-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-deep);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  white-space: nowrap;
}
.deploy-pkg-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.deploy-pkg-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  min-height: 32px;
}
.deploy-pkg-price-month {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: -0.02em;
}
.deploy-pkg-price-month span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.deploy-pkg-price-year {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 14px;
}
.deploy-pkg-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  flex: 1;
}
.deploy-pkg-features li {
  font-size: 12px;
  padding: 4px 0;
  color: var(--ink);
}
.deploy-pkg-btn {
  width: 100%;
}

/* Payment */
.deploy-payment-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deploy-payment-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.deploy-payment-card:has(input:checked) {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
}
.deploy-payment-card input { margin: 0; flex-shrink: 0; }
.deploy-payment-info { flex: 1; }
.deploy-payment-name { font-weight: 600; font-size: 14px; }
.deploy-payment-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Bank Info */
.deploy-bank-info {
  background: var(--paper-2);
  padding: 16px;
  border-radius: 10px;
}
.deploy-bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
  gap: 10px;
}
.deploy-bank-row:last-child { border-bottom: 0; }
.deploy-bank-row span { color: var(--muted); }
.deploy-bank-account {
  align-items: center;
}
.deploy-bank-amount strong {
  font-size: 20px;
}

/* Domain Search */
.deploy-domain-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.deploy-domain-result {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--paper-2);
  border-radius: 8px;
  font-size: 13px;
}
.deploy-domain-result.unavailable { opacity: 0.6; }
.deploy-domain-result-name strong {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
}
.deploy-domain-status-ok {
  font-size: 11px;
  color: var(--accent-deep);
  margin-left: 6px;
  font-weight: 600;
}
.deploy-domain-status-no {
  font-size: 11px;
  color: var(--danger);
  margin-left: 6px;
}
.deploy-domain-result-price {
  font-size: 13px;
  color: var(--muted);
}
.deploy-tld-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.deploy-tld-card {
  position: relative;
  padding: 10px 12px;
  background: var(--paper-2);
  border-radius: 8px;
  text-align: center;
}
.deploy-tld-card.popular {
  background: var(--accent-soft);
  border: 1px solid var(--accent-deep);
}
.deploy-tld-name {
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  color: var(--accent-deep);
}
.deploy-tld-price {
  font-size: 12px;
  color: var(--ink);
  margin-top: 2px;
}
.deploy-tld-price span {
  font-size: 10px;
  color: var(--muted);
}
.deploy-tld-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  background: var(--accent-deep);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 99px;
  font-weight: 700;
}

/* Orders List */
.deploy-orders-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.deploy-order-card {
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
}
.deploy-order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
}
.deploy-order-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-deep);
}
.deploy-order-project {
  font-size: 13px;
  margin-top: 2px;
}
.deploy-order-body {
  padding: 10px 14px;
}
.deploy-order-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
}
.deploy-order-row span {
  color: var(--muted);
}

.btn-link {
  color: var(--accent-deep);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
}

/* Deploy active method badge */
.deploy-method-card.is-active {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}
.deploy-active-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  background: var(--accent-deep);
  color: #fff;
  border-radius: 99px;
  text-transform: uppercase;
  margin-left: 6px;
}
.deploy-order-card.is-active-config {
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 1px var(--accent-deep);
}

/* Marketplace mini elements */
.mp-shop-row { display: flex; gap: 10px; align-items: center; }
.mp-shop-logo-mini {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #FE2C5540, #FE2C5580);
  display: grid; place-items: center;
  color: #fff; font-size: 16px;
  flex-shrink: 0;
}
.mp-product-img-mini {
  width: 40px; height: 40px; border-radius: 6px;
  background: var(--paper-2);
  display: grid; place-items: center;
  color: var(--muted); font-size: 18px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

/* ============================================================
   PLUGIN MANAGER (admin)
   ============================================================ */
.pm-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 18px; gap: 16px; flex-wrap: wrap;
}
.pm-title {
  margin: 0 0 4px; font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pm-subtitle { margin: 0; font-size: 13px; color: var(--muted); }
.pm-header-actions { display: flex; gap: 8px; }

.pm-toolbar {
  display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap;
}
.pm-search {
  flex: 1; min-width: 200px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: var(--bg);
  transition: border-color .15s;
}
.pm-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

.pm-categories { display: flex; gap: 6px; flex-wrap: wrap; }
.pm-cat-chip {
  padding: 6px 14px; border: 1px solid var(--border); background: transparent;
  border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--muted); transition: all .15s;
}
.pm-cat-chip:hover { background: var(--bg-soft); color: var(--ink); }
.pm-cat-chip.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  border-color: transparent; box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

.pm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.pm-card {
  display: flex; gap: 12px; padding: 16px;
  background: var(--surface, #fff); border: 1px solid var(--border);
  border-radius: 14px; transition: all .2s; position: relative;
  flex-direction: column;
}
.pm-card:hover {
  border-color: rgba(99,102,241,.4);
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
  transform: translateY(-2px);
}
.pm-card.is-overridden {
  border-color: rgba(245,158,11,.5);
  background: linear-gradient(135deg, rgba(254,243,199,.4), rgba(255,255,255,1) 60%);
}
.pm-card.is-overridden::before {
  content: '✏️'; position: absolute; top: -8px; right: 12px;
  background: #fff; padding: 2px 8px; border-radius: 99px;
  border: 1px solid rgba(245,158,11,.5); font-size: 12px;
}

.pm-card { flex-direction: row; align-items: flex-start; }

.pm-icon-btn {
  position: relative; width: 56px; height: 56px; flex-shrink: 0;
  border: 2px dashed var(--border); border-radius: 14px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; cursor: pointer; transition: all .2s;
}
.pm-icon-btn:hover {
  border-color: var(--accent); border-style: solid;
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(99,102,241,.25);
}
.pm-icon-display { line-height: 1; }
.pm-icon-edit-badge {
  position: absolute; bottom: -4px; right: -4px;
  width: 22px; height: 22px; background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; box-shadow: 0 2px 6px rgba(99,102,241,.4);
  opacity: 0; transition: opacity .15s;
}
.pm-icon-btn:hover .pm-icon-edit-badge { opacity: 1; }

.pm-card-body { flex: 1; min-width: 0; }
.pm-card-name {
  font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-card-meta {
  display: flex; gap: 8px; align-items: center; font-size: 11px;
  color: var(--muted); margin-bottom: 6px;
}
.pm-card-category {
  background: rgba(99,102,241,.1); color: #6366f1;
  padding: 2px 8px; border-radius: 99px; font-weight: 600; text-transform: capitalize;
}
.pm-card-id {
  font-family: 'JetBrains Mono', monospace; opacity: .7; font-size: 10px;
}
.pm-card-desc {
  font-size: 12px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.pm-card-footer {
  position: absolute; bottom: 12px; right: 12px;
  display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--accent-deep);
}
.pm-card-changed {
  background: rgba(245,158,11,.12); padding: 3px 8px; border-radius: 6px;
  font-weight: 600;
}
.pm-reset-btn {
  width: 24px; height: 24px; border: 1px solid var(--border);
  background: #fff; border-radius: 6px; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.pm-reset-btn:hover { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #dc2626; }

.pm-empty {
  grid-column: 1 / -1; padding: 60px 20px; text-align: center;
  background: var(--bg-soft); border-radius: 14px; color: var(--muted);
}
.pm-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }

/* ============================================================
   ICON PICKER MODAL
   ============================================================ */
.pm-picker-preview {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  padding: 20px; margin-bottom: 18px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 14px;
}
.pm-picker-current, .pm-picker-new {
  text-align: center; flex: 1; max-width: 140px;
}
.pm-picker-current-label, .pm-picker-new-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  font-weight: 700; letter-spacing: .08em; margin-bottom: 8px;
}
.pm-picker-current-icon, .pm-picker-new-icon {
  width: 80px; height: 80px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; background: #fff; border-radius: 18px;
  border: 1px solid var(--border);
}
.pm-picker-new-icon {
  background: linear-gradient(135deg, #ddd6fe, #fce7f3);
  border-color: rgba(99,102,241,.4);
  box-shadow: 0 4px 14px rgba(99,102,241,.2);
}
.pm-picker-arrow { font-size: 28px; color: var(--accent); font-weight: 300; }

.pm-picker-custom { margin-bottom: 20px; }
.pm-picker-custom label {
  display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--ink);
}
.pm-picker-custom-row { display: flex; gap: 10px; }
.pm-picker-custom-row input {
  flex: 1; padding: 12px 16px; font-size: 24px; text-align: center;
  border: 2px solid var(--border); border-radius: 10px; background: #fff;
  transition: border-color .15s;
}
.pm-picker-custom-row input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.pm-palette { margin-top: 18px; }
.pm-palette-title {
  font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 12px;
}
.pm-palette-group { margin-bottom: 16px; }
.pm-palette-group-title {
  font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .06em;
}
.pm-palette-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px;
}
.pm-palette-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; transition: all .12s;
  padding: 0;
}
.pm-palette-cell:hover {
  background: rgba(99,102,241,.08); border-color: var(--accent);
  transform: scale(1.15); z-index: 1;
}
.pm-palette-cell.is-selected {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(99,102,241,.4);
  transform: scale(1.1);
}

@media (max-width: 640px) {
  .pm-grid { grid-template-columns: 1fr; }
  .pm-palette-grid { grid-template-columns: repeat(8, 1fr); }
  .pm-palette-cell { font-size: 18px; }
}

/* ============================================================
   PLUGIN MANAGER — Picker mode tabs + SVG grid
   ============================================================ */
.pm-picker-modes {
  display: flex; gap: 8px; margin-bottom: 18px;
  padding: 4px; background: #f1f5f9; border-radius: 12px; width: fit-content;
}
.pm-mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; background: transparent;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  color: #64748b; cursor: pointer; transition: all .15s;
}
.pm-mode-btn:hover { color: #0E1F1A; }
.pm-mode-btn.active {
  background: #0E1F1A; color: #6EE7B7;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

.pm-svg-info {
  font-size: 13px; color: #64748b; margin-bottom: 12px; padding: 10px 14px;
  background: #DCFCE7; border-radius: 10px; border-left: 3px solid #10b981;
}

.pm-svg-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 480px; overflow-y: auto; padding: 4px;
}

.pm-svg-cell {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; background: #fff; border: 2px solid #e5e7eb;
  border-radius: 12px; cursor: pointer; transition: all .15s;
}
.pm-svg-cell:hover {
  border-color: #10b981; transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16,185,129,.15);
}
.pm-svg-cell.is-selected {
  border-color: #10b981; background: #f0fdf4;
  box-shadow: 0 4px 14px rgba(16,185,129,.25);
}
.pm-svg-cell.is-selected::after {
  content: '✓'; position: absolute; top: 4px; right: 6px;
  background: #10b981; color: #fff; width: 20px; height: 20px;
  border-radius: 50%; font-size: 12px; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
}
.pm-svg-cell { position: relative; }
.pm-svg-label {
  font-size: 11px; color: #64748b; text-transform: capitalize;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; font-weight: 500;
}

/* Override pm-icon-display so it doesn't constrain the SVG box */
.pm-icon-btn { padding: 0; background: transparent; border: none; }
.pm-icon-btn .ai-icon { transition: transform .18s ease; }
.pm-icon-btn:hover .ai-icon { transform: scale(1.06); box-shadow: 0 4px 14px rgba(16,185,129,.25); }

/* Plugin marketplace card icon — match app pastel green style */
.plugin-card-icon, .plugin-installed-icon {
  background: #DCFCE7 !important;
  color: #0E1F1A;
}
.plugin-card-icon svg, .plugin-installed-icon svg {
  display: block;
}
.plugin-card.installed .plugin-card-icon {
  background: #BBF7D0 !important;
}

/* Picker preview boxes — let inner span control bg */
.pm-picker-current-icon, .pm-picker-new-icon,
#pm-picker-current-icon, #pm-picker-new-icon {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; height: auto;
}

/* ============================================================
   ICON PICKER — SVG mode (App Icons)
   ============================================================ */
.icon-pick-tab.is-svg-tab {
  background: linear-gradient(135deg, #DCFCE7, #BBF7D0);
  color: #064E3B;
  font-weight: 700;
}
.icon-pick-tab.is-svg-tab.active {
  background: #0E1F1A; color: #6EE7B7;
}

.icon-pick-grid.is-svg-grid {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.icon-pick-cell.is-svg-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; height: auto; aspect-ratio: auto;
  background: #fff; border: 2px solid #e5e7eb; border-radius: 12px;
}
.icon-pick-cell.is-svg-cell:hover {
  border-color: #10b981; transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16,185,129,.15);
  background: #fff;
}
.icon-pick-cell.is-selected {
  border-color: #10b981 !important; background: #f0fdf4 !important;
  box-shadow: 0 4px 14px rgba(16,185,129,.25);
}
.icon-pick-svg-label {
  font-size: 10px; color: #64748b; text-transform: capitalize;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; font-weight: 500; letter-spacing: 0.01em;
}

/* Live preview box in menu form */
#menu-icon-live-preview {
  transition: background 0.18s ease;
}
