@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
  --bg: hsl(240, 100%, 99%);
  --fg: hsl(244, 47%, 20%);
  --card: #ffffff;
  --card-fg: hsl(244, 47%, 20%);
  --primary: hsl(239, 84%, 67%);
  --primary-fg: #ffffff;
  --primary-dark: hsl(239, 76%, 59%);
  --secondary: hsl(224, 76%, 95%);
  --secondary-fg: hsl(244, 47%, 20%);
  --muted: hsl(220, 14%, 96%);
  --muted-fg: hsl(215, 16%, 47%);
  --accent: hsl(263, 83%, 58%);
  --accent-fg: #ffffff;
  --destructive: hsl(0, 84%, 60%);
  --success: hsl(160, 84%, 39%);
  --warning: hsl(38, 92%, 50%);
  --border: hsl(224, 76%, 95%);
  --ring: hsl(239, 84%, 67%);
  --radius: 0.75rem;
  --gradient-primary: linear-gradient(135deg, hsl(239, 84%, 67%), hsl(263, 83%, 58%));
  --gradient-hover: linear-gradient(135deg, hsl(239, 76%, 59%), hsl(263, 83%, 52%));
  --sidebar-w: 240px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid var(--border); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; outline: none; }
input, select, textarea { font: inherit; outline: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 30;
  transition: transform .3s ease;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-fg); font-size: 18px;
}
.sidebar-logo-text { font-size: 18px; font-weight: 700; color: var(--fg); }
.sidebar-logo-text span {
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }

.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  transition: all .2s ease; width: 100%;
  color: var(--muted-fg);
}
.sidebar-item:hover { background: var(--secondary); color: var(--fg); }
.sidebar-item.active {
  background: var(--gradient-primary);
  color: var(--primary-fg);
  box-shadow: 0 4px 12px rgba(99,102,241,.25);
}
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-bottom { padding: 16px; }
.lang-switch {
  display: flex; gap: 4px; background: var(--secondary);
  border-radius: 999px; padding: 4px; margin-bottom: 12px;
}
.lang-btn {
  flex: 1; font-size: 11px; font-weight: 500; padding: 6px 0;
  border-radius: 999px; text-align: center; color: var(--muted-fg);
  transition: all .2s;
}
.lang-btn.active {
  background: var(--gradient-primary); color: var(--primary-fg);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--primary-fg);
}
.sidebar-user-name { font-size: 14px; font-weight: 500; color: var(--fg); }
.sidebar-user-plan { font-size: 12px; color: var(--muted-fg); }

/* ── Common ── */
.gradient-primary { background: var(--gradient-primary); }
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-card-violet {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(196,181,253,0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  border: 1px solid var(--border);
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--primary-fg); font-weight: 600;
  padding: 12px 24px; border-radius: 12px;
  font-size: 14px; transition: opacity .2s;
  box-shadow: 0 4px 14px rgba(99,102,241,.2);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary:hover { opacity: .9; }

.btn-outline {
  border: 1px solid rgba(99,102,241,.3);
  color: var(--primary); font-weight: 500; font-size: 14px;
  padding: 8px 16px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .2s;
}
.btn-outline:hover { background: rgba(99,102,241,.05); }

.pill-tab {
  padding: 8px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  transition: all .2s; cursor: pointer;
}
.pill-tab.active { background: var(--gradient-primary); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,.2); }
.pill-tab:not(.active) { background: var(--secondary); color: var(--muted-fg); }
.pill-tab:not(.active):hover { background: hsl(224,76%,92%); }

.input {
  width: 100%; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--border);
  font-size: 14px; background: var(--card);
  transition: box-shadow .2s;
}
.input:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

