@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Merriweather:wght@400;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --blue-dark: #1e40af;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --yellow: #ca8a04;
  --yellow-light: #fefce8;
  --red: #dc2626;
  --red-light: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.65;
}

/* ===== App Layout ===== */
.app-layout {
  position: relative;
  min-height: 100vh;
}

.main-area {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  margin-left: 260px;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout.sidebar-hidden .main-area {
  margin-left: 0;
}

/* ===== Header (inside main-area) ===== */
.wiki-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  z-index: 100;
}

.header-inner {
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  position: relative;
}


.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--blue-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* header-search is defined above in .header-inner block */

.search-wrapper {
  position: relative;
  z-index: 500;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}


.header-actions {
  position: absolute;
  right: 32px;
  flex-shrink: 0;
}

.btn-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
  height: 38px;
}

.btn-header:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

/* Top nav (centered in header) */
.top-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
  padding-left: 36px;
}

.top-nav-link {
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s;
}

.top-nav-link:hover {
  color: var(--blue);
  background: var(--blue-light);
}

.top-nav-link.active {
  color: var(--blue);
  background: var(--blue-light);
  font-weight: 600;
}

/* ===== Sidebar ===== */
.wiki-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: #fbfbfa;
  border-right: 1px solid var(--gray-200);
  padding: 0 12px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 300;
  transform: translateX(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 12px rgba(0,0,0,0.12);
}

.app-layout.sidebar-hidden .wiki-sidebar {
  transform: translateX(-100%);
  box-shadow: none;
}

/* Sidebar search button */
.sidebar-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 8px);
  margin: 0 4px 12px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--gray-400);
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-search-btn:hover {
  border-color: var(--gray-300);
  color: var(--gray-600);
}

.sidebar-search-btn span {
  flex: 1;
  text-align: left;
}

.sidebar-search-btn kbd {
  font-size: 0.65rem;
  padding: 2px 5px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  color: var(--gray-400);
  font-family: inherit;
}

/* Search Modal */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}

.search-modal.hidden {
  display: none;
}

.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.search-modal-box {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.search-modal-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
}

.search-modal-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--gray-900);
  background: transparent;
}

.search-modal-input-wrap input::placeholder {
  color: var(--gray-400);
}

.search-modal-input-wrap kbd {
  font-size: 0.7rem;
  padding: 3px 6px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  color: var(--gray-400);
  font-family: inherit;
  cursor: pointer;
}

.search-modal-results {
  max-height: 360px;
  overflow-y: auto;
}

.search-modal-results.hidden {
  display: none;
}

.search-modal-suggestions {
  max-height: 360px;
  overflow-y: auto;
}

.search-modal-suggestions.hidden {
  display: none;
}

.search-suggestions-header {
  padding: 10px 18px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
}

.search-modal-suggestions .search-dropdown-item {
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-50);
  transition: background 0.1s;
}

.search-modal-suggestions .search-dropdown-item:last-child {
  border-bottom: none;
}

.search-modal-suggestions .search-dropdown-item:hover {
  background: var(--blue-light);
}

.search-modal-suggestions .search-dropdown-item strong {
  display: block;
  font-size: 0.875rem;
  color: var(--gray-900);
}

.search-modal-suggestions .search-dropdown-item span {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.search-modal-results .search-dropdown-item {
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-50);
  transition: background 0.1s;
}

.search-modal-results .search-dropdown-item:last-child {
  border-bottom: none;
}

.search-modal-results .search-dropdown-item:hover {
  background: var(--blue-light);
}

.search-modal-results .search-dropdown-item strong {
  display: block;
  font-size: 0.875rem;
  color: var(--gray-900);
}

.search-modal-results .search-dropdown-item span {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Sidebar brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-200);
  margin: 0 -12px 12px;
  padding-left: 16px;
}

.sidebar-brand-text strong {
  display: block;
  font-size: 0.9rem;
  color: var(--gray-900);
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-brand-text span {
  font-size: 0.65rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin-bottom: 4px;
}

.sidebar-header-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-700);
  letter-spacing: 0.3px;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Open button (in header, visible when sidebar is hidden) */
.sidebar-open-btn {
  position: absolute;
  left: 32px;
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-open-btn.visible {
  display: flex;
}

.sidebar-open-btn:hover {
  color: var(--gray-700);
  background: var(--gray-100);
}

.sidebar-box { margin-bottom: 20px; }

.sidebar-box h3 {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  padding: 6px 12px;
  margin-bottom: 4px;
}

.sidebar-box ul { list-style: none; }

.sidebar-box a {
  display: block;
  padding: 6px 12px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 450;
  cursor: pointer;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-box a:hover {
  background: #f0f1f3;
  color: var(--gray-800);
}

.sidebar-box a.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
  border-left-color: var(--blue);
}

.review-badge {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}

.review-badge.overdue { background: var(--red); }
.review-badge.due { background: var(--yellow); }

/* ===== Main Content ===== */
.wiki-content {
  flex: 1;
  background: #fff;
  padding: 28px 48px 60px;
  max-width: 1100px;
  margin: 0;
  width: 100%;
}

/* Article */
.article-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 12px;
  line-height: 1.3;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0 16px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 24px;
  font-size: 0.78rem;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.72rem;
}

.meta-tag.category {
  background: var(--blue-light);
  color: var(--blue-dark);
}

.meta-tag.owner {
  background: var(--gray-100);
  color: var(--gray-600);
}

.meta-tag.status-active {
  background: var(--green-light);
  color: var(--green);
}

.meta-tag.status-draft {
  background: var(--yellow-light);
  color: var(--yellow);
}

.meta-tag.status-deprecated {
  background: var(--red-light);
  color: var(--red);
}

.meta-tag.review-ok {
  background: var(--green-light);
  color: var(--green);
}

.meta-tag.review-due {
  background: var(--yellow-light);
  color: var(--yellow);
}

.meta-tag.review-overdue {
  background: var(--red-light);
  color: var(--red);
}

.meta-text {
  color: var(--gray-400);
  font-size: 0.78rem;
}

/* Article body */
.article-body {
  position: relative;
  overflow: visible;
  word-wrap: break-word;
  min-height: 600px;
  padding-bottom: 400px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

.article-body h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
  clear: both;
}

.article-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--gray-800);
}

/* Article figures (saved from editor) */
.article-figure,
.article-body figure {
  margin: 16px 0;
  padding: 0;
  display: block;
  border: none;
  outline: none;
}

.article-figure img,
.article-body figure img {
  height: auto;
  border-radius: 6px;
  display: block;
}

.article-figure figcaption,
.article-body figure figcaption {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-top: 6px;
}

.article-body p {
  margin-bottom: 12px;
  color: var(--gray-700);
}

.article-body ul, .article-body ol {
  margin: 6px 0 14px 24px;
}

.article-body li { margin-bottom: 5px; color: var(--gray-700); }

.article-body code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
  color: var(--blue-dark);
}

.article-body pre {
  background: var(--gray-900);
  color: #e5e7eb;
  padding: 16px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 10px 0 18px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.82em;
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.article-body blockquote {
  border-left: 3px solid var(--gray-800);
  padding-left: 14px;
  margin: 12px 0;
  color: var(--gray-600);
  font-style: italic;
}

.article-body .callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 12px 0;
}

.article-body .callout p {
  margin: 0;
  font-size: 0.9rem;
  color: #92400e;
}

.article-body ul {
  list-style: disc;
  padding-left: 24px;
  margin: 8px 0;
}

.article-body ol {
  list-style: decimal;
  padding-left: 24px;
  margin: 8px 0;
}

.article-body ul li,
.article-body ol li {
  margin: 4px 0;
}

.article-body ul.todo-list {
  list-style: none;
  padding-left: 4px;
}

.article-body ul.todo-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-body .todo-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 16px 0;
}

.article-body a {
  color: var(--blue);
  text-decoration: none;
}

.article-body a:hover { text-decoration: underline; }

/* Infobox */
.infobox {
  float: right;
  clear: right;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin: 0 0 20px 24px;
  width: 260px;
  font-size: 0.82rem;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.infobox-title {
  background: var(--blue);
  color: #fff;
  text-align: center;
  padding: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.infobox table { width: 100%; border-collapse: collapse; }

.infobox td {
  padding: 7px 12px;
  border-top: 1px solid var(--gray-200);
  vertical-align: top;
}

.infobox td:first-child {
  font-weight: 600;
  width: 90px;
  color: var(--gray-500);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Table of contents */
/* Version history */
.version-history {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.version-history h3 {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 10px;
}

.version-list {
  max-height: 220px;
  overflow-y: auto;
}

.version-entry {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--gray-100);
}

.version-date {
  color: var(--gray-400);
  min-width: 100px;
  font-variant-numeric: tabular-nums;
}

.version-desc { color: var(--gray-600); }

.version-author {
  color: var(--gray-400);
  margin-left: auto;
  white-space: nowrap;
}

/* ===== Home page ===== */
/* ===== Home v2 ===== */
.home-v2 {
  max-width: 980px;
  margin: 0 auto;
}

/* Banner */
.home-banner {
  position: relative;
  margin: -28px -32px 28px;
  padding: 36px 36px 32px;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(135deg, #005C97 0%, #363795 100%);
  color: #fff;
}

.home-banner-content {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.home-banner-left h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.home-banner-left p {
  font-size: 0.85rem;
  margin: 0 0 16px;
  opacity: 0.7;
}

.home-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  backdrop-filter: blur(4px);
}

.home-banner-btn:hover {
  background: rgba(255,255,255,0.25);
}

.home-banner-stats {
  display: flex;
  gap: 24px;
  flex-shrink: 0;
}

.home-banner-stat {
  text-align: center;
}

.home-banner-stat strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.home-banner-stat span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
}

.home-banner-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.15);
}

/* Two-column layout */
.home-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 768px) {
  .home-two-col {
    grid-template-columns: 1fr 260px;
  }
}

.home-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  margin: 0 0 12px;
}

/* Article table */
.home-article-table {
  background: #fff;
  border: 1px solid var(--gray-150, #e8e8ec);
  border-radius: 12px;
  overflow: hidden;
}

.home-arow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--gray-100);
}

