/* ═══════════════════════════════════════════════════════════════════════════
   BLOC  —  Design System
   Dark, clean, professional. No phone wrapper. Mobile-first responsive.
═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:           #0d0d11;
  --surface:      #13131a;
  --surface-2:    #1a1a23;
  --surface-3:    #22222d;
  --border:       #2d2d38;
  --border-2:     #3a3a48;
  --accent:       #7c5ce8;
  --accent-hover: #9573f0;
  --accent-dim:   rgba(124,92,232,0.14);
  --text-1:       #e8e8f0;
  --text-2:       #9090a0;
  --text-3:       #55556a;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --danger-dim:   rgba(239,68,68,0.10);
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;
  --transition:   0.15s ease;
  --sidebar-w:    220px;
  --mobile-nav-h: 64px;
  --mobile-hdr-h: 52px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { cursor:pointer; border:none; background:none; font:inherit; color:inherit; }
input, textarea { font:inherit; color:inherit; }
a { color:inherit; }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display:none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH OVERLAY
═══════════════════════════════════════════════════════════════════════════ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow-y: auto;
  transition: opacity var(--transition);
}
.auth-overlay.fade-out { opacity:0; pointer-events:none; }

.auth-screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 40px;
}
.auth-screen.active { display:flex; }

.auth-logo {
  font-size: 28px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--accent); margin-bottom: 40px;
}
.auth-logo span { color: var(--text-1); }

.auth-welcome-copy { margin-bottom: 32px; }
.auth-welcome-copy h1 { font-size:26px; font-weight:700; line-height:1.25; margin-bottom:10px; }
.auth-welcome-copy p  { color:var(--text-2); font-size:15px; }

.auth-step-copy { margin-bottom: 24px; }
.auth-step-copy h2 { font-size:22px; font-weight:700; margin-bottom:8px; }
.auth-step-copy p  { color:var(--text-2); font-size:14px; }

.auth-pills {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: auto; padding-bottom: 32px;
}
.auth-pill {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 14px;
  font-size: 13px; color: var(--text-2);
}

.auth-actions { display:flex; flex-direction:column; gap:10px; margin-top:auto; padding-top:24px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent); color: #fff;
  border-radius: var(--radius); padding: 13px 20px;
  font-size: 14px; font-weight: 600;
  transition: background var(--transition), opacity var(--transition);
  text-align: center; display:block; width:100%;
}
.btn-primary:hover  { background: var(--accent-hover); }
.btn-primary:active { opacity: 0.85; }
.btn-primary:disabled { opacity:0.5; cursor:not-allowed; }

.btn-secondary {
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 20px;
  font-size: 14px; font-weight: 500;
  transition: background var(--transition);
  display:inline-block; text-align:center;
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: none; color: var(--text-2);
  border-radius: var(--radius); padding: 11px 20px;
  font-size: 14px; font-weight: 500;
  transition: color var(--transition);
  text-align: center; display:block; width:100%;
}
.btn-ghost:hover { color: var(--text-1); }

.btn-danger {
  background: var(--danger-dim); color: var(--danger);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius); padding: 11px 20px;
  font-size: 14px; font-weight: 500;
  display:block; width:100%; text-align:center;
  transition: background var(--transition);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

.link-btn {
  background:none; border:none; color:var(--accent);
  font-size:inherit; cursor:pointer; text-decoration:underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color:var(--accent-hover); }

/* ── Fields ─────────────────────────────────────────────────────────────── */
.field {
  width: 100%;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px;
  font-size: 14px; outline: none;
  transition: border-color var(--transition);
  margin-top: 8px; display:block;
}
.field:focus { border-color: var(--accent); }
.field::placeholder { color: var(--text-3); }
.field-textarea { resize:none; min-height:80px; }
.field-hint { font-size:12px; color:var(--text-3); margin-top:6px; }
.field-error { font-size:13px; color:var(--danger); margin-top:6px; min-height:18px; }
.field-success { font-size:13px; color:var(--success); margin-top:6px; }

