/* ============================================================
   DANI SPARK — Collaboration Extension CSS  (collab.css)
   Extends style.css with WorkItems, Projects, and Teams-like
   project workspace styles.
   ============================================================ */

/* ---- Tool Badges ---- */
.tool-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-radius: 12px; font-size: 0.73rem; color: var(--text-secondary);
  margin: 2px;
}

/* ============================================================
   WORKITEM CARDS
   ============================================================ */
.wi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px; margin-bottom: 32px;
}

.wi-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; transition: var(--transition);
}
.wi-card:hover { border-color: rgba(37,99,235,0.35); transform: translateY(-2px); }

.wi-card-top {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px;
}
.wi-card-icon { font-size: 1.8rem; flex-shrink: 0; }
.wi-card-name { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.wi-card-id   { font-size: 0.74rem; color: var(--text-muted); font-family: 'Courier New', monospace; }

.wi-card-desc {
  color: var(--text-secondary); font-size: 0.86rem;
  line-height: 1.55; margin: 10px 0;
}
.wi-card-tools { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }

.wi-actions {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

/* ---- WorkItem Form ---- */
.wi-form-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; margin-bottom: 30px;
}
.wi-form-title {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}

.checkbox-group { display: flex; flex-direction: column; gap: 10px; }

.checkbox-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated); border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: var(--transition);
}
.checkbox-item:hover { border-color: var(--text-secondary); }
.checkbox-item.checked { border-color: var(--accent); background: rgba(37,99,235,0.08); }
.checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.checkbox-item-label { font-size: 0.9rem; font-weight: 600; }
.checkbox-item-desc  { font-size: 0.76rem; color: var(--text-muted); }

.tool-config-section {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 16px; margin-top: 10px; display: none;
}
.tool-config-section.visible { display: block; }

.tool-config-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--accent); margin-bottom: 14px;
}

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.88rem; }
.radio-group  { display: flex; gap: 16px; }
.radio-group label {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.82rem; color: var(--text-secondary); cursor: pointer;
}
.radio-group input[type="radio"] { accent-color: var(--accent); }

/* ============================================================
   PROJECT CARDS  (projects.html dashboard)
   ============================================================ */
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}

.project-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; cursor: pointer;
  transition: var(--transition); position: relative; overflow: hidden;
}
.project-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--border); transition: var(--transition);
}
.project-card:hover { border-color: rgba(37,99,235,0.3); transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card:hover::before { background: var(--accent); }

.project-card-header { margin-bottom: 10px; }
.project-card-type {
  display: inline-block;
  background: rgba(37,99,235,0.12); color: var(--accent);
  border: 1px solid rgba(37,99,235,0.22); font-size: 0.7rem; font-weight: 700;
  padding: 3px 10px; border-radius: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.project-card-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 7px; }
.project-card-desc {
  color: var(--text-secondary); font-size: 0.86rem; margin-bottom: 12px;
  line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.project-card-tools { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.project-card-footer {
  display: flex; justify-content: space-between;
  color: var(--text-muted); font-size: 0.78rem;
  padding-top: 12px; border-top: 1px solid var(--border);
}

/* WorkItem option (create_project.html radio list) */
.wi-option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; background: var(--bg-elevated);
  border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: var(--transition); margin-bottom: 10px;
}
.wi-option:hover   { border-color: var(--text-secondary); }
.wi-option.selected { border-color: var(--accent); background: rgba(37,99,235,0.08); }
.wi-option input[type="radio"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.wi-option-name { font-weight: 700; margin-bottom: 4px; }
.wi-option-desc { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 7px; }

/* ============================================================
   PROJECT SHELL  — Teams-like layout
   ============================================================ */
.project-shell {
  display: flex;
  height: calc(100vh - 68px);
  overflow: hidden;
}

/* ---- Sidebar ---- */
.project-sidebar {
  width: 240px; min-width: 240px;
  background: #191919; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}

.project-brand {
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.project-brand-name {
  font-size: 0.95rem; font-weight: 700; word-break: break-word; margin-bottom: 3px;
}
.project-brand-type {
  font-size: 0.68rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px;
}

.project-nav { padding: 8px 0; flex: 1; }
.project-nav-section {
  padding: 12px 16px 4px; font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted);
}

.project-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  font-size: 0.9rem; border: none; background: none; width: 100%;
  text-align: left; text-decoration: none; border-left: 3px solid transparent;
}
.project-nav-item:hover  { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.project-nav-item.active { background: rgba(37,99,235,0.12); color: var(--text-primary); border-left-color: var(--accent); }
.nav-icon { font-size: 1rem; }

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

/* ---- Main Area ---- */
.project-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}

.project-topbar {
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-secondary); display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0; gap: 12px;
}
.project-topbar-left { display: flex; align-items: center; gap: 10px; }
.project-topbar-title { font-size: 1rem; font-weight: 700; }
.project-topbar-desc  { font-size: 0.8rem; color: var(--text-muted); }
.member-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 0.75rem; color: var(--text-secondary);
}

/* Section panels — shown/hidden by JS */
.section-panel { display: none; flex-direction: column; height: 100%; overflow: hidden; }
.section-panel.active { display: flex; }

/* ============================================================
   CHAT PANEL
   ============================================================ */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}

