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

:root {
  color-scheme: dark;
  /* XeoNote Brand Colors - Dark Theme */
  --bg: #0F172A;        /* Deep Slate - primary dark base */
  --panel: #1F2937;     /* Soft Graphite - panels/surfaces */
  --surface: #252b36;
  --text: #FFFFFF;      /* Pure White - text contrast */
  --muted: #9aa3b2;
  --accent: #4F46E5;    /* Electric Indigo - brand signature */
  --accent-hover: #4338CA; /* Darker indigo for hover */
  --accent-glow: #22D3EE;  /* Neon Cyan - attention accents */
  --border: #2f3644;
  --danger: #ff5f56;
  --success: #5af78e;
  --font-mono: "Cascadia Code", "Fira Code", "Source Code Pro", "Consolas", monospace;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-heading: "Sora", "Space Grotesk", "Inter", system-ui, sans-serif;
  --radius: 6px;
  --radius-lg: 8px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --touch-topbar-h: calc(56px + var(--safe-area-top));
}

/* Light theme - explicit light mode only */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f5f7fa;
  --surface: #ffffff;
  --text: #0F172A;      /* Deep Slate for light mode text */
  --muted: #6b7280;
  --accent: #4F46E5;    /* Electric Indigo - consistent across themes */
  --accent-hover: #4338CA;
  --accent-glow: #22D3EE;  /* Neon Cyan */
  --border: #e0e4ea;
  --danger: #dc2626;
  --success: #059669;
}

/* Dark theme - explicit dark mode */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F172A;
  --panel: #1F2937;
  --surface: #252b36;
  --text: #FFFFFF;
  --muted: #9aa3b2;
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-glow: #22D3EE;
  --border: #2f3644;
  --danger: #ff5f56;
  --success: #5af78e;
}

/* System preference: light mode when OS prefers light */
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #f5f7fa;
    --surface: #ffffff;
    --text: #0F172A;
    --muted: #6b7280;
    --accent: #4F46E5;
    --accent-hover: #4338CA;
    --accent-glow: #22D3EE;
    --border: #e0e4ea;
    --danger: #dc2626;
    --success: #059669;
  }
}

/* System preference: dark mode when OS prefers dark */
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #0F172A;
    --panel: #1F2937;
    --surface: #252b36;
    --text: #FFFFFF;
    --muted: #9aa3b2;
    --accent: #4F46E5;
    --accent-hover: #4338CA;
    --accent-glow: #22D3EE;
    --border: #2f3644;
    --danger: #ff5f56;
    --success: #5af78e;
  }
}

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

html, body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── App shell ──────────────────────────────────────────────── */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Top bar ────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-area-top) max(1.25rem, var(--safe-area-right)) 0 max(1.25rem, var(--safe-area-left));
  height: calc(100px + var(--safe-area-top));
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-actions .btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  letter-spacing: -0.02em;
  cursor: default;
  user-select: none;
}

.logo .logo-img {
  max-height: 150px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

.login-logo-img {
  max-height: 150px;
  width: auto;
  object-fit: contain;
}

.logo-link {
  color: inherit;
  text-decoration: none;
}
.logo-link:hover {
  opacity: 0.8;
}

/* Theme-aware logo variants: dark logo shown in dark mode, light logo shown in light mode */
/* Default (dark mode assumed) — show dark-mode logo, hide light-mode logo */
.logo-light-mode { display: none !important; }
.logo-dark-mode { display: inline !important; }

:root[data-theme="light"] .logo-light-mode { display: inline !important; }
:root[data-theme="light"] .logo-dark-mode { display: none !important; }

:root[data-theme="dark"] .logo-light-mode { display: none !important; }
:root[data-theme="dark"] .logo-dark-mode { display: inline !important; }

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .logo-light-mode { display: inline !important; }
  :root[data-theme="system"] .logo-dark-mode { display: none !important; }
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .logo-light-mode { display: none !important; }
  :root[data-theme="system"] .logo-dark-mode { display: inline !important; }
}

/* Pages without data-theme (auth pages, initial load): use prefers-color-scheme */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .logo-light-mode { display: inline !important; }
  :root:not([data-theme]) .logo-dark-mode { display: none !important; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .logo-light-mode { display: none !important; }
  :root:not([data-theme]) .logo-dark-mode { display: inline !important; }
}

.user-pill {
  padding: 0.4rem 0.8rem;
  background: var(--surface);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--border);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

a.user-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: var(--font-ui);
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn.primary {
  background: var(--accent);
  color: #0b0f14;
}

.btn.small {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  color: var(--text);
  border-color: var(--muted);
  background: var(--surface);
}

/* ── Workspace (3-pane layout) ──────────────────────────────── */

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search {
  width: 100%;
  padding: 0.45rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s;
}

.search:focus {
  border-color: var(--accent);
}

.search::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.note-list li {
  padding: 0.5rem 0.65rem;
  background: transparent;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.1s, color 0.1s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-list li:hover {
  background: var(--surface);
  color: var(--text);
}

.note-list li.active {
  background: var(--surface);
  color: var(--text);
  border-left-color: var(--accent);
}

.sidebar-empty {
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.sidebar-empty p {
  margin-bottom: 0.75rem;
}

/* ── Editor pane ────────────────────────────────────────────── */

.editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  min-height: 0;
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  padding: 0.4rem 0.75rem 0;
  background: var(--panel);
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  min-height: 36px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  position: relative;
  top: 1px;
}

.tab:hover {
  background: var(--surface);
  color: var(--text);
}

.tab.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.tab-title {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.tab-title-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: inherit;
  font: inherit;
  font-size: inherit;
  width: 120px;
  outline: none;
  padding: 0;
}

.tab-close {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.4;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 3px;
}

.tab-close:hover {
  opacity: 1;
  background: rgba(255, 95, 86, 0.2);
  color: var(--danger);
}

/* Editor area (Quill rich text) */
.editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  margin: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.editor-wrap.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Quill dark theme overrides ───────────────────────────── */

.editor-wrap .ql-toolbar.ql-snow {
  background: var(--panel);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
  flex-shrink: 0;
}

.editor-wrap .ql-container.ql-snow {
  border: none;
  flex: 1;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  position: relative;
  display: flex;
  flex-direction: row;
}

.line-numbers {
  width: 2.5rem;
  flex-shrink: 0;
  padding-top: 0.75rem;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  font-family: var(--font-mono, 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--muted);
  opacity: 0.4;
  text-align: right;
  box-sizing: border-box;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.line-numbers .ln {
  display: block;
  padding-right: 0.4rem;
}

.editor-wrap .ql-editor {
  color: var(--text);
  padding: 0.75rem;
  padding-left: 0.75rem;
  line-height: 1.6;
  min-height: 100%;
  flex: 1;
  overflow-y: auto;
}

.editor-wrap .ql-editor.ql-blank::before {
  color: var(--muted);
  opacity: 0.4;
  font-style: normal;
}

/* Toolbar buttons */
.editor-wrap .ql-toolbar .ql-stroke {
  stroke: var(--muted);
}

.editor-wrap .ql-toolbar .ql-fill {
  fill: var(--muted);
}

.editor-wrap .ql-toolbar .ql-picker-label {
  color: var(--muted);
  border-color: transparent;
}

.editor-wrap .ql-toolbar button:hover .ql-stroke,
.editor-wrap .ql-toolbar .ql-picker-label:hover .ql-stroke {
  stroke: var(--accent);
}

.editor-wrap .ql-toolbar button:hover .ql-fill,
.editor-wrap .ql-toolbar .ql-picker-label:hover .ql-fill {
  fill: var(--accent);
}

.editor-wrap .ql-toolbar button:hover,
.editor-wrap .ql-toolbar .ql-picker-label:hover {
  color: var(--accent);
}

.editor-wrap .ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--accent);
}

