/* ═══════════════════════════════════════════════════
   LucID — Bespoke 2026 Modern Design System & Layout
   Inspired by Matte Metallic Surfaces & Gold Accents
   ═══════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════
   DESIGN TOKENS — single source of truth
   Colour model: oklch only (perceptually uniform, so
   tints/shades and dark↔light pairs derive systematically).
   No rgba, no scattered hex. Every colour is named once
   and referenced by name via var(--token).
   ═══════════════════════════════════════════════════ */

/* ─── THEME-AGNOSTIC SCALES (never change per theme) ─── */
:root {
  /* Spacing ramp — relational rem, no raw px */
  --space-3xs: 0.125rem;   /* 2px  */
  --space-2xs: 0.25rem;    /* 4px  */
  --space-xs:  0.375rem;   /* 6px  */
  --space-sm:  0.5rem;     /* 8px  */
  --space-md:  0.75rem;    /* 12px */
  --space-lg:  1rem;       /* 16px */
  --space-xl:  1.5rem;     /* 24px */
  --space-2xl: 2rem;       /* 32px */
  --space-3xl: 3rem;       /* 48px */

  /* Corner radii */
  --radius-xs:    0.25rem;
  --radius-sm:    0.375rem;
  --radius-md:    0.5rem;
  --radius-lg:    0.75rem;
  --radius-xl:    1rem;
  --radius-pill:  62.5rem;
  --radius-round: 50%;

  /* Elevation ladder — one scale, no magic 9999/10000 */
  --z-raised:  10;
  --z-sticky:  100;
  --z-overlay: 1000;
  --z-modal:   2000;
  --z-toast:   3000;

  /* Motion tokens */
  --motion-fast: 0.12s;
  --motion-base: 0.2s;
  --motion-slow: 0.35s;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Type scale (rem) */
  --text-xs:   0.75rem;    /* 12px — badges, fine print */
  --text-sm:   0.8125rem;  /* 13px — UI text */
  --text-base: 0.9375rem;  /* 15px — body / editor / preview */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.375rem;   /* 22px */
  --text-2xl:  1.75rem;    /* 28px */
  --text-3xl:  2.25rem;    /* 36px */

  /* Hairline width */
  --hairline: 0.0625rem; /* 1px */
}

/* ─── THEME: Dusk Ember (dark) — also the :root default ─── */
:root,
[data-theme="dusk-ember"] {
  color-scheme: dark;

  --bg-base:      oklch(0.239 0.014 267);
  --bg-surface:   oklch(0.277 0.019 268);
  --bg-elevated:  oklch(0.321 0.025 266);
  --bg-input:     oklch(0.212 0.013 267);            /* was referenced but undefined */
  --bg-hover:     oklch(0.773 0.140 78.6 / 0.12);
  --bg-active:    oklch(0.773 0.140 78.6 / 0.20);
  --surface-hover: oklch(0.321 0.025 266);           /* was referenced but undefined */

  --accent:        oklch(0.773 0.140 78.6);
  --accent-hover:  oklch(0.718 0.138 76.7);
  --accent-subtle: oklch(0.773 0.140 78.6 / 0.15);
  --on-accent:     oklch(0.239 0.014 267);           /* readable text ON accent */

  --text-primary:   oklch(0.967 0.006 264);
  --text-secondary: oklch(0.800 0.006 264);
  --text-muted:     oklch(0.690 0.006 264);          /* AA on base AND elevated surfaces */

  --border:        oklch(0.967 0.006 264 / 0.10);
  --border-hover:  oklch(0.967 0.006 264 / 0.20);
  --highlight:     oklch(1 0 0 / 0.05);
  --shadow:        0 0.25rem 1rem oklch(0 0 0 / 0.35);
  --shadow-sm:     0 0.0625rem 0.1875rem oklch(0 0 0 / 0.25);
  --shadow-md:     0 0.125rem 0.5rem oklch(0 0 0 / 0.28);
  --shadow-lg:     0 0.5rem 1.5rem oklch(0 0 0 / 0.40);
  --scrim:         oklch(0 0 0 / 0.65);
  --accent-glow:   oklch(0.773 0.140 78.6 / 0.45);
  --on-danger:     oklch(0.220 0.020 25);            /* dark label — the dark-theme danger is a LIGHT coral */

  /* State feedback — belongs to the theme, not raw red/green.
     Positive == the theme accent; negative == the theme danger hue. */
  --danger:        oklch(0.710 0.160 22.8);
  --save-ok:       var(--accent);
  --success:       var(--accent);                    /* "matched / ready" reads on-brand */
  --success-glow:  oklch(0.773 0.140 78.6 / 0.32);
  --danger-glow:   oklch(0.710 0.160 22.8 / 0.28);
  --danger-subtle: oklch(0.710 0.160 22.8 / 0.12);

  --scrollbar-track: var(--bg-base);
  --scrollbar-thumb: var(--bg-elevated);
}

