:root {
  --ink: #18181b;
  --ink-muted: #71717a;
  --line: #e4e4e7;
  --line-dark: #d4d4d8;
  --surface: #ffffff;
  --surface-tint: #fafafa;
  --surface-head: #f4f4f5;
  --desk-bg: #eceef1;
  --slate-banner: #27272a;
  --ice-blue: #fafafa;
  --steel-blue: #f4f4f5;
  --accent: #27272a;
  --status-review-bg: #FCC963;
  --status-review-fg: #2e2c2a;
  --status-approved-bg: #A8B49A;
  --status-approved-fg: #212b1e;
  --status-revise-bg: #FCC963;
  --status-revise-fg: #2e2c2a;
  --status-pending-bg: #FCC963;
  --status-pending-fg: #2e2c2a;
  --status-progress-bg: #FCC963;
  --status-progress-fg: #2e2c2a;
  --status-closed-bg: #A8B49A;
  --status-closed-fg: #212b1e;
  --font-main: "Sarabun", "Noto Sans Thai", "Leelawadee UI", "Tahoma", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink);
  background: var(--desk-bg);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Stage & 16:9 Slide Container
   ========================================================================== */
.stage {
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slides-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.slide-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}

.slide-top-bar {
  width: 1280px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.slide-page-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.slide-control-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.slide-control-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.layout-icon-strip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #ffffff;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  padding: 2px;
}

.layout-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.layout-icon-btn svg {
  width: 22px;
  height: 15px;
  display: block;
}

.layout-icon-btn:hover {
  background: var(--surface-head);
  color: var(--ink);
}

.layout-icon-btn.is-active {
  background: var(--slate-banner);
  color: #ffffff;
}

.mini-seg {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  overflow: hidden;
}

.mini-seg-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.mini-seg-btn + .mini-seg-btn {
  border-left: 1px solid var(--line);
}

.mini-seg-btn:hover {
  background: var(--surface-head);
  color: var(--ink);
}

.mini-seg-btn.is-active {
  background: var(--slate-banner);
  color: #ffffff;
}

.mini-seg-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  padding: 0 7px;
  min-width: 34px;
  text-align: center;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.slide-indicator {
  font-size: 11px;
  font-weight: 600;
  color: #52525b;
  white-space: nowrap;
}

.slide-frame {
  --ink: var(--doc-ink, #18181b);
  font-family: var(--doc-font, var(--font-main));
  color: var(--ink);
  width: 1280px;
  height: 720px;
  aspect-ratio: 16 / 9;
  background: #ffffff;
  border: 1px solid var(--line-dark);
  box-shadow: 0 10px 30px rgba(24, 24, 27, 0.12);
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Unified Top Header Row (Logo + 7-Column Project / Doc No. Header Grid)
   ========================================================================== */
.sr-top-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex: 0 0 auto;
}

.slide-logo-box {
  position: relative;
  width: 108px;
  height: 52px;
  flex: 0 0 auto;
  border: 1.25px dashed var(--line-dark);
  border-radius: 4px;
  background: var(--surface-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  cursor: pointer;
  overflow: hidden;
  outline: none;
}

.slide-logo-box:hover,
.slide-logo-box:focus,
.slide-logo-box.is-dragover {
  border-color: var(--slate-banner);
  background: var(--surface-head);
}

.slide-logo-box.has-logo {
  border-color: transparent;
  background: transparent;
  padding: 0 2px;
}

.slide-logo-box.has-logo:hover {
  border-color: var(--line-dark);
  background: var(--surface-tint);
}

.slide-logo-box img {
  max-width: 104px;
  max-height: 48px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.slide-logo-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
}

.slide-logo-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--ink);
}

