/* ============================================================
   VILLAFORGE · ENTERPRISE DESIGN SYSTEM "OBSIDIAN NEON"
   ------------------------------------------------------------
   Token-first Architecture. Alle Farben, Radien, Schatten und
   Bewegungen laufen über Design-Tokens in :root.
   Palette: Obsidian #0B0F17 · Neon Pink #FF2A85 · Cyan #22D3EE
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #0B0F17;
  --bg-elevated: #0F172A;
  --glass: rgba(17, 24, 39, 0.62);
  --glass-2: rgba(23, 32, 51, 0.55);
  --glass-solid: #111827;
  --line: rgba(255, 255, 255, 0.08);
  --line-hover: rgba(255, 42, 133, 0.32);
  --text: #F3F5FB;
  --muted: #98A2BD;
  --muted-2: #6B7490;

  /* Accents */
  --pink: #FF2A85;
  --pink-deep: #FF007F;
  --cyan: #22D3EE;
  --purple: #A78BFA;
  --green: #2EE6A8;
  --warn: #FBBF24;
  --danger: #FB7185;

  /* Glow & Shadows */
  --glow-pink: 0 0 24px rgba(255, 42, 133, 0.35);
  --glow-pink-lg: 0 8px 32px rgba(255, 42, 133, 0.28);
  --shadow-card: 0 18px 48px -18px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 24px 90px -20px rgba(0, 0, 0, 0.7), 0 0 60px -30px rgba(255, 42, 133, 0.4);

  /* Geometry & Motion */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 0.16s var(--ease);
  --t-mid: 0.28s var(--ease);

  /* Type */
  --font-ui: "Plus Jakarta Sans", "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(52% 38% at 18% -4%, rgba(255, 42, 133, 0.09), transparent 68%),
    radial-gradient(46% 34% at 88% 6%, rgba(34, 211, 238, 0.07), transparent 66%),
    radial-gradient(40% 44% at 55% 108%, rgba(167, 139, 250, 0.08), transparent 72%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.1px;
}
body.workspace-open { overflow: hidden; }

::selection { background: rgba(255, 42, 133, 0.35); color: #fff; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--font-mono); font-size: 0.92em; }

/* Refined scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 199, 0.25) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(148, 163, 199, 0.22); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 42, 133, 0.45); }

/* ---------------------------- Aurora backdrop ---------------------------- */
.aurora {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 42% at 14% 4%, rgba(140, 82, 255, 0.16), transparent 72%),
    radial-gradient(44% 38% at 88% 10%, rgba(34, 211, 238, 0.1), transparent 72%),
    radial-gradient(38% 42% at 55% 100%, rgba(255, 42, 133, 0.09), transparent 75%);
  animation: aurora-drift 26s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
  from { filter: hue-rotate(0deg) brightness(1); }
  to { filter: hue-rotate(18deg) brightness(1.12); }
}

/* ---------------------------- Top navigation ---------------------------- */
.topbar {
  height: 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 clamp(18px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 23, 0.72);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand strong { display: block; font-size: 17px; font-weight: 800; letter-spacing: 0.2px; }
.brand small { display: block; color: var(--muted-2); font-size: 9px; letter-spacing: 2.6px; font-weight: 600; }
.logo-mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 13px; color: #fff; font-size: 22px;
  background: linear-gradient(145deg, var(--pink) 0%, #B537F2 55%, var(--cyan) 130%);
  box-shadow: var(--glow-pink), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.brand:hover .logo-mark { transform: scale(1.06) rotate(-3deg); box-shadow: 0 0 32px rgba(255, 42, 133, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.topnav { display: flex; gap: 6px; }
.topnav a {
  position: relative;
  padding: 9px 14px; border-radius: var(--radius-xs);
  color: var(--muted); font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.topnav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.topnav a.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 42, 133, 0.16), rgba(255, 42, 133, 0.07));
  border-color: rgba(255, 42, 133, 0.28);
}
.topnav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, var(--pink), var(--cyan));
  box-shadow: 0 0 10px rgba(255, 42, 133, 0.8);
}
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 12px currentColor; }
.dot.ok { background: var(--green); animation: pulse-dot 2.4s ease-in-out infinite; }
.dot.err { background: var(--danger); }
@keyframes pulse-dot { 50% { box-shadow: 0 0 2px currentColor; opacity: 0.72; } }