.home-arow:last-child {
  border-bottom: none;
}

.home-arow:hover {
  background: var(--gray-50);
}

.home-arow-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.home-arow-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.home-arow-main strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-arow-main span {
  font-size: 0.74rem;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-arow-cat {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-light, #eff6ff);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-arow-time {
  font-size: 0.72rem;
  color: var(--gray-300);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 70px;
  text-align: right;
}

/* Right sidebar cards */
.home-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-quick-card {
  background: #fff;
  border: 1px solid var(--gray-150, #e8e8ec);
  border-radius: 12px;
  padding: 16px;
}

.home-quick-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-qlink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.1s;
}

.home-qlink:hover {
  background: var(--gray-50);
  color: var(--blue);
}

.home-bm-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-bm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.home-bm-row:hover {
  background: var(--gray-50);
}

.home-bm-row span {
  flex-shrink: 0;
}

.home-bm-row strong {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-bm-more {
  display: block;
  text-align: center;
  padding: 6px;
  font-size: 0.75rem;
  color: var(--gray-400);
  cursor: pointer;
  margin-top: 4px;
}

.home-bm-more:hover {
  color: var(--blue);
}

/* Empty state */
.home-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
  font-size: 0.9rem;
}

/* Legacy classes kept for compatibility */
.home-sections-grid { display: flex; flex-direction: column; gap: 24px; }

/* Quick action buttons (legacy) */
.home-quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.home-qa-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.home-qa-btn:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.home-qa-btn.home-qa-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.home-qa-btn.home-qa-primary:hover {
  background: var(--blue-dark, #1d4ed8);
  border-color: var(--blue-dark, #1d4ed8);
}

/* Main grid */
.home-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 860px) {
  .home-main-grid:has(.home-sidebar) {
    grid-template-columns: 1fr 240px;
  }
}

.home-section-header {
  margin-bottom: 16px;
}

.home-section-header h2 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  margin: 0;
}

/* Article cards grid */
.home-articles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.home-article-card {
  background: #fff;
  border: 1px solid var(--gray-150, #e8e8ec);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-article-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.home-article-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-article-card-icon {
  font-size: 1.3rem;
}

.home-article-card-cat {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-light, #eff6ff);
  padding: 2px 8px;
  border-radius: 10px;
}

.home-article-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-article-card-desc {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-article-card-time {
  font-size: 0.7rem;
  color: var(--gray-300);
  margin-top: auto;
}

/* Featured first card spans full width */
.home-article-featured {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-color: var(--blue-light, #bfdbfe);
}

.home-article-featured .home-article-card-top {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.home-article-featured .home-article-card-icon {
  font-size: 1.6rem;
}

.home-article-featured .home-article-card-title {
  font-size: 1.1rem;
}

.home-article-featured .home-article-card-desc {
  -webkit-line-clamp: 3;
}

/* Empty state */
.home-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}

.home-empty p {
  margin: 12px 0 16px;
  font-size: 0.9rem;
}

/* Sidebar bookmarks */
.home-sidebar {
  min-width: 0;
}

.home-bookmarks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.home-bm-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.home-bm-card:hover {
  background: var(--gray-50);
}

.home-bm-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.home-bm-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-bm-info strong {
  font-size: 0.82rem;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-bm-info span {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.home-bm-all {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  background: none;
  border: 1px dashed var(--gray-200);
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--gray-400);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.home-bm-all:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.home-hero {
  text-align: center;
  padding: 48px 24px 40px;
  background: linear-gradient(135deg, var(--blue) 0%, #4f8cff 100%);
  border-radius: 12px;
  color: #fff;
  margin-bottom: 24px;
}
.home-hero h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 16px 0 8px;
  color: #fff;
}
.home-hero p {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  margin: 0;
}
.home-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255,255,255,0.2);
}
.home-stats-inline {
  display: flex !important;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
}
.home-stats-dot { display: inline !important; }
.home-sections-grid { display: flex; flex-direction: column; gap: 24px; }

.home-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}

.home-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-500);
}

.home-card-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
}

/* Article list rows */
.home-article-list {
  padding: 4px 0;
}

.home-article-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.1s;
}

.home-article-row:hover {
  background: var(--gray-50);
}

.home-article-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.home-article-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.home-article-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-article-sub {
  font-size: 0.75rem;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-article-cat {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-light, #eff6ff);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-article-time {
  font-size: 0.72rem;
  color: var(--gray-400);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

/* Bookmarks sidebar */
.home-card-side {
  height: fit-content;
}

.home-bookmark-list {
  padding: 8px 0;
}

.home-bookmark-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background 0.1s;
}

.home-bookmark-item:hover {
  background: var(--gray-50);
}

.home-bookmark-item span:first-child {
  font-size: 1rem;
  flex-shrink: 0;
}

.home-bookmark-item div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-bookmark-item strong {
  font-size: 0.82rem;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-bookmark-item div span {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.home-card-workspace .workspace-columns {
  padding: 16px;
  margin-top: 0;
}

.workspace-column h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-column-count {
  font-size: 0.68rem;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}

/* Recent changes list */
.home-recent-list {
  padding: 4px 0;
}

.home-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--gray-50);
}

.home-recent-item:last-child {
  border-bottom: none;
}

.home-recent-item:hover {
  background: var(--blue-light);
}

.home-recent-info {
  flex: 1;
  min-width: 0;
}

.home-recent-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--gray-800);
  font-weight: 600;
}

.home-recent-info span {
  display: block;
  font-size: 0.78rem;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-recent-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.home-recent-date {
  font-size: 0.75rem;
  color: var(--gray-400);
  white-space: nowrap;
}

/* Legacy home-grid kept for other views */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.home-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
}

.home-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 6px;
}

.home-section ul { list-style: none; }

.home-section li {
  padding: 5px 0;
  border-bottom: 1px solid var(--gray-100);
}

.home-section li:last-child { border-bottom: none; }

.home-section a {
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.home-section a:hover { text-decoration: underline; }

.home-section .article-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 1px;
}

/* ===== Status page ===== */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.status-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  max-height: 320px;
  overflow-y: auto;
}

.status-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--gray-700);
}

.status-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--gray-100);
}

.status-item:last-child { border-bottom: none; }

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== Search results, categories, recent ===== */
.search-results h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.search-result-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.search-result-item a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}

.search-result-item a:hover { text-decoration: underline; }

.search-result-item p {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 3px;
}

.result-meta {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.category-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
}

.category-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-count {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 10px;
}

.category-card ul { list-style: none; font-size: 0.85rem; }
.category-card a { color: var(--blue); text-decoration: none; cursor: pointer; }
.category-card a:hover { text-decoration: underline; }

/* ===== Back button ===== */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 12px;
}
.btn-back:hover {
  background: var(--gray-100);
  color: var(--gray-800);
  border-color: var(--gray-300);
}
.btn-back svg { flex-shrink: 0; }

/* ===== Article actions ===== */
.article-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.btn-action {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--gray-300);
  transition: all 0.15s;
}

.btn-edit {
  background: var(--gray-50);
  color: var(--gray-700);
}

.btn-edit:hover { background: var(--gray-100); }

.btn-delete {
  background: #fff;
  color: var(--red);
  border-color: var(--red);
}

.btn-delete:hover { background: var(--red-light); }

.btn-save {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.btn-save:hover { background: var(--blue-dark); }

.btn-cancel {
  background: var(--gray-50);
  color: var(--gray-600);
}

.btn-cancel:hover { background: var(--gray-100); }

.btn-add-section {
  background: var(--gray-50);
  color: var(--blue);
  border-color: var(--gray-200);
  margin-bottom: 16px;
}

.btn-add-section:hover { background: var(--blue-light); }

.btn-remove {
  padding: 4px 10px;
  background: var(--red-light);
  color: var(--red);
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-remove:hover { border-color: var(--red); }

/* ===== Forms ===== */
.article-form {
  max-width: 720px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-divider {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  padding: 12px 0 8px;
  margin: 8px 0;
  border-bottom: 1px solid var(--gray-200);
}

.form-section-block {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.form-section-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.form-section-header input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.form-section-header input:focus {
  outline: none;
  border-color: var(--blue);
}

.section-content {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: 'Fira Code', 'Consolas', monospace;
  resize: vertical;
  line-height: 1.5;
}

.section-content:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-infobox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.form-infobox-row input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.form-infobox-row input:focus {
  outline: none;
  border-color: var(--blue);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 0;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  overflow: hidden;
  animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-brand {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  padding: 28px 32px 24px;
  text-align: center;
  color: #fff;
}

.modal-brand-icon {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.modal-brand h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-brand p {
  font-size: 0.8rem;
  opacity: 0.8;
}

.modal-body {
  padding: 28px 32px 32px;
}

.modal-header {
  display: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,0.2);
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 1;
}

.modal-close:hover {
  background: rgba(255,255,255,0.3);
}

.modal-content .form-group {
  margin-bottom: 18px;
}

.modal-content .form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  display: block;
}

.modal-content .form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--gray-50);
  transition: all 0.2s;
}

.modal-content .form-group input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.modal-content .form-group input::placeholder {
  color: var(--gray-400);
}

.modal-content .form-actions {
  margin-top: 24px;
  padding-top: 0;
  border-top: none;
  display: flex;
  gap: 10px;
}

.modal-content .form-actions .btn-save {
  flex: 1;
  padding: 11px 20px;
  font-size: 0.9rem;
  border-radius: 8px;
  font-weight: 600;
}

.modal-content .form-actions .btn-cancel {
  padding: 11px 20px;
  font-size: 0.9rem;
  border-radius: 8px;
}

.auth-error {
  background: var(--red-light);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 14px;
  border: 1px solid rgba(220,38,38,0.15);
}

.auth-error.hidden { display: none; }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--gray-500);
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.auth-switch a {
  color: var(--blue);
  cursor: pointer;
  font-weight: 600;
}

.auth-switch a:hover { text-decoration: underline; }

/* ===== Dialog ===== */
.dialog-box {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  text-align: center;
  animation: modalSlideIn 0.25s ease;
}

.dialog-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.dialog-icon.danger {
  background: var(--red-light);
  color: var(--red);
}

.dialog-icon.warning {
  background: var(--yellow-light);
  color: var(--yellow);
}

.dialog-icon.info {
  background: var(--blue-light);
  color: var(--blue);
}

.dialog-icon.success {
  background: var(--green-light);
  color: var(--green);
}

.dialog-box h3 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.1rem;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.dialog-box p {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 24px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.dialog-actions .btn-action {
  min-width: 100px;
  padding: 10px 20px;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* ===== User menu ===== */
.user-menu-wrapper {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  z-index: 300;
  overflow: hidden;
}

.user-menu.hidden { display: none; }

.user-menu-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu-header strong {
  font-size: 0.85rem;
}

.user-menu a {
  display: block;
  padding: 8px 16px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.1s;
}

.user-menu a:hover {
  background: var(--blue-light);
  color: var(--blue);
}

.user-menu-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 4px 0;
}

/* ===== Profile ===== */
.profile-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
}

.profile-info h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.profile-info p {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ===== Toast ===== */
#toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  color: #fff;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--blue); }

/* ===== Admin users table ===== */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 16px;
}

.users-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--gray-200);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
}