.slide-logo-sub {
  font-size: 8.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.slide-logo-clear {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 15px;
  height: 15px;
  border: none;
  border-radius: 50%;
  background: rgba(24, 24, 27, 0.8);
  color: #ffffff;
  font-size: 11px;
  line-height: 15px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.slide-logo-box:hover .slide-logo-clear {
  opacity: 1;
}

.sr-header-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 16% 8.5% 15% 15% 16.5% 8% 21%;
  grid-template-rows: 25px 25px;
  border: 1px solid #e4e4e7;
  background: #ffffff;
}

.sr-cell {
  display: flex;
  align-items: center;
  padding: 0 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
  gap: 4px;
}

.sr-cell-project {
  grid-column: 1 / 3;
  background: var(--surface-head);
}

.sr-cell-docno {
  grid-column: 3;
  background: #ffffff;
}

.sr-cell-reviewed-lbl {
  background: var(--surface-tint);
}

.sr-cell-reviewed-val {
  background: #ffffff;
}

.sr-cell-date-lbl {
  background: var(--surface-head);
}

.sr-cell-date-val {
  background: #ffffff;
  border-right: none;
  justify-content: center;
}

.sr-cell-stage,
.sr-cell-part,
.sr-cell-watermark-val {
  background: #ffffff;
  border-bottom: none;
}

.sr-cell-part {
  grid-column: 2 / 4;
}

.sr-cell-watermark-lbl {
  background: var(--surface-tint);
  border-bottom: none;
}

.sr-cell-status-lbl {
  background: var(--surface-head);
  border-bottom: none;
}

.sr-cell-status-val {
  border-right: none;
  border-bottom: none;
  justify-content: center;
  padding: 0 6px;
}

.sr-cell-status-val[data-status="REVIEW"] {
  background: var(--status-review-bg);
  color: var(--status-review-fg);
}

.sr-cell-status-val[data-status="APPROVED"],
.sr-cell-status-val[data-status="DONE"],
.sr-cell-status-val[data-status="SOLVED"],
.sr-cell-status-val[data-status="CLOSED"] {
  background: var(--status-approved-bg);
  color: var(--status-approved-fg);
}

.sr-cell-status-val[data-status="REVISE"] {
  background: var(--status-revise-bg);
  color: var(--status-revise-fg);
}

.sr-cell-status-val[data-status="OPEN"],
.sr-cell-status-val[data-status="PENDING"] {
  background: var(--status-pending-bg);
  color: var(--status-pending-fg);
}

.sr-cell-status-val[data-status="IN PROGRESS"] {
  background: var(--status-progress-bg);
  color: var(--status-progress-fg);
}

.sr-lbl-static {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  flex: 0 0 auto;
  letter-spacing: 0.1px;
}

.sr-input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: inherit;
  padding: 1px 3px;
  border-radius: 3px;
  outline: none;
}

.sr-input:hover {
  background-color: rgba(255, 255, 255, 0.45);
}

.sr-input:focus {
  background-color: #ffffff;
  box-shadow: inset 0 0 0 1.5px var(--slate-banner);
}

.sr-cell-stage .sr-header-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 1px 16px 1px 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='none' stroke='%2352525b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 10px 10px;
}

.sr-input-center {
  text-align: center;
}