/* ─── THEME: Warm Linen (light) ─── */
[data-theme="warm-linen"] {
  color-scheme: light;

  --bg-base:      oklch(0.976 0.026 92.4);
  --bg-surface:   oklch(0.949 0.030 92.3);
  --bg-elevated:  oklch(0.951 0.040 88.2);
  --bg-input:     oklch(0.985 0.018 92.4);
  --bg-hover:     oklch(0.747 0.046 83.8 / 0.15);
  --bg-active:    oklch(0.747 0.046 83.8 / 0.22);
  --surface-hover: oklch(0.951 0.040 88.2);

  --accent:        oklch(0.643 0.055 81.4);
  --accent-hover:  oklch(0.579 0.053 81.1);
  --accent-subtle: oklch(0.643 0.055 81.4 / 0.15);
  --on-accent:     oklch(0.200 0.015 84.5);          /* dark text ON accent — AA on the muted-brown accent */

  --text-primary:   oklch(0.267 0.019 84.5);
  --text-secondary: oklch(0.420 0.017 84.5);
  --text-muted:     oklch(0.500 0.015 84.5);         /* darkened to pass AA (was 2.66:1) */

  --border:        oklch(0.267 0.019 84.5 / 0.12);
  --border-hover:  oklch(0.267 0.019 84.5 / 0.24);
  --highlight:     oklch(1 0 0 / 0.5);
  --shadow:        0 0.125rem 0.5rem oklch(0 0 0 / 0.06);
  --shadow-sm:     0 0.0625rem 0.1875rem oklch(0 0 0 / 0.08);
  --shadow-md:     0 0.125rem 0.5rem oklch(0 0 0 / 0.10);
  --shadow-lg:     0 0.5rem 1.5rem oklch(0 0 0 / 0.16);
  --scrim:         oklch(0 0 0 / 0.45);
  --accent-glow:   oklch(0.643 0.055 81.4 / 0.45);
  --on-danger:     oklch(0.985 0.005 92);

  --danger:        oklch(0.543 0.174 29.7);
  --save-ok:       var(--accent);
  --success:       var(--accent);
  --success-glow:  oklch(0.643 0.055 81.4 / 0.35);
  --danger-glow:   oklch(0.543 0.174 29.7 / 0.28);
  --danger-subtle: oklch(0.543 0.174 29.7 / 0.12);

  --scrollbar-track: var(--bg-base);
  --scrollbar-thumb: oklch(0.862 0.038 83.0);
}

/* ─── RESETS & BASE ────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  height: 100%;
  width: 100%;
}

body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background var(--motion-base) ease, color var(--motion-base) ease;
}

.icon-svg {
  width: 1.125rem;
  height: 1.125rem;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

@keyframes iconSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.icon-spin {
  animation: iconSpin 1.1s linear infinite;
}

::selection {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

/* ─── 100% PERFECT THEME-ADAPTIVE SCROLLBARS ─────── */
::-webkit-scrollbar {
  width: 0.375rem;
  height: 0.375rem;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

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

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

/* ─── 3-PANE CONTAINER ──────────────────────────── */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg-base);
}

/* ─── SIDEBAR RESIZERS ──────────────────────────── */
.sidebar-resizer {
  width: 0.25rem;
  background: transparent;
  cursor: col-resize;
  flex-shrink: 0;
  z-index: var(--z-raised);
  transition: background var(--motion-fast);
}
.sidebar-resizer:hover,
.sidebar-resizer.resizing {
  background: var(--accent);
}