.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
}

.users-table select {
  padding: 4px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: inherit;
}

.hidden { display: none !important; }

/* Footer */
.wiki-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
}

/* ===== Workspace / Wiki Tree ===== */
.sidebar-workspace {
  margin-bottom: 4px;
}

/* Category groups in sidebar */
/* Notion-style sidebar sections */
.sidebar-section {
  margin-bottom: 2px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  user-select: none;
  cursor: pointer;
  transition: background 0.1s;
}

.sidebar-section-header:hover {
  background: var(--gray-100);
}

.sidebar-section-header:hover .sidebar-section-actions {
  opacity: 1;
}

.sidebar-section-dragging {
  opacity: 0.15;
  pointer-events: none;
}

.sidebar-drag-ghost {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  pointer-events: none;
  will-change: top;
  overflow: hidden;
  max-height: 200px;
  opacity: 0.95;
}

.sidebar-drag-ghost .sidebar-section-actions {
  display: none;
}

.sidebar-drag-ghost .section-list {
  border-left: 2px solid var(--gray-200);
  margin-left: 14px;
}

.sidebar-section-drop-indicator {
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
  margin: 2px 10px;
}

.sidebar-section-chevron {
  flex-shrink: 0;
  color: var(--gray-500);
  transition: transform 0.2s ease;
}

.sidebar-section-chevron.expanded {
  transform: rotate(90deg);
}

.sidebar-section-label {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-section-chevron.expanded + .sidebar-section-label {
  color: var(--gray-700);
}

/* Animated section list */
.section-list {
  overflow: hidden;
  transition: height 0.2s ease;
  border-left: 2px solid var(--gray-200);
  margin-left: 14px;
}

.section-list.collapsed {
  height: 0;
  overflow: hidden;
}

.sidebar-section-actions {
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar-section-header:hover .sidebar-section-actions {
  opacity: 1;
}

.sidebar-section-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.1s;
}

.sidebar-section-btn:hover {
  color: var(--gray-700);
  background: var(--gray-200);
}

/* Keep old class names working for category menu/rename */
.sidebar-cat-menu-btn { display: none; }
.sidebar-cat-add-btn { display: none; }

/* Category context menu */
.sidebar-cat-menu {
  z-index: 900;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 4px;
  min-width: 170px;
  animation: slashMenuIn 0.1s ease;
}

.sidebar-cat-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  color: var(--gray-700);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.08s;
}

.sidebar-cat-menu-item:hover {
  background: var(--blue-light);
  color: var(--blue);
}

.sidebar-cat-menu-item.delete:hover {
  background: var(--red-light);
  color: var(--red);
}

.sidebar-cat-menu-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

/* Inline rename input */
.sidebar-cat-rename-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--blue);
  background: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--gray-800);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.sidebar-add-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.sidebar-add-btn:hover {
  color: var(--blue);
  background: var(--gray-100);
}

.new-category-popup {
  margin: 4px 8px 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.new-category-popup label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.new-category-popup input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--gray-50);
  transition: border-color 0.15s;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.new-category-popup input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.new-category-popup-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.sidebar-new-category-btn {
  display: none;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-new-category-btn:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: rgba(37, 99, 235, 0.04);
}

/* Tree structure */
.page-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.page-tree .page-tree {
  padding-left: 12px;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.page-tree-item {
  margin: 0;
}

.page-tree-link {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 450;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.1s;
  position: relative;
}

.page-tree-link:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.page-tree-link.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}

.page-tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
  border-radius: 3px;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.15s;
}

.tree-toggle:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.tree-toggle svg {
  transition: transform 0.15s;
}

.tree-toggle.expanded svg {
  transform: rotate(90deg);
}

.tree-toggle-spacer {
  width: 18px;
  flex-shrink: 0;
}

.page-tree-link .tree-add-child {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  border-radius: 3px;
  line-height: 1;
}

.page-tree-link:hover .tree-add-child {
  display: inline-flex;
}

.tree-add-child:hover {
  color: var(--blue) !important;
}

.page-icon {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
  width: 18px;
  text-align: center;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--gray-500);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.1s;
}

.breadcrumb a:hover {
  color: var(--blue);
}

.breadcrumb-sep {
  color: var(--gray-300);
  font-size: 0.7rem;
}

.breadcrumb-current {
  color: var(--gray-700);
  font-weight: 500;
}

/* Workspace page layout */
.workspace-page {
  margin-top: 24px;
}

.workspace-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.workspace-column h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 8px;
}

.workspace-subpage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.workspace-subpage:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: var(--shadow-sm);
}

.workspace-subpage-icon {
  width: 34px;
  height: 34px;
  background: var(--gray-100);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.workspace-subpage-info {
  flex: 1;
  min-width: 0;
}

.workspace-subpage-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--gray-800);
  font-weight: 600;
}

.workspace-subpage-info span {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-add-page {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: var(--gray-50);
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  color: var(--gray-400);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
}

.workspace-add-page:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

.workspace-show-more {
  padding: 8px 12px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--blue);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.workspace-show-more:hover {
  background: var(--blue-light, #eff6ff);
}

/* Wiki divider */
.wiki-divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 24px 0;
}

/* Sub-pages section in article view */
.subpages-section {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.subpages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.subpages-header h3 {
  font-size: 0.85rem;
  color: var(--gray-500);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.subpages-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ===== Notion-style Create Page ===== */
.notion-create {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 0;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
}

.notion-title {
  width: 100%;
  border: none;
  outline: none;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gray-900);
  padding: 8px 0;
  margin-bottom: 0;
  background: transparent;
}

.notion-title::placeholder {
  color: var(--gray-300);
}

.notion-subtitle-hint {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-bottom: 20px;
}

.notion-subtitle-hint kbd {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Block editor */
.notion-blocks {
  min-height: 200px;
  margin-bottom: 24px;
  flex: 1;
}

.notion-block {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  position: relative;
  border-radius: 4px;
  margin: 2px -8px;
  padding: 2px 8px;
  transition: background 0.1s;
}

.notion-block:hover {
  background: var(--gray-50);
}

.notion-block:hover .notion-block-handle,
.notion-block:hover .notion-block-delete {
  opacity: 1;
}

.notion-block-handle {
  opacity: 0;
  cursor: grab;
  color: var(--gray-300);
  padding: 6px 2px;
  flex-shrink: 0;
  transition: opacity 0.15s, color 0.15s;
  margin-top: 2px;
}

.notion-block-handle:hover {
  color: var(--gray-500);
}

.notion-block-delete {
  opacity: 0;
  position: absolute;
  right: 2px;
  top: 2px;
  background: none;
  border: none;
  color: var(--gray-300);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: opacity 0.15s, color 0.15s;
}

.notion-block-delete:hover {
  color: var(--red);
  background: var(--red-light);
}

.notion-block-content {
  flex: 1;
  outline: none;
  min-height: 1.5em;
  padding: 4px 2px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--gray-800);
  word-break: break-word;
}

.notion-block-content:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-300);
  pointer-events: none;
}

/* Heading blocks */
.notion-h1 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 12px 0 2px;
  border: none;
}

.notion-h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 10px 0 2px;
  border: none;
}

.notion-h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 8px 0 2px;
}

/* List blocks */
.notion-block-list {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
}

.notion-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-500);
  flex-shrink: 0;
  margin-top: 10px;
}

.notion-number {
  font-size: 0.9rem;
  color: var(--gray-500);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 16px;
  text-align: right;
  margin-top: 4px;
}

.notion-number::after {
  content: '.';
}

.notion-checkbox {
  margin-top: 7px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--blue);
}

/* Special blocks */
.notion-divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 8px 0;
  flex: 1;
}

.notion-code-block {
  flex: 1;
  background: var(--gray-900);
  color: #e5e7eb;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: none;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  min-height: 60px;
}

.notion-quote {
  flex: 1;
  border-left: 3px solid var(--gray-800);
  padding-left: 14px;
  margin: 4px 0;
}

.notion-callout {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.notion-callout-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Slash command menu */
.slash-menu {
  position: absolute;
  z-index: 600;
  display: flex;
  gap: 0;
  animation: slashMenuIn 0.12s ease;
}

.slash-menu-body {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  width: 280px;
  max-height: 360px;
  overflow-y: auto;
}

@keyframes slashMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.slash-menu.hidden {
  display: none;
}

.slash-menu-header {
  padding: 8px 14px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
}

.slash-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.08s;
}

.slash-menu-item:hover,
.slash-menu-item.highlighted {
  background: var(--blue-light);
}

.slash-menu-icon {
  width: 32px;
  height: 32px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--gray-500);
}

.slash-menu-item.highlighted .slash-menu-icon {
  background: #fff;
  border-color: var(--blue);
  color: var(--blue);
}

.slash-menu-item div:last-child {
  flex: 1;
  min-width: 0;
}

