/* ============================================================
   TOPICS & TEAM — Collaboration Section
   Same design system as Submittal (Inter, base 13px)
   ============================================================ */

/* ── Section wrapper ─────────────────────────────────────────── */
#section-collaboration.section.collab-section {
  display: none !important;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
  background: var(--bg-surface, #fff);
  box-sizing: border-box;
  overflow: hidden;
}
#section-collaboration.section.collab-section.active {
  display: flex !important;
}

/* ── Tab bar — pill style matching submittal-subnav ─────────── */
.collab-tabbar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  border-radius: 10px;
  margin: 0;
}

.collab-tab {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 9px 22px;
  border: none;
  background: transparent;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  border-radius: 8px;
  transition: all .2s ease;
}
.collab-tab:hover {
  color: var(--primary-blue, #2563eb);
  background: rgba(59, 130, 246, 0.08);
}
.collab-tab.active {
  background: #fff;
  color: var(--primary-blue, #2563eb);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.collab-tab svg { opacity: .65; }
.collab-tab.active svg { opacity: 1; }
.collab-tab-count {
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--color-bg-light, #e2e8f0);
  color: var(--text-muted, #64748b);
  min-width: 18px;
  text-align: center;
}
.collab-tab.active .collab-tab-count {
  background: var(--primary-blue, #2563eb);
  color: #fff;
}

/* ── Pane ─────────────────────────────────────────────────────── */
.collab-pane {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.collab-pane.active { display: flex; }

/* ── Stats bar ───────────────────────────────────────────────── */
.topics-stats-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  flex-shrink: 0;
  flex-wrap: nowrap;
}
.ts-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.ts-val { font-size: 16px; font-weight: 700; color: var(--text-color, #1e293b); }
.ts-lbl { font-size: 11px; color: var(--text-muted, #94a3b8); text-transform: uppercase; letter-spacing: 0.5px; }
.ts-open .ts-val   { color: #d97706; }
.ts-critical .ts-val { color: #dc2626; font-weight: 800; }

/* ── Toolbar ─────────────────────────────────────────────────── */
.topics-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 00px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #fff);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.topics-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  padding: 5px 10px;
  background: var(--color-bg-light, #f8fafc);
}
.topics-search-inp {
  border: none; background: transparent; outline: none;
  font-size: 13px; color: var(--text-color, #1e293b); width: 100%;
}
.topics-sel {
  padding: 5px 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg-surface, #fff);
  color: var(--text-color, #1e293b);
  cursor: pointer;
  outline: none;
}

.topics-toolbar .cs-select {
  min-width: 140px;
}

.topics-toolbar .cs-select .cs-select__trigger {
  min-height: 30px;
  border-radius: 6px;
  font-size: 12px;
  padding: 5px 8px;
}
.topics-toolbar-right { margin-left: auto; display: flex; gap: 8px; }
.topics-btn-new {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border: none; border-radius: 6px;
  background: var(--color-primary, #2563eb);
  color: #fff;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  min-height: 40px;
}
.topics-btn-new:hover { background: var(--color-primary-dark, #1d4ed8); }
.topics-btn-new:disabled,
.topics-btn-new[aria-disabled="true"] {
  background: #94a3b8;
  color: rgba(255, 255, 255, 0.9);
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
}
.topics-btn-new:disabled:hover,
.topics-btn-new[aria-disabled="true"]:hover {
  background: #94a3b8;
}

/* ── Topics main area ─────────────────────────────────────────── */
.topics-main {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
/* When showing list, topics-main holds a flex column that fills height */
.topics-main.view-list {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* When showing detail, header fixed + body scrollable */
.topics-main.view-detail {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* tdp-header is a direct child of topics-main — fixed, never scrolls */
.topics-main.view-detail > .tdp-header {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface, #fff);
  padding: 14px 24px 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
/* topics-detail-panel is a direct child — takes remaining height and scrolls */
.topics-main.view-detail > .topics-detail-panel {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ── Topics table ─────────────────────────────────────────────── */
.topics-list-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.topics-table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  font-size: 12.5px;
  table-layout: fixed;
}
/* Fixed header table — no scroll */
.topics-table-head {
  flex-shrink: 0;
}
.topics-table-head thead {
  background: var(--color-bg-light, #f8fafc);
}
/* Scrollable body wrapper */
.topics-body-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.topics-table th {
  position: relative;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  white-space: nowrap;
  user-select: none;
}
/* Column resize handle */
.tc-resize-handle {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 5px;
  cursor: col-resize;
  user-select: none;
  z-index: 1;
}
.tc-resize-handle:hover,
.tc-resize-handle.resizing {
  background: var(--color-primary, #2563eb);
  opacity: 0.4;
}
.topics-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  vertical-align: middle;
}
.topic-row { cursor: pointer; transition: background .12s; }
.topic-row:hover { background: var(--color-bg-light, #f8fafc); }
.topic-row.topic-row-sel { background: #eff6ff; }

/* Column widths */
.tc-id { width: 90px; }
.tc-title { width: 300px; }
.tc-status { width: 110px; }
.tc-priority { width: 80px; }
.tc-disc { width: 70px; }
.tc-raised { width: 110px; }
.tc-date { width: 90px; white-space: nowrap; }
.tc-due  { width: 90px; white-space: nowrap; }
.tc-links { width: 90px; }
.tc-overdue { color: #dc2626; font-weight: 600; }

.topic-type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
}
.topic-id-num {
  margin-left: 4px;
  font-size: 11px;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.topic-title-text {
  display: block;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-color, #1e293b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topic-tags-row { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.topic-tag {
  padding: 1px 6px;
  background: var(--color-bg-light, #f1f5f9);
  border-radius: 10px;
  font-size: 10px;
  color: var(--text-muted, #64748b);
  border: 1px solid var(--border-color, #e2e8f0);
}
.topic-status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.topic-overdue-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.tp-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
}
.tp-critical { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.tp-major    { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.tp-minor    { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.topic-disc { font-size: 11px; font-weight: 600; color: var(--text-muted, #64748b); }
.topic-user-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 9px; font-weight: 700;
  background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe;
  margin-right: 4px;
}
.topic-user-name { font-size: 11px; color: var(--text-muted, #64748b); }
.topic-link-count {
  font-size: 11px;
  color: var(--color-primary, #2563eb);
  cursor: default;
}
.topics-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted, #94a3b8);
  font-size: 13px;
  gap: 12px;
}

/* ── Topic Detail Panel ──────────────────────────────────────── */
.topics-detail-panel {
  padding: 10px 24px 24px;
  max-width: 900px;
}
.tdp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tdp-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tdp-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.tdp-id { font-size: 12px; font-weight: 700; color: var(--text-muted, #64748b); font-family: monospace; }
.tdp-status-sel {
  padding: 6px 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg-surface, #fff);
  color: var(--text-color, #1e293b);
  cursor: pointer;
  outline: none;
}
.tdp-watch-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  background: var(--bg-surface, #fff);
  color: var(--text-secondary, #64748b);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tdp-watch-btn:hover {
  border-color: var(--color-primary, #2563eb);
  color: var(--color-primary, #2563eb);
  background: rgba(37, 99, 235, 0.04);
}
.tdp-watch-btn.watching {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--color-primary, #2563eb);
  color: var(--color-primary, #2563eb);
  font-weight: 600;
}
.tdp-export-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tdp-export-btn:hover { background: #dcfce7; border-color: #86efac; }
.tdp-export-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.tdp-delete-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tdp-delete-btn:hover:not(:disabled) {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.tdp-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tdp-back {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary, #2563eb);
  color: #fff;
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.tdp-back:hover { background: var(--color-primary-dark, #1d4ed8); }
.tdp-badges { display: flex; align-items: center; gap: 6px; }
.tdp-id { font-size: 12px; font-weight: 700; color: var(--text-muted, #64748b); font-family: monospace; }
.tdp-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-color, #1e293b);
  line-height: 1.4;
  margin-bottom: 14px;
}
.tdp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 14px;
  background: var(--color-bg-light, #f8fafc);
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color, #e2e8f0);
}
.tdp-meta-item { display: flex; flex-direction: column; gap: 2px; }
.tdp-meta-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted, #94a3b8); }
.tdp-meta-val { font-size: 13px; font-weight: 500; color: var(--text-color, #1e293b); }
.tdp-disc { font-weight: 700; }
.tdp-overdue { color: #dc2626 !important; }
.tdp-section { margin-bottom: 18px; }
.tdp-sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted, #64748b);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  margin-bottom: 12px;
}
.tdp-edit-people-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-secondary, #64748b);
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all .2s ease;
}
.tdp-edit-people-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-blue, #2563eb);
}
.tdp-thread-count {
  font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0;
  padding: 1px 6px; background: var(--color-bg-light); border-radius: 10px;
  color: var(--text-muted);
}
.tdp-description {
  font-size: 13px; color: var(--text-color); line-height: 1.6;
  padding: 10px 14px;
  background: var(--color-bg-light, #f8fafc);
  border-radius: 6px;
  border-left: 3px solid var(--color-primary, #2563eb);
}
.tdp-links-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tdp-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: default;
  border: none;
  font-family: inherit;
}
button.tdp-link-pill {
  cursor: pointer;
  transition: opacity 0.12s;
}
button.tdp-link-pill:hover { opacity: 0.75; }
.tdp-link-ver {
  font-size: 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 4px;
  padding: 0 4px;
}
.tdp-link-file   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.tdp-link-sub    { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.tdp-link-clash  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.tdp-pill-rm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  background: rgba(0,0,0,0.12);
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.tdp-pill-rm:hover { background: rgba(0,0,0,0.28); }

/* File action popup (Tải về / Xem trong Data) */
.file-action-popup {
  position: absolute;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 10px 12px;
  min-width: 200px;
}
.fap-title {
  font-size: 12px;
  color: #475569;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.fap-actions { display: flex; gap: 8px; }
.fap-btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.fap-btn:hover { background: #e0f2fe; border-color: #7dd3fc; }
.fap-btn-download:hover { background: #dcfce7; border-color: #86efac; }

.tdp-tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tdp-people-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--color-bg-light, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  min-height: 40px;
  align-items: center;
}

.tdp-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--color-bg-light, #f8fafc);
  color: var(--text-color, #1e293b);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all .2s ease;
}
.tdp-user-pill:hover {
  background: var(--color-bg-hover, #eef2f8);
  border-color: var(--primary-blue, #2563eb);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.tdp-pill-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-color, #e2e8f0);
}
.tdp-pill-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}
.tdp-pill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  max-width: 140px;
}
.tdp-user-empty {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

/* ── Thread ──────────────────────────────────────────────────── */
.tdp-thread { display: flex; flex-direction: column; gap: 12px; }
.thread-msg {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #fff);
}
.thread-question { border-left: 3px solid #3b82f6; }
.thread-answer   { border-left: 3px solid #22c55e; }
.thread-note     { border-left: 3px solid #f59e0b; }
.thread-close    { border-left: 3px solid #64748b; }
.thread-confirmation { border-left: 3px solid #8b5cf6; }
.thread-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.thread-body { flex: 1; }
.thread-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-bottom: 6px;
}
.thread-name { font-weight: 600; font-size: 13px; color: var(--text-color); }
.thread-role { font-size: 11px; color: var(--text-muted); }
.thread-type-badge {
  padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
}
.thread-time { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.thread-text { font-size: 13px; line-height: 1.6; color: var(--text-color); white-space: pre-wrap; }
.thread-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thread-attach-pill {
  padding: 2px 8px;
  background: var(--color-bg-light);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── History timeline ─────────────────────────────────────────── */
.tdp-history { display: flex; flex-direction: column; gap: 0; }
.tdp-hist-item {
  display: flex; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.tdp-hist-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-primary, #2563eb);
  flex-shrink: 0;
  margin-top: 4px;
}
.tdp-hist-body { flex: 1; }
.tdp-hist-event { font-weight: 600; font-size: 12.5px; color: var(--text-color); }
.tdp-hist-actor { font-size: 12px; color: var(--text-muted); }
.tdp-hist-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tdp-hist-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Reply box ───────────────────────────────────────────── */
.tdp-reply-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  background: var(--bg-surface, #fff);
}
.tdp-reply-type {
  align-self: flex-start;
  padding: 4px 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  font-size: 12px;
  background: var(--color-bg-light, #f8fafc);
  color: var(--text-color, #1e293b);
  cursor: pointer;
  outline: none;
}
.tdp-reply-inp {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-color, #1e293b);
  background: var(--color-bg-light, #f8fafc);
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.tdp-reply-inp:focus { border-color: var(--color-primary, #2563eb); background: #fff; }
.tdp-pending-attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.tdp-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.topics-btn-outline {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  background: var(--bg-surface, #fff);
  color: var(--text-muted, #64748b);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.topics-btn-outline:hover { background: var(--color-bg-light, #f1f5f9); color: var(--text-color); border-color: #cbd5e1; }

/* ════════════════════════════════════════════════════════
   TEAM SECTION
   ════════════════════════════════════════════════════════ */
.team-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #fff);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.team-search-wrap {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 180px; max-width: 260px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px; padding: 5px 10px;
  background: var(--color-bg-light, #f8fafc);
}
.team-search-inp {
  border: none; background: transparent; outline: none;
  font-size: 13px; color: var(--text-color); width: 100%;
}

.team-stats {
  display: flex; align-items: center; gap: 0;
  padding: 10px 20px;
  background: var(--color-bg-light, #f8fafc);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.team-stat-item {
  display: flex; align-items: baseline; gap: 4px;
  padding: 4px 14px;
  border-right: 1px solid var(--border-color);
}
.team-stat-item:last-child { border-right: none; }

.team-groups {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.team-party-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  margin-bottom: 8px;
}
.team-party-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.team-party-label { font-size: 13px; font-weight: 700; color: var(--text-color); }
.team-party-count {
  font-size: 11px; color: var(--text-muted);
  padding: 1px 7px; background: var(--color-bg-light); border-radius: 10px;
}
.team-company-group { margin-bottom: 10px; }
.team-company-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  background: var(--color-bg-light, #f8fafc);
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--border-color, #e2e8f0);
  border-bottom: none;
}
.team-company-name { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.team-company-count {
  font-size: 11px; color: var(--text-muted);
  margin-left: auto;
}
.team-members-list {
  border: 1px solid var(--border-color, #e2e8f0);
  border-top: none;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}
.team-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  transition: background .12s;
  cursor: default;
}
.team-member-row:last-child { border-bottom: none; }
.team-member-row:hover { background: var(--color-bg-light, #f8fafc); }
.team-member-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.team-member-info { flex: 1; }
.team-member-name { font-size: 13px; font-weight: 600; color: var(--text-color); }
.team-member-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.team-member-email {
  font-size: 11.5px; color: var(--text-muted);
  font-family: monospace;
  min-width: 180px;
}
.team-member-actions { display: flex; align-items: center; gap: 4px; }
.team-member-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  background: var(--bg-surface, #fff);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.team-member-btn:hover { background: var(--color-bg-light); color: var(--color-primary); }

/* ── Team stats wrap (fixed header, not scrolling) ──────────── */
.team-stats-wrap {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: var(--color-bg-light, #f8fafc);
}
.team-stats-wrap:empty { display: none; }

/* ── Team stats bar extras ───────────────────────────────────── */
.team-stat-sep {
  width: 1px; height: 24px;
  background: var(--border-color, #e2e8f0);
  margin: 0 6px;
  flex-shrink: 0;
}
.team-stat-company {
  display: flex; align-items: center; gap: 5px;
  padding: 2px 10px;
  font-size: 12px; color: var(--text-muted);
}
.team-company-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.team-company-count {
  font-size: 11px; font-weight: 600;
  background: var(--color-bg-light, #f1f5f9);
  padding: 0 5px; border-radius: 8px;
  color: var(--text-muted);
}

/* ── Team category blocks ────────────────────────────────────── */
.team-category-block {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
}
/* Allow horizontal scroll when table is wider than container */
.team-category-block { overflow-x: auto; }
.team-category-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--color-bg-light, #f8fafc);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.team-category-icon { font-size: 14px; }
.team-category-title {
  font-size: 12px; font-weight: 700; color: var(--text-color);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.team-category-count {
  font-size: 11px; color: var(--text-muted);
  padding: 1px 7px; background: var(--border-color, #e2e8f0); border-radius: 10px;
  margin-left: auto;
}

/* ── Team table ──────────────────────────────────────────────── */
.team-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  /* Prefer natural column sizing for team tables; force if overridden */
  table-layout: auto !important;
  min-width: 100%;
}
.team-table thead tr {
  background: var(--bg-surface, #fff);
}
.team-table th {
  padding: 7px 12px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  /* Allow header text to wrap instead of forcing a fixed column width */
  white-space: normal;
  word-break: break-word;
}
.team-table-row { transition: background .12s; }
.team-table-row:hover { background: var(--color-bg-light, #f8fafc); }
.team-table-row:not(:last-child) td { border-bottom: 1px solid var(--border-color, #e2e8f0); }
.team-table td { padding: 8px 12px; vertical-align: middle; word-break: break-word; white-space: normal; }

.team-td-member {
  min-width: 0;
}
.team-td-member-inner {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.team-member-avatar-sm {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.team-member-name-text {
  font-weight: 600; color: var(--text-color);
  max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.team-td-role { color: var(--text-muted); font-size: 12px; }
.team-td-company { white-space: normal; }
.team-company-pill {
  display: inline-block;
  padding: 1px 8px;
  background: var(--color-bg-light, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  font-size: 11px; font-weight: 500; color: var(--text-muted);
}
.team-td-email { font-size: 11.5px; color: var(--text-muted); font-family: monospace; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-td-phone { font-size: 11.5px; color: var(--text-muted); font-family: monospace; white-space: nowrap; }
.team-td-perm { white-space: nowrap; }
.team-perm-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.team-th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.team-th-sortable:hover {
  background: var(--color-bg-light, #f8fafc);
}
.team-th-sortable::after {
  content: ' ↕';
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.4;
}
.team-th-sortable.sort-asc::after {
  content: ' ↑';
  opacity: 1;
  color: var(--color-primary, #3b82f6);
}
.team-th-sortable.sort-desc::after {
  content: ' ↓';
  opacity: 1;
  color: var(--color-primary, #3b82f6);
}
.team-th-actions {
  width: 96px;
  min-width: 96px;
}
.team-td-actions {
  width: 96px;
  min-width: 96px;
  white-space: nowrap;
}
.team-actions-cell {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}
.team-action-placeholder {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.team-action-btn,
.team-perm-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  background: var(--bg-surface, #fff);
  color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.team-action-btn svg,
.team-perm-btn svg {
  width: 14px;
  height: 14px;
}
.team-action-btn:hover,
.team-perm-btn:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.team-remove-btn:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* ── Topic Create Dialog (advanced form) ─────────────────────── */
.dialog.topic-create-dialog .dialog-header h2 {
  font-size: 18px;
  letter-spacing: 0.01em;
}


.dialog.topic-create-dialog .dialog-body {
  max-height: 76vh;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 16%);
  padding: 16px 18px;
}

.topic-create-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topic-create-section {
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.topic-create-section[data-topic-section="assignment"] {
  overflow: visible;
}

.topic-create-section[data-topic-section="assignment"] .topic-create-section-grid {
  overflow: visible;
}

.topic-create-section-header {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.topic-create-section-header h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #334155;
}

.topic-create-section-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
}

.topic-create-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 12px;
  align-items: start;
}

.topic-create-form .form-field {
  margin-bottom: 0;
}

/* .topic-create-form input,
.topic-create-form select,
.topic-create-form textarea {
  min-height: 40px;
} */

.topic-create-form .form-field[data-field-name="description"],
.topic-create-form .form-field[data-field-name="assigned_to"],
.topic-create-form .form-field[data-field-name="watchers"],
.topic-create-form .form-field[data-field-name="linked_files"],
.topic-create-form .form-field[data-field-name="linked_submittals"],
.topic-create-form .form-field[data-field-name="linked_topics"],
.topic-create-form .form-field[data-field-name="linked_clashes"],
.topic-create-form .form-field[data-field-name="rfi_question"],
.topic-create-form .form-field[data-field-name="rfi_reference_docs"],
.topic-create-form .form-field[data-field-name="rfa_requested_decision"],
.topic-create-form .form-field[data-field-name="rfa_alternative_option"],
.topic-create-form .form-field[data-field-name="ncr_non_conformance"],
.topic-create-form .form-field[data-field-name="ncr_root_cause"],
.topic-create-form .form-field[data-field-name="ncr_corrective_action"],
.topic-create-form .form-field[data-field-name="rfp_scope"],
.topic-create-form .form-field[data-field-name="rfp_deliverables"],
.topic-create-form .form-field[data-field-name="rfp_eval_criteria"] {
  grid-column: 1 / -1;
}

.topic-create-form .form-field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #475569;
}

.topic-create-form textarea {
  min-height: 92px;
}

.topic-create-form .multi-select-field,
.topic-create-form .checkbox-group {
  min-height: 120px;
  max-height: 190px;
  overflow-y: auto;
}

.dialog.topic-create-dialog .dialog-footer.topic-create-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.dialog.topic-create-dialog .dialog-footer.topic-create-footer .btn {
  min-width: 110px;
}

.topic-create-attach-block {
  grid-column: 1 / -1;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}

.topic-create-attach-head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #334155;
  margin-bottom: 8px;
}

.topic-create-attach-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topic-create-attach-hint {
  font-size: 12px;
  color: #64748b;
}

/* ── User Picker ─────────────────────────────────────────────── */
.user-picker {
  position: relative;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  cursor: text;
  z-index: 1;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.user-picker:focus-within {
  border-color: var(--color-primary);
  z-index: 30;
  box-shadow: 0 0 0 2.5px rgba(0, 102, 204, 0.14);
}

.user-picker-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  min-height: 40px;
}

.up-input-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 120px;
}

.up-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 2px 6px 2px 4px;
  font-size: 12px;
  color: #1d4ed8;
  max-width: 200px;
  flex-shrink: 0;
  user-select: none;
}

.up-token-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.up-token-avatar-img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  border: 1px solid #bfdbfe;
  background: #e2e8f0;
}

.up-token-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
    max-width: 100px;
}

.up-token-role {
  font-size: 10px;
  color: #60a5fa;
  background: #dbeafe;
  border-radius: 4px;
  padding: 1px 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.up-token-rm {
  border: none;
  background: transparent;
  color: #93c5fd;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.up-token-rm:hover { color: #1d4ed8; }

.user-picker-search {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  background: transparent;
  color: var(--text-primary);
  padding: 2px 0;
  min-width: 0;
}
.user-picker-search::placeholder { color: #94a3b8; }

.user-picker-dropdown {
  position: absolute;
  left: 0;
  right: 0;
    top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  list-style: none;
  margin: 0;
  padding: 4px;
    max-height: 220px;
  overflow-y: auto;
  z-index: var(--z-popover);
}

.upd-opt {
  display: flex;
  align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
}
.upd-opt:hover { background: #eff6ff; }

.upd-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upd-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  border: 1px solid #dbeafe;
  background: #e2e8f0;
}

.upd-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.upd-name {
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upd-role {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upd-empty {
  padding: 12px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  font-style: italic;
}

/* ── File Tree Picker ────────────────────────────────────────── */
.ftree-picker {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* max-height: 280px; */
}

.ftree-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ftree-search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ftree-search-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.12);
}

.ftree-search {
  flex: 1;
  border: none;
  outline: none;
  font-size: 12px;
  background: transparent;
  color: var(--text-primary);
  padding: 0;
}

.ftree-badge {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1px 7px;
  white-space: nowrap;
}

.ftree-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 4px;
}

.ftree-root { padding: 0; }

.ftree-folder {
  margin: 1px 0;
}

.ftree-folder-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.ftree-folder-hdr:hover { background: #f1f5f9; }

.ftree-folder-ico {
  color: #f59e0b;
}

.ftree-folder-ico path {
  fill: currentColor;
}

.ftree-folder-hdr.zone-wip {
  background: var(--cde-wip-bg, #fff8ec);
  border: 1px solid var(--cde-wip-border, #f5d080);
}

.ftree-folder-hdr.zone-shared {
  background: var(--cde-shared-bg, #eef5ff);
  border: 1px solid var(--cde-shared-border, #a8c8f8);
}

.ftree-folder-hdr.zone-published {
  background: var(--cde-publish-bg, #eefaf3);
  border: 1px solid var(--cde-publish-border, #7ecfa0);
}

.ftree-folder-hdr.zone-archive {
  background: var(--cde-archive-bg, #f4eeff);
  border: 1px solid var(--cde-archive-border, #c0a0e8);
}

.ftree-folder-hdr.zone-wip .ftree-folder-ico,
.ftree-folder-hdr.zone-wip .ftree-foldname {
  color: var(--cde-wip, #b86e00);
}

.ftree-folder-hdr.zone-shared .ftree-folder-ico,
.ftree-folder-hdr.zone-shared .ftree-foldname {
  color: var(--cde-shared, #1460b8);
}

.ftree-folder-hdr.zone-published .ftree-folder-ico,
.ftree-folder-hdr.zone-published .ftree-foldname {
  color: var(--cde-publish, #157a35);
}

.ftree-folder-hdr.zone-archive .ftree-folder-ico,
.ftree-folder-hdr.zone-archive .ftree-foldname {
  color: var(--cde-archive, #6530b0);
}

.ftree-arrow {
  font-size: 9px;
  color: #94a3b8;
  width: 10px;
  flex-shrink: 0;
}

.ftree-foldname {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ftree-fold-count {
  font-size: 10px;
  color: #94a3b8;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 0 5px;
  flex-shrink: 0;
}

.ftree-children {
  padding-left: 16px;
  border-left: 1px dashed #e2e8f0;
  margin-left: 12px;
}

.ftree-file {
  margin: 1px 0;
}

.ftree-file-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 12px;
  color: #475569;
}
.ftree-file-lbl:hover { background: #f8fafc; }
.ftree-chk:checked ~ .ftree-file-ext-badge,
.ftree-chk:checked ~ .ftree-fname { color: #1d4ed8; }

.ftree-chk {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}

.ftree-file-ext-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  background: #e2e8f0;
  color: #475569;
  border-radius: 3px;
  padding: 1px 3px;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.ftree-fname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ftree-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 10px;
  border-top: 1px solid #f1f5f9;
  /* min-height: 32px; */
  background: #fafbfc;
}

.ftree-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 2px 6px 2px 8px;
  font-size: 11px;
  color: #1d4ed8;
  max-width: 260px;
}
.ftree-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.ftree-chip-with-version {
  max-width: 320px;
}
.ftree-ver-badge {
  flex-shrink: 0;
  font-size: 10px;
  background: #dbeafe;
  border-radius: 6px;
  padding: 1px 5px;
  color: #1e40af;
}
.ftree-ver-sel {
  flex-shrink: 0;
  font-size: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 1px 4px;
  background: #dbeafe;
  color: #1e40af;
  cursor: pointer;
}

.ftree-chip-rm {
  border: none;
  background: transparent;
  color: #93c5fd;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.12s;
}
.ftree-chip-rm:hover { color: #1d4ed8; }

.ftree-empty {
  padding: 16px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

/* ── Search Item Picker (submittals / topics / clashes) ──────── */
.sip-wrap {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  position: relative;
  transition: border-color 0.15s;
}
.sip-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2.5px rgba(0, 102, 204, 0.14);
}

.sip-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px 4px;
  min-height: 34px;
}

.sip-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 12px;
  padding: 2px 6px 2px 8px;
  font-size: 11px;
  color: #166534;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sip-rm {
  border: none;
  background: transparent;
  color: #86efac;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.12s;
}
.sip-rm:hover { color: #166534; }

.sip-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-top: 1px solid #f1f5f9;
}

.sip-search {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  background: transparent;
  color: var(--text-primary);
  padding: 0;
  min-width: 0;
}

.sip-drop {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 220px;
  overflow-y: auto;
  z-index: var(--z-popover);
}

.sip-opt {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s;
}
.sip-opt:hover { background: #f0fdf4; color: #166534; }

.sip-empty {
  padding: 10px 8px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

/* ── Rich Text Editor ────────────────────────────────────────── */
.rte-wrap {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s;
}
.rte-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2.5px rgba(0, 102, 204, 0.14);
}

.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.rte-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1.4;
  min-width: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rte-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #1e293b;
}

.rte-divider {
  width: 1px;
  height: 16px;
  background: #e2e8f0;
  margin: 0 4px;
}

.rte-hint {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rte-editor {
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  outline: none;
  word-break: break-word;
}

.rte-editor:empty::before {
  content: attr(data-ph);
  color: #94a3b8;
  pointer-events: none;
}

.rte-editor ul, .rte-editor ol {
  margin: 4px 0;
  padding-left: 20px;
}

.rte-editor li { margin: 2px 0; }

.rte-inline-img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  margin: 4px 0;
  display: block;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.topic-create-file-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topic-create-file-empty {
  color: #94a3b8;
  font-size: 12px;
}

.topic-create-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px;
}

.topic-create-file-name {
  font-size: 12px;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-create-file-remove {
  border: none;
  background: transparent;
  color: #ef4444;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* ── Responsive: hide email on small screens ─────────────────── */
@media (max-width: 700px) {
  .topic-create-section-grid {
    grid-template-columns: 1fr;
  }

  .dialog.topic-create-dialog {
    width: calc(100vw - 12px);
  }

  .dialog.topic-create-dialog .dialog-body {
    max-height: 72vh;
    padding: 12px;
  }

  .team-member-email { display: none; }
  .team-td-email { display: none; }
  .topics-stats-bar { flex-direction: column; align-items: flex-start; }
}

/* ── Skeleton loading ─────────────────────────────────────── */
@keyframes clashSkShimmer {
  100% { transform: translateX(100%); }
}

.clash-skeleton-cell {
  display: inline-block;
  height: 13px;
  border-radius: 4px;
  background: #e2e8f0;
  position: relative;
  overflow: hidden;
}
.clash-skeleton-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, rgba(226,232,240,0) 0%, rgba(248,250,252,0.8) 50%, rgba(226,232,240,0) 100%);
  animation: clashSkShimmer 1.1s ease-in-out infinite;
}

tr.clash-skeleton-row td { padding-top: 10px; padding-bottom: 10px; }
tr.clash-skeleton-row:nth-child(even) { background: transparent; }
