/* Documents library, document page, live indicators */

/* Live status in the sidebar */
.live-badge { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--sidebar-text); opacity: .85; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #8a94a6; }
.live-badge[data-state="live"] .live-dot { background: #3ccf7a; box-shadow: 0 0 0 3px rgba(60, 207, 122, .18); }
.live-badge[data-state="connecting"] .live-dot { background: #e0a33a; }

/* "Someone made changes" bar when a live redraw would interrupt you */
.stale-bar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 8px 6px 16px; box-shadow: var(--shadow-lg); font-size: 13px; }
.stale-bar[hidden] { display: none; }

/* Type tags */
.doc-icon { flex: none; display: inline-grid; place-items: center; width: 38px; height: 30px; border-radius: 6px; font: 700 9.5px/1 var(--font); letter-spacing: .04em;
  color: #fff; background: #7b8798; }
.doc-icon-doc { background: var(--primary); }
.doc-icon-pdf { background: #c0392b; }
.doc-icon-word { background: #2b5797; }
.doc-icon-sheet { background: #1e7145; }
.doc-icon-slides { background: #c55a11; }
.doc-icon-image { background: #7a4fb5; }

/* Rows */
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); color: inherit; }
.doc-row:hover { background: var(--surface-2); text-decoration: none; }
.doc-row:last-child { border-bottom: 0; }
.doc-row-main { display: flex; flex-direction: column; min-width: 0; }
.doc-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-more { display: block; padding: 10px 20px; font-size: 13px; }
.doc-group + .doc-group { border-top: 1px solid var(--border); }
.doc-group-head { display: flex; align-items: center; gap: 8px; padding: 12px 20px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.doc-group-head h3 { margin: 0; font-size: 13px; }
.doc-group-head .count { font-size: 11px; background: var(--surface); padding: 1px 7px; border-radius: 999px; color: var(--muted); }
.doc-drop-hint { margin: -6px 0 10px; }
.drop-over { outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: var(--radius); }

/* Document page header */
.doc-head { padding: 16px 20px; }
.doc-head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.doc-title-input { flex: 1 1 280px; min-width: 0; font: 600 22px var(--serif); border: 1px solid transparent; background: transparent; padding: 4px 8px; margin-left: -8px; border-radius: var(--radius-sm); color: var(--text); }
.doc-title-input:hover { border-color: var(--border); }
.doc-title-input:focus { border-color: var(--primary); background: var(--surface); outline: none; }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 20px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; }
.doc-meta-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.doc-project-select { width: 100%; }
.doc-status { font-weight: 600; color: var(--ok); }
.doc-status[data-state="saving"] { color: var(--muted); }
.doc-status[data-state="error"] { color: var(--danger); }
.doc-people { display: flex; align-items: center; gap: 4px; }
.doc-people .small { margin-right: 4px; }
.doc-person { border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.doc-person.editing { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #3ccf7a; }

/* Editor */
.doc-card { margin-top: 16px; overflow: hidden; }
.doc-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doc-body { display: grid; grid-template-columns: 1fr; min-height: 62vh; }
.doc-body[data-mode="split"] { grid-template-columns: 1fr 1fr; }
.doc-body[data-mode="write"] .doc-render { display: none; }
.doc-body[data-mode="preview"] .doc-editor { display: none; }
.doc-editor { width: 100%; min-height: 62vh; resize: vertical; border: 0; border-radius: 0; padding: 22px 26px; font: 15px/1.7 var(--font); background: var(--surface); color: var(--text); }
.doc-editor:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary-soft); }
.doc-render { padding: 22px 28px; overflow: auto; max-height: 80vh; }
.doc-body[data-mode="split"] .doc-render { border-left: 1px solid var(--border); background: var(--surface-2); }
.doc-preview iframe { display: block; width: 100%; height: 78vh; border: 0; border-radius: var(--radius); }
.doc-preview img { display: block; max-width: 100%; margin: 0 auto; border-radius: var(--radius); }
.doc-preview { margin-top: 16px; padding: 8px; }

/* Rendered Markdown */
.md { font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.md h2, .md h3, .md h4, .md h5 { font-family: var(--serif); margin: 1.2em 0 .4em; line-height: 1.3; }
.md h2 { font-size: 24px; } .md h3 { font-size: 19px; } .md h4 { font-size: 16px; } .md h5 { font-size: 15px; }
.md > :first-child { margin-top: 0; }
.md p, .md ul, .md ol, .md blockquote { margin: 0 0 .8em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li.md-task { list-style: none; margin-left: -1.2em; }
.md blockquote { border-left: 3px solid var(--border-strong); padding-left: 14px; color: var(--text-2); }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }

/* History */
.doc-hist { display: grid; grid-template-columns: 260px 1fr; gap: 16px; min-height: 340px; }
.doc-hist-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; border-right: 1px solid var(--border); }
.doc-hist-list li button { display: block; width: 100%; padding: 8px 10px; border-radius: 6px; }
.doc-hist-list li button.active { background: var(--primary-soft); }
.doc-hist-view { max-height: 60vh; overflow: auto; padding-right: 6px; }

@media (max-width: 900px) {
  .doc-body[data-mode="split"] { grid-template-columns: 1fr; }
  .doc-body[data-mode="split"] .doc-render { border-left: 0; border-top: 1px solid var(--border); }
  .doc-hist { grid-template-columns: 1fr; }
  .doc-hist-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 30vh; }
  .doc-hint { display: none; }
}
.doc-filters select { max-width: 280px; }
.doc-filters .seg { align-self: center; }

/* Sidebar logo */
.brand-logo { flex: none; width: 34px; height: 34px; }
.brand-lg .brand-logo { width: 44px; height: 44px; }

/* Website editor */
.site-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.site-row:last-child { border-bottom: 0; }
.site-row.is-hidden .site-row-title { color: var(--muted); }
.site-row-main { flex: 1; min-width: 0; }
.site-row-title { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.site-row-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-row-actions { display: flex; gap: 4px; flex: none; }
@media (max-width: 700px) { .site-row { flex-wrap: wrap; } }

/* Project stage bar and conferences */
.stagebar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.stagebar-step { display: flex; flex-direction: column; gap: 6px; }
.stagebar-seg { height: 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.stagebar-step.done .stagebar-seg { background: var(--primary); border-color: var(--primary); }
.stagebar-step.now .stagebar-seg { background: #c9a54c; border-color: #c9a54c; }
.stagebar-label { font-size: 11.5px; color: var(--muted); }
.stagebar-step.now .stagebar-label { color: var(--text); font-weight: 600; }
.stage-note { margin: 14px 0 0; }
.card-head-sub { border-top: 1px solid var(--border); }
.meet-list { list-style: none; margin: 0; padding: 0; }
.meet-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.meet-row:last-child { border-bottom: 0; }
.meet-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.meet-title { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meet-status { width: auto; font-size: 12.5px; padding: 4px 8px; }
@media (max-width: 700px) { .stagebar-label { font-size: 0; } .stagebar-step.now .stagebar-label { font-size: 11px; } }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }

/* Profile photos */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