.chat-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted); text-align: center; gap: 8px;
}
.chat-empty-icon { font-size: 3rem; }

.chat-msg {
  display: flex; align-items: flex-end; gap: 10px; max-width: 72%;
}
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}

.chat-msg-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-msg.mine .chat-msg-body { align-items: flex-end; }

.chat-msg-author { font-size: 0.72rem; color: var(--text-muted); margin: 0 4px 2px; }

.chat-bubble {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 9px 14px; font-size: 0.9rem;
  line-height: 1.55; word-break: break-word; max-width: 100%;
}
.chat-msg.mine .chat-bubble {
  background: var(--accent); border-color: var(--accent); color: white;
}

.chat-msg-time { font-size: 0.68rem; color: var(--text-muted); margin: 2px 4px 0; }

/* Input area */
.chat-input-area {
  flex-shrink: 0; padding: 12px 20px;
  border-top: 1px solid var(--border); background: var(--bg-secondary);
}
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; position: relative; }

textarea.chat-input {
  flex: 1; padding: 10px 14px; resize: none;
  background: var(--bg-elevated); border: 1.5px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); font-size: 0.9rem;
  outline: none; max-height: 120px; overflow-y: auto; line-height: 1.5; font-family: inherit;
}
textarea.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
textarea.chat-input::placeholder { color: var(--text-muted); }

.emoji-picker {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  display: none; flex-wrap: wrap; width: 272px; gap: 2px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px;
  box-shadow: var(--shadow-lg); z-index: 200;
}
.emoji-picker.open { display: flex; }
.emoji-btn {
  background: none; border: none; font-size: 1.35rem; cursor: pointer;
  padding: 4px; border-radius: 6px; transition: var(--transition); line-height: 1;
}
.emoji-btn:hover { background: rgba(255,255,255,0.1); }

.chat-toolbar { display: flex; gap: 6px; margin-top: 8px; }
.chat-file-label {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.78rem; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.chat-file-label:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.chat-disabled-notice {
  text-align: center; padding: 16px; color: var(--text-muted); font-size: 0.85rem;
  background: var(--bg-secondary); border-top: 1px solid var(--border);
}

/* ============================================================
   TASKS PANEL
   ============================================================ */
.tasks-panel { padding: 24px; overflow-y: auto; }

.tasks-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
}

.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; transition: var(--transition);
}
.task-item:hover { border-color: rgba(37,99,235,0.2); }
.task-item.completed { opacity: 0.65; }
.task-item.completed .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-checkbox { padding-top: 2px; }
.task-checkbox input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.task-desc  { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.5; }

.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.72rem; color: var(--text-muted);
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 10px;
}

.task-status-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.status-open { background: rgba(52,152,219,0.14); color: #5dade2; border: 1px solid rgba(52,152,219,0.3); }
.status-done { background: rgba(46,204,113,0.14); color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }

.task-actions { flex-shrink: 0; }

/* New task form */
.new-task-form {
  background: var(--bg-card); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 22px; display: none;
}
.new-task-form.visible { display: block; }

/* ============================================================
   DOCUMENTS PANEL
   ============================================================ */
.docs-panel { padding: 24px; overflow-y: auto; }

.docs-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px;
}

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }

.doc-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 7px;
  transition: var(--transition); text-align: center;
}
.doc-card:hover { border-color: rgba(37,99,235,0.3); transform: translateY(-2px); }

