:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --secondary: #0d9488;
  --secondary-light: #ccfbf1;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

@keyframes orthoRedBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.99); }
}

.ortho-auto-skip-note {
  animation: orthoRedBlink 1.8s ease-in-out infinite;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, button, input, select, textarea, .slot-header, .studio-card-title, .section-title {
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header Navbar */
.app-header {
  background: #ffffff;
  color: #0f172a;
  padding: 0 12px;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 100%;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  display: none;
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0;
}

.brand-info p {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.btn-header-tool {
  padding: 5px 10px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  height: 32px !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.btn-accent:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background-color: #334155;
  color: #e2e8f0;
  border-color: #475569;
}

.btn-secondary:hover {
  background-color: #475569;
}

.btn-outline {
  background-color: transparent;
  border-color: #475569;
  color: #cbd5e1;
}

.btn-outline:hover {
  background-color: #334155;
}

.btn-danger-outline {
  background: transparent;
  border-color: #ef4444;
  color: #ef4444;
}

.btn-danger-outline:hover {
  background-color: #fef2f2;
}

/* Container */
.main-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 4px 8px;
  box-sizing: border-box;
}

/* Drop Zone Banner */
.bulk-upload-card {
  background: #ffffff;
  border: 2px dashed #93c5fd;
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 2rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.bulk-upload-card:hover, .bulk-upload-card.drag-over {
  border-color: var(--primary);
  background-color: #f0f9ff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.upload-icon {
  font-size: 2.75rem;
  margin-bottom: 0.5rem;
  display: block;
}

.upload-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.upload-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.upload-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  background: #f1f5f9;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.counter-badge {
  color: var(--primary);
  font-size: 1rem;
}

.upload-options {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #475569;
}

.upload-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

/* Section Containers */
.section-container {
  margin-bottom: 0.4rem;
  padding: 0.4rem 0.6rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--border-color);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #0f172a;
}

.section-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
}

/* Photo Grid Layouts */
.photo-card-grid {
  display: grid;
  gap: 6px;
  margin-bottom: 0.6rem;
}

/* Step 1 Overview 4 Wide Rows */
.grid-row-6 {
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 0.6rem;
}

.grid-row-5 {
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 0.6rem;
}

.grid-row-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 0.6rem;
}

.grid-row-2 {
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 0.6rem;
}

@media (max-width: 1300px) {
  .grid-row-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-row-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-row-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-row-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-row-6 { grid-template-columns: repeat(2, 1fr); }
  .grid-row-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-row-4 { grid-template-columns: 1fr; }
  .grid-row-2 { grid-template-columns: 1fr; }
}

/* 6 Ngoài mặt: Lưới 3x2 (Legacy) */
.grid-extraoral {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .grid-extraoral {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 5 Trong miệng: Bố cục chữ thập chuẩn */
.grid-intraoral-cross {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto auto;
  gap: 1rem;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2.5rem;
}

.slot-maxillary {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

.slot-right-buccal {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
}

.slot-frontal-occlusion {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
}

.slot-left-buccal {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}

.slot-mandibular {
  grid-column: 2 / 3;
  grid-row: 3 / 4;
}

@media (max-width: 768px) {
  .grid-intraoral-cross {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .slot-maxillary, .slot-right-buccal, .slot-frontal-occlusion, .slot-left-buccal, .slot-mandibular {
    grid-column: auto;
    grid-row: auto;
  }
}

/* 2 Phim X-quang */
.grid-radiographs {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .grid-radiographs {
    grid-template-columns: 1fr;
  }
}

/* Individual Slot Card */
.photo-slot {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
}

.photo-slot:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.photo-slot.drag-over {
  border: 2px dashed var(--primary);
  background-color: var(--primary-light);
}

.photo-slot.filled {
  border-color: #93c5fd;
}

.slot-header {
  padding: 4px 6px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
}

.slot-badge-mirror {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}

.slot-body {
  height: 220px;
  background: #f8fafc;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.photo-slot.filled .slot-body {
  background: #0f172a;
}

.slot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  text-align: center;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.slot-placeholder p {
  font-size: 0.8rem;
}

.slot-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
  user-select: none;
}

/* Controls Toolbar on Slot */
.slot-controls {
  display: none !important;
}

.btn-tool {
  background: transparent;
  border: 1px solid transparent;
  color: #475569;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  transition: all 0.15s ease;
}

.btn-tool:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.btn-tool.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
}

.btn-tool.btn-delete {
  color: #ef4444;
}

.btn-tool.btn-delete:hover {
  background: #fef2f2;
}

/* Clinical Charting Section */
.charting-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  margin-bottom: 3rem;
}

.charting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.chart-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.chart-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e2e8f0;
}

.form-group {
  margin-bottom: 0.85rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.25rem;
}

.form-control {
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: #1e293b;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #334155;
  cursor: pointer;
}

/* Lightbox Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-content {
  max-width: 90vw;
  max-height: 90vh;
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.modal-body img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  /* Bấm xuyên qua thông báo tới nút bên dưới; mờ đi khi chuột lại gần (app.js) */
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.toast-container .toast { pointer-events: none; }
.toast-container .toast button { pointer-events: auto; }

.toast {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease forwards;
}

.toast-success { background-color: var(--success); }
.toast-info { background-color: var(--primary); }
.toast-warning { background-color: var(--accent); }
.toast-danger, .toast-error { background-color: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===================================================
   SLIDE EDITOR - VERTICAL NAVIGATOR & NO-SCROLL LAYOUT
   =================================================== */
.slide-editor-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-editor-layout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 4px 8px;
  box-sizing: border-box;
}

