.page.cr-page {
  flex: 1 1 auto !important;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}
.cr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cr-header-lead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cr-header-lead h1 { margin: 0; }
.cr-fs-logo {
  display: none;
  flex: 0 0 auto;
}
.cr-fs-logo img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.cr-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cr-header-actions .btn[hidden] {
  display: none !important;
}
.cr-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, var(--border, #d8d4cf));
  background: var(--bg);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.cr-expand-btn:hover,
.cr-expand-btn:focus-visible {
  background: var(--surface, var(--bg));
  color: var(--ink);
  border-color: var(--brand-on-surface, var(--brand1, #ff6a3d));
}
.cr-expand-btn svg {
  flex: 0 0 auto;
}
.cr-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 12px;
}
.cr-rail,
.cr-center,
.cr-preview {
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--line, var(--border, #d8d4cf));
  border-radius: 10px;
  background: var(--surface, var(--bg));
}
.cr-rail {
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.cr-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0 0 8px;
}
.cr-rail-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.cr-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line, var(--border, #d8d4cf));
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.cr-add:hover,
.cr-add:focus-visible {
  background: color-mix(in srgb, var(--accent, #ff6a3d) 12%, var(--bg));
}
#crRail { flex: 1 1 auto; min-height: 0; overflow: auto; }
.cr-add-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--line, var(--border, #d8d4cf));
  border-radius: 10px;
  background: var(--surface, var(--bg));
  color: var(--ink);
}
.cr-add-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 35%, transparent);
}
.cr-add-dialog h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.cr-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.cr-center {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
  text-align: left;
}
.cr-center.bv-main.bv-main--chat {
  width: 100% !important;
  max-width: none;
}
.cr-thread {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cr-thread .bv-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.cr-thread .bv-composer {
  flex: 0 0 auto;
}
.cr-room-head {
  flex: 0 0 auto;
  padding: 2px 2px 10px;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line, var(--border, #d8d4cf));
}
.cr-room-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-align: left;
}
.cr-section {
  margin: 0 0 12px;
}
.cr-section-title {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.cr-room {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.cr-room.is-on,
.cr-room:hover {
  background: color-mix(in srgb, var(--accent, #ff6a3d) 12%, var(--bg));
}
.cr-preview {
  display: none;
  flex-direction: column;
  padding: 10px;
}
.cr-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cr-preview-head h2 {
  margin: 0;
  font-size: 0.95rem;
}
.cr-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cr-preview-body img,
.cr-preview-body video,
.cr-preview-body iframe {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 240px;
  height: 100%;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 4%, var(--bg));
}
.cr-preview-body a { color: var(--accent, #ff6a3d); word-break: break-all; }
.cr-preview-open { margin: 0 0 8px; }

body.cr-expand {
  box-sizing: border-box;
  height: 100dvh;
  overflow: hidden;
  border-top: 4px solid var(--brand-color-primary, #ff4d6d);
}
body.cr-expand .cr-fs-logo { display: block; }
body.cr-expand #main-menu-placeholder,
body.cr-expand #sub-menu-placeholder,
body.cr-expand .editor-context-shell,
body.cr-expand .hea-footer,
body.cr-expand #hea-footer-placeholder,
body.cr-expand .cr-page > .office-lede {
  display: none !important;
}
body.cr-expand .page.cr-page {
  max-width: none !important;
  width: 100% !important;
  margin-inline: 0 !important;
  height: 100dvh;
  padding: 8px 12px !important;
}
body.cr-expand .cr-layout {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
}
body.cr-expand:not(.cr-preview-off) .cr-layout {
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr) minmax(280px, 38vw);
}
body.cr-expand:not(.cr-preview-off) .cr-preview {
  display: flex;
}

@media (max-width: 900px) {
  .cr-layout,
  body.cr-expand .cr-layout,
  body.cr-expand:not(.cr-preview-off) .cr-layout {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
  }
  body.cr-expand .cr-layout,
  body.cr-expand:not(.cr-preview-off) .cr-layout {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .cr-rail {
    flex: 0 0 auto;
    overflow: hidden;
    padding: 8px;
  }
  .cr-rail-head { margin-bottom: 6px; }
  #crRail {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cr-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin: 0;
    flex: 0 0 auto;
  }
  .cr-section-title {
    margin: 0;
    white-space: nowrap;
  }
  .cr-room {
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--line, var(--border, #d8d4cf));
    white-space: nowrap;
    touch-action: manipulation;
  }
  .cr-center {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .cr-preview {
    flex: 1 1 auto;
    min-height: 0;
  }
}

html[data-theme="dark"] .cr-room.is-on,
html[data-theme="dark"] .cr-room:hover {
  background: color-mix(in srgb, var(--accent, #ff6a3d) 18%, var(--bg));
}
