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

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface-2:  #22263a;
  --border:     #2e3250;
  --accent:     #6c63ff;
  --accent-h:   #857dff;
  --text:       #e8eaf6;
  --text-muted: #8890b8;
  --danger:     #ff5c7a;
  --success:    #43d98c;
  --radius:     12px;
  --nav-w:      220px;
  --transition: 0.18s ease;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: none;
  outline: none;
  transition: background var(--transition), opacity var(--transition);
}

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  width: 100%;
  transition: border-color var(--transition);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238890b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select option { background: var(--surface); color: var(--text); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder { color: var(--text-muted); }

/* ── Auth page ────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-logo svg { color: var(--accent); }

.auth-logo span {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; }

.otp-digit {
  width: 48px;
  height: 56px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
  caret-color: transparent;
}
.otp-digit:focus { border-color: var(--accent); }
.otp-digit.filled { border-color: var(--accent); }

.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.btn-primary:hover { background: var(--accent-h); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-error {
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
  background: rgba(255, 92, 122, 0.1);
  border-radius: 6px;
  display: none;
}

.auth-error.visible { display: block; }

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

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo svg { color: var(--accent); flex-shrink: 0; }

.sidebar-logo span {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: rgba(108, 99, 255, 0.15); color: var(--accent); }
.nav-link svg { flex-shrink: 0; }

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

/* Pushes Subscribe/Help/Admin to the bottom of the nav */
.nav-spacer { flex: 1; min-height: 16px; }

/* Subscribe gets a subtle accent highlight */
.nav-subscribe { color: var(--accent) !important; }
.nav-subscribe:hover { background: rgba(108,99,255,0.12) !important; }
.nav-subscribe svg { color: var(--accent); }

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

/* ── Topbar button groups ─────────────────────────────────── */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.topbar-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 2px;
}

/* Pill-grouped buttons share a single rounded border */
.btn-group {
  display: flex;
  align-items: stretch;
}

.btn-group > button {
  border-radius: 0;
  border-right-width: 0;
}

.btn-group > button:first-child { border-radius: 8px 0 0 8px; }
.btn-group > button:last-child  { border-radius: 0 8px 8px 0; border-right-width: 1px; }

/* ── AiManic branding footer ──────────────────────────────── */
.aimanic-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px 18px;
  border-top: 1px solid var(--border);
}

.aimanic-brand-powered {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.aimanic-brand-powered svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.aimanic-brand-terms {
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.7;
}

.aimanic-brand-terms:hover {
  opacity: 1;
  color: var(--text-muted);
}

.aimanic-brand-copy {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.55;
  text-align: center;
}

/* standalone page footer */
.aimanic-page-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 24px 40px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}

.aimanic-page-footer .aimanic-brand-powered {
  font-size: 13px;
}

.aimanic-page-footer .aimanic-brand-copy {
  font-size: 12px;
  opacity: 0.6;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}

.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.user-chip-name:hover { color: var(--accent); }
.user-chip-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px;
  background: transparent; color: var(--text-muted);
  font-weight: 500; font-size: 14px;
  width: 100%; margin-top: 6px;
  transition: background var(--transition), color var(--transition);
}

.btn-logout:hover { background: rgba(255,92,122,0.1); color: var(--danger); }

/* ── Main content ─────────────────────────────────────────── */
.main {
  margin-left: var(--nav-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  padding: 24px 32px 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.btn-upload-top {
  display: flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff;
  padding: 10px 18px; border-radius: 8px;
  font-weight: 600; font-size: 14px;
  flex-shrink: 0;
}

.btn-upload-top:hover { background: var(--accent-h); }

.content-area {
  flex: 1;
  padding: 28px 32px 40px;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
}

/* ── Drop zone ────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 20px;
  padding: 64px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  text-align: center;
  max-width: 520px;
  width: 100%;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.05);
}

.drop-zone-icon {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: rgba(108, 99, 255, 0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}

.drop-zone h3 { font-size: 20px; font-weight: 700; }
.drop-zone p { color: var(--text-muted); font-size: 14px; max-width: 320px; }

.drop-zone-hint {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 20px;
  padding: 5px 14px;
}

/* ── Upload modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 18px; font-weight: 700; }

.btn-close {
  background: var(--surface-2); color: var(--text-muted);
  border-radius: 8px; padding: 6px 8px;
  font-size: 18px; line-height: 1;
}

.btn-close:hover { color: var(--text); }

/* upload progress list */
.upload-list { display: flex; flex-direction: column; gap: 10px; }

.upload-item {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--bg);
  flex-shrink: 0;
}

.upload-thumb-placeholder {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.upload-info { flex: 1; min-width: 0; }
.upload-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.upload-status { font-size: 12px; font-weight: 600; flex-shrink: 0; }
.upload-status.pending  { color: var(--text-muted); }
.upload-status.uploading { color: var(--accent); }
.upload-status.done  { color: var(--success); }
.upload-status.error { color: var(--danger); }

.progress-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  margin-top: 6px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ── Media grid ───────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}

.media-card:hover { transform: translateY(-2px); border-color: var(--accent); }

.media-card-thumb {
  aspect-ratio: 1;
  width: 100%;
  object-fit: contain;
  background: var(--bg);
  display: block;
}

.media-card-thumb-placeholder {
  aspect-ratio: 1;
  width: 100%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.media-card-info {
  padding: 10px 12px;
}

.media-card-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.media-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.media-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px;
}

.media-type-badge.image { background: rgba(108,99,255,0.15); color: var(--accent); }
.media-type-badge.video { background: rgba(255,92,122,0.12); color: var(--danger); }

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

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}

.group-card:hover { transform: translateY(-2px); border-color: var(--accent); }