.slide-section-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  scroll-margin-top: 56px;
}

.slide-content-grid {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
}

/* Sidebar Dọc (95px — thu gọn 1/2 để nhường chỗ cho phần nội dung slide) */
.slide-nav-sidebar {
  width: 95px;
  min-width: 95px;
  flex: 0 0 95px;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 4px 2px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 54px;
  z-index: 20;
}

.slide-nav-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  padding: 4px 8px 8px;
  letter-spacing: 0.5px;
}

/* Tiêu đề + nút Cài Đặt xếp gọn trong sidebar hẹp (ghi đè style inline trong index.html) */
.slide-nav-sidebar .slide-nav-title {
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px 3px !important;
  letter-spacing: 0;
}
.slide-nav-sidebar .slide-nav-title > span {
  font-size: 10px !important;
  gap: 3px !important;
}
.slide-nav-sidebar .slide-nav-title svg {
  width: 10px;
  height: 10px;
}
.slide-nav-sidebar #btnOpenSlideSettings {
  font-size: 9px !important;
  padding: 1px 4px !important;
  gap: 2px !important;
}

.slide-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-slide-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 4px 4px;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-slide-nav .btn-del-slide-nav {
  font-size: 9px !important;
  margin-right: 1px !important;
  padding: 0 1px !important;
  flex-shrink: 0;
}

.btn-slide-nav:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.btn-slide-nav.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.btn-slide-nav .nav-icon {
  display: none !important;
}

.btn-slide-nav .nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 4px;
}

.btn-back-photos {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: #64748b;
  margin-top: 4px;
}

.btn-back-photos:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Slide Main Area */
.slide-main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slide-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.slide-title-text {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #14532A;
}

.slide-subtitle-text {
  display: none !important;
}

.btn-preview-slide {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
}

.btn-preview-slide:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Two-column Panels */
.slide-visual-panel {
  flex: 0 0 46%;
  width: 46%;
  max-width: 46%;
  min-width: 300px;
  box-sizing: border-box;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 10px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 54px;
  align-self: flex-start;
  z-index: 10;
}

/* Slide 16: cột trái = hình slide + khối hỗ trợ lập kế hoạch bên dưới (không thuộc slide) */
.slide-left-col {
  flex: 0 0 46%;
  width: 46%;
  max-width: 46%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: flex-start;
}
.slide-left-col > .slide-visual-panel {
  flex: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  position: static;
}

/* Criteria Panel: BỎ HOÀN TOÀN THANH CUỘN THEO YÊU CẦU */
.slide-criteria-panel,
#slideCriteriaPanel,
#criteriaItemsList,
.criteria-items-grid {
  overflow-y: visible !important;
  max-height: none !important;
  height: auto !important;
}

.slide-criteria-panel {
  flex: 0 0 54%;
  width: 54%;
  max-width: 54%;
  min-width: 320px;
  box-sizing: border-box;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.criteria-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 6px;
  width: 100%;
}

/* Criterion Card in Criteria Panel (Thu gọn theo yêu cầu) */
.criterion-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 8px;
  margin-bottom: 4px;
  transition: all 0.2s ease;
}

.criterion-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.opt-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.opt-chip {
  padding: 2px 8px !important;
  font-size: 0.75rem !important;
}

.crit-custom-input {
  height: 26px !important;
  font-size: 0.75rem !important;
  padding: 2px 6px !important;
  margin-top: 2px;
}

/* Interactive Photo Card & Hover Overlay */
.interactive-photo-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.interactive-photo-card:hover {
  border-color: #06b6d4;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.interactive-photo-card .edit-badge-hover {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.8);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.interactive-photo-card:hover .edit-badge-hover {
  opacity: 1;
  background: rgba(6, 182, 212, 0.95);
  color: #ffffff;
}

/* Modal Landmark & Smile Crop Editor */
.landmark-modal-content {
  max-width: 1260px;
  width: 96vw;
  max-height: 94vh;
  background: #0f172a;
}

.landmark-modal-header {
  background: #0f172a;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #1e293b;
}

.landmark-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.landmark-header-icon {
  font-size: 1.4rem;
}

.landmark-header-title {
  margin: 0;
  font-weight: 700;
  color: #38bdf8;
  font-size: 1.1rem;
}

