/* ── Reset & base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --border: #2a2a38;
  --text: #e8e8f0;
  --text2: #888898;
  --text3: #555568;
  --accent: #7c6ff7;
  --accent2: #a78bfa;
  --accent-hover: #6b5fe6;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

html.light {
  --bg: #f8f9fc;
  --bg2: #ffffff;
  --bg3: #f0f1f5;
  --border: #e2e4ec;
  --text: #111118;
  --text2: #555570;
  --text3: #9090a8;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--bg3); border-color: var(--text3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-danger { background: transparent; border-color: transparent; color: var(--red); opacity: 0.6; }
.btn-danger:hover { background: rgba(248,113,113,0.1); opacity: 1; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 16px; font-weight: 600; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,0.1); }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text3); }

.error-msg {
  padding: 10px 14px;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
}

.hidden { display: none !important; }
.text-muted { color: var(--text2); }
.loading { color: var(--text3); font-size: 14px; padding: 20px 0; }

/* ────────────────────────────────────────────────────────────────────────────── */
/* LANDING PAGE                                                                   */
/* ────────────────────────────────────────────────────────────────────────────── */

.landing-body { overflow-x: hidden; }

/* Nav */
.lnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
html.light .lnav {
  background: rgba(255,255,255,0.9);
}
html.light .lnav-logo { color: var(--text); }
html.light .lnav-links a { color: var(--text2); }
.lnav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lnav-logo { font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; }
.lnav-links { display: flex; align-items: center; gap: 20px; }
.lnav-links a { color: var(--text2); font-size: 14px; font-weight: 500; text-decoration: none; }
.lnav-links a:hover { color: var(--text); }
/* btn overrides the lnav-links a color rule */
.lnav-links a.btn { color: var(--text); }
.lnav-links a.btn-primary { color: #fff !important; }
.lnav-links a.btn-primary:hover { color: #fff; text-decoration: none; }

/* Hero */
.hero {
  position: relative;
  padding: 100px 24px 80px;
  text-align: center;
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }
.hero-badge {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 24px;
}
.hero-headline {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent2), #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 18px;
  color: var(--text2);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 32px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.hero-note { color: var(--text3); font-size: 13px; }
.hero-glow {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(124,111,247,0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Sections */
.section { padding: 80px 24px; }
.section-alt { background: var(--bg2); }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-title { font-size: clamp(26px, 4vw, 40px); font-weight: 700; text-align: center; margin-bottom: 12px; }
.section-sub { color: var(--text2); text-align: center; font-size: 16px; margin-bottom: 48px; }

/* Steps */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}
.step-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.step-num { font-size: 48px; font-weight: 800; color: var(--border); line-height: 1; margin-bottom: 16px; }
.step-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.step-card p { color: var(--text2); font-size: 14px; line-height: 1.7; }

/* Features grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 0;
}
.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.feature-icon { font-size: 28px; margin-bottom: 14px; }
.feature-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.feature-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.feature-card h4 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { color: var(--text2); font-size: 13px; line-height: 1.6; margin-bottom: 16px; }
.feature-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent2);
  background: rgba(124,111,247,0.1);
  border: 1px solid rgba(124,111,247,0.2);
  border-radius: 4px;
  padding: 2px 8px;
}
.feature-tag--founder {
  color: #f59e0b;
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.25);
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 760px;
  margin: 48px auto 0;
  align-items: start;
}
.pricing-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* ── Founder featured card ── */
.pricing-featured {
  background:
    linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.055) 50%, transparent 65%),
    linear-gradient(145deg, #1c1245 0%, #150e38 50%, #0e0a25 100%);
  background-size: 250% 100%, 100% 100%;
  background-position: 200% 0, 0 0;
  border: 1.5px solid rgba(139,120,255,0.7);
  border-radius: var(--radius-lg);
  padding: 36px;
  position: relative;
  transform: translateY(-10px);
  box-shadow:
    0 0 0 1px rgba(124,111,247,0.25),
    0 20px 60px rgba(124,111,247,0.4),
    0 4px 16px rgba(0,0,0,0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: card-shimmer 4s ease-in-out infinite;
}
.pricing-featured:hover {
  transform: translateY(-16px);
  box-shadow:
    0 0 0 1px rgba(124,111,247,0.4),
    0 28px 72px rgba(124,111,247,0.5),
    0 8px 24px rgba(0,0,0,0.5);
}
@keyframes card-shimmer {
  0%   { background-position: 200% 0, 0 0; }
  60%  { background-position: -200% 0, 0 0; }
  100% { background-position: -200% 0, 0 0; }
}

/* Text overrides for dark featured card */
.pricing-featured h3 { color: #fff; font-size: 22px; }
.pricing-featured .price-amount {
  background: linear-gradient(135deg, #c4b5fd, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pricing-featured .price-period { color: rgba(255,255,255,0.6); }
.pricing-featured .price-desc { color: rgba(255,255,255,0.85); }
.pricing-featured .price-features li { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.08); }
.pricing-featured .price-features li::before { color: #a78bfa; }
.pricing-featured .price-cancel { color: rgba(255,255,255,0.4); }
.pricing-featured .price-topup { color: rgba(255,255,255,0.5); border-color: rgba(255,255,255,0.08); }
.pricing-featured .price-topup-link { color: #a78bfa; }

/* Light mode — keep dark card so it still pops against white */
html.light .pricing-featured {
  background: linear-gradient(145deg, #1c1245 0%, #150e38 50%, #0e0a25 100%);
  box-shadow:
    0 0 0 1px rgba(124,111,247,0.3),
    0 20px 60px rgba(124,111,247,0.35),
    0 4px 20px rgba(0,0,0,0.2);
}
.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #a78bfa, #7c6ff7);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(124,111,247,0.5);
  letter-spacing: 0.03em;
}
.pricing-card h3 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.price { margin-bottom: 6px; }
.price-amount { font-size: 48px; font-weight: 800; }
.price-period { color: var(--text2); font-size: 18px; }
.price-desc { color: var(--text2); font-size: 13px; margin-bottom: 24px; }
.price-features { list-style: none; margin-bottom: 24px; }
.price-features li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.price-features li::before { content: "✓ "; color: var(--green); font-weight: 700; }
.price-desc--day { color: var(--green) !important; font-weight: 600; }
.price-cancel { text-align: center; font-size: 12px; color: var(--text3); margin-top: 10px; margin-bottom: 0; }
.pricing-note { text-align: center; color: var(--text3); font-size: 13px; margin-top: 20px; }
.price-topup { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.07); text-align: center; font-size: 12px; color: var(--text3); }
.price-topup-link { color: var(--accent2); text-decoration: none; font-weight: 600; }
.price-topup-link:hover { text-decoration: underline; }

/* Footer */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 48px 24px;
  text-align: center;
}
.footer-logo { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.footer-tagline { color: var(--text2); font-size: 14px; margin-bottom: 20px; }
.footer-links { display: flex; gap: 24px; justify-content: center; margin-bottom: 20px; }
.footer-links a { color: var(--text2); font-size: 14px; }
.footer-links a:hover { color: var(--text); text-decoration: none; }
.footer-copy { color: var(--text3); font-size: 13px; }

/* ────────────────────────────────────────────────────────────────────────────── */
/* APP (DASHBOARD)                                                                */
/* ────────────────────────────────────────────────────────────────────────────── */

.app-body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Auth */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 200;
  padding: 24px;
}
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth-tagline { color: var(--text2); text-align: center; font-size: 14px; margin-bottom: 28px; }
.auth-tabs { display: flex; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  margin-bottom: -1px;
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.auth-footer { color: var(--text3); font-size: 12px; text-align: center; margin-top: 16px; }

/* App shell */
.app-shell { display: flex; flex-direction: column; height: 100vh; }

/* Nav */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 54px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.app-nav-left { display: flex; align-items: center; gap: 16px; }
.app-logo { font-size: 16px; font-weight: 700; }
.app-nav-right { display: flex; align-items: center; gap: 12px; }
.nav-credits { font-size: 13px; color: var(--accent2); font-weight: 600; }

/* Project switcher */
.project-switcher { position: relative; }
.project-switcher-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.project-switcher-btn:hover { background: var(--bg3); border-color: var(--text3); }
.project-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  padding: 6px;
}
.project-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.project-menu-item:hover { background: var(--bg3); }
.project-menu-item.active { color: var(--accent2); font-weight: 600; }
.project-menu-check { color: var(--accent2); font-size: 12px; }
.project-menu-divider { height: 1px; background: var(--border); margin: 6px 0; }
.project-menu-new {
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.project-menu-new:hover { background: var(--bg3); color: var(--text); }

/* Workspace split layout */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Left: Chat panel */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Resize handle */
.panel-resize-handle {
  width: 12px;
  flex-shrink: 0;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  position: relative;
  transition: background 0.15s;
}
.panel-resize-handle::after {
  content: '';
  display: block;
  width: 3px;
  height: 32px;
  border-left: 1px dotted var(--border);
  border-right: 1px dotted var(--border);
  border-radius: 2px;
  transition: border-color 0.15s;
}
.panel-resize-handle:hover::after,
.panel-resize-handle.dragging::after { border-color: var(--accent); }

/* Right: Operator panel */
.op-panel {
  width: 340px;
  min-width: 160px;
  max-width: 680px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg2);
}

/* Status bar */
.op-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  flex-shrink: 0;
}
.op-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.op-status-dot.idle { background: var(--text3); }
.op-status-dot.working { background: var(--accent2); animation: pulse 1.5s ease-in-out infinite; }
.op-status-dot.done { background: var(--green); }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* Sections — heights controlled by JS resize */
.op-section {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  overflow: hidden;
  flex-shrink: 0;
}
#op-tasks-section      { height: 220px; }
#op-deliverables-section { flex: 1; min-height: 80px; overflow: hidden; }

/* Deliverable info modal (what is this?) */
.deliv-info-modal { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 24px; }
.deliv-info-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.deliv-info-box {
  position: relative; z-index: 1;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.deliv-info-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--border);
}
.deliv-info-title { font-size: 15px; font-weight: 700; }
.deliv-info-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.deliv-info-section {}
.deliv-info-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent2); margin-bottom: 5px; }
.deliv-info-text { font-size: 13px; color: var(--text2); line-height: 1.6; }
.deliv-info-output { font-family: 'Courier New', monospace; font-size: 11px; color: var(--text3); background: var(--bg3); padding: 8px 10px; border-radius: var(--radius); }
.deliv-info-footer { padding: 0 18px 16px; }

/* Vertical resize handle between tasks and deliverables */
.panel-vresize-handle {
  height: 8px;
  flex-shrink: 0;
  cursor: row-resize;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: background 0.15s;
  position: relative;
  z-index: 1;
}
.panel-vresize-handle:hover,
.panel-vresize-handle.dragging { background: var(--bg3); }
.panel-vresize-handle::before {
  content: '';
  width: 28px;
  height: 2px;
  border-radius: 99px;
  background: var(--border);
  transition: background 0.15s;
}
.panel-vresize-handle:hover::before,
.panel-vresize-handle.dragging::before { background: var(--accent); }
.op-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 7px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.op-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.op-done-count {
  font-size: 11px;
  color: var(--text3);
  padding: 6px 10px 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.op-tasks-list { overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.op-deliverables-list { overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.op-empty { color: var(--text3); font-size: 12px; padding: 8px 8px 4px; }

/* Custom scrollbars — thin and dark-themed, app-wide */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.op-tasks-list::-webkit-scrollbar,
.op-deliverables-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.modal-box::-webkit-scrollbar,
.billing-info::-webkit-scrollbar,
.preview-body::-webkit-scrollbar { width: 5px; }
.op-tasks-list::-webkit-scrollbar-track,
.op-deliverables-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.modal-box::-webkit-scrollbar-track,
.billing-info::-webkit-scrollbar-track,
.preview-body::-webkit-scrollbar-track { background: transparent; }
.op-tasks-list::-webkit-scrollbar-thumb,
.op-deliverables-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.modal-box::-webkit-scrollbar-thumb,
.billing-info::-webkit-scrollbar-thumb,
.preview-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.op-tasks-list::-webkit-scrollbar-thumb:hover,
.op-deliverables-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.modal-box::-webkit-scrollbar-thumb:hover,
.billing-info::-webkit-scrollbar-thumb:hover,
.preview-body::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* Operator panel footer */
.op-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  margin-top: auto;
}

/* Compact task rows for op panel */
.op-task {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  transition: border-color 0.15s;
}
.op-task--pending { border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.04); }
.op-task--active  { border-color: rgba(124,111,247,0.3); }
.op-task--done    { opacity: 0.55; }
.op-task--failed  { border-color: rgba(248,113,113,0.3); }
.op-task-top { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.op-task-title { font-size: 12px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-task-status { font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 4px; }
.status-pending_approval .op-task-status-label { color: var(--yellow); }
.status-in_progress .op-task-status-label, .status-approved .op-task-status-label { color: var(--accent2); }
.status-completed .op-task-status-label { color: var(--green); }
.status-failed .op-task-status-label { color: var(--red); }
.op-task-actions { display: flex; gap: 4px; margin-top: 6px; }

/* ── Deliverable folder tree ──────────────────────────────────────────────── */
.deliv-tree { padding: 4px 0; }

/* Folder */
.deliv-folder { margin-bottom: 2px; }
.deliv-folder-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  user-select: none;
  transition: background 0.12s;
}
.deliv-folder-header:hover { background: var(--bg3); }
.deliv-folder-chevron { font-size: 9px; color: var(--text3); transition: transform 0.15s; flex-shrink: 0; }
.deliv-folder.open .deliv-folder-chevron { transform: rotate(90deg); }
.deliv-folder-icon { font-size: 14px; flex-shrink: 0; }
.deliv-folder-meta { flex: 1; min-width: 0; }
.deliv-folder-name { font-size: 12px; font-weight: 700; color: var(--text1); letter-spacing: -0.01em; }
.deliv-folder-desc { font-size: 10px; color: var(--text3); }
.deliv-folder-count {
  font-size: 10px; font-weight: 700; padding: 1px 7px;
  border-radius: 99px; flex-shrink: 0;
}
.deliv-folder-count.none  { background: var(--bg3); color: var(--text3); }
.deliv-folder-count.partial { background: rgba(251,191,36,0.15); color: #b45309; }
.deliv-folder-count.complete { background: rgba(52,211,153,0.15); color: #059669; }

/* Folder children with tree line */
.deliv-folder-children {
  margin-left: 23px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  margin-bottom: 4px;
  display: none;
}
.deliv-folder.open .deliv-folder-children { display: block; }

/* File row */
.deliv-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 0;
  border-radius: var(--radius);
  transition: background 0.12s;
  cursor: default;
}
.deliv-file:hover { background: var(--bg3); }

/* Horizontal tree connector */
.deliv-file::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.deliv-file-icon { font-size: 13px; flex-shrink: 0; }
.deliv-file-info { flex: 1; min-width: 0; }
.deliv-file-name {
  font-size: 11px; font-weight: 600; color: var(--text1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deliv-file-meta { font-size: 10px; color: var(--text3); }
.deliv-file-path { font-size: 10px; color: var(--text3); font-family: 'Courier New', monospace; }

/* Built vs not-built states */
.deliv-file.not-built .deliv-file-name { color: var(--text3); font-weight: 400; }
.deliv-file.not-built .deliv-file-icon { opacity: 0.4; }

/* File action buttons — visible on hover */
.deliv-file-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.deliv-file:hover .deliv-file-actions { opacity: 1; }

.deliv-file-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  color: var(--text2);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.deliv-file-btn:hover { border-color: var(--accent); color: var(--accent2); }
.deliv-file-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.deliv-file-btn.primary:hover { opacity: 0.85; }
.deliv-file-btn.restore { color: var(--green); border-color: rgba(52,211,153,0.4); }
.deliv-file-btn.restore:hover { background: rgba(52,211,153,0.1); border-color: var(--green); }
.deliv-file-btn.build { color: var(--accent2); border-color: rgba(124,111,247,0.4); }
.deliv-file-btn.build:hover { background: rgba(124,111,247,0.08); border-color: var(--accent2); }
.deliv-file-btn.info-btn { color: var(--text3); border-color: var(--border); font-weight: 700; min-width: 20px; text-align: center; }
.deliv-file-btn.info-btn:hover { color: var(--text1); border-color: var(--text3); background: var(--bg3); }
.deliv-file-btn.danger { color: var(--red); border-color: transparent; }
.deliv-file-btn.danger:hover { border-color: rgba(248,113,113,0.4); }

/* Version history row inside a file */
.deliv-versions {
  margin-left: 19px;
  padding-left: 10px;
  border-left: 1px dashed var(--border);
  margin-top: 2px;
}
.deliv-version-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  position: relative;
}
.deliv-version-row::before {
  content: '';
  position: absolute;
  left: -10px; top: 50%;
  width: 8px; height: 1px;
  background: var(--border);
}
.deliv-version-row:hover { background: var(--bg3); }
.deliv-version-label { font-size: 10px; color: var(--text3); flex: 1; }
.deliv-version-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.deliv-version-row:hover .deliv-version-actions { opacity: 1; }

/* Kept for backward compat — legacy flat list */
.op-deliv-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 3px 8px; font-size: 11px; color: var(--text2); cursor: pointer;
  font-family: inherit; flex-shrink: 0; transition: border-color 0.15s, color 0.15s;
}
.op-deliv-btn:hover { border-color: var(--accent); color: var(--accent2); }
.op-deliv-btn--restore { color: var(--green); border-color: rgba(52,211,153,0.3); }
.op-deliv-btn--restore:hover { border-color: var(--green); color: var(--green); background: rgba(52,211,153,0.08); }

/* Badge */
.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Chat panel internals */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-welcome {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  max-width: 600px;
}
.chat-welcome p { color: var(--text2); font-size: 14px; line-height: 1.7; }
.chat-welcome p:first-child { color: var(--text); font-weight: 500; margin-bottom: 6px; }

.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 720px;
}
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.chat-msg.user .chat-avatar { background: var(--accent); border-color: var(--accent); }
.chat-bubble {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chat-bubble p { margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.tab-link { color: var(--accent2); text-decoration: underline; cursor: pointer; font-weight: 500; }
.tab-link:hover { color: #fff; text-decoration: none; }

/* ── Upgrade pill — shown inside chat bubbles when a plan gate fires ──── */
@keyframes pill-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(167,139,250,0.6), 0 3px 14px rgba(124,111,247,0.45);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(167,139,250,0), 0 3px 24px rgba(124,111,247,0.7);
  }
}
@keyframes pill-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
.upgrade-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border: 2px solid rgba(167,139,250,0.5);
  border-radius: 999px;
  background: linear-gradient(
    105deg,
    #6d5ce6 0%,
    #8b5cf6 30%,
    #c4b5fd 50%,
    #8b5cf6 70%,
    #6d5ce6 100%
  );
  background-size: 200% auto;
  color: #fff !important;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  animation: pill-pulse 1.8s ease-in-out infinite, pill-shimmer 3s linear infinite;
  transition: transform 0.15s, border-color 0.15s;
  text-decoration: none;
  margin-top: 8px;
  white-space: nowrap;
}
.upgrade-pill:hover {
  transform: scale(1.06) translateY(-1px);
  border-color: rgba(196,181,253,0.8);
  animation: pill-shimmer 1.5s linear infinite;
  box-shadow: 0 6px 28px rgba(124,111,247,0.75), 0 2px 8px rgba(0,0,0,0.2);
}

/* Subtle "build with current plan" link that appears beside the upgrade pill */
.build-current-link {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  border-bottom: 1px dashed var(--text3);
  cursor: pointer;
  vertical-align: middle;
  opacity: 0.75;
  transition: opacity 0.15s, color 0.15s;
}
.build-current-link:hover {
  opacity: 1;
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--text2);
}
.chat-bubble ul { margin: 0 0 8px 16px; padding: 0; }
.chat-bubble ul:last-child { margin-bottom: 0; }
.chat-bubble li { margin-bottom: 3px; line-height: 1.5; }
.chat-bubble strong { font-weight: 600; color: var(--text); }
.chat-bubble em { font-style: italic; }
.chat-msg.user .chat-bubble strong { color: #fff; }

.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text3);
  border-radius: 50%;
  animation: typing 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

/* Suggestion chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px 48px;
}
.suggestion-chip {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.suggestion-chip:hover {
  border-color: var(--accent);
  background: rgba(124,111,247,0.08);
  transform: translateY(-1px);
}
.suggestion-chip:active { transform: translateY(0); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes taskPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(52,211,153,0); }
}
.chat-task-created {
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--green);
  margin-top: 8px;
  animation: slideUp 0.3s ease, taskPulse 1.5s ease 0.3s 3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-task-created::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  animation: taskPulse 1.5s ease 0.3s 3;
}

.chat-input-wrap {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  background: var(--bg2);
  flex-shrink: 0;
}
#chat-form { display: flex; gap: 10px; align-items: flex-end; }
#chat-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 10px 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 42px;
  max-height: 120px;
}
#chat-input:focus { border-color: var(--accent); }

/* Tasks & deliverables — legacy selectors kept for JS compat */
.tasks-list { display: flex; flex-direction: column; gap: 4px; }
.deliverables-list { display: flex; flex-direction: column; gap: 4px; }

.task-row {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s;
}
.task-row--pending {
  border-color: rgba(251,191,36,0.4);
  background: rgba(251,191,36,0.04);
}
.task-row--done { opacity: 0.7; }
.task-row--failed { border-color: rgba(248,113,113,0.3); }
.task-row-body { flex: 1; min-width: 0; }
.task-row-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.task-row-title { font-size: 14px; font-weight: 600; }
.task-row-status-line { display: flex; align-items: center; gap: 6px; }
.task-status-text { font-size: 12px; color: var(--text3); text-transform: capitalize; }
.status-pending_approval { color: var(--yellow) !important; }
.status-in_progress, .status-approved { color: var(--accent2) !important; }
.status-completed { color: var(--green) !important; }
.status-failed { color: var(--red) !important; }
.task-err { font-size: 12px; color: var(--red); }
.task-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-inline-link {
  background: none;
  border: none;
  color: var(--accent2);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.btn-inline-link:hover { text-decoration: underline; }

.task-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.tag-builder { background: rgba(96,165,250,0.15); color: #60a5fa; }
.tag-growth  { background: rgba(52,211,153,0.15); color: var(--green); }

.spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  opacity: 0.8;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Deliverables tab */
#tab-deliverables { overflow-y: auto; }
.deliverables-list { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 10px; }

.deliv-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.deliv-card-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.deliv-icon { font-size: 26px; flex-shrink: 0; line-height: 1; }
.deliv-info { flex: 1; min-width: 0; }
.deliv-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.deliv-meta { display: flex; gap: 8px; align-items: center; }
.deliv-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(124,111,247,0.15);
  color: var(--accent2);
  text-transform: uppercase;
}
.deliv-date { color: var(--text3); font-size: 12px; }
.deliv-actions { display: flex; gap: 6px; }

/* Billing tab */
#tab-billing { overflow-y: auto; }
.billing-info { padding: 16px 20px 20px; overflow-y: auto; width: 100%; box-sizing: border-box; }
.billing-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
  width: 100%;
  box-sizing: border-box;
}
.billing-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.billing-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.billing-row:last-child { border-bottom: none; }
.billing-row-label { color: var(--text2); font-size: 14px; }
.billing-row-value { font-size: 14px; font-weight: 600; }

/* Billing redesign */
.billing-hero { text-align: center; padding: 20px 0 8px; }
.billing-hero-title { font-size: 22px; font-weight: 800; color: var(--text1); margin-bottom: 6px; }
.billing-hero-sub { font-size: 14px; color: var(--text2); }

.billing-card--highlight { border-color: var(--accent); background: linear-gradient(135deg, var(--bg2) 0%, rgba(124,111,247,0.04) 100%); }
.billing-price-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.billing-price { font-size: 36px; font-weight: 900; color: var(--text1); line-height: 1; }
.billing-price-period { font-size: 16px; font-weight: 400; color: var(--text2); }
.billing-price-day { font-size: 13px; color: var(--green); font-weight: 600; margin-top: 4px; }
.billing-bonus-badge { background: rgba(52,211,153,0.12); border: 1px solid rgba(52,211,153,0.3); color: var(--green); font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: var(--radius); text-align: center; line-height: 1.4; }
.billing-divider { height: 1px; background: var(--border); margin: 16px 0; }

.billing-plan-badge { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--bg3); color: var(--text2); margin-bottom: 8px; }
.billing-plan-badge.active { background: rgba(124,111,247,0.15); color: var(--accent2); }
.billing-plan-badge.payg { background: rgba(52,211,153,0.12); color: var(--green); }
.credits-display { display: flex; align-items: baseline; gap: 4px; margin-bottom: 10px; }
.credits-big { font-size: 40px; font-weight: 800; color: var(--accent2); }
.credits-of { font-size: 14px; color: var(--text2); }
.credits-bar-wrap { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.credits-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width 0.5s; }
.billing-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); }
.billing-credits-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }

.billing-features { list-style: none; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.billing-features li { font-size: 13px; color: var(--text2); display: flex; align-items: flex-start; gap: 8px; }
.billing-features li strong { color: var(--text1); }
.feat-check { color: var(--green); font-weight: 700; flex-shrink: 0; }

.billing-cta { font-size: 15px; padding: 14px; font-weight: 700; letter-spacing: -0.01em; }
.billing-cancel-note { text-align: center; font-size: 11px; color: var(--text3); margin-top: 10px; margin-bottom: 0; }
.btn-glow { box-shadow: 0 0 16px rgba(124,111,247,0.5); transition: box-shadow 0.2s; }
.btn-glow:hover { box-shadow: 0 0 24px rgba(124,111,247,0.75); }

.billing-trial-warning {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; border-radius: 8px; padding: 10px 14px;
  font-size: 13px; font-weight: 500; margin-bottom: 14px;
}
.billing-trial-notice {
  background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.25);
  color: #fbbf24; border-radius: 8px; padding: 10px 14px;
  font-size: 13px; font-weight: 500; margin-bottom: 14px;
}
.billing-site-link {
  display: inline-block; font-size: 13px; font-weight: 600;
  color: var(--accent2); background: rgba(124,111,247,0.1);
  border: 1px solid rgba(124,111,247,0.2); border-radius: 6px;
  padding: 4px 10px; text-decoration: none; word-break: break-all;
}
.billing-site-link:hover { background: rgba(124,111,247,0.18); }

