*, *::before, *::after { box-sizing: border-box; }

body, html {
  margin: 0; padding: 0;
  width: 100vw; height: 100vh;
  overflow: hidden;
  background: #fff;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 11px;
  line-height: 1.8;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== VIEW TRANSITIONS ===== */
#editor-view, #cards-view, #doc-cards-view, #document-view {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform: translateY(4px);
}
#editor-view.view-active, #cards-view.view-active, #doc-cards-view.view-active, #document-view.view-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ===== TOOLBAR ===== */
#toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  gap: 8px;
  z-index: 100;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
#toolbar-left  { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
#toolbar-center { flex: 1; display: flex; justify-content: center; }
#toolbar-right  { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }

#folder-status {
  font-size: 10px; color: rgba(0,0,0,0.3);
  max-width: 160px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
#folder-status.ready { color: rgba(0,0,0,0.45); }
#folder-status.error { color: #c44; }

.toolbar-btn {
  background: none;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 10px;
  color: #777;
  cursor: pointer;
  transition: all 0.14s;
  font-family: inherit;
  line-height: 1.5;
  display: flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.toolbar-btn:hover { background: rgba(0,0,0,0.04); color: #444; border-color: rgba(0,0,0,0.18); }
.toolbar-btn:focus { background: #222; color: #fff; border-color: #222; outline: none; }
.toolbar-btn.active { background: #222; color: #fff; border-color: #222; }
.toolbar-btn.active:hover { background: #444; }
.icon-btn { padding: 3px 7px; }

.beta-tag {
  font-size: 8px; background: #f60; color: #fff;
  border-radius: 3px; padding: 0 3px; line-height: 1.4; margin-left: 1px;
}

/* ===== PILL LAYOUT TOGGLE ===== */
#btn-layout-toggle {
  background: rgba(0,0,0,0.03) !important;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 20px;
  padding: 1.5px;
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
}
#btn-layout-toggle:hover {
  background: rgba(0,0,0,0.06) !important;
  border-color: rgba(0,0,0,0.15);
}
#btn-layout-toggle:focus {
  background: rgba(0,0,0,0.03) !important;
  border-color: #222;
  box-shadow: 0 0 0 1px #222;
  color: inherit;
}
.toggle-option {
  padding: 2.5px 8px;
  font-size: 10px;
  color: #777;
  border-radius: 15px;
  transition: all 0.15s ease;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  user-select: none;
}
.toggle-option.active {
  background: #222;
  color: #fff;
}
#btn-layout-toggle:focus .toggle-option.active {
  background: #222; /* keep active option dark when container has focus */
}


/* ===== SEARCH BAR ===== */
#search-bar { display: flex; align-items: center; gap: 4px; width: 260px; }
#search-input {
  flex: 1; border: 1px solid rgba(0,0,0,0.1); border-radius: 5px;
  padding: 4px 10px; font-size: 11px; font-family: inherit;
  background: rgba(0,0,0,0.03); outline: none; transition: border-color 0.14s;
}
#search-input:focus { border-color: rgba(0,0,0,0.25); background: #fff; }
.search-clear-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(0,0,0,0.3); font-size: 12px; padding: 2px 4px;
  line-height: 1; border-radius: 3px; transition: color 0.14s;
}
.search-clear-btn:hover { color: #c44; }

/* ===== SETUP OVERLAY ===== */
#setup-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.97);
  z-index: 600;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  transition: opacity 0.3s;
}
#setup-overlay.hidden { opacity: 0; pointer-events: none; }
#setup-overlay h1 { font-size: 18px; font-weight: 700; color: #222; margin: 0; }
#setup-overlay p { font-size: 12px; color: #888; margin: 0; text-align: center; line-height: 1.8; }
#btn-pick-folder {
  background: #333; color: #fff;
  border: none; border-radius: 8px;
  padding: 10px 28px; font-size: 13px;
  font-family: inherit; cursor: pointer;
  transition: background 0.14s;
}
#btn-pick-folder:hover { background: #555; }

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.72); color: #fff;
  padding: 6px 18px; border-radius: 6px; font-size: 11px;
  opacity: 0; transition: opacity 0.22s, transform 0.22s;
  z-index: 500; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== SAVE INDICATOR ===== */