.landmark-header-sub {
  margin: 2px 0 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.landmark-toolbar {
  background: #1e293b;
  padding: 10px 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid #334155;
}

.landmark-toolbar-label {
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 600;
}

.landmark-mode-buttons {
  display: flex;
  gap: 8px;
}

.btn-mode-switch {
  background: #334155;
  color: #cbd5e1;
  font-weight: 600;
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mode-switch.active {
  background: #0284c7;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.btn-reset-landmarks {
  background: transparent;
  color: #f87171;
  border: 1px solid #ef4444;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 6px;
  margin-left: auto;
  cursor: pointer;
}

.btn-reset-landmarks:hover {
  background: rgba(239, 68, 68, 0.1);
}

.landmark-modal-body {
  padding: 16px 20px;
  background: #0b1120;
  display: flex;
  gap: 20px;
  align-items: stretch;
  justify-content: center;
  overflow: auto;
  max-height: 78vh;
}

.landmark-editor-left {
  flex: 1;
  min-width: 320px;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.landmark-canvas-wrapper {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  border: 1px solid #e2e8f0;
}

.landmark-editor-canvas {
  display: block;
  max-width: 100%;
}

.landmark-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.landmark-hint-text {
  margin-top: 10px;
  font-size: 0.78rem;
  color: #94a3b8;
  text-align: center;
}

.landmark-editor-right {
  flex: 1;
  min-width: 320px;
  max-width: 720px;
  background: #1e293b;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #334155;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.landmark-side-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
}

.landmark-side-title {
  font-weight: 700;
  color: #38bdf8;
  font-size: 0.95rem;
}

.crop-preview-box {
  background: #0f172a;
  border: 2px solid #06b6d4;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 480px;
  max-height: 640px;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.25);
  padding: 8px;
  box-sizing: border-box;
}

.crop-live-canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.landmark-stat-card {
  background: #0f172a;
  border-radius: 6px;
  padding: 10px;
  font-size: 0.78rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.landmark-stat-title {
  font-weight: 600;
  color: #e2e8f0;
  border-bottom: 1px solid #334155;
  padding-bottom: 4px;
  margin-bottom: 2px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
}

.stat-row strong {
  color: #38bdf8;
}

.landmark-modal-footer {
  padding: 12px 20px;
  background: #1e293b;
  border-top: 1px solid #334155;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Cửa sổ chỉnh đường E: toàn màn hình, ảnh to hết cỡ, thu phóng (slide_editor.js) */
#elineModal { padding: 0; }
#elineModal .modal-content {
  width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0;
}
#elineModal .eline-header {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start;
  gap: 10px 16px; padding: 8px 14px;
}
#elineModal .eline-lips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; color: #cbd5e1; font-size: 0.88rem; font-weight: 600; }
#elineModal .eline-lips strong { font-weight: 800; }
#elineModal .eline-ai-busy { display: inline-flex; align-items: center; gap: 7px; color: #7dd3fc; }
#elineModal .eline-ai-busy[hidden] { display: none; }
#elineModal .eline-spin {
  width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid #334155; border-top-color: #38bdf8; animation: elineSpin 0.8s linear infinite;
}
@keyframes elineSpin { to { transform: rotate(360deg); } }
#elineModal .eline-chk { display: inline-flex; align-items: center; gap: 6px; color: #4ade80; font-size: 0.82rem; font-weight: 700; cursor: pointer; user-select: none; }
#elineModal .eline-zoom { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
#elineModal .eline-zoom button {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid #475569; background: #1e293b;
  color: #e2e8f0; font-weight: 800; font-size: 0.85rem; cursor: pointer;
}
#elineModal .eline-zoom button:hover { background: #334155; }
#elineModal #elineZoomLabel { min-width: 46px; text-align: center; color: #cbd5e1; font-size: 0.8rem; font-weight: 700; }
#elineModal .eline-ai-btn {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); color: #ffffff; font-weight: 700; border: none;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem;
}
#elineModal .eline-body { flex: 1 1 auto; min-height: 0; padding: 0; display: block; background: #0b1120; }
#elineModal .eline-viewport { position: relative; width: 100%; height: 100%; overflow: hidden; cursor: grab; touch-action: none; }
#elineModal .eline-viewport.is-panning { cursor: grabbing; }
#elineModal .eline-canvas-wrapper {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; border-radius: 0; border: none; background: #334155;
}
#elineModal .eline-canvas-wrapper .landmark-editor-canvas { max-width: none; width: 100%; height: 100%; }

/* Modal Slide 16:9 Preview */
.slide-preview-modal-content {
  max-width: 1040px;
  width: 96vw;
  max-height: 94vh;
  background: #0f172a;
}

.slide-preview-modal-header {
  background: #1e293b;
  color: #ffffff;
  border-bottom: 1px solid #334155;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slide-preview-modal-body {
  padding: 24px;
  background: #0b1120;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
}

.slide-preview-stage {
  width: 960px;
  height: 540px;
  position: relative;
  background: #ffffff url('../assets/bg_vietsmile.jpg') no-repeat center center;
  background-size: 100% 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  font-family: 'Times New Roman', Times, serif !important;
}

.slide-preview-stage,
.slide-preview-stage * {
  font-family: 'Times New Roman', Times, serif !important;
}

.slide-preview-modal-footer {
  padding: 12px 20px;
  background: #1e293b;
  border-top: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 1024px) {
  .slide-editor-layout {
    flex-direction: column;
  }
  .slide-nav-sidebar {
    width: 100%;
    min-width: 100%;
    position: static;
  }
  .slide-nav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .btn-slide-nav {
    width: auto;
  }
}

@media (max-width: 992px) {
  .slide-content-grid,
  #slideContentWrapper {
    flex-direction: column !important;
  }
  .slide-visual-panel, .slide-criteria-panel, .slide-left-col,
  #slideVisualPanel, #slideCriteriaPanel {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    position: static !important;
  }
  .criteria-items-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   PHOTO EDITOR STUDIO (CLEAN MEDICAL LIGHT THEME & COMPACT SIZING)
   ========================================================================== */

#editorStudioContainer,
#cephStudioStepContainer,
#slideEditorContainer {
  scroll-margin-top: 56px;
}

#editorStudioContainer {
  background: #ffffff;
  color: var(--text-main);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin: 12px 0 28px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
}

.studio-header {
  position: sticky;
  top: var(--hdr-h, 48px); /* chiều cao thanh trên, đặt bởi script tự co trong index.html */
  z-index: 40;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.studio-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-header-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.studio-section {
  margin-bottom: 24px;
}

.studio-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #e2e8f0;
}

.studio-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.studio-section-desc {
  font-size: 0.8rem;
  color: #64748b;
}

