:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --danger: #dc2626;
  --code-bg: #0f172a;
  --code-text: #f8fafc;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --border: #273449;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --code-bg: #020617;
  --code-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 800;
}

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

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  padding: 5px 11px;
  border-radius: 999px;
}

.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  padding: 5px 12px;
  border-radius: 999px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover { background: var(--surface-alt); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.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(--text-muted);
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

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

/* Container */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 56px 24px 36px;
  max-width: 820px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(30px, 4.5vw, 46px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 14px 0 14px;
  font-weight: 850;
}

.hero p {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0 auto 28px;
  max-width: 640px;
}

/* Dropzone */
.dropzone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 40px 24px;
  max-width: 680px;
  margin: 0 auto;
  transition: all 0.18s ease;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.dropzone h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.dropzone p {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-subtle);
}

.dropzone-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.supported-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Workspace */
.workspace-wrap {
  max-width: 1280px;
  margin: 0 auto 48px;
  padding: 0 24px;
}

.workspace-wrap.hidden { display: none; }

.workspace-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.stats-group {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.stats-group strong { color: var(--text); }

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  min-height: 660px;
  max-height: 78vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.sidebar-controls {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.search-input:focus { border-color: var(--accent); }

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

.platform-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pill {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.select-sm {
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.select-all-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-subtle);
  padding-top: 2px;
}

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

.chat-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s ease;
  margin-bottom: 4px;
}

.chat-item:hover { background: var(--surface-alt); }

.chat-item.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.chat-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
  cursor: pointer;
}

.chat-item-body {
  flex: 1;
  min-width: 0;
}

.chat-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 3px;
}

.badge-platform {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
}
.badge-chatgpt { background: #dcfce7; color: #166534; }
.badge-claude { background: #ffedd5; color: #9a3412; }
.badge-gemini { background: #dbeafe; color: #1d4ed8; }
.badge-unknown { background: var(--surface-alt); color: var(--text-muted); }

/* Reader */
.reader {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.reader-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reader-title-wrap { min-width: 0; flex: 1; }
.reader-title {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-sub {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 2px;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reader-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg-card {
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.msg-card.user {
  background: var(--surface-alt);
  border-left: 4px solid var(--accent);
}

.msg-card.assistant {
  background: var(--surface);
}

.msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.msg-role {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.msg-time { color: var(--text-subtle); }

.msg-content { font-size: 14px; word-break: break-word; }
.msg-content > :first-child { margin-top: 0; }
.msg-content > :last-child { margin-bottom: 0; }

.msg-content pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  position: relative;
}

.msg-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.msg-content :not(pre) > code {
  background: var(--surface-alt);
  padding: 2px 5px;
  border-radius: 4px;
}

.msg-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}

.msg-content th, .msg-content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.msg-content th { background: var(--surface-alt); }

.empty-state {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-subtle);
  padding: 40px;
}

/* SEO Content Sections */
.section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

.section-title {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.section-sub {
  text-align: center;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 36px;
  font-size: 15px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p, .card li { font-size: 14px; color: var(--text-muted); }
.card ol { padding-left: 18px; margin: 8px 0 0; }

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.price-card.featured {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-md);
}

.price-amount {
  font-size: 36px;
  font-weight: 850;
  margin: 8px 0 4px;
}

.price-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 24px;
  flex: 1;
}

.price-list li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* FAQ */
.faq-list {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}

.faq-item summary {
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.faq-item p {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 460px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.modal h3 { margin: 0 0 8px; font-size: 20px; }
.modal p { margin: 0 0 16px; font-size: 14px; color: var(--text-muted); }

.divider-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-subtle);
  margin: 18px 0 12px;
}

.license-row {
  display: flex;
  gap: 8px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 200;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.hidden { opacity: 0; pointer-events: none; transform: translateY(10px); }

footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-subtle);
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    max-height: none;
  }
  .sidebar { max-height: 360px; }
  .privacy-pill { display: none; }
}