.badge-en { background: var(--primary); color: #fff; border-radius: 999px; font-size: 11px; padding: 2px 8px; font-weight: 500; }
.badge-hi { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 2px 8px; font-weight: 500; }
.badge-hinglish { background: var(--gradient-primary); color: #fff; border-radius: 999px; font-size: 11px; padding: 2px 8px; font-weight: 500; }

/* ── Dashboard ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { border-radius: 16px; padding: 16px; }
.stat-card .stat-icon { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stat-card .stat-icon svg { width: 16px; height: 16px; }
.stat-card .stat-label { font-size: 12px; font-weight: 500; color: var(--muted-fg); }
.stat-card .stat-value { font-size: 18px; font-weight: 700; color: var(--fg); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 18px; font-weight: 600; color: var(--fg); }
.view-all { font-size: 14px; color: var(--primary); font-weight: 500; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.view-all:hover { opacity: .8; }

.knowledge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.knowledge-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  border-left: 4px solid var(--primary);
  padding: 20px;
  transition: all .3s ease;
  cursor: pointer;
}
.knowledge-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px rgba(99,102,241,.15);
}

.kc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kc-source { display: flex; align-items: center; gap: 8px; }
.kc-source-label { font-size: 12px; font-weight: 500; color: var(--muted-fg); }
.kc-title { font-size: 15px; font-weight: 600; color: var(--fg); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kc-summary { font-size: 14px; color: var(--muted-fg); margin-bottom: 12px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kc-insights { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.kc-insight { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--muted-fg); }
.kc-insight svg { width: 12px; height: 12px; margin-top: 3px; color: var(--primary); flex-shrink: 0; }
.kc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.kc-tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(99,102,241,.3); color: var(--primary); font-weight: 500; }
.kc-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); }
.kc-date { font-size: 12px; color: var(--muted-fg); }
.kc-actions { display: flex; align-items: center; gap: 8px; }
.kc-action { font-size: 12px; color: rgba(99,102,241,.7); display: flex; align-items: center; gap: 4px; }
.kc-action:hover { color: var(--primary); }
.kc-action svg { width: 12px; height: 12px; }

.collections-row { display: flex; flex-wrap: wrap; gap: 12px; }
.collection-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  border: 1px solid rgba(99,102,241,.2);
  background: var(--card); font-size: 14px;
  transition: all .2s; cursor: pointer;
}
.collection-chip:hover { border-color: rgba(99,102,241,.5); background: rgba(99,102,241,.03); }
.collection-chip .emoji { font-size: 18px; }
.collection-chip .name { font-weight: 500; color: var(--fg); }
.collection-chip .count { font-size: 12px; color: var(--muted-fg); background: var(--secondary); padding: 2px 8px; border-radius: 999px; }

.ask-panel { border-radius: 16px; padding: 20px; }
.ask-panel-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ask-panel-header svg { width: 20px; height: 20px; color: var(--primary); }
.ask-panel-header h3 { font-weight: 600; font-size: 15px; }
.ask-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.ask-input-row .input { flex: 1; }
.ask-send-btn {
  background: var(--gradient-primary); color: var(--primary-fg);
  padding: 10px; border-radius: 12px; transition: opacity .2s;
}
.ask-send-btn:hover { opacity: .9; }
.ask-send-btn svg { width: 16px; height: 16px; }
.suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion-chip {
  font-size: 12px; padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted-fg); transition: all .2s;
}
.suggestion-chip:hover { color: var(--primary); border-color: rgba(99,102,241,.3); }

/* ── Capture Page ── */
.capture-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.capture-form { padding: 24px; }
.capture-form .form-group { margin-bottom: 16px; }
.capture-form label { display: block; font-size: 14px; font-weight: 500; color: var(--fg); margin-bottom: 8px; }
.capture-form .hint { font-size: 12px; color: var(--muted-fg); margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.select { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); font-size: 14px; background: var(--card); appearance: none; }
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 48px; text-align: center; color: var(--muted-fg);
}
.dropzone svg { width: 40px; height: 40px; margin: 0 auto 12px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-fg); }
.input-icon-wrap .input { padding-left: 36px; }

