/* =============================================================
   HIGH-FIDELITY CLAYMORPHISM DESIGN SYSTEM — popvaultpress.store
   Tactile, soft, buoyant, candy-colored digital clay interface.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&family=Nunito:ital,wght@0,600..900;1,600..900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* Candy Shop Clay Palette */
  --canvas: #F4F1FA;
  --canvas-surface: rgba(255, 255, 255, 0.78);
  --canvas-surface-solid: #FFFFFF;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-bg-elevated: rgba(255, 255, 255, 0.88);
  --inset-bg: #EAE5F4;
  --recessed-bg: #EAE5F4;
  
  --foreground: #332F3A;
  --foreground-bright: #1E1B24;
  --muted: #635F69;
  --line: rgba(124, 58, 237, 0.08);
  --line-strong: rgba(124, 58, 237, 0.16);

  /* Accents */
  --violet: #7C3AED;
  --violet-light: #A78BFA;
  --violet-dark: #6D28D9;
  --pink: #DB2777;
  --pink-light: #F472B6;
  --sky: #0EA5E9;
  --sky-light: #38BDF8;
  --emerald: #10B981;
  --emerald-light: #34D399;
  --amber: #F59E0B;
  --amber-light: #FBBF24;
  --bad: #EF4444;

  /* Primary brand mapping */
  --primary: #7C3AED;
  --primary-gradient: linear-gradient(135deg, #A78BFA 0%, #7C3AED 100%);
  --secondary-gradient: linear-gradient(135deg, #F472B6 0%, #DB2777 100%);
  --sky-gradient: linear-gradient(135deg, #38BDF8 0%, #0EA5E9 100%);
  --emerald-gradient: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  --amber-gradient: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);

  /* High-Fidelity 4-Layer Shadow Architecture */
  --shadow-clay-surface: 
    20px 20px 50px rgba(185, 175, 205, 0.4),
    -18px -18px 40px rgba(255, 255, 255, 0.95),
    inset 6px 6px 14px rgba(124, 58, 237, 0.04),
    inset -6px -6px 14px rgba(255, 255, 255, 0.9);

  --shadow-clay-card: 
    16px 16px 36px rgba(160, 150, 185, 0.28),
    -10px -10px 28px rgba(255, 255, 255, 0.95),
    inset 4px 4px 10px rgba(124, 58, 237, 0.03),
    inset -4px -4px 10px rgba(255, 255, 255, 0.95);

  --shadow-clay-card-hover: 
    20px 24px 44px rgba(140, 125, 175, 0.36),
    -12px -12px 30px rgba(255, 255, 255, 1),
    inset 4px 4px 10px rgba(124, 58, 237, 0.04),
    inset -4px -4px 10px rgba(255, 255, 255, 1);

  --shadow-clay-button: 
    10px 12px 24px rgba(124, 58, 237, 0.32),
    -6px -6px 16px rgba(255, 255, 255, 0.8),
    inset 3px 3px 6px rgba(255, 255, 255, 0.45),
    inset -3px -3px 6px rgba(0, 0, 0, 0.12);

  --shadow-clay-button-hover: 
    14px 16px 28px rgba(124, 58, 237, 0.42),
    -8px -8px 20px rgba(255, 255, 255, 0.9),
    inset 3px 3px 6px rgba(255, 255, 255, 0.55),
    inset -3px -3px 6px rgba(0, 0, 0, 0.14);

  --shadow-clay-btn-sec:
    10px 10px 20px rgba(170, 160, 190, 0.3),
    -6px -6px 16px rgba(255, 255, 255, 0.95),
    inset 3px 3px 6px rgba(255, 255, 255, 0.9),
    inset -3px -3px 6px rgba(160, 150, 180, 0.1);

  --shadow-clay-pressed: 
    inset 8px 8px 16px rgba(165, 155, 185, 0.45),
    inset -8px -8px 16px rgba(255, 255, 255, 0.9);

  --shadow-clay-orb:
    12px 14px 28px rgba(124, 58, 237, 0.3),
    -8px -8px 20px rgba(255, 255, 255, 0.9),
    inset 6px 6px 12px rgba(255, 255, 255, 0.5),
    inset -6px -6px 12px rgba(0, 0, 0, 0.15);

  --shadow-clay-pill:
    6px 6px 14px rgba(160, 150, 180, 0.25),
    -4px -4px 10px rgba(255, 255, 255, 0.9),
    inset 2px 2px 4px rgba(255, 255, 255, 0.8),
    inset -2px -2px 4px rgba(160, 150, 180, 0.1);

  /* Radii */
  --radius-hero: 48px;
  --radius-card: 32px;
  --radius-md: 24px;
  --radius-sm: 20px;
  --radius-pill: 9999px;

  /* Typography */
  --ff-display: 'Nunito', system-ui, -apple-system, sans-serif;
  --ff-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --ff-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="dark"] {
  --canvas: #1A1624;
  --canvas-surface: rgba(35, 30, 48, 0.78);
  --canvas-surface-solid: #231E30;
  --card-bg: rgba(35, 30, 48, 0.75);
  --card-bg-elevated: rgba(43, 37, 60, 0.9);
  --inset-bg: #14111D;
  --recessed-bg: #14111D;
  
  --foreground: #EDE9F6;
  --foreground-bright: #FFFFFF;
  --muted: #A39BB2;
  --line: rgba(167, 139, 250, 0.12);
  --line-strong: rgba(167, 139, 250, 0.24);

  --shadow-clay-surface: 
    20px 20px 50px rgba(0, 0, 0, 0.55),
    -14px -14px 36px rgba(55, 48, 76, 0.35),
    inset 6px 6px 14px rgba(167, 139, 250, 0.06),
    inset -6px -6px 14px rgba(0, 0, 0, 0.4);

  --shadow-clay-card: 
    16px 16px 36px rgba(0, 0, 0, 0.45),
    -8px -8px 24px rgba(60, 52, 82, 0.28),
    inset 3px 3px 8px rgba(167, 139, 250, 0.08),
    inset -3px -3px 8px rgba(0, 0, 0, 0.4);

  --shadow-clay-card-hover: 
    20px 24px 44px rgba(0, 0, 0, 0.6),
    -10px -10px 28px rgba(75, 65, 102, 0.35),
    inset 3px 3px 8px rgba(167, 139, 250, 0.12),
    inset -3px -3px 8px rgba(0, 0, 0, 0.4);

  --shadow-clay-button: 
    10px 12px 24px rgba(124, 58, 237, 0.45),
    -4px -4px 14px rgba(167, 139, 250, 0.2),
    inset 3px 3px 6px rgba(255, 255, 255, 0.35),
    inset -3px -3px 6px rgba(0, 0, 0, 0.35);

  --shadow-clay-button-hover: 
    14px 16px 28px rgba(124, 58, 237, 0.55),
    -6px -6px 18px rgba(167, 139, 250, 0.25),
    inset 3px 3px 6px rgba(255, 255, 255, 0.45),
    inset -3px -3px 6px rgba(0, 0, 0, 0.4);

  --shadow-clay-btn-sec:
    10px 10px 20px rgba(0, 0, 0, 0.4),
    -4px -4px 12px rgba(65, 56, 88, 0.25),
    inset 3px 3px 6px rgba(80, 70, 110, 0.3),
    inset -3px -3px 6px rgba(0, 0, 0, 0.3);

  --shadow-clay-pressed: 
    inset 8px 8px 16px rgba(0, 0, 0, 0.6),
    inset -8px -8px 16px rgba(50, 42, 68, 0.2);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--canvas);
}