.studio-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.studio-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 1200px) {
  .studio-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .studio-grid-2, .studio-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Editor Slot Card */
.editor-slot-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.editor-slot-card:hover {
  border-color: #0284c7;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.12);
}

.editor-card-header {
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.editor-card-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-aspect-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}

.badge-ratio-34 {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.badge-ratio-free {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-preview {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.mirror-alert-badge {
  font-size: 0.72rem;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.mirror-alert-center-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 14px 0;
  text-align: center;
}

.mirror-alert-badge-pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1.5px solid #f59e0b;
  padding: 6px 18px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.25);
  animation: mirrorNoticePulse 2.8s ease-in-out infinite;
}

@keyframes mirrorNoticePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.25);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 5px 16px rgba(245, 158, 11, 0.4);
    border-color: #d97706;
  }
}

/* Viewport - Kích thước vừa vặn màn hình (Không cần cuộn chuột) */
.editor-viewport {
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  height: 330px;
  padding: 8px;
  user-select: none;
}

.viewport-extraoral {
  height: 360px !important;
  max-height: 46vh;
  min-height: 280px;
}

.viewport-compact {
  height: 290px !important;
  max-height: 38vh;
  min-height: 230px;
}

.editor-no-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  gap: 6px;
  height: 100%;
}

.editor-no-image svg {
  stroke: #cbd5e1;
}

.editor-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
  background: #ffffff;
}

/* Crop Box */
.crop-box {
  position: absolute;
  border: 2px solid #0284c7;
  cursor: move;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 0 9999px rgba(15, 23, 42, 0.45);
  touch-action: none;
  z-index: 10;
  pointer-events: auto;
}

.crop-grid-3x3,
.crop-grid-8x8 {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.85) 1px, rgba(0, 0, 0, 0.35) 1px, transparent 2px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.85) 1px, rgba(0, 0, 0, 0.35) 1px, transparent 2px);
  background-size: 12.5% 12.5%;
}

/* Card Maximized Mode (Double-click Zoom) */
.editor-slot-card.card-maximized {
  position: fixed !important;
  top: 16px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: min(94vw, 1100px) !important;
  height: calc(96vh - 20px) !important;
  max-height: 96vh !important;
  z-index: 10000 !important;
  background: #ffffff !important;
  border: 2px solid #0284c7 !important;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.6), 0 0 0 9999px rgba(15, 23, 42, 0.55) !important;
}

.editor-slot-card.card-maximized .editor-viewport {
  height: calc(96vh - 160px) !important;
  max-height: none !important;
  min-height: 460px !important;
  background: #f8fafc !important;
}

.editor-card-header .btn-toggle-maximize {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.editor-card-header .btn-toggle-maximize:hover {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #0284c7;
}

/* L-shaped Corners */
.crop-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #0284c7;
  border-style: solid;
  pointer-events: none;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

.crop-corner-tl {
  top: -2px;
  left: -2px;
  border-width: 4px 0 0 4px;
}

.crop-corner-tr {
  top: -2px;
  right: -2px;
  border-width: 4px 4px 0 0;
}

.crop-corner-bl {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 4px 4px;
}

.crop-corner-br {
  bottom: -2px;
  right: -2px;
  border-width: 0 4px 4px 0;
}

/* 8-point interactive handles */
.crop-handle {
  position: absolute;
  z-index: 15;
}

.crop-handle-tl {
  top: -8px;
  left: -8px;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
}

.crop-handle-tr {
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  cursor: nesw-resize;
}

.crop-handle-bl {
  bottom: -8px;
  left: -8px;
  width: 22px;
  height: 22px;
  cursor: nesw-resize;
}

.crop-handle-br {
  bottom: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
}

.crop-handle-t {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 16px;
  cursor: ns-resize;
}

.crop-handle-b {
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 16px;
  cursor: ns-resize;
}

.crop-handle-l {
  top: 50%;
  left: -8px;
  transform: translateY(-50%);
  width: 16px;
  height: 36px;
  cursor: ew-resize;
}

.crop-handle-r {
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
  width: 16px;
  height: 36px;
  cursor: ew-resize;
}

/* Handle indicator bars */
.crop-handle-t::after,
.crop-handle-b::after {
  content: '';
  display: block;
  width: 20px;
  height: 4px;
  background: #ffffff;
  border: 1px solid #0284c7;
  border-radius: 2px;
  margin: 6px auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.crop-handle-l::after,
.crop-handle-r::after {
  content: '';
  display: block;
  width: 4px;
  height: 20px;
  background: #ffffff;
  border: 1px solid #0284c7;
  border-radius: 2px;
  margin: auto;
  margin-top: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Editor Toolbar - Gọn gàng, sáng sủa, vừa khít trong màn hình */
.editor-toolbar {
  padding: 6px 10px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-sizing: border-box;
}

.fine-rotate-container {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.fine-rotate-label {
  font-size: 0.72rem;
  color: #475569;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.fine-slider-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.fine-angle-slider {
  width: 100%;
  accent-color: #0284c7;
  cursor: pointer;
  height: 4px;
}

.slider-ruler {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: #94a3b8;
  user-select: none;
  line-height: 1;
}

.btn-step-angle {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1.3;
  transition: all 0.12s ease;
}

.btn-step-angle:hover {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #0284c7;
}

.angle-display {
  min-width: 34px;
  text-align: right;
  font-size: 0.76rem;
  font-weight: 800;
  color: #0284c7;
  font-family: monospace;
  flex-shrink: 0;
}

/* 1 Hàng nút thao tác duy nhất - Tối ưu chiều ngang */
.editor-action-buttons {
  display: flex;
  flex-wrap: nowrap !important;
  gap: 4px;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

.btn-editor-tool {
  flex: 1 1 0;
  min-width: 0;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 2px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  letter-spacing: -0.2px;
  box-sizing: border-box;
  transition: all 0.15s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-editor-tool:hover {
  background: #f1f5f9;
  color: #0284c7;
  border-color: #0284c7;
}

.btn-reset-crop {
  color: #dc2626 !important;
  background: #fff5f5 !important;
  border-color: #fecaca !important;
}

.btn-reset-crop:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}

/* Thông báo Cần lật ảnh nhấp nháy cho Mặt nhai HT & HD */
.badge-flip-notice {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  border: 1px solid #fca5a5;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  animation: blink-flip-alert 0.9s ease-in-out infinite alternate;
  vertical-align: middle;
  transition: transform 0.15s ease;
}

.badge-flip-notice:hover {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  transform: scale(1.05);
}

@keyframes blink-flip-alert {
  0% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.97);
    box-shadow: 0 0 1px rgba(239, 68, 68, 0.2);
  }
  100% {
    opacity: 1;
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.7);
  }
}

/* Nút Lật Ngang nhấp nháy nổi bật khi chưa lật */
.btn-flip-h.need-flip-pulse {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border-color: #ef4444 !important;
  animation: pulse-flip-btn 0.9s ease-in-out infinite alternate;
}

@keyframes pulse-flip-btn {
  0% {
    box-shadow: 0 0 2px rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
  }
  100% {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    border-color: #dc2626;
    color: #b91c1c !important;
  }
}

.studio-bottom-actions {
  margin: 28px 0 16px 0;
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: var(--radius-md);
  border: 1.5px solid #bbf7d0;
  box-shadow: var(--shadow-sm);
}

/* A4 Print Optimization */
@media print {
  .app-header, .bulk-upload-card, .header-actions, .slot-controls, .btn, .upload-options, #editorStudioContainer {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .main-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .photo-slot {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .slot-body {
    background: #ffffff !important;
    height: 180px !important;
  }

  .charting-container {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    page-break-before: always;
  }
}

/* Slide 9 Notice Blink Animation */
@keyframes blink-warning {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.99); }
}
.bolton-skip-notice {
  animation: blink-warning 1.8s ease-in-out infinite;
  display: inline-block;
}