.editor-wrap .ql-toolbar button.ql-active .ql-fill {
  fill: var(--accent);
}

.editor-wrap .ql-toolbar button.ql-active {
  color: var(--accent);
}

.editor-wrap .ql-toolbar .ql-picker-label.ql-active {
  color: var(--accent);
}

.editor-wrap .ql-toolbar .ql-picker-label.ql-active .ql-stroke {
  stroke: var(--accent);
}

/* Toolbar dropdown menus */
.ql-toolbar .ql-picker-options {
  background: var(--panel) !important;
  border-color: var(--border) !important;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.ql-toolbar .ql-picker-item {
  color: var(--muted) !important;
}

.ql-toolbar .ql-picker-item:hover {
  color: var(--accent) !important;
}

/* Code blocks */
.editor-wrap .ql-editor pre.ql-syntax {
  background: #1a1e26;
  color: #abb2bf;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
}

:root[data-theme="light"] .editor-wrap .ql-editor pre.ql-syntax {
  background: #f6f8fa;
  color: #24292e;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .editor-wrap .ql-editor pre.ql-syntax {
    background: #f6f8fa;
    color: #24292e;
  }
}

/* Inline code */
.editor-wrap .ql-editor code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

:root[data-theme="light"] .editor-wrap .ql-editor code {
  background: rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .editor-wrap .ql-editor code {
    background: rgba(0, 0, 0, 0.06);
  }
}

/* Headings in editor */
.editor-wrap .ql-editor h1 { font-size: 1.6rem; margin: 0.5em 0 0.3em; }
.editor-wrap .ql-editor h2 { font-size: 1.3rem; margin: 0.4em 0 0.25em; }
.editor-wrap .ql-editor h3 { font-size: 1.1rem; margin: 0.3em 0 0.2em; }

/* Lists */
.editor-wrap .ql-editor ol,
.editor-wrap .ql-editor ul {
  padding-left: 1.5em;
}

/* Blockquote */
.editor-wrap .ql-editor blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  color: var(--muted);
  margin: 0.5em 0;
}

/* Quill snow theme tooltip (link editor etc) */
.ql-snow .ql-tooltip {
  background: var(--panel) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

.ql-snow .ql-tooltip input[type=text] {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#status-saved {
  margin-left: auto;
  color: var(--success);
}

/* ── Context pane (right sidebar) ───────────────────────────── */

.context-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.context-pane h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.context-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.context-item .label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.context-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s;
}

.context-input:focus {
  border-color: var(--accent);
}

/* ── Welcome screen ─────────────────────────────────────────── */

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  text-align: center;
  color: var(--muted);
  height: 100%;
}

.welcome-screen h2 {
  color: var(--text);
  font-size: 1.4rem;
}

.welcome-screen p {
  max-width: 400px;
  line-height: 1.5;
}

/* ── Auth page (login) ──────────────────────────────────────── */

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-area-top);
  background: linear-gradient(135deg, #0f1115 0%, #1c212d 100%);
}

:root[data-theme="light"] .auth-page {
  background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .auth-page {
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
  }
}

.auth-card {
  width: min(420px, 90%);
  background: var(--panel);
  padding: 2.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.auth-card h1 {
  font-size: 1.6rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.auth-card p {
  color: var(--muted);
  line-height: 1.5;
}

.auth-meta {
  color: var(--muted);
  font-size: 0.8rem;
  opacity: 0.6;
}

.auth-meta a {
  color: var(--accent);
  text-decoration: none;
}

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

/* ── Auth forms ────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s;
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.auth-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
}

.auth-error {
  background: rgba(255, 95, 86, 0.1);
  border: 1px solid rgba(255, 95, 86, 0.3);
  color: var(--danger);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.4;
}

.auth-success {
  background: rgba(90, 247, 142, 0.1);
  border: 1px solid rgba(90, 247, 142, 0.3);
  color: var(--success);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.4;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  opacity: 0.5;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── OAuth buttons ─────────────────────────────────────────── */

.auth-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.oauth-btn {
  justify-content: center;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
}

.oauth-btn:hover {
  border-color: var(--muted);
  background: var(--panel);
}

.oauth-btn.entra {
  border-color: #0078d4;
}

.oauth-btn.entra:hover {
  background: rgba(0, 120, 212, 0.1);
}

.oauth-btn.google {
  border-color: #4285f4;
}

.oauth-btn.google:hover {
  background: rgba(66, 133, 244, 0.1);
}

.oauth-btn.github {
  border-color: #6e7681;
}

.oauth-btn.github:hover {
  background: rgba(110, 118, 129, 0.1);
}

/* ── Profile page ──────────────────────────────────────────── */

.profile-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.profile-content {
  max-width: 640px;
  margin: 2rem auto;
  padding: 0 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.profile-header h1 {
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.profile-email {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-meta {
  color: var(--muted);
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 0.25rem;
}

.profile-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.profile-section h2 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 1rem;
}

.profile-section p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.6;
}

.profile-danger {
  border-color: rgba(255, 95, 86, 0.3);
}

.profile-danger h2 {
  color: var(--danger);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.danger:hover {
  background: #e04940;
}

/* ── Sessions list ─────────────────────────────────────────── */

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.session-item.current {
  border-color: var(--accent);
}
.session-item.token-expired {
  opacity: 0.5;
}
.session-item + .session-item {
  margin-top: 0.5rem;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
}

.session-ip {
  color: var(--text);
  font-weight: 600;
}

.session-badge {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.session-time {
  color: var(--muted);
  font-size: 0.78rem;
}

.session-ua {
  color: var(--muted);
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ── Scrollbar styling ──────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── Encryption indicators ─────────────────────────────────── */

.note-list li.encrypted::before {
  content: '\1F512';
  margin-right: 0.35rem;
  font-size: 0.75rem;
}

.tab .tab-lock {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-right: 0.15rem;
}

#note-encryption-status.encrypted {
  color: var(--success);
  font-weight: 600;
}

#btn-encrypt.active {
  color: var(--success);
  border-color: var(--success);
}

#status-encrypted {
  color: var(--success);
}

/* ── Modal ─────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(400px, 90vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-card h3 {
  font-size: 1.1rem;
  color: var(--text);
}

.modal-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.modal-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-error {
  color: var(--danger);
  font-size: 0.82rem;
  min-height: 1.2em;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

/* ── Folder tree ───────────────────────────────────────────── */

.folder-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 0.5rem;
}

.sidebar-section-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 12px 12px 4px;
    margin-top: 4px;
}

.folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--muted);
  transition: background 0.1s, color 0.1s;
  user-select: none;
}