.sr-static-val {
  width: 100%;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: inherit;
  padding: 1px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.sr-date-input {
  font-size: 11px;
  letter-spacing: 0.25px;
}

.sr-status-select {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  outline: none;
}

/* ==========================================================================
   Banner + Main Content Wrapper + Footer
   ========================================================================== */
.sr-board {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: none;
  background: #ffffff;
}

.sr-banner {
  background: var(--slate-banner);
  color: #ffffff;
  padding: 3px 10px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.sr-topic-input {
  width: 100%;
  border: none;
  background: transparent;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  padding: 1px 4px;
  border-radius: 3px;
  outline: none;
}

.sr-topic-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.sr-topic-input:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sr-topic-input:focus {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.sr-slide-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-top: 2px;
  line-height: 1;
}

.sr-page-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #52525b;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ==========================================================================
   Shared Photo Dropzone & Controls (Used across Gallery, Site Insp, Board A-D)
   ========================================================================== */
.sr-photo-slot {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1.25px dashed var(--line-dark);
  background: var(--surface-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sr-photo-slot:hover,
.sr-photo-slot:focus,
.sr-photo-slot.is-dragover {
  border-color: var(--slate-banner);
  background: var(--surface-head);
}

.sr-photo-slot.has-image {
  border: 1px solid #e4e4e7;
  background: #ffffff;
}

.sr-photo-slot.has-image:hover {
  outline: 1.5px solid var(--slate-banner);
}

.sr-photo-slot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform-origin: center center;
  pointer-events: none;
}

.sr-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  color: var(--ink-muted);
  padding: 8px;
}

.sr-photo-placeholder strong {
  font-size: 12px;
  color: var(--ink);
}

.sr-photo-placeholder span {
  font-size: 10.5px;
}

.sr-photo-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 3;
  background: rgba(17, 24, 39, 0.72);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
}

.sr-photo-clear {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 5;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(17, 24, 39, 0.8);
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sr-photo-slot:hover .sr-photo-clear {
  opacity: 1;
}

.sr-photo-adjust-bar {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(17, 24, 39, 0.84);
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.sr-photo-slot:hover .sr-photo-adjust-bar,
.sr-photo-slot:focus-within .sr-photo-adjust-bar {
  opacity: 1;
  pointer-events: auto;
}

.sr-adj-btn {
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
}

.sr-adj-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.sr-adj-btn.is-active {
  background: #ffffff;
  color: #111827;
}

.sr-adj-sep {
  width: 1px;
  height: 11px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 2px;
}

/* ==========================================================================
   Format 1: Review Gallery
   ========================================================================== */
.rv-body {
  flex: 1;
  min-height: 0;
  padding: 8px 0 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--notes-pct, 29%);
  gap: 10px;
  position: relative;
}

.rv-body.is-caption-layout {
  grid-template-columns: 1fr;
}

.rv-photos-area {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 6px;
}

.rv-photos-area[data-layout="2tall-2stack"] {
  grid-template-columns: 1.16fr 1fr 1.04fr;
  grid-template-rows: 42% minmax(0, 1fr);
}

.rv-photos-area[data-layout="2tall-2stack"] .sr-photo-slot[data-slot-idx="0"] {
  grid-column: 1;
  grid-row: 1 / 3;
}

.rv-photos-area[data-layout="2tall-2stack"] .sr-photo-slot[data-slot-idx="1"] {
  grid-column: 2;
  grid-row: 1 / 3;
}

.rv-photos-area[data-layout="2tall-2stack"] .sr-photo-slot[data-slot-idx="2"] {
  grid-column: 3;
  grid-row: 1;
}

.rv-photos-area[data-layout="2tall-2stack"] .sr-photo-slot[data-slot-idx="3"] {
  grid-column: 3;
  grid-row: 2;
}

.rv-photos-area[data-layout="1-large"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.rv-photos-area[data-layout="2-cols"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.rv-photos-area[data-layout="2-stack"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}

.rv-photos-area[data-layout="3-cols"] {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr;
}

.rv-photos-area[data-layout="3-stack"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr 1fr;
}

.rv-photos-area[data-layout="2x2"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.rv-photos-area[data-layout="4-cols-caption"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 1fr;
  gap: 8px;
}

.rv-photos-area[data-layout="4-rows-caption"] {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.rv-caption-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 26%;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line-dark);
  background: #ffffff;
  overflow: hidden;
}

.rv-photos-area[data-layout="4-rows-caption"] .rv-caption-card {
  grid-template-rows: minmax(0, 1fr) 30px;
}

.rv-caption-card .sr-photo-slot {
  border: none;
}

.rv-caption-box {
  border-top: 1px solid var(--line-dark);
  background: var(--surface-tint);
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.rv-caption-box[data-valign="top"] {
  justify-content: flex-start;
  padding-top: 6px;
}

.rv-photos-area[data-layout="4-rows-caption"] .rv-caption-box {
  padding: 2px 8px;
}

.rv-caption-textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--doc-font, inherit);
  font-size: var(--notes-fs, 14px);
  font-weight: 500;
  line-height: 1.38;
  color: var(--doc-ink, var(--ink));
  resize: none;
  overflow: hidden;
  outline: none;
  padding: 1px 2px;
  border-radius: 3px;
}

.rv-caption-textarea:hover {
  background: rgba(255, 255, 255, 0.55);
}

.rv-caption-textarea:focus {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line-dark);
}

.rv-caption-textarea::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.rv-photos-area[data-layout="custom"] {
  position: relative;
  display: block;
}

.sr-photo-slot.is-custom {
  position: absolute;
  width: auto;
  height: auto;
}

.sr-photo-slot.is-dragging-frame {
  z-index: 12;
  outline: 2px solid var(--slate-banner) !important;
  box-shadow: 0 8px 20px rgba(24, 24, 27, 0.18);
}

.rv-frame-handle {
  position: absolute;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.14s ease, background-color 0.14s ease;
}

.sr-photo-slot:hover .rv-frame-handle,
.sr-photo-slot:focus-within .rv-frame-handle,
.sr-photo-slot.is-dragging-frame .rv-frame-handle {
  opacity: 1;
}

.rv-frame-handle-e { top: 10px; bottom: 14px; right: 0; width: 7px; cursor: ew-resize; }
.rv-frame-handle-w { top: 10px; bottom: 10px; left: 0; width: 7px; cursor: ew-resize; }
.rv-frame-handle-s { left: 10px; right: 14px; bottom: 0; height: 7px; cursor: ns-resize; }
.rv-frame-handle-n { left: 10px; right: 10px; top: 0; height: 7px; cursor: ns-resize; }

.rv-frame-handle-e:hover,
.rv-frame-handle-w:hover,
.rv-frame-handle-s:hover,
.rv-frame-handle-n:hover {
  background: rgba(24, 24, 27, 0.24);
}

.rv-frame-handle-se {
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 45%, rgba(24, 24, 27, 0.72) 45%);
  border-bottom-right-radius: 2px;
}

.rv-frame-move {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(17, 24, 39, 0.78);
  color: #ffffff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  cursor: grab;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.14s ease;
}

.sr-photo-slot:hover .rv-frame-move,
.sr-photo-slot.is-dragging-frame .rv-frame-move {
  opacity: 1;
}

.rv-frame-del {
  position: absolute;
  top: 5px;
  right: 28px;
  z-index: 6;
  border: 1px solid rgba(254, 202, 202, 0.6);
  background: rgba(127, 29, 29, 0.85);
  color: #ffffff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
}

.sr-photo-slot:not(.has-image) .rv-frame-del {
  right: 5px;
}

.sr-photo-slot:hover .rv-frame-del,
.sr-photo-slot:focus-within .rv-frame-del {
  opacity: 1;
}

.rv-notes-col {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 10px 6px;
}

.rv-notes-col[data-valign="middle"] { justify-content: center; }
.rv-notes-col[data-valign="top"] { justify-content: flex-start; padding-top: 14px; }

.rv-notes-resizer {
  position: absolute;
  left: -8px;
  top: 18px;
  bottom: 18px;
  width: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 5;
}

.rv-notes-resizer::after {
  content: "";
  width: 3px;
  height: 44px;
  border-radius: 999px;
  background: var(--line-dark);
}

.rv-notes-resizer:hover::after,
.rv-notes-resizer.is-dragging::after {
  height: 68px;
  background: var(--slate-banner);
}

.rv-notes-textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--notes-fs, 16px);
  font-weight: 500;
  line-height: 1.95;
  color: var(--ink);
  resize: none;
  outline: none;
  padding: 6px 8px;
  border-radius: 4px;
  overflow-y: auto;
  max-height: 100%;
}