/* Floating Action Button (Sticky Step 1 -> Step 2) */
.floating-step-action {
  transition: all 0.25s ease;
}

.floating-btn-animate:hover {
  transform: translateY(-3px) scale(1.04) !important;
  box-shadow: 0 14px 30px rgba(2, 132, 199, 0.7) !important;
}

.floating-btn-animate.btn-success:hover {
  box-shadow: 0 14px 30px rgba(22, 163, 74, 0.75) !important;
}

.floating-btn-animate:active {
  transform: translateY(0) scale(0.98) !important;
}

/* ========================================================
   BƯỚC 3: CEPH STUDIO STYLES
   ======================================================== */
.ceph-studio-container {
  animation: fadeIn 0.3s ease-in-out;
}

.ceph-status-msg.info {
  background: #1e293b;
  color: #93c5fd;
  border-left: 4px solid #3b82f6;
}

.ceph-status-msg.success {
  background: #064e3b;
  color: #6ee7b7;
  border-left: 4px solid #10b981;
}

.ceph-status-msg.warning {
  background: #78350f;
  color: #fde68a;
  border-left: 4px solid #f59e0b;
}

.ceph-status-msg.error {
  background: #7f1d1d;
  color: #fca5a5;
  border-left: 4px solid #ef4444;
}

.btn-ruler-preset.active {
  background: #d97706 !important;
  color: white !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

@keyframes pulseRuler {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.6);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 0 10px rgba(234, 179, 8, 0);
  }
}

#btnConfirmRuler {
  animation: pulseRuler 2.2s infinite;
}

.ceph-landmark-tooltip {
  position: fixed;
  z-index: 100050;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  border: 1px solid #38bdf8;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  white-space: nowrap;
  display: none;
  backdrop-filter: blur(4px);
  line-height: 1.4;
}

/* ========================================================
   TOP HEADER COMPACT (48px) & SUB-HEADER (40px) - CLINICAL LIGHT
   ======================================================== */