#save-indicator {
  position: fixed; bottom: 10px; right: 14px;
  font-size: 9px; color: rgba(0,0,0,0.2);
  z-index: 200; transition: opacity 0.5s;
}

/* ===== ALL MAIN VIEWS ===== */
#editor-view, #cards-view, #doc-cards-view, #document-view {
  position: absolute;
  top: 36px; left: 0; right: 0;
  height: calc(100vh - 36px);
}

/* ===== EDITOR VIEW ===== */
#editor-view {
  display: flex;
  background: #fff; z-index: 5;
}
.column {
  flex: 1; height: 100%;
  position: relative; padding: 12px 16px 20px;
}
.column + .column { border-left: 1px solid rgba(0,0,0,0.06); }
.column::before {
  content: attr(data-col);
  position: absolute; top: 4px; left: 50%;
  transform: translateX(-50%);
  font-size: 8px; color: rgba(0,0,0,0.1);
  pointer-events: none; font-weight: 600; letter-spacing: 0.5px;
}
.editor {
  width: 100%; height: 100%;
  outline: none; overflow: hidden;
  white-space: pre-wrap; word-wrap: break-word;
  caret-color: #333; line-height: 1.6;
}
.editor > div { margin-bottom: 0.3em; }
.editor:empty::before { content: 'Click to type...'; color: #ccc; pointer-events: none; }
.editor .heading  { font-size: 13px; font-weight: 700; color: #222; margin-bottom: 0.3em; margin-top: 0.2em; }
.editor .indent-1 { padding-left: 2em; }
.editor .indent-2 { padding-left: 4em; }
.editor .indent-3 { padding-left: 6em; }
.editor .indent-4 { padding-left: 8em; }

/* Checklist Item (Markdown-style visual checkbox) */
.editor div.checklist-item {
  position: relative;
  padding-left: 18px;
}
.editor div.checklist-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2.5px;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(0, 0, 0, 0.28);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.12s ease;
}
.editor div.checklist-item:hover::before {
  border-color: rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.02);
}
.editor div.checklist-item.checked {
  color: rgba(0, 0, 0, 0.35);
  text-decoration: line-through;
}
.editor div.checklist-item.checked::before {
  background: #0050c8;
  border-color: #0050c8;
}
.editor div.checklist-item.checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 3.5px;
  height: 6.5px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}

/* Checklist indentation */
.editor div.checklist-item.indent-1 { padding-left: calc(2em + 18px); }
.editor div.checklist-item.indent-1::before { left: 2em; }
.editor div.checklist-item.indent-1.checked::after { left: calc(2em + 4px); }

.editor div.checklist-item.indent-2 { padding-left: calc(4em + 18px); }
.editor div.checklist-item.indent-2::before { left: 4em; }
.editor div.checklist-item.indent-2.checked::after { left: calc(4em + 4px); }

.editor div.checklist-item.indent-3 { padding-left: calc(6em + 18px); }
.editor div.checklist-item.indent-3::before { left: 6em; }
.editor div.checklist-item.indent-3.checked::after { left: calc(6em + 4px); }

.editor div.checklist-item.indent-4 { padding-left: calc(8em + 18px); }
.editor div.checklist-item.indent-4::before { left: 8em; }
.editor div.checklist-item.indent-4.checked::after { left: calc(8em + 4px); }

