/* Companion client (/companion/) — one flex shell that fills the viewport. */

html.companion-pending #account-view-stash,
html.companion-pending #header-actions-editor,
html.companion-pending #settings-panel,
html.companion-pending #group-view-main,
html.companion-pending #search-button,
html.companion-pending #scrapbook-button,
html.companion-pending #home-button,
html.companion-pending .nav-back-slot,
html.companion-pending #header-messages-btn,
html.companion-pending #user-menu {
  display: none !important;
}

body.companion-mode #account-view-stash,
body.companion-mode #header-actions-editor,
body.companion-mode #settings-panel,
body.companion-mode:not(.companion-reader) #group-view-main,
body.companion-mode #search-button,
body.companion-mode #scrapbook-button,
body.companion-mode #header-messages-btn,
body.companion-mode #user-menu {
  display: none !important;
}

body.companion-mode,
html:has(body.companion-mode) {
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

body.companion-mode {
  display: flex;
  flex-direction: column;
}

body.companion-mode .app-header {
  flex: 0 0 auto;
  box-shadow: none;
}

body.companion-mode #app-root {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.companion-mode.companion-reader #group-view-main {
  display: block !important;
}

body.companion-mode.companion-reader .companion-shell {
  display: none;
}

body.companion-mode .app-title {
  letter-spacing: 0.04em;
}

.companion-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.companion-shell__actions {
  flex: 0 0 auto;
  min-height: 44px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px;
}

.companion-shell__actions[hidden] {
  display: none !important;
}

.companion-shell__actions .screen-head__actions {
  margin: 0;
}

.companion-shell__body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.companion-shell__body.has-list {
  grid-template-columns: minmax(12rem, 17.5rem) minmax(0, 1fr);
}

.companion-shell__list {
  border-right: 1px solid var(--hairline);
  padding: 16px;
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.companion-shell__list .asset-grid {
  display: contents;
}

.companion-shell__list .asset-card--selected .asset-card__media-wrap {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.companion-shell__detail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.companion-shell__detail.project-main {
  height: auto;
}

body.companion-mode #header-actions-view {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.companion-shell__detail--plot,
.companion-shell__detail--document.companion-shell__detail--plot {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.companion-plot-workspace,
body.companion-mode .companion-plot-workspace.project-workspace,
body.companion-mode .companion-shell__detail--plot .project-workspace {
  height: 100%;
  min-height: 0;
  width: 100%;
}

body.companion-mode .companion-shell__detail--plot .project-workspace .panel--right.plot-panel {
  right: 0;
}

body.companion-mode .panel--right {
  box-shadow: none;
}

.companion-note {
  max-width: 720px;
}

.companion-shell__detail:has(.analysis-view),
.companion-shell__detail:has(.plot-grid-screen) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.companion-shell__detail:has(.analysis-view) .project-main__inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
}

.companion-shell__placeholder {
  margin: 0;
  color: var(--text-faint);
  font-size: 14px;
}

.companion-shell__pick {
  appearance: none;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.companion-shell__pick.is-selected {
  border-color: var(--accent);
}

.companion-shell__detail .library.scrapbook {
  margin: 0;
}

.companion-page-head {
  margin-bottom: 20px;
}

.companion-page-head h1 {
  margin: 0;
  font-size: 1.5rem;
}

.companion-page-head__sub {
  margin: 6px 0 0;
  color: var(--text-faint);
  font-size: 14px;
}

.companion-card-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
}

button.companion-work-card,
button.companion-applet-card {
  appearance: none;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.companion-applet-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border: 1px solid var(--hairline) !important;
  border-radius: 12px;
  background: var(--raised-bg, transparent) !important;
  min-height: 7.5rem;
  justify-content: center;
}

.companion-applet-card:hover,
.companion-applet-card:focus-visible {
  border-color: var(--accent) !important;
}

.companion-applet-card__icon {
  display: inline-flex;
  color: var(--text-dim);
}

.companion-applet-card__label {
  font-size: 15px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .companion-shell__body.has-list {
    grid-template-columns: 1fr;
  }

  .companion-shell__list {
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }

  .companion-shell__body.has-list.is-sheet .companion-shell__list {
    display: none;
  }

  .companion-shell__body.has-list:not(.is-sheet) .companion-shell__detail {
    display: none;
  }
}

@media (max-width: 1180px) {
  body.companion-mode .panel--right {
    box-shadow: none;
  }
}