.rv-notes-textarea:hover { background: var(--surface-tint); }
.rv-notes-textarea:focus { background: #ffffff; box-shadow: inset 0 0 0 1px var(--line-dark); }

/* ==========================================================================
   Format 2: Site Inspection Body (4 Panels inside sr-board)
   ========================================================================== */
.sr-body-padded {
  flex: 1;
  min-height: 0;
  padding: 8px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slide-columns {
  display: grid;
  grid-template-columns: var(--sw-left-pct, 41%) 1fr;
  gap: 10px;
  flex: 1;
  min-height: 0;
  position: relative;
}

.sw-col-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--sw-left-pct, 41%) - 1px);
  width: 8px;
  cursor: ew-resize;
  z-index: 8;
}

.sw-col-resizer::after {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background-color 0.14s ease;
}

.sw-col-resizer:hover::after,
.sw-col-resizer.is-dragging::after {
  background: #2563eb;
}

.left-column-stack,
.right-column-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.panel-issue { position: relative; flex: 0 0 auto; }
.panel-root-cause { flex: 1 1 0; min-height: 0; overflow: hidden; }
.panel-compare { position: relative; flex: 0 0 auto; }
.panel-compare.has-custom-h { flex: 0 0 var(--cmp-panel-h); height: var(--cmp-panel-h); overflow: hidden; }
.panel-compare.has-custom-h > .panel-body { overflow: auto; flex: 1 1 0; min-height: 0; }
.panel-compare.has-custom-h .cmp-photo-comment-split,
.panel-compare.has-custom-h .cmp-photo-grid,
.panel-compare.has-custom-h .cmp-comment-col { min-height: 0; height: 100%; }
.panel-solution { flex: 1 1 0; min-height: 0; overflow: hidden; }
.panel-solution > .panel-body { overflow: hidden; min-height: 0; }