/* ── Processing Screen ── */
.processing-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 70vh; text-align: center; }
.processing-orb {
  position: relative; width: 128px; height: 128px; margin-bottom: 40px;
}
.processing-orb .ring {
  position: absolute; border-radius: 50%;
  background: var(--gradient-primary);
}
.processing-orb .ring-outer { inset: 0; opacity: .3; filter: blur(20px); animation: orb-pulse 2s ease-in-out infinite; }
.processing-orb .ring-mid { inset: 16px; opacity: .6; filter: blur(8px); animation: orb-pulse 2s ease-in-out infinite .3s; }
.processing-orb .ring-inner {
  inset: 32px; display: flex; align-items: center; justify-content: center;
  animation: orb-pulse 2s ease-in-out infinite .6s;
  font-size: 28px;
}

.processing-steps { max-width: 320px; width: 100%; margin-bottom: 32px; text-align: left; }
.processing-step { display: flex; align-items: center; gap: 12px; font-size: 14px; padding: 6px 0; opacity: 0; transform: translateX(-10px); transition: all .4s ease; }
.processing-step.visible { opacity: 1; transform: translateX(0); }
.processing-step.done { color: var(--muted-fg); }
.processing-step.active { color: var(--fg); font-weight: 500; }
.processing-step svg { width: 16px; height: 16px; flex-shrink: 0; }
.step-check { color: var(--success); }
.step-spinner { color: var(--primary); animation: spin 1s linear infinite; }

.progress-bar { width: 256px; height: 8px; background: var(--secondary); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; background: var(--gradient-primary); border-radius: 999px; transition: width .2s; }
.processing-hint { font-size: 12px; color: var(--muted-fg); margin-bottom: 16px; }
.cancel-btn { font-size: 14px; color: var(--muted-fg); transition: color .2s; }
.cancel-btn:hover { color: var(--fg); }

/* ── Knowledge Page ── */
.knowledge-page { display: flex; gap: 24px; }
.knowledge-filters { width: 220px; flex-shrink: 0; }
.knowledge-filters .filter-group { margin-bottom: 20px; }
.knowledge-filters .filter-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted-fg); margin-bottom: 8px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  transition: all .2s; cursor: pointer;
}
.filter-pill.active { background: var(--gradient-primary); color: #fff; }
.filter-pill:not(.active) { background: var(--secondary); color: var(--muted-fg); }
.topic-pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(99,102,241,.2); color: var(--primary);
  transition: all .2s; cursor: pointer;
}
.topic-pill:hover { background: rgba(99,102,241,.05); }
.clear-filters { font-size: 12px; color: var(--primary); cursor: pointer; }
.clear-filters:hover { text-decoration: underline; }

.knowledge-main { flex: 1; }
.knowledge-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.item-count { font-size: 14px; color: var(--muted-fg); }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.sort-select { font-size: 12px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); }
.view-btn { padding: 6px; border-radius: 8px; color: var(--muted-fg); transition: all .2s; }
.view-btn.active { background: var(--secondary); color: var(--fg); }

/* ── Ask Memora ── */
.ask-page { display: flex; gap: 16px; height: calc(100vh - 7rem); }
.chat-sidebar { width: 280px; flex-shrink: 0; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; }
.new-chat-btn { width: 100%; background: var(--gradient-primary); color: var(--primary-fg); font-size: 14px; font-weight: 500; padding: 10px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; transition: opacity .2s; }
.new-chat-btn:hover { opacity: .9; }
.chat-history { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.chat-history-item { text-align: left; padding: 10px 12px; border-radius: 12px; transition: background .2s; width: 100%; }
.chat-history-item:hover { background: var(--secondary); }
.chat-history-title { font-size: 14px; font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-history-date { font-size: 12px; color: var(--muted-fg); }

.chat-main { flex: 1; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.chat-header h1 { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chat-header h1 svg { width: 20px; height: 20px; color: var(--primary); }
.chat-header p { font-size: 12px; color: var(--muted-fg); margin-top: 2px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; }
.chat-empty-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--gradient-primary); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; font-size: 32px; animation: float 3s ease-in-out infinite; }
.chat-empty h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.chat-empty p { font-size: 14px; color: var(--muted-fg); margin-bottom: 24px; max-width: 380px; }
.chat-suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 420px; }
.chat-suggestion { text-align: left; font-size: 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); color: var(--muted-fg); transition: all .2s; }
.chat-suggestion:hover { border-color: rgba(99,102,241,.3); background: rgba(99,102,241,.03); }
.chat-suggestion svg { width: 14px; height: 14px; color: var(--primary); margin-bottom: 4px; }