.billing-upgrade-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.billing-upgrade-title { font-size: 15px; font-weight: 700; }
.billing-upgrade-price { font-size: 22px; font-weight: 800; color: var(--accent2); }
.billing-upgrade-price span { font-size: 13px; font-weight: 400; color: var(--text2); }

/* Deploy button */
.op-deploy-btn { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; color: var(--text2); cursor: pointer; transition: all 0.15s; text-align: left; }
.op-deploy-btn:hover { border-color: var(--accent); color: var(--accent2); background: rgba(124,111,247,0.08); }
.op-deploy-btn .deploy-icon { font-size: 14px; }
.op-deploy-btn .deploy-label { flex: 1; font-weight: 500; }
.op-deploy-btn .deploy-url { font-size: 11px; color: var(--accent2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.op-deploy-section { padding: 8px 12px 4px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.op-deploy-btn--accent { border-color: rgba(124,111,247,0.3); color: var(--accent2); }
.op-deploy-btn--accent:hover { border-color: var(--accent); background: rgba(124,111,247,0.12); }

/* Package button in status bar */
.op-pkg-btn { margin-left: auto; font-size: 11px; padding: 3px 10px; opacity: 0.7; }
.op-pkg-btn:hover { opacity: 1; }
.op-collapse-btn { font-size: 13px; padding: 2px 6px; opacity: 0.5; line-height: 1; }
.op-collapse-btn:hover { opacity: 1; }

/* Preview modal */
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
.modal-box {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-box.modal-box--sm { max-width: 460px; width: 460px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-actions { display: flex; gap: 8px; }
.preview-body { flex: 1; overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.preview-body .preview-markdown { padding: 20px; overflow-y: auto; flex: 1; }
.preview-markdown { font-size: 14px; line-height: 1.75; color: var(--text2); }
.preview-markdown h1 { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 12px; }
.preview-markdown h2 { font-size: 17px; font-weight: 700; color: var(--text); margin: 24px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.preview-markdown h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 18px 0 6px; }
.preview-markdown p { margin: 0 0 10px; }
.preview-markdown ul { margin: 0 0 10px 18px; }
.preview-markdown li { margin-bottom: 4px; }
.preview-markdown strong { color: var(--text); font-weight: 600; }
.preview-markdown hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.preview-body pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.7;
  font-family: 'Courier New', monospace;
  color: var(--text2);
}
.preview-body iframe {
  width: 100%;
  flex: 1;
  border: none;
  background: #fff;
  display: block;
  min-height: 500px;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
  font-size: 14px;
}

/* ── Responsive — Landing ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .steps-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr; gap: 24px; }
  .lnav-links a:not(.btn) { display: none; }
  .hero-cta { flex-direction: column; align-items: center; }

  /* Founder card on mobile — slightly lighter purple, no vertical lift, no shimmer flicker */
  .pricing-featured {
    transform: translateY(0) !important;
    background:
      linear-gradient(145deg, #261660 0%, #1a1040 50%, #120c32 100%);
    background-size: 100% 100%;
    animation: none;
    box-shadow:
      0 0 0 1.5px rgba(139,120,255,0.6),
      0 8px 32px rgba(124,111,247,0.35);
  }
  .pricing-featured:hover { transform: translateY(-4px) !important; }
  /* Ensure white text is visible on mobile */
  .pricing-featured h3,
  .pricing-featured .price-period,
  .pricing-featured .price-desc,
  .pricing-featured .price-cancel { color: rgba(255,255,255,0.9) !important; }
  .pricing-featured .price-features li { color: rgba(255,255,255,0.85) !important; }
  /* Badge stays visible — add top margin so it doesn't clip */
  .pricing-featured .pricing-badge { top: -10px; }
}
@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}

/* ── Responsive — App Dashboard ───────────────────────────────────────────────── */

/* Mobile tab bar — hidden on desktop (explicit min-width guard) */
@media (min-width: 769px) {
  .mobile-tab-bar { display: none !important; }
}

@media (max-width: 768px) {

  /* Tab bar — last flex child of app-shell, no position:fixed needed (iOS safe) */
  .mobile-tab-bar {
    display: flex;
    flex-shrink: 0;
    height: 56px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 10;
  }
  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    font-size: 11px;
    font-family: inherit;
    position: relative;
    transition: color 0.15s;
  }
  .mobile-tab--active, .mobile-tab.mobile-tab--active { color: var(--accent2); }
  .mtab-icon { font-size: 18px; line-height: 1; }
  .mtab-label { font-weight: 500; }
  .mtab-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Nav — compact */
  .app-nav { padding: 0 12px; gap: 8px; }
  .app-logo { font-size: 14px; }
  .app-nav-right .btn { padding: 4px 8px; font-size: 12px; }

  /* Workspace — stacking container for sliding panels */
  .workspace {
    position: relative !important;
    overflow: hidden !important;
    min-height: 0 !important; /* critical: allows flex:1 to be bounded by parent height */
  }

  /* Hide all resize handles */
  .panel-resize-handle,
  .panel-vresize-handle { display: none !important; }

  /* Chat panel — visible by default, slides left when hidden */
  .chat-panel {
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    transform: translateX(0) !important;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1) !important;
    z-index: 1;
    border-right: none;
    flex: unset;
    /* Enforce flex column layout so children fill height correctly */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .chat-panel.mobile-hidden {
    transform: translateX(-100%) !important;
  }
  /* Chat messages must fill remaining height and scroll — not collapse to 0 */
  .chat-messages {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  /* Input bar must not grow, always stick to bottom */
  .chat-input-wrap {
    flex-shrink: 0 !important;
  }

  /* Op panel — off-screen right by default, slides in */
  .op-panel {
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    min-width: unset !important;
    max-width: unset !important;
    border-left: none;
    border-top: 1px solid var(--border);
    transform: translateX(100%) !important;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1) !important;
    z-index: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  .op-panel.mobile-active {
    transform: translateX(0) !important;
  }

  /* Op panel internals — natural height so the panel scrolls as one unit */
  .op-section { padding: 12px; }
  .op-footer { padding: 10px 12px; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
  .op-status { padding: 8px 12px; flex-wrap: wrap; flex-shrink: 0; }
  #op-tasks-section { height: auto !important; min-height: unset !important; flex-shrink: 0; }
  #op-deliverables-section { flex: unset !important; min-height: unset !important; overflow: visible !important; }
  .op-deploy-section { flex-shrink: 0; }

  /* Modals — bottom sheet on mobile */
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
  }
  .modal { align-items: flex-end; }

  /* Preview modal — full screen, not a bottom sheet (iframe needs full height) */
  #preview-modal {
    align-items: stretch !important;
    padding: 0 !important;
  }
  #preview-modal .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #preview-modal .preview-body {
    flex: 1 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  /* Chat input */
  .chat-input-wrap { padding: 8px; }
  #chat-input { font-size: 16px; } /* prevent iOS zoom */
}

/* ── Pipeline progress bar ────────────────────────────────────────────────── */
.pipeline-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.pipeline-steps {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}
.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: background 0.15s;
  min-width: 56px;
}
.pipeline-step:hover { background: var(--bg3); }
.pipeline-step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text3);
  transition: all 0.2s;
}
.pipeline-step.done .pipeline-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.pipeline-step-label {
  font-size: 9px;
  color: var(--text3);
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-step.done .pipeline-step-label { color: var(--accent2); }
.pipeline-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 8px;
  max-width: 24px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* ── Onboarding empty state ────────────────────────────────────────────────── */
.onboarding-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  gap: 10px;
  min-height: 0;
}
.onboarding-icon {
  font-size: 32px;
  line-height: 1;
}
.onboarding-step-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent2);
}
/* both class names map to the same style */
.onboarding-headline,
.onboarding-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin: 0;
}
.onboarding-sub {
  font-size: 13px;
  color: var(--text2);
  max-width: 300px;
  line-height: 1.55;
  margin: 0;
}
/* Pipeline row — scrolls horizontally if it overflows */
.onboarding-pipeline {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 6px 0 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
  padding: 4px 0;
}
.onboarding-pipeline::-webkit-scrollbar { display: none; }
/* ob-step: pill with emoji + label */
.ob-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  flex-shrink: 0;
}
.ob-step.done-soon {
  border-color: rgba(124,111,247,0.4);
  color: var(--accent2);
  background: rgba(124,111,247,0.08);
}
/* ob-arrow: connector between steps */
.ob-arrow {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
  padding: 0 1px;
}
/* Chips inside onboarding */
.onboarding-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
  width: 100%;
}
.onboarding-chip {
  padding: 6px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}
