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

:root {
  --color-bg: #fafaf9;
  --color-surface: #ffffff;
  --color-surface-warm: #fefdfb;
  --color-border: #e7e5e4;
  --color-border-light: #f5f5f4;
  --color-text: #1c1917;
  --color-text-secondary: #78716c;
  --color-text-tertiary: #a8a29e;
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #eef2ff;
  --color-danger: #ef4444;
  --color-danger-light: #fef2f2;
  --color-success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(28,25,23,0.04);
  --shadow: 0 1px 3px rgba(28,25,23,0.06), 0 1px 2px rgba(28,25,23,0.04);
  --shadow-md: 0 4px 12px rgba(28,25,23,0.06), 0 1px 3px rgba(28,25,23,0.04);
  --shadow-lg: 0 12px 32px rgba(28,25,23,0.08), 0 4px 12px rgba(28,25,23,0.03);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 380px;
  --navbar-height: 56px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn:hover { background: var(--color-primary-hover); text-decoration: none; box-shadow: 0 2px 8px rgba(99,102,241,0.25); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-active { background: var(--color-primary-hover); }
.btn-outline {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-outline:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: #d6d3d1;
  box-shadow: none;
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  padding: 6px 10px;
}
.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
.btn-danger-hover:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: var(--color-danger-light);
  box-shadow: none;
}
.btn-icon {
  padding: 7px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 18px;
  line-height: 1;
}
.btn-icon:hover { background: var(--color-bg); color: var(--color-text); }

.btn.btn-edit-claude {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  font-weight: 600;
  gap: 5px;
  font-size: 12px;
  padding: 6px 14px;
}
.btn.btn-edit-claude:hover { background: linear-gradient(135deg, #4f46e5, #7c3aed); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.btn-edit-claude svg { flex-shrink: 0; }

/* ─── Forms ─── */
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
select.form-input {
  cursor: pointer;
  appearance: auto;
}
.hint {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* ─── Navbar ─── */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: var(--navbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(28,25,23,0.03);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-brand { display: flex; align-items: center; flex-shrink: 0; }
.nav-brand:hover { text-decoration: none; }
.nav-logo { height: 18px; width: auto; display: block; color: var(--color-text); }
.nav-separator { color: var(--color-border); font-size: 18px; font-weight: 300; }
.nav-title {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  letter-spacing: -0.01em;
}
.nav-title:hover { color: var(--color-primary); }
.nav-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nav-divider { width: 1px; height: 22px; background: var(--color-border); margin: 0 6px; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
  padding: 0 4px;
}
.avatar { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--color-border-light); }
.avatar-sm { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }

/* ─── Container ─── */
.container { max-width: 1240px; margin: 0 auto; padding: 32px 28px; }

/* ─── Dashboard ─── */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.dashboard-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border-light);
}
.dash-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.dash-tab:hover { color: var(--color-text-secondary); text-decoration: none; }
.dash-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.dash-tab-count {
  font-size: 11px;
  color: var(--color-text-tertiary);
  background: var(--color-border-light);
  padding: 1px 7px;
  border-radius: 100px;
  margin-left: 5px;
  font-weight: 500;
}
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input {
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 260px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--color-surface);
}
.search-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ─── Filter dropdown ─── */
.filter-wrapper { position: relative; }
.filter-btn-badge {
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 100px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  margin-left: 2px;
}
.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 8px 0;
}
.filter-group {
  padding: 8px 16px;
}
.filter-group + .filter-group {
  border-top: 1px solid var(--color-border-light);
}
.filter-group-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  margin-bottom: 6px;
}
.filter-option {
  display: block;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--color-text-secondary);
  border-radius: 6px;
  transition: all var(--transition);
}
.filter-option:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.filter-option.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