.group-card-cover {
  height: 150px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.group-card-cover img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.group-card-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.group-card-count {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 99px;
  backdrop-filter: blur(4px);
}

.group-card-body { padding: 14px 16px; }
.group-card-title { font-size: 14px; font-weight: 700; }
.group-card-summary { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag { font-size: 11px; background: var(--surface-2); border-radius: 99px; padding: 3px 9px; color: var(--text-muted); }

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
  padding: 24px;
}

.lightbox.open { display: flex; }

.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.lightbox img, .lightbox video {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 10px;
  object-fit: contain;
}

.lightbox-meta {
  color: var(--text-muted); font-size: 13px; text-align: center;
}

.btn-lightbox-close {
  position: fixed; top: 20px; right: 24px;
  background: rgba(255,255,255,0.1);
  color: #fff; border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.btn-lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ── Toasts ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
  display: flex; align-items: center; gap: 10px;
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }

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

/* ── Section headers ──────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.section-title { font-size: 18px; font-weight: 700; }
.section-count { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Filters ──────────────────────────────────────────────── */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 7px 14px; border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-center {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px;
}

/* ── Metadata edit modal ──────────────────────────────────── */
.meta-modal { max-width: 720px; width: 100%; }

.meta-modal-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

.meta-preview { display: flex; flex-direction: column; gap: 10px; }

.meta-preview img, .meta-preview video {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  border-radius: 10px; background: var(--bg); display: block;
}

.meta-preview-placeholder {
  width: 100%; aspect-ratio: 1; background: var(--surface-2);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; color: var(--text-muted);
}

.meta-preview-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-preview-size { font-size: 11px; color: var(--text-muted); }

.btn-view-full { font-size: 12px; font-weight: 500; color: var(--accent); background: transparent; padding: 0; text-align: left; }
.btn-view-full:hover { color: var(--accent-h); }

/* ── EXIF panel ────────────────────────────────────────────── */
.exif-section { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.exif-toggle {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  font-family: inherit; width: 100%; text-align: left;
  transition: color 0.15s;
}
.exif-toggle:hover { color: var(--text); }
.exif-toggle svg { transition: transform 0.2s; flex-shrink: 0; }
.exif-toggle--open svg { transform: rotate(180deg); }
.exif-body { margin-top: 8px; }
.exif-loading, .exif-empty { font-size: 11px; color: var(--text-muted); padding: 4px 0; }
.exif-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.exif-table tr + tr td { border-top: 1px solid var(--border); }
.exif-label { color: var(--text-muted); padding: 4px 8px 4px 0; white-space: nowrap; vertical-align: top; }
.exif-value { color: var(--text); padding: 4px 0; word-break: break-word; }

/* AI journal description — editable textarea hint */
.ai-field-label {
  display: flex; align-items: center; gap: 6px;
}
.ai-field-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent);
  background: rgba(108, 99, 255, 0.12); border-radius: 99px;
  padding: 2px 8px;
}
.ai-field-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 5px;
  font-weight: 400; line-height: 1.5;
}

.meta-form { display: flex; flex-direction: column; gap: 13px; }
.meta-form .form-label { font-size: 12px; color: var(--text-muted); font-weight: 500; display: flex; flex-direction: column; gap: 5px; }

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

.meta-form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }

.btn-secondary {
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 18px; font-weight: 500; font-size: 14px;
}
.btn-secondary:hover { color: var(--text); border-color: var(--accent); }

.btn-danger {
  display: flex; align-items: center; gap: 6px;
  background: transparent; color: var(--danger);
  border: 1px solid rgba(255, 92, 122, 0.35);
  border-radius: 8px; padding: 10px 16px;
  font-weight: 500; font-size: 14px;
  transition: background var(--transition), border-color var(--transition);
}
.btn-danger:hover { background: rgba(255,92,122,0.1); border-color: var(--danger); }

/* ── Timeline ─────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 8px; max-width: 860px; }

.timeline-year-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 18px; font-weight: 700;
  transition: background var(--transition), border-color var(--transition); text-align: left;
}
.timeline-year-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.timeline-year-btn.open  { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.timeline-year-count { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: auto; }
.timeline-chevron { color: var(--text-muted); transition: transform var(--transition); flex-shrink: 0; }
.open .timeline-chevron { transform: rotate(90deg); }

.timeline-months {
  border: 1px solid var(--accent); border-top: none;
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
  padding: 8px 12px 12px; background: var(--surface);
  display: flex; flex-direction: column; gap: 2px;
}

.timeline-month-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; background: transparent;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: background var(--transition), color var(--transition); text-align: left;
}
.timeline-month-btn:hover { background: var(--surface-2); color: var(--text); }
.timeline-month-btn.open  { background: rgba(108,99,255,0.1); color: var(--accent); }
.timeline-month-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }

.timeline-days { padding: 10px 2px 4px; }

/* ── Day grid (month view) ───────────────────────────────── */
.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 4px 0 8px;
}

.day-grid-card {
  border-radius: 12px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.day-grid-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.35); }

.day-grid-cover {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg);
}
.day-grid-cover img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.day-grid-card:hover .day-grid-cover img { transform: scale(1.04); }
.day-grid-cover-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.day-grid-count {
  position: absolute; bottom: 8px; left: 8px;
  font-size: 11px; font-weight: 600;
  background: rgba(0,0,0,0.55); color: #fff;
  padding: 2px 8px; border-radius: 99px;
  backdrop-filter: blur(4px);
}

.day-grid-delete {
  position: absolute; top: 7px; right: 7px;
  background: rgba(0,0,0,0.55); color: #fff;
  border: none; border-radius: 6px;
  padding: 5px; opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  backdrop-filter: blur(4px);
}
.day-grid-card:hover .day-grid-delete { opacity: 1; }
.day-grid-delete:hover { background: rgba(239,68,68,0.8); }

