/* ============================================================
   WordNote — Word-like chrome
   ============================================================ */
:root {
  --accent: #2B579A;
  --accent-dark: #1b3f78;
  --accent-soft: #dee8f7;
  --ribbon: #f3f2f1;
  --ribbon-line: #dedcd9;
  --ink: #201f1e;
  --ink-soft: #5f5d5b;
  --canvas: #e8e8e8;
  --white: #ffffff;
  --hover: #e8e6e4;
  --on: #c9d8ee;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  overflow: hidden;
  height: 100dvh;
  overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Tinggi mengikuti viewport dinamis (100dvh) dan visualViewport saat keyboard
   virtual muncul; toolbar tetap menempel di atas, hanya .scroller yang menggulir. */
.app {
  height: 100vh;
  height: 100dvh;
  height: var(--app-h, 100dvh);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ======================= Title bar ======================= */
.titlebar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 34px;
  flex: 0 0 34px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  user-select: none;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tb-right { margin-left: auto; }
.app-logo { font-size: 17px; display: grid; place-items: center; width: 24px; }
.quick-access { display: flex; align-items: center; gap: 1px; }
.qa {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 2px;
  color: #fff; font-size: 12px; cursor: pointer;
}
.qa:hover { background: rgba(255,255,255,.18); }
.qa-sep { width: 1px; height: 16px; background: rgba(255,255,255,.3); margin: 0 4px; display: inline-block; }
.save-state { font-size: 11.5px; color: #e8eefb; display: inline-flex; align-items: center; gap: 5px; }
.save-state.saving { color: #fff2c2; }
.doc-title-wrap { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.doc-title {
  background: rgba(255,255,255,.12);
  border: 1px solid transparent;
  border-radius: 2px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  padding: 3px 10px;
  width: 340px;
  max-width: 46vw;
}
.doc-title:hover { background: rgba(255,255,255,.2); }
.doc-title:focus { background: #fff; color: var(--ink); border-color: #fff; outline: none; }
.user-chip {
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; color: var(--accent);
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700;
}

/* ======================= Tabs ======================= */
.tabstrip {
  position: sticky;
  top: 34px;
  z-index: 100;
  flex: 0 0 32px;
  height: 32px;
  background: var(--accent);
  display: flex;
  align-items: flex-end;
  padding-left: 6px;
  user-select: none;
}
.file-tab {
  height: 28px;
  padding: 0 16px;
  border: 0;
  background: var(--accent-dark);
  color: #fff;
  font-size: 12.5px;
  letter-spacing: .2px;
  cursor: pointer;
  border-radius: 2px 2px 0 0;
  margin-right: 2px;
}
.file-tab:hover { background: #17325f; }
.tabs { display: flex; align-items: flex-end; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  height: 28px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #e8eefb;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 2px 2px 0 0;
  white-space: nowrap;
}
.tab:hover { background: rgba(255,255,255,.16); color: #fff; }
.tab.active {
  background: var(--ribbon);
  color: var(--accent);
  font-weight: 600;
}

/* ======================= Ribbon ======================= */
.ribbon {
  position: sticky;
  top: 66px;
  z-index: 99;
  flex: 0 0 auto;
  min-height: 94px;
  background: var(--ribbon);
  border-bottom: 1px solid #cfcdca;
  display: flex;
  align-items: stretch;
  padding: 3px 2px 2px;
  overflow-x: auto;
  overflow-y: hidden;
  user-select: none;
}
.ribbon::-webkit-scrollbar { height: 8px; }
.ribbon::-webkit-scrollbar-thumb { background: #c9c6c3; border-radius: 4px; }

.group {
  display: flex;
  flex-direction: column;
  padding: 2px 8px 0;
  flex: 0 0 auto;
}
.group + .group { border-left: 1px solid #e2e0dd; }
.group-body {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  gap: 3px;
  min-height: 68px;
}
.group-label {
  font-size: 10.5px;
  color: #6d6b69;
  text-align: center;
  padding: 3px 0 1px;
  white-space: nowrap;
}
.rb-row { display: flex; align-items: center; gap: 2px; margin-bottom: 2px; }

.rb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #34322f;
  font-size: 11.5px;
  cursor: pointer;
  padding: 2px 6px;
  white-space: nowrap;
  line-height: 1.15;
}
.rb i { color: #3a3936; font-size: 13px; width: 14px; text-align: center; }
.rb:hover { background: var(--hover); border-color: #dcdad7; }
.rb:active { background: #dad7d3; }
.rb.on { background: var(--on); border-color: #a8bfde; }
.rb.big {
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 56px;
  max-width: 92px;
  height: 68px;
  padding: 4px 6px;
  text-align: center;
}
.rb.big i { font-size: 20px; width: auto; }
.rb.big .rb-label { white-space: normal; font-size: 11px; line-height: 1.15; }
.rb.small { height: 22px; }
.rb .caret { font-size: 8px; color: #6d6b69; width: auto; margin-left: 1px; }
.color-bar {
  display: block;
  height: 3px;
  width: 16px;
  border-radius: 1px;
  margin-top: 1px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.rb.small .color-bar { margin: 0 0 0 2px; width: 14px; }
.btn-split { display: inline-flex; align-items: center; gap: 0; }
.btn-split .rb:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 3px; }
.btn-split .rb.caret-btn { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 3px; height: 22px; }
.small-stack {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(3, 22px);
  gap: 2px 2px;
  align-content: start;
}

/* Combos */
.combo-col { display: flex; flex-direction: column; gap: 2px; }
.combo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 22px;
  padding: 0 5px 0 7px;
  background: #fff;
  border: 1px solid #cbc9c6;
  border-radius: 2px;
  font-size: 11.5px;
  color: #26251f;
  cursor: pointer;
  text-align: left;
  width: 128px;
  overflow: hidden;
}
.combo.size-combo { width: 62px; }
.combo:hover { border-color: #9b9893; background: #fff; }
.combo .combo-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo .combo-caret { font-size: 8px; color: #6d6b69; }

/* Styles gallery (inline) */
.gallery { display: flex; gap: 2px; height: 68px; align-items: stretch; }
.g-item {
  width: 64px;
  min-width: 64px;
  background: #fff;
  border: 1px solid #dcdad7;
  border-radius: 2px;
  padding: 4px 5px;
  font-size: 10.5px;
  color: #201f1e;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  text-align: left;
  line-height: 1.2;
}
.g-item:hover { border-color: var(--accent); background: #f6f9ff; }
.g-item .g-prev { font-size: 11.5px; font-weight: 600; margin-bottom: 2px; }

/* ======================= Workspace ======================= */
.workspace { flex: 1 1 auto; display: flex; min-height: 0; }
.canvas {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--canvas);
  position: relative;
  display: flex;
}
.scroller {
  flex: 1 1 auto;
  overflow: auto;
  padding: 22px 24px 70px;
  display: flex;
  justify-content: center;
}
.zoom-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  align-self: flex-start;
  transform-origin: top center;
}

/* Ruler */
.ruler-row { display: flex; justify-content: center; }
.ruler {
  height: 20px;
  width: var(--pw, 794px);
  background: #fbfbfa;
  border: 1px solid #d6d4d1;
  border-bottom: 0;
  position: relative;
  margin-bottom: 4px;
  overflow: hidden;
}
.ruler .tick { position: absolute; bottom: 0; width: 1px; background: #b9b6b2; }
.ruler .tick.inch { background: #8f8c88; }
.ruler .tick-num {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  font-size: 8.5px;
  color: #8a8884;
}
.ruler .ruler-margin {
  position: absolute;
  top: 0; bottom: 0;
  background: #efeeec;
  border-right: 1px solid #dcdad7;
}
.ruler .ruler-margin.right { border-right: 0; border-left: 1px solid #dcdad7; }

/* Page */
.page-wrap { display: flex; justify-content: center; }
.page {
  width: var(--pw, 794px);
  min-height: var(--ph, 1123px);
  padding: var(--pt, 96px) var(--pr, 96px) var(--pb, 96px) var(--pl, 96px);
  background: #fff;
  color: #000;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.20);
  margin-bottom: 26px;
}
.page-header, .page-footer {
  outline: none;
  color: #6b6b6b;
  font-size: 10pt;
  min-height: 22px;
  border-bottom: 1px solid #ececec;
  margin-bottom: 14px;
  padding-bottom: 4px;
}
.page-footer { border-bottom: 0; border-top: 1px solid #ececec; margin: 18px 0 0; padding-top: 6px; }
.page-header:empty::before, .page-footer:empty::before {
  content: attr(data-ph); color: #c9c7c4; font-style: italic;
}
.page-body { outline: none; min-height: 320px; position: relative; z-index: 1; }
.page.grid .page-body {
  background-image:
    linear-gradient(to right, #edf1f7 1px, transparent 1px),
    linear-gradient(to bottom, #edf1f7 1px, transparent 1px);
  background-size: 24px 24px;
}
.watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: rotate(-32deg);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 84px;
  font-weight: 800;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: rgba(43, 87, 154, .10);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  white-space: nowrap;
}

/* ======================= Document typography ======================= */
.page-body {
  font-family: Calibri, "Segoe UI", system-ui, sans-serif;
  font-size: 11pt;
  line-height: 1.15;
  color: #000;
  word-wrap: break-word;
}
.page-body p { margin: 0 0 8pt; }
.page-body p:empty::after { content: ""; }
.page-body h1, .page-body h2, .page-body h3, .page-body h4 {
  font-family: "Calibri Light", Calibri, "Segoe UI", sans-serif;
  color: var(--doc-accent, #2B579A);
  font-weight: 400;
  line-height: 1.15;
  margin: 14pt 0 6pt;
}
.page-body h1 { font-size: 20pt; }
.page-body h2 { font-size: 15pt; }
.page-body h3 { font-size: 12.5pt; font-weight: 600; }
.page-body h4 { font-size: 11.5pt; font-weight: 600; }
.page-body h1:first-child, .page-body h2:first-child { margin-top: 0; }
.page-body .title { font-size: 26pt; text-align: center; margin-bottom: 4pt; }
.page-body .subtitle { text-align: center; font-size: 12pt; color: #5b5b5b; margin-bottom: 16pt; }
.page-body .no-spacing { margin-bottom: 0; }
.page-body blockquote {
  margin: 8pt 0;
  padding: 6pt 12pt;
  border-left: 3px solid var(--doc-accent, #2B579A);
  background: #f6f8fc;
  color: #333;
  font-style: italic;
}
.page-body blockquote.intense {
  border: 1px solid var(--doc-accent, #2B579A);
  border-left-width: 6px;
  font-style: normal;
  font-weight: 600;
  color: var(--doc-accent, #2B579A);
}
.page-body ul, .page-body ol { margin: 0 0 8pt; padding-left: 30px; }
.page-body li { margin-bottom: 2pt; }
.page-body ul li::marker { color: #444; }
.page-body a { color: var(--accent); }
.page-body hr { border: 0; border-top: 1px solid #d9d9d9; margin: 12pt 0; }
.page-body table.doc-table { border-collapse: collapse; margin: 8pt 0; width: 100%; max-width: 100%; }
.page-body table.doc-table td, .page-body table.doc-table th {
  border: 1px solid #bfbfbf;
  padding: 4px 8px;
  min-width: 56px;
  vertical-align: top;
}
.page-body table.doc-table th { background: #eef3fa; }
.page-body img { max-width: 100%; height: auto; }
.page-body sup, .page-body sub { font-size: 75%; }
.page-body .page-break {
  border-top: 2px dashed #b8c6dc;
  margin: 18pt 0 10pt;
  position: relative;
  height: 0;
  user-select: none;
}
.page-body .page-break::after {
  content: "Halaman baru";
  position: absolute;
  right: 0;
  top: -8pt;
  font-size: 8pt;
  color: #7d94b6;
  background: #fff;
  padding: 0 4px;
  font-family: "Segoe UI", sans-serif;
}
.page-body .col-break { break-after: column; }
.page-body .shape-block { display: inline-block; vertical-align: middle; line-height: 0; }
.page-body .shape-block svg { width: 120px; height: auto; }

/* ===== Objek mengambang (shapes/gambar/grafik) ===== */
.page-body .shape-obj {
  position: absolute;
  z-index: 2;
  line-height: 0;
  cursor: move;
  touch-action: none;
  user-select: none;
}
.page-body .shape-obj svg { width: 100%; height: 100%; display: block; }
.page-body .chart-block { max-width: 100%; }
.page-body .chart-block svg { max-width: 100%; height: auto; }

/* Bingkai pilihan + titik pegangan resize */
.obj-frame {
  position: fixed;
  z-index: 62;
  pointer-events: none;
  border: 1px solid var(--accent);
  outline: 1px solid rgba(255, 255, 255, .65);
  touch-action: none;
}
.obj-frame[hidden] { display: none !important; }
.obj-frame .oh {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  pointer-events: auto;
  touch-action: none;
}
.oh-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.oh-n  { left: 50%; top: -5px; margin-left: -5px; cursor: ns-resize; }
.oh-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.oh-e  { right: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.oh-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.oh-s  { left: 50%; bottom: -5px; margin-left: -5px; cursor: ns-resize; }
.oh-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.oh-w  { left: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }

/* Tabel: siap di-resize */
.page-body table.doc-table td, .page-body table.doc-table th { overflow-wrap: break-word; }
.page-body table.doc-table.rz-active { user-select: none; }
.page-body .text-box {
  border: 1px solid #9aa7b8;
  padding: 8pt 10pt;
  margin: 8pt 0;
  background: #fcfdff;
  min-height: 60px;
}
.page-body .wordart {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 34pt;
  text-align: center;
  background: linear-gradient(180deg, #4a7fd4, #17325f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px #2B579A;
  margin: 10pt 0;
  letter-spacing: 1px;
}
.page-body .chart-block { margin: 10pt 0; text-align: center; }
.page-body .chart-block figcaption { font-size: 9pt; color: #555; margin-bottom: 4px; }
.page-body .cover-block { text-align: center; padding: 90pt 0 30pt; }
.page-body .cover-kicker { letter-spacing: 4px; font-size: 10pt; color: #7b8798; }
.page-body .cover-title { font-size: 32pt; margin: 14pt 0 8pt; }
.page-body .cover-sub { font-size: 13pt; color: #4b5a70; }
.page-body .cover-meta { margin-top: 60pt; font-size: 11pt; color: #445162; }
.page-body .footnotes { border-top: 1px solid #d6d6d6; margin-top: 22pt; padding-top: 6pt; font-size: 9pt; }
.page-body .footnotes .fn { margin-bottom: 3pt; }
.page-body .footnotes .fn-sep { display: none; }
.page-body .citation { color: #2B579A; }
.page-body .caption { font-size: 9.5pt; color: #555; font-style: italic; margin-top: 2pt; }
.page-body .toc { margin: 10pt 0 14pt; }
.page-body .toc-title { font-weight: 700; font-size: 13pt; margin-bottom: 6pt; }
.page-body .toc-item { margin: 0 0 3pt; }
.page-body .toc-item a { text-decoration: none; color: #1f3864; }
.page-body .toc-h2 { padding-left: 16pt; }
.page-body .toc-h3 { padding-left: 32pt; }
.page-body .index-block ul { margin-top: 4pt; }

/* tracked changes / comments inside doc */
.page-body .trk-ins {
  text-decoration: underline;
  text-decoration-color: #2e7d32;
  background: #eef8ef;
}
.page-body .comment-mark {
  background: #fff2b8;
  border-bottom: 2px dotted #c9a227;
  cursor: help;
}
.pn-line { text-align: center; }
.page-num { font-weight: 600; color: #444; }

/* ======================= Side panes ======================= */
.sidepane {
  flex: 0 0 262px;
  width: 262px;
  background: #faf9f8;
  border-right: 1px solid #dcdad7;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-size: 12px;
}
.sidepane + .canvas + .sidepane { border-right: 0; border-left: 1px solid #dcdad7; }
.pane-head {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid #e4e2df;
  font-weight: 600;
  color: #3a3936;
  position: sticky;
  top: 0;
  background: #faf9f8;
  z-index: 2;
}
.pane-x { border: 0; background: none; cursor: pointer; color: #6d6b69; padding: 4px 6px; border-radius: 2px; }
.pane-x:hover { background: #e8e6e4; }
.nav-list, #commentsList, #changesList { padding: 6px; }
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 5px 8px;
  border-radius: 3px;
  cursor: pointer;
  color: #2f4e7a;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item:hover { background: #eef2f8; }
.nav-item.lvl-2 { padding-left: 20px; font-size: 11.5px; }
.nav-item.lvl-3 { padding-left: 32px; font-size: 11px; color: #4a4a4a; }
.pane-section { border-top: 1px solid #eae8e5; padding: 2px 0 6px; }
.pane-sub {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #8a8884;
  padding: 8px 12px 4px;
}
.empty { color: #9a9894; font-size: 11.5px; padding: 4px 8px; margin: 0; }
.comment-card, .change-card {
  background: #fff;
  border: 1px solid #e2e0dd;
  border-left: 3px solid #f0b429;
  border-radius: 3px;
  padding: 7px 9px;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: #333;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.change-card { border-left-color: #2e7d32; }
.comment-card .c-by { font-weight: 600; color: #2B579A; font-size: 11px; margin-bottom: 3px; display: flex; justify-content: space-between; }
.comment-card .c-del { border: 0; background: none; cursor: pointer; color: #9a9894; font-size: 11px; padding: 0 2px; }
.comment-card .c-del:hover { color: #c0392b; }
.comment-card .c-body { line-height: 1.35; word-break: break-word; }
.change-card .c-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: #2e7d32; }
.change-card .c-txt { text-decoration: line-through; color: #7a7a7a; }

/* ======================= Status bar ======================= */
.statusbar {
  flex: 0 0 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  gap: 8px;
  user-select: none;
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 8px; }
.sb-right { margin-left: auto; }
.sb-sep { width: 1px; height: 12px; background: rgba(255,255,255,.3); }
.sb-btn {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  width: 22px; height: 20px; display: grid; place-items: center; border-radius: 2px; font-size: 11px;
}
.sb-btn:hover { background: rgba(255,255,255,.2); }
.sb-btn.on { background: rgba(255,255,255,.3); }
.zoom-ctrl { display: flex; align-items: center; gap: 4px; }
.zoom-ctrl input[type="range"] { width: 86px; accent-color: #fff; height: 14px; }
.zoom-label { border: 0; background: transparent; color: #fff; font-size: 11px; cursor: pointer; width: 40px; text-align: right; }

/* ======================= Popups ======================= */
.popup-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.popup-layer .popup { pointer-events: auto; }
.popup {
  position: absolute;
  background: #fff;
  border: 1px solid #c8c6c3;
  border-radius: 3px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  padding: 5px;
  min-width: 132px;
  max-height: 74vh;
  overflow: auto;
  animation: pop .08s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.popup-head { font-size: 10.5px; color: #7a7875; padding: 2px 6px 5px; text-transform: uppercase; letter-spacing: .4px; }
.popup-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 5px 8px;
  background: none; border: 0; border-radius: 2px;
  text-align: left; font-size: 12px; cursor: pointer; color: #24232f;
}
.popup-item:hover { background: #eaf1fb; }
.popup-item i { width: 16px; text-align: center; color: #56544f; font-size: 12px; }
.popup-sep { height: 1px; background: #eae8e5; margin: 4px 2px; }
.font-prev { font-size: 13px; }

.swatches { display: grid; grid-template-columns: repeat(10, 17px); gap: 3px; padding: 2px 4px 4px; }
.swatches.auto { grid-template-columns: 1fr; }
.sw {
  width: 17px; height: 17px; border: 1px solid rgba(0,0,0,.22);
  border-radius: 2px; cursor: pointer; padding: 0;
}
.sw:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw-custom { display: flex; align-items: center; gap: 6px; padding: 5px 6px 2px; font-size: 11px; color: #5f5d5b; border-top: 1px solid #eee; margin-top: 3px; }
.sw-custom input[type="color"] { width: 26px; height: 20px; border: 1px solid #ccc; padding: 0; background: none; cursor: pointer; }

.tbl-grid { display: grid; grid-template-columns: repeat(8, 15px); gap: 2px; }
.tbl-cell {
  width: 15px; height: 15px; border: 1px solid #b9b7b3; background: #fff; border-radius: 1px; cursor: pointer; padding: 0;
}
.tbl-cell.hl { background: #cfe0f5; border-color: #8aa8d0; }
.tbl-label { font-size: 11px; color: #5f5d5b; padding: 5px 2px 0; min-height: 18px; }

.shape-grid { display: grid; grid-template-columns: repeat(3, 52px); gap: 4px; padding: 2px; }
.shape-item {
  width: 52px; height: 44px; background: #fff; border: 1px solid #e0dedb; border-radius: 2px;
  display: grid; place-items: center; cursor: pointer; padding: 3px;
}
.shape-item:hover { border-color: var(--accent); background: #f4f8ff; }
.shape-item svg { width: 40px; height: 30px; }

.sym-grid { display: grid; grid-template-columns: repeat(8, 26px); gap: 2px; padding: 2px; }
.sym {
  width: 26px; height: 26px; border: 1px solid #e4e2df; background: #fff; border-radius: 2px;
  cursor: pointer; font-size: 14px; display: grid; place-items: center; padding: 0;
}
.sym:hover { background: #eaf1fb; border-color: var(--accent); }

.theme-grid { display: grid; grid-template-columns: repeat(2, 118px); gap: 6px; padding: 2px; }
.theme-card { border: 1px solid #e0dedb; border-radius: 3px; background: #fff; cursor: pointer; padding: 0; overflow: hidden; text-align: left; }
.theme-card:hover { border-color: var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.theme-swatch { height: 34px; display: flex; }
.theme-swatch span { flex: 1; }
.theme-name { font-size: 11px; padding: 4px 6px; color: #3a3936; }

.margin-opt { display: flex; align-items: center; gap: 9px; width: 100%; padding: 5px 8px; border: 0; background: none; border-radius: 2px; cursor: pointer; text-align: left; font-size: 12px; }
.margin-opt:hover { background: #eaf1fb; }
.margin-opt .mini { width: 34px; height: 30px; border: 1px solid #b9b7b3; position: relative; flex: 0 0 auto; background: #fff; }
.margin-opt .mini i { position: absolute; inset: 6px 8px; border: 1px dashed #9aa7b8; display: block; }
.margin-opt .mini i.thin { inset: 3px 4px; }
.margin-opt .mini i.wide { inset: 7px 12px; }
.margin-opt .mini i.mid { inset: 7px 9px; }
.margin-opt small { display: block; color: #85837f; font-size: 10.5px; }

.zoom-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; padding: 2px; }
.zoom-item { border: 1px solid #e4e2df; background: #fff; border-radius: 2px; padding: 6px; font-size: 12px; cursor: pointer; }
.zoom-item:hover { background: #eaf1fb; border-color: var(--accent); }

/* ======================= Modals ======================= */
.modal-layer { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal-layer[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 26, 36, .32); }
.modal {
  position: relative;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  animation: modalIn .12s ease-out;
}
.modal.wide { width: 620px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #eae8e5;
  font-weight: 600; font-size: 13.5px; color: #26251f;
}
.modal-x { border: 0; background: none; cursor: pointer; color: #6d6b69; font-size: 14px; padding: 2px 4px; }
.modal-x:hover { color: #000; }
.modal-body { padding: 14px; overflow: auto; font-size: 12.5px; color: #3a3936; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid #eae8e5; background: #fafafa; }
.btn {
  padding: 6px 14px; border-radius: 2px; border: 1px solid #c8c6c3;
  background: #fff; font-size: 12.5px; cursor: pointer; color: #26251f;
}
.btn:hover { background: #f2f1ef; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 11.5px; color: #6d6b69; margin-bottom: 3px; }
.inp, .ta {
  width: 100%; border: 1px solid #c8c6c3; border-radius: 2px;
  padding: 6px 8px; font-family: inherit; font-size: 12.5px; color: #26251f; background: #fff;
}
.inp:focus, .ta:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.ta { resize: vertical; min-height: 90px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #4a4845; margin: 6px 0; }
.stat-grid { display: grid; grid-template-columns: 1fr auto; gap: 0; border: 1px solid #eae8e5; border-radius: 3px; overflow: hidden; }
.stat-grid > div { padding: 8px 12px; border-bottom: 1px solid #f0eeeb; font-size: 12.5px; }
.stat-grid > div:nth-child(even) { font-weight: 700; text-align: right; color: var(--accent); }
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 2px; border-bottom: 1px solid #f1efec; font-size: 12.5px;
}
.issue-list li:last-child { border-bottom: 0; }
.issue-list .sug { color: #2e7d32; font-weight: 600; }
.issue-list .bad { color: #b3261e; }
.mini-btn { border: 1px solid #c8c6c3; background: #fff; border-radius: 2px; padding: 3px 8px; font-size: 11.5px; cursor: pointer; }
.mini-btn:hover { background: #eef2f8; border-color: var(--accent); }
.file-menu { display: grid; gap: 2px; }
.file-op { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 3px; cursor: pointer; text-align: left; font-size: 13px; }
.file-op:hover { background: #eef2f8; }
.file-op i { width: 18px; color: var(--accent); }
.file-op small { display: block; color: #85837f; font-size: 11px; }

/* ======================= Toast ======================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translate(-50%, 12px);
  background: #26251f;
  color: #fff;
  padding: 8px 16px;
  border-radius: 3px;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 100;
  box-shadow: 0 6px 18px rgba(0,0,0,.24);
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ======================= Read mode ======================= */
.app.read-mode .ribbon,
.app.read-mode .tabstrip,
.app.read-mode .ruler-row { display: none; }
.app.read-mode .canvas { background: #fdfdfd; }
.app.read-mode .scroller { padding: 30px 16px 60px; }
.app.read-mode .page { width: min(760px, 100%); min-height: 0; padding: 40px 34px !important; box-shadow: none; }
.app.read-mode .page-header, .app.read-mode .page-footer { display: none !important; }
.exit-read {
  position: fixed;
  top: 42px;
  right: 14px;
  z-index: 70;
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 16px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,.2);
}
.app.read-mode .exit-read { display: inline-flex; }

/* ======================= Responsive ======================= */
@media (max-width: 900px) {
  .save-state { display: none; }
  .scroller { padding: 14px 10px 60px; }
  .sidepane { flex-basis: 220px; width: 220px; }
  .sb-lang, .sb-sep.opt { display: none; }
}
/* HP & layar sentuh: target sentuh minimal 44x44 px */
@media (max-width: 768px) {
  .titlebar { height: 46px; flex-basis: 46px; padding: 0 6px; gap: 4px; }
  .tabstrip { top: 46px; height: 34px; flex-basis: 34px; }
  .ribbon { top: 80px; min-height: 0; max-height: 156px; padding-bottom: 2px; }
  .doc-title { width: 180px; font-size: 12px; padding: 6px 8px; }
  .app-logo { width: 30px; font-size: 19px; }
  .qa { width: 44px; height: 44px; font-size: 15px; }
  .quick-access { gap: 2px; }
  .qa-sep { display: none; }
  .user-chip { width: 36px; height: 36px; font-size: 12px; }
  .file-tab, .tab { height: 32px; min-width: 44px; padding: 0 12px; }
  .rb { min-height: 44px; padding: 4px 8px; }
  .rb i { font-size: 15px; }
  .rb.small { min-height: 40px; }
  .rb.big { min-width: 62px; max-width: 92px; }
  .combo { height: 34px; }
  .combo.size-combo { width: 70px; }
  .qb-hidden { display: none; }
  .group-body { min-height: 68px; }
  .gallery { height: 68px; }
  .scroller { padding: 10px 6px 40px; }
  .page {
    width: auto !important;
    max-width: 100%;
    min-height: 0;
    padding: 26px 20px !important;
  }
  .ruler-row { display: none; }
  .sidepane { position: absolute; left: 0; top: 0; bottom: 0; z-index: 20; box-shadow: 0 0 20px rgba(0,0,0,.18); }
  .sidepane + .canvas + .sidepane { position: absolute; right: 0; left: auto; top: 0; bottom: 0; }
  .group-label { font-size: 9.5px; }
  .sb-btn, .zoom-label { min-width: 44px; min-height: 44px; }
  .sb-btn i { font-size: 14px; }
  .zoom-ctrl input[type="range"] { width: 58px; }
  .sb-left #sbPage { display: none; }
  /* Area editor punya scroll sendiri + tinggi proporsional agar keyboard
     virtual tidak menutupi toolbar (100dvh sudah dipakai oleh .app) */
  .page-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 180px;
    max-height: calc(var(--app-h, 100dvh) - 260px);
  }
}

/* Layar pendek (mis. HP miring / keyboard terbuka) */
@media (max-height: 520px) {
  .titlebar { height: 40px; flex-basis: 40px; }
  .qa { width: 40px; height: 40px; }
  .tabstrip { height: 30px; flex-basis: 30px; top: 40px; }
  .ribbon { top: 70px; max-height: 108px; }
  .rb.big { height: 54px; }
  .group-body { min-height: 54px; }
  .gallery { height: 54px; }
  .page-body { min-height: 120px; max-height: calc(var(--app-h, 100dvh) - 210px); }
}

/* Titik pegangan lebih besar untuk layar sentuh */
@media (pointer: coarse) {
  .obj-frame .oh { width: 16px; height: 16px; border-width: 2px; }
  .oh-nw { left: -8px; top: -8px; }
  .oh-n  { top: -8px; margin-left: -8px; }
  .oh-ne { right: -8px; top: -8px; }
  .oh-e  { right: -8px; margin-top: -8px; }
  .oh-se { right: -8px; bottom: -8px; }
  .oh-s  { bottom: -8px; margin-left: -8px; }
  .oh-sw { left: -8px; bottom: -8px; }
  .oh-w  { left: -8px; margin-top: -8px; }
}

/* ======================= Objek: pilih, hapus, blok tabel ======================= */
/* Kursor pemilih baris (panah kanan) & kolom (panah bawah) */
.page.cur-pick-row, .page-body.cur-pick-row { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22'><path d='M2 11h15M12 5l6 6-6 6' stroke='%232B579A' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") 11 11, default; }
.page.cur-pick-col, .page-body.cur-pick-col { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22'><path d='M11 2v15M5 12l6 6 6-6' stroke='%232B579A' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") 11 11, default; }
.page-body .selected-element { outline: 2px solid rgba(43,87,154,.5); outline-offset: 1px; }
.page-body table.doc-table.selected-element { outline-offset: 0; }
.obj-frame.no-handles .oh { display: none; }
.obj-del {
  position: absolute;
  top: -13px;
  right: -13px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #c62828;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.obj-del:hover { background: #e53935; }
.obj-del i { pointer-events: none; }

/* Sorotan pemilih baris / kolom tabel */
.tbl-band {
  position: fixed;
  z-index: 61;
  pointer-events: none;
  background: rgba(43,87,154,.13);
  border: 1px solid rgba(43,87,154,.55);
  border-radius: 2px;
}
.tbl-band[hidden] { display: none !important; }
.page-body .tbl-row-sel,
.page-body .tbl-col-sel { background: rgba(43,87,154,.18) !important; }
.page-body table.doc-table.tbl-sel { outline: 2px solid rgba(43,87,154,.5); outline-offset: 1px; }

/* ======================= Print ======================= */
@media print {
  .titlebar, .tabstrip, .ribbon, .statusbar, .sidepane, .ruler-row, .exit-read, .toast { display: none !important; }
  .canvas, .scroller { background: #fff !important; padding: 0 !important; overflow: visible !important; }
  .page { box-shadow: none !important; width: auto !important; padding: 0 !important; margin: 0 !important; }
  .page-break::after, .page-break { border: 0 !important; }
  .zoom-wrap { zoom: 1 !important; }
  .page-body .page-break { break-after: page; }
  .obj-frame, .obj-del, .tbl-band { display: none !important; }
  .page-body { overflow: visible !important; max-height: none !important; }
}