body {
  background-color: var(--canvas);
  color: var(--foreground);
  font-family: var(--ff-body);
  font-size: 15px;
  line-height: 1.625;
  -webkit-font-smoothing: antialiased;
  min-width: 320px;
  position: relative;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

/* ---------- Floating Clay Background Blobs ---------- */
.clay-blobs-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.clay-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.22;
  transition: all 0.5s ease;
}

.clay-blob-violet {
  width: 55vw;
  height: 55vw;
  max-width: 680px;
  max-height: 680px;
  background: var(--violet);
  top: -12vw;
  left: -10vw;
  animation: clay-float 14s infinite ease-in-out;
}

.clay-blob-pink {
  width: 48vw;
  height: 48vw;
  max-width: 600px;
  max-height: 600px;
  background: var(--pink);
  top: 35vh;
  right: -10vw;
  animation: clay-float-delayed 16s infinite ease-in-out;
}

.clay-blob-sky {
  width: 45vw;
  height: 45vw;
  max-width: 540px;
  max-height: 540px;
  background: var(--sky);
  bottom: -10vh;
  left: 20vw;
  animation: clay-float 18s infinite ease-in-out;
}

.clay-blob-amber {
  width: 35vw;
  height: 35vw;
  max-width: 420px;
  max-height: 420px;
  background: var(--amber);
  top: 15vh;
  left: 45vw;
  animation: clay-float-slow 20s infinite ease-in-out;
}