.msg-row { display: flex; }
.msg-row.user { justify-content: flex-end; }
.msg-row.ai { justify-content: flex-start; }
.msg-bubble { max-width: 520px; padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.6; }
.msg-row.user .msg-bubble { background: var(--gradient-primary); color: var(--primary-fg); border-bottom-right-radius: 6px; }
.msg-row.ai .msg-wrap { display: flex; align-items: flex-start; gap: 12px; }
.ai-avatar { width: 32px; height: 32px; border-radius: 12px; background: var(--gradient-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.msg-row.ai .msg-bubble { background: var(--card); border: 1px solid var(--border); border-top-left-radius: 6px; color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.msg-sources { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.msg-sources-label { font-size: 12px; color: var(--muted-fg); margin-bottom: 6px; }
.msg-source-chip { display: inline-block; font-size: 12px; padding: 4px 8px; border-radius: 999px; background: var(--secondary); color: var(--primary); font-weight: 500; margin-right: 6px; }

.chat-input-area { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input-area .input { flex: 1; padding: 12px 16px; }
.chat-send-btn { background: var(--gradient-primary); color: var(--primary-fg); padding: 12px; border-radius: 12px; transition: opacity .2s; }
.chat-send-btn:hover { opacity: .9; }
.chat-send-btn svg { width: 16px; height: 16px; }

/* ── Collections Page ── */
.collections-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.collection-card { border-radius: 16px; padding: 20px; cursor: pointer; transition: all .3s; }
.collection-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -12px rgba(99,102,241,.15); }
.collection-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.collection-card-head .emoji { font-size: 32px; }
.collection-card-head h3 { font-weight: 600; color: var(--fg); }
.collection-card-head .cnt { font-size: 12px; color: var(--muted-fg); }
.collection-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.collection-bar { height: 8px; background: var(--secondary); border-radius: 999px; }
.collection-meta { font-size: 12px; color: var(--muted-fg); }

/* ── Settings Page ── */
.settings-layout { display: flex; gap: 24px; }
.settings-nav { width: 180px; display: flex; flex-direction: column; gap: 4px; }
.settings-nav-item { font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 12px; text-align: left; transition: all .2s; color: var(--muted-fg); white-space: nowrap; }
.settings-nav-item:hover { background: var(--secondary); }
.settings-nav-item.active { background: var(--gradient-primary); color: var(--primary-fg); }
.settings-content { flex: 1; padding: 24px; }
.settings-content .form-group { margin-bottom: 16px; }
.settings-content label { display: block; font-size: 14px; font-weight: 500; color: var(--fg); margin-bottom: 6px; }
.storage-bar { width: 100%; height: 10px; background: var(--secondary); border-radius: 999px; overflow: hidden; }
.storage-fill { height: 100%; background: var(--gradient-primary); border-radius: 999px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.toggle-row p { font-size: 14px; font-weight: 500; color: var(--fg); }
.toggle-row small { font-size: 12px; color: var(--muted-fg); }
.toggle { width: 44px; height: 24px; border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.toggle.on { background: var(--primary); }
.toggle.off { background: var(--secondary); }
.toggle-dot { width: 20px; height: 20px; border-radius: 50%; position: absolute; top: 2px; transition: all .2s; }
.toggle.on .toggle-dot { right: 2px; background: var(--primary-fg); }
.toggle.off .toggle-dot { left: 2px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

.integrations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.integration-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; align-items: center; justify-content: space-between; }
.integration-name { font-size: 14px; font-weight: 500; color: var(--fg); }
.int-btn { font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 999px; }
.int-btn.connected { background: rgba(16,185,129,.1); color: var(--success); }
.int-btn.connect { border: 1px solid rgba(99,102,241,.3); color: var(--primary); }
.int-btn.disabled { background: var(--secondary); color: var(--muted-fg); cursor: not-allowed; }

/* ── Detail Panel (slide-in) ── */
.detail-overlay { position: fixed; inset: 0; z-index: 40; display: none; }
.detail-overlay.open { display: flex; justify-content: flex-end; }
.detail-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.2); backdrop-filter: blur(4px); }
.detail-panel {
  position: relative; width: 100%; max-width: 560px;
  background: var(--card); height: 100%;
  box-shadow: -8px 0 30px rgba(0,0,0,.1);
  overflow-y: auto; display: flex; flex-direction: column;
  animation: slide-in-right .3s ease;
}
.detail-header { position: sticky; top: 0; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 16px; display: flex; align-items: center; justify-content: space-between; z-index: 10; }
.detail-body { flex: 1; padding: 24px; }
.detail-body h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.detail-section { margin-bottom: 24px; }
.detail-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.detail-section p { font-size: 14px; color: var(--muted-fg); line-height: 1.7; }
.insight-item { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.insight-num { width: 20px; height: 20px; border-radius: 50%; background: var(--gradient-primary); color: var(--primary-fg); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.detail-meta { font-size: 12px; color: var(--muted-fg); display: flex; flex-direction: column; gap: 4px; }
.detail-footer { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--border); padding: 16px; display: flex; gap: 8px; }
.detail-action { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; font-size: 12px; font-weight: 500; color: var(--muted-fg); border-radius: 8px; transition: all .2s; }
.detail-action:hover { background: var(--secondary); color: var(--fg); }
.detail-action.danger { color: var(--destructive); }
.detail-action.danger:hover { background: rgba(239,68,68,.1); }
.detail-action svg { width: 14px; height: 14px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.2); backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: 16px; box-shadow: 0 24px 48px rgba(0,0,0,.15); width: 100%; max-width: 420px; padding: 24px; margin: 16px; }
.modal h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.emoji-picker { display: flex; gap: 8px; margin-bottom: 16px; }
.emoji-pick { font-size: 20px; padding: 8px; border-radius: 8px; transition: background .2s; }
.emoji-pick:hover { background: var(--secondary); }
.color-picker { display: flex; gap: 8px; margin-bottom: 20px; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; transition: all .2s; }
.color-dot:hover { box-shadow: 0 0 0 3px rgba(99,102,241,.3); }

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 700; color: var(--fg); }
.page-header p { font-size: 14px; color: var(--muted-fg); margin-top: 4px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; }

/* ── Animations ── */
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: .8; }
  50% { transform: scale(1.15); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide-in-right { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .knowledge-grid, .collections-grid { grid-template-columns: 1fr; }
  .knowledge-page { flex-direction: column; }
  .knowledge-filters { width: 100%; }
  .ask-page { flex-direction: column; height: auto; }
  .chat-sidebar { display: none; }
  .settings-layout { flex-direction: column; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; }
  .form-row { grid-template-columns: 1fr; }
  .integrations-grid { grid-template-columns: 1fr; }
  .chat-suggestions { grid-template-columns: 1fr; }
}

/* ── Utility ── */
.hidden { display: none !important; }
.page { display: none; }
.page.active { display: block; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.space-y-6 > * + * { margin-top: 24px; }
.space-y-4 > * + * { margin-top: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 700; }