.onboarding-chip:hover {
  border-color: var(--accent);
  color: var(--accent2);
  background: rgba(124,111,247,0.08);
}

/* Mobile tweaks for onboarding */
@media (max-width: 768px) {
  .onboarding-empty {
    padding: 24px 16px;
    gap: 8px;
    justify-content: flex-start;
    padding-top: 28px;
  }
  .onboarding-title, .onboarding-headline { font-size: 20px; }
  .onboarding-sub { font-size: 13px; max-width: 100%; }
  .ob-step { font-size: 11px; padding: 4px 8px; }
  .onboarding-chips { gap: 7px; }
  /* Make suggestion chips full-width on mobile for easy tapping */
  .onboarding-chips .suggestion-chip {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* ── Agent activity feed ───────────────────────────────────────────────────── */
.agent-feed {
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.agent-feed.hidden { display: none; }

.agent-feed-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 3px 0;
  transition: opacity 0.3s;
}
.agent-feed-row.current { opacity: 1; }
.agent-feed-row.past:nth-child(2) { opacity: 0.55; }
.agent-feed-row.past:nth-child(3) { opacity: 0.3; }
.agent-feed-row.past:nth-child(4) { opacity: 0.15; }

.agent-feed-icon {
  font-size: 11px;
  margin-top: 1px;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.agent-feed-content {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}
.agent-feed-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent2);
  flex-shrink: 0;
}
.agent-feed-row.past .agent-feed-name { color: var(--text3); }

.agent-feed-msg {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.agent-feed-row.current .agent-feed-msg { color: var(--text); }

.agent-feed-workers {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
  width: 100%;
}
.agent-worker-chip {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── New deliverable highlight (flashes when task completes) ───────────────── */
@keyframes delivNewGlow {
  0%   { background: rgba(124,111,247,0.18); box-shadow: 0 0 0 1px var(--accent); }
  60%  { background: rgba(124,111,247,0.12); box-shadow: 0 0 0 1px var(--accent); }
  100% { background: transparent; box-shadow: none; }
}
.deliv-file.deliv-new {
  animation: delivNewGlow 4s ease-out forwards;
  border-radius: var(--radius);
}
.deliv-file.deliv-new .deliv-file-name {
  color: var(--accent2);
}

/* ── Tag colours — all agents ─────────────────────────────────────────────── */
.tag-engineer { background: rgba(34,211,238,0.15);  color: #22d3ee; }
.tag-legal    { background: rgba(99,102,241,0.15);  color: #818cf8; }
.tag-design   { background: rgba(236,72,153,0.15);  color: #f472b6; }
.tag-product  { background: rgba(20,184,166,0.15);  color: #2dd4bf; }
.tag-pitch    { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.tag-metrics  { background: rgba(16,185,129,0.15);  color: #34d399; }

/* ── Chain queued task state ──────────────────────────────────────────────── */
.op-task--chain-queued {
  opacity: 0.55;
  border-left: 3px solid var(--border);
}
.op-task--chain-queued .op-task-title { color: var(--text3); }
.chain-queued-badge {
  font-size: 10px;
  color: var(--text3);
  padding: 1px 6px;
  background: var(--bg3);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Full-Stack Deploy modal ─────────────────────────────────────────────── */
.fullstack-body { padding: 20px; }
.fullstack-section { margin-bottom: 20px; }
.fullstack-section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 10px;
}
.fullstack-token-row {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
}
.fullstack-token-label {
  font-size: 12px; font-weight: 600; color: var(--text1);
  display: flex; align-items: center; gap: 6px;
}
.fullstack-token-sublabel { font-size: 11px; color: var(--text3); font-weight: 400; }
.fullstack-token-input {
  width: 100%; padding: 8px 10px; background: var(--bg1);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; color: var(--text1); font-family: 'SFMono-Regular', monospace;
  outline: none;
}
.fullstack-token-input:focus { border-color: var(--accent); }
.fullstack-token-saved { color: #34d399; font-size: 11px; }
.fullstack-info {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; font-size: 12px; color: var(--text2); margin-bottom: 16px;
  line-height: 1.7;
}
.fullstack-info strong { color: var(--text1); }
.fullstack-info a { color: var(--accent2); text-decoration: none; }
.fullstack-info a:hover { text-decoration: underline; }
/* Deploy progress */
.fullstack-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.fullstack-step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 13px;
}
.fullstack-step-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.fullstack-step-msg { flex: 1; color: var(--text2); }
.fullstack-step.done   .fullstack-step-icon::before { content: '✓'; color: #34d399; font-size: 14px; }
.fullstack-step.failed .fullstack-step-icon::before { content: '✗'; color: #f87171; font-size: 14px; }
.fullstack-step.skipped .fullstack-step-icon::before { content: '–'; color: var(--text3); font-size: 14px; }
.fullstack-step.running .fullstack-step-icon { animation: spin .8s linear infinite; display: inline-block; }
.fullstack-step.running .fullstack-step-icon::before { content: '⟳'; color: var(--accent2); }
/* Results */
.fullstack-result-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 8px;
}
.fullstack-result-card h4 { font-size: 12px; font-weight: 700; color: var(--text1); margin-bottom: 8px; }
.fullstack-url-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.fullstack-url-label { font-size: 11px; color: var(--text3); width: 80px; flex-shrink: 0; }
.fullstack-url-link { font-size: 12px; color: var(--accent2); word-break: break-all; text-decoration: none; }
.fullstack-url-link:hover { text-decoration: underline; }
.fullstack-db-url {
  font-size: 11px; font-family: monospace; background: var(--bg1);
  border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px;
  word-break: break-all; color: var(--text2); position: relative; margin-top: 4px;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Build Package modal ─────────────────────────────────────────────────── */
.modal-box--md { max-width: 560px; width: 92vw; }
.build-pkg-body { padding: 20px; }
.build-pkg-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text3); margin: 16px 0 8px;
}
.build-pkg-section-label:first-child { margin-top: 0; }
.build-pkg-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  margin-bottom: 6px; cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s;
}
.build-pkg-item:hover { border-color: var(--accent); }
.build-pkg-item.built { opacity: .55; cursor: default; }
.build-pkg-item input[type=checkbox] { flex-shrink: 0; accent-color: var(--accent); width: 15px; height: 15px; }
.build-pkg-item-icon { font-size: 16px; flex-shrink: 0; }
.build-pkg-item-label { flex: 1; font-size: 13px; font-weight: 500; }
.build-pkg-item-built { font-size: 11px; color: #34d399; font-weight: 600; }
.build-pkg-tag {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: var(--bg1); border: 1px solid var(--border);
  color: var(--text2); font-weight: 600; letter-spacing: .04em;
}
.build-pkg-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
  gap: 12px;
}
.build-pkg-cost { font-size: 13px; color: var(--text2); }
.build-pkg-cost strong { color: var(--text1); }

/* ── Analytics modal ──────────────────────────────────────────────────────── */
.modal-box--lg { max-width: 880px; width: 92vw; max-height: 80vh; }
.analytics-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
}
.analytics-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 28px;
}
.analytics-table th {
  text-align: left;
  padding: 6px 10px;
  color: var(--text2);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.analytics-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-score-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.analytics-score-fill {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  min-width: 2px;
}
.run-status-success { color: var(--green); font-weight: 500; }
.run-status-retry   { color: var(--yellow); font-weight: 500; }
.run-status-failed  { color: var(--red); font-weight: 500; }
.analytics-empty {
  text-align: center;
  padding: 40px;
  color: var(--text3);
  font-size: 13px;
}