.day-grid-body { padding: 12px 14px 14px; }
.day-grid-title { font-size: 13px; font-weight: 700; line-height: 1.3; }
.day-grid-summary {
  font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.day-grid-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ── AI description confirm dialog ───────────────────────── */
#confirm-modal    { z-index: 300; } /* sits above all other modals */
#ai-confirm-modal { z-index: 150; } /* sits above other modals (z-index 100) */

.ai-confirm-modal {
  max-width: 400px;
  text-align: center;
  padding: 36px 32px 32px;
}
.ai-confirm-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(108, 99, 255, 0.12); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.ai-confirm-heading {
  font-size: 18px; font-weight: 700; margin-bottom: 10px;
}
.ai-confirm-message {
  font-size: 14px; color: var(--text-muted); line-height: 1.6;
  margin-bottom: 28px;
}
.ai-confirm-actions {
  display: flex; gap: 10px;
}
.ai-confirm-actions .btn-secondary,
.ai-confirm-actions .btn-primary { flex: 1; justify-content: center; }

/* ── Confirm dialog ───────────────────────────────────────── */
.confirm-modal {
  max-width: 380px;
  text-align: center;
  padding: 36px 32px 32px;
}
.confirm-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255, 92, 122, 0.12); color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.confirm-heading {
  font-size: 18px; font-weight: 700; margin-bottom: 10px;
}
.confirm-message {
  font-size: 14px; color: var(--text-muted); line-height: 1.6;
  margin-bottom: 28px;
}
.confirm-actions {
  display: flex; gap: 10px;
}
.confirm-actions .btn-secondary { flex: 1; }
.confirm-actions .btn-danger    { flex: 1; justify-content: center; }

/* ── Group detail summary block ───────────────────────────── */
.group-detail-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
  max-width: 680px;
}

.group-detail-summary p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}

/* ── Group detail notes ────────────────────────────────────── */
.group-notes-section {
  margin-bottom: 28px;
  max-width: 680px;
}

.group-notes-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
  resize: vertical;
  font-family: inherit;
  margin-top: 6px;
}

.group-notes-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.group-notes-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* ── Frame Extractor metadata step ────────────────────────── */
.editor-meta-step { max-width: 520px; }

.editor-meta-filename {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  word-break: break-all;
}

.editor-meta-form { display: flex; flex-direction: column; gap: 16px; }

.editor-meta-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ── Frame Extractor ───────────────────────────────────────── */
.editor-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  max-width: 680px;
}

.editor-upload-zone:hover,
.editor-upload-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.editor-drop-icon { color: var(--text-muted); margin-bottom: 16px; }

.editor-drop-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 6px;
}

.editor-drop-browse { color: var(--accent); text-decoration: underline; cursor: pointer; }

.editor-drop-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.editor-drop-note {
  font-size: 12px;
  color: var(--text-muted);
  opacity: .7;
  margin: 0;
}

/* progress */
.editor-progress-section { max-width: 520px; margin-top: 32px; }

.editor-progress-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
}

.editor-progress-bar-wrap {
  background: var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.editor-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .4s ease;
}

.editor-progress-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* results */
.editor-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.editor-results-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.editor-results-sub { font-size: 13px; color: var(--text-muted); }

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

.editor-frame-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-frame-thumb-wrap {
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  flex-shrink: 0;
}

.editor-frame-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .2s ease;
}

.editor-frame-thumb.loaded { opacity: 1; }

.editor-frame-thumb.loaded { opacity: 1; }

.editor-frame-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  gap: 6px;
}

.editor-frame-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.editor-frame-actions { display: flex; gap: 6px; flex-shrink: 0; }

.editor-frame-dl {
  font-size: 13px;
  padding: 4px 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.editor-frame-save { font-size: 12px; padding: 4px 8px; white-space: nowrap; }

.editor-frame-saved {
  background: var(--success, #22c55e) !important;
  cursor: default;
}

/* ── Cover image badge & set-cover button ──────────────────── */
.media-card { position: relative; }

.cover-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 99px;
  pointer-events: none;
}

.btn-set-cover {
  background: none;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  margin-left: 6px;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}

.btn-set-cover:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Journal media grid (group detail) ────────────────────── */
/* ── Journal entry detail — photo grid ───────────────────── */
.journal-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
  margin-bottom: 0;
}

.journal-photo-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
}

.journal-photo-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform 0.35s ease;
}
.journal-photo-item:hover .journal-photo-img { transform: scale(1.04); }

.journal-photo-video-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.journal-photo-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 12px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.journal-photo-item:hover .journal-photo-overlay { opacity: 1; }

.journal-photo-desc {
  font-size: 12px; line-height: 1.5; color: rgba(255,255,255,0.9);
  margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.journal-photo-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: rgba(255,255,255,0.6);
}

/* ── Journal entry body (summary + notes) ────────────────── */
.journal-entry-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.journal-entry-summary {
  position: relative;
  margin-bottom: 36px;
  text-align: center;
}

.journal-entry-summary--empty .journal-entry-summary-text {
  color: var(--text-muted);
  font-style: italic;
}

.journal-entry-summary-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.journal-entry-summary-text {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  line-height: 1.85;
  color: var(--text);
  letter-spacing: 0.01em;
  white-space: pre-wrap;
  text-align: left;
}