/* ─── Artifact grid ─── */
.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.artifact-card-outer {
  position: relative;
  display: flex;
}
.artifact-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  color: var(--color-text);
  position: relative;
}
.artifact-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background var(--transition);
}
.artifact-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(99,102,241,0.3);
  text-decoration: none;
  transform: translateY(-2px);
}
.artifact-card:hover::before {
  background: var(--color-primary);
}
.artifact-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; letter-spacing: -0.01em; }
.card-desc { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 10px; line-height: 1.5; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.card-top h3 { display: flex; align-items: center; gap: 5px; }
.card-lock { color: var(--color-text-tertiary); display: inline-flex; align-items: center; flex-shrink: 0; }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.card-author {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.card-author-pic {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}
.card-author-placeholder {
  display: inline-block;
  background: var(--color-primary-light);
  border: 1px solid var(--color-border);
}
.card-author-name {
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}
.card-comments {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}
.tag-team {
  background: #f0fdf4;
  color: #16a34a;
}

/* ─── Empty state ─── */
.empty-state { text-align: center; padding: 80px 24px; color: var(--color-text-tertiary); }
.empty-state p { font-size: 15px; font-weight: 500; color: var(--color-text-secondary); }
.empty-state .hint { margin-top: 8px; font-size: 13px; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,25,23,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(28,25,23,0.2);
  width: 100%;
  max-width: 480px;
  margin: 24px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-light);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border-light);
}

/* ─── Upload zone ─── */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-text-tertiary);
  font-size: 13px;
  background: var(--color-bg);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════
   ARTIFACT PAGE — Full-width with right sidebar
   ═══════════════════════════════════════════════════ */

.artifact-body { overflow: hidden; }

.artifact-layout {
  display: flex;
  flex-direction: row;
  height: calc(100vh - var(--navbar-height));
  background: var(--color-bg);
  overflow: hidden;
}

/* ── Main panel (iframe) ── */
.artifact-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.artifact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.artifact-frame-container {
  flex: 1;
  position: relative;
  background: #fff;
}
.artifact-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Right sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  border-left: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
  overflow: hidden;
}
.sidebar.hidden {
  width: 0;
  border-left: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
  padding-right: 8px;
}
.sidebar-tabs {
  display: flex;
  gap: 0;
  flex: 1;
}
.sidebar-tab {
  flex: 1;
  padding: 12px 0;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  color: var(--color-text-tertiary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.sidebar-tab:hover { color: var(--color-text-secondary); }
.sidebar-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.sidebar-panel { display: none; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.sidebar-panel.active { display: flex; }

/* ── Comments ── */
.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.comments-empty {
  color: var(--color-text-tertiary);
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
}
.comment { padding: 10px 0; }
.comment + .comment { border-top: 1px solid var(--color-border-light); }
.comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.comment-author { font-size: 12px; font-weight: 600; color: var(--color-text); }
.comment-date { font-size: 11px; color: var(--color-text-tertiary); margin-left: auto; }
.comment-delete {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: all var(--transition);
}
.comment:hover .comment-delete { opacity: 1; }
.comment-delete:hover { color: var(--color-danger); }
.comment-body {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.5;
  word-break: break-word;
}
.mention { color: var(--color-primary); font-weight: 600; }

/* Comment form */
.comment-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
}
.comment-input-wrap { flex: 1; position: relative; }
.comment-input-wrap textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color var(--transition);
  line-height: 1.4;
  background: var(--color-bg);
}
.comment-input-wrap textarea:focus {
  border-color: var(--color-primary);
  background: #fff;
}

/* @mention dropdown */
.mention-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  margin-bottom: 4px;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.mention-item:hover { background: var(--color-bg); }
.mention-name { font-size: 13px; font-weight: 500; }
.mention-email { font-size: 11px; color: var(--color-text-tertiary); }

/* ── Threaded comments ── */
.thread {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.thread:last-child { border-bottom: none; }
.thread .comment + .comment { border-top: none; }
.thread-resolved { opacity: 0.6; }
.thread-resolved:hover { opacity: 1; }
.thread-resolved-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: #f0fdf4;
  border-radius: 4px;
}
.thread-highlight {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  font-style: italic;
  color: var(--color-text-secondary);
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 8px;
  line-height: 1.4;
}
.thread-highlight svg { flex-shrink: 0; margin-top: 2px; }
.thread-replies {
  margin-left: 20px;
  padding-left: 12px;
  border-left: 2px solid var(--color-border-light);
}
.thread-replies .comment { padding: 6px 0; }
.thread-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  padding-left: 2px;
}
.thread-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition);
}
.thread-action:hover { color: var(--color-primary); background: var(--color-primary-light); }

