.ed72-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:18px}.ed72-box{border:1px solid #d5e1ea;border-radius:13px;padding:16px;min-width:0}.ed72-tools{display:flex;flex-wrap:wrap;gap:5px;padding:10px;background:#f5f8fb;border:1px solid #d9e3ec;border-radius:10px;position:sticky;top:5px;z-index:2}.ed72-tools button{border:1px solid #cbd5e1;border-radius:7px;background:white;color:#153052;padding:7px 10px;cursor:pointer}.ed72-edit{border:1px solid #cad6e3;border-radius:9px;background:#ffffff;color:#172033;padding:14px;min-height:125px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}.ed72-edit:focus{outline:2px solid #1f7cc2}.ed72-choice .ed72-edit{min-height:55px}.ed72-preview{overflow-wrap:anywhere;line-height:1.8}.ed72-preview [dir=rtl],.ed72-edit [dir=rtl]{text-align:right;unicode-bidi:isolate}.ed72-preview table,.ed72-edit table,.cbt72-rich table{border-collapse:collapse;max-width:100%}.ed72-preview td,.ed72-edit td,.cbt72-rich td,.ed72-preview th,.ed72-edit th,.cbt72-rich th{border:1px solid #9ca3af;padding:7px}.ed72-preview blockquote,.ed72-edit blockquote{padding:9px 14px;border-inline-start:3px solid #64748b;background:#f7f9fc}@media(max-width:920px){.ed72-grid{grid-template-columns:1fr}}

.ed72-edit img,.ed72-preview img,.cbt72-rich img{max-width:100%;height:auto;vertical-align:middle}.ed72-edit img[data-align="center"],.ed72-preview img[data-align="center"],.cbt72-rich img[data-align="center"]{display:block;margin:10px auto}.ed72-edit img[data-align="left"],.ed72-preview img[data-align="left"],.cbt72-rich img[data-align="left"]{display:block;margin:10px auto 10px 0}.ed72-edit img[data-align="right"],.ed72-preview img[data-align="right"],.cbt72-rich img[data-align="right"]{display:block;margin:10px 0 10px auto}.ed72-edit img{cursor:pointer}.ed72-edit img:focus{outline:2px solid #0f6c9e}

/* PATCH 08P.7C.4 — image rows and connected choice labels */
.ed72-edit [data-layout^="images-"],.ed72-preview [data-layout^="images-"],.cbt72-rich [data-layout^="images-"]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-items:start;margin:10px 0;white-space:normal}
.ed72-edit [data-layout="images-3"],.ed72-preview [data-layout="images-3"],.cbt72-rich [data-layout="images-3"]{grid-template-columns:repeat(3,minmax(0,1fr))}
.ed72-edit [data-layout^="images-"]>div,.ed72-preview [data-layout^="images-"]>div,.cbt72-rich [data-layout^="images-"]>div{min-width:0;min-height:50px;overflow-wrap:anywhere}
.ed72-edit [data-layout^="images-"]>div{border:1px dashed #bccdda;border-radius:7px;padding:6px}
.ed72-edit [data-layout^="images-"] img,.ed72-preview [data-layout^="images-"] img,.cbt72-rich [data-layout^="images-"] img{max-width:100%;height:auto;object-fit:contain}
.ed74-answer-row{display:flex;align-items:flex-start;gap:11px;margin:14px 0;min-width:0}
.ed74-answer-label{font-weight:700;flex:0 0 28px;line-height:1.8}
.ed74-answer-content{flex:1;min-width:0}
.ed74-answer-content>:first-child{margin-top:0}
.ed74-answer-content>:last-child{margin-bottom:0}
@media(max-width:500px){.ed72-edit [data-layout="images-3"],.ed72-preview [data-layout="images-3"],.cbt72-rich [data-layout="images-3"]{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* PATCH 08P.7C.4.1 — real table cells prevent contenteditable breaking image grids */
.ed72-edit table[data-layout^="images-"],.ed72-preview table[data-layout^="images-"],.cbt72-rich table[data-layout^="images-"]{display:table!important;width:100%!important;table-layout:fixed;border:0!important;border-collapse:separate!important;border-spacing:8px!important;white-space:normal!important;margin:12px 0!important}
.ed72-edit table[data-layout^="images-"] td,.ed72-preview table[data-layout^="images-"] td,.cbt72-rich table[data-layout^="images-"] td{display:table-cell!important;width:auto!important;vertical-align:top;border:0!important;padding:7px!important;overflow-wrap:anywhere;min-width:0}
.ed72-edit table[data-layout^="images-"] td{border:1px dashed #94a3b8!important;background:#f8fbfd;cursor:text;min-height:60px}
.ed72-edit table[data-layout^="images-"] img,.ed72-preview table[data-layout^="images-"] img,.cbt72-rich table[data-layout^="images-"] img{display:block!important;margin:4px auto!important;max-width:100%!important;height:auto!important;object-fit:contain}
.ed74-answer-row{display:flex!important;gap:10px!important;align-items:flex-start!important}
.ed74-answer-label{display:block!important;flex:0 0 26px!important}
.ed74-answer-content{display:block!important;flex:1 1 auto!important;min-width:0!important}

/* 08P.7C.4.2: bounded semantic image table (no horizontal overflow).
   table DOM remains intact for existing sanitizer and saved versions. */
.ed72-grid, .ed72-grid > .ed72-box, .ed72-edit, .ed72-preview {min-width:0!important;max-width:100%;box-sizing:border-box;}
.ed72-grid{width:100%;}
.ed72-edit,.ed72-preview {overflow-x:auto;overflow-wrap:anywhere;}
.ed72-edit table[data-layout^="images-"],
.ed72-preview table[data-layout^="images-"],
.cbt72-rich table[data-layout^="images-"] {
 display:block!important;width:100%!important;max-width:100%!important;
 box-sizing:border-box!important;table-layout:auto!important;
 border-collapse:separate!important;border-spacing:0!important;
 margin:12px 0!important;overflow:visible!important;
}
.ed72-edit table[data-layout^="images-"] > tbody,
.ed72-preview table[data-layout^="images-"] > tbody,
.cbt72-rich table[data-layout^="images-"] > tbody {display:block!important;max-width:100%!important;}
.ed72-edit table[data-layout^="images-"] tr,
.ed72-preview table[data-layout^="images-"] tr,
.cbt72-rich table[data-layout^="images-"] tr {
 display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));
 gap:8px;max-width:100%!important;min-width:0!important;
}
.ed72-edit table[data-layout="images-3"] tr,
.ed72-preview table[data-layout="images-3"] tr,
.cbt72-rich table[data-layout="images-3"] tr {grid-template-columns:repeat(3,minmax(0,1fr));}
.ed72-edit table[data-layout^="images-"] td,
.ed72-preview table[data-layout^="images-"] td,
.cbt72-rich table[data-layout^="images-"] td {
 display:block!important;width:auto!important;min-width:0!important;max-width:100%!important;
 box-sizing:border-box!important;overflow:hidden!important;
 padding:6px!important;overflow-wrap:anywhere;word-break:break-word;
}
.ed72-edit table[data-layout^="images-"] img,
.ed72-preview table[data-layout^="images-"] img,
.cbt72-rich table[data-layout^="images-"] img {
 display:block!important;max-width:100%!important;width:auto;
 height:auto!important;margin:4px auto!important;object-fit:contain;
}
.ed72-preview .ed74-answer-row,.ed74-answer-row {display:flex!important;max-width:100%;min-width:0;align-items:flex-start;gap:10px;}
.ed74-answer-label{flex:0 0 24px!important;white-space:nowrap;}
.ed74-answer-content{flex:1 1 0!important;min-width:0!important;max-width:calc(100% - 34px);}
@media(max-width:520px){
 .ed72-edit table[data-layout="images-3"] tr,
 .ed72-preview table[data-layout="images-3"] tr,
 .cbt72-rich table[data-layout="images-3"] tr {grid-template-columns:repeat(2,minmax(0,1fr));}
}

/* PATCH 08P.7C.4.3 — respect explicitly chosen image width in editor AND preview.
   Inline JS width keeps dimensions stable; no cell stretching or horizontal overflow. */
.ed72-edit img[width],.ed72-preview img[width],.cbt72-rich img[width]{
  max-width:100%!important;height:auto!important;min-width:0!important;
  object-fit:contain!important;flex-shrink:1;
}
.ed72-edit table[data-layout^="images-"] td img[width],
.ed72-preview table[data-layout^="images-"] td img[width],
.cbt72-rich table[data-layout^="images-"] td img[width]{
  max-width:100%!important;height:auto!important;min-width:0!important;
}

/* 08P.7C.4.4: compact fixed-column image layout, neutralize native table minimum widths */
.ed72-grid{width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)!important}
.ed72-grid>.ed72-box{min-width:0!important;max-width:100%!important;box-sizing:border-box!important}
.ed72-edit,.ed72-preview{width:100%;min-width:0!important;max-width:100%!important;box-sizing:border-box!important;overflow-x:clip!important}
.ed72-edit table[data-layout^="images-"],.ed72-preview table[data-layout^="images-"],.cbt72-rich table[data-layout^="images-"]{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;width:100%!important;min-width:0!important;max-width:100%!important;box-sizing:border-box!important;border-collapse:separate!important;border-spacing:0!important;padding:0!important;margin:10px 0!important;overflow:clip!important}
.ed72-edit table[data-layout="images-3"],.ed72-preview table[data-layout="images-3"],.cbt72-rich table[data-layout="images-3"]{grid-template-columns:repeat(3,minmax(0,1fr))!important}
.ed72-edit table[data-layout^="images-"]>tbody,.ed72-preview table[data-layout^="images-"]>tbody,.cbt72-rich table[data-layout^="images-"]>tbody,.ed72-edit table[data-layout^="images-"]>tbody>tr,.ed72-preview table[data-layout^="images-"]>tbody>tr,.cbt72-rich table[data-layout^="images-"]>tbody>tr{display:contents!important}
.ed72-edit table[data-layout^="images-"] td,.ed72-preview table[data-layout^="images-"] td,.cbt72-rich table[data-layout^="images-"] td{display:block!important;min-width:0!important;max-width:100%!important;width:auto!important;box-sizing:border-box!important;overflow:hidden!important;padding:6px!important;margin:0!important}
.ed72-edit table[data-layout^="images-"] td img,.ed72-preview table[data-layout^="images-"] td img,.cbt72-rich table[data-layout^="images-"] td img{display:block!important;max-width:100%!important;min-width:0!important;height:auto!important;object-fit:contain!important;margin:4px auto!important}
.ed72-preview .ed74-answer-row{display:flex!important;min-width:0!important;max-width:100%!important}
.ed72-preview .ed74-answer-content{min-width:0!important;max-width:calc(100% - 34px)!important;overflow-wrap:anywhere}
@media(max-width:920px){.ed72-grid{grid-template-columns:minmax(0,1fr)!important}}
@media(max-width:460px){.ed72-edit table[data-layout="images-3"],.ed72-preview table[data-layout="images-3"]{gap:4px!important}}

/* 08P.7C.4.5 Flexible image gallery — compact or equal columns, server-whitelisted metadata. */
.ed72-edit table[data-layout^="images-"][data-mode],
.ed72-preview table[data-layout^="images-"][data-mode],
.cbt72-rich table[data-layout^="images-"][data-mode]{
 --gallery-cols:3;--gallery-gap:4px;
 display:grid!important;
 grid-template-columns:repeat(var(--gallery-cols),minmax(0,1fr))!important;
 gap:var(--gallery-gap)!important;
 border:0!important;border-spacing:0!important;
 padding:0!important;margin:8px 0!important;
 max-width:100%!important;box-sizing:border-box!important;
 min-width:0!important;overflow:visible!important;
}
.ed72-edit table[data-mode="compact"],
.ed72-preview table[data-mode="compact"],
.cbt72-rich table[data-mode="compact"]{
 width:100%!important;
 justify-content:start!important;
}
.ed72-edit table[data-mode="equal"],
.ed72-preview table[data-mode="equal"],
.cbt72-rich table[data-mode="equal"]{width:100%!important;}
.ed72-edit table[data-columns="1"],.ed72-preview table[data-columns="1"],.cbt72-rich table[data-columns="1"]{--gallery-cols:1!important}
.ed72-edit table[data-columns="2"],.ed72-preview table[data-columns="2"],.cbt72-rich table[data-columns="2"]{--gallery-cols:2!important}
.ed72-edit table[data-columns="3"],.ed72-preview table[data-columns="3"],.cbt72-rich table[data-columns="3"]{--gallery-cols:3!important}
.ed72-edit table[data-columns="4"],.ed72-preview table[data-columns="4"],.cbt72-rich table[data-columns="4"]{--gallery-cols:4!important}
.ed72-edit table[data-columns="5"],.ed72-preview table[data-columns="5"],.cbt72-rich table[data-columns="5"]{--gallery-cols:5!important}
.ed72-edit table[data-columns="6"],.ed72-preview table[data-columns="6"],.cbt72-rich table[data-columns="6"]{--gallery-cols:6!important}
.ed72-edit table[data-gap="0"],.ed72-preview table[data-gap="0"],.cbt72-rich table[data-gap="0"]{--gallery-gap:0px!important}
.ed72-edit table[data-gap="2"],.ed72-preview table[data-gap="2"],.cbt72-rich table[data-gap="2"]{--gallery-gap:2px!important}
.ed72-edit table[data-gap="4"],.ed72-preview table[data-gap="4"],.cbt72-rich table[data-gap="4"]{--gallery-gap:4px!important}
.ed72-edit table[data-gap="6"],.ed72-preview table[data-gap="6"],.cbt72-rich table[data-gap="6"]{--gallery-gap:6px!important}
.ed72-edit table[data-gap="8"],.ed72-preview table[data-gap="8"],.cbt72-rich table[data-gap="8"]{--gallery-gap:8px!important}
.ed72-edit table[data-gap="10"],.ed72-preview table[data-gap="10"],.cbt72-rich table[data-gap="10"]{--gallery-gap:10px!important}
.ed72-edit table[data-gap="12"],.ed72-preview table[data-gap="12"],.cbt72-rich table[data-gap="12"]{--gallery-gap:12px!important}
.ed72-edit table[data-gap="14"],.ed72-preview table[data-gap="14"],.cbt72-rich table[data-gap="14"]{--gallery-gap:14px!important}
.ed72-edit table[data-gap="16"],.ed72-preview table[data-gap="16"],.cbt72-rich table[data-gap="16"]{--gallery-gap:16px!important}
.ed72-edit table[data-gap="18"],.ed72-preview table[data-gap="18"],.cbt72-rich table[data-gap="18"]{--gallery-gap:18px!important}
.ed72-edit table[data-gap="20"],.ed72-preview table[data-gap="20"],.cbt72-rich table[data-gap="20"]{--gallery-gap:20px!important}
.ed72-edit table[data-gap="22"],.ed72-preview table[data-gap="22"],.cbt72-rich table[data-gap="22"]{--gallery-gap:22px!important}
.ed72-edit table[data-gap="24"],.ed72-preview table[data-gap="24"],.cbt72-rich table[data-gap="24"]{--gallery-gap:24px!important}

/* Empty image cells and fitted thumbnails. Individual image width remains authoritative. */
.ed72-edit table[data-mode] td,.ed72-preview table[data-mode] td,.cbt72-rich table[data-mode] td{box-sizing:border-box!important;min-width:0!important;max-width:100%!important;width:auto!important;overflow:hidden!important;padding:4px!important;margin:0!important}
.ed72-edit table[data-mode] td img,.ed72-preview table[data-mode] td img,.cbt72-rich table[data-mode] td img{display:block!important;max-width:100%!important;height:auto!important;object-fit:contain!important;margin:2px auto!important}
@media(max-width:650px){.ed72-edit table[data-mode],.ed72-preview table[data-mode],.cbt72-rich table[data-mode]{grid-template-columns:repeat(auto-fit,minmax(min(100%,90px),1fr))!important;width:100%!important}}

/* Conservative widths avoid browser-specific typed CSS arithmetic. */
.ed72-edit table[data-mode="compact"][data-columns="1"],.ed72-preview table[data-mode="compact"][data-columns="1"],.cbt72-rich table[data-mode="compact"][data-columns="1"]{width:min(100%,112px)!important}
.ed72-edit table[data-mode="compact"][data-columns="2"],.ed72-preview table[data-mode="compact"][data-columns="2"],.cbt72-rich table[data-mode="compact"][data-columns="2"]{width:min(100%,228px)!important}
.ed72-edit table[data-mode="compact"][data-columns="3"],.ed72-preview table[data-mode="compact"][data-columns="3"],.cbt72-rich table[data-mode="compact"][data-columns="3"]{width:min(100%,344px)!important}
.ed72-edit table[data-mode="compact"][data-columns="4"],.ed72-preview table[data-mode="compact"][data-columns="4"],.cbt72-rich table[data-mode="compact"][data-columns="4"]{width:min(100%,460px)!important}
.ed72-edit table[data-mode="compact"][data-columns="5"],.ed72-preview table[data-mode="compact"][data-columns="5"],.cbt72-rich table[data-mode="compact"][data-columns="5"]{width:min(100%,576px)!important}
.ed72-edit table[data-mode="compact"][data-columns="6"],.ed72-preview table[data-mode="compact"][data-columns="6"],.cbt72-rich table[data-mode="compact"][data-columns="6"]{width:min(100%,692px)!important}

/* Tahap X.5: ensure readable inherited text in all rich editors under dark themes. Inline author colors remain respected. */
.ed72-edit{color:#172033!important;caret-color:#172033;color-scheme:light}
.ed72-edit:empty:before{color:#64748b}

/* X.5.1: readable editor even with theme overrides; author-specified inline colors are untouched. */
#cbt-manual-form .ed72-edit[contenteditable="true"] {
  background-color:#ffffff !important;
  color:#172033 !important;
  -webkit-text-fill-color:#172033;
  caret-color:#172033 !important;
  color-scheme:light;
}
#cbt-manual-form .ed72-edit[contenteditable="true"]:focus { background-color:#ffffff !important; }
#cbt-manual-form .ed72-edit[contenteditable="true"] table td,
#cbt-manual-form .ed72-edit[contenteditable="true"] table th {color:#172033 !important;}
