/* D2 Central Rich Text Editor */
.d2-rte-wrap{
  border:1px solid rgba(15,23,42,.16);
  border-radius:16px;
  overflow:hidden;
  background:#fff;
  margin:8px 0 16px;
}

.d2-rte-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  padding:8px;
  background:#f8fafc;
  border-bottom:1px solid rgba(15,23,42,.10);
}

.d2-rte-toolbar button,
.d2-rte-toolbar select,
.d2-rte-toolbar input[type="color"]{
  height:36px;
  border:1px solid rgba(15,23,42,.14);
  background:#fff;
  border-radius:10px;
  padding:0 10px;
  font:inherit;
  cursor:pointer;
}

.d2-rte-toolbar button{
  min-width:36px;
  font-weight:800;
}

.d2-rte-toolbar button:hover,
.d2-rte-toolbar select:hover{
  background:#eef2ff;
}

.d2-rte-color{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:.82rem;
  color:#475569;
}

.d2-rte-editor{
  min-height:240px;
  padding:16px;
  line-height:1.75;
  outline:none;
  background:#fff;
  color:#0f172a;
}

.d2-rte-editor:focus{
  box-shadow:inset 0 0 0 2px rgba(37,99,235,.18);
}

.d2-rte-editor h1,
.d2-rte-editor h2,
.d2-rte-editor h3{
  line-height:1.25;
  margin:.5em 0 .35em;
}

.d2-rte-editor p{
  margin:.45em 0;
}

.d2-rte-editor ul,
.d2-rte-editor ol{
  padding-left:1.5rem;
}

.d2-rte-source{
  display:none !important;
}

.d2-rte-wrap.is-source .d2-rte-editor{
  display:none;
}

.d2-rte-wrap.is-source textarea{
  display:block !important;
  width:100%;
  min-height:260px;
  border:0;
  padding:14px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  font-size:14px;
  line-height:1.6;
  box-sizing:border-box;
}

@media(max-width:760px){
  .d2-rte-toolbar{
    gap:5px;
  }
  .d2-rte-toolbar button,
  .d2-rte-toolbar select{
    height:34px;
    padding:0 8px;
  }
}

/* D2 RTE Font Selector */
.d2-rte-toolbar select{
  min-width:96px;
}
.d2-rte-editor font{
  line-height:inherit;
}

/* D2 Text Pro Canva-like tools */
.d2-rte-plus-sep{
  width:1px;
  height:28px;
  background:rgba(15,23,42,.14);
  margin:0 4px;
}

.d2-rte-plus-select{
  min-width:112px;
  background:#fff7ed !important;
}

.d2-rte-plus-btn{
  background:#fff7ed !important;
}

.d2-text-hero{
  display:block;
  margin:12px 0;
  font-size:clamp(28px,4vw,52px);
  font-weight:900;
  line-height:1.08;
  letter-spacing:-.03em;
  color:#0f172a;
}

.d2-text-notice{
  display:block;
  margin:12px 0;
  padding:14px 16px;
  border-radius:18px;
  border:1px solid rgba(245,158,11,.38);
  background:linear-gradient(135deg,#fff7ed,#fffbeb);
  color:#7c2d12;
  line-height:1.7;
}

.d2-text-info{
  display:block;
  margin:12px 0;
  padding:14px 16px;
  border-radius:18px;
  border:1px solid rgba(59,130,246,.28);
  background:linear-gradient(135deg,#eff6ff,#f8fafc);
  color:#0f172a;
  line-height:1.7;
}

.d2-text-quote{
  display:block;
  margin:14px 0;
  padding:14px 18px;
  border-left:6px solid #2563eb;
  border-radius:14px;
  background:#f8fafc;
  color:#334155;
  font-size:1.05em;
  line-height:1.75;
}

.d2-text-pill{
  display:inline-flex;
  align-items:center;
  padding:5px 12px;
  border-radius:999px;
  background:#e0f2fe;
  color:#075985;
  font-weight:800;
  margin:2px 4px;
}

.d2-text-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin:8px 4px;
  padding:10px 18px;
  border-radius:999px;
  background:#0f172a;
  color:#fff !important;
  text-decoration:none !important;
  font-weight:900;
  box-shadow:0 12px 30px rgba(15,23,42,.18);
}

.d2-text-btn:hover{
  transform:translateY(-1px);
}

.d2-text-hr{
  border:0;
  height:1px;
  margin:22px 0;
  background:linear-gradient(90deg,transparent,#94a3b8,transparent);
}

.d2-text-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  margin:14px 0;
  overflow:hidden;
  border:1px solid #e2e8f0;
  border-radius:16px;
}

.d2-text-table th,
.d2-text-table td{
  padding:12px 14px;
  border-bottom:1px solid #e2e8f0;
  border-right:1px solid #e2e8f0;
  text-align:left;
  vertical-align:top;
}

.d2-text-table th{
  background:#f8fafc;
  font-weight:900;
}

.d2-text-table tr:last-child td{
  border-bottom:0;
}

.d2-text-table th:last-child,
.d2-text-table td:last-child{
  border-right:0;
}

.d2-text-shadow{
  text-shadow:0 3px 12px rgba(15,23,42,.28);
  font-weight:800;
}

.d2-text-outline{
  display:inline-block;
  padding:2px 8px;
  border:2px solid currentColor;
  border-radius:10px;
  font-weight:800;
}

/* D2 Text Pro undo/remove buttons */
.d2-rte-plus-btn[title="ย้อนกลับ"],
.d2-rte-plus-btn[title="ทำซ้ำ"]{
  min-width:40px;
  background:#eef2ff !important;
}

.d2-rte-plus-btn[title="ลบข้อความหรือบล็อกที่เลือก"],
.d2-rte-plus-btn[title="ลบกรอบ/กล่อง/ป้าย Text Pro แต่เก็บข้อความไว้"]{
  background:#fee2e2 !important;
  color:#7f1d1d !important;
}
