/* ================================================
   IP 品牌智创 Pro - 深色玻璃拟态主题
   参考: Linear / Notion / Raycast 风格
   ================================================ */

/* ---- CSS Variables ---- */
:root {
  --bg: #07070f;
  --bg-secondary: #0c0c1a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-border: rgba(255, 255, 255, 0.08);
  --bg-glass-strong: rgba(255, 255, 255, 0.10);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);
  --bg-sidebar: rgba(12, 12, 26, 0.92);
  --text: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #6a6a82;
  --accent: #6C5CE7;
  --accent-light: #8b7cf7;
  --accent-dark: #5a4bd4;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --gradient: linear-gradient(135deg, #6C5CE7, #a855f7);
  --gradient-subtle: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(168, 85, 247, 0.10));
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --nav-width: 280px;
  --nav-collapsed: 0px;
  --header-height: 0px;
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover { color: var(--accent); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.20); }

/* ---- Layout ---- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ---- Sidebar Navigation ---- */
.sidebar {
  width: var(--nav-width);
  min-width: var(--nav-width);
  height: 100vh;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar-logo .logo-version {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-glass);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: auto;
  letter-spacing: 0.5px;
}

.sidebar-search {
  padding: 12px 16px;
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition-fast);
}
.sidebar-search input:focus {
  border-color: var(--accent);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.sidebar-search input::placeholder { color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  user-select: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-glass);
  color: var(--text);
}

.nav-item.active {
  background: var(--gradient-subtle);
  color: var(--accent-light);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient);
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  padding: 1px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-footer .nav-item {
  font-size: 13px;
  padding: 8px 14px;
}

/* ---- Main Content Area ---- */
.main-content {
  flex: 1;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px;
  animation: pageEnter 0.35s ease;
}

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

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ---- Hamburger / Mobile Toggle ---- */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}
.mobile-toggle:hover {
  background: var(--bg-card-hover);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}
.card-glass:hover {
  background: var(--bg-glass-strong);
  border-color: rgba(255,255,255,0.15);
}

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0.7;
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

.stat-card .stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--success); background: rgba(16, 185, 129, 0.15); }
.stat-change.down { color: var(--error); background: rgba(239, 68, 68, 0.15); }

/* ---- Feature Card Grid (Home) ---- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.15);
}
.feature-card .fc-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}
.feature-card .fc-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.feature-card .fc-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  outline: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-glass-strong);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-glass);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition-fast);
  line-height: 1.5;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236a6a82' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---- Tags / Badges ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.tag-accent { background: rgba(108, 92, 231, 0.15); color: var(--accent-light); }
.tag-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.tag-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.tag-error { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.tag-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

/* ---- Chat UI ---- */
.chat-layout {
  display: flex;
  height: 100%;
  gap: 0;
  margin: -28px -32px -40px;
}

.chat-sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-sidebar-title {
  font-size: 14px;
  font-weight: 600;
}

.chat-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-session-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-session-item:hover { background: var(--bg-glass); color: var(--text); }
.chat-session-item.active { background: var(--gradient-subtle); color: var(--accent-light); }

.chat-session-item .session-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-glass-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  animation: msgEnter 0.3s ease;
}

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

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-avatar.bot {
  background: var(--gradient);
  color: #fff;
}

.chat-avatar.user {
  background: var(--bg-glass-strong);
  color: var(--text);
}

.chat-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  position: relative;
}

.chat-message.bot .chat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}

.chat-message.user .chat-bubble {
  background: var(--gradient-subtle);
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-top-right-radius: 4px;
  color: var(--text);
}

.chat-message.user .chat-bubble .msg-time {
  text-align: right;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.chat-input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  transition: var(--transition-fast);
}
.chat-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  outline: none;
  padding: 4px 8px;
  max-height: 120px;
  line-height: 1.5;
}

.chat-input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.chat-input-wrapper .btn {
  flex-shrink: 0;
}

.chat-input-actions {
  display: flex;
  gap: 6px;
  padding: 4px 4px 0;
}

.chat-input-actions .btn {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

/* ---- Generator Forms ---- */
.generator-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

.generator-form {
  position: sticky;
  top: 0;
}

.generator-output {
  min-height: 300px;
}

.generator-output .output-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}

