/* ============================================================
   DocFlow Styles – Design System Aligned
   Uses app CSS variables + DocFlow purple accent
   ============================================================ */

:root {
  --df: #8b5cf6;
  --df-dark: #7c3aed;
  --df-light: #f5f3ff;
  --df-tint: #ede9fe;
  --df-glow: rgba(139,92,246,.15);
}

/* ── Tab visibility ── */
.df-tab { display: none; }
.df-tab.active { display: block; }

/* ── Cards ── */
.df-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.df-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--df);
  border-radius: var(--radius) var(--radius) 0 0;
}
.df-card:hover { box-shadow: var(--shadow-md); }
.df-card h3 { margin: 0 0 .8rem; font-size: .95rem; font-weight: 700; color: var(--text); }
.df-card .df-subtitle { color: var(--text-secondary); font-size: .8rem; margin: -.4rem 0 1rem; }
.df-card-plain { composes: df-card; }
.df-card-plain::before { display: none; }

/* ── KPI override for DocFlow ── */
.df-tab .kpi-card::before { background: var(--df); }
.df-tab .kpi-value { color: var(--df); }

/* ── Grid layouts ── */
.df-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.df-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Toolbar ── */
.df-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap; gap: .6rem;
}
.df-toolbar-actions { display: flex; gap: .5rem; align-items: center; }

/* ── Buttons ── */
.df-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.3rem; border-radius: 10px; font-size: .84rem;
  font-weight: 600; font-family: inherit; cursor: pointer;
  transition: var(--transition); letter-spacing: .01em; border: none;
}
.df-btn-primary {
  background: var(--df); color: #fff;
  box-shadow: 0 1px 3px var(--df-glow);
}
.df-btn-primary:hover {
  background: var(--df-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--df-glow);
}
.df-btn-primary:active { transform: translateY(0); }
.df-btn-secondary {
  background: var(--card); color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.df-btn-secondary:hover {
  border-color: var(--muted); background: var(--border-light);
  color: var(--text); transform: translateY(-1px);
}
.df-btn-danger {
  background: none; color: var(--danger); border: 1.5px solid var(--danger);
}
.df-btn-danger:hover { background: var(--danger-light); }
.df-btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; padding: 4px 8px; border-radius: 6px;
  opacity: .45; transition: var(--transition); color: var(--text);
}
.df-btn-icon:hover { opacity: 1; background: var(--df-light); }
.df-btn-icon svg, .df-btn-icon i, .df-btn svg, .df-btn i { pointer-events: none; }
.df-btn-sm { padding: .4rem .9rem; font-size: .78rem; border-radius: 8px; }

/* ── View toggle ── */
.df-view-toggle { display: flex; gap: 2px; }
.df-view-toggle button {
  background: var(--card); border: 1px solid var(--border);
  padding: 4px 8px; cursor: pointer; font-size: 14px;
  transition: var(--transition); border-radius: 6px;
}
.df-view-toggle button.active { background: var(--df); color: #fff; border-color: var(--df); }

/* ── Drop Zone ── */
.df-drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2rem; text-align: center; color: var(--muted);
  margin-bottom: 1rem; transition: var(--transition);
  background: var(--card);
}
.df-drop-zone.dragover { border-color: var(--df); background: var(--df-light); color: var(--df); }
.df-drop-zone p { margin: 0; font-size: .84rem; }
.df-drop-zone-icon { font-size: 2rem; margin-bottom: .5rem; display: block; }