/* ===== CARDS VIEW ===== */
#cards-view, #doc-cards-view {
  padding: 20px 32px;
  overflow-y: auto; background: #f8f8f8;
  z-index: 10;
}
.cards-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.cards-title { font-size: 12px; font-weight: 600; color: #888; letter-spacing: 0.4px; }
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.card-new {
  border: 1px dashed rgba(0,0,0,0.13); border-radius: 8px;
  padding: 20px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; min-height: 100px; transition: all 0.14s;
  color: rgba(0,0,0,0.25); font-size: 13px; background: #fff;
}
.card-new:hover { border-color: rgba(0,0,0,0.28); color: rgba(0,0,0,0.45); }
.card {
  border: 1px solid rgba(0,0,0,0.08); border-radius: 8px;
  padding: 14px; cursor: pointer; height: 140px;
  transition: all 0.14s; position: relative; overflow: hidden;
  background: #fff;
}
.card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 36px;
  background: linear-gradient(transparent, #fff 90%);
  pointer-events: none; border-radius: 0 0 8px 8px;
}
.card:hover { border-color: rgba(0,0,0,0.16); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.card.selected, .card-new.selected { border-color: #333; box-shadow: 0 0 0 2px rgba(0,0,0,0.1); }
.card.editing { border-color: rgba(0,120,255,0.35); }
.card-headings { font-size: 11px; color: #444; line-height: 1.7; }
.card-heading-item { font-weight: 600; margin-bottom: 2px; }

/* ===== DOC CARDS VIEW (List) ===== */
.gd-list-container {
  background: #fff; border-radius: 8px; border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden; font-size: 13px; margin-top: 16px;
  max-width: 800px; margin-left: auto; margin-right: auto;
}
.gd-list-header {
  display: grid; grid-template-columns: minmax(200px, 1fr) 150px 50px;
  padding: 10px 16px; border-bottom: 1px solid rgba(0,0,0,0.1);
  font-weight: 500; color: #5f6368; font-size: 12px;
}
.gd-list-row {
  display: grid; grid-template-columns: minmax(200px, 1fr) 150px 50px;
  padding: 10px 16px; align-items: center; border-bottom: 1px solid rgba(0,0,0,0.04);
  cursor: pointer; color: #202124; transition: background 0.1s;
}
.gd-list-row:hover { background: #f5f5f5; }
.gd-list-row.selected { background: #e8f0fe; color: #1967d2; }
.gd-list-row.editing { border: 1px solid rgba(0,120,255,0.35); }
.gd-list-row:last-child { border-bottom: none; }
.gd-col-name { display: flex; align-items: center; gap: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-icon { font-size: 16px; color: #1967d2; }
.gd-col-date { color: #5f6368; font-size: 12px; }
.gd-actions { text-align: right; opacity: 0; transition: opacity 0.1s; display: flex; justify-content: flex-end; }
.gd-list-row:hover .gd-actions { opacity: 1; }
.gd-action-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 50%; color: #5f6368; font-size: 14px; }
.gd-action-btn:hover { background: rgba(0,0,0,0.05); color: #202124; }
.gd-action-btn.delete:hover { color: #d93025; background: rgba(217,48,37,0.05); }
.doc-list-item-new {
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: #fff; border: 1px dashed rgba(0,0,0,0.15);
  border-radius: 8px; cursor: pointer; transition: 0.1s;
  color: rgba(0,0,0,0.35); font-size: 13px; margin-bottom: 16px;
}
.doc-list-item-new.selected { border-color: #333; box-shadow: 0 0 0 2px rgba(0,0,0,0.1); color: #333; }
.doc-list-item-new:hover { border-color: rgba(0,0,0,0.28); color: rgba(0,0,0,0.5); }
.card-meta { font-size: 9px; color: rgba(0,0,0,0.2); margin-top: 6px; }
.card-folders-label { font-size: 9px; color: rgba(60,100,200,0.6); margin-top: 2px; }

.card-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; gap: 2px; opacity: 0; transition: opacity 0.13s;
}
.card:hover .card-actions { opacity: 1; }
.card-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 11px; padding: 2px 4px; border-radius: 3px;
  line-height: 1; transition: all 0.13s; color: rgba(0,0,0,0.2);
}
.card-action-btn:hover { color: #555; background: rgba(0,0,0,0.06); }
.card-action-btn.delete:hover { color: #c44; background: rgba(200,60,60,0.06); }
.card-action-btn.unarchive:hover { color: #0050c8; background: rgba(0,80,200,0.08); }
.card.pinned .card-action-btn.pin { color: #f80; opacity: 1; }
.card.pinned .card-actions { opacity: 1; }
/* But keep delete button hidden until hover on pinned cards */
.card.pinned .card-actions .card-action-btn:not(.pin) { opacity: 0; transition: opacity 0.13s; }
.card.pinned:hover .card-actions .card-action-btn:not(.pin) { opacity: 1; }

.card.is-archived {
  background: #fdfdfd;
  border-style: dashed;
}
.card-badge-archive {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  background: #f1f3f4;
  color: #5f6368;
  padding: 1px 5px;
  border-radius: 4px;
  margin-bottom: 4px;
  font-weight: 500;
}
.gd-badge-archive {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  background: #f1f3f4;
  color: #5f6368;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.gd-action-btn.unarchive:hover {
  color: #0050c8;
  background: rgba(0, 80, 200, 0.08);
}

/* ===== FOLDER SIDEBAR ===== */
#folder-sidebar {
  position: fixed;
  top: 36px; left: -280px;
  width: 260px;
  height: calc(100vh - 36px);
  background: #fff;
  border-right: 1px solid rgba(0,0,0,0.09);
  box-shadow: 4px 0 24px rgba(0,0,0,0.09);
  z-index: 80;
  display: flex; flex-direction: column;
  transition: left 0.24s cubic-bezier(0.25, 0.8, 0.25, 1);
}
#folder-sidebar.open { left: 0; }

#folder-sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.12);
  z-index: 79;
  cursor: default;
}

#folder-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  font-size: 12px; font-weight: 600; color: #555;
  flex-shrink: 0;
}
.sidebar-header-actions {
  display: flex; gap: 4px;
}
.sidebar-icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: rgba(0,0,0,0.4); padding: 3px 6px;
  border-radius: 4px; line-height: 1; transition: all 0.13s;
}
.sidebar-icon-btn:hover { color: #333; background: rgba(0,0,0,0.06); }

#folder-sidebar-list {
  flex: 1; overflow-y: auto; padding: 6px 0;
}

/* Sidebar folder items */
.sb-folder {
  user-select: none;
}
.sb-folder-row {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px 6px 12px;
  cursor: pointer; transition: background 0.12s;
  border-radius: 0;
  font-size: 12px; color: #444;
}
.sb-folder-row:hover { background: rgba(0,0,0,0.04); }
.sb-folder-row.selected { background: rgba(0,0,0,0.07); color: #111; font-weight: 500; }
.sb-arrow { font-size: 9px; color: rgba(0,0,0,0.25); width: 12px; flex-shrink: 0; transition: transform 0.14s; }
.sb-folder.open > .sb-folder-row .sb-arrow { transform: rotate(90deg); }
.sb-folder-icon { font-size: 13px; }
.sb-folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-folder-actions { display: flex; gap: 1px; opacity: 0; transition: opacity 0.12s; }
.sb-folder-row:hover .sb-folder-actions { opacity: 1; }
.sb-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 10px; padding: 1px 3px; border-radius: 3px;
  color: rgba(0,0,0,0.25); transition: all 0.12s;
}
.sb-action-btn:hover { color: #c44; background: rgba(200,60,60,0.07); }

.sb-children {
  display: none;
  border-left: 1px solid rgba(0,0,0,0.07);
  margin-left: 20px;
  padding-left: 0;
}
.sb-folder.open > .sb-children { display: block; }

.sb-memo-row {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px 5px 10px;
  cursor: pointer; transition: background 0.12s;
  font-size: 11px; color: #555;
}
.sb-memo-row:hover { background: rgba(0,0,0,0.04); }
.sb-memo-row.selected { background: rgba(0,80,200,0.08); color: #0050c8; font-weight: 500; }
.sb-memo-row.active-page { color: rgba(0,80,200,0.7); }
.sb-memo-icon { font-size: 11px; color: rgba(0,0,0,0.65); flex-shrink: 0; }
.sb-memo-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sb-empty { color: rgba(0,0,0,0.25); font-size: 10px; padding: 4px 12px; font-style: italic; }

/* Sidebar drag & drop */
.sb-memo-row[draggable] { cursor: grab; }
.sb-memo-row.dragging { opacity: 0.4; cursor: grabbing; }
.sb-folder-row.drag-over { background: rgba(0,80,200,0.08); border-radius: 5px; }

/* Sidebar inline rename */
.sb-rename-input {
  flex: 1; border: none; border-bottom: 1px solid rgba(0,80,200,0.5);
  background: transparent; font-size: 12px; font-family: inherit;
  color: #111; outline: none; padding: 0 2px; min-width: 0;
}

/* Sidebar statistics footer */
#folder-sidebar-stats {
  flex-shrink: 0;
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(0,0,0,0.07);
  background: rgba(0,0,0,0.015);
  font-size: 10.5px;
  line-height: 1.6;
  user-select: none;
}
.sidebar-stats-title {
  font-size: 10px;
  font-weight: 600;
  color: rgba(0,0,0,0.35);
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}
.sidebar-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.sidebar-stats-label {
  color: #777;
}
.sidebar-stats-val {
  color: #222;
  font-weight: 500;
  font-feature-settings: "tnum";
}
.sidebar-stats-breakdown {
  font-size: 9.5px;
  color: rgba(0,0,0,0.4);
  font-weight: 400;
  margin-left: 2px;
}

/* ===== FOLDER ASSIGN MODAL ===== */
#folder-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.2); z-index: 400;
}
#folder-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px; background: #fff;
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.16);
  z-index: 401; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; border-bottom: 1px solid rgba(0,0,0,0.07);
  font-size: 12px; font-weight: 600; color: #333;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 15px; color: #999; padding: 2px 5px; border-radius: 4px;
}
.modal-close:hover { background: rgba(0,0,0,0.05); }
#folder-modal-list { padding: 6px 0; max-height: 220px; overflow-y: auto; }
.folder-modal-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 15px; cursor: pointer; transition: background 0.12s;
  font-size: 12px;
}
.folder-modal-item:hover { background: rgba(0,0,0,0.04); }
.folder-modal-item.checked { color: #0050c8; }
.folder-modal-check { font-size: 13px; color: rgba(0,0,0,0.15); }
.folder-modal-item.checked .folder-modal-check { color: #0050c8; }
.folder-modal-item.selected-by-key { background: rgba(0,80,200,0.08); }
.modal-footer {
  display: flex; gap: 7px;
  padding: 11px 15px; border-top: 1px solid rgba(0,0,0,0.07);
}
#folder-modal-new-input {
  flex: 1; border: 1px solid rgba(0,0,0,0.1); border-radius: 5px;
  padding: 5px 9px; font-size: 11px; font-family: inherit; outline: none;
  transition: all 0.12s ease;
}
#folder-modal-new-input:focus, #folder-modal-new-input.focused-by-key {
  border-color: #0050c8;
  box-shadow: 0 0 0 2px rgba(0,80,200,0.15);
}

/* ===== ARCHIVE BANNER ===== */
#archive-banner {
  position: absolute;
  top: 36px; left: 0; right: 0;
  height: 28px;
  background: #fbf6ec;
  border-bottom: 1px solid #ebdcc5;
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  font-size: 11px; color: #8a6d3b;
  z-index: 50;
}
.archive-banner-btn {
  background: #fff;
  border: 1px solid #d4c2a5;
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 10px;
  color: #6c5428;
  cursor: pointer;
  transition: all 0.12s;
}
.archive-banner-btn:hover {
  background: #f0e6d6;
  border-color: #bfa885;
}
#editor-view.with-archive-banner {
  top: 64px !important;
  height: calc(100vh - 64px) !important;
}

/* ===== SIDEBAR UNARCHIVE BUTTON ===== */
.sb-unarchive-btn {
  background: none; border: none; cursor: pointer;
  font-size: 11px; opacity: 0; transition: opacity 0.12s, transform 0.12s;
  padding: 1px 4px; border-radius: 3px; margin-left: 4px;
  line-height: 1;
}
.sb-memo-row:hover .sb-unarchive-btn { opacity: 0.7; }
.sb-unarchive-btn:hover { opacity: 1; transform: scale(1.1); background: rgba(0,0,0,0.06); }

/* ===== DOCUMENT VIEW ===== */
#document-view, #doc-cards-view {
  background: #f0f0f0;
  z-index: 15;
  overflow-y: auto; overflow-x: hidden;
}

#doc-editor-wrap {
  min-height: 100%;
  padding: 32px;
  display: flex; flex-direction: column; align-items: center;
}

/* Document Layout Wrapper */
#doc-pages-container {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
}
#doc-pages-container.layout-1up {
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
}

/* Add Page Button */
#doc-add-page {
  display: none !important;
}
#btn-add-doc-page {
  background: none; border: 1px dashed rgba(0,0,0,0.2);
  border-radius: 8px; padding: 12px 32px; font-size: 13px;
  color: rgba(0,0,0,0.4); cursor: pointer; transition: all 0.14s;
  font-family: inherit;
}
#btn-add-doc-page:hover {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.3); color: #333;
}