/* ── Admin settings view ──────────────────────────────────── */
/* Admin tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
}
.admin-tab:hover  { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-tab-count {
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
}

/* Admin badges */
.admin-badge {
  display: inline-block;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  text-transform: capitalize;
}
.admin-badge--active     { background: rgba(67,217,140,0.12); color: #43d98c; }
.admin-badge--cancelled  { background: rgba(255,92,122,0.10); color: var(--danger); }
.admin-badge--none       { background: var(--surface-2); color: var(--text-muted); }
.admin-badge--verified   { background: rgba(67,217,140,0.10); color: #43d98c; }
.admin-badge--unverified { background: rgba(255,170,0,0.10); color: #ffaa00; }

/* Users table */
.admin-card--flush { padding: 0; overflow: hidden; }
.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-users-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.admin-users-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-users-table tbody tr:last-child td { border-bottom: none; }
.admin-users-table tbody tr:hover td     { background: rgba(255,255,255,0.02); }
.admin-user-name  { font-weight: 600; color: var(--text); }
.admin-user-email { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-top: 2px; }
.admin-user-active { color: var(--text-muted); font-size: 12px; }
.admin-role-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
}
.admin-role-select:focus   { outline: none; border-color: var(--accent); }
.admin-role-select:disabled { opacity: 0.5; cursor: not-allowed; }

.admin-block-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin-block-btn:hover            { background: rgba(255,92,122,0.1); color: var(--danger); border-color: var(--danger); }
.admin-block-btn--blocked         { background: rgba(255,92,122,0.1); color: var(--danger); border-color: var(--danger); }
.admin-block-btn--blocked:hover   { background: rgba(67,217,140,0.1); color: #43d98c; border-color: #43d98c; }
.admin-block-btn:disabled         { opacity: 0.5; cursor: not-allowed; }
.admin-age-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin-age-btn:hover             { background: rgba(67,217,140,0.1); color: #43d98c; border-color: #43d98c; }
.admin-age-btn--verified         { background: rgba(67,217,140,0.1); color: #43d98c; border-color: #43d98c; }
.admin-age-btn--verified:hover   { background: rgba(255,92,122,0.1); color: var(--danger); border-color: var(--danger); }
.admin-age-btn:disabled          { opacity: 0.5; cursor: not-allowed; }

.admin-settings {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-card-header { display: flex; flex-direction: column; gap: 6px; }

.admin-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.admin-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.admin-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font-family: inherit;
  transition: border-color var(--transition);
}

.admin-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-default-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 14px;
}

.admin-default-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 1px;
  flex-shrink: 0;
}

.admin-default-text {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  line-height: 1.5;
}

.btn-reset-prompt {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition);
}

.btn-reset-prompt:hover {
  color: var(--text);
  border-color: var(--accent);
}

.admin-context-preview {
  background: rgba(108,99,255,0.07);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-context-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.admin-context-example {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.admin-context-example em {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-actions .btn-primary {
  padding: 11px 28px;
  font-size: 14px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --nav-w: 64px; }
  .sidebar-logo span, .nav-link span, .user-chip-info,
  .btn-logout span, .nav-section-label { display: none; }
  .nav-link { justify-content: center; padding: 12px; }
  .sidebar-logo { justify-content: center; padding: 20px 0; }
  .btn-logout { justify-content: center; }
  .main { margin-left: var(--nav-w); }
  .topbar, .content-area { padding-left: 16px; padding-right: 16px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .journal-photo-grid { grid-template-columns: repeat(2, 1fr); }
  .day-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .journal-entry-summary-text { font-size: 17px; }
  .journal-entry-body { padding: 28px 16px 48px; }
  .meta-modal-layout { grid-template-columns: 1fr; }
  .meta-form-row { grid-template-columns: 1fr; }
  .chat-win { width: calc(100vw - 32px); right: 16px; }
}

/* ── Chat Widget ────────────────────────────────────────────────────────────── */

.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-fab:hover { transform: scale(1.07); box-shadow: 0 6px 24px rgba(108, 99, 255, 0.6); }
.chat-fab .hidden { display: none; }

.chat-win {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9001;
  width: 370px;
  height: 530px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s;
}
.chat-win-hidden {
  transform: scale(0.82) translateY(16px);
  opacity: 0;
  pointer-events: none;
}

/* Header */
.chat-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.chat-hdr-left { display: flex; align-items: center; gap: 10px; }
.chat-hdr-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.chat-hdr-title { font-size: 13px; font-weight: 600; color: var(--text); }
.chat-hdr-sub   { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.chat-hdr-actions { display: flex; gap: 2px; }

.chat-icon-btn {
  background: none; border: none; padding: 6px; border-radius: 6px;
  cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center;
  transition: background 0.13s, color 0.13s;
}
.chat-icon-btn:hover { background: var(--surface); color: var(--text); }

/* Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Footer */
.chat-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, background 0.15s;
}
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.chat-send-btn:not(:disabled):hover { background: var(--accent-h); }

/* Messages */
.chat-msgs { padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.chat-msg { display: flex; gap: 7px; align-items: flex-end; }
.chat-msg-u  { flex-direction: row-reverse; }

.chat-msg-av {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}

.chat-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.chat-msg-u  .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-ai .chat-bubble {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-bubble ul, .chat-bubble ol { margin: 6px 0 0 16px; }
.chat-bubble li { margin-bottom: 2px; }
.chat-bubble code {
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: monospace;
}
.chat-bubble strong { font-weight: 600; }

/* Typing dots */
.chat-typing-dots {
  display: flex; gap: 4px; align-items: center;
  padding: 10px 14px !important;
}
.chat-typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatDot 1.2s ease-in-out infinite;
}
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* Sessions list */
.chat-sess-list { padding: 8px; }
.chat-sess-label {
  font-size: 10.5px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 8px 10px 4px;
}
.chat-sess-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.chat-sess-item:hover { background: var(--surface-2); }
.chat-sess-title {
  font-size: 13px; color: var(--text);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-sess-meta { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.chat-sess-del {
  background: none; border: none;
  padding: 4px; border-radius: 4px;
  cursor: pointer; color: var(--text-muted);
  opacity: 0; display: flex; align-items: center;
  transition: opacity 0.12s, color 0.12s;
}
.chat-sess-item:hover .chat-sess-del { opacity: 1; }
.chat-sess-del:hover { color: var(--danger); }

/* Welcome / empty states */
.chat-welcome {
  padding: 28px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.chat-welcome-star {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(108, 99, 255, 0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.chat-welcome h3 { font-size: 16px; color: var(--text); margin: 0; }
.chat-welcome p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 0; }

.chat-empty { padding: 20px 14px; display: flex; flex-direction: column; gap: 14px; }
.chat-empty-hint { font-size: 13px; color: var(--text-muted); text-align: center; margin: 0; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.chat-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 12px; color: var(--text);
  cursor: pointer; font-family: inherit;
  transition: border-color 0.12s, color 0.12s;
}
.chat-chip:hover { border-color: var(--accent); color: var(--accent); }

/* Loading / error */
.chat-loader { display: flex; align-items: center; justify-content: center; height: 100%; }
.chat-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.chat-err {
  padding: 20px; text-align: center;
  font-size: 13px; color: var(--danger);
}

/* ── AI Image Generation ──────────────────────────────────── */
.btn-imagegen {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #a78bfa, var(--accent));
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.btn-imagegen:hover { opacity: 0.88; }

.imagegen-modal { max-width: 600px; }
.imagegen-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.imagegen-row { display: flex; gap: 12px; }

.imagegen-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
}
.imagegen-select:focus { outline: none; border-color: var(--accent); }

.imagegen-status {
  margin-top: 14px;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
}
.imagegen-status--busy  { background: rgba(108,99,255,0.1); color: var(--accent); }
.imagegen-status--done  { background: rgba(67,217,140,0.1);  color: var(--success); }
.imagegen-status--error { background: rgba(255,92,122,0.1);  color: var(--danger); }

.imagegen-result { margin-top: 16px; }
.imagegen-result-img {
  width: 100%;
  border-radius: 10px;
  display: block;
  margin-bottom: 12px;
  max-height: 400px;
  object-fit: contain;
  background: var(--surface-2);
}
.imagegen-result-actions { display: flex; gap: 8px; }
.imagegen-download {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.imagegen-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── New AI Entry modal ───────────────────────────────────── */
/* ── Two-panel modal split ───────────────────────────────────── */
.modal-split {
  display: flex;
  gap: 0;
  margin-top: 20px;
  min-height: 400px;
}

.modal-panel-left {
  width: 196px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-right: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.modal-panel-right {
  flex: 1;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.modal-panel-group {
  margin-bottom: 18px;
}

.modal-panel-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

/* left-panel inputs go full width */
.modal-panel-left .form-input,
.modal-panel-left input[type="text"],
.modal-panel-left input[type="date"],
.modal-panel-left select,
.modal-panel-left textarea {
  width: 100%;
  margin-top: 6px;
}

/* spacer to push last group to bottom of left panel */
.modal-panel-spacer { flex: 1; }

/* ── AI entry modal ─────────────────────────────────────────── */
.ai-entry-modal { max-width: 820px; }

.ai-entry-preview  { margin-top: 4px; }
.ai-entry-preview img {
  width: 100%;
  border-radius: 10px;
  display: block;
  max-height: 300px;
  object-fit: contain;
  background: var(--surface-2);
}
.ai-entry-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 8px;
}
.nav-ai-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 8px;
}
.nav-ai-entry:hover { background: var(--surface-2); color: var(--accent); }

/* ── Toonify ──────────────────────────────────────────────── */
.btn-toonify {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.12s, background 0.12s;
}
.btn-toonify:hover { border-color: var(--accent); background: rgba(var(--accent-rgb,99,102,241),0.08); }

.toonify-modal { max-width: 860px; }
.toonify-subtitle { font-size: 13px; color: var(--text-muted); margin: -8px 0 0; }

/* ── Toonify image picker ──────────────────────────────────── */
.toonify-pick-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; max-height: 340px; overflow-y: auto; }
.toonify-pick-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  transition: opacity 0.2s;
}
.toonify-pick-item--off { opacity: 0.35; }
.toonify-pick-check { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-shrink: 0; }
.toonify-pick-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.toonify-pick-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
.toonify-pick-meta { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.toonify-pick-name { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toonify-caption-input {
  width: 100%; padding: 7px 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; box-sizing: border-box; font-family: inherit;
}
.toonify-caption-input:focus { outline: none; border-color: var(--accent); }
.toonify-fallback-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.toonify-fallback-radio { accent-color: var(--accent); cursor: pointer; }
.toonify-fallback-hint { font-size: 12px; color: var(--text-muted); margin: -8px 0 4px; font-style: italic; }
.toonify-opacity-slider { width: 100%; margin-top: 6px; accent-color: var(--accent); cursor: pointer; }

.toonify-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toonify-style-toggle { display: flex; gap: 6px; margin-top: 4px; }
.toonify-style-btn {
  flex: 1; padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
  cursor: pointer; font-family: inherit; transition: all 0.12s;
}
.toonify-style-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb,99,102,241),0.1); }

.toonify-input {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 13px; font-family: inherit;
  margin-top: 4px;
}
.toonify-color {
  width: 100%; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; padding: 2px; margin-top: 4px;
}

/* Progress list */
.toonify-progress-list {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px;
}
.toonify-progress-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border-radius: 8px; padding: 8px 10px;
}
.toonify-prog-thumb {
  width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
}
.toonify-prog-name { flex: 1; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toonify-prog-status { font-size: 11px; font-weight: 600; flex-shrink: 0; color: var(--text-muted); }
.toonify-prog-working { color: var(--accent); }
.toonify-prog-done { color: #34d399; }
.toonify-prog-error { color: var(--danger); }

.toonify-actions { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }

.toonify-error {
  color: var(--danger); font-size: 13px; margin-top: 12px;
  padding: 10px; border-radius: 8px; background: rgba(255,92,122,0.08);
}
.toonify-warn {
  color: #f59e0b; font-size: 12px; margin-top: 8px;
  padding: 8px 10px; border-radius: 8px; background: rgba(245,158,11,0.08);
}
.toonify-result-img { margin-top: 16px; }
.toonify-result-img img { width: 100%; border-radius: 10px; display: block; margin-bottom: 10px; }
.toonify-result-actions { display: flex; gap: 8px; }
.toonify-result-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 14px; }
.toonify-result-grid img { max-width: 100%; max-height: 45vh; width: auto; height: auto; border-radius: 10px; display: block; object-fit: contain; }
.toonify-download { flex: 1; justify-content: center; text-decoration: none; }
#toonify-add-journal { flex: 1; }

/* ── Group detail summary edit ───────────────────────────── */
/* Legacy class kept for compatibility but overridden by .journal-entry-summary */
.group-detail-summary { display: none; }
.group-detail-summary-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.btn-edit-summary {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}
.btn-edit-summary:hover {
  background: rgba(108,99,255,0.1);
  border-color: var(--accent);
}

/* ── Edit summary modal ───────────────────────────────────── */
.summary-edit-modal { max-width: 640px; }

.summary-edit-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  margin-top: 12px;
}

.summary-edit-ai-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 6px;
  margin-top: 8px;
}
.summary-edit-ai-hint--busy  { background: rgba(108,99,255,0.1); color: var(--accent); }
.summary-edit-ai-hint--info  { background: rgba(67,217,140,0.1);  color: var(--success); }
.summary-edit-ai-hint--error { background: rgba(255,92,122,0.1);  color: var(--danger); }

/* Actions row: cancel on left, tool group + save on right */
.summary-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.summary-edit-actions-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ai-improve {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: linear-gradient(135deg, #a78bfa, var(--accent));
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.btn-ai-improve:hover { opacity: 0.88; }
.btn-ai-improve:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Dictation ────────────────────────────────────────────── */
.group-notes-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-dictate {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
}
.btn-dictate:hover { background: var(--border); }

.btn-dictate--recording {
  background: rgba(255, 92, 122, 0.15);
  border-color: var(--danger);
  color: var(--danger);
  animation: dictate-pulse 1.2s ease-in-out infinite;
}

@keyframes dictate-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,92,122,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(255,92,122,0); }
}

.dictate-status {
  margin-top: 8px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
}
.dictate-status--recording { background: rgba(255,92,122,0.1); color: var(--danger); }
.dictate-status--busy      { background: rgba(108,99,255,0.1); color: var(--accent); }
.dictate-status--done      { background: rgba(67,217,140,0.1); color: var(--success); }
.dictate-status--error     { background: rgba(255,92,122,0.1); color: var(--danger); }

/* ── Subscribe nav button ─────────────────────────────────── */
.nav-subscribe {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.nav-subscribe:hover { opacity: 0.88; }
.nav-subscribe svg { flex-shrink: 0; }

/* ── Subscription modal ───────────────────────────────────── */
.subscription-modal {
  max-width: 680px;
  width: 100%;
}

.subscription-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.subscription-plans {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  .subscription-plans { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .subscription-plans { grid-template-columns: 1fr; }
}

.subscription-plan {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.plan-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.plan-header { display: flex; flex-direction: column; gap: 4px; }

.plan-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.plan-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.plan-period {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.plan-features li {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

.btn-plan-select {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  width: 100%;
  transition: background var(--transition), opacity var(--transition);
}

.btn-plan-select:hover { background: var(--accent-h); }
.btn-plan-select:disabled { opacity: 0.55; cursor: not-allowed; }

.plan-featured .btn-plan-select {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
}

.plan-badge--save {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.plan-trial-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: -8px;
}

.btn-plan-trial {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
}

/* ── Auth T&C checkbox ────────────────────────────────────── */
.auth-tc-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
  margin-top: 4px;
}
.auth-tc-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.auth-tc-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-tc-link:hover { color: var(--text); }

/* Turnstile widget spacing */
.cf-turnstile { margin: 8px 0 4px; }

/* ── Help view ────────────────────────────────────────────── */
.help-view { max-width: 860px; margin: 0 auto; padding: 0 0 60px; }

.help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.help-title    { font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.help-subtitle { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.5; }
.help-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.help-chat-btn,
.help-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 9px 16px;
  font-size: 13px;
}

/* Contact modal */
.contact-modal    { width: 480px; max-width: 95vw; }
.contact-intro    { margin: 0 0 20px; font-size: 14px; color: var(--text-muted); }
.contact-message  { resize: vertical; min-height: 100px; }
.required         { color: var(--accent); }
.contact-turnstile { margin: 4px 0 8px; }
.contact-status   { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 8px; }
.contact-status--error   { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.contact-status--success { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }

/* ── Profile modal ───────────────────────────────────────── */
.profile-modal { width: 580px; max-width: 96vw; }
.profile-modal-body { padding-top: 4px; }

.profile-avatar-row {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-avatar-name  { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.profile-avatar-email { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.profile-sub-badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 2px 10px; border-radius: 99px;
  background: var(--border); color: var(--text-muted);
}
.profile-sub-badge--active { background: rgba(34,197,94,0.15); color: #4ade80; }

.profile-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 20px 0 12px;
}
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.profile-sub-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.profile-sub-plan   { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.profile-sub-status { font-size: 12px; color: var(--text-muted); }

/* Table of contents */
.help-toc        { margin-bottom: 32px; }
.help-toc-nav    { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.help-toc-label  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-right: 4px; }
.help-toc-link   {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  background: rgba(108,99,255,0.08);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 20px;
  padding: 4px 12px;
  transition: background 0.15s;
}
.help-toc-link:hover { background: rgba(108,99,255,0.18); }

/* Sections */
.help-section { margin-bottom: 36px; }
.help-section--depth-2 { margin-left: 0; padding-left: 16px; border-left: 2px solid var(--border); margin-bottom: 20px; }
.help-heading  { font-size: 18px; font-weight: 700; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.help-section--depth-2 .help-heading { font-size: 15px; border-bottom: none; padding-bottom: 0; color: var(--text); }
.help-body     { font-size: 14px; line-height: 1.75; color: var(--text-secondary, var(--text)); }
.help-body p   { margin: 0 0 12px; }
.help-body ul  { padding-left: 20px; margin: 0 0 12px; }
.help-body li  { margin-bottom: 5px; }
.help-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 14px;
  margin: 12px 0;
  background: rgba(108,99,255,0.06);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.help-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12px;
  margin: 12px 0;
}
.help-body code {
  background: var(--surface-2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
}
.help-body pre code { background: none; padding: 0; }

/* Tables */
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
}
.help-table th, .help-table td {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--border);
}
.help-table th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text);
}
.help-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }


/* ── Home / Landing page ───────────────────────────────────── */
.home-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.home-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}

.home-logo svg {
  color: var(--accent);
}

.home-header-cta {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: border-color var(--transition), background var(--transition);
}

.home-header-cta:hover {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--text);
}

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.home-hero {
  text-align: center;
  padding: 72px 24px 48px;
}

.home-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
}

.home-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

.home-video-section {
  width: 100%;
}

/* Outer frame: side columns + video */
.home-video-frame {
  display: grid;
  grid-template-columns: 180px 1fr 180px;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  height: 55vh;
  overflow: hidden;
}

/* Side columns */
.home-video-side {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Individual image slots */
.home-side-img {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-side-img + .home-side-img {
  border-top: none;
}

.home-video-side--left .home-side-img {
  border-right: none;
}

.home-video-side--right .home-side-img {
  border-left: none;
}

.home-side-img__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-side-img__img--hidden {
  display: none;
}

.home-side-img__label {
  position: absolute;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
  text-align: center;
  padding: 4px;
  pointer-events: none;
}

.home-video-wrapper {
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Shown when no <source> is present */
.home-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.home-video-placeholder svg {
  opacity: 0.4;
}

.home-cta-section {
  display: flex;
  justify-content: center;
  padding: 56px 24px 80px;
}

.home-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 18px 52px;
  border-radius: var(--radius);
  letter-spacing: 0.01em;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 24px rgba(108, 99, 255, 0.35);
}

.home-cta-btn:hover {
  background: var(--accent-h);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(108, 99, 255, 0.5);
}

.home-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.home-footer-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-footer-link:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .home-video-frame { grid-template-columns: 100px 1fr 100px; }
}

@media (max-width: 600px) {
  .home-header { padding: 16px 20px; }
  .home-hero { padding: 48px 20px 32px; }
  .home-video-frame { grid-template-columns: 1fr; }
  .home-video-side { display: none; }
  .home-video-wrapper { aspect-ratio: 16 / 9; }
  .home-cta-btn { font-size: 1rem; padding: 16px 36px; }
}

/* Modal shared helpers */
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-body { padding: 0; }

/* ── Support panel ───────────────────────────────────────────── */
.support-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.support-btn-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.support-btn-archive:not(:disabled) {
  color: var(--text-muted);
}

.support-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.support-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.support-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.support-table tbody tr:last-child td { border-bottom: none; }
.support-row { cursor: pointer; }
.support-row:hover td { background: rgba(255,255,255,0.025); }
.support-row--selected td { background: rgba(108,99,255,0.08); }
.support-ref { font-weight: 700; color: var(--accent); font-size: 12px; font-family: monospace; }
.support-email-cell { color: var(--text-muted); font-size: 12px; }
.support-date { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

.support-badge {
  display: inline-block;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  text-transform: capitalize;
}
.support-badge--open     { background: rgba(108,99,255,0.15); color: #a09cff; }
.support-badge--closed   { background: rgba(67,217,140,0.12); color: #43d98c; }
.support-badge--archived { background: var(--surface-2); color: var(--text-muted); }

/* Support modals */
.support-modal { width: 540px; max-width: 96vw; }
.support-modal--wide { width: 680px; }
.support-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.form-required { color: var(--danger); }

/* Support ticket thread */
.support-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding: 4px 2px;
}
.support-thread-msg {
  border-radius: 8px;
  padding: 12px 14px;
}
.support-thread-msg--customer {
  background: var(--surface-2);
  border: 1px solid var(--border);
  align-self: flex-start;
  max-width: 88%;
}
.support-thread-msg--agent {
  background: rgba(108,99,255,0.1);
  border: 1px solid rgba(108,99,255,0.25);
  align-self: flex-end;
  max-width: 88%;
}
.support-thread-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 12px;
}
.support-thread-who {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.support-thread-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.support-thread-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Image editor ─────────────────────────────────────────────────────────────── */

.btn-edit-image {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
  padding: 0;
}
.media-card:hover .btn-edit-image {
  opacity: 1;
}

.ie-modal {
  width: 92vw;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.ie-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  align-items: center;
}

.ie-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ie-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.ie-btn:hover {
  background: var(--bg-hover);
}

.ie-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.ie-dim-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.ie-dim-input {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12px;
  text-align: right;
}

.ie-dim-sep {
  font-size: 13px;
  color: var(--text-muted);
}

.ie-lock-btn {
  font-size: 14px;
  padding: 3px 7px;
}

.ie-canvas-wrap {
  flex: 1;
  overflow: auto;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 12px;
}

.ie-canvas-wrap img {
  max-width: 100%;
  display: block;
}

/* ── Saved Readings ─────────────────────────────────────────────────────────── */
.recordings-section {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.recordings-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: block;
}
.recordings-list { display: flex; flex-direction: column; gap: 8px; }
.recordings-empty { font-size: 13px; color: var(--text-muted); font-style: italic; }
.recording-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  transition: border-color var(--transition);
}
.recording-row--playing {
  border-color: var(--accent);
  background: rgba(108,99,255,0.06);
}
.recording-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), transform 0.1s;
}
.recording-play-btn:hover { background: var(--accent-h); transform: scale(1.06); }
.recording-play-btn--playing { background: var(--success); }
.recording-meta { flex: 1; min-width: 0; }
.recording-date { display: block; font-size: 13px; font-weight: 500; color: var(--text); }
.recording-voice { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.recording-delete-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.recording-delete-btn:hover { background: rgba(255,92,122,0.1); border-color: var(--danger); color: var(--danger); }

/* ── Text-to-Speech ─────────────────────────────────────────────────────────── */

.btn-tts {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn-tts:hover { background: var(--surface); border-color: var(--accent); }
.btn-tts--playing { border-color: var(--success); color: var(--success); }
.btn-tts--playing:hover { background: var(--surface); }

.btn-tts-settings {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}
.btn-tts-settings:hover { color: var(--text); border-color: var(--accent); }

/* TTS settings modal/popover */
.tts-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 70px 24px 0;
  pointer-events: none;
}
.tts-settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 340px;
  pointer-events: all;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tts-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}
.tts-settings-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 6px;
}
.tts-settings-close:hover { color: var(--text); }
.tts-url-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  font-family: monospace;
}
.tts-url-input:focus { outline: none; border-color: var(--accent); }
.tts-settings-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.tts-settings-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}
.tts-settings-hint code {
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
}

.tts-url-active {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 8px 10px;
  font-size: 12px;
  font-family: monospace;
  word-break: break-all;
}

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

/* TTS voice picker */
.tts-vpc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.tts-vpc-loading {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}
.tts-vpc-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  padding: 9px 12px;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}
.tts-vpc-item:hover { border-color: var(--accent); background: var(--surface-2); }
.tts-vpc-item--active { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ── Create Journal Entry modal ───────────────────────────────────────────── */
.create-entry-modal { max-width: 820px; }

.ce-textarea {
  flex: 1;
  min-height: 220px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}

.ce-hint {
  font-size: 12px;
  min-height: 16px;
  color: var(--text-muted);
}
.ce-hint--error  { color: var(--danger); }
.ce-hint--busy   { color: var(--accent); }
.ce-hint--info   { color: var(--success); }

.ce-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Drop zone */
.ce-drop-zone {
  flex: 1;
  border: 2px dashed var(--border);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ce-drop-zone:hover,
.ce-drop-zone--over { border-color: var(--accent); background: rgba(108,99,255,0.05); }

.ce-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  text-align: center;
  pointer-events: none;
}
.ce-drop-inner svg { opacity: 0.5; }
.ce-drop-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.ce-browse-label { color: var(--accent); cursor: pointer; pointer-events: all; text-decoration: underline; }

.ce-drop-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.ce-drop-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background var(--transition);
}
.ce-drop-clear:hover { background: var(--danger); }

/* placeholder cover images for entries without real media */
.day-grid-cover-placeholder-img,
.group-card-cover-placeholder-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

/* ── Profile — Imported data section ─────────────────────── */
.pf-import-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pf-import-row:last-child { border-bottom: none; }
.pf-import-info { display: flex; flex-direction: column; gap: 2px; }
.pf-import-platform { font-size: 14px; font-weight: 600; color: var(--text); }
.pf-import-count { font-size: 12px; color: var(--text-muted); }

/* ── Facebook Import Wizard ───────────────────────────────── */
.fb-modal {
  width: min(760px, 96vw);
  height: 80vh;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Every top-level step div must fill the modal and form a flex column */
#fb-step-connect,
#fb-step-home,
#fb-step-loading,
#fb-step-select,
#fb-step-review,
#fb-step-done {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.fb-connect-body {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.fb-connect-icon { color: var(--accent); }

.fb-connect-heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.fb-connect-sub {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.55;
}

.fb-connected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34,197,94,.1);
  color: #22c55e;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.fb-import-types {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  margin-bottom: 8px;
}
.fb-import-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 130px;
  padding: 20px 12px 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s;
}
.fb-import-type-btn:hover {
  border-color: var(--accent);
  background: rgba(108,99,255,.07);
}
.fb-import-type-label {
  font-size: 14px;
  font-weight: 600;
}
.fb-import-type-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

.fb-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: fb-spin .8s linear infinite;
  margin: 0 auto 8px;
}
@keyframes fb-spin { to { transform: rotate(360deg); } }

/* Select step */
.fb-select-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.fb-select-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.fb-posts-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-auto-rows: min-content;
  gap: 12px;
  align-content: start;
}
.fb-post-card {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  background: var(--surface);
}
.fb-post-card:has(.fb-post-check:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.fb-post-check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  z-index: 1;
}
.fb-post-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.fb-post-meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fb-post-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fb-post-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.fb-select-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 10px;
}

/* Review step */
.fb-review-sub {
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 20px 0;
  line-height: 1.5;
}
.fb-review-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fb-review-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.fb-review-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  flex-shrink: 0;
}
.fb-review-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.fb-review-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.fb-review-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fb-review-date-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.fb-review-date-input {
  font-size: 13px;
  padding: 5px 10px;
  width: auto;
}

