﻿/* === Palet Tema (Biru Primer + Amber, terinspirasi Bootstrap) === */
:root {
    --mi-green-900: #084298;
    --mi-green-800: #0a58ca;
    --mi-green-700: #0d6efd;
    --mi-green-600: #3d8bfd;
    --mi-gold-600: #d97706;
    --mi-gold-500: #f59e0b;
    --mi-gold-300: #fcd34d;
}
.font-kufi { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Layout CSS */
body { height: 100vh; overflow: hidden; display: flex; flex-direction: column; background-color: #f1f5f9; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

.editor-container { flex: 1; display: flex; overflow: hidden; }

.sidebar { width: 280px; flex-shrink: 0; background: #e2e8f0; border-right: 1px solid #cbd5e1; display: flex; flex-direction: column; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.dual-pane { flex: 1; display: flex; overflow: hidden; }
@media (max-width: 768px) {
    .dual-pane { flex-direction: column; }
}

.pane { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; }

/* Pane Kiri: Textarea Editor */
#editor-pane { border-right: 1px solid #e2e8f0; background: #ffffff; padding: 0; }
@media (max-width: 768px) { #editor-pane { border-right: none; border-bottom: 1px solid #e2e8f0; } }

#md-input {
    width: 100%; height: 100%; flex: 1; resize: none; border: none; outline: none;
    background: transparent;
    padding: 1.5rem; font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem; line-height: 1.6; color: #334155;
}

/* CodeMirror Panel Editor Styling */
.CodeMirror {
    height: 100% !important;
    flex: 1;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #334155;
    background: #ffffff;
}
.CodeMirror-gutters {
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
}
.CodeMirror-linenumber {
    color: #94a3b8;
    padding: 0 5px 0 8px;
}
.CodeMirror-lines {
    padding: 1rem 0;
}
.CodeMirror-activeline-background {
    background: rgba(241, 245, 249, 0.6) !important;
}

/* CodeMirror Mode Gelap (Dark Mode) — palet slate menyatu dengan chrome aplikasi */
body.dark .CodeMirror {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}
body.dark .CodeMirror-gutters {
    background-color: #0f172a !important;
    border-right-color: #334155 !important;
}
body.dark .CodeMirror-linenumber {
    color: #94a3b8 !important;
}
body.dark .CodeMirror-cursor {
    border-left-color: #f8fafc !important;
}
body.dark .CodeMirror-selected {
    background-color: #334155 !important;
}
body.dark .CodeMirror-focused .CodeMirror-selected {
    background-color: #475569 !important;
}
body.dark .CodeMirror-activeline-background {
    background: rgba(51, 65, 85, 0.4) !important;
}
body.dark .cm-header { color: #38bdf8 !important; font-weight: 600; }
body.dark .cm-strong { color: #f43f5e !important; font-weight: bold; }
body.dark .cm-em { color: #fbbf24 !important; font-style: italic; }
body.dark .cm-link { color: #60a5fa !important; }
body.dark .cm-string { color: #34d399 !important; }
body.dark .cm-comment { color: #94a3b8 !important; }
body.dark .cm-quote { color: #a7f3d0 !important; }
body.dark .cm-variable { color: #e2e8f0 !important; }

/* Token Markdown ala VS Code */
.cm-header { color: #0451a5 !important; font-weight: 600; }
.cm-strong { color: #af00db !important; font-weight: 700; }
.cm-em { color: #795e26 !important; }
.cm-link, .cm-url { color: #0070c1 !important; }
.cm-comment, .cm-quote { color: #008000 !important; }
.cm-string { color: #a31515 !important; }
.cm-variable-2, .cm-tag { color: #800000 !important; }
body.dark .cm-header { color: #569cd6 !important; }
body.dark .cm-strong { color: #c586c0 !important; }
body.dark .cm-em { color: #dcdcaa !important; }
body.dark .cm-link, body.dark .cm-url { color: #4fc1ff !important; }
body.dark .cm-comment, body.dark .cm-quote { color: #6a9955 !important; }
body.dark .cm-string { color: #ce9178 !important; }
body.dark .cm-variable-2, body.dark .cm-tag { color: #4ec9b0 !important; }

/* Pane Kanan: Preview (GitHub Markdown) — putih (terang) / hitam (gelap) */
#preview-pane { background: #ffffff; }
body.dark #preview-pane { background: #000000; }

/* Markdown Preview dan syntax highlighting yang mendekati VS Code */
.markdown-body {
    color: #24292f;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.6;
}
.markdown-body pre {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #f6f8fa !important;
    padding: 16px !important;
    overflow: auto;
}
.markdown-body pre code.hljs {
    display: block;
    padding: 0;
    background: transparent;
    font-family: 'JetBrains Mono', "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.55;
}
.markdown-body :not(pre) > code {
    color: #a31515;
    background: #f3f4f6;
    border-radius: 3px;
    padding: 0.15em 0.35em;
    font-size: 0.9em;
}
body.dark .markdown-body { color: #d4d4d4; }
body.dark .markdown-body pre { border-color: #3e3e42; background: #1e1e1e !important; }
body.dark .markdown-body :not(pre) > code { color: #ce9178; background: #2d2d30; }
body.dark .markdown-body pre code.hljs { color: #d4d4d4; }

/* Layout perbaikan untuk header dan konten agar sejajar (align) */
.pane-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #ffffff; }
body.dark .pane-container { background: #1e293b; }

/* Notification Toast */
#toast {
    position: fixed; bottom: 20px; right: 20px; background: var(--mi-green-700); color: white;
    border: 1px solid var(--mi-gold-300);
    padding: 10px 20px; border-radius: 6px; box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transform: translateY(100px); opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 50;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* Transparent Markdown Body Background agar menyatu dengan panel preview */
.markdown-body { background-color: transparent !important; }

/* Diagram Mermaid.js: netralkan gaya <pre> bawaan (bg abu-abu, font monospace, dll)
   supaya diagram SVG tampil bersih & rata tengah */
.markdown-body pre.mermaid {
    background: transparent !important; border: none !important; padding: 1rem 0 !important;
    display: flex !important; justify-content: center; overflow-x: auto; font-family: inherit;
}

/* Anchor Link pada Heading (ala GitHub): tersembunyi, muncul saat heading di-hover */
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 { position: relative; }
.markdown-body .heading-anchor {
    position: absolute; left: -0.75em; text-decoration: none; color: #94a3b8;
    opacity: 0; transition: opacity 0.15s ease-in-out; font-weight: 400;
}
.markdown-body h1:hover .heading-anchor, .markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor, .markdown-body h4:hover .heading-anchor,
.markdown-body h5:hover .heading-anchor, .markdown-body h6:hover .heading-anchor { opacity: 1; }

/* Preview Dokumen "Pesan WhatsApp": hanya satu bubble pesan terformat, bukan mockup obrolan */
.wa-preview-wrap {
    background: #E5DDD5; padding: 24px 16px; border-radius: 8px; min-height: 100px; display: flex;
}
.dark .wa-preview-wrap { background: #0b141a; }
.wa-bubble {
    margin-left: auto; max-width: 78%; padding: 6px 9px 8px; border-radius: 7.5px;
    border-top-right-radius: 0; background: #DCF8C6; font-size: 14px; line-height: 19px;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13); word-wrap: break-word; color: #111b21;
    font-family: 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
}
.dark .wa-bubble { background: #005c4b; color: #e9edef; }
.wa-bubble .wa-mono {
    background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px;
}
.dark .wa-bubble .wa-mono { background: rgba(255,255,255,0.12); }
.wa-bubble .wa-quote {
    display: block; border-left: 3px solid #128C7E; padding-left: 8px; margin: 3px 0; color: #4a5a60;
}
.dark .wa-bubble .wa-quote { color: #a3b0b5; }
.wa-bubble .wa-placeholder { color: #7a8a90; font-style: italic; }
.wa-bubble .wa-list {
    list-style-position: outside !important; padding-left: 1.4em !important; margin: 4px 0 !important;
}
.wa-bubble ul.wa-list { list-style-type: disc !important; }
.wa-bubble ol.wa-list { list-style-type: decimal !important; }
.wa-bubble .wa-list li { display: list-item !important; margin-bottom: 2px !important; }

/* Perbaikan Rendering Bullet & Numbering (Melawan Tailwind Preflight) */
.markdown-body ul { list-style-type: disc !important; padding-left: 2em !important; }
.markdown-body ol { list-style-type: decimal !important; padding-left: 2em !important; }
.markdown-body ul ul { list-style-type: circle !important; }
.markdown-body ul ul ul { list-style-type: square !important; }
.markdown-body li { display: list-item !important; margin-bottom: 0.25em !important; }

/* Membatasi lebar teks pada preview agar nyaman dibaca */
.markdown-body {
    max-width: 800px;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Opsi membebaskan lebar preview (via pengaturan) */
.markdown-body.preview-free {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Dokumen jenis Mermaid (diagram utuh, bukan diembed): lebar preview dimaksimalkan
   mengikuti lebar panel, bukan dibatasi 800px seperti dokumen teks biasa,
   supaya diagram besar tidak sempit/terpotong. */
.markdown-body.mermaid-doc-view {
    max-width: none !important;
    width: 100%;
}
.markdown-body.mermaid-doc-view pre.mermaid svg {
    max-width: 100%;
    height: auto;
}

/* Override Global Dark Mode (Tanpa menyentuh setiap tag HTML) */
body.dark { background-color: #0f172a; color: #f8fafc; }
body.dark .sidebar, body.dark #editor-pane { background: #1e293b; }
body.dark #preview-pane { background: #000000; }
body.dark #md-input { background: #1e293b; color: #e2e8f0; }
body.dark .bg-white { background-color: #1e293b !important; }
body.dark .bg-slate-50 { background-color: #0f172a !important; }
body.dark .bg-slate-100 { background-color: #0f172a !important; }
body.dark .text-slate-800 { color: #f8fafc !important; }
body.dark .text-slate-700 { color: #e2e8f0 !important; }
body.dark .text-slate-600 { color: #cbd5e1 !important; }
body.dark .text-slate-500 { color: #94a3b8 !important; }
body.dark .border-slate-200, body.dark .border-slate-300 { border-color: #334155 !important; }
body.dark select, body.dark input[type="text"] { background-color: #1e293b; color: #f8fafc; border-color: #475569 !important; }
body.dark .file-item { color: #cbd5e1; }
body.dark .file-item:hover { background-color: #334155; color: #6ea8fe; }
body.dark .file-item.active { background-color: #0f172a; color: #6ea8fe; border-color: var(--mi-gold-500); }
body.dark ::-webkit-scrollbar-track { background: #1e293b; }
body.dark ::-webkit-scrollbar-thumb { background: #475569; }
body.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* === Layout Dua Tampilan Terpisah: Manajemen File & Editor === */
body { margin: 0; background-color: #f1f5f9; }
.view { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; background-color: #f1f5f9; }
body.dark .view { background-color: #0f172a; }

/* Kartu pada halaman Manajemen File: outline tipis, tanpa bar kiri berwarna */
.fm-folder {
    background: #fffbeb;
    border: 1px solid #fde68a;
    transition: border-color 0.15s, box-shadow 0.15s;
}
body.dark .fm-folder { background: #1e293b !important; border-color: rgba(245, 158, 11, 0.35) !important; }
.fm-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    transition: border-color 0.15s, box-shadow 0.15s;
}
body.dark .fm-card { background: #1e293b !important; border-color: #334155 !important; }
.fm-card:hover { border-color: #94a3b8; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08); }
body.dark .fm-card:hover { border-color: #64748b; }
.fm-card.active { border-color: #3b82f6; box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25); }
body.dark .fm-card.active { border-color: #60a5fa; box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25); }
.fm-action-btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.625rem; border-radius: 0.375rem; font-size: 0.75rem; font-weight: 500; transition: background-color 0.15s, color 0.15s; }

/* Toolbar Insert Markdown */
#md-toolbar { scrollbar-width: thin; }
.md-toolbar-btn { width: 2rem; height: 2rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 0.375rem; color: #475569; transition: background-color 0.15s, color 0.15s; }
.md-toolbar-btn:hover { background-color: #e2e8f0; color: #0f172a; }
.md-toolbar-sep { width: 1px; height: 1.25rem; background-color: #cbd5e1; margin: 0 0.25rem; flex-shrink: 0; }
body.dark .md-toolbar-btn { color: #cbd5e1; }
body.dark .md-toolbar-btn:hover { background-color: #334155; color: #f8fafc; }
body.dark .md-toolbar-sep { background-color: #475569; }
#wa-emoji-toolbar { scrollbar-width: thin; }
.wa-emoji-btn { width: 2rem; height: 2rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 0.375rem; font-size: 1.05rem; line-height: 1; transition: background-color 0.15s; }
.wa-emoji-btn:hover { background-color: #e2e8f0; }
body.dark .wa-emoji-btn:hover { background-color: #334155; }

/* â€” Penyejajaran vertikal icon Font Awesome dengan label â€” */
.fa-solid, .fa-regular, .fa-brands { line-height: 1; vertical-align: middle; }
button i.fa-solid, button i.fa-brands, a i.fa-solid, label i.fa-solid, label i.fa-brands {
  display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0;
}

/* =====================================================================
   KOMPONEN UI SEMANTIK â€” tahap 1 pengurangan ketergantungan Tailwind.
   Markup memakai class di bawah; utilitas Tailwind tinggal untuk layout
   yang belum dipindahkan. Semua komponen punya varian body.dark.
   ===================================================================== */

/* Tombol dasar */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; border-radius: 0.375rem;
  font-size: 0.875rem; font-weight: 500; line-height: 1.25rem;
  cursor: pointer; flex-shrink: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-outline {
  background: #ffffff; color: #334155;
  border: 1px solid #cbd5e1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-outline:hover { background: #f8fafc; }
body.dark .btn-outline { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark .btn-outline:hover { background: #334155; }

.btn-primary {
  background: #2563eb; color: #ffffff;
  border: 1px solid #2563eb; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-primary:hover { background: #1d4ed8; }

/* Tombol kecil (ukuran teks xs) */
.btn-xs { padding: 0.25rem 0.625rem; font-size: 0.75rem; line-height: 1rem; border-radius: 0.375rem; }

/* Tombol ikon bulat (dark mode, pengaturan, dll.) */
.icon-btn-round {
  width: 2.25rem; height: 2.25rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; cursor: pointer;
  background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1;
  transition: background-color 0.15s;
}
.icon-btn-round:hover { background: #e2e8f0; }
body.dark .icon-btn-round { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark .icon-btn-round:hover { background: #334155; }

/* Panel popup melayang (menu pengaturan, menu dokumen baru, menu heading) */
.popup-panel {
  position: fixed; z-index: 50;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}
body.dark .popup-panel { background: #1e293b; border-color: #334155; }

/* Item menu di dalam panel popup */
.menu-item {
  display: flex; align-items: center; gap: 0.625rem; width: 100%;
  padding: 0.5rem 0.875rem; text-align: left;
  font-size: 0.875rem; color: #334155; cursor: pointer; border: none; background: none;
}
.menu-item:hover { background: #f1f5f9; }
body.dark .menu-item { color: #e2e8f0; }
body.dark .menu-item:hover { background: #334155; }

/* Baris pengaturan (label + kontrol) dalam popup pengaturan */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.625rem 1rem; cursor: pointer;
  font-size: 0.875rem; line-height: 1; color: #334155;
}
.setting-row:hover { background: #f8fafc; }
body.dark .setting-row { color: #e2e8f0; }
body.dark .setting-row:hover { background: #374151; }
.setting-row .row-icon { width: 1rem; text-align: center; color: #64748b; font-size: 0.875rem; }
body.dark .setting-row .row-icon { color: #94a3b8; }

/* Saklar toggle (pengganti pola peer/sr-only Tailwind) */
.switch { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch .track {
  width: 2.25rem; height: 1.25rem; border-radius: 9999px;
  background: #e2e8f0; transition: background-color 0.15s;
}
.switch .thumb {
  position: absolute; left: 0.125rem; top: calc(50% - 0.5rem);
  width: 1rem; height: 1rem; border-radius: 9999px;
  background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s; pointer-events: none;
}
.switch input:checked ~ .track { background: #2563eb; }
.switch input:checked ~ .thumb { transform: translateX(1rem); }
body.dark .switch .track { background: #475569; }
body.dark .switch .thumb { background: #f8fafc; }

/* Grup input menempel: Nama Dokumen + tombol Simpan */
.input-group {
  position: relative; display: flex; align-items: stretch; flex-shrink: 0;
  height: 2rem; border-radius: 0.375rem; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.text-input {
  height: 100%; width: 10rem; min-width: 0; padding: 0 0.75rem;
  font-size: 0.875rem; outline: none;
  background: #ffffff; color: #1e293b;
  border: 1px solid #cbd5e1; border-right: none;
  border-radius: 0.375rem 0 0 0.375rem;
}
.text-input:focus { border-color: #3b82f6; position: relative; z-index: 10; }
.btn-save {
  height: 100%; display: flex; align-items: center; justify-content: center; gap: 0.375rem;
  flex-shrink: 0; padding: 0 0.875rem; cursor: pointer;
  font-size: 0.875rem; font-weight: 500; color: #ffffff; line-height: 1;
  background: #2563eb; border: 1px solid #2563eb; margin-left: -1px;
  border-radius: 0 0.375rem 0.375rem 0;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn-save:hover { background: #1d4ed8; border-color: #1d4ed8; }
.text-input, .input-group { transition: border-color 0.15s; }
.save-label { display: none; line-height: 1; }
.strip-count { display: none; }

/* Indikator status penyimpanan dokumen */
.save-indicator {
  flex-shrink: 0; display: flex; align-items: center; gap: 0.4rem;
  margin-left: 0.5rem; padding: 0.125rem 0.5rem;
  border: 1px solid transparent; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 500; line-height: 1; white-space: nowrap;
  color: #64748b; transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.save-indicator__dot {
  font-size: 0.5rem; line-height: 1; display: inline-block;
  color: #cbd5e1; transition: color 0.2s, transform 0.2s;
}
.save-indicator__label { line-height: 1; }
/* State: Siap (idle) */
.save-indicator[data-state="idle"] { color: #94a3b8; }
.save-indicator[data-state="idle"] .save-indicator__dot { color: #94a3b8; }
/* State: Menyimpan (saving) */
.save-indicator[data-state="saving"] { color: #2563eb; }
.save-indicator[data-state="saving"] .save-indicator__dot {
  color: #2563eb; border-radius: 50%;
  animation: save-spin 0.6s linear infinite;
}
@keyframes save-spin { to { transform: rotate(360deg); } }
/* State: Tersimpan (saved) */
.save-indicator[data-state="saved"] { color: #16a34a; }
.save-indicator[data-state="saved"] .save-indicator__dot { color: #22c55e; }
/* State: Gagal (error) */
.save-indicator[data-state="error"] { color: #dc2626; }
.save-indicator[data-state="error"] .save-indicator__dot { color: #ef4444; }
body.dark .save-indicator { color: #cbd5e1; }
body.dark .save-indicator[data-state="idle"] { color: #64748b; }
body.dark .save-indicator[data-state="idle"] .save-indicator__dot { color: #64748b; }


@media (min-width: 640px) {
  .text-input { width: 12rem; }
  .btn-save { padding: 0 1rem; }
  .save-label { display: inline; }
  .strip-count { display: inline; }
}

/* Strip judul panel editor ("Editor (Markdown)" + tombol Download) */
.panel-strip {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  background: #e2e8f0; border-bottom: 1px solid #cbd5e1;
  padding: 0.3rem 0.75rem;
  font-size: 0.8125rem; font-weight: 500; color: #64748b;
}
.panel-strip .strip-label { display: flex; align-items: center; gap: 0.5rem; }
.panel-strip .strip-count { font-size: 0.75rem; font-weight: 400; color: #94a3b8; }
body.dark .panel-strip { background: #1e293b; border-color: #334155; color: #cbd5e1; }

/* === Sidebar Manajemen File: baris kartu folder & dokumen === */
.fm-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem; margin-bottom: 0.5rem;
  border-radius: 0.5rem; font-size: 0.875rem; cursor: pointer;
}
.fm-row--folder { margin-top: 0.75rem; }
.fm-child { margin-left: 1.5rem; }
.fm-title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem; }
.fm-text { min-width: 0; }
.fm-name {
  display: flex; align-items: center; gap: 0.375rem;
  font-weight: 500; color: #334155;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fm-meta { font-size: 0.75rem; color: #94a3b8; }
.fm-icon { flex-shrink: 0; width: 1.25rem; height: 1.25rem; }
.fm-icon--md { color: #3b82f6; }
.fm-icon--mermaid { color: #10b981; }
.fm-icon--wa { color: #25D366; }
.fm-badge {
  display: inline-block; flex-shrink: 0;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em;
  padding: 0.125rem 0.375rem; border-radius: 0.25rem;
}
.fm-badge--mermaid { color: #059669; background: #ecfdf5; }
.fm-badge--whatsapp { color: #128C7E; background: #f0fdf4; }
body.dark .fm-name { color: #e2e8f0; }
body.dark .fm-badge--mermaid { color: #34d399; background: #022c22; }
body.dark .fm-badge--whatsapp { color: #4ade80; background: #052e16; }

/* Baris folder */
.fm-folder-title {
  flex: 1; display: flex; align-items: center; gap: 0.5rem; min-width: 0;
  font-weight: 600; color: #334155;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fm-caret { flex-shrink: 0; width: 0.875rem; height: 0.875rem; color: #94a3b8; }
.fm-folder-icon { flex-shrink: 0; width: 1rem; height: 1rem; color: #f59e0b; }
body.dark .fm-folder-title { color: #e2e8f0; }

/* Tombol aksi folder (+ import, upload, hapus) */
.fm-btn-group { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.fm-action { color: #64748b; }
.fm-action:hover { color: #2563eb; background: #eff6ff; }
.fm-action--danger:hover { color: #ef4444 !important; background: #fef2f2 !important; }
body.dark .fm-action { color: #94a3b8; }
body.dark .fm-action:hover { color: #60a5fa; background: #172554; }
body.dark .fm-action--danger:hover { color: #f87171 !important; background: #450a0a !important; }

/* Pesan kosong dalam folder, pemisah root, dan galat muat daftar */
.fm-empty { font-size: 0.75rem; font-style: italic; color: #94a3b8; margin-left: 2.25rem; margin-bottom: 0.5rem; }
.fm-sep { margin: 0.75rem 0; border-top: 1px solid #e2e8f0; }
.load-error-text { color: #ef4444; font-size: 0.875rem; padding: 0.5rem; }
body.dark .fm-sep { border-color: #334155; }

/* === Header halaman Manajemen File === */
.fm-header {
position: relative; z-index: 10; flex-shrink: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 1rem;
  background: #e2e8f0; border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
@media (min-width: 768px) { .fm-header { padding: 1rem 1.5rem; } }
body.dark .fm-header { background: #1e293b; border-color: #334155; }
.fm-brand { position: relative; display: flex; align-items: center; gap: 0.75rem; }
.fm-brand-logo {
  width: 2.5rem; height: 2.5rem; flex-shrink: 0;
  border-radius: 9999px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.fm-brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.fm-title { font-size: 1.25rem; font-weight: 700; color: #1e293b; line-height: 1.25; }
body.dark .fm-title { color: #f1f5f9; }
.fm-subtitle { font-size: 11px; color: #64748b; letter-spacing: 0.025em; }

/* Sidebar daftar file */
.fm-sidebar {
  width: 100%; flex-shrink: 0; overflow-y: auto; padding: 1rem;
  background: #e2e8f0; border-right: 1px solid #cbd5e1;
}
@media (min-width: 768px) { .fm-sidebar { width: 20rem; } }
@media (min-width: 1024px) { .fm-sidebar { width: 24rem; } }
body.dark .fm-sidebar { background: #1e293b; border-color: #334155; }

/* === Workspace sambutan (kanan sidebar, layar lebar) === */
.ws-empty {
  display: none; position: relative; flex: 1;
  align-items: center; justify-content: center; overflow: hidden;
  background: #f8fafc;
}
@media (min-width: 768px) { .ws-empty { display: flex; } }
body.dark .ws-empty { background: #0f172a; }
.ws-watermark {
  position: absolute; bottom: -2.5rem; right: -2.5rem;
  font-size: 18rem; line-height: 1; color: #e2e8f0;
  transform: rotate(-6deg); user-select: none; pointer-events: none;
}
body.dark .ws-watermark { color: #1e293b; }
.ws-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; padding: 0 1.5rem; }
.ws-icon-box {
  width: 4rem; height: 4rem; margin-bottom: 0.25rem;
  border-radius: 1rem; background: #eff6ff; border: 1px solid #dbeafe;
  display: flex; align-items: center; justify-content: center;
}
.ws-icon-box i { font-size: 1.5rem; color: #3b82f6; }
body.dark .ws-icon-box { background: #172554; border-color: #1e3a8a; }
body.dark .ws-icon-box i { color: #60a5fa; }
.ws-hello { color: #64748b; font-weight: 500; }
body.dark .ws-hello { color: #cbd5e1; }
.ws-hint { color: #94a3b8; font-size: 0.875rem; max-width: 20rem; }
.ws-credit { margin-top: 1rem; font-size: 0.75rem; color: #94a3b8; }
body.dark .ws-credit { color: #475569; }
.ws-credit .author { font-weight: 600; color: #64748b; }
body.dark .ws-credit .author { color: #94a3b8; }

/* Tombol pilihan jenis dokumen baru di workspace sambutan */
.doc-type-btns { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; flex-wrap: wrap; justify-content: center; }
.doc-type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.375rem;
  min-width: 92px; padding: 1rem 1.25rem; cursor: pointer;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s, background-color 0.15s;
}
.doc-type-btn .dtb-icon { width: 2.5rem; height: 2.5rem; border-radius: 9999px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.doc-type-btn .dtb-label { font-size: 0.75rem; font-weight: 600; color: #334155; }
body.dark .doc-type-btn { background: #1e293b; border-color: #334155; }
body.dark .doc-type-btn .dtb-label { color: #e2e8f0; }
.doc-type-btn--md .dtb-icon { background: #eff6ff; }
.doc-type-btn--md .dtb-icon i { color: #2563eb; }
.doc-type-btn--md:hover { border-color: #93c5fd; background: rgba(239, 246, 255, 0.6); }
body.dark .doc-type-btn--md .dtb-icon { background: rgba(30, 58, 138, 0.4); }
body.dark .doc-type-btn--md .dtb-icon i { color: #60a5fa; }
body.dark .doc-type-btn--md:hover { border-color: #1d4ed8; background: #334155; }
.doc-type-btn--mermaid .dtb-icon { background: #ecfdf5; }
.doc-type-btn--mermaid .dtb-icon i { color: #059669; }
.doc-type-btn--mermaid:hover { border-color: #6ee7b7; background: rgba(236, 253, 245, 0.6); }
body.dark .doc-type-btn--mermaid .dtb-icon { background: rgba(6, 78, 59, 0.4); }
body.dark .doc-type-btn--mermaid .dtb-icon i { color: #34d399; }
body.dark .doc-type-btn--mermaid:hover { border-color: #047857; background: #334155; }
.doc-type-btn--wa .dtb-icon { background: #f0fdf4; }
.doc-type-btn--wa .dtb-icon i { color: #25D366; }
.doc-type-btn--wa:hover { border-color: #86efac; background: rgba(240, 253, 244, 0.6); }
body.dark .doc-type-btn--wa .dtb-icon { background: rgba(20, 83, 45, 0.4); }
body.dark .doc-type-btn--wa:hover { border-color: #15803d; background: #334155; }

/* === Topbar Editor === */
.editor-nav {
  position: relative; z-index: 10; flex-shrink: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #e2e8f0; border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
body.dark .editor-nav { background: #1e293b; border-color: #334155; }
.btn-back-folder {
  position: relative; height: 2.25rem; flex-shrink: 0;
  display: flex; align-items: center; gap: 0.375rem;
  max-width: 10rem; padding: 0 0.75rem; border: none; cursor: pointer;
  border-radius: 0.375rem; background: #f1f5f9; color: #475569;
  font-size: 0.75rem; font-weight: 500;
  transition: background-color 0.15s;
}
.btn-back-folder:hover { background: #e2e8f0; }
.btn-back-folder .folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.dark .btn-back-folder { background: #334155; color: #cbd5e1; }
body.dark .btn-back-folder:hover { background: #475569; }
.icon-btn-danger {
  position: relative; width: 2.25rem; height: 2.25rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 0.375rem; border: 1px solid #fecaca; background: transparent; color: #ef4444;
  transition: background-color 0.15s, border-color 0.15s;
}
.icon-btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
body.dark .icon-btn-danger { border-color: #7f1d1d; }
body.dark .icon-btn-danger:hover { background: #450a0a; }
.icon-btn-share {
  position: relative; width: 2.25rem; height: 2.25rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 0.375rem; border: 1px solid #cbd5e1; background: transparent; color: #64748b;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.icon-btn-share:hover { background: #eff6ff; border-color: #93c5fd; color: #2563eb; }
body.dark .icon-btn-share { border-color: #475569; color: #94a3b8; }
body.dark .icon-btn-share:hover { background: #334155; border-color: #1d4ed8; color: #60a5fa; }

/* Saklar mode tampilan (Editor / Split / Preview) */
.mode-switch {
  position: relative; display: flex; align-items: center; gap: 0.25rem;
  background: #f1f5f9; border: 1px solid #e2e8f0; padding: 0.25rem; border-radius: 0.5rem;
}
.mode-btn {
  padding: 0.375rem 0.5rem; border: none; background: transparent; cursor: pointer;
  font-size: 0.75rem; font-weight: 600; border-radius: 0.375rem; color: #64748b;
  display: inline-flex; align-items: center; gap: 0.25rem;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
@media (min-width: 640px) { .mode-btn { padding-left: 0.75rem; padding-right: 0.75rem; } }
.mode-btn:hover { background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.mode-btn.active { background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); color: #2563eb; }
body.dark .mode-switch { background: #0f172a; border-color: #334155; }
body.dark .mode-btn { color: #94a3b8; }
body.dark .mode-btn:hover { background: #334155; color: #e2e8f0; }
body.dark .mode-btn.active { background: #334155; color: #60a5fa; }

/* Pembatas antar-pane saat mode split */
.pane-container.divided { border-right: 1px solid #e2e8f0; }
@media (max-width: 767px) {
  .pane-container.divided { border-right: none; border-bottom: 1px solid #e2e8f0; }
}
body.dark .pane-container.divided { border-color: #334155; }

/* Strip toolbar insert (markdown & emoji WhatsApp) */
.toolbar-strip {
  flex-shrink: 0; display: flex; align-items: center; gap: 0.125rem;
  border-bottom: 1px solid #cbd5e1; background: #e2e8f0;
  padding: 0.25rem 0.5rem; overflow-x: auto;
}
body.dark .toolbar-strip { background: #1e293b; border-color: #334155; }

/* Tombol salin WhatsApp (strip preview) */
.btn-wa-xs {
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-size: 0.75rem; font-weight: 500; line-height: 1rem; color: #ffffff;
  background: #25D366; border: 1px solid #25D366;
  padding: 0.25rem 0.625rem; border-radius: 0.375rem; cursor: pointer;
  transition: background-color 0.15s;
}
.btn-wa-xs:hover { background: #1ebe59; }

/* Kepala & kaki popup pengaturan */
.settings-head {
  padding: 0.5rem 1rem; margin-bottom: 0.25rem;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b; border-bottom: 1px solid #e2e8f0;
}
.settings-foot {
  margin-top: 0.25rem; padding: 0.75rem 1rem 0.5rem; text-align: center;
  font-size: 11px; color: #94a3b8; border-top: 1px solid #e2e8f0;
}
.settings-foot .author { font-weight: 600; }
body.dark .settings-head { color: #94a3b8; border-color: #334155; }
body.dark .settings-foot { color: #64748b; border-color: #334155; }

/* Baris pengaturan yang tidak relevan untuk jenis dokumen aktif */
.setting-disabled { opacity: 0.4; pointer-events: none; }

/* Pemisah horizontal di dalam popup menu */
.menu-sep { margin: 0.375rem 0.5rem; border-top: 1px solid #e2e8f0; }
body.dark .menu-sep { border-color: #334155; }

/* ============================================================
   RESET RINGAN (pengganti Preflight Tailwind)
   Konten markdown tidak terpengaruh: github-markdown-css &
   gaya .markdown-body memiliki spesifisitas lebih tinggi.
   ============================================================ */
*, ::before, ::after { box-sizing: border-box; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
button {
  font-family: inherit; font-size: 100%; line-height: inherit; color: inherit;
  background: none; border: none; padding: 0; cursor: pointer;
}
input, textarea, select { font: inherit; color: inherit; }

/* ============================================================
   LAPISAN UTILITAS MINIMAL (pengganti Tailwind CDN)
   Hanya utilitas yang benar-benar masih dipakai markup/dynamic JS.
   Urutan penting: varian responsif (sm:inline) harus SETELAH .hidden.
   ============================================================ */

/* --- Display & layout --- */
.hidden { display: none; }
.block { display: block; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* --- Responsif --- */
@media (min-width: 640px) {
  .sm\:inline { display: inline; }
}

/* --- Spacing --- */
.p-6 { padding: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-16 { margin-top: 4rem; }
.mb-4 { margin-bottom: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* --- Ukuran --- */
.w-4 { width: 1rem; } .h-4 { height: 1rem; }
.w-3\.5 { width: 0.875rem; } .h-3\.5 { height: 0.875rem; }
.w-44 { width: 11rem; }
.w-60 { width: 15rem; }
.w-64 { width: 16rem; }

/* --- Tipografi --- */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-\[11px\] { font-size: 11px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.text-center { text-align: center; }

/* --- Warna teks --- */
.text-slate-400 { color: #94a3b8; }
.text-slate-800 { color: #1e293b; }
.text-amber-500 { color: #f59e0b; }
.text-blue-500 { color: #3b82f6; }
.text-emerald-500 { color: #10b981; }
.text-\[\#25D366\] { color: #25D366; }

/* --- Transisi --- */
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.transition-colors {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.duration-200 { transition-duration: 200ms; }