/* Reply banner */
.reply-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--color-primary-light);
  border-top: 1px solid var(--color-border-light);
  font-size: 12px;
  color: var(--color-primary);
}
.reply-banner-text { flex: 1; font-weight: 500; }
.reply-banner-close {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.reply-banner-close:hover { color: var(--color-text); }
.highlight-quote { font-style: italic; }

/* ── Access control panel ── */
.access-control {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.access-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.access-option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.access-option input[type="radio"] { margin-top: 2px; flex-shrink: 0; }
.access-option-text { display: flex; flex-direction: column; }
.access-option-text span { font-size: 13px; font-weight: 500; }
.access-option-text small { font-size: 11px; color: var(--color-text-tertiary); margin-top: 1px; }
#allowed-emails-section { margin-top: 8px; }
#allowed-emails-section textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  outline: none;
  background: var(--color-bg);
}
#allowed-emails-section textarea:focus { border-color: var(--color-primary); background: #fff; }

/* ── Share link section ── */
.share-link-box {
  display: flex;
  gap: 6px;
  align-items: center;
}
.share-link-box .form-input {
  flex: 1;
  font-size: 11px;
  padding: 5px 8px;
  background: var(--color-bg);
}

/* ── Project toggle checkboxes ── */
.project-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  cursor: pointer;
}
.project-toggle input { flex-shrink: 0; }

/* ─── Pagination ─── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; }

/* ─── Login page ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #111111;
}
.login-container { width: 100%; max-width: 420px; padding: 24px; }
.login-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
  backdrop-filter: blur(20px);
}
.login-header { margin-bottom: 36px; }
.login-logo { height: 32px; width: auto; margin: 0 auto 16px; display: block; color: var(--color-text); }
.login-subtitle { color: rgba(255,255,255,0.5); font-size: 14px; letter-spacing: 0.5px; }
.login-body p { margin-bottom: 28px; font-size: 14px; color: rgba(255,255,255,0.6); }
.login-body strong { color: rgba(255,255,255,0.85); }

/* Google Sign-In button */
.google-btn {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #4285F4;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.2s;
  overflow: hidden;
}
.google-btn:hover { box-shadow: 0 2px 8px rgba(66,133,244,0.4); text-decoration: none; }
.google-btn:active { background: #3367D6; }
.google-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 2px;
  margin: 1px;
}
.google-btn-text {
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 0 12px 0 8px;
  letter-spacing: 0.2px;
}

/* ─── Error ─── */
.error-card { background: var(--color-surface); border: 1px solid var(--color-border); }
.error-card h1 { color: var(--color-danger); font-size: 22px; margin-bottom: 12px; }
.error-card p { color: var(--color-text-secondary); margin-bottom: 24px; line-height: 1.6; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .artifact-body { overflow: auto; overflow-x: hidden; }
  .artifact-layout { flex-direction: column; height: auto; min-height: calc(100vh - var(--navbar-height)); overflow: visible; }
  .artifact-main { min-height: 70vh; }
  .artifact-frame-container { position: relative; min-height: 70vh; height: 70vh; }
  .artifact-frame { position: absolute; }
  .sidebar {
    width: 100% !important;
    border-left: none;
    border-top: 1px solid var(--color-border);
    max-height: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 70vh;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    border-radius: 16px 16px 0 0;
  }
  .sidebar.hidden {
    display: none !important;
  }
  .nav-right .artifact-meta,
  .nav-right .nav-divider:first-of-type,
  .nav-right .tag { display: none; }
  .nav-title { max-width: 120px; }
  .dashboard-tabs { overflow-x: auto; }
  .filter-dropdown { right: auto; left: 0; }
}
@media (max-width: 640px) {
  .navbar { padding: 0 10px; gap: 4px; }
  .nav-right { gap: 2px; }
  .nav-right .btn { padding: 6px 8px; font-size: 12px; }
  .nav-right .btn-icon { padding: 6px; }
  .nav-right .nav-divider { margin: 0 2px; }
  .container { padding: 20px 16px; }
  .dashboard-header { flex-direction: column; align-items: stretch; }
  .search-form { flex: 1; }
  .search-form input { width: 100%; }
  .artifact-grid { grid-template-columns: 1fr; }
  .login-card { padding: 36px 24px; }
}

