/* Project-specific Bootstrap 6 overrides go here. */
:root[data-bs-theme="dark"],
:host([data-bs-theme="dark"]) {
  --bs-bg-body: #020617;
  --bs-bg-1: #161A2ABF;
  --bs-bg-2: #161A2ABF;
  --bs-fg-body: #e7e9ee;

  --bs-border-color: rgba(255, 255, 255, 0.12);

  --bs-link-color: #8ab4ff;
  --bs-link-hover-color: #a7c4ff;
}

/* Bootstrap 6 sets `scrollbar-gutter: stable` on :root, which reserves an empty strip
   on the right of short pages that have no scrollbar. Restore the default. */
/* :root {
  scrollbar-gutter: auto;
} */

/* Tenant layout: fixed-height page, non-scrolling icon sidebar, scrolling content. */
.tenant-body {
  height: 100dvh;
  overflow: hidden;
}
.tenant-shell {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}
.tenant-sidebar {
  flex: 0 0 auto;
  width: 3.5rem;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  overflow: hidden;
  background-color: var(--bs-bg-1);
  border-right: 1px solid var(--bs-border-color);
}
.tenant-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.tenant-sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  font-size: 1.15rem;
  color: var(--bs-fg-2, inherit);
  text-decoration: none;
}
.tenant-sidebar-link:hover,
.tenant-sidebar-link:focus-visible {
  background-color: var(--bs-border-color);
  color: var(--bs-link-hover-color);
}
.tenant-sidebar-link.active {
  background-color: var(--bs-border-color);
  color: var(--bs-link-color);
}
/* A dot over the top right of an icon, when the list has unread recent activity (see public/js/sidebar-indicators.js) */
.tenant-sidebar-dot {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bs-primary-base);
  box-shadow: 0 0 0 2px var(--bs-body-bg);
  pointer-events: none;
}
.tenant-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.tenant-content > * { flex-shrink: 0; }

/* The page itself never scrolls here, so don't let Bootstrap's root `scrollbar-gutter: stable`
   reserve an empty strip beside the content area's own scrollbar. */
:root:has(.tenant-body) {
  scrollbar-gutter: auto;
  overflow: hidden;
}

/* A page header holding breadcrumb, title, subtitle and tabs: the breadcrumb's usual large bottom margin is too much here. */
.page-header .breadcrumb {
  margin-bottom: 1rem;
}

.tenant-sidebar-bottom {
  margin-top: auto;
}
/* Between the sidebar's groups: the workspace's views, then the lists of pages */
.tenant-sidebar-divider {
  flex: 0 0 auto;
  width: 1.75rem;
  margin: 0.5rem auto;
  border: 0;
  border-top: 1px solid var(--bs-border-color);
  opacity: 1;
}

/* Breathing room at the bottom of every page so any content can be scrolled to the middle of the screen. */
.page-breathing-room {
  min-height: 50dvh;
}

/* Node drilldown: the node's image with its sub-nodes as linked dots (relative 0..1 positions). */
.node-view { position: relative; display: block; width: fit-content; max-width: 100%; line-height: 0; }
.node-view > img { display: block; max-width: 100%; height: auto; max-height: 70vh; border-radius: .5rem; }
/* A node shown on its parent's image, zoomed in 2x: the hidden spacer keeps the parent image's size and shape, and the
   image over it is twice as big, moved so the node's point is in the middle. */