@keyframes clay-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(4deg); }
}

@keyframes clay-float-delayed {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-25px) rotate(-4deg); }
}

@keyframes clay-float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  50% { transform: translateY(-35px) rotate(6deg) scale(1.04); }
}

@keyframes clay-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ---------- Typography & Base Styles ---------- */
h1, h2, h3, h4 {
  font-family: var(--ff-display);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.18;
  color: var(--foreground-bright);
}

p { margin: 0 0 10px; }
button { font-family: var(--ff-display); color: inherit; }
a { color: var(--violet); text-decoration: none; font-weight: 600; }
a:hover { color: var(--violet-dark); text-decoration: underline; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.text-violet { color: var(--violet); }
.text-emerald { color: var(--emerald); }
.text-pink { color: var(--pink); }
.text-sky { color: var(--sky); }

/* ---------- Password Authentication Gate ---------- */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--canvas);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.4s ease;
}

.auth-gate.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--card-bg-elevated);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-hero);
  padding: 38px 32px;
  box-shadow: var(--shadow-clay-surface);
  text-align: center;
  position: relative;
  animation: authCardEntrance 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes authCardEntrance {
  from { opacity: 0; transform: scale(0.9) translateY(24px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-card.is-shaking {
  animation: authCardShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes authCardShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.auth-badge-orb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  background: var(--primary-gradient);
  color: #FFFFFF;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-clay-orb);
  animation: clay-breathe 5s infinite ease-in-out;
}

.auth-lock-icon {
  width: 26px;
  height: 26px;
}

.auth-header {
  margin-bottom: 22px;
}

.auth-title {
  font-size: 26px;
  font-weight: 900;
  margin: 6px 0;
  color: var(--foreground-bright);
}

.auth-subtitle {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 auto;
  max-width: 32ch;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  padding-right: 48px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.auth-toggle-pwd {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 6px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  transition: color 0.2s ease, transform 0.2s ease;
}

.auth-toggle-pwd:hover {
  color: var(--violet);
  transform: scale(1.1);
}

.auth-error-msg {
  color: var(--bad);
  font-size: 13px;
  font-weight: 800;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-clay-pill);
}

.auth-submit-btn {
  margin-top: 4px;
}

.auth-footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 6px 14px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- App Shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.app-shell.is-locked {
  filter: blur(10px);
  opacity: 0.2;
  pointer-events: none;
  user-select: none;
}

.sidebar {
  width: 280px;
  flex: none;
  background: var(--canvas-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
  box-shadow: var(--shadow-clay-card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-family: var(--ff-display);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.02em;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-clay-orb);
  animation: clay-breathe 6s infinite ease-in-out;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-text strong {
  font-family: var(--ff-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--foreground-bright);
}
.brand-text small {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--ff-body);
  font-weight: 600;
}

.sidebar-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  background: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item span { flex: 1; }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-clay-pill);
  color: var(--violet);
  transform: translateY(-2px);
}

.nav-item.is-active {
  background: var(--canvas-surface-solid);
  box-shadow: var(--shadow-clay-card);
  color: var(--violet);
  font-weight: 800;
}

.pill {
  font-style: normal;
  font-size: 11px;
  font-family: var(--ff-display);
  font-weight: 800;
  padding: 2px 8px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-pill);
  color: var(--muted);
}
.nav-item.is-active .pill {
  background: var(--violet);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
}

.engine-badge {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--card-bg-elevated);
  box-shadow: var(--shadow-clay-pill);
  border-radius: var(--radius-md);
}