.slash-menu-item strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-800);
}

.slash-menu-item span {
  font-size: 0.72rem;
  color: var(--gray-400);
}

/* Slash menu preview panel */
.slash-preview {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  width: 260px;
  margin-left: 6px;
  padding: 0;
  overflow: hidden;
  animation: slashPreviewIn 0.15s ease;
  align-self: flex-start;
}

@keyframes slashPreviewIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.slash-preview.hidden {
  display: none;
}

.slash-preview-label {
  padding: 8px 14px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  border-bottom: 1px solid var(--gray-100);
}

.slash-preview-content {
  padding: 14px;
}


/* + button on blocks */
.notion-block-add {
  opacity: 0;
  position: absolute;
  left: -28px;
  top: 4px;
  background: none;
  border: none;
  color: var(--gray-300);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  line-height: 1;
  transition: opacity 0.15s, color 0.15s;
}

.notion-block:hover .notion-block-add {
  opacity: 1;
}

.notion-block-add:hover {
  color: var(--blue);
  background: var(--blue-light);
}

/* Block handle as button */
.notion-block-handle {
  opacity: 0;
  cursor: grab;
  color: var(--gray-300);
  padding: 4px 2px;
  flex-shrink: 0;
  transition: opacity 0.15s, color 0.15s;
  margin-top: 2px;
  background: none;
  border: none;
  border-radius: 3px;
}

.notion-block:hover .notion-block-handle {
  opacity: 1;
}

.notion-block-handle:hover {
  color: var(--gray-500);
  background: var(--gray-100);
}

.notion-block-handle:active {
  cursor: grabbing;
}

/* Dragging state */
.notion-block.dragging {
  opacity: 0.4;
}

.drag-indicator {
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
  margin: -1px 0;
  pointer-events: none;
}


/* Block menu (⋮⋮ click) */
.block-menu {
  z-index: 650;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  width: 220px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
  animation: slashMenuIn 0.12s ease;
}

.block-menu-section {
  padding: 2px 0;
}

.block-menu-label {
  padding: 6px 10px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
}

.block-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--gray-700);
  transition: background 0.08s;
}

.block-menu-item:hover {
  background: var(--blue-light);
  color: var(--blue);
}

.block-menu-item.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}

.block-menu-item.delete:hover {
  background: var(--red-light);
  color: var(--red);
}

.block-menu-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 4px 0;
}

/* Emoji icon picker */
.notion-icon-row {
  position: relative;
  margin-bottom: 4px;
}

.notion-icon-btn {
  background: none;
  border: 2px dashed transparent;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 2.2rem;
  line-height: 1;
  transition: all 0.15s;
}

.notion-icon-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.emoji-picker {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 10px;
  width: 280px;
  max-height: 240px;
  overflow: hidden;
  animation: slashMenuIn 0.12s ease;
}

.emoji-picker.hidden { display: none; }

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-height: 216px;
  overflow-y: auto;
  padding-right: 2px;
}

.emoji-option {
  background: none;
  border: none;
  font-size: 1.25rem;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
  line-height: 1;
  flex-shrink: 0;
}

.emoji-option:hover {
  background: var(--blue-light);
}


/* Live stats bar */
.notion-stats-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
  font-size: 0.72rem;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-100);
  margin-top: auto;
}

.notion-stats-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notion-stats-sep {
  color: var(--gray-300);
}

.notion-stats-right {
  display: flex;
  align-items: center;
}

.draft-saved {
  color: var(--green);
  font-size: 0.72rem;
}

/* Draft restore banner */
.draft-restore-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--blue-light);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  animation: slashMenuIn 0.2s ease;
}

.draft-restore-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--gray-700);
}

.draft-restore-actions {
  display: flex;
  gap: 6px;
}


/* ===== New Editor Layout ===== */
.editor-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -32px -32px 24px;
}

.editor-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--gray-500);
  min-width: 0;
}

.editor-header-left a {
  color: var(--gray-500);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.editor-header-left a:hover {
  color: var(--blue);
}

.editor-header-left .header-title {
  color: var(--gray-800);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.editor-header-right .btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 100px;
  padding: 0 16px;
  line-height: 1;
  font-size: 0.85rem;
  box-sizing: border-box;
}

.editor-draft-status {
  font-size: 0.72rem;
  color: var(--gray-400);
  white-space: nowrap;
}

.editor-draft-status:empty {
  display: none;
}

.editor-draft-status.saved {
  color: var(--green);
  background: var(--green-light);
  border: 1px solid var(--green);
  padding: 4px 10px;
  border-radius: 20px;
}

/* Editor settings row */
.editor-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  padding: 16px 20px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-field.full-width {
  grid-column: 1 / -1;
}

.editor-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
}

.editor-field select,
.editor-field input[type="text"] {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--gray-700);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.editor-field select:focus,
.editor-field input[type="text"]:focus {
  border-color: var(--blue);
}

/* Template cards grid */
/* Større ikon-knap */
.notion-icon-btn-large {
  width: 80px;
  height: 80px;
  font-size: 3rem;
}

/* Sideindstillinger wrapper */
.editor-details-wrapper {
  margin: 16px 0 20px;
}

.editor-details-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.editor-details-toggle:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.editor-details-toggle .details-chevron {
  transition: transform 0.2s;
  color: var(--gray-400);
}

/* Chevron rotation when collapsed */
.editor-details-wrapper:has(.editor-details-content.collapsed) .details-chevron {
  transform: rotate(-90deg);
}

.editor-details-toggle svg {
  color: var(--gray-400);
  flex-shrink: 0;
}

.editor-details-content {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px;
  margin-top: -1px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.editor-details-content.collapsed {
  display: none;
}

.editor-details-toggle:has(+ .editor-details-content:not(.collapsed)) {
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Fallback for browsers without :has() */
.editor-details-wrapper.expanded .editor-details-toggle {
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Kategori, Beskrivelse + Skabeloner samlet boks (legacy) */
.editor-details-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.editor-details-field {
  margin-bottom: 12px;
}

.editor-details-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.editor-details-field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.editor-details-field input:focus,
.editor-details-field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.editor-details-field select {
  width: 100%;
  padding: 10px 32px 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Category required arrow indicator */
.category-arrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--red-light);
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 500;
  animation: bounce-arrow 0.6s ease-in-out infinite;
}

.category-arrow svg {
  animation: point-up 0.6s ease-in-out infinite;
}

@keyframes bounce-arrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes point-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Highlight required field */
.editor-details-field select.highlight-required,
.create-setting-field select.highlight-required {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
  animation: pulse-red 1s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
  50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.25); }
}

/* Skabeloner folder */
.editor-templates-section {
  border-top: 1px solid var(--gray-200);
  padding-top: 12px;
}

.editor-templates-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 0.15s;
}

.editor-templates-toggle:hover {
  background: var(--gray-100);
}

.editor-templates-toggle .folder-chevron {
  transition: transform 0.2s;
  color: var(--gray-400);
}

.editor-templates-toggle svg {
  color: var(--gray-400);
}

.templates-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gray-400);
  background: var(--gray-200);
  padding: 2px 6px;
  border-radius: 10px;
}

.templates-folder {
  overflow: hidden;
  transition: height 0.2s ease;
  max-height: 200px; /* Ca. 5 items */
  overflow-y: auto;
}

.templates-folder.collapsed {
  height: 0;
  max-height: 0;
}

.templates-folder::-webkit-scrollbar {
  width: 6px;
}

.templates-folder::-webkit-scrollbar-track {
  background: transparent;
}

.templates-folder::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.templates-folder::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.template-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 34px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.template-item:hover {
  background: #fff;
}

.template-item-icon {
  font-size: 1rem;
}

.template-item-name {
  font-size: 0.85rem;
  color: var(--gray-700);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.template-grid.hidden {
  display: none;
}

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: inherit;
}

.template-card:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.template-card .template-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.template-card .template-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-700);
}

.template-card .template-desc {
  font-size: 0.68rem;
  color: var(--gray-400);
  line-height: 1.3;
}

/* Template selector (minimal editor) */
.template-selector-minimal {
  margin: 16px 0 24px;
}

.template-selector-minimal.hidden {
  display: none;
}

.template-selector-label {
  font-size: 0.82rem;
  color: var(--gray-400);
  margin-bottom: 10px;
  font-weight: 500;
}

/* Editor hotbar */
.editor-hotbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Hotbar is sticky when NOT inside the sticky wrapper (edit page) */
.editor-hotbar:not(.create-sticky-toolbar .editor-hotbar) {
  position: sticky;
  top: 8px;
}

/* Inside sticky wrapper: no extra sticky, wrapper handles it */
.create-sticky-toolbar .editor-hotbar {
  margin-bottom: 8px;
}

.hotbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  width: 28px;
  height: 26px;
  border: none;
  background: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 0.82rem;
  font-family: inherit;
  transition: all 0.1s;
  padding: 0;
}

.hotbar-btn:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.hotbar-btn:active {
  background: var(--gray-200);
}

.hotbar-btn.hotbar-active {
  background-color: var(--gray-200) !important;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15) !important;
  color: var(--gray-900);
}

.hotbar-sep {
  width: 1px;
  height: 18px;
  background: var(--gray-200);
  margin: 0 4px;
}

.hotbar-fontsize {
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 1px 2px;
  font-size: 11px;
  background: #fff;
  cursor: pointer;
  color: var(--gray-600);
  outline: none;
  width: 44px;
  height: 26px;
}

/* ─── Floating Toolbar ─── */
.floating-toolbar {
  position: fixed;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 4px 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: opacity 0.12s;
}
.floating-toolbar.hidden {
  display: none;
}
.ft-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ft-btn:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}
.ft-sep {
  width: 1px;
  height: 18px;
  background: var(--gray-200);
  margin: 0 3px;
}
.ft-fontsize {
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 2px 2px;
  font-size: 11px;
  background: #fff;
  cursor: pointer;
  color: var(--gray-600);
  outline: none;
  width: 48px;
}
.ft-color-wrap {
  position: relative;
  display: inline-flex;
}
.ft-color-input {
  position: absolute;
  top: 100%;
  left: 0;
  width: 0;
  height: 0;
  opacity: 0;
  border: none;
  padding: 0;
  pointer-events: none;
  visibility: hidden;
}
.ft-color-input::-webkit-color-swatch-wrapper { display: none; }
.ft-color-input::-webkit-color-swatch { display: none; }
.ft-color-input::-moz-color-swatch { display: none; }
.ft-highlight {
  border-radius: 3px;
}