.top-header-compact {
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-left-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modern-medical-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.22);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}
.modern-medical-logo:hover {
  transform: scale(1.06);
}
.logo-svg-icon {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.doctor-badge-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.doctor-avatar-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
}
.doctor-name-label {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  max-width: 220px;
  white-space: nowrap;
}
.btn-logout-compact {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.btn-logout-compact:hover {
  color: #ef4444;
  background: #fee2e2;
}

.compact-stepper {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.stepper-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.stepper-pill:hover {
  background: #f1f5f9;
  color: #0284c7;
  transform: translateY(-1px);
}
.stepper-pill:active {
  transform: translateY(0);
}
.stepper-pill.active {
  background: #e0f2fe;
  color: #0369a1;
}
.stepper-pill.completed {
  color: #10b981;
}
.pill-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #ffffff;
  font-size: 8.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}
.stepper-pill.active .pill-dot {
  background: #0284c7;
}
.stepper-pill.completed .pill-dot {
  background: #10b981;
}
.stepper-line {
  width: 10px;
  height: 1.5px;
  background: #e2e8f0;
}

.header-right-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-top-next {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 6px 16px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.btn-top-next:hover {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}
.btn-top-next:active {
  transform: translateY(0) scale(0.98);
}

.btn-tool-export {
  padding: 5px 8px;
  border-radius: 6px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-tool-export svg {
  flex-shrink: 0;
}
.btn-tool-export:hover {
  filter: brightness(1.12);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.btn-tool-export:active {
  transform: translateY(0);
  filter: brightness(0.96);
}

/* Thanh trên tự co cho vừa màn hình: script ngay sau <header> trong index.html
   thêm lần lượt hdr-fit-1 → 4 cho tới khi hết tràn. Chữ bị ẩn vẫn xem được khi rê chuột (title). */
.top-header-compact { gap: 10px; }
.hdr-measuring, .hdr-measuring * { transition: none !important; }
/* 1: các bước chưa làm chỉ còn số; Đăng xuất và Quản lý AI chỉ còn biểu tượng */
.hdr-fit-1 .stepper-pill:not(.active) > span:not(.pill-dot),
.hdr-fit-1 .btn-logout-compact > span,
.hdr-fit-1 #linkAdminLearning .hdr-label { display: none; }
/* 2: nút thao tác (Lưu ca, Xuất PDF...) chỉ còn biểu tượng */
.hdr-fit-2 .btn-tool-export > span { display: none; }
.hdr-fit-2 .btn-tool-export { padding: 6px 7px; }
/* 3: ẩn tên bác sĩ, bước đang làm chỉ còn số */
.hdr-fit-3 .doctor-name-label,
.hdr-fit-3 .stepper-pill.active > span:not(.pill-dot) { display: none; }
.hdr-fit-3 .stepper-line { width: 5px; }
.hdr-fit-3 .header-left-cluster { gap: 6px; }
.hdr-fit-3 .btn-top-next { padding: 6px 10px; }
/* 4: màn hình hẹp (điện thoại, cửa sổ chia đôi): xuống 2 dòng */
.hdr-fit-4.top-header-compact {
  height: auto;
  max-height: none;
  flex-wrap: wrap;
  row-gap: 6px;
  padding: 6px 10px;
}
.hdr-fit-4 .header-right-cluster { flex-wrap: wrap; justify-content: flex-end; }
.hdr-fit-4 #step4ExportGroup { flex-wrap: wrap; }

/* Mouse Micro-Interactions across the app */
.photo-slot {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.photo-slot:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.editor-slot-card {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.editor-slot-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
}
.btn-editor-tool {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-editor-tool:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  filter: brightness(1.08);
}
.btn-editor-tool:active {
  transform: translateY(0);
}
.btn-step-angle {
  transition: all 0.15s ease;
}
.btn-step-angle:hover {
  background: #e2e8f0;
  color: #0284c7;
  transform: scale(1.08);
}

.sub-action-bar {
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: var(--hdr-h, 48px); /* thanh trên có thể cao 2 dòng trên điện thoại */
  z-index: 900;
}

.btn-prominent-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all 0.15s ease;
}
.btn-prominent-back:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0284c7;
  transform: translateX(-2px);
}

.sub-context-title {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.floating-next-cta {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 13px 26px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  letter-spacing: 0.3px;
}
.floating-next-cta:hover {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 32px rgba(16, 185, 129, 0.55);
}
.floating-next-cta:active {
  transform: translateY(0) scale(0.98);
}

/* ========================================================
   TRANG 1: DASHBOARD BỆNH ÁN & NÚT MEGA SAPPHIRE
   ======================================================== */
.dashboard-wrapper {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

@keyframes sapphireAura {
  0%, 100% {
    opacity: 0.6;
    transform: scale(0.98);
    filter: blur(22px);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.06);
    filter: blur(34px);
  }
}
.mega-sapphire-aura {
  animation: sapphireAura 3s ease-in-out infinite;
}

@keyframes fiberOpticTrace {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.fiber-optic-border {
  position: relative;
  border-radius: 1.75rem;
  padding: 3.5px;
  overflow: hidden;
  display: inline-flex;
}
.fiber-optic-border::before {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    #0284c7 20%,
    #38bdf8 35%,
    #ffffff 50%,
    #38bdf8 65%,
    #0369a1 80%,
    transparent 100%
  );
  animation: fiberOpticTrace 2.8s linear infinite;
}

@keyframes mirrorGlare {
  0% { transform: translateX(-140%) skewX(-25deg); }
  100% { transform: translateX(240%) skewX(-25deg); }
}
.mirror-glare-effect {
  position: relative;
  overflow: hidden;
}
.mirror-glare-effect::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    70deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 70%
  );
  transform: translateX(-140%) skewX(-25deg);
  animation: mirrorGlare 2.4s ease-in-out infinite;
}

@keyframes radarSweepScan {
  0% { transform: translateX(-100px); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% { transform: translateX(1100px); opacity: 0; }
}
.radar-sweep-bar {
  animation: radarSweepScan 4.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes sapphirePing {
  0% { r: 6; opacity: 1; stroke-width: 3; }
  100% { r: 28; opacity: 0; stroke-width: 0.5; }
}
.sapphire-radar-ring {
  animation: sapphirePing 2.2s cubic-bezier(0.1, 0.7, 0.3, 1) infinite;
}

@keyframes sapphireGlowBreathe {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.08); }
}
.sapphire-mesh-bg {
  animation: sapphireGlowBreathe 6s ease-in-out infinite;
}

@keyframes cardFloatIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-card-float {
  animation: cardFloatIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dashboard-mega-btn {
  height: 76px;
  padding: 0 44px;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, #020617 0%, #082f49 50%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 12px 36px rgba(2, 132, 199, 0.45);
}
.dashboard-mega-btn:hover {
  transform: scale(1.035);
  box-shadow: 0 18px 48px rgba(2, 132, 199, 0.65);
}
.dashboard-mega-btn:active {
  transform: scale(0.97);
}

.dashboard-ceph-btn {
  height: 56px;
  padding: 0 32px;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #022c22 0%, #064e3b 45%, #047857 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(52, 211, 153, 0.5);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 26px rgba(5, 150, 105, 0.4);
}
.dashboard-ceph-btn:hover {
  transform: scale(1.035);
  box-shadow: 0 14px 38px rgba(5, 150, 105, 0.65);
  border-color: rgba(52, 211, 153, 0.85);
}
.dashboard-ceph-btn:active {
  transform: scale(0.97);
}

.mega-emerald-aura {
  animation: sapphireAura 2.8s ease-in-out infinite;
}




/* ============================================================ */
/* CLICK-TO-SWAP ANIMATIONS & SELECTION STYLES                  */
/* ============================================================ */
@keyframes orangePulseSwap {
  0% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    transform: scale(1.02);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(249, 115, 22, 0);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    transform: scale(1.0);
  }
}

.pulse-orange-badge {
  animation: orangePulseSwap 1.5s infinite ease-in-out;
}

.swap-selected-slot {
  border: 2px solid #f97316 !important;
  box-shadow: 0 0 0 3.5px rgba(249, 115, 22, 0.6) !important;
  position: relative;
  z-index: 10;
}

.swap-target-candidate {
  cursor: pointer !important;
  transition: all 0.2s ease;
}

.swap-target-candidate:hover {
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4) !important;
  transform: translateY(-2px);
}

.swap-selected-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Category upload button */
.btn-category-upload {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

/* ============================================================ */
/* PATIENT CARDS ON DASHBOARD (ĐỊNH DẠNG THẺ BỆNH NHÂN TRANG 1)  */
/* Khắc phục triệt để lỗi kích thước ảnh, icon SVG và nút bấm   */
/* ============================================================ */
#patientGrid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
  gap: 20px !important;
}

/* Khung thẻ chính */
#patientGrid .animate-card-float {
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 18px !important;
  padding: 18px 20px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05) !important;
  transition: all 0.25s ease !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