.panel {
  border: 1px solid var(--line-dark);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  background: var(--surface-head);
  border-bottom: 1px solid var(--line-dark);
  padding: 3.5px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.panel-tag {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.4px;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.panel-header > .panel-actions {
  margin-left: auto;
}

.panel-actions .mini-seg-btn {
  font-size: 9px;
  padding: 1.5px 5px;
}

.mini-btn {
  border: 1px solid var(--line-dark);
  background: #ffffff;
  color: var(--ink);
  border-radius: 3px;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 600;
  padding: 0 5px;
  cursor: pointer;
}

.mini-btn:hover { background: var(--surface-head); }
.mini-btn.is-active { background: var(--slate-banner); border-color: var(--slate-banner); color: #ffffff; }

.panel-body {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.panel-body-tight { gap: 5px; }

.issue-photo-grid {
  flex: 0 0 var(--issue-grid-h, 330px);
  height: var(--issue-grid-h, 330px);
  display: grid;
  gap: 6px;
  min-height: 0;
}

.issue-photo-grid[data-count="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.issue-photo-grid[data-count="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.issue-photo-grid[data-count="3"],
.issue-photo-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.issue-photo-grid[data-count="3"] .sr-photo-slot:nth-child(3) { grid-column: span 2; }
.issue-photo-grid[data-layout="vertical"][data-count="2"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.issue-photo-grid[data-layout="vertical"][data-count="3"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr 1fr; }
.issue-photo-grid[data-layout="vertical"][data-count="3"] .sr-photo-slot:nth-child(3) { grid-column: auto; }
.issue-photo-grid[data-layout="vertical"][data-count="4"] { grid-template-columns: 1fr; grid-template-rows: repeat(4, minmax(0, 1fr)); }

.col-resizer-h {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -8px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  z-index: 6;
}

.col-resizer-h::after {
  content: "";
  width: 46px;
  height: 3px;
  border-radius: 999px;
  background: var(--line-dark);
}

.col-resizer-h:hover::after,
.col-resizer-h.is-dragging::after {
  width: 72px;
  background: var(--slate-banner);
}

.panel-textarea,
.inline-field,
.cmp-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink);
  padding: 2px 4px;
  border-radius: 2px;
}

.panel-textarea { resize: none; overflow: hidden; }
.panel-textarea.grow { flex: 1; }
.panel-textarea:hover, .inline-field:hover, .cmp-input:hover { border-color: var(--line); background: var(--surface-tint); }
.panel-textarea:focus, .inline-field:focus, .cmp-input:focus { outline: none; border-color: #71717a; background: #ffffff; }

.compare-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--cmp-photo-pct, 36%);
  gap: 8px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.cmp-photo-comment-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--cmp-comment-pct, 34%);
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  flex: 1 1 auto;
  min-height: 148px;
  align-items: stretch;
}

.cmp-photo-grid {
  flex: 1 1 0 !important;
  height: 100% !important;
  min-height: 148px;
}

.cmp-comment-col {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface-tint);
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 148px;
  min-width: 0;
}

.cmp-comment-col .col-resizer-v {
  left: -8px;
}

.compare-table-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sw-cmp-photo-wrap {
  position: relative;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sw-cmp-photo-wrap .sr-photo-slot {
  flex: 1;
  min-height: 120px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  table-layout: fixed;
}

.compare-table th {
  position: relative;
  background: var(--surface-tint);
  border: 1px solid var(--line-dark);
  padding: 2.5px 4px;
  text-align: left;
  font-size: 8.5px;
  font-weight: 700;
  color: var(--ink-muted);
}

.cmp-col-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -3px;
  width: 6px;
  cursor: col-resize;
  z-index: 6;
}

.cmp-col-resizer::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 2px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background-color 0.14s ease;
}

.cmp-col-resizer:hover::after,
.cmp-col-resizer.is-dragging::after {
  background: #2563eb;
}

.compare-table th.th-check-group,
.compare-table th.th-check-col {
  text-align: center;
  padding: 2px;
  font-size: 8px;
  line-height: 1.15;
}

.compare-table th.th-check-group {
  background: var(--surface-head);
  color: var(--ink);
}

.compare-table td {
  border: 1px solid var(--line);
  padding: 2px 4px;
  vertical-align: top;
}

.cmp-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.cmp-title-input {
  width: 100%;
  min-width: 80px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  padding: 0 3px;
  border-radius: 3px;
}

.cmp-title-input:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.cmp-title-input:focus {
  outline: none;
  border-color: #71717a;
  background: #ffffff;
}

.mini-select {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  max-width: 158px;
}

.cmp-th-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
  min-width: 0;
}

.cmp-th-input.cmp-th-center,
.cmp-th-input.cmp-th-check {
  text-align: center;
}

.cmp-th-input:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.cmp-th-input:focus {
  outline: none;
  border-color: #71717a;
  background: #ffffff;
}

.cmp-impact-lbl-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 8.5px;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 0 2px;
  border-radius: 2px;
  margin-bottom: 1px;
}

.cmp-impact-lbl-input:hover {
  border-color: var(--line);
  background: var(--surface-tint);
}

.cmp-impact-lbl-input:focus {
  outline: none;
  border-color: #71717a;
  background: #ffffff;
}