.badge-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  background: var(--secondary-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(219, 39, 119, 0.3);
}

.engine-badge strong {
  display: block;
  font-size: 12px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--foreground-bright);
}
.engine-badge small {
  color: var(--muted);
  font-size: 11px;
}

.muted-note {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  font-weight: 500;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(40, 32, 56, 0.4);
  backdrop-filter: blur(8px);
  z-index: 55;
  border: 0;
}

/* ---------- Main Content Area ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: var(--canvas-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(160, 150, 185, 0.12);
}

.topbar-kicker {
  font-size: 12px;
  font-family: var(--ff-display);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--violet);
  letter-spacing: 0.06em;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}
.topbar-title h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-top: 1px;
}
.topbar-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.menu-btn { display: none; }

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--canvas-surface-solid);
  border: none;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-clay-btn-sec);
  cursor: pointer;
  color: var(--foreground);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.icon-btn:hover {
  transform: translateY(-2px);
  color: var(--violet);
  box-shadow: var(--shadow-clay-card-hover);
}
.icon-btn:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-clay-pressed);
}

.views {
  padding: 32px;
  display: block;
  flex: 1;
}
.view {
  display: none;
  flex-direction: column;
  gap: 26px;
}
.view.is-active { display: flex; }

.app-footer {
  border-top: 1px solid var(--line);
  padding: 20px 32px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  background: var(--canvas-surface);
  backdrop-filter: blur(16px);
}
.app-footer p { margin: 0; }

/* ---------- Squishy Clay Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--canvas-surface-solid);
  box-shadow: var(--shadow-clay-btn-sec);
  cursor: pointer;
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--foreground);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  color: var(--violet);
}
.btn:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-clay-pressed);
}

.btn:focus-visible, .nav-item:focus-visible, .input:focus-visible, .editor:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25), var(--shadow-clay-button);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: var(--shadow-clay-button);
}
.btn-primary:hover {
  color: #FFFFFF;
  box-shadow: var(--shadow-clay-button-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--canvas-surface-solid);
  color: var(--foreground);
  box-shadow: var(--shadow-clay-btn-sec);
}
.btn-secondary:hover {
  box-shadow: var(--shadow-clay-card-hover);
  color: var(--violet);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid rgba(124, 58, 237, 0.15);
  color: var(--violet);
  box-shadow: var(--shadow-clay-pill);
}
.btn-outline:hover {
  border-color: var(--violet);
  background: var(--canvas-surface-solid);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-clay-pill);
  color: var(--violet);
}

.btn-danger-ghost {
  background: rgba(239, 68, 68, 0.08);
  color: var(--bad);
  box-shadow: var(--shadow-clay-pill);
}
.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #DC2626;
  transform: translateY(-2px);
}

.btn-lg { min-height: 52px; padding: 14px 28px; font-size: 16px; border-radius: var(--radius-md); }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-tiny { min-height: 30px; padding: 4px 10px; font-size: 12px; border-radius: var(--radius-pill); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Glass-Clay Cards & Panels ---------- */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-clay-card);
  position: relative;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card:hover {
  box-shadow: var(--shadow-clay-card-hover);
}

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

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.terminal-tag {
  font-size: 11px;
  font-family: var(--ff-display);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--violet);
  letter-spacing: 0.06em;
}
.card-head h3 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tag {
  font-size: 12px;
  font-family: var(--ff-display);
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  color: var(--muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.tag-sm {
  font-size: 11px;
  padding: 2px 8px;
}
.tag-violet {
  color: var(--violet);
  background: rgba(124, 58, 237, 0.1);
  box-shadow: var(--shadow-clay-pill);
}
.tag-sky {
  color: var(--sky);
  background: rgba(14, 165, 233, 0.1);
  box-shadow: var(--shadow-clay-pill);
}
.tag-emerald {
  color: var(--emerald);
  background: rgba(16, 185, 129, 0.1);
  box-shadow: var(--shadow-clay-pill);
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-2-compact { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-editor { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }

.field-optional {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.85;
  text-transform: none;
  letter-spacing: normal;
}

/* ---------- Dashboard Hero ---------- */
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 32px;
  background: var(--card-bg-elevated);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-hero);
  padding: 40px;
  box-shadow: var(--shadow-clay-surface);
  position: relative;
  overflow: hidden;
}

.hero-panel::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--primary-gradient);
  opacity: 0.12;
  filter: blur(40px);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--violet);
  margin-bottom: 12px;
  padding: 6px 14px;
  background: rgba(124, 58, 237, 0.08);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-clay-pill);
}
.clay-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 6px var(--pink);
}