.generator-output .output-placeholder .placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

.stream-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}

.stream-text-active {
  color: var(--accent-light);
}
.stream-text .cursor-blink {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ---- SOP Wizard ---- */
.sop-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  transition: all 0.2s;
}
.sop-dot:hover .sop-dot-circle {
  transform: scale(1.12);
  border-color: var(--accent);
}
.sop-dot-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.15);
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  transition: all 0.25s;
}
.sop-dot-active .sop-dot-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(108,92,231,0.4);
}
.sop-dot-done .sop-dot-circle {
  border-color: #00cec9;
  background: rgba(0,206,201,0.15);
  color: #00cec9;
}
.sop-dot-label {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  color: var(--text-muted);
}
.sop-dot-active .sop-dot-label {
  color: var(--text);
}
.sop-dot-done .sop-dot-label {
  color: #00cec9;
}
.sop-dot-tag {
  font-size: 8px;
  color: var(--text-muted);
  opacity: 0.6;
  text-align: center;
}
.sop-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(108,92,231,0.15);
  color: var(--accent-light);
  font-weight: 500;
  white-space: nowrap;
}
.sop-output-area {
  position: relative;
  border-radius: 10px;
  transition: min-height 0.3s;
}

/* ---- Pipeline Dashboard ---- */
.pl-pipeline {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 8px;
  margin-bottom: 12px;
  background: rgba(12,12,26,0.5);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  overflow-x: auto;
  gap: 0;
}
.pl-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  min-width: 56px;
  padding: 6px 4px;
  border-radius: 8px;
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
}
.pl-node:hover {
  background: rgba(108,92,231,0.08);
}
.pl-node-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.12);
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  transition: all 0.25s;
}
.pl-done .pl-node-circle {
  border-color: #00cec9;
  background: rgba(0,206,201,0.12);
  color: #00cec9;
}
.pl-active .pl-node-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(108,92,231,0.35);
}
.pl-node-icon {
  font-size: 16px;
  line-height: 1;
}
.pl-node-title {
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: -0.2px;
}
.pl-active .pl-node-title {
  color: var(--accent-light);
}
.pl-done .pl-node-title {
  color: #00cec9;
}
.pl-arrow {
  display: flex;
  align-items: center;
  padding: 0 2px;
  color: rgba(255,255,255,0.12);
  font-size: 14px;
  margin-top: 16px;
  flex-shrink: 0;
}
.pl-arrow-done {
  color: rgba(0,206,201,0.3);
}
.pl-arrow-active {
  color: var(--accent);
  animation: pulseArrow 1.5s ease infinite;
}
@keyframes pulseArrow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.pl-now-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(108,92,231,0.15);
  color: var(--accent-light);
  font-weight: 500;
  border: 1px solid rgba(108,92,231,0.25);
}
.pl-done-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 4px;
}
.pl-done-card:hover {
  background: rgba(108,92,231,0.06);
  border-color: rgba(108,92,231,0.15);
}

/* ---- Template Cards ---- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
}
.template-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}
.template-card .tc-icon {
  font-size: 24px;
  margin-bottom: 10px;
}
.template-card .tc-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.template-card .tc-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}
.template-card .tc-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---- History ---- */
.history-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.history-toolbar .search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--transition-fast);
}
.history-toolbar .search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: var(--transition);
  cursor: pointer;
}
.history-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}
.history-item .hi-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.history-item .hi-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-item .hi-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Tool Cards ---- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.12);
}
.tool-card .tool-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}
.tool-card .tool-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.tool-card .tool-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ---- Settings ---- */
.settings-section {
  margin-bottom: 32px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}
.settings-row + .settings-row {
  border-top: 1px solid var(--border);
}

.settings-row .sr-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.settings-row .sr-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-row .sr-control {
  flex-shrink: 0;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle input {
  display: none;
}
.toggle .toggle-track {
  width: 100%;
  height: 100%;
  background: var(--bg-glass-strong);
  border-radius: 12px;
  transition: var(--transition-fast);
  border: 1px solid var(--border);
}
.toggle input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle .toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked ~ .toggle-thumb {
  left: 22px;
}

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.empty-state .es-icon {
  font-size: 48px;
  opacity: 0.2;
  margin-bottom: 16px;
}
.empty-state .es-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state .es-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
}