/* ─── TOP BAR (3.25rem) ─────────────────────────── */
.brand-header,
.top-bar {
  height: 3.25rem;
  min-height: 3.25rem;
  max-height: 3.25rem;
  padding: 0 var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--hairline) solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.brand-header {
  /* No dividing borders — the header blends into the sidebar as one continuous
     surface, the same way the footer does. (Panel/center separation is the
     resizer.) Horizontal inset matches the body/footer so edges line up. */
  border-bottom: none;
  border-right: none;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.top-bar {
  /* Center column is one continuous surface: the top-bar shares the editor's
     background and drops the dividing line, so only the view-tabs pill reads
     as a floating control — matching how the sidebar header blends. */
  background: var(--bg-base);
  border-bottom: none;
}

.brand-logo {
  display: flex;
  align-items: center;
}
.brand-logo-img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
  min-width: 0;
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

/* DOCKED EXPAND SIDEBAR BUTTON IN TOP BAR */
.docked-expand-btn {
  margin-right: var(--space-2xs);
  /* offset the icon button's own left padding so the glyph optically aligns
     with the editor content inset, not sitting 6px to its right */
  margin-left: calc(-1 * var(--space-xs));
}
.docked-expand-btn.hidden { display: none; }

/* right-side mirror: glyph optically aligns to the inspector edge */
.docked-expand-btn.dock-right {
  margin-left: var(--space-2xs);
  margin-right: calc(-1 * var(--space-xs));
}

/* UN-CRAMPED VIEW MODE TABS (NO SUFFOCATING BORDERS) */
.view-tabs {
  display: flex;
  background: var(--bg-surface);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xs) var(--space-sm);
  gap: var(--space-sm);
}
.view-tab {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  border: var(--hairline) solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  transition: color var(--motion-base) var(--ease-standard),
              background var(--motion-base) var(--ease-standard),
              box-shadow var(--motion-base) var(--ease-standard);
  white-space: nowrap;
}
.view-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.view-tab.active {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: transparent;
  box-shadow: var(--shadow-md);
  font-weight: 600;
}

/* ICON BUTTONS (ANIMATES ICON ITSELF — NO HARSH HOVER BACKGROUND BOX) */
.icon-btn,
.theme-glow-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  opacity: 0.75;
  transition: transform var(--motion-base) ease, opacity var(--motion-base) ease, filter var(--motion-base) ease, color var(--motion-base) ease;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover,
.theme-glow-btn:hover {
  opacity: 1;
  background: transparent;
  transform: translateY(-0.125rem) scale(1.15);
  color: var(--accent);
}
.theme-glow-btn {
  color: var(--accent);
  filter: drop-shadow(0 0 0.5rem var(--accent-glow));
}
/* When the inspector is open the theme toggle is the rightmost control, so
   offset its own right padding to land the glyph on the 32px content edge —
   mirroring how the left view-tabs sit flush at 32px. When the inspector is
   collapsed the expand chevron follows it (not .hidden) and owns that edge. */
.top-bar-right #btn-theme-toggle:has(+ .docked-expand-btn.hidden) {
  margin-right: calc(-1 * var(--space-xs));
}

/* ─── SIDEBARS ──────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  transition: width var(--motion-fast) ease, opacity var(--motion-base) ease;
  background: var(--bg-surface);
}

.left-pane {
  width: var(--left-w, 20rem);   /* default shows labels with comfortable margin */
  min-width: 13rem;      /* toolbar goes icon-only before this, so nothing clips */
  max-width: 30rem;
  flex-shrink: 0;
  container-type: inline-size;   /* enables the icon-only container query below */
}

.right-pane {
  width: var(--right-w, 16rem);
  min-width: 12rem;
  max-width: 25rem;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
}

/* Inspector header — same 3.25rem band as the top-bar/brand-header so the
   collapse button lines up with the top-bar controls. Button sits at the
   left edge, adjacent to the center divider (mirror of the left panel). */
.inspector-header {
  height: 3.25rem;
  min-height: 3.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
}
.inspector-collapse-btn {
  /* offset the icon button's own padding so the glyph optically aligns with
     the inspector body's content column below it */
  margin-left: calc(-1 * var(--space-2xs));
}
.inspector-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--space-lg) var(--space-lg);
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: none;
  opacity: 0;
  pointer-events: none;
}

/* ─── LEFT SIDEBAR BODY & STREAMLINED EXPLORER TOOLBAR ─ */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.875rem var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ─── EXPLORER TOOLBAR: ICON-ONLY WHEN NARROW ───── */
/* The labeled toolbar needs ~18.9rem of sidebar to fit. Below 19.5rem we drop
   the Folders/Tags text (icon-only) so the actions pill can never clip —
   no dead zone at any width. Container query on .left-pane. */
@container (max-width: 19.5rem) {
  .pill-label { display: none; }
  .explorer-pill-btn { padding: 0 var(--space-xs); }
  /* higher specificity so these beat the later base rules */
  .explorer-actions-pill .action-pill-btn { width: 1.5rem; }
  .toolbar-cluster.toolbar-cluster { gap: var(--space-xs); }
}