.hero-clay-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--foreground-bright);
  margin-bottom: 14px;
}

.hero-panel p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 60ch;
}

.hero-panel-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.hud-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 10px 16px;
}
.hud-dots {
  display: flex;
  gap: 6px;
}
.hud-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
}
.dot-p { background: var(--pink); }
.dot-v { background: var(--violet); }
.dot-s { background: var(--sky); }
.hud-title {
  font-size: 12px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--muted);
}

.flow {
  list-style: none;
  counter-reset: f;
  margin: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.flow li {
  counter-increment: f;
  background: var(--canvas-surface-solid);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--ff-display);
  font-weight: 700;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: var(--shadow-clay-pill);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.flow li:hover {
  transform: translateX(4px);
  color: var(--violet);
}
.flow li::before {
  content: counter(f, decimal-leading-zero);
  color: #FFFFFF;
  background: var(--primary-gradient);
  font-family: var(--ff-display);
  font-weight: 900;
  font-size: 11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.stat {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow-clay-card);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-clay-card-hover);
}
.stat b {
  display: block;
  font-size: 32px;
  font-family: var(--ff-display);
  font-weight: 900;
  color: var(--violet);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat span {
  color: var(--muted);
  font-size: 13px;
  font-family: var(--ff-display);
  font-weight: 700;
}

/* DB Grid */
.db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.db-item {
  background: var(--canvas-surface-solid);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-clay-pill);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.db-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-clay-card);
}
.db-item b {
  display: block;
  font-size: 20px;
  font-family: var(--ff-display);
  font-weight: 900;
  color: var(--pink);
}
.db-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* Check list */
.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 18px;
}
.check-list li {
  position: relative;
  padding-left: 30px;
  font-size: 14px;
  color: var(--foreground);
  font-weight: 500;
}
.check-list li code {
  font-family: var(--ff-mono);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--recessed-bg);
}
.check-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 2px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--emerald-gradient);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.activity-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--canvas-surface-solid);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow-clay-pill);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.activity-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-clay-card);
}
.activity-row strong {
  color: var(--foreground-bright);
  font-weight: 800;
  font-family: var(--ff-display);
}
.activity-row small {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

/* ---------- Toggle Control Cards ---------- */
.control-box-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.clay-toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--canvas-surface-solid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay-pill);
  cursor: pointer;
  border: 1px solid var(--line);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}
.clay-toggle-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-clay-card);
}
.clay-toggle-card:has(input:checked) {
  background: var(--card-bg-elevated);
  border-color: var(--violet);
  box-shadow: var(--shadow-clay-card-hover);
}

.clay-checkbox {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--violet);
  cursor: pointer;
  flex: none;
}

.clay-toggle-body {
  flex: 1;
  min-width: 0;
}
.clay-toggle-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.clay-toggle-title strong {
  font-size: 13.5px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--foreground-bright);
}
.clay-toggle-title code {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--pink);
}
.clay-toggle-desc {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
  line-height: 1.45;
}
.clay-toggle-desc code {
  font-family: var(--ff-mono);
  font-size: 11px;
}