.hotbar-color-wrap {
  position: relative;
  display: inline-flex;
}

.hotbar-color-input {
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: none;
  opacity: 0;
  clip: rect(0,0,0,0);
}
.hotbar-color-input::-webkit-color-swatch-wrapper { display: none; }
.hotbar-color-input::-webkit-color-swatch { display: none; }
.hotbar-color-input::-moz-color-swatch { display: none; }
.hotbar-highlight {
  border-radius: 3px;
}

/* Template dropdown in hotbar */
.hotbar-template-wrap {
  position: relative;
}

.hotbar-template-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  width: 240px;
  overflow: hidden;
}

.hotbar-template-dropdown.hidden {
  display: none;
}

.template-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.template-dropdown-item:hover {
  background: var(--blue-50, #eff6ff);
}

.template-dropdown-item > span {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.template-dropdown-item > div {
  display: flex;
  flex-direction: column;
}

.template-dropdown-item strong {
  font-size: 0.82rem;
  color: var(--gray-700);
}

.template-dropdown-item div span {
  font-size: 0.72rem;
  color: var(--gray-400);
}

/* Editor textbox (inline) */
.editor-textbox {
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 8px 0;
  background: var(--gray-50);
  min-height: 40px;
  transition: border-color 0.15s;
}

/* Textbox drag handle (top bar) */
.textbox-drag-handle {
  height: 14px;
  margin: -14px -16px 8px;
  padding: 0;
  cursor: grab;
  border-radius: 8px 8px 0 0;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
}

.textbox-drag-handle::after {
  content: '';
  width: 30px;
  height: 3px;
  background: var(--gray-400);
  border-radius: 2px;
}

.textbox-drag-handle:hover {
  background: var(--gray-300);
}

.textbox-drag-handle:active {
  cursor: grabbing;
  background: var(--blue-light);
}

/* Textbox resize corner */
.textbox-resize-corner {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background: var(--gray-300);
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}

.editor-textbox:hover .textbox-resize-corner {
  opacity: 0.5;
}

.textbox-resize-corner:hover {
  opacity: 1 !important;
  background: var(--blue);
}

/* Hide resize corners in article view */
.article-body .textbox-resize-corner,
.article-body .textbox-drag-handle,
.article-body .img-resize-handle {
  display: none !important;
}

.editor-textbox:focus-within {
  border-color: var(--blue);
  background: #fff;
}

/* Drawing mode for textbox creation */
.editor-drawing-mode {
  cursor: crosshair !important;
}

.textbox-draw-preview {
  position: absolute;
  border: 2px solid var(--blue);
  background: rgba(59, 130, 246, 0.1);
  pointer-events: none;
  z-index: 100;
}

/* ── Clean selection for textboxes & images ── */
.editor-el-selected {
  outline: 2px solid var(--blue) !important;
  outline-offset: 0;
  cursor: move;
}

.editor-el-selected[contenteditable="true"] {
  cursor: text;
}

.editor-textbox.editor-el-editing {
  outline: 2px solid var(--blue) !important;
  cursor: text;
}

.resize-handle-se {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: var(--blue);
  border-radius: 2px;
  cursor: nwse-resize;
  z-index: 51;
}


/* Figure with caption */
.editor-figure {
  margin: 12px 0;
  display: inline-block;
  position: relative;
}

.editor-figure.selected {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 8px;
}

.editor-caption {
  display: block;
  font-size: 0.82rem;
  color: var(--gray-400);
  text-align: center;
  padding: 6px 4px 2px;
  border: none;
  outline: none;
  font-style: italic;
}

.editor-caption:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-300);
}

.editor-caption:focus {
  color: var(--gray-600);
}

/* Figure image toolbar */
.figure-toolbar {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  background: #1f2937;
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 20;
}

.figure-toolbar button {
  background: none;
  border: none;
  color: #fff;
  width: 28px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figure-toolbar button:hover {
  background: rgba(255,255,255,0.15);
}

/* Content wrapper for editor + overlay + drag handle */
.minimal-content-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Placeholder overlay */
.editor-placeholder-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  color: var(--gray-300);
  font-size: 0.9rem;
  line-height: 1.7;
  padding: 0;
  transition: opacity 0.2s ease;
}

.editor-placeholder-overlay.hidden {
  display: none;
}

.editor-placeholder-overlay p {
  margin: 0 0 8px;
}

.editor-placeholder-overlay ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.editor-placeholder-overlay li {
  margin-bottom: 4px;
}

.editor-placeholder-overlay kbd {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--gray-500);
}

/* Onboarding tooltip */
.editor-onboarding-tooltip {
  position: absolute;
  top: 8px;
  right: -20px;
  background: #1f2937;
  color: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.82rem;
  line-height: 1.5;
  z-index: 100;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  animation: fadeIn 0.3s ease;
  transition: opacity 0.2s ease;
}

.onboarding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.onboarding-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 2px;
}

.onboarding-tips {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
}

.onboarding-tips li {
  margin-bottom: 4px;
}

.onboarding-tips kbd {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.75rem;
}

.onboarding-got-it {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}

.onboarding-got-it:hover {
  opacity: 0.9;
}

/* Content drag-and-drop */
.content-drag-handle {
  position: absolute;
  left: -28px;
  width: 20px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--gray-300);
  border-radius: 4px;
  z-index: 10;
  transition: color 0.15s;
}

.content-drag-handle:hover {
  color: var(--gray-500);
  background: var(--gray-100);
}

.content-drag-handle.hidden {
  display: none;
}

.content-block-dragging {
  opacity: 0.4;
  background: var(--blue-light);
  border-radius: 4px;
}

.content-drag-indicator {
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
  margin: 2px 0;
  pointer-events: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fixed formatting toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 53px;
  z-index: 190;
}

.editor-tb-group {
  display: flex;
  align-items: center;
  gap: 1px;
}

.editor-tb-sep {
  width: 1px;
  height: 22px;
  background: var(--gray-200);
  margin: 0 6px;
  flex-shrink: 0;
}

.editor-tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  background: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.1s;
  white-space: nowrap;
}

.editor-tb-btn:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.editor-tb-btn.active {
  background: var(--blue-light);
  color: var(--blue);
}

.editor-tb-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Custom tooltip element (created via JS) */
.editor-tooltip {
  position: fixed;
  background: #1f2937;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  max-width: 300px;
  text-align: center;
  line-height: 1.5;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  pointer-events: none;
  white-space: normal;
  word-wrap: break-word;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.editor-tooltip.visible {
  opacity: 1;
}

.editor-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
}

.editor-tb-color {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--gray-600);
  background: #fff;
  cursor: pointer;
  height: 30px;
}

.editor-tb-color:hover {
  border-color: var(--gray-300);
}

/* ===== Responsive ===== */

/* Sidebar overlay — hidden, not used */
#sidebar-overlay {
  display: none;
}

/* Small/medium screens: sidebar pushes content */
@media (max-width: 1400px) {
  .app-layout {
    display: flex;
    flex-direction: row;
  }
  .wiki-sidebar {
    position: relative;
    height: auto;
    width: 220px;
    flex-shrink: 0;
    box-shadow: none;
    border-right: 1px solid var(--gray-200);
    transform: none;
    transition: none;
  }
  .app-layout.sidebar-hidden .wiki-sidebar {
    display: none;
    transform: none;
  }
  .main-area {
    flex: 1;
    min-width: 0;
  }
  .wiki-content { padding: 20px; }
  .home-grid, .status-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .infobox { float: none; width: 100%; margin: 0 0 16px; }
  .header-inner { flex-wrap: wrap; }
  .workspace-columns { grid-template-columns: 1fr; }
  .subpages-grid { grid-template-columns: 1fr; }
}

/* ===== Inline Edit Mode ===== */
.edit-page-wrapper {
  max-width: 900px;
  margin: 0 auto;
}

.edit-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.edit-topbar-badge {
  background: var(--blue-light);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.edit-topbar-actions {
  display: flex;
  gap: 8px;
}

.edit-title-input {
  width: 100%;
  border: none;
  border-bottom: 2px solid transparent;
  outline: none;
  background: none;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--gray-900);
  padding: 4px 0;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.edit-title-input:focus {
  border-bottom-color: var(--blue);
}

.edit-inline-select {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--gray-700);
  background: #fff;
  cursor: pointer;
  outline: none;
}

.edit-inline-select:focus {
  border-color: var(--blue);
}

.edit-inline-input {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--gray-700);
  outline: none;
}

.edit-inline-input:focus {
  border-color: var(--blue);
}

/* ===== @-Mention Menu ===== */
.mention-menu {
  position: fixed;
  z-index: 9999;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1);
  min-width: 280px;
  max-width: 360px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  animation: mentionFadeIn 0.15s ease-out;
}