.cmp-input { font-size: 10px; resize: none; overflow: hidden; display: block; }
.cmp-item-input { font-weight: 700; }
.cmp-check-cell { vertical-align: middle !important; text-align: center; padding: 2px !important; }

.cmp-cell-check-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 22px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 3px;
  padding: 2px;
  cursor: pointer;
}

.cmp-cell-check-btn:hover { background: var(--surface-head); color: var(--ink); }

.check-box-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 9.5px;
  line-height: 1;
}

.cmp-cell-check-btn.is-checked .check-box-mark {
  background: var(--slate-banner);
  color: #ffffff;
  border-color: var(--slate-banner);
  font-weight: 800;
}

.impact-box {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-label {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.35px;
}

.solution-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sol-photo-pct, 38%);
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.solution-split.is-no-photo {
  grid-template-columns: minmax(0, 1fr);
}

.solution-text-col { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }

.sw-sol-photo-wrap {
  position: relative;
  min-height: 0;
  height: min(var(--sol-photo-h, 100%), 100%);
  max-height: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.sw-sol-photo-wrap .sr-photo-slot {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}

.col-resizer-v {
  position: absolute;
  left: -8px;
  top: 10px;
  bottom: 12px;
  width: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 6;
}

.col-resizer-v::after { content: ""; width: 3px; height: 36px; border-radius: 999px; background: var(--line-dark); }
.col-resizer-v:hover::after, .col-resizer-v.is-dragging::after { height: 56px; background: var(--slate-banner); }

.sol-resizer-b {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -7px;
  height: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  z-index: 6;
}

.sol-resizer-b::after { content: ""; width: 36px; height: 3px; border-radius: 999px; background: var(--line-dark); }
.sol-resizer-b:hover::after, .sol-resizer-b.is-dragging::after { width: 56px; background: var(--slate-banner); }

.sol-resizer-bl {
  position: absolute;
  left: -8px;
  bottom: -8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(24, 24, 27, 0.78);
  color: #ffffff;
  font-size: 8px;
  line-height: 12px;
  text-align: center;
  cursor: nesw-resize;
  z-index: 7;
  opacity: 0.78;
}

.owner-bar {
  display: grid;
  grid-template-columns: var(--owner-cols, 1.02fr 0.72fr 1.26fr);
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
  margin-top: auto;
  flex: 0 0 auto;
}

.owner-cell { position: relative; display: flex; flex-direction: column; min-width: 0; }
.owner-cell + .owner-cell { border-left: 1px solid var(--line); padding-left: 7px; }
.inline-field { font-size: 10.5px; font-weight: 600; }

.owner-area {
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
  min-height: 18px;
  display: block;
}

.owner-col-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -6px;
  width: 8px;
  cursor: col-resize;
  z-index: 6;
}

.owner-col-resizer::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background-color 0.14s ease;
}

.owner-col-resizer:hover::after,
.owner-col-resizer.is-dragging::after {
  background: #2563eb;
}

/* ==========================================================================
   Format 3–6: Review Board A–D
   ========================================================================== */
.rb-panel-textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  resize: none;
  outline: none;
  padding: 4px 6px;
  border-radius: 4px;
}