/* ---------------------------- Dashboard grid ---------------------------- */
.dashboard {
  width: min(1180px, 100%); margin: auto;
  padding: 32px clamp(16px, 4vw, 40px) 58px;
  display: grid; gap: 18px;
}

/* Glass panel primitive */
.panel-glass {
  position: relative;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.014) 42%, rgba(255, 42, 133, 0.035)),
    var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
.panel-glass::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent 6%, rgba(255, 255, 255, 0.22) 38%, rgba(255, 42, 133, 0.35) 62%, transparent 96%);
  pointer-events: none;
}

/* ---------------------------- Hero ---------------------------- */
.hero {
  min-height: 272px; padding: 38px clamp(24px, 5vw, 58px);
  display: flex; align-items: center; justify-content: space-between;
  overflow: hidden; position: relative;
}
.hero::after {
  content: ""; position: absolute; inset: auto -5% -65% 25%; height: 180%;
  background: radial-gradient(ellipse, rgba(255, 42, 133, 0.12), transparent 66%);
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 7px; color: var(--pink); font-size: 10px;
  letter-spacing: 2.4px; font-weight: 700; text-transform: uppercase;
}
.hero h1 { margin: 0; font-size: clamp(30px, 5vw, 52px); line-height: 1.06; letter-spacing: -1.6px; font-weight: 800; }
.hero h1 span {
  background: linear-gradient(100deg, var(--pink) 10%, var(--purple) 70%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-copy { max-width: 520px; color: var(--muted); margin: 15px 0 22px; font-size: 14.5px; }
.hero-orb {
  width: 185px; height: 185px; margin-right: 5%;
  display: grid; place-items: center; border-radius: 50%; position: relative;
  background:
    radial-gradient(circle at 50% 50%, rgba(34, 211, 238, 0.9) 0 4%, rgba(255, 42, 133, 0.34) 20%, transparent 62%),
    conic-gradient(from 20deg, transparent, var(--cyan), transparent 23%, var(--pink), transparent 59%, var(--green), transparent);
  box-shadow: 0 0 44px rgba(255, 42, 133, 0.3), 0 0 70px rgba(34, 211, 238, 0.18);
  animation: float 7s ease-in-out infinite;
}
.hero-orb::before {
  content: ""; position: absolute; width: 130px; height: 130px;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 50%;
}
.orb-core { font-size: 42px; color: #fff; text-shadow: 0 0 18px #5ef5ff; }
@keyframes float { 50% { transform: translateY(-8px) rotate(8deg); } }

/* ---------------------------- Buttons ---------------------------- */
button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 10px 15px;
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast), background var(--t-fast), filter var(--t-fast);
}
button:hover { transform: translateY(-1px); border-color: var(--line-hover); background: rgba(255, 42, 133, 0.08); }
button:active { transform: translateY(0) scale(0.985); }
button:disabled { opacity: 0.5; cursor: progress; transform: none; box-shadow: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid rgba(255, 42, 133, 0.6); outline-offset: 2px;
}

.primary {
  border: 1px solid rgba(255, 42, 133, 0.55);
  background: linear-gradient(110deg, var(--pink-deep), var(--pink) 55%, #FF5FA8);
  font-weight: 700; color: #fff;
  box-shadow: var(--glow-pink);
}
.primary:hover { box-shadow: var(--glow-pink-lg), inset 0 1px 0 rgba(255, 255, 255, 0.3); border-color: rgba(255, 42, 133, 0.85); background: linear-gradient(110deg, var(--pink-deep), var(--pink) 55%, #FF5FA8); }
.primary span { margin-left: 10px; }
.primary.large { padding: 13px 22px; font-size: 14px; }
.ghost { background: transparent; }
.ghost:hover { background: rgba(255, 255, 255, 0.05); }
.danger {
  border: 1px solid rgba(251, 113, 133, 0.45);
  background: linear-gradient(110deg, #E64560, #F97316);
  font-weight: 700;
  box-shadow: 0 6px 22px rgba(230, 69, 96, 0.28);
}
.compact { padding: 7px 11px; font-size: 12px; }

/* ---------------------------- Metric cards ---------------------------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card {
  display: flex; align-items: center; gap: 13px; padding: 17px;
  border-radius: 15px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)), var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  transition: transform var(--t-mid), border-color var(--t-mid), box-shadow var(--t-mid);
}
.metric-card:hover { transform: translateY(-3px); border-color: var(--line-hover); box-shadow: var(--glow-pink), var(--shadow-card); }
.metric-card b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.metric-card small { color: var(--muted); font-size: 11px; font-weight: 500; }
.metric-icon {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 11px; font-size: 17px;
  border: 1px solid var(--line);
  transition: box-shadow var(--t-mid), transform var(--t-mid);
}
.metric-card:hover .metric-icon { transform: scale(1.08); }
.metric-icon.purple { background: rgba(167, 139, 250, 0.14); color: var(--purple); }
.metric-icon.cyan { background: rgba(34, 211, 238, 0.11); color: var(--cyan); }
.metric-icon.green { background: rgba(46, 230, 168, 0.11); color: var(--green); }
.metric-icon.pink { background: rgba(255, 42, 133, 0.13); color: var(--pink); }
.metric-card:hover .metric-icon.pink { box-shadow: var(--glow-pink); }

/* ---------------------------- Sections ---------------------------- */
.create-panel, .system-section, #villaSection { padding: 24px clamp(18px, 3vw, 30px); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.section-heading h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.section-count {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  padding: 4px 9px; border-radius: 999px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.03);
}
.hint { margin: 5px 0 17px; color: var(--muted); font-size: 13px; }

/* ---------------------------- Forms ---------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.4px; margin-bottom: 12px; text-transform: uppercase; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(8, 12, 22, 0.65); color: var(--text);
  padding: 11px 13px; font: inherit; font-size: 13px; resize: vertical;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus {
  outline: none;
  border-color: rgba(255, 42, 133, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 42, 133, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  background: rgba(8, 12, 22, 0.85);
}
.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 6px; }
.msg { min-height: 18px; color: var(--green); font-size: 12px; }
.msg.err { color: var(--danger); }
.advanced { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.advanced summary {
  color: var(--muted); cursor: pointer; font-size: 12px; margin-bottom: 12px;
  font-weight: 600; letter-spacing: 0.3px;
  transition: color var(--t-fast);
}
.advanced summary:hover { color: var(--pink); }

/* ---------------------------- Villa cards ---------------------------- */
.villa-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.villa-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.008)), var(--glass-2);
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform var(--t-mid), border-color var(--t-mid), box-shadow var(--t-mid);
}
.villa-card::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 1.5px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--pink), var(--cyan), transparent);
  transition: opacity var(--t-mid);
}
.villa-card:hover { transform: translateY(-3px); border-color: var(--line-hover); box-shadow: var(--glow-pink), var(--shadow-card); }
.villa-card:hover::after { opacity: 1; }
.villa-card b { display: block; font-size: 14px; font-weight: 700; }
.villa-card small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.45; }