.folder-item:hover {
  background: var(--surface);
  color: var(--text);
}

.folder-item.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.folder-item.virtual {
  font-size: 0.82rem;
}

.folder-item .folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.folder-item .folder-count {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.6;
  margin-left: 0.4rem;
  flex-shrink: 0;
}

.folder-item .folder-action {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.2rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.folder-item:hover .folder-action {
  opacity: 0.6;
}

.folder-item .folder-action:hover {
  opacity: 1;
  color: var(--danger);
}

.folder-actions {
  padding: 0.25rem 0.3rem;
}

.folder-item.child {
  padding-left: 1.4rem;
  font-size: 0.82rem;
}

.folder-chevron {
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 0.6rem;
  color: var(--muted);
  text-align: center;
  user-select: none;
}

.folder-chevron-spacer {
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
}

.folder-item.drag-over {
  background: var(--surface);
  outline: 2px solid var(--accent);
  border-radius: var(--radius);
}

.folder-item.drag-over-nest {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  outline: 2px dashed var(--accent);
  border-radius: var(--radius);
}

.folder-item[draggable="true"] {
  cursor: grab;
}

/* ── Topbar dropdown (More menu) ───────────────────────────── */

.topbar-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 180px;
  padding: 0.35rem;
  z-index: 150;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.dropdown-item:hover {
  background: var(--surface);
  color: var(--text);
}

a.dropdown-item {
  display: block;
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}

/* ── Note action buttons (trash restore, template use) ─────── */

.note-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.note-list li .note-title-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-action-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--font-ui);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.note-action-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
}

/* ── Pin button active state ───────────────────────────────── */

#btn-pin.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Version history in modal ──────────────────────────────── */

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.version-item .version-date {
  color: var(--text);
  font-weight: 500;
}

.version-item .version-size {
  color: var(--muted);
  font-size: 0.78rem;
}

.version-item .version-actions {
  display: flex;
  gap: 0.4rem;
}

/* ── Select styling for context pane / modals ──────────────── */

select.context-input,
select.modal-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa3b2' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

/* ── Topbar left (burger + logo) ────────────────────────────── */

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Burger button ─────────────────────────────────────────── */