.rb-panel-textarea:hover { background: var(--surface-tint); }
.rb-panel-textarea:focus { background: #ffffff; box-shadow: inset 0 0 0 1px var(--line-dark); }

/* Board A */
.mode-a-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-a-col { border: 1px solid var(--line-dark); display: flex; flex-direction: column; min-height: 0; background: #ffffff; }
.mode-a-head { display: flex; align-items: center; gap: 8px; padding: 4px 9px; border-bottom: 1px solid var(--line-dark); background: var(--surface-head); }
.mode-a-head-input { flex: 1; min-width: 0; border: none; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink); outline: none; }
.mode-a-col-body { flex: 1; min-height: 0; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.mode-a-photos { flex: 1; min-height: 0; display: grid; gap: 7px; }
.mode-a-photos[data-count="1"] { grid-template-columns: 1fr; }
.mode-a-photos[data-count="2"] { grid-template-columns: 1fr 1fr; }
.mode-a-photos[data-count="2"][data-layout="vertical"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.mode-a-notes { flex: 0 0 auto; border-top: 1px solid var(--line); padding-top: 5px; }
.mode-a-meta-bar { display: grid; grid-template-columns: var(--owner-cols, 1.02fr 0.72fr 1.26fr); gap: 6px; border-top: 1px solid var(--line); padding-top: 5px; flex: 0 0 auto; }
.mode-a-meta-cell { position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mode-a-meta-cell + .mode-a-meta-cell { border-left: 1px solid var(--line); padding-left: 7px; }
.mini-lbl { font-size: 9.5px; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.3px; }
.mini-inline-input { width: 100%; border: 1px solid transparent; background: transparent; font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink); outline: none; padding: 2px 4px; border-radius: 2px; }
.mini-inline-input:hover { border-color: var(--line); background: var(--surface-tint); }
.mini-inline-input:focus { border-color: #71717a; background: #ffffff; }

/* Board B */
.mode-b-grid { flex: 1; min-height: 0; display: grid; gap: 9px; }
.mode-b-grid[data-cards="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-b-grid[data-cards="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-b-grid[data-cards="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mode-b-grid[data-layout="vertical"] { grid-template-columns: 1fr; }
.mode-b-grid[data-layout="vertical"][data-cards="2"] { grid-template-rows: repeat(2, minmax(0, 1fr)); }
.mode-b-grid[data-layout="vertical"][data-cards="3"] { grid-template-rows: repeat(3, minmax(0, 1fr)); }
.mode-b-grid[data-layout="vertical"][data-cards="4"] { grid-template-rows: repeat(4, minmax(0, 1fr)); }
.mode-b-grid[data-layout="vertical"] .mode-b-card-body { display: grid; grid-template-columns: 36% minmax(0, 1fr); gap: 8px; padding: 6px; }
.mode-b-grid[data-layout="vertical"] .mode-b-card-notes { border-top: none; border-left: 1px solid var(--line); padding-top: 0; padding-left: 8px; display: flex; flex-direction: column; min-height: 0; }
.mode-b-grid[data-layout="vertical"] .mode-b-card-notes .rb-panel-textarea { flex: 1; height: 100%; }
.mode-b-card { border: 1px solid var(--line-dark); display: flex; flex-direction: column; min-height: 0; background: #ffffff; }
.mode-b-card-head { background: var(--surface-head); border-bottom: 1px solid var(--line-dark); padding: 4px 8px; }
.mode-b-card-title { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink); outline: none; }
.mode-b-card-body { flex: 1; min-height: 0; padding: 7px; display: flex; flex-direction: column; gap: 7px; }
.mode-b-card-photo { flex: 1; min-height: 0; }
.mode-b-card-notes { flex: 0 0 auto; border-top: 1px solid var(--line); padding-top: 4px; }

/* Board C */
.mode-c-split { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--c-left-pct, 43%) minmax(0, 1fr); gap: 10px; }
.mode-c-photos { min-height: 0; display: grid; gap: 7px; }
.mode-c-photos[data-count="1"] { grid-template-rows: 1fr; }
.mode-c-photos[data-count="2"] { grid-template-rows: 1fr 1fr; }
.mode-c-photos[data-count="2"][data-layout="horizontal"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.mode-c-table-wrap { position: relative; min-height: 0; border: 1px solid var(--line-dark); background: #ffffff; display: flex; flex-direction: column; overflow: hidden; }
.mode-c-resizer { position: absolute; left: -8px; top: 16px; bottom: 16px; width: 10px; display: flex; align-items: center; justify-content: center; cursor: ew-resize; z-index: 5; }
.mode-c-resizer::after { content: ""; width: 3px; height: 44px; border-radius: 999px; background: var(--line-dark); }
.mode-c-resizer:hover::after, .mode-c-resizer.is-dragging::after { height: 68px; background: var(--slate-banner); }
.mode-c-table-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.rb-comment-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rb-comment-table th { background: var(--surface-head); color: #334155; font-size: 11px; font-weight: 700; padding: 5px 6px; border-bottom: 1px solid var(--line-dark); border-right: 1px solid var(--line-dark); text-align: left; position: sticky; top: 0; z-index: 2; }
.rb-comment-table th:last-child, .rb-comment-table td:last-child { border-right: none; }
.rb-comment-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 4px 5px; vertical-align: middle; }
.rb-tbl-num { text-align: center; font-weight: 700; font-size: 12px; color: #334155; }
.rb-tbl-textarea { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 12px; line-height: 1.4; color: var(--ink); resize: none; overflow: hidden; outline: none; display: block; }
.rb-tbl-input { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink); outline: none; }
.rb-tbl-status-select { width: 100%; border: none; border-radius: 3px; font-family: inherit; font-size: 11px; font-weight: 700; padding: 3px 2px; text-align: center; text-align-last: center; cursor: pointer; outline: none; }
.rb-tbl-status-select[data-row-status="REVIEW"] { background: var(--status-review-bg); color: var(--status-review-fg); }
.rb-tbl-status-select[data-row-status="REVISE"] { background: var(--status-revise-bg); color: var(--status-revise-fg); }
.rb-tbl-status-select[data-row-status="OK"],
.rb-tbl-status-select[data-row-status="DONE"],
.rb-tbl-status-select[data-row-status="SOLVED"],
.rb-tbl-status-select[data-row-status="CLOSED"] { background: var(--status-approved-bg); color: var(--status-approved-fg); }
.rb-tbl-status-select[data-row-status="OPEN"],
.rb-tbl-status-select[data-row-status="PENDING"] { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.rb-tbl-status-select[data-row-status="IN PROGRESS"] { background: var(--status-progress-bg); color: var(--status-progress-fg); }

/* Board D */
.mode-d-stack { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 9px; }
.mode-d-photos { flex: 1; min-height: 0; display: grid; gap: 8px; }
.mode-d-photos[data-count="1"] { grid-template-columns: 1fr; }
.mode-d-photos[data-count="2"] { grid-template-columns: 1fr 1fr; }
.mode-d-photos[data-count="3"] { grid-template-columns: 1fr 1fr 1fr; }
.mode-d-photos[data-count="2"][data-layout="vertical"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.mode-d-photos[data-count="3"][data-layout="vertical"] { grid-template-columns: 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.mode-d-summary-strip { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mode-d-box { border: 1px solid var(--line-dark); background: var(--surface-tint); padding: 5px 8px; display: flex; flex-direction: column; gap: 2px; }
.mode-d-box-title { border: none; background: transparent; font-family: inherit; font-size: 11.5px; font-weight: 700; color: var(--slate-banner); outline: none; padding: 0; }
.mode-d-box-text { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 500; line-height: 1.45; color: var(--ink); resize: none; outline: none; padding: 0; }

/* Blank / Free Photo Sheet */
.blank-body {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.blank-body.has-text {
  grid-template-columns: minmax(0, 1fr) var(--blank-text-pct, 28%);
}

.blank-photos-grid {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 8px;
}

.blank-photos-grid[data-count="1"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.blank-photos-grid[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}

.blank-photos-grid[data-count="3"] {
  grid-template-columns: 1fr 1fr 1fr;
}

.blank-photos-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.blank-photos-grid[data-count="2"][data-layout="vertical"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}

.blank-photos-grid[data-count="3"][data-layout="vertical"] {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, minmax(0, 1fr));
}

.blank-photos-grid[data-count="4"][data-layout="vertical"] {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.blank-text-col {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-dark);
  background: var(--surface-tint);
  padding: 10px 12px;
}

.blank-text-textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--blank-fs, 16px);
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  resize: none;
  outline: none;
  padding: 0;
}

/* ==========================================================================
   Print Styles (Exact 16:9 PowerPoint PDF)
   ========================================================================== */
@page {
  size: 338.67mm 190.5mm;
  margin: 0;
  @top-left { content: none; }
  @top-center { content: none; }
  @top-right { content: none; }
  @bottom-left { content: none; }
  @bottom-center { content: none; }
  @bottom-right {
    content: counter(page) " / " counter(pages);
    font-family: "Sarabun", "Noto Sans Thai", sans-serif;
    font-size: 9pt;
    font-weight: 600;
    color: #52525b;
    padding: 0 4mm 2mm 0;
  }
}

@media print {
  html,
  body {
    width: 338.67mm;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .no-print {
    display: none !important;
  }

  .stage {
    width: 338.67mm !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    overflow: visible !important;
  }

  .slides-container {
    width: 338.67mm !important;
    display: block !important;
  }

  .slide-wrap {
    gap: 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .slide-wrap + .slide-wrap {
    break-before: page;
    page-break-before: always;
  }

  .slide-frame {
    box-shadow: none !important;
    border: none !important;
    width: 338.67mm !important;
    max-width: none !important;
    aspect-ratio: 16 / 9 !important;
    height: 190.2mm !important;
    max-height: 190.2mm !important;
    padding: 8px 10px 10px !important;
    overflow: hidden !important;
    margin: 0 !important;
  }

  .sr-status-select,
  .rb-tbl-status-select,
  .sr-header-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: none !important;
  }

  .slide-logo-box:not(.has-logo),
  .slide-logo-box:not(.has-logo) .slide-logo-ph,
  .sr-photo-slot:not(.has-image) .sr-photo-placeholder {
    visibility: hidden !important;
    border-color: transparent !important;
    background: transparent !important;
  }
}
