/* Beta side drawers */
.page {
  width: min(1760px, 100%);
  max-width: none;
}

#main-section.card {
  padding-left: 18px;
  padding-right: 18px;
}

.workspace-shell {
  display: block;
}

.workspace-left {
  width: 100%;
}

.workspace-side-panel {
  position: fixed;
  top: 16px;
  bottom: 16px;
  z-index: 80;
  width: min(390px, calc(100vw - 58px));
  max-height: none;
  overflow: auto;
  padding: 0;
  transition: transform .24s ease, box-shadow .24s ease;
  pointer-events: auto;
}

.workspace-preview-drawer {
  left: 0;
  transform: translateX(calc(-100% - 18px));
}

.workspace-history-drawer {
  right: 0;
  top: 70px;
  width: min(520px, calc(100vw - 58px));
  transform: translateX(calc(100% + 18px));
}

body.preview-drawer-open .workspace-preview-drawer {
  transform: translateX(14px);
  box-shadow: 18px 0 38px rgba(18, 35, 63, .16);
}

body.history-drawer-open .workspace-history-drawer {
  transform: translateX(-14px);
  box-shadow: -18px 0 38px rgba(18, 35, 63, .16);
}

.side-drawer-toggle {
  position: fixed;
  top: 50%;
  z-index: 95;
  min-width: 42px;
  min-height: 92px;
  padding: 12px 8px;
  border: 1px solid #cfe0f7;
  background: #ffffff;
  color: #1f5fc8;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(31, 42, 68, .16);
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  letter-spacing: 0;
}

.side-drawer-toggle-left {
  left: 0;
  border-radius: 0 18px 18px 0;
}

.side-drawer-toggle-right {
  right: 0;
  border-radius: 18px 0 0 18px;
}

.side-drawer-toggle:hover,
.side-drawer-toggle:focus-visible {
  background: #eaf2ff;
}

.workspace-preview-panel {
  position: fixed;
  display: grid;
  gap: 12px;
}

.workspace-preview-panel .preview-card,
.workspace-preview-panel .preview-details-card,
.history-drawer-card {
  border: 1px solid #d8e3f2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(31, 42, 68, .08);
}

.preview-collapse-toggle {
  justify-self: stretch;
}

.history-drawer-card {
  height: 100%;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.history-drawer-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-drawer-head h2 {
  margin: 0;
}

.history-drawer-close {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 8px;
}

.history-type-filter-rail {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.history-type-filter-rail button {
  min-height: 42px;
  padding: 8px 6px;
  border: 1px solid #d8e6f8;
  border-radius: 8px;
  background: #f7fbff;
  color: #24476f;
  font-weight: 800;
  text-align: center;
}

.history-type-filter-rail button span {
  display: block;
  margin-top: 3px;
  color: #65748b;
  font-size: 12px;
  font-weight: 700;
}

.history-type-filter-rail button.active {
  border-color: #1f6feb;
  background: #eaf2ff;
  color: #0c4fb7;
}

.history-drawer-list {
  min-width: 0;
  overflow: auto;
  padding-right: 3px;
}

.workspace-history-drawer .history-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.workspace-history-drawer .history-tools label {
  min-width: 0;
}

.workspace-history-drawer .recent-records {
  display: grid;
  gap: 12px;
}

.workspace-history-drawer .recent-card {
  padding: 10px;
}

.workspace-history-drawer .recent-head {
  grid-template-columns: 1fr;
  gap: 4px;
}

.workspace-history-drawer .output-dir {
  display: none;
}

.workspace-history-drawer .history-record-details {
  grid-template-columns: 1fr;
}

.workspace-history-drawer .thumb-list {
  grid-template-columns: 1fr;
}

.workspace-history-drawer .recent-image-card {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.workspace-history-drawer .recent-image-card .image-preview {
  grid-row: span 3;
  width: 126px;
}

.workspace-history-drawer .recent-image-card img {
  width: 126px;
  height: 126px;
  object-fit: contain;
}

.workspace-history-drawer .recent-image-card > span {
  min-width: 0;
  word-break: break-all;
}

.workspace-history-drawer .recent-image-card .actions {
  justify-content: flex-start;
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(236px, 280px);
  gap: 12px;
  align-items: start;
}

.workspace-left {
  min-width: 0;
}

.workspace-history-drawer {
  position: sticky;
  top: 12px;
  right: auto;
  bottom: auto;
  width: auto;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  padding: 0;
  transform: none;
  z-index: 2;
}

body.history-drawer-open .workspace-history-drawer {
  transform: none;
  box-shadow: none;
}

.side-drawer-toggle-right,
.history-drawer-close {
  display: none;
}

.workspace-history-drawer .history-drawer-card {
  height: auto;
  max-height: calc(100vh - 24px);
  grid-template-columns: 68px minmax(0, 1fr);
  padding: 8px;
  box-shadow: 0 14px 34px rgba(31, 42, 68, .08);
}

.workspace-history-drawer .history-drawer-head {
  gap: 6px;
}

.workspace-history-drawer .history-drawer-head h2 {
  font-size: 18px;
}

.workspace-history-drawer .history-type-filter-rail {
  gap: 6px;
  padding-right: 0;
}

.workspace-history-drawer .history-type-filter-rail button {
  min-height: 38px;
  padding: 6px 4px;
  font-size: 12px;
}

.workspace-history-drawer .history-type-filter-rail button span {
  font-size: 11px;
}

.workspace-history-drawer .history-drawer-list {
  max-height: calc(100vh - 90px);
  overflow: auto;
}