/* ─── INLINE SEARCH THAT MORPHS OVER THE TOOLBAR ─── */
.toolbar-cluster {
  position: relative;   /* the search overlay fills this exact box */
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}
.explorer-search {
  position: absolute;
  inset: 0;   /* 1:1 with the pills' combined box (width AND height) at any panel size */
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 var(--space-sm);
  background: var(--bg-surface);
  border: var(--hairline) solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 0.125rem var(--accent-subtle);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.98);
  transition: opacity var(--motion-base) var(--ease-standard),
              transform var(--motion-base) var(--ease-standard),
              visibility var(--motion-base) var(--ease-standard);
}
.explorer-search .search-lead {
  flex-shrink: 0;
  color: var(--text-muted);
}
.explorer-search .search-input {
  flex: 1;
  min-width: 0;
  width: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: var(--space-2xs) 0;
  font-size: 0.8125rem;
  color: var(--text-primary);
  outline: none;
}
.search-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.search-close:hover {
  color: var(--accent);
  background: var(--bg-hover);
}

/* Morph: pills give way to the search field */
.explorer-mode-pill,
.explorer-actions-pill {
  transition: opacity var(--motion-base) var(--ease-standard);
}
.tree-header-row.searching .explorer-mode-pill,
.tree-header-row.searching .explorer-actions-pill {
  opacity: 0;
  pointer-events: none;
}
.tree-header-row.searching .explorer-search {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* EXPLORER STREAMLINED TOOLBAR ROW (ANCHORED SIDE-BY-SIDE WITH FIXED GAP) */
.tree-header-row {
  position: relative;   /* positioning context for the inline search overlay */
  display: flex;
  align-items: center;
  justify-content: flex-start;   /* both pills anchored left so they DON'T slide when the sidebar resizes */
  padding: var(--space-2xs) 0;
  gap: var(--space-sm);
  flex-wrap: nowrap;
  width: 100%;
  overflow: hidden;
}

.explorer-mode-pill {
  display: flex;
  align-items: center;
  flex: 0 0 auto; /* FIXED: Prevent Folders / Tags from stretching when sidebar expands */
  height: 2.25rem;
  background: var(--bg-surface);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xs);
  gap: var(--space-2xs);
}

.explorer-pill-btn {
  flex: 0 0 auto; /* FIXED: Compact non-stretching width */
  height: 100%;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-md);
  border: var(--hairline) solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: color var(--motion-base) ease, background var(--motion-base) ease, border-color var(--motion-base) ease;
}
.explorer-pill-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.explorer-pill-btn.active {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.explorer-actions-pill {
  display: flex;
  align-items: center;
  flex: 0 0 auto; /* FIXED: Keep action buttons fixed and visible */
  height: 2.25rem;
  background: var(--bg-surface);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xs);
  gap: var(--space-3xs);
}

/* FIXED CONFINEMENT & ALIGNMENT FOR ACTION PILL BUTTONS */
.action-pill-btn {
  height: 100%;
  width: 1.875rem;
  padding: 0;
  margin: 0;
  border-radius: var(--radius-md);
  border: var(--hairline) solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: none; /* PREVENT translateY(-2px) MISALIGNMENT */
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease;
}
.action-pill-btn:hover {
  transform: none; /* KEEP OUTER HOVER BOX STRICTLY FLUSH AND ALIGNED */
  color: var(--accent);
  background: var(--bg-hover);
  opacity: 1;
}
.action-pill-btn:hover .icon-svg {
  transform: scale(1.15); /* SCALE ICON ITSELF SMOOTHLY WITHOUT SHIFTING OUTER CONFINEMENT BOX */
  transition: transform var(--motion-fast) ease;
}

/* ─── FOLDER & NOTE TREE HIERARCHY INDENTATION & SPACING ──── */
.folder-tree, .tag-tree {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.folder-tree.hidden, .tag-tree.hidden {
  display: none;
}

.tree-folder-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background var(--motion-fast), color var(--motion-fast);
  position: relative;
}
.tree-folder-header:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
/* Containing folder of the open note: emphasised (brighter text+icon), NOT a selection chip.
   Emphasis is via text-primary only — accent isn't used here because its lightness
   relative to the default icon flips between themes and would invert the hierarchy. */