@keyframes mentionFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mention-menu.hidden {
  display: none;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.mention-item:hover,
.mention-item.highlighted {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
}

.mention-icon {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border-radius: 8px;
}

.mention-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.mention-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mention-category {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.mention-empty {
  padding: 16px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.85rem;
}

/* Wiki link in content */
.wiki-link {
  background: linear-gradient(135deg, #e8f4ff 0%, #dbeafe 100%);
  color: var(--blue);
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9em;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wiki-link:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* Floating Selection Toolbar — see .floating-toolbar above */

/* Inline code styling */
.inline-code {
  background: #f1f5f9;
  color: #e11d48;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88em;
}

/* Highlight styling */
.highlight-yellow {
  background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ===== Image Block ===== */
.notion-image-wrapper {
  flex: 1;
  padding: 8px 0;
  text-align: center;
}

.notion-image {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: block;
}

.image-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--blue);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 5;
}

.image-resize-handle.corner-tl {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.image-resize-handle.corner-tr {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.image-resize-handle.corner-bl {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.image-resize-handle.corner-br {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

/* Edge handles */
.image-resize-handle.edge-t,
.image-resize-handle.edge-b {
  width: 40px;
  height: 6px;
  border-radius: 3px;
  left: 50%;
  transform: translateX(-50%);
}

.image-resize-handle.edge-t {
  top: -3px;
  cursor: ns-resize;
}

.image-resize-handle.edge-b {
  bottom: -3px;
  cursor: ns-resize;
}

.image-resize-handle.edge-l,
.image-resize-handle.edge-r {
  width: 6px;
  height: 40px;
  border-radius: 3px;
  top: 50%;
  transform: translateY(-50%);
}

.image-resize-handle.edge-l {
  left: -3px;
  cursor: ew-resize;
}

.image-resize-handle.edge-r {
  right: -3px;
  cursor: ew-resize;
}

.notion-block:hover .image-resize-handle {
  opacity: 1;
}

/* Container for multiple images - free positioning */
.image-items {
  position: relative;
  min-height: 250px;
  width: 100%;
  border: 2px dashed transparent;
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
  overflow: visible;
}

.notion-block:hover .image-items {
  border-color: var(--gray-200);
  background: rgba(249, 250, 251, 0.5);
}

/* Box resize handles */
.box-resize-handle {
  position: absolute;
  background: var(--blue);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 20;
}

.notion-block:hover .box-resize-handle {
  opacity: 0.6;
}

.box-resize-handle:hover {
  opacity: 1 !important;
}

.box-resize-handle.box-edge-r {
  right: 0;
  top: 20%;
  width: 6px;
  height: 60%;
  border-radius: 3px;
  cursor: ew-resize;
}

.box-resize-handle.box-edge-b {
  bottom: 0;
  left: 20%;
  width: 60%;
  height: 6px;
  border-radius: 3px;
  cursor: ns-resize;
}

.box-resize-handle.box-corner-br {
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: nwse-resize;
}

/* Selected image */
.notion-image.selected {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.notion-image:focus {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Image position container - absolute positioning for free movement */
.image-position-container {
  position: absolute;
  text-align: center;
  cursor: grab;
  z-index: 1;
}

.image-position-container:active {
  cursor: grabbing;
  z-index: 10;
}

.image-position-container.dragging {
  z-index: 100;
  opacity: 0.9;
}

/* Image resizable wrapper */
.image-resizable {
  position: relative;
  display: inline-block;
}

/* Add image button - hidden until hover */
.add-image-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  margin-top: 8px;
  background: var(--gray-100);
  border: 1px dashed var(--gray-300);
  border-radius: 8px;
  color: var(--gray-500);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0;
  pointer-events: none;
}

.notion-block:hover .add-image-btn {
  opacity: 1;
  pointer-events: auto;
}

.add-image-btn:hover {
  background: var(--gray-200);
  border-color: var(--gray-400);
  color: var(--gray-700);
}

/* Make image draggable */
.notion-image {
  cursor: grab;
  user-select: none;
}

.notion-image:active,
.image-position-container.dragging .notion-image {
  cursor: grabbing;
}

/* Caption container - can be moved independently */
.caption-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
}

.notion-image-caption {
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--gray-500);
  padding: 6px 12px;
  outline: none;
  font-style: italic;
  min-height: 1.4em;
  cursor: grab;
  text-align: center;
  border-radius: 4px;
  transition: background 0.15s;
}

.notion-image-caption:hover {
  background: var(--gray-50);
}

.notion-image-caption:focus {
  cursor: text;
  background: var(--gray-50);
  color: var(--gray-700);
}

.notion-image-caption:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-300);
  pointer-events: none;
}

.notion-image-caption:focus:empty::before {
  color: var(--gray-400);
}

/* Auto-link styling */
.auto-link {
  color: var(--blue);
  text-decoration: underline;
}

/* ===== Gallery Block ===== */
.notion-gallery {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
}

.gallery-item:hover .gallery-item-remove {
  opacity: 1;
}

.gallery-item-remove:hover {
  background: rgba(220,38,38,0.9);
}

.gallery-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  background: transparent;
  color: var(--gray-500);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.gallery-add-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

/* Gallery in article view */
.wiki-content .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.wiki-content .gallery-grid img {
  width: 100%;
  border-radius: 8px;
  aspect-ratio: 1;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Drag over state */
.notion-blocks.drag-over {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
  border: 2px dashed var(--blue);
  border-radius: 12px;
}

/* ===== Focus Mode ===== */
body.focus-mode .wiki-sidebar,
body.focus-mode .wiki-header,
body.focus-mode .wiki-footer,
body.focus-mode .sidebar-open-btn {
  display: none !important;
}

body.focus-mode .app-layout {
  grid-template-columns: 1fr !important;
}

body.focus-mode .main-area {
  max-width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
  padding-top: 70px;
}

body.focus-mode .notion-create {
  padding: 0;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

body.focus-mode #content,
body.focus-mode .wiki-content {
  max-width: 800px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 24px !important;
  box-sizing: border-box !important;
}

body.focus-mode .editor-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-radius: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 12px 32px;
  margin: 0;
  box-sizing: border-box;
}

body.focus-mode .editor-header-right {
  flex-shrink: 0;
  gap: 8px;
}

body.focus-mode .editor-header-right .btn-action {
  white-space: nowrap;
  height: 36px;
  min-width: 100px;
}

body.focus-mode .editor-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  width: 100%;
  margin: 0 0 20px;
  background: var(--gray-50);
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid var(--gray-200);
  box-sizing: border-box;
}

body.focus-mode .editor-details-box,
body.focus-mode .editor-details-wrapper {
  width: 100%;
  margin: 0 0 16px;
}

body.focus-mode .template-grid,
body.focus-mode .template-section {
  width: 100%;
  margin: 0 0 16px;
}

body.focus-mode .editor-details-toggle {
  width: 100%;
}

body.focus-mode .notion-icon-row {
  margin: 80px 0 8px;
}

body.focus-mode .notion-title {
  font-size: 2.5rem;
  margin: 0 0 16px;
}

body.focus-mode .notion-subtitle-hint {
  margin: 0 0 16px;
  text-align: center;
}

body.focus-mode .editor-toolbar {
  margin: 0 0 16px;
}

body.focus-mode .notion-blocks {
  font-size: 1.1rem;
  line-height: 1.8;
}

body.focus-mode .notion-stats-bar {
  padding: 16px 0;
}

/* Focus mode button */
.btn-focus {
  background: var(--gray-100) !important;
  color: var(--gray-600) !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px !important;
  min-width: 100px !important;
}

.btn-focus:hover {
  background: var(--gray-200) !important;
}

body.focus-mode .btn-focus {
  background: var(--blue-light) !important;
  color: var(--blue) !important;
}

/* ===== Keyboard Shortcuts Dialog ===== */
#dialog-message kbd {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--gray-600);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ===== Enhanced Editor Animations ===== */
.notion-block {
  transition: all 0.2s ease;
}

.notion-block:hover {
  background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
}

.notion-block-content:focus {
  outline: none;
  background: rgba(59, 130, 246, 0.03);
}

/* Smoother slash menu */
.slash-menu {
  animation: slashFadeIn 0.12s ease-out;
}

@keyframes slashFadeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Template cards hover effect */
.template-card {
  transition: all 0.2s ease;
}

.template-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* Nicer editor header */
.editor-header {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
}

/* Stats bar polish */
.notion-stats-bar {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-top: 1px solid var(--gray-200);
}

/* ===== Article Figure/Image ===== */
.wiki-content figure {
  margin: 24px 0;
  text-align: center;
}

.wiki-content figure img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.wiki-content figure figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--gray-500);
  font-style: italic;
}

/* Positioned images block */
.wiki-content .image-block[data-type="positioned-images"] {
  position: relative;
  margin: 24px 0;
  min-height: 250px;
  width: 100% !important;
  /* Ingen synlig boks */
  border: none;
  background: transparent;
}

.wiki-content .image-block .positioned-image {
  position: absolute;
  margin: 0;
  text-align: left;
}

.wiki-content .image-block .positioned-image img {
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-width: none; /* Tillad bredde fra style attribute */
}

.wiki-content .image-block .positioned-image figcaption {
  position: relative;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--gray-500);
  font-style: italic;
}

/* Tekstboks i artikler */
.wiki-content .text-box {
  position: absolute;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ===== Callout in articles ===== */
.wiki-content .callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 16px 0;
}

.wiki-content .callout p {
  margin: 0;
  font-size: 0.9rem;
  color: #92400e;
}

/* ===== Enhanced hint styling ===== */
.notion-subtitle-hint {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.notion-subtitle-hint kbd {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
}

/* ===== Floating Textbox in Image Containers ===== */
.floating-textbox {
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
  z-index: 50;
  overflow: visible;
}

.floating-textbox:hover {
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.2);
}

.floating-textbox:focus-within {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), 0 4px 16px rgba(37, 99, 235, 0.15);
}

.textbox-content {
  width: 100%;
  min-height: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--gray-800);
  outline: none;
  cursor: text;
}

.textbox-content:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-400);
  pointer-events: none;
}