/* ── Project settings panel ── */
.project-settings-panel {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 20px 32px;
}
.settings-section h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--color-text);
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.settings-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 10px;
}
.settings-action-btn svg {
  flex-shrink: 0;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.radio-label input[type="radio"] { margin: 0; }

/* ── Artifact card wrapper (with remove button) ── */
.artifact-card-wrapper {
  position: relative;
}
.btn-remove-artifact {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-tertiary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), border-color var(--transition);
}
.artifact-card-wrapper:hover .btn-remove-artifact { opacity: 1; }
.btn-remove-artifact:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: var(--color-danger-light);
}

/* ── Artifact picker (multi-select modal) ── */
.artifact-picker {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: var(--color-primary-light); }
.picker-item input[type="checkbox"] { margin: 0; flex-shrink: 0; }
.picker-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
}
.picker-meta {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* ── Notification bell & dropdown ── */
.notification-wrapper {
  position: relative;
  display: inline-flex;
}
.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}
.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 380px;
  max-height: 480px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 13px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.notification-list {
  overflow-y: auto;
  flex: 1;
}
.notification-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 13px;
}
.notification-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-primary-light);
  transition: background var(--transition);
}
.notification-item:last-child { border-bottom: none; }
.notification-item.read { background: transparent; }
.notification-item:hover { background: var(--color-bg); }
.notif-left {
  position: relative;
  flex-shrink: 0;
}
.notif-icon {
  position: absolute;
  bottom: -2px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  color: #fff;
}
.notif-mention { background: var(--color-primary); }
.notif-access-request { background: #f59e0b; }
.notif-access-granted { background: var(--color-success); }
.notif-access-denied { background: var(--color-danger); }
.notif-content {
  flex: 1;
  min-width: 0;
}
.notif-message {
  display: block;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
  line-height: 1.4;
}
.notif-message:hover { color: var(--color-primary); }
.notif-message strong { font-weight: 600; }
.notif-time {
  display: block;
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}
.notif-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.avatar-placeholder {
  background: var(--color-border);
  border-radius: 50%;
}

/* (legacy filter-bar/sort-bar removed – using .filter-dropdown now) */

/* ── Favorite star (inside .artifact-card-outer) ── */
.btn-favorite {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition);
  z-index: 2;
}
.artifact-card-outer:hover .btn-favorite { opacity: 1; }
.btn-favorite.active {
  opacity: 1;
  color: #f59e0b;
  border-color: #f59e0b;
  background: #fffbeb;
}
.btn-favorite:hover {
  color: #f59e0b;
  border-color: #f59e0b;
}
.btn-fav-active {
  color: #f59e0b !important;
}

/* ── Tags editor ── */
.tags-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-editable {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
}
.tag-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.6;
}
.tag-remove:hover { opacity: 1; }
.tags-input-row {
  display: flex;
  gap: 6px;
}

/* ── Reactions ── */
.comment-reactions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}
.reaction-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.reaction-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.reaction-btn.reaction-empty {
  opacity: 0;
}
.comment:hover .reaction-btn.reaction-empty {
  opacity: 0.5;
}
.comment:hover .reaction-btn.reaction-empty:hover {
  opacity: 1;
}
.reaction-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* ── Schedule ── */
.schedule-section { margin-top: 4px; }
.schedule-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.schedule-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.schedule-active {
  background: #f0fdf4;
  color: #16a34a;
}
.schedule-paused {
  background: var(--color-bg);
  color: var(--color-text-tertiary);
}