/* A4 page: Scaled to roughly 460x650 */
.doc-page {
  width: 560px;
  height: 792px;
  background: #fff;
  box-shadow: 0 2px 20px rgba(0,0,0,0.12);
  padding: 50px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.doc-page-label {
  position: absolute; top: -22px; left: 0;
  font-size: 10px; color: rgba(0,0,0,0.3); font-weight: 500;
}

.doc-editor {
  flex: 1; outline: none; line-height: 1.5;
  font-size: 10px; color: #2a2a2a; caret-color: #333;
  overflow: hidden;
}

.doc-editor > div, .doc-editor > p, .doc-editor > h1, .doc-editor > h2, .doc-editor > h3 {
  margin-bottom: 0.4em;
}

.doc-editor:empty::before {
  content: attr(data-placeholder); color: rgba(0,0,0,0.2); pointer-events: none;
}
.doc-editor > div { margin-bottom: 0.1em; }

/* Doc heading styles */
.doc-editor .doc-h1 { font-size: 18px; font-weight: 700; color: #111; margin: 0.7em 0 0.2em; line-height: 1.3; }
.doc-editor .doc-h2 { font-size: 15px; font-weight: 700; color: #222; margin: 0.6em 0 0.2em; line-height: 1.3; border-bottom: 1px solid rgba(0,0,0,0.08); padding-bottom: 4px; }
.doc-editor .doc-h3 { font-size: 12px; font-weight: 600; color: #333; margin: 0.5em 0 0.15em; line-height: 1.4; }
.doc-editor .doc-h4 { font-size: 11px; font-weight: 600; color: #555; margin: 0.4em 0 0.1em; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.04em; }

/* Doc indent styles */
.doc-editor .indent-1 { padding-left: 2em; }
.doc-editor .indent-2 { padding-left: 4em; }
.doc-editor .indent-3 { padding-left: 6em; }
.doc-editor .indent-4 { padding-left: 8em; }