.textbox-resize-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  background: var(--blue);
  border-radius: 3px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.textbox-resize-handle::before {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

.floating-textbox:hover .textbox-resize-handle,
.floating-textbox:focus-within .textbox-resize-handle {
  opacity: 1;
}

.textbox-drag-handle {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 16px;
  background: var(--blue);
  border-radius: 4px 4px 0 0;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.textbox-drag-handle:active {
  cursor: grabbing;
}

.floating-textbox:hover .textbox-drag-handle,
.floating-textbox:focus-within .textbox-drag-handle {
  opacity: 1;
}

/* Textbox toolbar button active state */
#textbox-tool-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

/* Crosshair cursor when textbox tool is active */
.image-items.textbox-cursor {
  cursor: crosshair;
}

/* Textbox draw preview */
.textbox-preview {
  position: absolute;
  border: 2px dashed var(--blue);
  background: rgba(37, 99, 235, 0.08);
  border-radius: 6px;
  pointer-events: none;
  z-index: 100;
}

/* Textbox in wiki-content (viewing mode) */
.wiki-content .floating-textbox {
  border: 1px solid var(--gray-200);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wiki-content .floating-textbox .textbox-drag-handle,
.wiki-content .floating-textbox .textbox-resize-handle {
  display: none;
}

.wiki-content .textbox-content {
  cursor: default;
}

/* --- Suggestions/Forslag --- */
.suggestion-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.suggestion-subtitle {
  font-size: 0.82rem;
  color: var(--gray-400);
  margin: 0;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Minimal create editor */
.notion-create-minimal {
  background: #fff;
}

.minimal-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--gray-200);
  background: #fff;
}

.minimal-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 0.95rem;
  padding: 6px 0;
  transition: color 0.15s;
}

.minimal-back-btn:hover {
  color: var(--gray-900);
}

.minimal-header-actions {
  display: flex;
  gap: 8px;
}

.minimal-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 24px 24px;
  box-sizing: border-box;
  position: relative;
  overflow-y: auto;
}

.minimal-title-input {
  font-size: 2.2rem;
  font-weight: 700;
  border: none;
  outline: none;
  padding: 0 0 8px 0;
  margin-bottom: 16px;
  color: var(--gray-900);
  background: transparent;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s;
}

.minimal-title-input:focus {
  border-bottom-color: var(--blue);
}

.minimal-title-input:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-300);
  pointer-events: none;
}

.minimal-content-input {
  flex: 1;
  font-size: 1rem;
  line-height: 1.7;
  border: none;
  outline: none;
  padding: 0 0 600px 0;
  resize: none;
  color: var(--gray-700);
  background: transparent;
  font-family: inherit;
  overflow: visible;
  position: relative;
  min-height: 600px;
}

/* --- Editor block styles (create page) --- */
.minimal-content-input blockquote {
  border-left: 3px solid var(--gray-800);
  padding-left: 14px;
  margin: 12px 0;
  color: var(--gray-600);
  font-style: italic;
  font-size: 0.95rem;
}

.minimal-content-input pre {
  background: var(--gray-900, #1a1a2e);
  color: #e5e7eb;
  padding: 14px 16px;
  border-radius: 8px;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
  margin: 12px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.minimal-content-input pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.minimal-content-input .callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 12px 0;
}

.minimal-content-input .callout p {
  margin: 0;
  font-size: 0.9rem;
  color: #92400e;
}

.minimal-content-input ul {
  list-style: disc;
  padding-left: 24px;
  margin: 8px 0;
}

.minimal-content-input ol {
  list-style: decimal;
  padding-left: 24px;
  margin: 8px 0;
}

.minimal-content-input ul li,
.minimal-content-input ol li {
  margin: 4px 0;
  padding-left: 4px;
}

.minimal-content-input ul.todo-list {
  list-style: none;
  padding-left: 4px;
}

.minimal-content-input ul.todo-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 0;
}

.minimal-content-input .todo-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.minimal-content-input hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 16px 0;
}

.minimal-content-input h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--gray-900);
}

.minimal-content-input h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 16px 0 6px;
  color: var(--gray-900);
}

.minimal-content-input h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 12px 0 4px;
  color: var(--gray-800);
}

/* --- Create page inline settings bar --- */
.create-sticky-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  padding-bottom: 4px;
}

.create-settings-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--gray-100);
}

.create-setting-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  flex: 1;
}

.create-setting-field label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.create-setting-field select,
.create-setting-field input[type="text"] {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: inherit;
  background: white;
  color: var(--gray-700);
  transition: border-color 0.15s;
}

.create-setting-field select:focus,
.create-setting-field input[type="text"]:focus {
  border-color: var(--blue);
  outline: none;
}

/* Emoji picker in create bar */
.create-setting-field-emoji {
  min-width: auto;
  flex: 0 0 auto;
}

.create-emoji-picker {
  position: relative;
}

.create-emoji-btn {
  width: 36px;
  height: 34px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}

.create-emoji-btn:hover {
  border-color: var(--gray-300);
}

.create-emoji-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  z-index: 200;
  padding: 10px;
  width: 280px;
  max-height: 220px;
  overflow-y: auto;
}

.create-emoji-dropdown.open {
  display: block;
}

.create-emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.create-emoji-option {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.create-emoji-option:hover {
  background: var(--gray-100);
}

/* --- Custom scrollable dropdown --- */
.custom-dropdown {
  position: relative;
}

.custom-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: inherit;
  background: white;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.15s;
  text-align: left;
  gap: 6px;
}

.custom-dropdown-btn:hover {
  border-color: var(--gray-300);
}

.custom-dropdown-btn:focus,
.custom-dropdown.open .custom-dropdown-btn {
  border-color: var(--blue);
  outline: none;
}

.custom-dropdown-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.custom-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 200px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  z-index: 200;
  overflow: hidden;
}

.custom-dropdown.open .custom-dropdown-menu {
  display: block;
}

.custom-dropdown-search {
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.custom-dropdown-search::placeholder {
  color: var(--gray-300);
}

.custom-dropdown-options {
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 0;
}

.custom-dropdown-option {
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-dropdown-option:hover {
  background: var(--gray-50);
}

.custom-dropdown-option.selected {
  background: var(--blue-light, #eff6ff);
  color: var(--blue);
  font-weight: 500;
}

.custom-dropdown-new {
  color: var(--blue);
  font-weight: 500;
  border-top: 1px solid var(--gray-100);
  margin-top: 2px;
  padding-top: 8px;
}

.minimal-content-input.editor-dragover {
  outline: 2px dashed var(--blue);
  outline-offset: -2px;
  background: var(--blue-light, #eff6ff);
}

.minimal-content-input .editor-figure,
.editor-figure {
  display: block;
  margin: 16px 0;
  padding: 0;
  border: none;
  outline: none;
}

.minimal-content-input .editor-figure {
  position: absolute;
  cursor: grab;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  background: #fff;
  padding: 4px;
  border-radius: 8px;
}

.minimal-content-input .editor-figure:active {
  cursor: grabbing;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Resize handle on bottom-right of image */
.img-resize-handle {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: var(--blue);
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}

.editor-figure:hover .img-resize-handle {
  opacity: 0.7;
}

.img-resize-handle:hover {
  opacity: 1 !important;
}



.editor-figure img {
  border: none;
  outline: none;
  border-radius: 6px;
  width: 300px;
  max-width: 100%;
  height: auto;
  display: block;
}

.editor-figure figcaption {
  border: none;
  outline: none;
}

.editor-figure figcaption:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-300);
}

/* Selected state for images and textboxes in editor */
.editor-selected {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 6px;
  cursor: default;
}

.editor-selected *,
.editor-selected img {
  outline: none !important;
  border: none !important;
}


.editor-img-spacer {
  height: 0;
  margin: 0;
  padding: 0;
  font-size: 0;
  line-height: 0;
  opacity: 0;
  pointer-events: none;
}


.minimal-content-input::placeholder {
  color: var(--gray-300);
}

.minimal-settings-panel {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background: var(--gray-50);
  border-left: 1px solid var(--gray-200);
  padding: 20px;
  box-sizing: border-box;
  transition: right 0.3s ease;
  z-index: 500;
  overflow-y: auto;
}

.minimal-settings-panel.open {
  right: 0;
}

.minimal-settings-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-600);
}

.minimal-settings-panel h3 {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
}

.minimal-setting {
  margin-bottom: 16px;
}

.minimal-setting label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.minimal-setting input,
.minimal-setting select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
}

.simple-text-editor {
  width: 100%;
  min-height: 400px;
  padding: 20px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.7;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.simple-text-editor:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.simple-text-editor::placeholder {
  color: var(--gray-300);
}

.suggestion-empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--gray-50);
  border: 2px dashed var(--gray-200);
  border-radius: 12px;
}

.suggestion-empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-500);
  margin: 16px 0 4px;
}

.suggestion-empty-sub {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin: 0;
}

/* Compact suggestion list */
.sug-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 20px;
}

.sug-search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  color: var(--gray-700);
}

.sug-group {
  margin-bottom: 20px;
}

.sug-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  margin-bottom: 6px;
}

.sug-group-toggle {
  cursor: pointer;
  user-select: none;
}

.sug-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sug-dot-open { background: var(--blue); }

.sug-group-chevron {
  color: var(--gray-400);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sug-chevron-open {
  transform: rotate(90deg);
}

.sug-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sug-group-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 1px 7px;
  border-radius: 8px;
}

.sug-compact-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sug-closed-hidden {
  display: none;
}

.sug-compact-empty {
  padding: 16px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--gray-400);
}

.sug-compact-item {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}

.sug-compact-item:hover {
  background: var(--gray-50);
}