.doc-icon  { font-size: 2.4rem; }
.doc-name  {
  font-size: 0.82rem; font-weight: 600; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.doc-meta  { font-size: 0.72rem; color: var(--text-muted); }
.doc-date  { font-size: 0.68rem; color: var(--text-muted); }
.doc-actions { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 30px; text-align: center; margin-bottom: 22px; cursor: pointer;
  transition: var(--transition); color: var(--text-muted);
}
.upload-zone:hover { border-color: var(--accent); color: var(--text-primary); }
.upload-zone-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-zone-text { font-size: 0.88rem; }

/* ============================================================
   SECTION HEADERS (used in standalone pages)
   ============================================================ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.section-title-row { display: flex; align-items: center; gap: 10px; }
.section-icon { font-size: 1.4rem; }
.section-title-text { font-size: 1.3rem; font-weight: 700; }
.section-subtitle { font-size: 0.84rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .project-shell {
    position: fixed; inset: 52px 0 0;
    height: auto; margin-top: 0;
    flex-direction: column;
  }
  .project-main { width: 100%; order: 1; }
  .project-sidebar {
    width: 100%; min-width: 0; height: 56px; min-height: 56px;
    order: 2; overflow: hidden; border-right: 0; border-top: 1px solid var(--border);
  }
  .project-brand, .project-nav-section, .project-sidebar-footer,
  .project-nav-item span:not(.nav-icon) { display: none; }
  .project-nav { display: flex; padding: 0; height: 100%; }
  .project-nav-item {
    flex: 1; justify-content: center; min-width: 44px; padding: 0;
    border-left: 0; border-top: 3px solid transparent;
  }
  .project-nav-item.active { background: rgba(37,99,235,0.1); border-top-color: var(--accent); }
  .wi-grid, .projects-grid { grid-template-columns: 1fr; }
  .chat-msg { max-width: 90%; }
  .doc-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .project-topbar { min-height: 56px; padding: 9px 12px; }
  .project-topbar-desc { display: none; }
  #topbar-actions { display: flex; gap: 4px; }
  .workspace-action { width: 44px; height: 44px; padding: 0; }
  .workspace-action-label, .chat-send-label { display: none; }
  .chat-messages { padding: 14px 12px; }
  .chat-input-area { padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
  .chat-input-row { gap: 5px; }
  textarea.chat-input { min-width: 0; padding: 9px 10px; }
  #emoji-toggle-btn, #chat-send-btn { width: 44px; min-width: 44px; height: 44px; padding: 0; }
  .chat-file-label { min-height: 44px; padding: 8px 12px; }
  .emoji-picker { left: 0; width: min(272px, calc(100vw - 76px)); }
  .tasks-panel, .docs-panel, .members-panel { padding: 16px 12px; }
  .tasks-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .tasks-toolbar > .btn:first-child { grid-column: 1; grid-row: 1; }
  .tasks-toolbar > .btn:last-child { grid-column: 2; grid-row: 1; }
  .tasks-toolbar #filter-assignee { grid-column: 1; grid-row: 2; }
  .tasks-toolbar #filter-status { grid-column: 2; grid-row: 2; }
  .tasks-toolbar .btn, .tasks-toolbar .form-input { width: 100% !important; min-width: 0; min-height: 44px; }
  .new-task-form { padding: 16px; }
  .new-task-form .btn { min-height: 44px; }
  .task-item { padding: 12px; }
  .task-checkbox input[type="checkbox"] { width: 22px; height: 22px; }
  .docs-toolbar .btn { min-height: 44px; }
  .upload-zone { padding: 22px 12px; }
  .doc-actions .btn { min-height: 40px; flex: 1; }
  .members-panel > .btn-group .btn { min-height: 44px; }
  .member-info { min-width: 0; }
  .member-name, .member-uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .modal-overlay { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 24px 18px; }

}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-hero {
  display: flex; align-items: center; gap: 28px;
  padding: 36px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); margin-bottom: 30px;
}
.profile-avatar-xl {
  width: 90px; height: 90px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-elevated); border: 3px solid var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 2.8rem;
  box-shadow: 0 0 24px rgba(37,99,235,0.2);
}
.profile-display-name { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.profile-username-tag { font-size: 0.85rem; color: var(--text-muted); font-family:'Courier New',monospace; margin-bottom: 10px; }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.profile-panel-title {
  font-size: 1rem; font-weight: 700; margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

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

.friend-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: var(--transition);
}
.friend-row:hover { border-color: rgba(37,99,235,0.2); }

.friend-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-card); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 0.9rem; font-weight: 600; }
.friend-username { font-size: 0.74rem; color: var(--text-muted); }

.online-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.online-dot.online  { background: var(--success); }
.online-dot.offline { background: var(--text-muted); }

/* ---- Invitation Code Display ---- */
.inv-code-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-secondary); border: 1.5px solid var(--accent);
  border-radius: var(--radius); padding: 12px 16px; margin: 12px 0;
}
.inv-code-text {
  flex: 1; font-family: 'Courier New', monospace; font-size: 1.1rem;
  font-weight: 700; color: var(--accent); letter-spacing: 2px;
}
.inv-code-copy {
  background: rgba(37,99,235,0.15); border: 1px solid rgba(37,99,235,0.3);
  color: var(--accent); padding: 5px 12px; border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.inv-code-copy:hover { background: var(--accent); color: white; }

.inv-type-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
}
.inv-type-friend  { background:rgba(52,152,219,0.15); color:#5dade2; border:1px solid rgba(52,152,219,0.3); }
.inv-type-project { background:rgba(155,89,182,0.15); color:#bb8de8; border:1px solid rgba(155,89,182,0.3); }

.code-history { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.code-history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.82rem;
}
.code-history-item.used { opacity: 0.5; }
.code-history-code { font-family: 'Courier New', monospace; font-weight: 700; flex: 1; }

/* ---- Friend selector grid (invite to project) ---- */
.friend-select-grid { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }

.friend-select-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--bg-elevated);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
}
.friend-select-item:hover { border-color: var(--text-secondary); }
.friend-select-item.selected { border-color: var(--accent); background: rgba(37,99,235,0.08); }
.friend-select-item input[type="checkbox"] { accent-color: var(--accent); width:16px; height:16px; }