/* ---------- Brand & Domain Multi-Pair Controls ---------- */
.brand-domain-box {
  background: var(--card-bg-elevated);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-clay-pill);
  border: 1px solid var(--line);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.brand-domain-box.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.5);
}

.brand-domain-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-box-title {
  font-size: 14px;
  font-family: var(--ff-display);
  font-weight: 900;
  color: var(--foreground-bright);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-count-badge {
  font-size: 11px;
  font-family: var(--ff-display);
  font-weight: 800;
  padding: 2px 8px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-pill);
  color: var(--muted);
}

.input-multiline {
  min-height: 80px;
  resize: vertical;
  font-family: var(--ff-mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 14px;
}

.brand-mode-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.brand-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 6px var(--pink);
  flex: none;
}

/* ---------- Editor & Recessed Form Controls ---------- */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--foreground-bright);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--recessed-bg);
  border: none;
  box-shadow: var(--shadow-clay-pressed);
  color: var(--foreground);
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.input:focus {
  background: var(--canvas-surface-solid);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2), var(--shadow-clay-pill);
}
.input-auto { width: auto; min-width: 220px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1;
  min-width: 54px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  cursor: pointer;
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.seg button:hover {
  color: var(--foreground);
}
.seg button.is-on {
  background: var(--canvas-surface-solid);
  box-shadow: var(--shadow-clay-btn-sec);
  color: var(--violet);
  transform: translateY(-2px);
}

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.editor-wrap {
  position: relative;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-md);
  padding: 8px;
  transition: all 0.2s ease;
}
.editor-wrap:focus-within {
  background: var(--canvas-surface-solid);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2), var(--shadow-clay-card);
}
.editor {
  width: 100%;
  min-height: 440px;
  resize: vertical;
  padding: 16px;
  background: transparent;
  border: none;
  color: var(--foreground);
  font-family: var(--ff-mono);
  font-size: 13px;
  line-height: 1.7;
}
.editor:focus { outline: none; }

.parse-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chip {
  font-size: 12px;
  font-family: var(--ff-display);
  font-weight: 700;
  padding: 5px 12px;
  background: var(--canvas-surface-solid);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-clay-pill);
  color: var(--muted);
}
.chip b { color: var(--foreground-bright); font-weight: 800; }
.chip-lock { color: var(--emerald); }
.chip-var { color: var(--violet); }
.chip-brand { color: var(--pink); }

.lock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.switch {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--canvas-surface-solid);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-clay-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.switch:hover {
  transform: translateY(-1px);
}
.switch input {
  margin-top: 3px;
  accent-color: var(--violet);
  width: 16px;
  height: 16px;
  flex: none;
}
.switch.is-forced {
  opacity: 0.85;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
}

.progress {
  margin-top: 16px;
  font-size: 13px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--violet);
}
.progress-bar {
  height: 10px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary-gradient);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
  transition: width 0.2s ease;
}

/* ---------- Results & Variation Cards ---------- */
.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.search {
  position: relative;
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 14px;
  color: var(--violet);
}
.search .input {
  padding-left: 42px;
}
.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.results-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.variation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 22px;
}

.vcard {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-card);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-clay-card);
  position: relative;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vcard:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-clay-card-hover);
}
.vcard.is-selected {
  box-shadow: 0 0 0 3px var(--violet), var(--shadow-clay-card-hover);
}

.vcard-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.vcard-num {
  font-family: var(--ff-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--violet);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.vcard-title {
  font-size: 18px;
  font-weight: 900;
  margin-top: 2px;
  color: var(--foreground-bright);
}

.vcard-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(219, 39, 119, 0.08);
  box-shadow: var(--shadow-clay-pill);
  font-size: 12.5px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--pink);
}
.vcard-brand-pill small {
  color: var(--muted);
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 500;
}

.vcard-niche-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(14, 165, 233, 0.08);
  box-shadow: var(--shadow-clay-pill);
  font-size: 12px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--sky);
}