/* Category picker */
.pick-count { font-size:13px; color:var(--text-2); margin-bottom:12px; margin-top:8px; }
.cat-picker  { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.cat-pick-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 16px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.cat-pick-btn:hover  { border-color: var(--accent); }
.cat-pick-btn.selected {
  background: var(--accent-dim); border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar (desktop only) ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
}

.sidebar-logo {
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--accent); padding: 4px 8px 20px;
}
.sidebar-logo span { color: var(--text-1); }

.sidebar-nav { display:flex; flex-direction:column; gap:2px; flex:1; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover  { background:var(--surface-2); color:var(--text-1); }
.nav-item.active { background:var(--accent-dim); color:var(--accent); }
.nav-icon { flex-shrink:0; width:18px; height:18px; }

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

.sidebar-broadcast-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff;
  border-radius: var(--radius); padding: 11px 16px;
  font-size: 14px; font-weight: 600;
  margin: 12px 0; width:100%;
  transition: background var(--transition);
}
.sidebar-broadcast-btn:hover { background: var(--accent-hover); }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: var(--radius-sm);
  cursor: pointer; margin-top: 4px;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--surface-2); }
.sidebar-user-avatar {
  width:34px; height:34px; border-radius:50%;
  background:var(--accent-dim); border:1px solid var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:16px; flex-shrink:0;
}
.sidebar-user-info { flex:1; min-width:0; overflow:hidden; }
.sidebar-user-name   { font-size:13px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.sidebar-user-handle { font-size:12px; color:var(--text-3); }
.sidebar-settings-btn {
  padding:4px; border-radius:6px; color:var(--text-3);
  transition:color var(--transition); flex-shrink:0;
}
.sidebar-settings-btn:hover { color:var(--text-1); }

/* ── Main area ──────────────────────────────────────────────────────────── */
.main-area {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

/* Mobile header */
.mobile-header {
  display: none;
  align-items: center; justify-content: space-between;
  height: var(--mobile-hdr-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-logo { font-size: 20px; font-weight: 700; color: var(--accent); }
.mobile-logo span { color: var(--text-1); }
.mobile-header-actions { display:flex; gap:8px; }
.mobile-create-btn, .mobile-settings-btn {
  width:36px; height:36px; border-radius:var(--radius-sm);
  background:var(--surface-2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  color:var(--text-2); transition:all var(--transition);
}
.mobile-create-btn:hover, .mobile-settings-btn:hover { color:var(--text-1); border-color:var(--border-2); }

/* Pages */
.page-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth;
}
.page {
  display: none;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
.page.active { display: block; }

/* ── Mobile nav ─────────────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  height: var(--mobile-nav-h);
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  align-items: center;
  padding: 0 4px;
}

.mob-nav-btn {
  flex: 1; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:3px;
  padding: 8px 4px; color: var(--text-3);
  font-size: 10px; font-weight: 500;
  transition: color var(--transition);
}
.mob-nav-btn.active { color: var(--accent); }
.mob-nav-btn span { display:block; }

.mob-nav-fab {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin: 0 4px;
  transition: background var(--transition);
  box-shadow: 0 4px 16px rgba(124,92,232,0.35);
}
.mob-nav-fab:hover { background: var(--accent-hover); }

/* ── Responsive: mobile ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .mobile-header { display: flex; }
  .mobile-nav { display: flex; }
  .page { padding: 16px 14px 28px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SHARED PAGE COMPONENTS
═══════════════════════════════════════════════════════════════════════════ */

.page-header { margin-bottom: 20px; }
.page-title  { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub    { color: var(--text-2); font-size: 14px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 14px; font-weight: 600; }
.section-link  { font-size: 12px; color: var(--accent); cursor:pointer; }
.section-link:hover { text-decoration:underline; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px;
  transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box svg   { color: var(--text-3); flex-shrink:0; }
.search-box input {
  flex:1; background:none; border:none; outline:none;
  font-size:14px; color:var(--text-1);
}
.search-box input::placeholder { color:var(--text-3); }

.cat-chips-wrap {
  overflow-x: auto; scrollbar-width: none; margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}
.cat-chips-wrap::-webkit-scrollbar { display:none; }
.cat-chips {
  display: inline-flex; gap: 6px; white-space: nowrap; padding: 2px 0;
}
.cat-chip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: all var(--transition); white-space: nowrap;
}
.cat-chip:hover  { border-color: var(--border-2); color: var(--text-1); }
.cat-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.filter-row  { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:16px; }
.filter-chip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 14px;
  font-size: 13px; color: var(--text-2);
  transition: all var(--transition);
}
.filter-chip:hover  { border-color: var(--border-2); color:var(--text-1); }
.filter-chip.active { background:var(--accent-dim); border-color:var(--accent); color:var(--accent); }

.search-row {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px;
}
.search-row .search-box { flex:1; }
.feed-count-label { font-size:12px; color:var(--text-3); white-space:nowrap; }

.tab-row { display:flex; gap:4px; margin-bottom:16px; border-bottom:1px solid var(--border); }
.tab-btn {
  background:none; color:var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom:-1px;
  padding: 8px 16px 10px 0; font-size:14px; font-weight:500;
  transition: all var(--transition);
}
.tab-btn.active { color:var(--accent); border-color:var(--accent); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-icon  { font-size: 36px; margin-bottom:12px; }
.empty-title { font-size:15px; font-weight:600; color:var(--text-2); margin-bottom:6px; }
.empty-sub   { font-size:13px; }

/* ═══════════════════════════════════════════════════════════════════════════
   BLOC CARDS
═══════════════════════════════════════════════════════════════════════════ */
.feed-list { display:flex; flex-direction:column; gap:10px; }

.bloc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  transition: border-color var(--transition);
}
.bloc-card:hover { border-color: var(--border-2); }

.bloc-card-top {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px;
}
.bloc-cat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; border: 1px solid transparent;
}
.bloc-main  { flex:1; min-width:0; }
.bloc-title { font-size:14px; font-weight:600; margin-bottom:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bloc-meta  { font-size:12px; color:var(--text-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.bloc-badges { display:flex; align-items:center; gap:6px; margin-bottom:10px; flex-wrap:wrap; }
.badge {
  font-size: 11px; font-weight: 500; padding: 3px 8px;
  border-radius: 20px; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.badge.now    { background:rgba(239,68,68,0.1); color:#f87171; border-color:rgba(239,68,68,0.2); }
.badge.full   { background:rgba(16,185,129,0.1); color:var(--success); border-color:rgba(16,185,129,0.2); }

.timer-ok     { color:var(--text-2); }
.timer-hot    { color:var(--warning); }
.timer-urgent { color:var(--danger); }

.progress-wrap  { margin-bottom: 10px; }
.progress-track { background:var(--surface-3); border-radius:4px; height:4px; overflow:hidden; }
.progress-fill  { height:100%; border-radius:4px; transition:width 0.4s ease; }
.progress-label {
  font-size:11px; color:var(--text-2); margin-top:5px;
  display:flex; justify-content:space-between;
}

.bloc-footer {
  display:flex; align-items:center; justify-content:space-between;
  padding-top:10px; border-top:1px solid var(--border);
}
.bloc-footer-left { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.bloc-footer-right { display:flex; gap:6px; align-items:center; }

.btn-join {
  background: var(--accent); color: #fff;
  border-radius: var(--radius-sm); padding: 7px 16px;
  font-size: 13px; font-weight: 600;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn-join:hover   { background: var(--accent-hover); }
.btn-join.joined  { background:rgba(16,185,129,0.12); color:var(--success); cursor:default; }
.btn-join.loading { opacity:0.6; cursor:default; }

@keyframes btn-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
@keyframes btn-dismiss {
  0%   { transform: scale(1) rotate(0deg); }
  35%  { transform: scale(1.25) rotate(-8deg); }
  65%  { transform: scale(0.9) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.btn-interact {
  background: none; color: var(--text-3);
  padding: 6px 8px; border-radius: 6px;
  font-size: 13px; line-height:1; display:flex; align-items:center; gap:3px;
  transition: color var(--transition), background var(--transition);
}
.btn-interact:hover                  { color:var(--text-2); background:var(--surface-2); }
.btn-interact.liked                  { color:var(--success); background:rgba(16,185,129,0.1); animation: btn-pop 0.35s ease forwards; }
.btn-interact.liked:disabled         { color:var(--success); background:rgba(16,185,129,0.1); opacity:1; }
.btn-interact.dismissed              { color:var(--danger);  background:rgba(239,68,68,0.1);  animation: btn-dismiss 0.35s ease forwards; }
.btn-interact.dismissed:disabled     { color:var(--danger);  background:rgba(239,68,68,0.1);  opacity:1; }
.btn-interact.popping                { animation: btn-pop 0.35s ease forwards; }

/* Small inline drop button on joined feed cards */
.btn-drop-feed {
  padding: 4px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  background: rgba(239,68,68,0.1); color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
  transition: background var(--transition);
}
.btn-drop-feed:hover { background: rgba(239,68,68,0.2); }

.poll-list { margin-bottom:10px; display:flex; flex-direction:column; gap:5px; }
.poll-opt  {
  position:relative; border-radius:6px; overflow:hidden;
  background:var(--surface-2); border:1px solid var(--border); padding:7px 10px;
}
.poll-fill { position:absolute; inset:0; background:var(--accent-dim); transition:width 0.5s ease; }
.poll-text {
  position:relative; display:flex; justify-content:space-between;
  font-size:12px;
}
.poll-pct { color:var(--text-2); }

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(124,92,232,0.35); }
  70%  { box-shadow: 0 0 0 6px rgba(124,92,232,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,92,232,0); }
}
.pulse-slow   { animation: pulse-ring 4s ease infinite; }
.pulse-medium { animation: pulse-ring 2.5s ease infinite; }
.pulse-fast   { animation: pulse-ring 1.5s ease infinite; }
.pulse-urgent { animation: pulse-ring 0.9s ease infinite; }

/* ═══════════════════════════════════════════════════════════════════════════
   AGENT PICKS
═══════════════════════════════════════════════════════════════════════════ */
.agent-picks-section { margin-bottom: 20px; }

.picks-row {
  display: flex; gap: 10px;
  overflow-x: auto; scrollbar-width: none; padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
}
.picks-row::-webkit-scrollbar { display:none; }
.picks-loading { color:var(--text-3); font-size:13px; padding:4px 0; }

.pick-card {
  flex-shrink: 0; width: 155px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 5px;
  cursor: pointer; transition: border-color var(--transition);
}
.pick-card:hover { border-color: var(--accent); }
.pick-icon  { font-size:22px; }
.pick-title {
  font-size:12px; font-weight:600;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden; line-height:1.4;
}
.pick-meta { font-size:11px; color:var(--text-2); }
.pick-join-btn {
  margin-top:6px;
  background:var(--accent-dim); color:var(--accent);
  border-radius:var(--radius-sm); padding:5px 10px;
  font-size:11px; font-weight:600; align-self:flex-start;
  transition:all var(--transition);
}
.pick-join-btn:hover { background:var(--accent); color:#fff; }

/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE PAGE
═══════════════════════════════════════════════════════════════════════════ */
.profile-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.profile-avatar {
  width:64px; height:64px; border-radius:50%;
  background:var(--accent-dim); border:2px solid var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:28px; flex-shrink:0;
}
.profile-name   { font-size:18px; font-weight:700; }
.profile-handle { font-size:13px; color:var(--text-2); margin-top:2px; }
.profile-tier   {
  display:inline-block; margin-top:6px;
  background:var(--accent-dim); color:var(--accent);
  border-radius:20px; padding:3px 10px; font-size:12px; font-weight:600;
}

.stat-row { display:flex; gap:8px; margin-bottom:20px; }
.stat-card {
  flex:1; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px; text-align:center;
}
.stat-val { font-size:20px; font-weight:700; margin-bottom:4px; }
.stat-lbl { font-size:11px; color:var(--text-2); }

.profile-section {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:16px; margin-bottom:12px;
}

.agent-status-dot  { font-size:12px; color:var(--success); }
.agent-setup-prompt p { font-size:13px; color:var(--text-2); line-height:1.6; margin-bottom:14px; }
.agent-setup-prompt .btn-primary { display:inline-block; width:auto; padding:10px 20px; }

.agent-prefs-display { display:flex; flex-direction:column; gap:8px; }
.agent-pref-row { display:flex; justify-content:space-between; align-items:center; font-size:13px; }
.agent-pref-label { color:var(--text-2); }
.agent-pref-value { font-weight:500; }
.agent-cats-list  { display:flex; flex-wrap:wrap; gap:5px; margin-top:4px; }
.agent-cat-chip   {
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:20px; padding:3px 10px; font-size:12px;
}

.history-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 0; border-bottom:1px solid var(--border);
}
.history-item:last-child { border-bottom:none; }
.history-icon  { font-size:18px; flex-shrink:0; width:28px; text-align:center; }
.history-info  { flex:1; min-width:0; }
.history-title { font-size:13px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.history-meta  { font-size:11px; color:var(--text-2); margin-top:2px; }
.history-role  {
  font-size:11px; font-weight:600; padding:2px 7px;
  border-radius:4px; background:var(--surface-2); color:var(--text-2); flex-shrink:0;
}
.history-role.creator { background:var(--accent-dim); color:var(--accent); }

.mission-list { display:flex; flex-direction:column; gap:8px; }
.mission-item {
  display:flex; align-items:flex-start; gap:10px;
  padding:10px; background:var(--surface-2); border-radius:var(--radius-sm);
}
.mission-icon  { font-size:14px; flex-shrink:0; margin-top:1px; }
.mission-text  { flex:1; font-size:13px; color:var(--text-2); }
.mission-saves { font-size:13px; color:var(--success); font-weight:600; flex-shrink:0; }

.verify-banner {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  background:rgba(245,158,11,0.1); border:1px solid rgba(245,158,11,0.25);
  border-radius:var(--radius); padding:10px 14px;
  font-size:13px; margin-bottom:16px;
}
.verify-banner-btn { background:none; color:var(--warning); font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; }

/* My Blocs */
.my-bloc-item {
  display:flex; align-items:center; gap:12px;
  padding:12px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); margin-bottom:8px;
}
.my-bloc-icon  { font-size:20px; flex-shrink:0; }
.my-bloc-info  { flex:1; min-width:0; }
.my-bloc-title { font-size:14px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.my-bloc-meta  { font-size:12px; color:var(--text-2); margin-top:2px; }
.my-bloc-status {
  font-size:11px; font-weight:600; padding:3px 8px;
  border-radius:20px; flex-shrink:0; white-space:nowrap;
}
.my-bloc-status.open        { background:rgba(16,185,129,0.1); color:var(--success); }
.my-bloc-status.in_progress { background:rgba(245,158,11,0.1); color:var(--warning); }
.my-bloc-status.completed   { background:rgba(16,185,129,0.1); color:var(--success); }
.my-bloc-status.full        { background:rgba(124,92,232,0.1); color:var(--accent); }
.my-bloc-status.bailed      { background:rgba(239,68,68,0.1);  color:var(--danger); }
.my-bloc-status.expired     { background:var(--surface-2); color:var(--text-3); }

/* Business badge */
.business-badge {
  display:inline-flex; align-items:center; gap:4px;
  background:rgba(245,158,11,0.12); color:var(--warning);
  border:1px solid rgba(245,158,11,0.25);
  border-radius:20px; padding:2px 8px; font-size:11px; font-weight:600;
}

/* Bloc card image hero */
.bloc-image {
  width:100%; height:130px; object-fit:cover;
  border-radius:var(--radius-sm); margin-bottom:10px;
  border:1px solid var(--border);
}

/* Load more button */
.load-more-btn {
  display:block; width:100%; margin-top:12px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:11px 16px;
  font-size:13px; font-weight:500; color:var(--text-2);
  text-align:center; transition:all var(--transition);
}
.load-more-btn:hover { border-color:var(--border-2); color:var(--text-1); background:var(--surface-2); }

/* Image upload in modal */
.img-upload-row {
  display:flex; align-items:center; gap:10px; margin-bottom:12px;
}
.img-upload-btn {
  display:flex; align-items:center; gap:6px;
  background:var(--surface-2); border:1px dashed var(--border-2);
  border-radius:var(--radius-sm); padding:9px 14px;
  font-size:13px; color:var(--text-2); cursor:pointer;
  transition:all var(--transition);
}
.img-upload-btn:hover { border-color:var(--accent); color:var(--accent); }
.img-preview-wrap { position:relative; display:inline-flex; }
.img-preview {
  width:56px; height:56px; object-fit:cover;
  border-radius:var(--radius-sm); border:1px solid var(--border);
}
.img-remove-btn {
  position:absolute; top:-6px; right:-6px;
  width:18px; height:18px; border-radius:50%;
  background:var(--danger); color:#fff;
  font-size:10px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; border:none;
}
#img-file-input { display:none; }

/* ═══════════════════════════════════════════════════════════════════════════
   INBOX
═══════════════════════════════════════════════════════════════════════════ */
.thread-item {
  display:flex; align-items:center; gap:12px;
  padding:12px; border-radius:var(--radius); cursor:pointer;
  transition:background var(--transition);
  border-bottom:1px solid var(--border);
}
.thread-item:last-child { border-bottom:none; }
.thread-item:hover { background:var(--surface-2); }
.thread-avatar {
  width:42px; height:42px; border-radius:50%;
  background:var(--surface-2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:20px; flex-shrink:0;
}
.thread-info  { flex:1; min-width:0; }
.thread-name  { font-size:14px; font-weight:600; }
.thread-prev  { font-size:12px; color:var(--text-2); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-meta  { text-align:right; flex-shrink:0; }
.thread-time  { font-size:11px; color:var(--text-3); }
.thread-unread { width:8px; height:8px; border-radius:50%; background:var(--accent); margin-left:auto; margin-top:4px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SLIDE PANELS
═══════════════════════════════════════════════════════════════════════════ */
.panel-backdrop {
  position:fixed; inset:0; z-index:149;
  background:rgba(0,0,0,0.5); opacity:0; pointer-events:none;
  transition:opacity var(--transition);
}
.panel-backdrop.show { opacity:1; pointer-events:auto; }

.slide-panel {
  position:fixed; top:0; right:0; bottom:0;
  width:min(440px, 100vw); z-index:150;
  background:var(--bg); border-left:1px solid var(--border);
  display:flex; flex-direction:column;
  transform:translateX(100%);
  transition:transform 0.25s cubic-bezier(0.4,0,0.2,1);
  overscroll-behavior:contain;
}
.slide-panel.open { transform:translateX(0); }

.slide-panel-header {
  display:flex; align-items:center; gap:12px;
  padding:16px; border-bottom:1px solid var(--border); flex-shrink:0;
}
.back-btn {
  width:34px; height:34px; border-radius:var(--radius-sm);
  background:var(--surface-2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  color:var(--text-2); flex-shrink:0; transition:all var(--transition);
}
.back-btn:hover { color:var(--text-1); border-color:var(--border-2); }
.slide-panel-title-group { display:flex; align-items:center; gap:10px; }
.slide-panel-title { font-size:15px; font-weight:600; }
.slide-panel-sub   { font-size:12px; color:var(--text-2); }
.chat-avatar { font-size:22px; }

/* ════════════════════════════════════════════════════════════════════════════
   CHAT / MESSAGING
   ─────────────────────────────────────────────────────────────────────────
   Key rule: .msg is ALWAYS a flex ROW. In a flex row, items use max-content
   sizing, so "yo" → ~50px wide bubble, not 1-char wide. Never use
   flex-direction:column + align-items:flex-end — that forces min-content
   (≈1 char) sizing and stacks every character on its own line.

   Layout:
     .msg.mine   → justify-content:flex-end  pushes .msg-col to the right
     .msg.theirs → justify-content:flex-start (default) stays left
     .msg-col    → flex item in the row; max-width:72% caps long messages
     .bubble     → plain display:block inside .msg-col; fills its width
════════════════════════════════════════════════════════════════════════════ */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scroll-behavior: smooth;
}

/* Every message row is a flex ROW — never a column */
.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.msg.mine   { justify-content: flex-end; }   /* push bubble to right  */
.msg.theirs { justify-content: flex-start; } /* bubble stays on left  */

/* Tighter spacing for grouped (consecutive same-sender) messages */
.msg.grouped { margin-top: 2px; }

/* Spacer that holds avatar column width when avatar is hidden mid-group */
.msg-avatar-gap { width: 28px; flex-shrink: 0; }

/* Avatar circle — theirs only */
.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Wrapper that holds sender-name + bubble + timestamp.
   As a flex item in .msg (row direction) it gets max-content sizing.
   max-width:72% prevents it from spanning more than 72% of the panel.
   NOT a flex container — children just stack as normal blocks. */
.msg-col {
  max-width: 72%;
}

/* The bubble itself: plain block that fills .msg-col's computed width */
.bubble {
  display: block;
  padding: 9px 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}
.bubble.mine {
  background: var(--accent);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}
.bubble.mine.no-tail  { border-radius: 18px 18px 10px 18px; }

.bubble.theirs {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
}
.bubble.theirs.no-tail { border-radius: 18px 18px 18px 10px; }

.msg-time {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
}
.msg.mine .msg-time { text-align: right; }

/* Sender name in group chat (theirs only) */
.msg-sender {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 3px;
}

/* ── Typing indicator ──────────────────────────────────────────────────── */
.typing-row {
  padding: 4px 16px 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.typing-bubble {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
}
.typing-bubble span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  display: inline-block;
  animation: typing-dot 1.3s ease-in-out infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1;   }
}

.chat-input-row {
  display:flex; gap:8px; padding:12px 16px;
  border-top:1px solid var(--border); flex-shrink:0;
}
.chat-input {
  flex:1; background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius); padding:10px 14px;
  font-size:14px; outline:none; color:var(--text-1);
  transition:border-color var(--transition);
}
.chat-input:focus { border-color:var(--accent); }
.chat-input::placeholder { color:var(--text-3); }
.chat-send-btn {
  width:40px; height:40px; border-radius:var(--radius-sm);
  background:var(--accent); color:#fff;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:background var(--transition);
}
.chat-send-btn:hover { background:var(--accent-hover); }

/* Settings / Agent body */
.settings-body { flex:1; overflow-y:auto; padding:16px; }
.settings-group {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px; margin-bottom:10px;
}
.settings-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:6px 0; font-size:14px;
}
.settings-lbl { color:var(--text-2); }
.settings-val  { font-weight:500; }
.settings-danger { border-color:rgba(239,68,68,0.3); }
.settings-danger-title { font-size:13px; font-weight:600; color:var(--danger); margin-bottom:6px; }
.settings-danger-sub   { font-size:13px; color:var(--text-2); margin-bottom:12px; line-height:1.6; }

.form-label { font-size:13px; font-weight:600; margin-bottom:4px; color:var(--text-1); }
.form-hint  { font-size:12px; color:var(--text-3); margin-bottom:8px; }
.form-row   { display:flex; gap:12px; margin-bottom:12px; }
.form-col   { flex:1; min-width:0; }
.option-row  { display:flex; gap:6px; flex-wrap:wrap; }
.option-grid { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.option-btn {
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:7px 14px;
  font-size:13px; font-weight:500; color:var(--text-2);
  transition:all var(--transition);
}
.option-btn:hover  { border-color:var(--border-2); color:var(--text-1); }
.option-btn.active { background:var(--accent-dim); border-color:var(--accent); color:var(--accent); }

.char-count { font-size:11px; color:var(--text-3); text-align:right; margin-top:4px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position:fixed; inset:0; z-index:200;
  background:rgba(0,0,0,0.7); backdrop-filter:blur(4px);
  display:flex; align-items:flex-end;
}
@media (min-width:768px) {
  .modal-backdrop { align-items:center; justify-content:center; padding:24px; }
}

.modal-sheet {
  width:100%; max-width:520px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  padding:0 20px 40px; max-height:90vh; overflow-y:auto;
}
@media (min-width:768px) {
  .modal-sheet { border-radius:var(--radius-lg); padding:24px; }
}
.modal-handle {
  width:36px; height:4px; border-radius:2px;
  background:var(--border-2); margin:12px auto 20px;
}
@media (min-width:768px) { .modal-handle { display:none; } }
.modal-title { font-size:17px; font-weight:700; margin-bottom:18px; }

/* Match modal */
.match-card {
  width:100%; max-width:360px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:32px 24px; text-align:center;
  margin:16px;
}
.match-badge {
  display:inline-block;
  background:rgba(16,185,129,0.12); color:var(--success);
  border:1px solid rgba(16,185,129,0.25);
  border-radius:20px; padding:5px 14px; font-size:13px; font-weight:600; margin-bottom:20px;
}
.match-avatar  { font-size:48px; margin-bottom:12px; }
.match-name    { font-size:18px; font-weight:700; margin-bottom:4px; }
.match-handle  { font-size:13px; color:var(--text-2); margin-bottom:6px; }
.match-email   { font-size:13px; color:var(--text-3); margin-bottom:4px; }
.match-bloc    { font-size:12px; color:var(--text-3); margin-bottom:20px; }
.match-actions { display:flex; gap:10px; justify-content:center; }
.match-actions .btn-primary, .match-actions .btn-secondary { display:inline-block; width:auto; min-width:120px; }

/* Group thread in inbox */
.thread-type-badge {
  font-size:10px; font-weight:600; padding:2px 6px;
  border-radius:4px; margin-left:4px;
  background:var(--accent-dim); color:var(--accent);
}
.thread-member-count { font-size:11px; color:var(--text-3); margin-top:2px; }

/* Group chat header */
.group-chat-header-info { flex:1; min-width:0; }
.group-chat-name  { font-size:14px; font-weight:600; }
.group-chat-meta  { font-size:11px; color:var(--text-2); margin-top:1px; }
.drop-bloc-btn {
  padding:6px 12px; border-radius:var(--radius-sm);
  background:var(--danger-dim); color:var(--danger);
  border:1px solid rgba(239,68,68,0.25);
  font-size:12px; font-weight:600; white-space:nowrap;
  transition:background var(--transition);
}
.drop-bloc-btn:hover { background:rgba(239,68,68,0.2); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════════════════════ */
.toast {
  position:fixed; bottom:calc(var(--mobile-nav-h) + 16px); left:50%;
  transform:translateX(-50%) translateY(12px);
  background:var(--surface-3); border:1px solid var(--border-2);
  border-radius:var(--radius); padding:10px 18px;
  font-size:13px; font-weight:500; z-index:400; pointer-events:none;
  opacity:0; transition:opacity 0.2s ease, transform 0.2s ease;
  white-space:nowrap; max-width:90vw;
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
@media (min-width:768px) { .toast { bottom:24px; } }

/* ═══════════════════════════════════════════════════════════════════════════
   SKELETONS
═══════════════════════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position:-400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background:linear-gradient(90deg,var(--surface) 25%,var(--surface-2) 50%,var(--surface) 75%);
  background-size:400px 100%; animation:shimmer 1.4s ease infinite;
  border-radius:6px;
}
.skeleton-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:16px; margin-bottom:10px;
}