.burger-btn {
  display: none; /* hidden on desktop */
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.burger-btn:hover {
  background: var(--surface);
}

.burger-line {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.burger-btn.open .burger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.burger-btn.open .burger-line:nth-child(2) {
  opacity: 0;
}

.burger-btn.open .burger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── Mobile-only / hide-mobile utility ─────────────────────── */

.show-mobile-only {
  display: none !important;
}

/* ── Sidebar overlay backdrop ──────────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--touch-topbar-h);
  background: rgba(0, 0, 0, 0.4);
  z-index: 49;
}

.sidebar-overlay.active {
  display: block;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 220px 1fr;
  }

  .context-pane {
    display: none;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: var(--safe-area-top) max(0.5rem, var(--safe-area-right)) 0 max(0.5rem, var(--safe-area-left));
    height: calc(56px + var(--safe-area-top));
  }

  .topbar-actions .btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }

  .logo .logo-img {
    max-height: 56px;
  }

  .topbar-actions {
    gap: 0.25rem;
  }

  .burger-btn {
    display: flex;
  }

  .hide-mobile {
    display: none !important;
  }

  .show-mobile-only {
    display: block !important;
  }

  hr.show-mobile-only {
    display: block !important;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: var(--touch-topbar-h);
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .sidebar.mobile-visible {
    display: flex;
  }

  body[data-ui-mode="touch"][data-nav-open="true"] .sidebar {
    display: flex;
  }

  body[data-ui-mode="touch"][data-nav-open="true"] .sidebar-overlay {
    display: block;
  }

  .context-pane {
    display: none;
  }

  .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  .btn.small {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }

  .dropdown-menu {
    right: -0.5rem;
    min-width: 200px;
  }
}

/* ── Touch-first refinements (phones/tablets only) ───────────── */
body[data-ui-mode="touch"] .sidebar {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body[data-ui-mode="touch"] .search {
  min-height: 42px;
  padding: 0.55rem 0.8rem;
  font-size: 16px;
}

body[data-ui-mode="touch"] .note-list li {
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
}

body[data-ui-mode="touch"] .folder-item {
  min-height: 42px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.92rem;
}

body[data-ui-mode="touch"] .folder-item .folder-action {
  opacity: 0.55;
  padding: 0.2rem 0.35rem;
}

body[data-ui-mode="touch"] .sidebar-tab {
  min-height: 44px;
  padding: 12px 6px 10px;
  font-size: 0.8rem;
}

body[data-ui-mode="touch"] .sidebar-section-header {
  min-height: 38px;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

body[data-ui-mode="touch"] .btn {
  min-height: 40px;
}

@media (max-width: 768px) {
  body[data-ui-mode="touch"] .sidebar {
    width: min(88vw, 340px);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  body[data-ui-mode="touch"] .sidebar {
    width: min(52vw, 380px);
  }
}

/* ── Touch polish (isolated to coarse pointers) ─────────────── */
@media (hover: none) and (pointer: coarse) {
  .topbar-actions {
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions .btn {
    min-height: 40px;
    padding: 0.4rem 0.7rem;
  }

  .sidebar {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .search {
    min-height: 42px;
    font-size: 16px;
    padding: 0.55rem 0.8rem;
  }

  .note-list li {
    min-height: 44px;
    padding: 0.65rem 0.8rem;
    font-size: 0.95rem;
  }

  .folder-item {
    min-height: 42px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.9rem;
  }

  .folder-item .folder-action {
    opacity: 0.55;
    padding: 0.2rem 0.35rem;
  }

  .sidebar-tab {
    min-height: 44px;
    padding: 12px 6px 10px;
    font-size: 0.8rem;
  }

  .tabs {
    min-height: 44px;
    padding-top: 0.45rem;
  }

  .tab {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
  }

  .tab-close {
    font-size: 1.1rem;
    padding: 0 0.35rem;
  }

  .dropdown-menu {
    position: fixed;
    top: calc(var(--touch-topbar-h) + 6px);
    right: 8px;
    min-width: min(80vw, 260px);
    max-width: min(92vw, 360px);
    max-height: calc(100vh - var(--touch-topbar-h) - 16px);
    overflow-y: auto;
  }

  .dropdown-item {
    min-height: 42px;
    padding: 0.65rem 0.8rem;
    font-size: 0.92rem;
  }

  /* In the slide-out sidebar, avoid pulling tabs under the topbar */
  .sidebar-tabs-bar {
    margin-top: 0;
  }

  .sidebar-section-header {
    min-height: 38px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  .btn {
    min-height: 40px;
  }
}

@media (hover: none) and (pointer: coarse) and (max-width: 768px) {
  .sidebar {
    width: min(88vw, 340px);
  }
}

@media (hover: none) and (pointer: coarse) and (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: min(52vw, 380px);
  }
}

/* ── Billing & Plans ────────────────────────────────────────── */

.billing-trial-banner {
  background: linear-gradient(135deg, #57c7ff22, #5af78e22);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--text);
}

.billing-trial-banner strong {
  color: var(--accent);
}

.trial-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
  margin-left: 0.5rem;
}

.founder-pill-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
}

.founder-pill-wrap .user-pill {
  margin: 0;
}

.founder-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #ffd700, #f4a900);
  color: #1a1200;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  line-height: 1.3;
}

.founder-badge .crown {
  font-size: 0.65rem;
  line-height: 1;
}

.user-pill.founder-pill {
  border-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(244, 169, 0, 0.05));
  color: #ffd700;
}

.founder-pill-wrap:hover .user-pill.founder-pill {
  border-color: #f4a900;
  color: #ffe44d;
}

/* ── Plan pill wrapper (shared by all plan badges) ──────── */

.plan-pill-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
}

.plan-pill-wrap .user-pill {
  margin: 0;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  line-height: 1.3;
}

.plan-badge .plan-icon {
  font-size: 0.65rem;
  line-height: 1;
}

/* Free plan */
.plan-badge.plan-free {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.user-pill.pill-free {
  border-color: var(--border);
  color: var(--muted);
}

/* Pro plan */
.plan-badge.plan-pro {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
}

.user-pill.pill-pro {
  border-color: #6366f1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(129, 140, 248, 0.05));
  color: #818cf8;
}

.plan-pill-wrap:hover .user-pill.pill-pro {
  border-color: #818cf8;
  color: #a5b4fc;
}

/* Team plan */
.plan-badge.plan-team {
  background: linear-gradient(135deg, #06b6d4, #22d3ee);
  color: #052e38;
}

.user-pill.pill-team {
  border-color: #06b6d4;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(34, 211, 238, 0.05));
  color: #22d3ee;
}

.plan-pill-wrap:hover .user-pill.pill-team {
  border-color: #22d3ee;
  color: #67e8f9;
}

.plan-org-name {
  font-size: 0.55rem;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.billing-current-plan {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.billing-plan-badge {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.billing-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.billing-usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.usage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.usage-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.usage-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.usage-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.usage-unlimited {
  font-size: 0.8rem;
  color: var(--muted);
}

.billing-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 0.2s;
}

.plan-card.current {
  border-color: var(--accent);
}

.plan-card h3 {
  font-size: 1.2rem;
  color: var(--text);
}

.plan-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
}

.plan-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.plan-interval {
  font-size: 0.9rem;
  color: var(--muted);
}

.plan-yearly {
  width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}

.plan-features {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.plan-features li {
  font-size: 0.85rem;
  color: var(--text);
  padding-left: 1.25rem;
  position: relative;
}

.plan-features li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.plan-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.plan-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.billing-table th,
.billing-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.billing-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.billing-table td {
  color: var(--text);
}

/* Trial banner in main app */
.app-trial-banner {
  background: linear-gradient(135deg, #57c7ff22, #5af78e22);
  border-bottom: 1px solid var(--accent);
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--text);
  text-align: center;
}

.app-trial-banner a {
  color: var(--accent);
  text-decoration: underline;
  margin-left: 0.5rem;
}

/* ── Announcement Banners ──────────────────────────────────── */

.app-announcement-banner {
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  color: var(--text);
  text-align: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.app-announcement-info {
  background: linear-gradient(135deg, #4F46E522, #22D3EE22);
  border-bottom-color: var(--accent);
}

.app-announcement-warning {
  background: linear-gradient(135deg, #eab30822, #f59e0b22);
  border-bottom-color: #eab308;
}

.app-announcement-critical {
  background: linear-gradient(135deg, #dc262622, #ef444422);
  border-bottom-color: var(--danger);
}

.announcement-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.announcement-dismiss:hover {
  color: var(--text);
}

/* ── Onboarding Overlay ───────────────────────────────────── */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: all;
}

.onboarding-spotlight {
  position: absolute;
  border: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
  transition: all 0.35s ease;
  pointer-events: none;
  z-index: 1;
}

.onboarding-tooltip {
  position: absolute;
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  max-width: 380px;
  min-width: 280px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  pointer-events: all;
  transition: all 0.35s ease;
  z-index: 2;
}

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

.onboarding-step-counter {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.onboarding-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.onboarding-close:hover {
  color: var(--text);
}

.onboarding-title {
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 0.4rem 0;
}

.onboarding-description {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 1rem 0;
  line-height: 1.5;
}

.onboarding-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ── Drag-and-drop file handling ────────────────────────────── */

.editor-pane.drag-over {
  position: relative;
}

.editor-pane.drag-over::after {
  content: 'Drop file to open';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.12);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-ui);
  z-index: 10;
  pointer-events: none;
}

/* ── Command Palette ────────────────────────────────────────── */

.command-palette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.command-palette {
  width: min(600px, 90vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.command-palette-input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
}

.command-palette-input::placeholder {
  color: var(--muted);
}

.command-palette-results {
  max-height: 400px;
  overflow-y: auto;
}

.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

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

.command-item:hover,
.command-item.selected {
  background: var(--surface);
}

.command-name {
  font-size: 0.95rem;
  color: var(--text);
}

.command-key {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
  background: var(--bg);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── Meetings & Action Items ─────────────────────────────────── */

.folder-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0.3rem;
}

.sidebar-meetings-header {
  padding: 0 0.3rem;
}

/* Action item in Quill editor */
.ql-editor .ql-action-item {
  border-left: 3px solid var(--accent);
  background: rgba(79, 70, 229, 0.06);
  padding-left: 0.5rem;
  margin: 2px 0;
}

.ql-editor .ql-action-item::before {
  content: '\2610 ';
  color: var(--accent);
  font-weight: 600;
}

/* Action item toolbar button */
.ql-toolbar .ql-action-item {
  width: 28px;
  height: 24px;
  position: relative;
}

.ql-toolbar .ql-action-item::after {
  content: '\2611';
  font-size: 1.1rem;
  line-height: 24px;
  position: absolute;
  top: 0;
  left: 4px;
}

/* Hide action-item button when not editing a meeting note */
.editor-wrap:not(.meeting-mode) .ql-action-item {
  display: none;
}

/* Context pane meeting fields */
.context-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.context-link:hover {
  text-decoration: underline;
}

.meeting-field textarea.context-input {
  resize: vertical;
  min-height: 60px;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.4;
}

/* ── Feedback image attachments ────────────────────────────── */

.feedback-images-section {
  margin-top: 0.75rem;
}

.feedback-images-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.feedback-image-input {
  font-size: 0.8rem;
  color: var(--text);
}

.feedback-image-previews {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.feedback-preview-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── Admin feedback image gallery ──────────────────────────── */

.feedback-admin-images {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.feedback-admin-thumb {
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: zoom-in;
  border: 1px solid var(--border);
  transition: opacity 0.15s;
}

.feedback-admin-thumb:hover {
  opacity: 0.85;
}

/* ── Lightbox ───────────────────────────────────────────────── */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}


/* ── Sidebar mode tabs ───────────────────────────────────────── */

.sidebar-tabs-bar {
    display: flex;
    align-items: flex-end;
    margin: -12px -12px 0;
    padding: 0 8px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
    gap: 2px;
}

.sidebar-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
    padding: 10px 4px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.015em;
    color: var(--muted);
    white-space: nowrap;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sidebar-tab svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.sidebar-tab:hover {
    color: var(--text);
    background: rgba(127, 127, 127, 0.06);
}

.sidebar-tab:hover svg {
    opacity: 1;
}

.sidebar-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.sidebar-tab.active svg {
    opacity: 1;
}


.sidebar-mode {
    overflow-y: auto;
    flex: 1;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius);
    margin: 0.1rem 0.25rem;
}

.sidebar-section-header:hover {
    background: var(--hover);
    color: var(--text);
}

.section-chevron {
    font-size: 0.6rem;
    transition: transform 0.15s;
}


/* ── Workspace accordion ─────────────────────────────────────── */

.workspace-item .folder-chevron {
    color: var(--muted);
}

.ws-folder-tree {
    /* Container for a workspace's folder tree */
}

.folder-add-btn {
    display: block;
    margin: 0.2rem 0.5rem 0.2rem 1.5rem;
    font-size: 0.8rem;
}


/* ── Workspace settings modal ────────────────────────────────── */

.ws-settings-card {
    width: min(520px, 94vw);
    max-height: 85vh;
    overflow-y: auto;
}

.ws-settings-section {
    margin: 0.75rem 0;
}

.ws-settings-heading {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 0.6rem 0;
    color: var(--text);
}

.ws-danger-heading {
    color: var(--danger, #e53e3e);
}

.ws-rename-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ws-rename-row .modal-input {
    flex: 1;
}

.ws-invite-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.ws-invite-row .modal-input {
    flex: 1;
    min-width: 140px;
}

.ws-role-select {
    width: auto !important;
}

.ws-radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.4rem 0;
    font-size: 0.875rem;
    cursor: pointer;
}

.ws-delete-desc {
    font-size: 0.875rem;
    margin: 0.75rem 0 0.5rem;
    color: var(--muted);
}

.ws-delete-confirm-label {
    font-size: 0.875rem;
    margin: 0.75rem 0 0.25rem;
}

.modal-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.75rem 0;
}

.modal-success {
    color: var(--success, #38a169);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.btn.danger {
    background: var(--danger, #e53e3e);
    color: #fff;
    border: none;
}

.btn.danger:hover {
    background: var(--danger-dark, #c53030);
}

/* ═══════════════════════════════════════════════════════════════
   Spaces — Wiki Page View
   ═══════════════════════════════════════════════════════════════ */

.space-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.space-shell .topbar {
    flex-shrink: 0;
}

.topbar-back-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.space-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
}

.space-icon {
    font-size: 1.15rem;
}

.space-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Space Layout */
.space-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Space Sidebar */
.space-sidebar {
    width: 260px;
    min-width: 220px;
    max-width: 320px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.space-sidebar-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.space-sidebar-header .search {
    width: 100%;
}

.space-page-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.space-sidebar-actions {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border);
}

/* Page Tree Items */
.space-tree-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    border-radius: var(--radius);
    margin: 1px 4px;
    font-size: 0.875rem;
    color: var(--text);
    transition: background 0.15s;
    user-select: none;
}

.space-tree-item:hover {
    background: var(--surface);
}

.space-tree-item.active {
    background: var(--accent);
    color: #fff;
}

.space-tree-item.drag-over {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.space-tree-item.dragging {
    opacity: 0.5;
}

.tree-chevron {
    width: 14px;
    text-align: center;
    font-size: 0.65rem;
    color: var(--muted);
    flex-shrink: 0;
    cursor: pointer;
}

.tree-chevron.invisible {
    visibility: hidden;
}

.tree-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}

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

.tree-draft-badge {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--warning, #e6a700);
    background: rgba(230, 167, 0, 0.12);
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 6px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.tree-menu-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    padding: 0 0.25rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.space-tree-item:hover .tree-menu-btn {
    opacity: 1;
}

.tree-menu-btn:hover {
    color: var(--text);
}

/* Context Menu */
.space-context-menu {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 150px;
}

.space-context-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
}

.space-context-item:hover {
    background: var(--surface);
}

.space-context-item.danger {
    color: var(--danger);
}

/* Space Content */
.space-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg);
    min-width: 0;
}

/* Breadcrumbs */
.space-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 2rem;
    font-size: 0.8rem;
    color: var(--muted);
    flex-wrap: wrap;
    min-height: 2rem;
}

.breadcrumb-item {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}

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

.breadcrumb-item.current {
    color: var(--text);
    font-weight: 500;
}

.breadcrumb-sep {
    color: var(--border);
    font-size: 0.75rem;
}

/* Page Header */
.space-page-header {
    padding: 0 2rem;
}

.space-page-title-input {
    width: 100%;
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    background: none;
    border: none;
    outline: none;
    padding: 0.25rem 0;
    line-height: 1.3;
}

.space-page-title-input::placeholder {
    color: var(--muted);
    opacity: 0.5;
}

.space-page-title-readonly {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    padding: 0.25rem 0;
    line-height: 1.3;
}

.space-page-meta {
    font-size: 0.8rem;
    color: var(--muted);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

/* Editor */
.space-editor-wrap {
    flex: 1;
    padding: 0 2rem 2rem;
    min-height: 300px;
}

.space-editor-wrap .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
}

.space-editor-wrap .ql-container {
    border: none;
    font-size: 1rem;
    line-height: 1.7;
}

.space-editor-wrap .ql-editor {
    padding: 1rem 0;
    min-height: 200px;
}

.space-editor-wrap .ql-editor.ql-blank::before {
    color: var(--muted);
    opacity: 0.4;
    font-style: normal;
}

/* Status */
.space-page-status {
    position: fixed;
    bottom: 1rem;
    right: 1.5rem;
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--panel);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.3s;
}

.space-page-status:empty {
    opacity: 0;
}

/* Welcome / Empty State */
.space-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem;
}

.space-welcome-inner {
    text-align: center;
    max-width: 400px;
}

.space-welcome-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.space-welcome h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
}

.space-welcome-desc {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.space-welcome-hint {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Version Items */
.version-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.version-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.version-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

/* Version Diff */
.version-compare-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.version-radio-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
    min-width: 28px;
}

.version-radio-col input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.diff-panel {
    max-height: 400px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    margin-top: 0.75rem;
    background: var(--surface);
}

.diff-line-add {
    background: rgba(46, 160, 67, 0.15);
    color: var(--text);
    white-space: pre-wrap;
}

.diff-line-remove {
    background: rgba(248, 81, 73, 0.15);
    color: var(--text);
    text-decoration: line-through;
    white-space: pre-wrap;
}

.diff-line-same {
    color: var(--muted);
    white-space: pre-wrap;
}

/* Archived workspace styles */
.archived-toggle {
    opacity: 0.7;
    margin-top: 0.25rem;
}

.archived-workspace {
    opacity: 0.6;
    font-style: italic;
}

.archived-empty {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.25rem 1rem;
}

/* Archive button (warning style) */
.btn.warning {
    background: var(--warning, #e3a008);
    color: #fff;
    border: none;
}

.btn.warning:hover {
    filter: brightness(0.9);
}

/* Search Results */
.search-result-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.search-result-item:hover {
    background: var(--surface);
}

/* ── Notification Bell ─────────────────────────────────────── */
.notif-wrap {
    position: relative;
    display: inline-flex;
}

.notif-bell-btn {
    position: relative;
    padding: 0.35rem 0.5rem;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
    pointer-events: none;
}

.notif-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.notif-list {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}

.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.notif-item {
    display: flex;
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.notif-item:hover {
    background: var(--surface);
}

.notif-item.unread {
    border-left: 3px solid var(--accent);
}

.notif-item-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-body {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.notif-panel-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* ── Notification Preferences ─────────────────────────────── */
.notif-pref-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0;
}

.notif-pref-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.notif-pref-row input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ── Mention Chip ─────────────────────────────────────────── */
.mention-chip {
    display: inline;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: inherit;
    font-weight: 500;
    white-space: nowrap;
    cursor: default;
}

/* ── Mention Autocomplete Dropdown ────────────────────────── */
.mention-dropdown {
    position: absolute;
    z-index: 1200;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 200px;
    max-width: 300px;
    max-height: 260px;
    overflow-y: auto;
}

.mention-dropdown-item {
    display: flex;
    flex-direction: column;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
}

.mention-dropdown-item:hover,
.mention-dropdown-item.selected {
    background: var(--surface);
}

.mention-dd-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.mention-dd-email {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ── Page Link Chip ─────────────────────────────────────── */
.page-link-chip {
    display: inline;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    border-radius: 3px;
    padding: 1px 4px;
    font-size: inherit;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.page-link-chip:hover {
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    text-decoration: underline;
}

/* ── Page Link Autocomplete Dropdown ────────────────────── */
.page-link-dropdown {
    position: absolute;
    z-index: 1200;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 200px;
    max-width: 300px;
    max-height: 260px;
    overflow-y: auto;
}
.page-link-dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.1s;
}
.page-link-dropdown-item:hover,
.page-link-dropdown-item.selected {
    background: var(--surface);
}

/* ── Share List ───────────────────────────────────────────── */
.share-restrict-toggle {
    padding: 0.5rem 0;
}

.share-add-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0;
}

.share-add-row .modal-select {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

.share-list {
    padding: 0.25rem 0;
}

.share-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border);
}

.share-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.share-list-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.share-list-email {
    font-size: 0.75rem;
    color: var(--muted);
}

.share-list-perm {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.4rem;
    background: var(--surface);
    border-radius: 3px;
}

/* Restricted badge on tree items */
.restricted-badge {
    font-size: 0.7rem;
    color: var(--muted);
    flex-shrink: 0;
}

/* ── Space Touch Targets ─────────────────────────────────────────── */

body[data-ui-mode="touch"] .space-tree-item {
    min-height: 44px;
    padding: 0.5rem 0.5rem;
    font-size: 0.95rem;
}

body[data-ui-mode="touch"] .space-tree-item .tree-menu-btn {
    opacity: 1;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

body[data-ui-mode="touch"] .tree-chevron {
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

body[data-ui-mode="touch"] .space-sidebar-actions .btn {
    min-height: 44px;
    font-size: 0.95rem;
}

body[data-ui-mode="touch"] .space-context-menu {
    min-width: 200px;
}

body[data-ui-mode="touch"] .space-context-item {
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
}

body[data-ui-mode="touch"] .space-page-tree {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ── Space Mobile Responsive ─────────────────────────────────────── */

@media (max-width: 768px) {
    .space-shell .burger-btn {
        display: flex;
    }

    .space-sidebar {
        display: none;
        position: fixed;
        top: var(--touch-topbar-h);
        left: 0;
        bottom: 0;
        z-index: 200;
        width: min(88vw, 340px);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .space-sidebar.mobile-visible {
        display: flex;
    }

    body.space-shell[data-ui-mode="touch"][data-nav-open="true"] .space-sidebar {
        display: flex;
    }

    body.space-shell[data-ui-mode="touch"][data-nav-open="true"] .sidebar-overlay {
        display: block;
    }

    .space-breadcrumbs {
        padding: 0.5rem 1rem;
    }

    .space-page-header {
        padding: 0 1rem;
    }

    .space-editor-wrap {
        padding: 0 1rem 1rem;
    }

    .space-page-title-input,
    .space-page-title-readonly {
        font-size: 1.35rem;
    }

    .space-content {
        width: 100%;
    }

    /* Space modals: full-width on mobile */
    .space-shell .modal-card {
        width: min(95vw, 600px) !important;
        max-height: 85vh !important;
    }

    .space-comment-input-wrap {
        flex-direction: column;
    }

    .space-comment-input-wrap textarea {
        width: 100%;
    }

    .space-comment-input-wrap .btn {
        align-self: flex-end;
    }

    /* Notification panel: fixed position on mobile so it doesn't overflow */
    .space-shell .notif-panel {
        position: fixed;
        top: calc(var(--touch-topbar-h) + 4px);
        right: 8px;
        left: 8px;
        width: auto;
        max-height: calc(100vh - var(--touch-topbar-h) - 16px);
        z-index: 1100;
    }
}

/* Tablet breakpoint for space sidebar */
@media (min-width: 769px) and (max-width: 1024px) {
    .space-sidebar {
        width: 220px;
        min-width: 200px;
    }
}

/* ── Space Comments ──────────────────────────────────────────────── */

.space-comment-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.space-comment-item.resolved {
    opacity: 0.6;
}

.space-comment-item.resolved .space-comment-body {
    text-decoration: line-through;
    color: var(--muted);
}

.space-comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.space-comment-time {
    color: var(--muted);
    font-size: 0.78rem;
}

.space-comment-body {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.space-comment-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.space-comment-reply {
    margin-left: 24px;
}

.space-comment-input-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.space-comment-input-wrap textarea {
    flex: 1;
    resize: vertical;
    min-height: 2.5rem;
}

/* ── Space Export ─────────────────────────────────────────────────── */

.space-export-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 1rem 0;
}

/* ── Space Presence ──────────────────────────────────────────────── */

.space-presence {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 0.5rem;
}

.space-presence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: default;
    border: 1.5px solid var(--bg);
    flex-shrink: 0;
}

/* ── Space Settings Page ────────────────────────────────────── */

.settings-page {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.settings-tab {
    padding: 0.625rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
}

.settings-tab:hover {
    color: var(--text);
}

.settings-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.form-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.8125rem;
    font-family: inherit;
}

.form-select-small {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
}

.form-hint {
    color: var(--muted);
    font-size: 0.8125rem;
}

.settings-save-status {
    margin-left: 0.75rem;
    font-size: 0.8125rem;
    color: var(--muted);
}

.settings-save-status.success {
    color: #22c55e;
}

.settings-save-status.error {
    color: #ef4444;
}

.settings-section-divider {
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.settings-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--text);
}

.settings-add-member {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.settings-add-member .form-input {
    flex: 1;
}

/* ── Member Rows ────────────────────────────────────────────── */

.member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.member-row:last-child {
    border-bottom: none;
}

.member-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.member-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-email {
    font-size: 0.75rem;
    color: var(--muted);
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.role-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-owner {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

/* ── Danger Zone ────────────────────────────────────────────── */

.danger-zone {
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 1.25rem;
}

.danger-zone h3 {
    color: #ef4444;
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.danger-zone p {
    color: var(--muted);
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

/* ── Analytics ──────────────────────────────────────────────── */

.analytics-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.analytics-stat-card {
    background: var(--sidebar-bg, var(--bg));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.analytics-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.analytics-stat-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analytics-top-pages {
    margin-top: 0.75rem;
}

.analytics-page-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.analytics-page-row:last-child {
    border-bottom: none;
}

.analytics-page-rank {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 2rem;
}

.analytics-page-title {
    flex: 1;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analytics-page-title:hover {
    color: var(--accent);
}

.analytics-page-views {
    color: var(--muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ── Settings responsive ────────────────────────────────────── */

@media (max-width: 600px) {
    .settings-page {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .settings-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .settings-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }

    .settings-add-member {
        flex-wrap: wrap;
    }

    .analytics-stats {
        grid-template-columns: 1fr;
    }

    .member-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ── Embed Cards ────────────────────────────────────────────── */

.embed-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    margin: 0.75rem 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    background: var(--card-bg, var(--bg-secondary));
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    cursor: pointer;
}

.embed-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.embed-card-image {
    width: 120px;
    min-height: 80px;
    object-fit: cover;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
}

.embed-card-body {
    padding: 0.75rem 1rem;
    min-width: 0;
    flex: 1;
}

.embed-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.embed-card-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.embed-card-domain {
    font-size: 0.75rem;
    color: var(--accent);
    opacity: 0.8;
}

.embed-card-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    background: var(--bg-secondary);
    color: var(--muted);
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.embed-card:hover .embed-card-remove,
.page-embed-card:hover .embed-card-remove {
    opacity: 1;
}

.embed-card-remove:hover {
    color: var(--danger);
}

/* ── Page Embed Card ────────────────────────────────────────── */

.page-embed-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--card-bg, var(--bg-secondary));
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    cursor: pointer;
}

.page-embed-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.page-embed-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.page-embed-body {
    min-width: 0;
    flex: 1;
}

.page-embed-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.page-embed-preview {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Embed Preview Button ───────────────────────────────────── */

.embed-preview-btn {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--accent);
    cursor: pointer;
    z-index: 10;
    transition: background 0.15s, border-color 0.15s;
}

.embed-preview-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Import Modal ───────────────────────────────────────────── */

.import-modal-content {
    margin: 1rem 0;
}

.import-file-section {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.import-divider {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0.75rem 0;
    position: relative;
}

.import-divider::before,
.import-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 1rem);
    height: 1px;
    background: var(--border);
}

.import-divider::before { left: 0; }
.import-divider::after { right: 0; }

/* ── Embed responsive ──────────────────────────────────────── */

@media (max-width: 600px) {
    .embed-card {
        flex-direction: column;
    }

    .embed-card-image {
        width: 100%;
        max-height: 120px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

/* ── Callout Blocks ──────────────────────────────────────── */

.callout-block {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    margin: 0.75rem 0;
    border-left: 4px solid;
    position: relative;
}

.callout-info {
    background: rgba(59, 130, 246, 0.08);
    border-left-color: #3b82f6;
}

.callout-warning {
    background: rgba(234, 179, 8, 0.08);
    border-left-color: #eab308;
}

.callout-success {
    background: rgba(34, 197, 94, 0.08);
    border-left-color: #22c55e;
}

.callout-error {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: #ef4444;
}

.callout-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1.5;
}

.callout-text {
    flex: 1;
    min-width: 0;
    margin: 0;
    outline: none;
    line-height: 1.5;
    color: var(--text);
}

.callout-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 2px 6px;
}

.callout-block:hover .callout-remove {
    opacity: 1;
}

.callout-remove:hover {
    color: var(--danger);
}

/* ── Resizable Image Styles ──────────────────────────────── */

.ql-image-wrapper {
    position: relative;
    margin: 12px 0;
    line-height: 0;
    user-select: none;
}

.ql-image-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.ql-image-wrapper[data-align="center"] { text-align: center; }
.ql-image-wrapper[data-align="center"] img { margin: 0 auto; }
.ql-image-wrapper[data-align="right"] { text-align: right; }
.ql-image-wrapper[data-align="right"] img { margin-left: auto; }

.ql-image-wrapper .resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent, #3b82f6);
    border: 2px solid var(--bg-card, #fff);
    border-radius: 2px;
    z-index: 50;
    display: none;
    box-sizing: border-box;
}

.ql-image-wrapper.selected .resize-handle { display: block; }

.ql-image-wrapper .resize-handle.nw { top: 2px; left: 2px; cursor: nw-resize; }
.ql-image-wrapper .resize-handle.ne { top: 2px; right: 2px; cursor: ne-resize; }
.ql-image-wrapper .resize-handle.sw { bottom: 2px; left: 2px; cursor: sw-resize; }
.ql-image-wrapper .resize-handle.se { bottom: 2px; right: 2px; cursor: se-resize; }

.ql-image-wrapper.selected {
    outline: 2px solid var(--accent, #3b82f6);
    outline-offset: 2px;
    border-radius: 4px;
}

.image-toolbar {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--bg-card, #1e2128);
    border: 1px solid var(--border, #2a2e37);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    z-index: 1000;
    white-space: nowrap;
}

.image-toolbar button {
    background: none;
    border: none;
    color: var(--text-secondary, #9ca3af);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.image-toolbar button:hover { background: var(--bg-hover, #2a2e37); color: var(--text, #e5e7eb); }
.image-toolbar button.active { background: var(--accent, #3b82f6); color: #fff; }

.image-toolbar-sep {
    width: 1px;
    height: 16px;
    background: var(--border, #2a2e37);
    margin: 0 2px;
}

.image-toolbar-delete:hover { color: var(--danger, #ef4444) !important; background: rgba(239, 68, 68, 0.1) !important; }

/* ── Checklist Styles ────────────────────────────────────── */

.ql-editor li[data-list="checked"],
.ql-editor li[data-list="unchecked"] {
    list-style-type: none;
    position: relative;
    padding-left: 1.5rem;
}

.ql-editor li[data-list="checked"]::before,
.ql-editor li[data-list="unchecked"]::before {
    display: inline-block;
    width: 1.1rem;
    height: 1.1rem;
    margin-left: -1.5rem;
    margin-right: 0.4rem;
    vertical-align: middle;
    border: 2px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    content: '';
    position: relative;
    top: -1px;
}

.ql-editor li[data-list="checked"]::before {
    background: var(--primary, #3b82f6);
    border-color: var(--primary, #3b82f6);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-size: 80%;
    background-position: center;
    background-repeat: no-repeat;
}

.ql-editor li[data-list="checked"] {
    color: var(--muted);
    text-decoration: line-through;
}

/* ── Table Styles ────────────────────────────────────────── */

.ql-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75rem 0;
}

.ql-editor td,
.ql-editor th {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    min-width: 80px;
    vertical-align: top;
}

.ql-editor th {
    background: var(--surface, rgba(255,255,255,0.03));
    font-weight: 600;
}

.ql-editor td:focus,
.ql-editor th:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: -2px;
}

/* ── Slash Command Dropdown ──────────────────────────────── */

.slash-command-dropdown {
    position: fixed;
    z-index: 9999;
    background: var(--card-bg, #1e2128);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-height: 300px;
    overflow-y: auto;
    min-width: 200px;
    padding: 4px;
}

.slash-command-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text);
    transition: background 0.1s;
}

.slash-command-item:hover,
.slash-command-item.selected {
    background: var(--hover-bg, rgba(255,255,255,0.06));
}

.slash-command-icon {
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.slash-command-label {
    flex: 1;
}

/* ── Tags ────────────────────────────────────────────────── */

.space-page-tags {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0 0.5rem 0;
}

.space-tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.space-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: var(--hover-bg, rgba(255,255,255,0.06));
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
}

.space-tag-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.space-tag-remove:hover {
    opacity: 1;
    color: var(--danger);
}

.space-tag-input {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.8rem;
    outline: none;
    width: 100%;
    padding: 0.15rem 0;
}

.space-tag-input::placeholder {
    color: var(--muted);
    opacity: 0.6;
}

/* ── Toast ───────────────────────────────────────────────── */

.space-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    background: var(--card-bg, #1e2128);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.space-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.space-toast-info { border-left: 3px solid var(--primary, #3b82f6); }
.space-toast-error { border-left: 3px solid var(--danger, #ef4444); }
.space-toast-success { border-left: 3px solid #22c55e; }

/* ── Trash Modal ─────────────────────────────────────────── */

.trash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

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

.trash-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}

.trash-item-title {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trash-item-date {
    font-size: 0.75rem;
    color: var(--muted);
}

.trash-item-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* ── Pin Workspace Button ────────────────────────────────── */

.pin-workspace-btn {
    opacity: 0.3;
    transition: opacity 0.15s;
    font-size: 0.7rem;
    padding: 2px 4px;
}

.pin-workspace-btn.pinned {
    opacity: 0.8;
}

.workspace-item:hover .pin-workspace-btn {
    opacity: 0.7;
}

.pin-workspace-btn:hover {
    opacity: 1 !important;
}

/* ── Divider / Horizontal Rule ───────────────────────────── */

.ql-editor hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 1rem 0;
}
