/* ==========================================================
   Makalah & Kerangka Skripsi (bisagratis.com/makalah/)
   ========================================================== */
.mk-workspace {
  flex-direction: row !important;
}
.mk-sidebar {
  width: 248px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, .45);
}
.mk-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 13.5px;
}
.mk-side-order { display: flex; gap: 4px; }
.mk-slide-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mk-slide-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mk-slide-row.is-sub { padding-left: 14px; }
.mk-slide-row.is-sub .mk-slide-tab {
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 500;
}
.mk-slide-tab {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, .72);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mk-slide-add {
  flex: 0 0 auto;
  width: 28px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, .82);
  font-weight: 800;
  color: var(--brand-dark);
  cursor: pointer;
}
.mk-slide-add:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.mk-slide-tab:hover { background: #fff; }
.mk-slide-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.mk-side-add {
  padding: 10px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mk-side-add .tb-select { width: 100%; }
.mk-canvas-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mk-rte {
  padding: 6px 10px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, .62);
}
.rte-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.mk-rte .tb-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.rte-words {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 4px;
}

.mk-body h3 { margin: 4mm 0 2mm; font-size: 1.05em; font-weight: 700; }
.mk-body blockquote {
  margin: 3mm 0 3mm 10mm;
  padding-left: 4mm;
  border-left: 2px solid #94A3B8;
  color: #334155;
}
.mk-body ul, .mk-body ol { margin: 2mm 0; padding-left: 7mm; }
.mk-table {
  width: 100%;
  border-collapse: collapse;
  margin: 3mm 0;
  font-size: .92em;
}
.mk-table th, .mk-table td {
  border: 1px solid #333;
  padding: 1.5mm 2.5mm;
  text-align: left;
}
.mk-table th { background: #F1F5F9; font-weight: 700; }
.mk-img {
  display: block;
  max-width: 100%;
  max-height: 110mm;
  margin: 3mm auto;
  object-fit: contain;
}

.mk-side-close,
.mk-fab,
.mk-backdrop { display: none; }

@media (max-width: 767px) {
  .mk-workspace { flex-direction: column !important; }
  .mk-side-close { display: inline-flex; }
  .mk-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(15, 23, 42, .42);
  }
  .mk-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(290px, 84vw);
    z-index: 45;
    background: rgba(255, 255, 255, .95);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow: 12px 0 36px -16px rgba(15, 23, 42, .35);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  .mk-sidebar.open { transform: translateX(0); }
  .mk-fab {
    display: inline-flex;
    position: fixed;
    left: 12px;
    bottom: 72px;
    z-index: 26;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
  }
  .mk-rte { padding: 6px 8px; }
  /* toolbar teks dibungkus ke beberapa baris, tanpa geser samping */
  .rte-row { flex-wrap: wrap; gap: 4px; }
  .rte-words { margin-left: 0; padding-left: 8px; width: 100%; }
}

/* Kertas A4 Makalah / Skripsi */
.mk-paper {
  box-sizing: border-box;
  position: relative;
  width: var(--pw, 210mm);
  min-height: var(--ph, 297mm);
  padding: var(--mk-pad, 40mm 30mm 30mm 40mm);
  background: #fff;
  color: #111;
  font-family: var(--fb, "Times New Roman", Times, serif);
  font-size: var(--fs, 12pt);
  line-height: var(--mk-lh, 1.5);
  text-align: justify;
}
.mk-paper .mk-h2 {
  margin: 0 0 6mm;
  text-align: center;
  font-family: var(--fh, "Times New Roman", Times, serif);
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.35;
}
.mk-paper .mk-body { min-height: 140mm; white-space: pre-wrap; }
.mk-paper .mk-pagenum {
  position: absolute;
  bottom: 14mm;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11pt;
}

/* Cover */
.mk-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}
.mk-cover-title {
  margin: 4mm 0 0;
  font-family: var(--fh, "Times New Roman", Times, serif);
  font-size: 1.35em;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
}
.mk-cover-sub { font-size: 1em; line-height: 1.45; }
.mk-logo-wrap { margin: 8mm 0; min-height: 34mm; display: grid; place-items: center; }
.mk-logo { max-width: 38mm; max-height: 38mm; object-fit: contain; cursor: pointer; }
.mk-logo-btn { padding: 10px 14px; font-size: 12px; }
.mk-cover-author { font-weight: 600; line-height: 1.5; }
.mk-cover-inst { font-weight: 700; text-transform: uppercase; line-height: 1.45; }

/* Daftar Isi Otomatis */
.mk-toc { display: flex; flex-direction: column; gap: 2.5mm; margin-top: 4mm; }
.mk-toc-row { display: flex; align-items: baseline; gap: 2mm; text-align: left; }
.mk-toc-label { flex: 0 1 auto; }
.mk-toc-dots { flex: 1 0 10mm; border-bottom: 1px dotted #444; }
.mk-toc-num { flex: 0 0 auto; font-weight: 600; }
.mk-toc-note { margin-top: 6mm; font-size: 10pt; color: #64748B; font-style: italic; text-align: center; }

@media print {
  .mk-paper {
    box-shadow: none !important;
    page-break-after: always;
    break-after: page;
  }
  .mk-paper:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}
