html, body {
  height: 100%;
}
body {
  background-color: #f5f6f8;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.card-img-top {
  background-color: #eee;
}
.pagination {
  flex-wrap: wrap;
}

.app-main {
  flex: 1 1 auto;
  min-height: 0;
}
.app-main--bleed {
  padding: 0 !important;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ================= Dashboard ================= */
.dash-kpi .display-6 {
  font-size: 2rem;
  line-height: 1.2;
}

/* ================= Chọn chuyên đề ================= */
.topic-card {
  transition: border-color .15s ease, box-shadow .15s ease;
  border-top: 3px solid #6c757d;
}
.topic-card:hover {
  border-top-color: #dc3545;
  box-shadow: 0 .25rem .75rem rgba(0,0,0,.08);
}

/* ================= Workspace chọn ảnh (full viewport) ================= */
.select-workspace {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px); /* trừ navbar */
  max-height: calc(100vh - 56px);
  padding: .5rem .75rem .75rem;
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
}
.select-workspace__header {
  flex: 0 0 auto;
  margin-bottom: .5rem;
}
.select-workspace__body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 34%) 1fr;
  gap: .75rem;
  overflow: hidden;
}
.select-workspace__left {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;    
}
.select-workspace__right {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.select-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.select-panel .nav-tabs .nav-link {
  font-weight: 600;
}
.image-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: none;
}

.image-item {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: inherit;
}
.image-item:hover {
  background: #f8f9fa;
}
.image-item.is-active {
  background: #fbeceb;
  border-left: 3px solid #dc3545;
}
.image-item img {
  width: 64px;
  height: 96px;
  object-fit: cover;
  border-radius: 3px;
  background: #eee;
  flex-shrink: 0;
  margin-top: 2px;
}
.image-item__body {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
  flex: 1;
}
.image-item__title {
  font-size: .85rem;
  line-height: 1.3;
  font-weight: 600;
}
.image-item__tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  color: #dc3545;
  margin-left: .25rem;
}
.image-item__meta {
  font-size: .75rem;
  color: #6c757d;
  line-height: 1.25;
}
.image-item__meta--clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.editor-panel .editor-preview {
  background: #1e2530;
  flex: 1 1 auto;
  min-height: 140px;
  max-height: 48%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
  overflow: hidden;
}
.editor-panel .editor-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 4px solid #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
.editor-panel .editor-form {
  flex: 0 0 auto;
  overflow-y: auto;
  max-height: 52%;
}
.editor-empty {
  color: #6c757d;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.stamp-btn {
  transform: rotate(-1deg);
}
.stamp-btn:hover {
  transform: rotate(0deg);
}

@media (max-width: 991.98px) {
  .select-workspace {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .select-workspace__body {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .image-list {
    max-height: 360px;
  }
  .editor-panel .editor-preview {
    max-height: 280px;
  }
  .editor-panel .editor-form {
    max-height: none;
  }
}