.tree-folder-header.active {
  color: var(--text-primary);
}
/* Disclosure chevron — rotates when the folder/tag is open */
.tree-caret {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--motion-base) var(--ease-standard);
}
.tree-folder-header.open .tree-caret {
  transform: rotate(90deg);
}
.tree-folder-header .count-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-base);
  padding: var(--space-3xs) var(--space-xs);
  border-radius: var(--radius-xl);
}

/* GENEROUS PROPER SPACING BETWEEN HEADER AND FIRST NESTED NOTE UNDERNEATH */
.tree-notes {
  margin-left: var(--space-lg);
  margin-top: var(--space-xs);
  padding-left: var(--space-sm);
  padding-top: var(--space-2xs);
  border-left: var(--hairline) solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  overflow: hidden;
  transition: max-height var(--motion-slow) ease;
}
.tree-notes.collapsed { max-height: 0; margin-top: 0; padding-top: 0; }

.tree-note {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: background var(--motion-fast), color var(--motion-fast);
}
.tree-note:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
/* The ONE open note: clean filled selection + readable bold text */
.tree-note.active {
  background: var(--bg-active);
  color: var(--text-primary);
  font-weight: 600;
}

/* Keyboard focus ring for tree navigation (arrow keys / Tab) */
.tree-folder-header:focus-visible,
.tree-note:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: -0.125rem;
}

/* A-01: keyboard focus must be visible on every interactive control, not just
   tree items. :focus-visible means mouse users never see a ring — only keyboard
   users do. Matches the accent outline already used by the tree. */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: 0.125rem;
  border-radius: var(--radius-sm);
}

/* ─── RIGHT-CLICK TREE CONTEXT MENU ─────────────── */
.context-menu {
  position: fixed;
  z-index: var(--z-overlay);
  background: var(--bg-elevated);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-xs);
  min-width: 11rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}
.context-menu.hidden { display: none; }

.context-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background var(--motion-fast);
}
.context-menu-item:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.context-menu-item.danger:hover {
  background: var(--danger-subtle);
  color: var(--danger);
}
.context-menu-divider {
  height: var(--hairline);
  background: var(--border);
  margin: var(--space-2xs) 0;
}

/* ─── SIDEBAR FOOTER, E2EE, SYNC BADGE & LOCK ACTION ─── */
.sidebar-footer {
  padding: var(--space-md);
  margin-top: auto;
  border-top: none;
  background: var(--bg-surface);
}

.e2ee-card {
  padding: 0.625rem var(--space-md);
  border-radius: 0.625rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
.e2ee-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}
/* auto-lock timeout picker, top-right of the footer card */
.autolock-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}
.autolock-btn:hover { color: var(--accent); background: var(--surface-hover); }
.autolock-btn svg { width: 0.9375rem; height: 0.9375rem; }
.menu-icon-blank { display: inline-block; width: 0.875rem; height: 0.875rem; }
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-round);
  background: var(--danger);
  flex-shrink: 0;
}
.status-dot.active {
  background: var(--save-ok);
  box-shadow: 0 0 0.375rem var(--save-ok);
}

.footer-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-2xs);
  border-top: none;
}

/* Status text is present for assistive technology but not painted: the glyph
   carries the state visually, the tooltip carries the detail. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Sync and runtime read as one control family with the repository link beside
   them: same box, same hover, same accent. */
.sync-status-badge,
.runtime-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}
.sync-status-badge:hover,
.runtime-badge:hover {
  color: var(--accent);
  background-color: var(--surface-hover);
}
.sync-status-badge.saving {
  color: var(--accent);
  animation: pulse-sync 1.2s infinite var(--ease-standard);
}
.sync-status-badge.error,
.runtime-badge.error {
  color: var(--danger);
}
@keyframes pulse-sync {
  0%   { opacity: 1; }
  50%  { opacity: 0.45; }
  100% { opacity: 1; }
}

.lock-action-btn {
  font-size: 0.75rem;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-sm);
  border: var(--hairline) solid var(--border);
  background: var(--bg-base);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
.lock-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── CENTER PANE & 100% AUTO-FIT EDITOR ─────────── */
.center-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
}

/* 100% AUTO-FIT EDITOR/PREVIEW CONTAINER */
.editor-split {
  flex: 1 1 100%;
  height: calc(100% - 3.25rem);
  width: 100%;
  display: flex;
  overflow: hidden;
  min-height: 0;
  background: var(--bg-base);
}

/* MODE 1: EDITOR ONLY */
.editor-split.mode-editor .editor-pane {
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  display: flex;
}
.editor-split.mode-editor .preview-pane,
.editor-split.mode-editor .split-handle {
  display: none;
}