.uniq {
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  font-family: var(--ff-display);
  background: var(--canvas-surface-solid);
  box-shadow: var(--shadow-clay-btn-sec);
  border-radius: 50%;
  text-align: center;
  line-height: 1.1;
}
.uniq small {
  display: block;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

.swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-sm);
}
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.dna-list {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 6px 12px;
  font-size: 13px;
}
.dna-list dt {
  color: var(--muted);
  font-family: var(--ff-display);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.dna-list dd {
  margin: 0;
  color: var(--foreground);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.vcard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.vcard-actions .btn {
  padding: 6px 12px;
  font-size: 12.5px;
}

.empty {
  text-align: center;
  padding: 56px 24px;
  border-radius: var(--radius-card);
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  color: var(--muted);
  grid-column: 1 / -1;
  width: 100%;
}
.empty strong {
  display: block;
  color: var(--foreground-bright);
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

/* ---------- Templates & History ---------- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}
.tpl {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-card);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-clay-card);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tpl:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-clay-card-hover);
}
.tpl pre {
  margin: 0;
  max-height: 140px;
  overflow: hidden;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-md);
  padding: 12px;
}

.hist {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-clay-card);
  padding: 18px 22px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hist:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-clay-card-hover);
}

.readme {
  font-family: var(--ff-mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-card);
  padding: 20px;
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: 18px;
  color: var(--foreground);
}

/* ---------- Modals ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 24, 44, 0.45);
  backdrop-filter: blur(12px);
}
.modal {
  width: min(960px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--card-bg-elevated);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow-clay-surface);
  border-radius: var(--radius-hero);
  padding: 32px;
  animation: clayModalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes clayModalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.modal-body textarea {
  width: 100%;
  min-height: 420px;
  font-family: var(--ff-mono);
  font-size: 13px;
  line-height: 1.7;
  padding: 18px;
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  border-radius: var(--radius-md);
  border: none;
  color: var(--foreground);
  resize: vertical;
}
.modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.cmp-wrap { overflow-x: auto; padding-bottom: 8px; }
table.cmp {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  font-size: 13px;
  min-width: 640px;
}
table.cmp th, table.cmp td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-radius: var(--radius-sm);
}
table.cmp thead th {
  background: var(--canvas-surface-solid);
  box-shadow: var(--shadow-clay-btn-sec);
  color: var(--violet);
  font-family: var(--ff-display);
  font-weight: 900;
  position: sticky;
  top: 0;
}
table.cmp tbody th {
  background: var(--recessed-bg);
  box-shadow: var(--shadow-clay-pressed);
  color: var(--foreground-bright);
  font-family: var(--ff-display);
  font-weight: 800;
  white-space: nowrap;
}
table.cmp tbody td {
  background: var(--canvas-surface-solid);
  box-shadow: var(--shadow-clay-pill);
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.export-grid .btn {
  flex-direction: column;
  padding: 20px 14px;
  gap: 10px;
  border-radius: var(--radius-md);
}

/* ---------- Toast Notifications ---------- */
.toast-wrap {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, 92vw);
  pointer-events: none;
}
.toast {
  background: var(--card-bg-elevated);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 13.5px;
  font-family: var(--ff-display);
  font-weight: 800;
  color: var(--foreground-bright);
  box-shadow: var(--shadow-clay-card);
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}
.toast.err { color: var(--bad); box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25); }
.toast.ok { color: var(--emerald); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(15px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--recessed-bg);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--violet);
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 1180px) {
  .grid-editor { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .hero-panel { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-104%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-close { display: grid; }
  .menu-btn { display: grid; }
  .topbar-title p { display: none; }
  .views { padding: 20px; }
  .hero-clay-title { font-size: 28px; }
}

@media (max-width: 600px) {
  body { font-size: 14px; }
  .topbar { padding: 12px 18px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 8px 12px; }
  .variation-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .app-footer { padding: 18px; }
  .card { padding: 18px; }
  .editor { min-height: 320px; }
  .grid-2-compact { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
  .dna-list { grid-template-columns: 1fr; gap: 2px; }
  .dna-list dt { margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation: none !important;
    transition: none !important;
  }
}