.sug-ctype-bug { border-left-color: #dc2626; }
.sug-ctype-forslag { border-left-color: #2563eb; }
.sug-ctype-andet { border-left-color: #7c3aed; }

.sug-cstatus-resolved, .sug-cstatus-rejected {
  opacity: 0.6;
}

.sug-compact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
}

.sug-compact-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sug-compact-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sug-compact-article {
  font-size: 0.7rem;
  color: var(--blue);
  background: var(--blue-light);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sug-compact-author {
  font-size: 0.7rem;
  color: var(--gray-400);
  flex-shrink: 0;
}

.sug-compact-date {
  font-size: 0.7rem;
  color: var(--gray-400);
  flex-shrink: 0;
}

.sug-compact-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  color: #fff;
  flex-shrink: 0;
}

.sug-badge-open { background: var(--blue); }
.sug-badge-resolved { background: #22c55e; }
.sug-badge-rejected { background: #ef4444; }

/* Type sub-groups */
.sug-type-group {
  margin-bottom: 16px;
}

.sug-type-group:last-child {
  margin-bottom: 0;
}

.sug-type-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.sug-type-header:hover {
  background: var(--gray-100);
}

.sug-type-chevron {
  color: var(--gray-400);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sug-type-chevron.expanded {
  transform: rotate(90deg);
}

.sug-type-body {
  transition: none;
}

.sug-type-collapsed {
  display: none;
}

.sug-type-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-700);
}

.sug-type-count {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
}

/* Suggestion popup */
.sug-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  animation: sugOverlayIn 0.15s ease;
}

@keyframes sugOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sug-popup {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: sugPopupIn 0.2s ease;
  display: flex;
  flex-direction: column;
}

@keyframes sugPopupIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.sug-popup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.sug-popup-banner-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sug-popup-banner-icon {
  font-size: 1.3rem;
}

.sug-popup-banner-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sug-popup-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.1s;
  display: flex;
  align-items: center;
}

.sug-popup-close:hover {
  color: var(--gray-700);
  background: rgba(0,0,0,0.06);
}

.sug-popup-content {
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.sug-popup-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 14px;
  line-height: 1.3;
}

.sug-popup-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.sug-popup-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sug-popup-meta-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sug-popup-author {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
}

.sug-popup-date {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.sug-popup-status {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 8px;
  color: #fff;
  flex-shrink: 0;
}

.sug-popup-body {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.sug-popup-body p {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--gray-700);
  margin: 0 0 4px;
}

.sug-popup-body p:last-child {
  margin-bottom: 0;
}

.sug-popup-image {
  margin-top: 12px;
  display: inline-flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  position: relative;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.sug-popup-image:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.sug-popup-image img {
  max-width: 220px;
  max-height: 160px;
  object-fit: cover;
  display: block;
  border-radius: 9px;
  transition: transform 0.15s;
}

.sug-popup-image:hover img {
  transform: scale(1.02);
}

.sug-popup-expand {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.55);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  padding: 0;
  color: #fff;
}

.sug-popup-image:hover .sug-popup-expand {
  opacity: 1;
}

.sug-popup-expand:hover {
  background: rgba(0,0,0,0.8);
}

/* Suggestion image upload */
.sug-image-upload {
  position: relative;
}

.sug-image-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  border: 2px dashed var(--gray-300);
  border-radius: 10px;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.15s;
  background: var(--gray-50);
}

.sug-image-dropzone:hover,
.sug-image-dropzone.dragover {
  border-color: var(--blue-400);
  background: #eff6ff;
  color: var(--blue-500);
}

.sug-image-dropzone span {
  font-size: 13px;
}

.sug-image-preview {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.sug-image-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

.sug-image-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.sug-image-remove:hover {
  background: rgba(220,38,38,0.9);
}

/* Custom article select dropdown */
.sug-article-select {
  position: relative;
}

.sug-article-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--gray-50);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
}

.sug-article-selected:hover {
  border-color: var(--gray-400);
}

.sug-article-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  overflow: hidden;
}

.sug-article-dropdown.open {
  display: block;
}

.sug-article-search {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  background: var(--gray-50);
}

.sug-article-search:focus {
  background: #fff;
}

.sug-article-options {
  max-height: 180px;
  overflow-y: auto;
}

.sug-article-option {
  padding: 9px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.1s;
}

.sug-article-option:hover {
  background: var(--blue-50, #eff6ff);
}

/* Image lightbox */
.image-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sugOverlayIn 0.15s ease;
  cursor: zoom-out;
}

.image-lightbox {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  animation: sugPopupIn 0.2s ease;
}

.image-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  cursor: default;
}

.image-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.95);
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: background 0.15s;
}

.image-lightbox-close:hover {
  background: #fff;
  color: #dc2626;
}

.sug-popup-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.sug-popup-article {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 16px;
}

.sug-popup-article:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

.sug-popup-article-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sug-popup-article-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sug-popup-article-info strong {
  font-size: 0.82rem;
  color: var(--gray-800);
}

.sug-popup-article-info span {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.sug-popup-resolved-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-bottom: 16px;
}

.sug-popup-resolved-box div {
  display: flex;
  flex-direction: column;
}

.sug-popup-resolved-box strong {
  font-size: 0.78rem;
  color: #166534;
}

.sug-popup-resolved-box span {
  font-size: 0.7rem;
  color: #4ade80;
}

.sug-popup-respond {
  margin-bottom: 14px;
}

.sug-popup-respond-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--gray-50);
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 4px;
}

.sug-popup-respond-input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.sug-popup-response-msg {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin: 6px 0 0;
  font-style: italic;
  line-height: 1.4;
}

.sug-popup-rejected-box {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.sug-popup-rejected-box strong {
  color: #991b1b !important;
}

.sug-popup-rejected-box span {
  color: #f87171 !important;
}

.sug-popup-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.sug-popup-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.sug-popup-btn-primary {
  background: #22c55e;
  color: #fff;
}

.sug-popup-btn-primary:hover {
  background: #16a34a;
}

.sug-popup-btn-secondary {
  background: var(--gray-100);
  color: var(--gray-600);
}

.sug-popup-btn-secondary:hover {
  background: var(--gray-200);
}

.sug-popup-btn-danger {
  background: none;
  color: var(--gray-400);
  margin-left: auto;
}

.sug-popup-btn-danger:hover {
  color: #ef4444;
  background: #fef2f2;
}

.sug-unseen {
  background: #eff6ff;
}

.sug-show-more {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  background: none;
  border: 1px dashed var(--gray-300);
  border-radius: 8px;
  color: var(--gray-500);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.sug-show-more:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

.suggestion-form {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
}

.suggestion-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.suggestion-form .form-group label {
  margin-bottom: 6px;
}

.suggestion-form .form-group input[type="text"],
.suggestion-form .form-group select,
.suggestion-form .form-group textarea,
.suggestion-form input[type="text"],
.suggestion-form select,
.suggestion-form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.suggestion-form input:focus,
.suggestion-form select:focus,
.suggestion-form textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.suggestion-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
}

/* Create Suggestion Page */
.create-suggestion-page {
  max-width: 640px;
  margin: 0 auto;
}

.create-suggestion-back {
  margin-bottom: 20px;
}

.create-suggestion-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.create-suggestion-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 12px;
  flex-shrink: 0;
}

.create-suggestion-subtitle {
  font-size: 0.82rem;
  color: var(--gray-400);
  margin: 0;
}

.create-suggestion-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 24px;
}

.create-suggestion-card .form-group {
  margin-bottom: 18px;
}

.create-suggestion-card .form-group:last-child {
  margin-bottom: 0;
}

.create-suggestion-card .form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.create-suggestion-card textarea {
  resize: vertical;
}

.create-suggestion-card input[type="text"],
.create-suggestion-card select,
.create-suggestion-card textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--gray-50);
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
}

.create-suggestion-card input:focus,
.create-suggestion-card select:focus,
.create-suggestion-card textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.form-input-lg {
  font-size: 1rem !important;
  padding: 12px 14px !important;
  font-weight: 500;
}

.create-suggestion-type-select {
  margin-bottom: 20px;
}

.create-suggestion-type-select > label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.suggestion-type-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.suggestion-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
  text-align: center;
}

.suggestion-type-option:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.suggestion-type-option.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.suggestion-type-option-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.suggestion-type-option-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
}

.suggestion-type-option-desc {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.create-suggestion-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
}

/* Field validation errors */
.form-input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.form-field-error {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #ef4444;
  animation: fieldErrorIn 0.25s ease;
}

@keyframes fieldErrorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Notification badge on user button */
.user-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.suggestion-notif-badge {
  position: absolute;
  top: -3px;
  right: -5px;
  background: #ef4444;
  color: #fff;
  font-size: 0.52rem;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  line-height: 13px;
  text-align: center;
  border-radius: 50%;
  padding: 0 3px;
  border: 2px solid #fff;
  box-sizing: border-box;
}

.suggestion-notif-badge-menu {
  background: #ef4444;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 7px;
  padding: 0 4px;
  margin-left: auto;
}

.my-suggestions-link {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}

.suggestion-unseen {
  background: #fffbeb;
  border-color: #fbbf24;
}

.suggestion-resolved-info {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--gray-50);
  border-radius: 6px;
}

/* Minimal slash command menu */
.minimal-slash-menu {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 260px;
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}

.minimal-slash-menu .slash-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.1s;
}

.minimal-slash-menu .slash-menu-item:hover {
  background: var(--gray-100);
}

.minimal-slash-menu .slash-menu-item div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.minimal-slash-menu .slash-menu-item strong {
  font-size: 0.88rem;
  color: var(--gray-800);
  font-weight: 600;
}

.minimal-slash-menu .slash-menu-item span {
  font-size: 0.74rem;
  color: var(--gray-400);
}

.slash-menu-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  padding: 6px 10px 2px;
}

.slash-cmd-icon {
  width: 30px;
  height: 30px;
  background: var(--gray-100);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-600);
  flex-shrink: 0;
}

/* Contenteditable editor needs relative positioning for free image placement */
.minimal-content-input {
  position: relative;
  min-height: 300px;
}

/* Free-positioned image container */
.img-free-container {
  position: absolute;
  z-index: 5;
  user-select: none;
  cursor: move;
}
.img-free-container.selected {
  outline: 2px solid var(--blue, #3b82f6);
  outline-offset: 2px;
  border-radius: 4px;
  z-index: 10;
}
.img-free-container img {
  display: block;
  border-radius: 6px;
  pointer-events: auto;
}
.img-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--blue, #3b82f6);
  border: 2px solid #fff;
  border-radius: 50%;
  z-index: 10;
}
.img-resize-nw { top: -5px; left: -5px; cursor: nw-resize; }
.img-resize-ne { top: -5px; right: -5px; cursor: ne-resize; }
.img-resize-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.img-resize-se { bottom: -5px; right: -5px; cursor: se-resize; }

.img-toolbar {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 3px 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 20;
}
.img-toolbar button {
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.1s;
}
.img-toolbar button:hover {
  background: var(--gray-100);
}

.img-drag-ghost {
  height: 4px;
  background: var(--blue, #3b82f6);
  border-radius: 2px;
  margin: 4px 0;
  pointer-events: none;
}