/* MODE 2: PREVIEW ONLY */
.editor-split.mode-preview .preview-pane {
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  display: flex;
}
.editor-split.mode-preview .editor-pane,
.editor-split.mode-preview .split-handle {
  display: none;
}

/* MODE 3A: SPLIT VIEW (Vertical / Top-Bottom) */
.editor-split.mode-split-vertical {
  flex-direction: column;
}
.editor-split.mode-split-vertical .editor-pane {
  flex: 0 0 var(--split-pct, 50%);
  width: 100%;
  min-height: 0;
  display: flex;
}
.editor-split.mode-split-vertical .preview-pane {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  display: flex;
}
.editor-split.mode-split-vertical .split-handle {
  height: 0.375rem;
  width: 100%;
  cursor: row-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  border-top: var(--hairline) solid var(--border);
  border-bottom: var(--hairline) solid var(--border);
  border-left: none;
  border-right: none;
  flex-shrink: 0;
}
.editor-split.mode-split-vertical .handle-line {
  width: 2.5rem;
  height: 0.1875rem;
  border-radius: 0.125rem;
  background: var(--border-hover);
}

/* MODE 3B: SPLIT VIEW (Horizontal / Side-by-Side Left-Right) */
.editor-split.mode-split-horizontal {
  flex-direction: row;
}
.editor-split.mode-split-horizontal .editor-pane {
  flex: 0 0 var(--split-pct, 50%);
  height: 100%;
  min-width: 0;
  display: flex;
}
.editor-split.mode-split-horizontal .preview-pane {
  flex: 1 1 0;
  height: 100%;
  min-width: 0;
  display: flex;
}
.editor-split.mode-split-horizontal .split-handle {
  width: 0.375rem;
  height: 100%;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  border-left: var(--hairline) solid var(--border);
  border-right: var(--hairline) solid var(--border);
  border-top: none;
  border-bottom: none;
  flex-shrink: 0;
}
.editor-split.mode-split-horizontal .handle-line {
  height: 2.5rem;
  width: 0.1875rem;
  border-radius: 0.125rem;
  background: var(--border-hover);
}

#markdown-textarea {
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: var(--space-xl) var(--space-2xl);
  background: var(--bg-base);
  color: var(--text-primary);
  border: none;
  outline: none;
  box-shadow: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: 1.6;
  box-sizing: border-box;
  overflow-y: auto;
  margin: 0;
}

.preview-content {
  flex: 1 1 100%;
  width: 100%;
  height: 100%;
  padding: var(--space-xl) var(--space-2xl);
  overflow-y: auto;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  box-sizing: border-box;
}

/* ─── RENDERED MARKDOWN (PREVIEW CONTENT) ──────────── */
.preview-content > *:first-child { margin-top: 0; }
.preview-content > *:last-child { margin-bottom: 0; }

.preview-content h1, .preview-content h2, .preview-content h3,
.preview-content h4, .preview-content h5, .preview-content h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  margin: var(--space-xl) 0 var(--space-md);
}
.preview-content h1 { font-size: var(--text-3xl); }
.preview-content h2 {
  font-size: var(--text-2xl);
  padding-bottom: var(--space-xs);
  border-bottom: var(--hairline) solid var(--border);
}
.preview-content h3 { font-size: var(--text-xl); }
.preview-content h4 { font-size: var(--text-lg); }
.preview-content h5 {
  font-size: var(--text-base);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.preview-content h6 { font-size: var(--text-sm); color: var(--text-muted); }

.preview-content p { margin: 0 0 var(--space-md); }

.preview-content ul, .preview-content ol {
  margin: 0 0 var(--space-md);
  padding-left: var(--space-xl);
}
.preview-content li { margin-bottom: var(--space-2xs); }
.preview-content li > ul, .preview-content li > ol { margin: var(--space-2xs) 0 0; }

.preview-content a { color: var(--accent); text-decoration: none; }
.preview-content a:hover { text-decoration: underline; }
.preview-content strong { font-weight: 700; color: var(--text-primary); }
.preview-content em { font-style: italic; }

.preview-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-elevated);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
}
.preview-content pre {
  background: var(--bg-elevated);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  overflow-x: auto;
  margin: 0 0 var(--space-md);
}
.preview-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.preview-content blockquote {
  margin: 0 0 var(--space-md);
  padding: var(--space-2xs) var(--space-lg);
  border-left: 0.1875rem solid var(--accent);
  color: var(--text-secondary);
}
.preview-content hr {
  border: none;
  border-top: var(--hairline) solid var(--border);
  margin: var(--space-xl) 0;
}

