/* ══════════════════════════════════════════════════════════════════════
   DASHBOARD VIEW
══════════════════════════════════════════════════════════════════════ */

.view-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 60px - 40px); /* header + footer */
}

.dash-toolbar {
  background: var(--wh);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--vb);
  padding: 9px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.dash-toolbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--accent);
  padding: 5px 11px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  background: none;
  transition: background .1s, border-color .1s;
  font-family: inherit;
}
.back-btn:hover {
  background: var(--wash-blue);
  border-color: var(--accent);
  text-decoration: none;
}

.dash-toolbar__title {
  font-family: "Gill Sans", "Gill Sans MT", Calibri, Arial, sans-serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--heading);
}

.dash-toolbar__meta {
  font-size: .74rem;
  color: var(--st);
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--fg);
}

.dash-iframe-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
}

.dash-iframe {
  width: 100%;
  border: none;
  display: block;
  flex: 1;
}

/* Download toolbar button */
.toolbar-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--st);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s, color .1s, border-color .1s;
  white-space: nowrap;
  text-decoration: none;
}
.toolbar-download-btn:hover { background: var(--bg); color: var(--heading); border-color: var(--muted); }
.toolbar-download-btn.is-busy {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
}

/* ── Notes / Comments panel ──────────────────────────────────────────── */
.notes-panel {
  position: fixed;
  top: 63px;   /* below accent bar (3px) + header (60px) */
  right: 0;
  bottom: 0;
  width: 360px;
  background: var(--wh);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,113,175,.08);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.notes-panel.open { transform: translateX(0); }

.notes-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--vb);
  flex-shrink: 0;
}
.notes-panel__title {
  font-family: "Gill Sans", "Gill Sans MT", Calibri, Arial, sans-serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 7px;
}
.notes-count-badge {
  background: var(--vb);
  color: var(--on-brand);
  border-radius: 100px;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 7px;
}
.notes-panel__close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--st);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .1s;
}
.notes-panel__close:hover { background: var(--bg); color: var(--heading); }

/* Comment feed */
.notes-feed {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.notes-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
  padding: 40px 20px;
  gap: 8px;
}
.notes-empty__icon { font-size: 2rem; }

.comment-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 13px 9px;
  position: relative;
}
.comment-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.comment-card__author {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
}
.comment-card__time {
  font-size: .68rem;
  color: var(--muted);
}
.comment-card__text {
  font-size: .84rem;
  color: var(--gr);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Anchored note — the quoted passage the note was attached to. Same treatment
   as the editor rail (.pi-ed-note__excerpt in css/editor.css) so a note reads
   identically inside and outside edit mode. */
.comment-card--anchored { border-left: 3px solid var(--su); }
.comment-card__excerpt {
  font-size: .74rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 6px;
  word-break: break-word;
}
/* "Remove" — rendered on the reader's OWN notes only (js/viewer.js#render-
   NotesFeed), matching the editor rail's control (.pi-ed-note__del in
   css/editor.css) so a note reads and behaves the same inside and outside edit
   mode. Always visible: it previously faded in on card hover, which hid the only
   way to remove a note until the pointer arrived and left no way at all on touch. */
.comment-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 7px;
}
.comment-card__del {
  font-family: inherit;
  font-size: .7rem;
  color: var(--danger);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
}
.comment-card__del:hover { text-decoration: underline; background: var(--danger-tint); }
.comment-card__del:focus-visible { outline: 2px solid var(--danger); outline-offset: 1px; }