#patientGrid .animate-card-float:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.12) !important;
  transform: translateY(-2px) !important;
}

/* Hàng trên: Flex container */
#patientGrid .flex.items-start {
  display: flex !important;
  align-items: flex-start !important;
  gap: 14px !important;
  margin-bottom: 12px !important;
}

/* Khung Avatar chân dung: Khóa chuẩn 56px x 56px */
#patientGrid .w-15 {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 900 !important;
  font-size: 1.15rem !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25) !important;
}

/* Ảnh chân dung bên trong avatar: Co về 100% của 56px, object-fit: cover */
#patientGrid .w-15 img,
#patientGrid img.w-full {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

/* Cột thông tin hành chính bên phải avatar */
#patientGrid .flex-1.min-w-0 {
  flex: 1 !important;
  min-width: 0 !important;
}
#patientGrid .flex.items-center.justify-between {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  margin-bottom: 3px !important;
}
#patientGrid span.text-sky-700 {
  font-size: 11px !important;
  font-family: monospace !important;
  font-weight: 700 !important;
  color: #0369a1 !important;
  background: #f0f9ff !important;
  padding: 2px 7px !important;
  border-radius: 6px !important;
  border: 1px solid #bae6fd !important;
}
#patientGrid span.text-slate-400 {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #94a3b8 !important;
}
#patientGrid h4 {
  font-size: 1rem !important;
  font-weight: 900 !important;
  color: #0f172a !important;
  text-transform: uppercase !important;
  margin: 2px 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#patientGrid p.text-slate-500 {
  font-size: 12px !important;
  color: #64748b !important;
  font-weight: 600 !important;
  margin: 0 !important;
}

/* Khối lý do khám & bác sĩ phụ trách */
#patientGrid .bg-slate-50.rounded-xl {
  background: #f8fafc !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  margin-bottom: 12px !important;
  border: 1px solid #f1f5f9 !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: #475569 !important;
}
#patientGrid .bg-slate-50.rounded-xl strong {
  color: #0f172a !important;
}

/* Hàng nút hành động dưới chân thẻ */
#patientGrid .flex.items-center.gap-2.pt-2 {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding-top: 10px !important;
  border-top: 1px solid #f1f5f9 !important;
}

/* Giới hạn kích thước tất cả icon SVG trong thẻ bệnh nhân chuẩn 16x16px */
#patientGrid svg,
#patientGrid svg.w-4,
#patientGrid svg.h-4 {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

/* Nút Xem Bệnh Án */
#patientGrid button.flex-1 {
  flex: 1 !important;
  height: 38px !important;
  padding: 0 14px !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25) !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
}
#patientGrid button.flex-1:hover {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
}

/* Nút Mở Thư Mục */
#patientGrid button.p-2 {
  width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}
#patientGrid button.p-2:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

/* Nút Gửi ca (bản online, js/share_case.js) */
#patientGrid button.case-share-btn {
  height: 38px !important;
  padding: 0 12px !important;
  border-radius: 10px !important;
  background: #f5f3ff !important;
  color: #6d28d9 !important;
  border: 1px solid #ddd6fe !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: all 0.2s ease !important;
}
#patientGrid button.case-share-btn:hover {
  background: #ede9fe !important;
  color: #5b21b6 !important;
  border-color: #c4b5fd !important;
  transform: translateY(-1px) !important;
}