/* ---------------------------- Badges & status pills ---------------------------- */
.badge, .status-pill {
  white-space: nowrap; padding: 3px 9px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 10px; font-weight: 600;
  font-family: var(--font-mono); letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.035);
}
.badge.RUNNING, .status-pill.RUNNING { color: var(--green); border-color: rgba(46, 230, 168, 0.45); background: rgba(46, 230, 168, 0.09); }
.badge.RUNNING, .status-pill.RUNNING { box-shadow: 0 0 12px rgba(46, 230, 168, 0.18); }
.badge.COMPLETED { color: var(--purple); border-color: rgba(167, 139, 250, 0.4); background: rgba(167, 139, 250, 0.08); }
.badge.FAILED { color: var(--danger); border-color: rgba(251, 113, 133, 0.45); background: rgba(251, 113, 133, 0.08); }
.badge.PAUSED, .badge.PLANNING { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.07); }

/* ---------------------------- Lists & rows ---------------------------- */
.empty-state {
  color: var(--muted-2); padding: 14px 0; font-size: 13px;
  text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-sm);
}
.list { display: grid; gap: 8px; max-height: 390px; overflow: auto; padding-right: 2px; }
.row {
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line); font-size: 12px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.row:hover { border-color: var(--line-hover); background: rgba(255, 42, 133, 0.045); }
.row .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row .sub { white-space: pre-wrap; color: var(--muted); font-size: 11px; margin-top: 4px; line-height: 1.55; }
.row code { color: var(--cyan); background: rgba(34, 211, 238, 0.08); padding: 1px 5px; border-radius: 5px; }
.system-section .row { background: rgba(255, 255, 255, 0.02); }