/* ── Template picker (in upload modal) ── */
.template-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.template-picker-item {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.template-picker-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.template-picker-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.template-picker-desc {
  font-size: 12px;
  margin-bottom: 4px;
}

/* ── Template card (dashboard) ── */
.template-card {
  position: relative;
}
.template-card h3 { margin-bottom: 4px; }

/* ── Embed code ── */
.embed-code-box { display: flex; flex-direction: column; }
.embed-code {
  font-size: 11px !important;
  font-family: 'SF Mono', Monaco, Consolas, monospace !important;
  line-height: 1.4;
  resize: none;
  background: var(--color-bg) !important;
  color: var(--color-text-secondary);
}

/* ── Data sources ── */
.data-sources-list {
  overflow-y: auto;
  flex: 1;
  padding: 0;
}
.data-source-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
}
.data-source-item:last-child { border-bottom: none; }
.data-source-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.data-source-header strong { font-size: 13px; }
.data-source-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.data-source-proxy code {
  font-size: 10px;
  background: var(--color-bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.data-source-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

/* ── Version history ── */
.version-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border-light);
  gap: 8px;
}
.version-item:last-child { border-bottom: none; }
.version-info {
  flex: 1;
  min-width: 0;
}
.version-info strong {
  font-size: 13px;
}
.version-meta {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
}
.version-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Activity log ── */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-action {
  font-weight: 600;
  white-space: nowrap;
  min-width: 140px;
}
.activity-details {
  flex: 1;
  color: var(--color-text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-meta {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* ── Responsive additions ── */
@media (max-width: 768px) {
  .activity-item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .activity-action { min-width: auto; }
}

/* ─── User dropdown menu ─── */
.nav-user-menu {
  position: relative;
}
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  color: var(--color-text);
  font-size: 13px;
  transition: var(--transition);
}
.nav-user-btn:hover {
  background: var(--color-border-light);
  border-color: var(--color-border);
}
.nav-user-btn .avatar {
  width: 28px;
  height: 28px;
}
.nav-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-light);
}
.avatar-md {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.user-dropdown-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
}
.user-dropdown-email {
  font-size: 11px;
  color: var(--color-text-tertiary);
}
.user-dropdown-links {
  padding: 6px 0;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
  transition: var(--transition);
}
.user-dropdown-item:hover {
  background: var(--color-border-light);
}
.user-dropdown-item svg {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 4px 0;
}
.user-dropdown-logout:hover {
  color: var(--color-danger);
}
.user-dropdown-logout:hover svg {
  color: var(--color-danger);
}

/* ─── Tag: Admin ─── */
.tag-admin {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

/* ─── Profile page ─── */
.profile-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-border-light);
}
.profile-avatar-placeholder {
  background: var(--color-border-light);
}
.profile-info {
  flex: 1;
}
.profile-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 2px;
}
.profile-email {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}
.profile-badges {
  display: flex;
  gap: 6px;
}
.profile-meta {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
  font-size: 12px;
  color: var(--color-text-tertiary);
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
}
.stat-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}
.profile-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.profile-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}
.profile-artifact-list {
  display: flex;
  flex-direction: column;
}
.profile-artifact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
  text-decoration: none;
  color: var(--color-text);
  transition: var(--transition);
}
.profile-artifact-item:last-child {
  border-bottom: none;
}
.profile-artifact-item:hover {
  color: var(--color-primary);
}
.profile-artifact-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.profile-artifact-date {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* ─── Admin page ─── */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.admin-stats .stat-card {
  padding: 16px;
}
.admin-stats .stat-number {
  font-size: 22px;
}
.admin-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.admin-section-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.admin-add-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
}
.admin-add-form .form-input {
  flex: 1;
}
.admin-list {
  display: flex;
  flex-direction: column;
}
.admin-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.admin-list-item:last-child {
  border-bottom: none;
}
.admin-list-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.admin-list-info .avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}
.admin-list-name {
  font-size: 13px;
  font-weight: 500;
}
.admin-list-sub {
  display: block;
  font-size: 11px;
  color: var(--color-text-tertiary);
}
.admin-list-meta {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.admin-list-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.team-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { grid-template-columns: repeat(3, 1fr); }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-list-item { flex-wrap: wrap; }
  .admin-list-meta { display: none; }
}