/* Nút Tải PDF */
#patientGrid a.p-2 {
  width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  background: #f0fdf4 !important;
  color: #16a34a !important;
  border: 1px solid #bbf7d0 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
}
#patientGrid a.p-2:hover {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
  transform: translateY(-1px) !important;
}


/* ========================================================
   WORKBENCH LAYOUT & KHAY ANH CHO SAP XEP (2 COT)
   ======================================================== */
.mockup-workbench-layout {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 1780px;
  margin: 0 auto;
  padding: 10px 16px 40px;
  box-sizing: border-box;
  align-items: flex-start;
}

.mockup-left-main {
  flex: 1;
  min-width: 0;
}

.mockup-right-tray {
  width: 328px;
  flex-shrink: 0;
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  z-index: 30;
}

.tray-top-header {
  padding: 10px 14px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1.5px solid #e2e8f0;
  flex-shrink: 0;
}

.tray-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tray-title-text {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tray-counter-pill {
  background: #fef3c7;
  color: #b45309;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #fde68a;
}

.tray-upload-card {
  margin: 8px 10px 4px;
  border: 1.5px dashed #38bdf8;
  background: #f0f9ff;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.tray-upload-card:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  transform: translateY(-1px);
}

.tray-upload-card-text {
  font-size: 0.74rem;
  font-weight: 700;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tray-photo-stream {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  min-height: 180px;
  background: #f8fafc;
}

.tray-photo-card {
  background: #0f172a;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  user-select: none;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}
.tray-photo-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
  transform: translateY(-2px);
}
.tray-photo-card.is-selected {
  border-color: #0284c7;
  box-shadow: 0 0 0 2.5px rgba(2, 132, 199, 0.45);
}
.tray-photo-card.is-junk {
  border-color: #f87171;
}

.tray-card-thumb {
  width: 100%;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1120;
  position: relative;
  overflow: hidden;
}

.tray-card-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tray-card-actions {
  position: absolute;
  bottom: 5px;
  right: 5px;
  display: flex;
  gap: 4px;
  z-index: 10;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.tray-photo-card:hover .tray-card-actions {
  opacity: 1;
  transform: scale(1);
}

.tray-mini-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}
.tray-mini-btn svg {
  width: 13px;
  height: 13px;
}
.tray-mini-btn:hover {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  transform: scale(1.1);
}
.tray-mini-btn-delete:hover {
  background: #ef4444 !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
  transform: scale(1.1);
}

.tray-card-overlay-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.tray-badge-junk {
  background: rgba(220, 38, 38, 0.9);
  color: #ffffff;
  border: 1px solid #f87171;
}

.tray-bottom-footer {
  padding: 8px 12px;
  background: #ffffff;
  border-top: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.tray-clean-all-btn {
  font-size: 0.72rem;
  font-weight: 700;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.tray-clean-all-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.tray-empty-box {
  text-align: center;
  padding: 30px 10px;
  color: #94a3b8;
}
.tray-empty-icon {
  margin-bottom: 8px;
}

/* Nut xoa thung rac goc phai tren khi hover vao o co anh */
.slot-hover-trash-topright {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.92);
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 25;
  padding: 0;
}
.photo-slot.filled:hover .slot-hover-trash-topright,
.tray-photo-card:hover .slot-hover-trash-topright {
  opacity: 1;
  transform: scale(1);
}
.slot-hover-trash-topright:hover {
  background: #dc2626 !important;
  transform: scale(1.12) !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.45);
}

/* Thanh cong cu hover day o */
.slot-hover-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.2) 75%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  pointer-events: none;
}
.photo-slot.filled:hover .slot-hover-controls {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.slot-mini-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
}
.slot-mini-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: #ffffff;
  transform: scale(1.05);
}
.slot-mini-btn-return:hover {
  background: #d97706 !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
}
.slot-mini-btn-delete:hover {
  background: #ef4444 !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
}

/* Khung tranh minh hoa y khoa lam sang */
.slot-illustration-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8fafc;
  border-radius: 6px;
}
.slot-illustration-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.94;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.photo-slot:hover .slot-illustration-img {
  transform: scale(1.04);
}

.slot-illustration-tag {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1.5px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  z-index: 2;
  pointer-events: none;
}

.slot-empty-prompt {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.75), transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  z-index: 2;
  pointer-events: none;
}
.photo-slot:hover .slot-empty-prompt {
  opacity: 1;
  transform: translateY(0);
}
.prompt-icon {
  font-size: 0.75rem;
}
.prompt-text {
  font-size: 0.65rem;
  font-weight: 700;
  color: #ffffff;
}

/* O bo sung: thiet ke toi gian, sach se, bo tag chu */
.slot-placeholder-other {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  margin: 6px;
  box-sizing: border-box;
  color: #94a3b8;
  transition: all 0.2s ease;
}
.photo-slot:hover .slot-placeholder-other {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0284c7;
}
.slot-other-icon {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  transition: transform 0.2s ease;
}
.photo-slot:hover .slot-other-icon {
  transform: scale(1.15);
}

/* Tinh chinh dac thu o Panorama & Cephalo vua van khung hinh */
#slot-rad_pano .slot-illustration-container,
#slot-rad_ceph .slot-illustration-container {
  padding: 8px 16px;
  background: #f8fafc;
  box-sizing: border-box;
}
#slot-rad_pano .slot-illustration-img,
#slot-rad_ceph .slot-illustration-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain !important;
}