.preview-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 var(--space-md);
  font-size: var(--text-sm);
}
.preview-content th, .preview-content td {
  border: var(--hairline) solid var(--border);
  padding: var(--space-xs) var(--space-md);
  text-align: left;
}
.preview-content th { background: var(--bg-surface); font-weight: 600; }

.preview-content img { max-width: 100%; border-radius: var(--radius-md); }

/* Task-list checkboxes */
.preview-content input[type="checkbox"] { margin-right: var(--space-2xs); accent-color: var(--accent); }

/* ─── RIGHT INSPECTOR PANE & METRICS FORMATTING ─── */
.right-pane section {
  margin-bottom: var(--space-xl);
}
.tags-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.tags-header h6 { margin-bottom: 0; }
.right-pane h6 {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.btn-tag-add {
  font-size: var(--text-base);
  font-weight: 600;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-round);
  border: var(--hairline) solid var(--border);
  background: var(--bg-base);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--motion-fast);
}
.btn-tag-add:hover {
  background: var(--accent);
  color: var(--bg-base);
}

.toc-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.toc-item {
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast);
}
.toc-item:hover {
  color: var(--accent);
  background: var(--bg-hover);
}
.toc-item.toc-h2 { padding-left: var(--space-lg); }
.toc-item.toc-h3 { padding-left: var(--space-xl); font-size: var(--text-xs); }

.empty-state {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}
/* J-04: these replace hardcoded inline px styles previously injected from app.js */
.empty-state-pane {
  padding: var(--space-2xl);
  text-align: center;
  font-style: normal;
}
.empty-state-preview {
  padding: var(--space-lg);
}
/* S-05: a note that could not be decrypted — shown read-only, never editable */
.locked-note {
  padding: var(--space-lg);
  color: var(--danger);
  font-style: normal;
  line-height: 1.5;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.tag-chip {
  font-size: var(--text-xs);
  background: var(--accent-subtle);
  color: var(--accent);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-xl);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
}
.tag-del-btn {
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  opacity: 0.7;
}
.tag-del-btn:hover { opacity: 1; color: var(--danger); }

/* METRICS GRID SPACING */
.metrics-grid {
  display: grid;
  /* responsive: 3 across when wide, reflow to 2 then 1 as the pane narrows —
     cards never overflow/clip */
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  gap: var(--space-sm);
}
.metric {
  padding: var(--space-sm) var(--space-xs);
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--bg-elevated);
  border: var(--hairline) solid var(--border);
  box-shadow: var(--shadow-sm);
}
.metric strong {
  display: block;
  font-size: var(--text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1.2;
}
.metric small {
  display: block;
  margin-top: var(--space-2xs);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

/* ─── IN-APP MODALS ──────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--scrim);
  backdrop-filter: blur(0.25rem);
}
.modal-backdrop.hidden { display: none; }

.modal-card {
  width: min(90vw, 22rem);
  padding: var(--space-xl);
  background: var(--bg-surface);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-icon {
  margin-bottom: var(--space-md);
  color: var(--accent);
  display: flex;
  justify-content: center;
}
.modal-warning-svg, .modal-prompt-svg {
  width: 2.75rem;
  height: 2.75rem;
}

.modal-card h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}
.modal-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.4;
}

.modal-input {
  width: 100%;
  display: block;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-base);
  background: var(--bg-base);
  color: var(--text-primary);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  margin-bottom: var(--space-lg);
}
.modal-input:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-modal-secondary,
.btn-modal-primary,
.btn-modal-danger {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--motion-fast);
}

.btn-modal-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: var(--hairline) solid var(--border);
}
.btn-modal-secondary:hover {
  background: var(--bg-hover);
}

.btn-modal-primary {
  background: var(--accent);
  color: var(--bg-base);
  border: none;
}
.btn-modal-primary:hover {
  opacity: 0.9;
}

.btn-modal-danger {
  background: var(--danger);
  color: var(--on-danger);
  border: none;
}
.btn-modal-danger:hover {
  opacity: 0.9;
}

/* ─── MANDATORY E2EE LOCK SCREEN ────────────────── */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}
.lock-screen.hidden { display: none; }

.lock-card {
  width: min(90vw, 26rem);
  padding: var(--space-2xl);
  text-align: center;
  background: var(--bg-surface);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.lock-icon {
  margin-bottom: var(--space-lg);
  display: flex;
  justify-content: center;
}
.lock-logo-img {
  width: 9rem;
  height: 9rem;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
}
.lock-card h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2xs);
  color: var(--text-primary);
}
.lock-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}
.lock-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}
.lock-inputs-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  margin-bottom: var(--space-lg);
}
.lock-input {
  width: 100%;
  padding: var(--space-md);
  margin-bottom: 0;
  font-size: var(--text-base);
  font-family: var(--font-mono);
  background: var(--bg-input);
  color: var(--text-primary);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  text-align: center;
  letter-spacing: 0.125rem;
  transition: color var(--motion-base) ease, background var(--motion-base) ease, border-color var(--motion-base) ease;
}
.lock-input.hidden { display: none; }