/* ---- Loading & Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}
.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotBounce 1.4s ease-in-out infinite both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ---- Calendar (Content Calendar) ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 16px;
}

.calendar-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-glass);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}
.calendar-day:hover { background: var(--bg-glass-strong); }
.calendar-day.today { border: 1px solid var(--accent); }
.calendar-day.has-content::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.calendar-day.other-month { opacity: 0.3; }

/* ---- AB Test Display ---- */
.ab-test-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.ab-variant {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.ab-variant .ab-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.ab-variant .ab-content {
  font-size: 14px;
  line-height: 1.6;
}

/* ---- Compliance Check ---- */
.compliance-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.compliance-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.compliance-item.pass { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.compliance-item.warn { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.compliance-item.fail { background: rgba(239, 68, 68, 0.1); color: var(--error); }
.compliance-item .ci-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ---- Toast / Notification ---- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow);
  max-width: 380px;
}
.toast.success { border-color: rgba(16, 185, 129, 0.3); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }
.toast.warning { border-color: rgba(245, 158, 11, 0.3); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- PWA / Offline Banner ---- */
.offline-banner {
  display: none;
  background: var(--warning);
  color: #000;
  text-align: center;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
}
body.offline .offline-banner { display: block; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }
  .generator-form {
    position: static;
  }
  .page-container {
    padding: 24px 20px 32px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle {
    display: flex;
  }
  .sidebar-overlay.show {
    display: block;
  }
  .page-container {
    padding: 20px 16px 32px;
    padding-top: 60px;
  }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .template-grid {
    grid-template-columns: 1fr;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .chat-layout {
    flex-direction: column;
    margin: 0;
    height: calc(100vh - 60px);
  }
  .chat-sidebar {
    width: 100%;
    min-width: unset;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .chat-messages {
    padding: 16px;
  }
  .chat-bubble {
    max-width: 90%;
  }
  .chat-input-area {
    padding: 12px 16px;
  }
  .ab-test-container {
    grid-template-columns: 1fr;
  }
  .history-toolbar {
    flex-direction: column;
  }
}

/* ---- Utility ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-light); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-semibold { font-weight: 600; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-full { width: 100%; }
.hidden { display: none; }

/* ---- Auth Pages (Login / Register) ---- */
.auth-page .card-glass {
  animation: slideUp 0.4s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---- User Dropdown Menu ---- */
.user-dropdown {
  animation: fadeIn 0.15s ease;
}
.user-dropdown .nav-item:hover {
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
}

/* ---- Brand Selector in Sidebar ---- */
.brand-selector-container {
  transition: var(--transition-fast);
}
.brand-selector-container select {
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}
.brand-selector-container select:hover {
  border-color: var(--accent);
}
.brand-selector-container select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ---- Todo Items (Dashboard) ---- */
.todo-item:last-child {
  border-bottom: none !important;
}
.todo-item:hover {
  background: var(--bg-glass);
  border-radius: 6px;
  padding-left: 8px;
  padding-right: 8px;
}

/* ---- RAG Info Display ---- */
#scripts-rag-info,
#branding-rag-info,
#planning-rag-info {
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.20);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-weight: 500;
}

/* ---- Export Buttons ---- */
#scripts-export-bar,
#branding-export-bar,
#planning-export-bar {
  animation: fadeIn 0.3s ease;
}

/* ---- Onboarding Modal ---- */
#onboarding-modal {
  animation: slideUp 0.35s ease;
}
#onboarding-modal h2 {
  letter-spacing: -0.3px;
}
#onboarding-modal .btn {
  transition: var(--transition);
}
#onboarding-modal .btn:hover {
  transform: translateY(-1px);
}

/* ---- Onboarding Overlay ---- */
#onboarding-overlay {
  animation: fadeIn 0.3s ease;
}

/* ---- Sidebar footer login/register buttons ---- */
.sidebar-footer .nav-item {
  margin-bottom: 2px;
}

/* ---- Responsive Auth Pages ---- */
@media (max-width: 480px) {
  .auth-page .card-glass {
    padding: 28px 20px !important;
  }
  .auth-page h2 {
    font-size: 20px !important;
  }
}