/* ============================================================
   MEMBERS PANEL (in project workspace)
   ============================================================ */
.members-panel { padding: 24px; overflow-y: auto; }

.members-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: var(--transition);
}
.member-row:hover { border-color: rgba(37,99,235,0.2); }

.member-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-elevated); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.member-info  { flex: 1; }
.member-name  { font-size: 0.9rem; font-weight: 600; }
.member-uname { font-size: 0.74rem; color: var(--text-muted); }
.member-role-badge {
  padding: 2px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 700; flex-shrink: 0;
}
.role-owner  { background:rgba(37,99,235,0.18);color:var(--accent);border:1px solid rgba(37,99,235,0.3); }
.role-member { background:rgba(255,255,255,0.08);color:var(--text-secondary);border:1px solid var(--border); }

/* ============================================================
   CHAT HUB  (enhanced project_chat.html sidebar)
   ============================================================ */
.chat-hub { display: flex; height: calc(100vh - 68px); overflow: hidden; }

.chat-hub-sidebar {
  width: 220px; min-width: 220px; flex-shrink: 0;
  background: #191919; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
}
.chat-hub-sidebar-title {
  padding: 14px 16px 8px; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted);
}
.chat-hub-friend-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer; transition: var(--transition);
  border-left: 3px solid transparent; text-decoration: none;
}
.chat-hub-friend-item:hover { background: rgba(255,255,255,0.05); border-left-color: var(--border); }
.chat-hub-friend-item.active { background: rgba(37,99,235,0.1); border-left-color: var(--accent); }

.chat-hub-avatar {
  width: 30px; height: 30px; border-radius: 50%; position: relative; flex-shrink: 0;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.chat-hub-avatar .status-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); border: 1.5px solid #191919;
}
.chat-hub-item-name { font-size: 0.84rem; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-hub-project-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px; cursor: pointer; transition: var(--transition);
  text-decoration: none; border-left: 3px solid transparent;
}
.chat-hub-project-item:hover { background: rgba(255,255,255,0.05); }
.chat-hub-project-name { font-size: 0.82rem; color: var(--text-secondary); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.chat-hub-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

@media (max-width: 768px) {
  .profile-hero { flex-wrap: wrap; gap: 16px; padding: 24px 18px; }
  .profile-avatar-xl { width: 72px; height: 72px; font-size: 2.2rem; }
  .profile-hero > div:last-child { width: 100%; margin-left: 0 !important; }
  .profile-hero > div:last-child .btn { width: 100%; min-height: 44px; }
  .profile-panel { padding: 18px 16px; }
  .inv-code-box, .code-history-item { flex-wrap: wrap; }
  .inv-code-text { min-width: 0; overflow-wrap: anywhere; }

  .chat-hub { position: fixed; inset: 52px 0 0; height: auto; margin-top: 0; flex-direction: column; }
  .chat-hub-main { width: 100%; min-height: 0; order: 2; }
  .chat-hub-sidebar {
    width: 100%; min-width: 0; height: 56px; min-height: 56px; order: 1;
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .chat-hub-sidebar-title, .chat-hub-item-name, .chat-hub-project-name,
  .chat-hub-sidebar > div:last-child { display: none; }
  #hub-friends-list, #hub-projects-list { display: flex; flex: 0 0 auto; }
  .chat-hub-friend-item, .chat-hub-project-item {
    justify-content: center; width: 52px; min-width: 52px; padding: 0; border-left: 0;
  }
  .chat-hub-friend-item.active { border-left: 0; box-shadow: inset 0 -3px var(--accent); }
}

@media (max-width: 480px) {
  .doc-grid { grid-template-columns: 1fr; }
}