.node-view-zoom { overflow: hidden; border-radius: .5rem; }
.node-view-zoom > .node-view-zoom-spacer { visibility: hidden; }
.node-view-zoom > .node-view-zoom-image { position: absolute; left: 50%; top: 50%; width: 200%; max-width: none; height: auto; max-height: none; border-radius: 0; }
/* The menus choosing what the dots show, over the image's top-left corner. */
.node-view-options { position: absolute; left: .5rem; top: .5rem; z-index: 3; display: flex; flex-wrap: wrap; gap: .25rem; line-height: 1.5; }
.node-view-options .btn { background-color: var(--bs-bg-body); box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.node-dot { position: absolute; display: block; width: 0; height: 0; line-height: 1.3; text-decoration: none; }
/* Each sub-node is a small severity doughnut of its pages, with the number of pages it counts in its centre. No backing: a soft shadow
   lifts the ring off the image and a halo keeps the count legible over it. */
.node-dot-mark { position: absolute; left: 0; top: 0; display: flex; transform: translate(-50%, -50%); border-radius: 50%; }
.node-dot-mark .severity-doughnut { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.node-dot-mark .severity-doughnut-count { font-size: 44px; font-weight: 700; fill: #fff; stroke: rgba(0, 0, 0, .75); stroke-width: 10px; paint-order: stroke; }
.node-dot-mark::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; } /* a bigger target to hit */
.node-dot-name { position: absolute; left: 20px; top: 0; transform: translateY(-50%); z-index: 1; max-width: 14rem; padding: .1rem .5rem; border-radius: .35rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-size: .8rem; background: var(--bs-bg-body); color: var(--bs-fg-body); border: 1px solid var(--bs-border-color, #dee2e6);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3); opacity: 0; pointer-events: none; }
.node-dot:hover, .node-dot:focus-visible { z-index: 2; }
.node-dot:hover .node-dot-name, .node-dot:focus-visible .node-dot-name { opacity: 1; }
.node-dot:focus-visible .node-dot-mark { outline: 2px solid var(--bs-primary-base); outline-offset: 3px; }

/* Page types: one colour each so they stand out in lists. */
.page-type { color: #fff; font-weight: 500; }
.page-type-issue { background-color: #c0392b; }
.page-type-documentation { background-color: #2563eb; }
.page-type-uploaded-file { background-color: #7c3aed; }
.page-type-log { background-color: #4b5563; }
.page-type-investigation { background-color: #0f766e; }
/* A page's type as a large icon on its colour, at the left of a page table row */
.page-type-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: .4rem; font-size: 1.35rem; color: #fff; }

/* Page cards: summary clamped to two lines. */
.page-card-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.page-card { overflow: hidden; }
.page-card-severity { position: absolute; top: 0; bottom: 0; left: 0; width: 5px; }

/* Page view: the feed of events and comments. */
.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed-item { position: relative; display: flex; gap: .75rem; padding-bottom: 1rem; }
/* The line joining each entry's icon to the next */
.feed-item:not(:last-child)::before { content: ""; position: absolute; left: 1rem; top: 2rem; bottom: 0; width: 1px; background: var(--bs-border-color); }
.feed-icon { flex: 0 0 2rem; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  border: 1px solid var(--bs-border-color); background: var(--bs-bg-body); color: var(--bs-fg-3); font-size: .9rem; position: relative; z-index: 1; }
.feed-icon.is-danger { color: var(--bs-danger-fg); border-color: currentColor; }
.feed-icon.is-comment { background: var(--bs-primary-base); border-color: transparent; color: #fff; font-weight: 600; font-size: .8rem; }
.feed-event { flex: 1 1 auto; min-width: 0; display: flex; gap: 1rem; align-items: baseline; padding-top: .3rem; overflow-wrap: anywhere; }
.feed-event-text { flex: 1 1 auto; min-width: 0; }
.feed-time { flex: 0 0 auto; margin-left: auto; white-space: nowrap; font-size: .85rem; color: var(--bs-fg-3); opacity: .85; }
.feed-value { font-weight: 500; }
/* Copy-to-clipboard icon button beside a value (partials/copy-button.ejs) */
.btn-copy-value { display: inline-flex; align-items: center; margin-left: .3rem; padding: 0 .2rem; border: 0; border-radius: .25rem; background: none; color: var(--bs-secondary-color); font-size: .8em; line-height: 1; vertical-align: baseline; opacity: .55; }
.btn-copy-value:hover, .btn-copy-value:focus-visible { opacity: 1; color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
.feed-severity { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; vertical-align: baseline; }
.feed-severity-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; flex-shrink: 0; }
.feed-severity-dot.is-none { border: 1px solid var(--bs-border-color); }
.feed-comment { flex: 1 1 auto; min-width: 0; border: 1px solid var(--bs-border-color); border-radius: .5rem; }
.feed-comment-head { display: flex; gap: 1rem; align-items: baseline; padding: .4rem .75rem; background: var(--bs-bg-1); border-bottom: 1px solid var(--bs-border-color); border-radius: calc(.5rem - 1px) calc(.5rem - 1px) 0 0; }
.feed-comment-body { padding: .75rem; overflow-wrap: anywhere; }
.feed-comment-body > :last-child { margin-bottom: 0; }
.feed-reactions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: 0 .75rem .75rem; }
.feed-reaction { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border: 1px solid var(--bs-border-color); border-radius: 1rem; background: transparent; color: inherit; font-size: .85rem; line-height: 1.5; }
.feed-reaction:hover:not(:disabled) { background: var(--bs-bg-1); }
.feed-reaction.is-mine { border-color: var(--bs-primary-base); background: var(--bs-bg-1); }
.feed-reaction:disabled { opacity: .7; cursor: default; }
.feed-reaction-add { color: var(--bs-fg-3); }
.feed-reaction-picker { position: relative; }
.feed-reaction-menu { display: none; position: absolute; z-index: 10; top: 100%; left: 0; margin-top: .25rem; padding: .25rem; background: var(--bs-bg-body, #fff); border: 1px solid var(--bs-border-color); border-radius: .5rem; box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .15); }
.feed-reaction-menu.show { display: flex; gap: .25rem; }
.feed-reaction-menu .feed-reaction { border-color: transparent; font-size: 1.1rem; }
.feed-files { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 .75rem .75rem; }
.feed-file { display: inline-flex; align-items: center; gap: .4rem; max-width: 100%; padding: .25rem .5rem; border: 1px solid var(--bs-border-color); border-radius: .375rem; font-size: .85rem; text-decoration: none; }
.feed-file img { width: 2rem; height: 2rem; object-fit: cover; border-radius: .25rem; }
.feed-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page view: pinned files as a row of thumbnails. */
.pinned-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .75rem; }
.pinned-file { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; font-size: .85rem; }
.pinned-file-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border: 1px solid var(--bs-border-color); border-radius: .375rem; background: var(--bs-bg-1); overflow: hidden; font-size: 2rem; color: var(--bs-fg-3); }
.pinned-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pinned-file:hover .pinned-file-thumb, .pinned-file:focus-visible .pinned-file-thumb { border-color: var(--bs-primary-bg, currentColor); }
.pinned-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page view: the Uploads tab's thumbnail cards, upload drop zone and link search. */
.file-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1rem; }
.file-card { display: flex; flex-direction: column; border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow: hidden; background: var(--bs-bg-body, transparent); }
.file-card.is-pinned { border-color: var(--bs-primary-base); }
.file-card-thumb { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--bs-bg-1); font-size: 2.75rem; color: var(--bs-fg-3); text-decoration: none; }
.file-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card-pin { position: absolute; top: .4rem; right: .4rem; display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--bs-primary-base); color: #fff; font-size: .9rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.file-card-body { padding: .6rem .75rem; min-width: 0; flex: 1; }
.file-card-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; text-decoration: none; }
.file-card-actions { display: flex; gap: .5rem; padding: 0 .75rem .75rem; }
.file-card-actions [data-pin] { flex: 1; }
.file-drop { padding: 1.25rem; border: 2px dashed var(--bs-border-color); border-radius: .5rem; text-align: center; color: var(--bs-fg-3); }
.file-drop.is-over { border-color: var(--bs-primary-base); background: var(--bs-bg-1); }

/* Documents page: tiling cards, each with its first file's thumbnail; or table rows with a small one. */
.document-card { overflow: hidden; }
.document-card-footer { padding: .5rem 1rem; border-top: 1px solid var(--bs-border-color); }
.document-card-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--bs-bg-1); border-bottom: 1px solid var(--bs-border-color); font-size: 3rem; color: var(--bs-fg-3); text-decoration: none; overflow: hidden; }
.document-card-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; background: #fff; }
.document-card:hover .document-card-thumb img { opacity: .92; }
.document-row-thumb { display: flex; align-items: center; justify-content: center; width: 3.5rem; height: 2.65rem; border: 1px solid var(--bs-border-color); border-radius: .25rem; background: var(--bs-bg-1); overflow: hidden; font-size: 1.35rem; color: var(--bs-fg-3); text-decoration: none; }
.document-row-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; background: #fff; }
.document-file-link { display: inline-flex; align-items: center; min-width: 0; text-decoration: none; }
.document-file-link:hover .document-file-name { text-decoration: underline; }
.document-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem; }

/* Page text editor: Help me write's suggestion panel. */
.help-write { border: 1px solid var(--bs-border-color); border-radius: .375rem; padding: .75rem; background: var(--bs-bg-1); }

/* Page view: rendered markdown text. */
.page-text { overflow-wrap: anywhere; }
.page-text img { max-width: 100%; height: auto; }
.page-text pre { padding: .75rem; border-radius: .375rem; background: var(--bs-bg-1); overflow-x: auto; }
.page-text table { border-collapse: collapse; margin-bottom: 1rem; }
.page-text th, .page-text td { border: 1px solid var(--bs-border-color); padding: .25rem .5rem; }
.page-text blockquote { border-left: 3px solid var(--bs-border-color); padding-left: 1rem; color: var(--bs-fg-3); }

/* Page view: stages as a list of steps with the current one marked. */
.stage-list { list-style: none; margin: 0; padding: 0; }
.stage-list li { position: relative; display: flex; align-items: center; gap: .75rem; min-height: 2.5rem; color: var(--bs-fg-3); }
.stage-list li:not(:last-child)::after { content: ""; position: absolute; left: .6875rem; top: 1.75rem; bottom: -.25rem; width: 2px; margin-left: -1px; background: var(--bs-border-color, #dee2e6); }
.stage-list li.is-done:not(:last-child)::after { background: var(--bs-success-base); }
.stage-marker { flex: none; width: 1.375rem; height: 1.375rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 600; border: 2px solid var(--bs-border-color, #dee2e6); background: var(--bs-bg-body); position: relative; z-index: 1; }
.stage-list li.is-done { color: inherit; }
.stage-list li.is-done .stage-marker { background: var(--bs-success-base); border-color: var(--bs-success-base); color: #fff; }
.stage-list li.is-current { color: inherit; font-weight: 600; }
.stage-list li.is-current .stage-marker { border-color: var(--bs-primary-base); background: var(--bs-primary-base); color: #fff; box-shadow: 0 0 0 .2rem color-mix(in oklch, var(--bs-primary-base) 20%, transparent); }
.comment-chosen { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Tables: the current stage with a pip per stage (done, current, to come). */
.stage-pips { display: inline-flex; flex-wrap: wrap; gap: 3px; margin-top: .25rem; max-width: 9rem; }
.stage-pip { width: .875rem; height: .3125rem; border-radius: 999px; background: var(--bs-border-color, #dee2e6); }
.stage-pip.is-done,
.stage-pip.is-current { background: var(--bs-primary-base); }

/* Page form: month shortcuts above the Estimated time to failure picker, stage template cards, and card choices laid out in columns. */
.month-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .5rem; }
.month-card, .choice-card { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .5rem .75rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; background: transparent; color: inherit; text-align: left; line-height: 1.3; cursor: pointer; }
.month-card:hover, .choice-card:hover { background: var(--bs-bg-1); }
.month-card:focus-visible, .choice-card:focus-visible { outline: 2px solid var(--bs-primary-base); outline-offset: 2px; }
.month-card[aria-pressed="true"] { border-color: var(--bs-primary-base); box-shadow: inset 0 0 0 1px var(--bs-primary-base); background: color-mix(in oklch, var(--bs-primary-base) 12%, transparent); }
.month-card-name, .choice-card-name { font-weight: 600; }
.month-card-when, .choice-card-when { font-size: .85rem; color: var(--bs-fg-3); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem; }

/* Marks a page with changes the viewer hasn't read yet */
.unread-dot { background: var(--bs-primary-base); vertical-align: middle; }

/* Inbox: the list of pages on the left, the open page in a reading pane on the right. */
.tenant-content.inbox-content { overflow: hidden; }
.tenant-content > .inbox { flex: 1 1 0; min-height: 0; display: flex; }
.inbox-list { flex: 0 0 24rem; max-width: 24rem; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--bs-border-color); overflow-y: auto; }
.inbox-list-header { position: sticky; top: 0; z-index: 2; padding: 1rem; border-bottom: 1px solid var(--bs-border-color); }
.inbox-items { list-style: none; margin: 0; padding: 0; }
.inbox-item { position: relative; display: block; padding: .75rem 1rem .75rem 1.25rem; border-bottom: 1px solid var(--bs-border-color); color: inherit; text-decoration: none; }
.inbox-item:hover, .inbox-item:focus-visible { background: var(--bs-bg-1); color: inherit; }
.inbox-item.active { background: var(--bs-border-color); }
.inbox-item.active::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 3px; background: var(--bs-primary-base); }
.inbox-item-severity { position: absolute; top: 0; bottom: 0; left: 0; width: 4px; }
.inbox-item-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.inbox-item.is-unread .inbox-item-name { font-weight: 700; }
.inbox-item-time { flex: 0 0 auto; font-size: .75rem; color: var(--bs-fg-3); white-space: nowrap; }
.inbox-item.is-unread .inbox-item-time { color: var(--bs-primary-base); font-weight: 600; }
.inbox-item-summary { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin-top: .25rem; }
.inbox-pagination { display: flex; justify-content: center; align-items: center; gap: .75rem; padding: .75rem; margin-top: auto; }
.inbox-reader { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.inbox-reader-toolbar { display: flex; align-items: center; padding: .25rem .5rem; border-bottom: 1px solid var(--bs-border-color); }
.inbox-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: 0; display: block; }
.inbox-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.inbox:not(.has-selection) .inbox-reader-toolbar,
.inbox:not(.has-selection) .inbox-frame { display: none; }
.inbox.has-selection .inbox-empty { display: none; }
.inbox-back { display: none; }
/* Small screens: the list or the open page, not both */
@media (max-width: 767.98px) {
  .inbox-list { flex: 1 1 auto; max-width: none; border-right: 0; }
  .inbox.has-selection .inbox-list { display: none; }
  .inbox:not(.has-selection) .inbox-reader { display: none; }
  .inbox-back { display: inline-block; }
}

/* Main top nav: a thinner bar than Bootstrap's default (~60px down to ~42px). */
.main-nav {
  --bs-navbar-padding-y: 0.25rem;
  --bs-navbar-min-height: 2.5rem;
  --bs-navbar-brand-padding-y: 0;
}
.main-nav .navbar-nav { --bs-nav-link-padding-y: 0.25rem; }

/* A page shown inside the Inbox's reading pane: no app chrome of its own (set in head.ejs). */
.is-embedded .tenant-body > .navbar,
.is-embedded .tenant-sidebar,
.is-embedded .tenant-content > footer,
.is-embedded .page-breathing-room,
.is-embedded .page-header .breadcrumb { display: none; }

/* Node cards: description clamped to two lines, and a severity doughnut of the node's active pages. */
.nav-card-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.severity-doughnut { flex-shrink: 0; }
/* Overlaid on the card's image, top right, on a backing disc so it reads over any picture. */
.nav-card-doughnut { position: absolute; top: .5rem; right: .5rem; display: flex; padding: 3px; border-radius: 50%;
  background: color-mix(in oklch, var(--bs-bg-body) 85%, transparent); box-shadow: var(--bs-box-shadow-sm); backdrop-filter: blur(4px); }
.severity-doughnut-count { font-size: 30px; font-weight: 600; fill: var(--bs-fg-body); }
.severity-doughnut-count.is-zero { fill: var(--bs-fg-3); font-weight: 400; }

/* A node card with no image of its own shows its parent's image zoomed in 2x around where the node sits on it */
.nav-card-zoom {
  position: relative;
  overflow: hidden;
}
.nav-card-zoom img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200%;
  height: auto;
  max-width: none;
}

/* Issues page: metadata values as tags (the key is shown on hover), and sortable column headers */
.meta-tag { display: inline-block; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .05rem .5rem; border: 1px solid var(--bs-border-color); border-radius: 999px; font-size: .8rem; line-height: 1.5; background: var(--bs-bg-1); cursor: default; }
/* A tag that filters its table by it, and a chosen one (which removes it) */
a.meta-tag { color: inherit; text-decoration: none; cursor: pointer; }
a.meta-tag:hover, a.meta-tag:focus-visible { border-color: currentColor; text-decoration: underline; }
.meta-tag-active { max-width: 20rem; background: var(--bs-bg-2); }
/* The "+N more" after a row's first few tags: a link to the page, not a filter */
a.meta-tag-more { border-style: dashed; color: var(--bs-fg-3, inherit); }
/* A site among a row's tags: tinted with the primary colour and led by a location pin, so it stands apart from metadata */
.meta-tag.site-tag { border-color: color-mix(in oklch, var(--bs-primary-base) 45%, transparent); background: color-mix(in oklch, var(--bs-primary-base) 12%, transparent); font-weight: 500; }
.site-tag .bi { margin-right: .25rem; color: var(--bs-primary-base); }
/* A prominent metadata key's value (MetadataDisplayMode.PROMINENT): bolder, with a stronger border, so it is seen first */
.meta-tag.meta-tag-prominent { font-weight: 600; border-color: currentColor; background: var(--bs-bg-2); }
/* A metadata key's display mode, as a small label in System Management */
.meta-mode-badge { display: inline-block; padding: 0 .4rem; border: 1px solid var(--bs-border-color); border-radius: .25rem; font-size: .75rem; line-height: 1.5; }
.meta-mode-badge.meta-mode-prominent { font-weight: 600; border-color: var(--bs-primary-base); color: var(--bs-primary-base); }
.meta-mode-badge.meta-mode-collapsed { border-style: dashed; }
.meta-mode-badge.meta-mode-hidden { color: var(--bs-fg-3, inherit); border-style: dotted; }
/* The box shown when a listing is empty: the message, then the filters that emptied it, stacked and centred */
.no-results { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 3rem 1.5rem; text-align: center; border: 1px dashed var(--bs-border-color); border-radius: .5rem; }
.no-results-icon { font-size: 2rem; line-height: 1; opacity: .6; }
.no-results-message { margin: 0; font-size: 1.125rem; }
.no-results-filters { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem; max-width: 40rem; }
.no-results-compact { padding: 2rem 1rem; gap: .5rem; border: 0; }
.no-results-compact .no-results-icon { font-size: 1.5rem; }
.no-results-compact .no-results-message { font-size: .875rem; }
.page-table th a { color: inherit; text-decoration: none; white-space: nowrap; }
.page-table th a:hover { text-decoration: underline; }
/* The name cell is a stretched link: show it is clickable anywhere in the cell */
.page-table-name:hover a.stretched-link { text-decoration: underline !important; }
/* The severity dot sits top-right of its cell, beside the first line of the page's title in the next column */
.page-table .page-table-severity { vertical-align: top; text-align: right; padding-right: 0; line-height: 1.5; }
.page-table-severity > span { vertical-align: middle; }

/* Agent page: conversations on the left, the chat on the right (like the Inbox), the composer pinned at the bottom. */
.tenant-content.agent-content { overflow: hidden; }
.tenant-content > .agent { flex: 1 1 0; min-height: 0; display: flex; }
.agent-sidebar { flex: 0 0 18rem; max-width: 18rem; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--bs-border-color); overflow-y: auto; }
.agent-sidebar-header { position: sticky; top: 0; z-index: 2; padding: 1rem; border-bottom: 1px solid var(--bs-border-color); background: var(--bs-bg-body); }
.agent-conversations { list-style: none; margin: 0; padding: 0; }
.agent-conversation { position: relative; display: block; padding: .6rem 1rem; border-bottom: 1px solid var(--bs-border-color); color: inherit; text-decoration: none; }
.agent-conversation:hover, .agent-conversation:focus-visible { background: var(--bs-bg-1); color: inherit; }
.agent-conversation.active { background: var(--bs-border-color); }
.agent-conversation.active::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 3px; background: var(--bs-primary-base); }
.agent-conversation-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.agent-chat { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.agent-chat-toolbar { display: flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border-bottom: 1px solid var(--bs-border-color); }
.agent-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1.5rem 1rem; }
.agent-thread-inner { max-width: 52rem; margin: 0 auto; }
.agent-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 100%; color: var(--bs-fg-3); }
.agent-message { display: flex; gap: .75rem; margin-bottom: 1.25rem; }
.agent-message.is-user { justify-content: flex-end; }
.agent-bubble { max-width: 85%; min-width: 0; padding: .6rem .9rem; border-radius: .75rem; overflow-wrap: anywhere; }
.agent-message.is-user .agent-bubble { background: var(--bs-primary-base); color: #fff; white-space: pre-wrap; border-bottom-right-radius: .25rem; }
.agent-message.is-assistant .agent-bubble { flex: 1 1 auto; border: 1px solid var(--bs-border-color); border-bottom-left-radius: .25rem; }
.agent-avatar { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bs-bg-1); border: 1px solid var(--bs-border-color); color: var(--bs-fg-2); }
.agent-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .85rem; color: var(--bs-fg-3); }
.agent-status .bi-arrow-repeat { display: inline-block; animation: agent-spin 1s linear infinite; }
@keyframes agent-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .agent-status .bi-arrow-repeat { animation: none; } }
.agent-markdown > :last-child { margin-bottom: 0; }
.agent-markdown pre { white-space: pre-wrap; }
.agent-markdown table { border-collapse: collapse; margin-bottom: 1rem; }
.agent-markdown th, .agent-markdown td { border: 1px solid var(--bs-border-color); padding: .25rem .5rem; }
.agent-tools-wrap { margin: .5rem 0; }
.agent-tools-wrap > summary { cursor: pointer; font-size: .85rem; color: var(--bs-fg-3); }
.agent-tools { display: flex; flex-direction: column; gap: .25rem; margin-top: .5rem; }
.agent-tool { border: 1px solid var(--bs-border-color); border-radius: .375rem; }
.agent-tool.is-error { border-color: color-mix(in oklch, var(--bs-danger-base, #dc3545) 50%, transparent); }
.agent-tool > summary { display: flex; align-items: center; gap: .5rem; padding: .3rem .6rem; cursor: pointer; font-size: .85rem; list-style: none; }
.agent-tool > summary::-webkit-details-marker { display: none; }
.agent-tool[open] > summary { border-bottom: 1px solid var(--bs-border-color); }
.agent-tool-body { padding: .5rem .6rem; }
.agent-tool-json { max-height: 18rem; overflow: auto; margin-bottom: .5rem; padding: .5rem; font-size: .75rem; background: var(--bs-bg-1); border-radius: .25rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-composer { border-top: 1px solid var(--bs-border-color); padding: .75rem 1rem; }
.agent-composer-inner { max-width: 52rem; margin: 0 auto; }
.agent-composer textarea { resize: vertical; min-height: 3rem; max-height: 40vh; }
.agent-back { display: none; }
@media (max-width: 767.98px) {
  .agent-sidebar { display: none; }
  .agent-back { display: inline-block; }
  /* With no conversation open, the conversation list sits above the new-chat composer */
  .agent.is-home { flex-direction: column; }
  .agent.is-home .agent-sidebar { display: flex; flex: 0 1 auto; max-height: 40%; max-width: none; border-right: 0; border-bottom: 1px solid var(--bs-border-color); }
}

/* Changes made by an in-app agent, in a page's activity feed */
.feed-icon.is-agent { background: var(--bs-bg-1); color: var(--bs-primary-base); border-color: var(--bs-primary-base); }
.agent-badge { display: inline-flex; align-items: center; gap: .2rem; margin-left: .25rem; padding: 0 .35rem; border-radius: .25rem; font-size: .7rem; font-weight: 600; vertical-align: .1em; color: var(--bs-primary-base); border: 1px solid currentColor; }

/* Drag-and-drop reordering (public/js/drag-reorder.js): the grab handle at the left of each item, and the item being dragged */
.reorder-handle { cursor: grab; touch-action: none; color: var(--bs-fg-3, inherit); }
.reorder-handle-cell { width: 1%; }
.is-reordering, .is-reordering * { cursor: grabbing !important; user-select: none; }
[data-reorder-item].is-dragging, [data-column].is-dragging { opacity: 0.6; background: var(--bs-bg-2, rgba(0, 0, 0, 0.05)); }

/* Linked pages (the page view's sidebar): one related page per row, and the search that links another. */
.linked-page + .linked-page { border-top: 1px solid var(--bs-border-color, #dee2e6); margin-top: .6rem; padding-top: .6rem; }
.link-page-results { max-height: 18rem; overflow-y: auto; }
.link-page-results .list-group-item { cursor: pointer; }

/* Overview: the activity across pages, each entry under the page it happened on (partials/activity-feed-items.ejs) */
.activity-entry { flex: 1 1 auto; min-width: 0; padding-top: .3rem; }
.activity-entry .feed-event { padding-top: .15rem; }
.activity-page { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.activity-page .badge { flex-shrink: 0; }
/* A long comment is cut short and faded out: the whole of it is on the page */
.activity-comment { max-height: 4.5rem; overflow: hidden; margin-top: .25rem; mask-image: linear-gradient(to bottom, #000 3rem, transparent 4.5rem); }
.activity-comment > :last-child { margin-bottom: 0; }