/* ---------------------------- Skeleton loaders ---------------------------- */
.skeleton {
  position: relative; overflow: hidden;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  min-height: 52px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
  animation: skeleton-shimmer 1.6s linear infinite;
  transform: translateX(-100%);
}
@keyframes skeleton-shimmer { to { transform: translateX(100%); } }
.skeleton.skeleton-line { min-height: 10px; border-radius: 99px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255, 42, 133, 0.22); border-top-color: var(--pink);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------- Footer ---------------------------- */
footer { text-align: center; color: var(--muted-2); font-size: 11px; padding: 22px; border-top: 1px solid var(--line); letter-spacing: 0.4px; }

/* ---------------------------- Workspace overlay ---------------------------- */
.workspace-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 7, 18, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: clamp(0px, 2vw, 22px);
  animation: overlay-in 0.24s var(--ease);
}
@keyframes overlay-in { from { opacity: 0; } }
.workspace-shell {
  height: 100%; max-width: 1400px; margin: auto;
  display: flex; flex-direction: column;
  background: linear-gradient(165deg, #0D1322, #0A0E1B 60%);
  border: 1px solid rgba(255, 42, 133, 0.22);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  border-radius: clamp(0px, 2vw, 20px);
}
.workspace-header {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 43, 0.7);
  backdrop-filter: blur(16px);
}
.workspace-title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.workspace-title h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.4px; }
.workspace-idea { margin: 3px 0 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
.icon-button { font-size: 22px; padding: 5px 10px; background: transparent; border: 0; color: var(--muted); }
.icon-button:hover { color: var(--pink); background: rgba(255, 42, 133, 0.08); transform: none; }
.workspace-actions { display: flex; align-items: center; gap: 8px; }
.workspace-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; flex: 1; }
.workspace-sidebar {
  border-right: 1px solid var(--line); padding: 20px 15px; overflow: auto;
  background: rgba(11, 16, 36, 0.5);
}
.sidebar-section { padding-bottom: 19px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.sidebar-section:last-child { border: 0; }
.sidebar-section .eyebrow { color: var(--pink); font-size: 9px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.stat {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
}
.stat b { display: block; color: var(--text); font-size: 15px; font-weight: 800; margin-top: 2px; letter-spacing: 0; }
.progress-track { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); margin-top: 14px; overflow: hidden; }
.progress-track span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan));
  border-radius: 99px;
  box-shadow: 0 0 12px rgba(255, 42, 133, 0.55);
  transition: width 0.5s var(--ease);
}
.progress-label { font-size: 10px; color: var(--muted); margin: 6px 0 0; font-family: var(--font-mono); }
.suggestion-note { color: var(--muted-2); font-size: 11px; margin: 0 0 10px; }
.suggestion-list { display: grid; gap: 7px; }
.suggestion {
  width: 100%; text-align: left; padding: 9px 10px; font-size: 11px; line-height: 1.35;
  background: rgba(255, 255, 255, 0.03);
}
.suggestion span { display: block; color: var(--pink); font-size: 10px; margin-bottom: 3px; font-weight: 700; }
.suggestion:hover { background: rgba(255, 42, 133, 0.07); }
.side-tab {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px;
  border: 0; background: transparent; color: var(--muted); text-align: left; font-size: 12px;
  border-radius: var(--radius-xs);
}
.side-tab:hover, .side-tab.active {
  background: linear-gradient(90deg, rgba(255, 42, 133, 0.14), rgba(255, 42, 133, 0.03));
  color: var(--text);
}
.side-tab.active { box-shadow: inset 2px 0 0 var(--pink); }
.side-tab span { width: 16px; color: var(--cyan); }
.side-tab em { margin-left: auto; font-style: normal; font-size: 10px; color: var(--muted-2); font-family: var(--font-mono); }
.side-tab.active em { color: var(--pink); }
.workspace-main { min-width: 0; min-height: 0; padding: clamp(18px, 3vw, 34px); overflow: auto; }
.workspace-main .tabpane { display: none; height: 100%; }
.workspace-main .tabpane.active { display: flex; flex-direction: column; animation: pane-in 0.3s var(--ease); }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } }

.chat-heading, .pane-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.chat-heading h3, .pane-heading h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.live-dot { color: var(--green); font-size: 11px; font-family: var(--font-mono); }
.live-dot::before { content: "●"; margin-right: 5px; animation: pulse-dot 1.8s ease-in-out infinite; display: inline-block; }
.pane-caption { color: var(--muted-2); font-size: 11px; font-weight: 500; letter-spacing: 0.3px; }

.chat-log { flex: 1; min-height: 180px; display: grid; align-content: start; gap: 12px; overflow: auto; padding: 4px 5px 18px; }
.bubble {
  max-width: min(700px, 88%); padding: 12px 15px; border-radius: 14px;
  font-size: 13px; line-height: 1.6; white-space: pre-wrap;
  animation: bubble-in 0.3s var(--ease);
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(5px); } }
.bubble.user {
  justify-self: end;
  background: linear-gradient(135deg, rgba(255, 42, 133, 0.32), rgba(181, 55, 242, 0.2));
  border: 1px solid rgba(255, 42, 133, 0.4);
  border-bottom-right-radius: 5px;
}
.bubble.assistant {
  background: rgba(23, 32, 51, 0.75);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.bubble .meta { display: block; color: var(--muted-2); font-size: 10px; margin-bottom: 4px; font-family: var(--font-mono); }
.chat-input { display: grid; grid-template-columns: 1fr 45px; gap: 9px; align-items: end; }
.chat-input textarea { min-height: 50px; max-height: 140px; border-radius: 13px; }
.send-button {
  height: 50px; border: 1px solid rgba(255, 42, 133, 0.5);
  background: linear-gradient(135deg, var(--pink-deep), var(--pink) 70%, #FF5FA8);
  font-size: 22px; color: #fff;
  box-shadow: var(--glow-pink);
}
.send-button:hover { box-shadow: var(--glow-pink-lg); border-color: rgba(255, 42, 133, 0.8); }
.chat-help { margin: 7px 3px 0; color: var(--muted-2); font-size: 10px; font-family: var(--font-mono); }

/* ---------------------------- Login overlay ---------------------------- */
#loginOverlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(7, 10, 20, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: overlay-in 0.24s var(--ease);
}
#loginOverlay .panel-glass { max-width: 400px; width: 100%; padding: 28px; display: grid; gap: 14px; }
#loginOverlay h2 { margin: 6px 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
#loginOverlay label { text-transform: uppercase; }
#loginOverlay button.primary { width: 100%; padding: 12px; }

/* ---------------------------- Responsive ---------------------------- */
@media (max-width: 760px) {
  :root { --mobile-gutter: max(14px, env(safe-area-inset-left)); }
  body { overflow-x: hidden; }
  .topbar { height: 64px; padding-left: var(--mobile-gutter); padding-right: max(14px, env(safe-area-inset-right)); }
  .topnav { display: none; }
  .brand strong { font-size: 15px; }
  .logo-mark { width: 34px; height: 34px; font-size: 20px; }
  .status { font-size: 10px; max-width: 112px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .dashboard { padding: 18px var(--mobile-gutter) calc(40px + env(safe-area-inset-bottom)); gap: 12px; }
  .hero { min-height: 300px; padding: 28px 22px; align-items: flex-start; flex-direction: column; }
  .hero h1 { font-size: 30px; }
  .hero-copy { max-width: 100%; }
  .hero-orb { position: absolute; right: -48px; bottom: -32px; width: 180px; height: 180px; opacity: 0.5; margin: 0; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .metric-card { gap: 7px; padding: 12px 10px; }
  .metric-card b { font-size: 17px; }
  .metric-icon { width: 29px; height: 29px; }
  .form-grid { grid-template-columns: 1fr; }
  .create-panel .actions { grid-template-columns: 1fr; }
  .section-heading h2 { font-size: 16px; }

  .workspace-overlay { padding: 0; }
  .workspace-header { align-items: flex-start; padding: 14px; padding-top: max(14px, env(safe-area-inset-top)); flex-wrap: wrap; }
  .workspace-title h2 { font-size: 16px; }
  .workspace-idea { max-width: calc(100vw - 78px); white-space: nowrap; }
  .workspace-actions { margin: 10px 0 0 43px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
  .workspace-actions button { min-height: 40px; padding: 8px 12px; font-size: 11px; flex: 1; }
  .workspace-actions .status-pill { display: none; }
  .workspace-body { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; }
  .workspace-sidebar {
    flex: 0 0 auto; min-height: 0; max-height: 190px;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 9px var(--mobile-gutter);
    display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: thin;
  }
  .workspace-sidebar .sidebar-section { min-width: 190px; margin: 0; padding: 0; border: 0; }
  .workspace-sidebar .sidebar-section:nth-child(2) { min-width: 220px; }
  .sidebar-links { min-width: max-content !important; display: flex; align-items: flex-start; gap: 4px; }
  .side-tab { min-height: 42px; padding: 9px 10px; white-space: nowrap; width: auto; }
  .side-tab em { display: inline; margin-left: 3px; }
  .side-tab.active { box-shadow: inset 0 -2px 0 var(--pink); }
  .workspace-main { flex: 1 1 auto; width: 100%; height: auto; min-height: 0; padding: 15px var(--mobile-gutter) max(14px, env(safe-area-inset-bottom)); overflow: hidden; }
  .workspace-main .tabpane.active { min-height: 0; }
  .chat-heading, .pane-heading { margin-bottom: 10px; }
  .chat-heading h3, .pane-heading h3 { font-size: 16px; }
  .chat-log { min-height: 0; padding-bottom: 10px; }
  .bubble { max-width: 96%; padding: 11px 12px; font-size: 13px; }
  .chat-input { grid-template-columns: minmax(0, 1fr) 46px; gap: 7px; }
  .chat-input textarea { min-height: 48px; max-height: 110px; }
  .send-button { width: 46px; min-height: 48px; height: 48px; }
  .chat-help { margin-top: 5px; text-align: center; }
  .workspace-main .list { max-height: none; padding-bottom: 10px; }
}

@media (max-width: 430px) {
  .topbar { height: 58px; }
  .hero { min-height: 320px; }
  .hero h1 { font-size: 28px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .suggestion { padding: 8px; }
  .workspace-sidebar { max-height: 176px; }
  .workspace-sidebar .sidebar-section:first-child { min-width: 170px; }
  .workspace-sidebar .sidebar-section:nth-child(2) { min-width: 205px; }
}

@media (max-width: 340px) {
  .workspace-sidebar { max-height: 155px; }
  .workspace-sidebar .sidebar-section:nth-child(2) { min-width: 190px; }
  .side-tab { padding-left: 7px; padding-right: 7px; font-size: 11px; }
}

/* ---------------------------- Accessibility ---------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