/* Compose area */
.notes-compose {
  border-top: 1px solid var(--border);
  padding: 12px 18px 14px;
  flex-shrink: 0;
  background: var(--wh);
}
.notes-compose__text {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--fg);
  border-radius: 5px;
  font-size: .84rem;
  font-family: inherit;
  color: var(--gr);
  resize: none;
  height: 80px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  margin-bottom: 8px;
}
.notes-compose__text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,113,175,.1);
}
.notes-compose__row {
  display: flex;
  justify-content: flex-end;
}
.btn-note-submit {
  padding: 7px 18px;
  background: var(--vb);
  color: var(--on-brand);
  border: none;
  border-radius: 5px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.btn-note-submit:hover { background: var(--accent-strong); }
.btn-note-submit:disabled { background: var(--fg); cursor: not-allowed; }

/* Notes toolbar button */
.toolbar-notes-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--st);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s, color .1s, border-color .1s;
  white-space: nowrap;
}
.toolbar-notes-btn:hover { background: var(--bg); color: var(--heading); border-color: var(--muted); }
.toolbar-notes-btn.active { color: var(--accent); border-color: var(--accent); background: var(--chip); }

/* ══════════════════════════════════════════════════════════════════════
   TM-9962 — In-app document viewer overlay (bundle documents)
══════════════════════════════════════════════════════════════════════ */
.doc-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 33, 46, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
}
.doc-viewer {
  background: var(--wh);
  border-radius: 8px;
  width: 100%;
  max-width: 1100px;
  height: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .3);
}
.doc-viewer__bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--wh);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--vb);
}
.doc-viewer__title {
  font-weight: 700;
  color: var(--heading);
  font-size: .95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-viewer__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.doc-viewer__download {
  font-size: .82rem;
  color: var(--accent);
  text-decoration: none;
  padding: 5px 11px;
  border: 1px solid var(--vb);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}
.doc-viewer__download:hover { background: var(--chip); }
.doc-viewer__close {
  border: none;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--st);
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
}
.doc-viewer__close:hover { background: var(--bg); color: var(--heading); }
.doc-viewer__body {
  flex: 1;
  min-height: 0;
  background: var(--wash);
  overflow: auto;
}
.doc-viewer__frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.doc-viewer__text {
  margin: 0;
  padding: 20px 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--heading);
  white-space: pre-wrap;
  word-break: break-word;
}
.doc-viewer__status {
  padding: 32px;
  text-align: center;
  color: var(--st);
  font-size: .9rem;
}
.doc-viewer__status--error { color: var(--or); }
.doc-viewer__fallback {
  padding: 48px 32px;
  text-align: center;
  color: var(--st);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.doc-viewer__fallback-icon { font-size: 2.4rem; }
.doc-viewer__fallback-title { font-size: 1rem; font-weight: 700; color: var(--heading); }
.doc-viewer__fallback-sub { font-size: .84rem; max-width: 420px; line-height: 1.5; }
.doc-viewer__fallback-btn { margin-top: 8px; text-decoration: none; }

/* TM-9962 — Office documents (xlsx / docx / pptx) rendered in the portal from
   their own bytes (js/office-preview.js) when Office Online isn't reachable. */
.office-doc {
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: var(--text);
  font-size: .84rem;
}
.office-doc__sheet,
.office-doc__slide,
.office-doc__page {
  background: var(--wh);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  overflow-x: auto;
}
.office-doc__sheet-name,
.office-doc__slide-num {
  margin: 0 0 12px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
}
.office-doc__table {
  border-collapse: collapse;
  width: 100%;
  font-size: .8rem;
}
.office-doc__table td {
  border: 1px solid var(--border);
  padding: 5px 9px;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 340px;
}
.office-doc__table tr:first-child td { font-weight: 700; color: var(--heading); background: var(--wash); }
.office-doc__table tr:nth-child(even) td { background: var(--wash); }
.office-doc__heading {
  margin: 18px 0 6px;
  font-size: .95rem;
  color: var(--heading);
}
.office-doc__para {
  margin: 0 0 8px;
  line-height: 1.55;
  word-break: break-word;
}
.office-doc__note {
  margin-top: 10px;
  font-size: .78rem;
  font-style: italic;
  color: var(--muted);
}

@media (max-width: 768px) {
  .doc-viewer-overlay { padding: 0; }
  .doc-viewer { max-height: 100vh; border-radius: 0; }
}