/* ── Folders ── */
.df-folders-grid { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.2rem; }
.df-folder-card {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem; background: var(--df-light); border: 1px solid var(--df-tint);
  border-radius: var(--radius); cursor: pointer; transition: var(--transition);
  position: relative; min-width: 150px;
}
.df-folder-card:hover { background: var(--df-tint); border-color: #c4b5fd; transform: translateY(-1px); }
.df-folder-icon { font-size: 1.2rem; }
.df-folder-name { font-size: .82rem; font-weight: 600; color: var(--text); }
.df-folder-del { position: absolute; right: 6px; top: 6px; font-size: .7rem; display: none; }
.df-folder-card:hover .df-folder-del { display: block; }

/* ── Documents Grid ── */
.df-docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.df-doc-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; cursor: pointer; transition: var(--transition);
  text-align: center; position: relative; box-shadow: var(--shadow-sm);
}
.df-doc-card:hover { border-color: var(--df); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.df-doc-thumb { font-size: 2.2rem; margin-bottom: .5rem; }
.df-doc-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.df-doc-meta { font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.df-doc-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 2px; }
.df-doc-card:hover .df-doc-actions { display: flex; }

/* ── Documents List ── */
.df-docs-list { display: flex; flex-direction: column; gap: 2px; }
.df-doc-row {
  display: grid; grid-template-columns: 30px 1fr 60px 80px 50px 120px auto;
  align-items: center; gap: .5rem; padding: .6rem .8rem;
  border-radius: 6px; cursor: pointer; font-size: .82rem;
  transition: var(--transition);
}
.df-doc-row:hover { background: var(--df-light); }

/* ── Breadcrumb ── */
.df-breadcrumb { display: flex; align-items: center; gap: .3rem; font-size: .82rem; }
.df-breadcrumb a { color: var(--df); text-decoration: none; font-weight: 600; }
.df-breadcrumb a:hover { text-decoration: underline; }
.df-breadcrumb-sep { color: var(--muted); margin: 0 2px; }

/* ── Tables ── */
.df-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border); font-size: .82rem;
}
.df-table th {
  background: #f8fafc; padding: .65rem .6rem; text-align: left;
  font-weight: 600; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-secondary);
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
.df-table td { padding: .55rem .6rem; border-bottom: 1px solid var(--border-light); }
.df-table tbody tr { transition: background .15s; }
.df-table tbody tr:hover { background: #f8fafc; }
.df-table tbody tr:last-child td { border-bottom: none; }
.df-table a { color: var(--df); text-decoration: none; font-weight: 600; }
.df-table a:hover { text-decoration: underline; }
.df-table-full { width: 100%; }

/* ── Badges ── */
.df-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
}
.df-badge-green { background: var(--accent-light); color: #065f46; }
.df-badge-red { background: var(--danger-light); color: #991b1b; }
.df-badge-blue { background: #dbeafe; color: #1e40af; }
.df-badge-purple { background: var(--df-tint); color: #6b21a8; }
.df-badge-amber { background: var(--warn-light); color: #92400e; }
.df-mini-badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: .68rem; font-weight: 600; background: #f1f5f9; color: #475569; margin-right: 3px;
}
.df-mini-badge-open { background: var(--accent-light); color: #065f46; }

/* ── Toggle Switch ── */
.df-toggle { position: relative; display: inline-block; width: 38px; height: 22px; }
.df-toggle input { opacity: 0; width: 0; height: 0; }
.df-toggle-slider {
  position: absolute; inset: 0; background: #ccc; border-radius: 22px;
  cursor: pointer; transition: .25s;
}
.df-toggle-slider:before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 2px; bottom: 2px; background: #fff; border-radius: 50%;
  transition: .25s; box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.df-toggle input:checked + .df-toggle-slider { background: var(--df); }
.df-toggle input:checked + .df-toggle-slider:before { transform: translateX(16px); }

/* ── Progress Bar ── */
.df-progress { display: flex; align-items: center; gap: 6px; width: 100%; }
.df-progress-track { flex: 1; height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.df-progress-bar { height: 100%; background: var(--df); border-radius: 3px; transition: width .3s ease; }
.df-progress span { font-size: .72rem; color: var(--muted); white-space: nowrap; min-width: 32px; }

/* ── Spaces ── */
.df-spaces-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.df-space-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; cursor: pointer; transition: var(--transition);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.df-space-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--df); border-radius: var(--radius) var(--radius) 0 0;
}
.df-space-card:hover { border-color: var(--df); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.df-space-header { display: flex; justify-content: space-between; align-items: flex-start; }
.df-space-header h3 { margin: 0; font-size: .95rem; font-weight: 700; }
.df-space-desc { color: var(--text-secondary); font-size: .8rem; margin: .5rem 0; line-height: 1.5; }
.df-space-stats { display: flex; gap: 1rem; font-size: .78rem; color: var(--text-secondary); margin-top: .8rem; }
.df-space-footer { font-size: .72rem; color: var(--muted); margin-top: .6rem; }

/* ── Space Detail ── */
.df-space-detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.df-space-settings { display: flex; flex-direction: column; gap: .5rem; font-size: .82rem; }
.df-space-settings label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.df-space-docs { display: flex; flex-direction: column; gap: 3px; }
.df-space-doc-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 6px; transition: var(--transition); }
.df-space-doc-row:hover { background: var(--df-light); }
.df-doc-order {
  width: 24px; height: 24px; background: var(--df-tint); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: var(--df-dark); flex-shrink: 0;
}

/* ── Links ── */
.df-link-row { display: flex; justify-content: space-between; align-items: center; padding: .6rem; border-radius: 6px; transition: var(--transition); }
.df-link-row:hover { background: var(--df-light); }
.df-link-meta { display: flex; gap: .5rem; align-items: center; font-size: .78rem; color: var(--muted); margin-top: .3rem; }

/* ── Activity ── */
.df-activity-list { display: flex; flex-direction: column; gap: 2px; }
.df-activity-item { display: flex; gap: .8rem; padding: .7rem; border-radius: 6px; transition: var(--transition); }
.df-activity-item:hover { background: var(--df-light); }
.df-activity-icon {
  width: 36px; height: 36px; border-radius: 50%; background: var(--df);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.df-activity-info { font-size: .82rem; line-height: 1.4; }
.df-activity-info em { color: var(--df); font-style: normal; font-weight: 600; }
.df-activity-meta { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; }

/* ── Document Detail ── */
.df-detail-layout { display: grid; grid-template-columns: 1fr 360px; gap: 1.2rem; }
.df-pdf-frame { width: 100%; height: 600px; border: none; border-radius: var(--radius); background: #f5f5f5; }
.df-img-preview { max-width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.df-file-preview {
  text-align: center; padding: 3rem; background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.df-file-icon-lg { font-size: 4rem; margin-bottom: .8rem; }
.df-detail-row {
  display: flex; justify-content: space-between; padding: .45rem 0;
  border-bottom: 1px solid var(--border-light); font-size: .82rem;
}
.df-detail-row span:first-child { color: var(--text-secondary); }
.df-detail-row strong { color: var(--text); font-weight: 600; }

/* ── Versions ── */
.df-version-row { display: flex; justify-content: space-between; padding: .4rem 0; font-size: .78rem; border-bottom: 1px solid var(--border-light); }

/* ── Views ── */
.df-view-row { display: flex; gap: .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border-light); }
.df-viewer-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--df-tint);
  color: var(--df-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem; flex-shrink: 0;
}
.df-view-meta { font-size: .72rem; color: var(--muted); }

/* ── Q&A ── */
.df-qa-list { display: flex; flex-direction: column; gap: .8rem; }
.df-qa-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.df-qa-question strong { font-size: .82rem; }
.df-qa-question p { margin: .4rem 0 0; font-size: .82rem; line-height: 1.5; }
.df-qa-date { font-size: .72rem; color: var(--muted); margin-left: .5rem; }
.df-qa-answer { background: var(--df-light); border-radius: 6px; padding: .7rem; font-size: .82rem; margin-top: .5rem; }
.df-qa-answer-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }

/* ── Branding ── */
.df-branding-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.2rem; }
.df-branding-item {
  display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius); transition: var(--transition);
}
.df-branding-item:hover { border-color: var(--df); }
.df-branding-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; }
.df-branding-logo-placeholder {
  width: 40px; height: 40px; background: var(--border-light); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: .65rem; color: var(--muted);
}
.df-branding-colors { display: flex; gap: 4px; }
.df-color-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.df-branding-info { flex: 1; display: flex; flex-direction: column; }
.df-branding-info strong { font-size: .82rem; }
.df-branding-info span { font-size: .78rem; color: var(--muted); }

/* ── Forms ── */
.df-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.df-form-row { margin-bottom: .8rem; }
.df-form-row label {
  display: block; font-size: .72rem; font-weight: 600; color: var(--text-secondary);
  margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .4px;
}
.df-form-row input, .df-form-row select {
  width: 100%; padding: .6rem .9rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .85rem; outline: none;
  transition: var(--transition); background: #fafbfc; font-family: inherit;
}
.df-form-row input:focus, .df-form-row select:focus {
  border-color: var(--df); background: #fff;
  box-shadow: 0 0 0 3px var(--df-glow);
}
.df-textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 8px;
  padding: .6rem .9rem; font-family: inherit; font-size: .82rem;
  resize: vertical; transition: var(--transition); background: #fafbfc;
}
.df-textarea:focus { border-color: var(--df); background: #fff; box-shadow: 0 0 0 3px var(--df-glow); outline: none; }
.df-checkbox {
  display: flex; align-items: center; gap: .5rem; font-size: .82rem;
  cursor: pointer; padding: .3rem 0;
}
.df-checkbox input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--df); cursor: pointer;
}
.df-form-section { margin-top: 1rem; }
.df-form-section h4 {
  font-size: .78rem; font-weight: 700; color: var(--text);
  margin: 0 0 .6rem; text-transform: uppercase; letter-spacing: .3px;
}
.df-form-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Modal ── */
#df-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  z-index: 1000; justify-content: center; align-items: center;
  padding: 20px; animation: dfBackdropIn .2s ease;
}
@keyframes dfBackdropIn { from { opacity: 0; } to { opacity: 1; } }
.df-modal-content {
  background: var(--card); border-radius: 16px; width: 100%; max-width: 540px;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: dfModalIn .25s ease;
}
@keyframes dfModalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.df-modal-lg { max-width: 800px; }
.df-modal-sm { max-width: 420px; }
.df-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border);
}
.df-modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text); }
.df-modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; transition: var(--transition); }
.df-modal-close:hover { color: var(--text); background: var(--border-light); }
.df-modal-body { padding: 1.5rem; overflow-y: auto; }
.df-modal-footer {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
}