/* "Vault locked" cue (unlock mode only) */
.lock-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  margin: 0 auto var(--space-md);
  padding: var(--space-3xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
}
.lock-status svg { width: 0.875rem; height: 0.875rem; color: var(--accent); }
.lock-status.hidden { display: none; }

/* Show/hide passphrase toggle */
.lock-input-wrap { position: relative; display: block; width: 100%; }
.lock-input-wrap .lock-input {
  padding-left: var(--space-2xl);
  padding-right: var(--space-2xl);
}
.lock-reveal {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--motion-fast) var(--ease-standard);
}
.lock-reveal:hover { color: var(--accent); }
.lock-reveal svg { width: 1.125rem; height: 1.125rem; }
.lock-reveal .icon-eye,
.lock-reveal .icon-eye-slash { display: inline-flex; align-items: center; }
.lock-reveal .icon-eye-slash { display: none; }
.lock-reveal.revealed .icon-eye { display: none; }
.lock-reveal.revealed .icon-eye-slash { display: inline-flex; }

/* Caps Lock heads-up */
.lock-capslock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-md);
}
.lock-capslock svg { width: 0.875rem; height: 0.875rem; }
.lock-capslock.hidden { display: none; }
.lock-input::placeholder {
  font-family: var(--font-sans);
  letter-spacing: normal;
  font-size: var(--text-sm);
  color: var(--text-muted);
  opacity: 0.7;
}
.lock-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.1875rem var(--accent-subtle);
}
/* matched = gold (the app's success/accent colour), by design */
.lock-input.is-matched {
  border-color: var(--success);
  box-shadow: 0 0 0 0.1875rem var(--success-glow);
  background: var(--accent-subtle);
}
.lock-input.is-mismatch {
  border-color: var(--danger);
  box-shadow: 0 0 0 0.1875rem var(--danger-glow);
  background: var(--danger-subtle);
}
.lock-error {
  font-size: var(--text-sm);
  color: var(--danger);
  margin-bottom: var(--space-md);
  font-weight: 500;
}
.lock-btn {
  width: 100%;
  display: block;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: var(--space-lg);
  transition: color var(--motion-base) ease, background var(--motion-base) ease, border-color var(--motion-base) ease;
}
.lock-btn:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-0.0625rem);
}
.lock-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.lock-btn.is-ready {
  background: var(--success);
  color: var(--on-accent);
  opacity: 1;
  cursor: pointer;
  box-shadow: 0 0.25rem 1rem var(--success-glow);
}
.lock-footer {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── FOOTER GITHUB / VERSION INDICATOR ───────────── */
/* lives in the left sidebar footer, grouped with sync + lock;
   uses the native title tooltip like its neighbours (no bespoke tooltip) */
.footer-status-cluster {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.footer-github-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}
.footer-github-link:hover {
  color: var(--accent);
  background-color: var(--surface-hover);
}
.footer-github-link.update-available {
  color: var(--accent);
  animation: pulse-update 2s infinite ease-in-out;
}
@keyframes pulse-update {
  0% { transform: scale(1); filter: drop-shadow(0 0 0.125rem var(--accent)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 0.375rem var(--accent)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0.125rem var(--accent)); }
}

/* Two indicators now signal state through motion. Users who have asked the OS
   to reduce motion keep the colour and glyph change and lose only the movement. */
@media (prefers-reduced-motion: reduce) {
  .footer-github-link.update-available,
  .sync-status-badge.saving,
  .icon-spin {
    animation: none;
  }
}

/* ─── RESPONSIVE BREAKPOINTS ─────────────────────── */
@media (max-width: 60rem) {
  .right-pane { display: none; }
  .sidebar-resizer { display: none; }
}
@media (max-width: 40rem) {
  .left-pane { width: 0; min-width: 0; overflow: hidden; border: none; }
}