/* ── Modal Tabs ── */
.df-modal-tabs {
  display: flex; gap: 0; border-bottom: 1.5px solid var(--border);
  padding: 0 1.5rem; background: #f8fafc;
}
.df-modal-tab {
  padding: .7rem 1rem; font-size: .82rem; font-weight: 600;
  color: var(--text-secondary); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; transition: var(--transition);
  font-family: inherit;
}
.df-modal-tab:hover { color: var(--text); }
.df-modal-tab.active { color: var(--df); border-bottom-color: var(--df); }

/* ── Heatmap ── */
.df-heatmap { display: flex; flex-direction: column; gap: 3px; }
.df-heatmap-row { display: flex; align-items: center; gap: .5rem; font-size: .78rem; }
.df-heatmap-label { width: 60px; text-align: right; color: var(--text-secondary); font-weight: 600; flex-shrink: 0; }
.df-heatmap-bar-bg { flex: 1; height: 22px; background: var(--border-light); border-radius: 4px; overflow: hidden; position: relative; }
.df-heatmap-bar {
  height: 100%; border-radius: 4px; transition: width .4s ease;
  display: flex; align-items: center; padding-left: .5rem;
  font-size: .68rem; font-weight: 600; color: #fff;
}
.df-heatmap-bar.hot { background: linear-gradient(90deg, #f97316, #ef4444); }
.df-heatmap-bar.warm { background: linear-gradient(90deg, #eab308, #f97316); }
.df-heatmap-bar.cool { background: linear-gradient(90deg, var(--df), #6366f1); }
.df-heatmap-bar.cold { background: var(--border); color: var(--text-secondary); }
.df-heatmap-time { width: 50px; font-size: .72rem; color: var(--muted); text-align: right; }

/* ── Timeline ── */
.df-timeline { position: relative; padding-left: 2rem; }
.df-timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.df-timeline-item { position: relative; padding: .6rem 0; }
.df-timeline-dot {
  position: absolute; left: -1.55rem; top: .8rem; width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid var(--card); z-index: 1;
}
.df-timeline-dot.view { background: var(--df); }
.df-timeline-dot.download { background: var(--accent); }
.df-timeline-dot.nda { background: var(--warn); }
.df-timeline-info { font-size: .82rem; }
.df-timeline-time { font-size: .72rem; color: var(--muted); }

/* ── Engagement Score ── */
.df-engagement {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; font-size: .78rem; font-weight: 700;
}
.df-engagement-high { background: var(--accent-light); color: #065f46; }
.df-engagement-mid { background: var(--warn-light); color: #92400e; }
.df-engagement-low { background: var(--danger-light); color: #991b1b; }

/* ── Empty State ── */
.df-empty-state{ text-align: center; padding: 3rem 1.5rem; color: var(--muted);
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); background:#fff; border:1px solid var(--border,#e2e8f0); }
.df-empty-state-icon { font-size: 3rem; margin-bottom: .8rem; display: block; opacity: .5; }
.df-empty-state p { font-size: .88rem; margin-bottom: .8rem; }
.df-empty{ color: var(--muted); font-size: .82rem; padding: 1rem; text-align: center; }

/* ── Loading ── */
.df-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem; }
.df-spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--df); border-radius: 50%; animation: dfSpin .7s linear infinite;
}
@keyframes dfSpin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.df-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: .7rem 1.4rem; border-radius: 10px; font-size: .82rem; font-weight: 600;
  z-index: 10000; animation: dfToastIn .3s ease; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: .5rem;
}
.df-toast-success { background: #065f46; color: #fff; }
.df-toast-error { background: #991b1b; color: #fff; }
.df-toast-info { background: var(--text); color: #fff; }
@keyframes dfToastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%); } }

/* ── Access Control ── */
.df-access-row { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; font-size: .82rem; border-bottom: 1px solid var(--border-light); }
.df-access-input-row { display: flex; gap: .5rem; margin-top: .5rem; }
.df-access-input-row input { flex: 1; }
.df-access-input-row select { width: 120px; }

/* ── Document Picker ── */
.df-doc-picker { display: flex; flex-direction: column; gap: 3px; max-height: 300px; overflow-y: auto; }
.df-doc-pick-item {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem;
  border-radius: 6px; cursor: pointer; font-size: .82rem; transition: var(--transition);
}
.df-doc-pick-item:hover { background: var(--df-light); }

/* ── Share Result ── */
.df-share-url { display: flex; gap: .5rem; margin: 1rem 0; }
.df-url-input {
  flex: 1; padding: .6rem .9rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .82rem; background: #f8fafc; font-family: monospace;
}
.df-share-hint { font-size: .82rem; color: var(--muted); }

/* ── File Preview Badges ── */
.df-file-type {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; font-size: .68rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
}
.df-file-type-pdf { background: #fee2e2; color: #dc2626; }
.df-file-type-doc { background: #dbeafe; color: #2563eb; }
.df-file-type-xls { background: #dcfce7; color: #16a34a; }
.df-file-type-ppt { background: #fed7aa; color: #ea580c; }
.df-file-type-img { background: var(--df-tint); color: var(--df); }
.df-file-type-other { background: #f1f5f9; color: #64748b; }

/* ============================================================
   DOCSEND-STYLE: Content Library Layout
   ============================================================ */

/* ── Content Library 2-column layout ── */
.df-library-layout { display: grid; grid-template-columns: 240px 1fr; gap: 0; min-height: calc(100vh - 140px); }

/* ── Sidebar Tree ── */
.df-tree-sidebar {
  border-right: 1px solid var(--border); padding: 1rem 0; overflow-y: auto;
  background: var(--card); border-radius: var(--radius) 0 0 var(--radius);
}
.df-tree-title { font-size: .82rem; font-weight: 700; padding: .5rem 1rem; color: var(--text); }
.df-tree-item {
  display: flex; align-items: center; gap: .4rem; padding: .4rem .6rem .4rem 1rem;
  cursor: pointer; font-size: .82rem; color: var(--text-secondary); transition: all .12s;
  border-radius: 0; border-left: 3px solid transparent;
}
.df-tree-item:hover { background: var(--df-light); color: var(--text); }
.df-tree-item.active { background: var(--df-light); color: var(--df); border-left-color: var(--df); font-weight: 600; }
.df-tree-item-icon { font-size: .9rem; flex-shrink: 0; opacity: .7; }
.df-tree-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.df-tree-toggle { width: 16px; font-size: .6rem; color: var(--muted); transition: transform .2s; flex-shrink: 0; cursor: pointer; text-align: center; }
.df-tree-toggle.open { transform: rotate(90deg); }
.df-tree-section-title {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: .8rem 1rem .3rem; display: flex; justify-content: space-between; align-items: center;
}
.df-tree-section-title button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: 0; }
.df-tree-section-title button:hover { color: var(--df); }
.df-tree-children { padding-left: .8rem; }
.df-tree-divider { border: none; border-top: 1px solid var(--border); margin: .6rem 1rem; }

/* ── Content Library Main Area ── */
.df-library-main { padding: 1.2rem 1.5rem; }
.df-library-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.df-library-header h2 { font-size: 1.3rem; font-weight: 700; margin: 0; }

/* ── Content Table (DocSend-style list) ── */
.df-content-table { width: 100%; border-collapse: collapse; }
.df-content-table th {
  text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--border);
}
.df-content-table td { padding: .6rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.df-content-table tbody tr { cursor: pointer; transition: background .12s; }
.df-content-table tbody tr:hover { background: var(--df-light); }
.df-content-row-name { display: flex; align-items: center; gap: .7rem; }
.df-content-folder-icon {
  width: 36px; height: 30px; background: #93b4f5; border-radius: 3px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; position: relative;
}
.df-content-folder-icon::before {
  content: ''; position: absolute; top: -4px; left: 0; width: 14px; height: 6px;
  background: #93b4f5; border-radius: 3px 3px 0 0;
}
.df-content-file-thumb {
  width: 36px; height: 36px; border-radius: 4px; display: flex; align-items: center;
  justify-content: center; font-size: .6rem; font-weight: 800; flex-shrink: 0;
}
.df-content-name-text { font-size: .88rem; font-weight: 600; color: var(--text); }
.df-content-author { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.df-content-date { font-size: .82rem; color: var(--text-secondary); }
.df-content-visits { font-size: .82rem; color: var(--text-secondary); }
.df-menu-cell { cursor: pointer; text-align: center; position: relative; }
.df-content-menu { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.df-content-menu svg,.df-content-menu i { pointer-events: none; }
.df-content-menu:hover { background: var(--border-light); color: var(--text); }
.df-ctx-menu{position:fixed;z-index:999;background:var(--card);border:1px solid var(--border);border-radius:8px;box-shadow:var(--shadow-lg);min-width:160px;padding:4px;animation:tabFadeIn .15s ease}
.df-ctx-item{display:flex;align-items:center;gap:8px;padding:7px 12px;font-size:.82rem;cursor:pointer;border-radius:6px;color:var(--text);transition:background .1s}
.df-ctx-item:hover{background:var(--border-light)}
.df-ctx-danger{color:var(--danger)}
.df-ctx-danger:hover{background:var(--danger-light)}
.df-content-section-label { font-size: .88rem; font-weight: 700; color: var(--text); padding: .8rem .6rem .4rem; }

/* ============================================================
   DOCSEND-STYLE: Document Detail
   ============================================================ */

/* ── Document Header ── */
.df-doc-header {
  display: flex; gap: 1rem; align-items: flex-start; padding: 1.2rem 0; margin-bottom: .5rem;
}
.df-doc-header-thumb {
  width: 56px; height: 56px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: .9rem; font-weight: 800; flex-shrink: 0; background: var(--df-tint); color: var(--df);
}
.df-doc-header-info { flex: 1; }
.df-doc-header-title {
  font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 0; display: flex; align-items: center; gap: .5rem;
}
.df-doc-header-title .df-edit-icon { font-size: .8rem; opacity: .4; cursor: pointer; }
.df-doc-header-title .df-edit-icon:hover { opacity: 1; color: var(--df); }
.df-doc-header-note {
  font-size: .82rem; color: var(--muted); margin: .3rem 0; cursor: pointer; font-style: italic;
}
.df-doc-header-note:hover { color: var(--df); }
.df-doc-header-meta { font-size: .78rem; color: var(--muted); margin-top: .3rem; display: flex; align-items: center; gap: .5rem; }
.df-doc-header-actions { display: flex; gap: .5rem; flex-shrink: 0; align-items: flex-start; margin-top: .3rem; }

/* ── Document Detail Tabs ── */
.df-doc-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.2rem;
}
.df-doc-tab {
  background: none; border: none; padding: .7rem 1.2rem; font-size: .88rem; font-weight: 600;
  cursor: pointer; color: var(--text-secondary); border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all .15s; font-family: inherit;
}
.df-doc-tab:hover { color: var(--text); }
.df-doc-tab.active { color: var(--df); border-bottom-color: var(--df); }
.df-doc-tab-content { display: none; }
.df-doc-tab-content.active { display: block; }

/* ── Visit Rows (expandable) ── */
.df-visit-item { border-bottom: 1px solid var(--border-light); }
.df-visit-header {
  display: grid; grid-template-columns: 36px 1fr 140px 70px 36px 32px;
  align-items: center; gap: .5rem; padding: .65rem .4rem; cursor: pointer; transition: background .12s;
}
.df-visit-header:hover { background: var(--df-light); }
.df-visit-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: .75rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.df-visit-avatar-0 { background: #e57373; }
.df-visit-avatar-1 { background: #f0a03c; }
.df-visit-avatar-2 { background: #4db6ac; }
.df-visit-avatar-3 { background: #7986cb; }
.df-visit-avatar-4 { background: #ba68c8; }
.df-visit-info { display: flex; flex-direction: column; min-width: 0; }
.df-visit-email { font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.df-visit-link-label { font-size: .72rem; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.df-visit-link-icon { font-size: .7rem; }
.df-visit-duration { font-size: .92rem; font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.df-visit-download { color: #3b82f6; font-size: .9rem; text-align: center; }
.df-visit-chevron {
  background: none; border: none; font-size: .7rem; color: var(--muted); cursor: pointer;
  transition: transform .2s; padding: 4px;
}
.df-visit-chevron.open { transform: rotate(180deg); }

/* ── Completion Ring (SVG circle) ── */
.df-completion-ring { width: 32px; height: 32px; flex-shrink: 0; }
.df-completion-ring circle { fill: none; stroke-width: 3; }
.df-completion-ring .ring-bg { stroke: var(--border); }
.df-completion-ring .ring-fg { stroke: var(--df); stroke-linecap: round; transition: stroke-dashoffset .4s ease; }

/* ── Visit Detail (expanded) ── */
.df-visit-detail {
  background: var(--card); border-radius: 0 0 10px 10px; padding: 1rem 1.2rem;
  display: none; border-top: 1px solid var(--border-light);
}
.df-visit-detail.open { display: block; animation: dfSlideDown .25s ease; }
@keyframes dfSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.df-visit-device-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin-bottom: .4rem; }
.df-visit-device { font-size: .78rem; color: var(--text-secondary); margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }

/* ── Per-Page Bar Chart (DocSend magenta bars on dark bg) ── */
.df-page-bars-container { position: relative; }
.df-page-bars-wrapper { display: flex; align-items: stretch; gap: 0; }
.df-page-bars-y-axis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding-right: 8px; width: 42px; flex-shrink: 0; }
.df-page-bars-y-label { font-size: .65rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.df-page-bars { display: flex; align-items: flex-end; gap: 2px; height: 160px; flex: 1; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 4px 0; position: relative; }
.df-page-bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; height: 100%; justify-content: flex-end; position: relative; cursor: pointer; }
.df-page-bar {
  width: 100%; max-width: 24px; background: linear-gradient(180deg, #e84393, #d63384);
  border-radius: 2px 2px 0 0; min-height: 2px; transition: all .15s;
}
.df-page-bar-col:hover .df-page-bar { background: linear-gradient(180deg, #ff6bb5, #e84393); transform: scaleY(1.05); transform-origin: bottom; }
.df-page-bar-label { font-size: .6rem; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.df-page-bar-col:hover .df-page-bar-label { color: #e84393; font-weight: 600; }

/* ── Slide Preview Tooltip (on hover) ── */
.df-slide-tooltip { position: fixed; z-index: 1000; background: #0f172a; border: 1px solid #334155; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.5); padding: 0; pointer-events: none; width: 320px; overflow: hidden; }
.df-slide-tooltip canvas { width: 100%; display: block; border-radius: 10px 10px 0 0; }
.df-slide-tooltip-info { display: flex; justify-content: space-between; padding: .6rem .8rem; background: #0f172a; }
.df-slide-tooltip-col { text-align: center; }
.df-slide-tooltip-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .5px; color: #64748b; font-weight: 600; }
.df-slide-tooltip-value { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; font-variant-numeric: tabular-nums; }

/* ── Links Section in Document Detail ── */
.df-links-section { margin-top: 1.5rem; }
.df-links-section h3 { font-size: .92rem; font-weight: 700; margin-bottom: .8rem; }
.df-link-expand-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .5rem; overflow: hidden; }
.df-link-expand-header {
  display: grid; grid-template-columns: 28px 1fr auto 50px auto 70px 32px;
  align-items: center; gap: .5rem; padding: .6rem .8rem; cursor: pointer; transition: background .12s;
}
.df-link-expand-header:hover { background: var(--df-light); }
.df-link-icon { font-size: .9rem; color: var(--muted); }
.df-link-name-col { font-size: .82rem; font-weight: 600; }
.df-link-name-date { font-size: .72rem; color: var(--muted); }
.df-link-url-col {
  font-size: .72rem; color: var(--df); background: var(--df-light); padding: 3px 8px;
  border-radius: 4px; font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.df-link-visits-col { font-size: .82rem; color: var(--text-secondary); text-align: right; }
.df-link-expand-body { display: none; border-top: 1px solid var(--border-light); }
.df-link-expand-body.open { display: block; }
.df-link-viewer-row {
  display: grid; grid-template-columns: 28px 1fr 70px 36px;
  align-items: center; gap: .5rem; padding: .5rem .8rem .5rem 2.5rem; font-size: .82rem;
  border-bottom: 1px solid var(--border-light);
}
.df-link-viewer-row:last-child { border-bottom: none; }

/* ── Performance Tab (Aggregated page chart) ── */
.df-perf-chart-container { background: var(--card); border-radius: var(--radius); padding: 1.2rem; border: 1px solid var(--border); }
.df-perf-kpi-row { display: flex; gap: 1.5rem; margin-bottom: 1.2rem; }
.df-perf-kpi { text-align: center; }
.df-perf-kpi-value { font-size: 1.4rem; font-weight: 700; color: var(--df); }
.df-perf-kpi-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }

/* ── Usage Tab ── */
.df-usage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.df-usage-card {
  background: var(--card); border-radius: var(--radius); padding: 1.2rem; text-align: center;
  border: 1px solid var(--border);
}
.df-usage-value { font-size: 1.8rem; font-weight: 700; color: var(--df); }
.df-usage-label { font-size: .78rem; color: var(--muted); margin-top: .2rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .df-grid-2, .df-grid-3 { grid-template-columns: 1fr; }
  .df-detail-layout { grid-template-columns: 1fr; }
  .df-form-grid { grid-template-columns: 1fr; }
  .df-modal-content { max-width: 95vw; }
  .df-spaces-grid { grid-template-columns: 1fr; }
  .df-library-layout { grid-template-columns: 1fr; }
  .df-tree-sidebar { display: none; }
  .df-visit-header { grid-template-columns: 32px 1fr 60px 28px; }
  .df-visit-header .df-visit-link-label { display: none; }
  .df-link-expand-header { grid-template-columns: 1fr auto 32px; }
  .df-link-url-col { display: none; }
  .df-usage-grid { grid-template-columns: 1fr; }
}

/* ========== Template Grid ========== */
.df-template-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1rem}
