/* ============================================================
       VARIABLES CSS — Système de design complet
    ============================================================ */
:root {
  --accent-h: 252;
  --accent-s: 100%;
  --accent-l: 70%;
  --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
  --accent-dark: hsl(
    var(--accent-h),
    var(--accent-s),
    calc(var(--accent-l) - 12%)
  );
  --accent-light: hsl(
    var(--accent-h),
    var(--accent-s),
    calc(var(--accent-l) + 18%)
  );
  --accent-subtle: hsl(var(--accent-h), 60%, 96%);

  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f2f2f8;
  --surface-3: #eaeaf5;
  --border: #e4e4ef;
  --border-strong: #c8c8df;

  --text: #1a1a2e;
  --text-2: #4a4a6a;
  --text-3: #8888aa;
  --text-on-accent: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08);

  --font-size-base: 15px;
  --font-size-sm: 13px;
  --font-size-xs: 11px;
  --font-size-lg: 17px;
  --font-size-xl: 21px;
  --font-size-2xl: 26px;
  --font-size-3xl: 34px;

  --font-body: "Georgia", "Times New Roman", serif;
  --font-ui: "Trebuchet MS", "Helvetica Neue", sans-serif;
  --font-mono: "Courier New", monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 999px;

  --density-factor: 1;
  --spacing-xs: calc(4px * var(--density-factor));
  --spacing-sm: calc(8px * var(--density-factor));
  --spacing-md: calc(16px * var(--density-factor));
  --spacing-lg: calc(24px * var(--density-factor));
  --spacing-xl: calc(32px * var(--density-factor));

  --transition-fast: 120ms ease;
  --transition-base: 220ms ease;
  --transition-slow: 380ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  --sidebar-width: 260px;
  --topbar-height: 60px;
}

[data-theme="dark"] {
  --bg: #111118;
  --surface: #1c1c28;
  --surface-2: #24243a;
  --surface-3: #2e2e48;
  --border: #2e2e48;
  --border-strong: #42425e;
  --text: #e8e8f8;
  --text-2: #a0a0c8;
  --text-3: #5c5c88;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.6);
  --accent-subtle: hsl(var(--accent-h), 40%, 16%);
}

[data-animations="off"] *,
[data-animations="off"] *::before,
[data-animations="off"] *::after {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}

/* ============================================================
       RESET & BASE
    ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  transition:
    background var(--transition-base),
    color var(--transition-base);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

img,
svg {
  display: block;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ============================================================
       LAYOUT PRINCIPAL
    ============================================================ */
#app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 49;
  backdrop-filter: blur(2px);
}

/* ============================================================
       SIDEBAR
    ============================================================ */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    transform var(--transition-slow),
    width var(--transition-slow);
  z-index: 50;
}

#sidebar.collapsed {
  width: 0;
  border-right-width: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.logo-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
  font-family: var(--font-body);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-sm) 0;
}

.sidebar-section {
  margin-bottom: var(--spacing-sm);
}

.sidebar-section-title {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: var(--spacing-xs) var(--spacing-md);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: 0;
  color: var(--text-2);
  font-size: var(--font-size-sm);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  user-select: none;
}

.sidebar-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-item .icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item.active .icon {
  opacity: 1;
}

.sidebar-item-badge {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sidebar-item.active .sidebar-item-badge {
  background: var(--accent);
  color: var(--text-on-accent);
}

.sidebar-tags {
  padding: var(--spacing-xs) var(--spacing-md);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sidebar-tag {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1.5px solid transparent;
  transition: all var(--transition-fast);
}

.sidebar-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-tag.active {
  background: var(--accent);
  color: var(--text-on-accent);
}

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: var(--spacing-sm);
}

.sidebar-footer-btns {
  display: flex;
  gap: var(--spacing-xs);
}

.sidebar-footer-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--text-2);
  background: var(--surface-2);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.sidebar-footer-btn:hover {
  background: var(--surface-3);
  color: var(--accent);
}

/* ============================================================
       TOPBAR
    ============================================================ */
#topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0 var(--spacing-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  flex-shrink: 0;
}

.topbar-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.topbar-btn.active {
  background: var(--accent-subtle);
  color: var(--accent);
}

.search-wrapper {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--text);
  transition: all var(--transition-fast);
  outline: none;
}

#search-input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px
    hsl(var(--accent-h), var(--accent-s), var(--accent-l), 0.15);
}

#search-input::placeholder {
  color: var(--text-3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-left: auto;
}

.sort-select {
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--text-2);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.sort-select:focus {
  border-color: var(--accent);
}

/* ============================================================
       ZONE PRINCIPALE
    ============================================================ */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

#notes-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
}

#notes-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

#notes-grid.view-list {
  grid-template-columns: 1fr;
}

#empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-xl) var(--spacing-lg);
  color: var(--text-3);
  min-height: 320px;
  text-align: center;
}

#empty-state.visible {
  display: flex;
}

.empty-icon {
  opacity: 0.35;
  width: 64px;
  height: 64px;
}

.empty-title {
  font-size: var(--font-size-xl);
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-2);
}

.empty-sub {
  font-size: var(--font-size-sm);
}

/* ============================================================
       NOTE CARD
    ============================================================ */
.note-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  cursor: pointer;
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
  user-select: none;
  animation: cardIn var(--transition-slow) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-light);
}

.note-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.note-card.pinned {
  border-color: var(--accent);
}

.note-card.pinned::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

.note-card-color-strip {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  bottom: 0;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.note-card[data-color]:not([data-color=""]) {
  padding-left: calc(var(--spacing-md) + 8px);
}

.note-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-xs);
}

.note-title {
  flex: 1;
  font-size: var(--font-size-base);
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-pin-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.note-fav-icon {
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 2px;
}

.note-body {
  font-size: var(--font-size-sm);
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  margin-bottom: var(--spacing-sm);
  font-family: var(--font-body);
}

.view-list .note-body {
  -webkit-line-clamp: 2;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.note-date {
  font-size: var(--font-size-xs);
  color: var(--text-3);
  margin-right: auto;
}

.note-category-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-on-accent);
}

.note-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-3);
}

.note-actions {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.note-card:hover .note-actions,
.note-card:focus-within .note-actions {
  opacity: 1;
}

.note-action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.note-action-btn:hover {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

.note-action-btn.danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.note-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.note-card.dragging {
  opacity: 0.4;
  transform: scale(0.97);
}

.note-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px
    hsl(var(--accent-h), var(--accent-s), var(--accent-l), 0.2);
}

/* ============================================================
       ÉDITEUR
    ============================================================ */
#editor-panel {
  width: 0;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow);
  position: relative;
}

#editor-panel.open {
  width: 460px;
}

#editor-panel.fullscreen {
  position: fixed;
  inset: 0;
  width: 100% !important;
  z-index: 100;
}

.editor-topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0 var(--spacing-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.editor-topbar-title {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--text-3);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px var(--spacing-md);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  flex-wrap: wrap;
  row-gap: 4px;
}

.toolbar-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-size: var(--font-size-sm);
  font-weight: 700;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.toolbar-btn:hover {
  background: var(--surface-3);
  color: var(--accent);
}

.toolbar-btn.active-cmd {
  background: var(--accent-subtle);
  color: var(--accent);
}

.toolbar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

.toolbar-color-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.toolbar-color-btn:hover {
  background: var(--surface-3);
}

.toolbar-color-btn .color-indicator {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.toolbar-color-btn input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
}

.toolbar-highlight-wrap {
  position: relative;
  flex-shrink: 0;
}

.toolbar-highlight-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toolbar-highlight-btn:hover {
  background: var(--surface-3);
}

.toolbar-highlight-btn .hl-indicator {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.highlight-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  z-index: 300;
  width: 168px;
}

.highlight-dropdown.open {
  display: block;
  animation: dropIn 140ms ease both;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.highlight-dropdown-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 7px;
}

.highlight-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hl-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}

.hl-swatch:hover {
  transform: scale(1.2);
  border-color: var(--text);
}

.hl-swatch[data-color="none"] {
  background: var(--surface-3) !important;
  position: relative;
  overflow: hidden;
}

.hl-swatch[data-color="none"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 45%,
    #ef4444 45%,
    #ef4444 55%,
    transparent 55%
  );
}

.hl-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.hl-custom-row label {
  font-size: 11px;
  color: var(--text-2);
  flex: 1;
  cursor: pointer;
}

.hl-custom-row input[type="color"] {
  width: 28px;
  height: 22px;
  padding: 1px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.editor-meta {
  padding: var(--spacing-sm) var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}

.editor-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
}

@media (min-width: 1400px) {
  .editor-actions {
    display: flex;
  }

  .editor-meta {
    flex-direction: row;
  }
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.editor-field label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.editor-field input,
.editor-field select {
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition-fast);
  min-width: 120px;
}

.editor-field input:focus,
.editor-field select:focus {
  border-color: var(--accent);
}

#note-title-input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
  background: transparent;
  border: none;
  font-size: var(--font-size-2xl);
  font-weight: 800;
  font-family: var(--font-body);
  color: var(--text);
  outline: none;
  resize: none;
  flex-shrink: 0;
}

#note-title-input::placeholder {
  color: var(--text-3);
}

#note-editor {
  flex: 1;
  padding: 0 var(--spacing-md) var(--spacing-lg);
  outline: none;
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.8;
  overflow-y: auto;
  word-break: break-word;
  cursor: text;
}

#note-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
  pointer-events: none;
  display: block;
}

#note-editor h1 {
  font-size: var(--font-size-3xl);
  margin: 0.8em 0 0.3em;
  font-weight: 800;
  font-family: var(--font-body);
}

#note-editor h2 {
  font-size: var(--font-size-2xl);
  margin: 0.7em 0 0.3em;
  font-weight: 700;
  font-family: var(--font-body);
}

#note-editor h3 {
  font-size: var(--font-size-xl);
  margin: 0.6em 0 0.25em;
  font-weight: 700;
}

#note-editor h4 {
  font-size: var(--font-size-lg);
  margin: 0.5em 0 0.2em;
  font-weight: 700;
}

#note-editor p {
  margin: 0.3em 0;
}

#note-editor strong,
#note-editor b {
  font-weight: 800;
}

#note-editor em,
#note-editor i {
  font-style: italic;
}

#note-editor u {
  text-decoration: underline;
}

#note-editor s,
#note-editor strike,
#note-editor del {
  text-decoration: line-through;
}

#note-editor ul {
  padding-left: 1.5em;
  margin: 0.4em 0;
  list-style: disc;
}

#note-editor ol {
  padding-left: 1.5em;
  margin: 0.4em 0;
  list-style: decimal;
}

#note-editor li {
  margin: 0.2em 0;
}

#note-editor blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--spacing-md);
  margin: 0.8em 0;
  color: var(--text-2);
  font-style: italic;
}

#note-editor code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

#note-editor pre {
  background: var(--surface-2);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0.8em 0;
}

#note-editor a {
  color: var(--accent);
  text-decoration: underline;
}

#note-editor hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2em 0;
}

#note-editor img {
  max-width: 100%;
  border-radius: var(--radius-md);
}

#note-editor mark {
  border-radius: 2px;
  padding: 0 1px;
}

.editor-footer {
  width: 100%;
  padding: var(--spacing-xs) var(--spacing-md);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-shrink: 0;
  background: var(--surface-2);
}

.editor-stat {
  font-size: var(--font-size-xs);
  color: var(--text-3);
}

.editor-save-status {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  transition: background var(--transition-fast);
}

.save-dot.dirty {
  background: #f59e0b;
}

.color-picker-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition:
    transform var(--transition-fast),
    border-color var(--transition-fast);
  flex-shrink: 0;
}

.color-dot:hover {
  transform: scale(1.2);
}

.color-dot.selected {
  border-color: var(--text);
  transform: scale(1.15);
}

.color-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tags-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: text;
  min-width: 160px;
}

.tags-input-wrapper:focus-within {
  border-color: var(--accent);
}

.tag-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-subtle);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
}

.tag-chip-remove {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.tag-chip-remove:hover {
  opacity: 1;
}

.tag-chip-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#tag-input {
  background: none;
  border: none;
  outline: none;
  font-size: var(--font-size-xs);
  color: var(--text);
  min-width: 60px;
  max-width: 120px;
}

/* ============================================================
       FAB
    ============================================================ */
#fab {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-lg);
  display: grid;
  place-items: center;
  z-index: 40;
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-base);
}

#fab:hover {
  transform: scale(1.1) rotate(45deg);
  box-shadow: var(--shadow-xl);
}

#fab:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

#fab.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
       MODALS
    ============================================================ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  place-items: center;
  backdrop-filter: blur(3px);
  animation: fadeIn var(--transition-fast) both;
}

.modal-backdrop.open {
  display: grid;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-xl);
  animation: modalIn var(--transition-slow) both;
  border: 1px solid var(--border);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal.modal-wide {
  max-width: 600px;
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  font-family: var(--font-body);
  margin-bottom: var(--spacing-sm);
}

.modal-desc {
  font-size: var(--font-size-sm);
  color: var(--text-2);
  margin-bottom: var(--spacing-lg);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ============================================================
       BOUTONS
    ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
}

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 9px;
  border-radius: var(--radius-md);
}

/* ============================================================
       PANNEAU SETTINGS
    ============================================================ */
#settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 150;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-xl);
}

#settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
}

.settings-header h2 {
  flex: 1;
  font-size: var(--font-size-lg);
  font-family: var(--font-body);
}

.settings-section {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.settings-section-title {
  font-size: var(--font-size-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: var(--spacing-md);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.settings-row:last-child {
  margin-bottom: 0;
}

.settings-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text);
}

.settings-sub {
  font-size: var(--font-size-xs);
  color: var(--text-3);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
  cursor: pointer;
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-bounce);
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(18px);
}

.accent-swatches {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.accent-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: all var(--transition-fast);
}

.accent-swatch:hover {
  transform: scale(1.15);
}

.accent-swatch.active {
  border-color: var(--text);
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px currentColor;
}

.accent-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.settings-select {
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 140px;
  transition: border-color var(--transition-fast);
}

.settings-select:focus {
  border-color: var(--accent);
}

/* ============================================================
       TOAST
    ============================================================ */
#toast-container {
  position: fixed;
  bottom: var(--spacing-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--spacing-sm);
  pointer-events: none;
  width: fit-content;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 10px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  white-space: nowrap;
  animation: toastIn var(--transition-bounce) both;
  pointer-events: all;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.out {
  animation: toastOut var(--transition-base) both;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
}

.toast-success {
  background: #15803d;
  color: #fff;
}

.toast-error {
  background: #dc2626;
  color: #fff;
}

.toast-warning {
  background: #d97706;
  color: #fff;
}

/* ============================================================
       CATÉGORIES
    ============================================================ */
.category-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.category-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.category-item .cat-name {
  flex: 1;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text);
}

#section-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 5px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-2);
  border: 1px solid var(--border);
  margin-bottom: var(--spacing-md);
}

/* ============================================================
       RESPONSIVE
    ============================================================ */
@media (max-width: 767px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  #sidebar.mobile-open {
    transform: translateX(0);
  }

  #sidebar-overlay.visible {
    display: block;
  }

  #editor-panel.open {
    position: fixed;
    inset: 0;
    width: 100% !important;
    z-index: 80;
  }

  #editor-panel.fullscreen {
    position: fixed;
    inset: 0;
    width: 100% !important;
    z-index: 100;
  }

  #notes-grid {
    grid-template-columns: 1fr;
  }

  #notes-container {
    padding: var(--spacing-md);
  }

  #fab {
    bottom: 80px;
  }

  #toast-container {
    bottom: 90px;
  }

  .topbar-actions .sort-select {
    display: none;
  }

  #settings-panel {
    width: 100%;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  #sidebar {
    width: 220px;
  }

  #editor-panel.open {
    width: 380px;
  }

  #notes-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (min-width: 1400px) {
  :root {
    --sidebar-width: 280px;
  }

  #editor-panel.open {
    width: 50vw;
  }
}

/* ============================================================
       UTILITIES
    ============================================================ */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.mt-sm {
  margin-top: var(--spacing-sm);
}

.mt-md {
  margin-top: var(--spacing-md);
}

.w-full {
  width: 100%;
}

.text-danger {
  color: #dc2626;
}

@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }

  100% {
    background-position: 400px 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: hsl(var(--accent-h), var(--accent-s), var(--accent-l), 0.25);
}

@media print {
  #sidebar,
  #topbar,
  #fab,
  #toast-container,
  .note-actions {
    display: none !important;
  }

  #editor-panel {
    position: static;
    width: 100%;
    border: none;
  }

  #table-ctx-toolbar {
    display: none !important;
  }
}

/* ============================================================
       MODULE TABLEAU
    ============================================================ */
.tb-table-wrap {
  position: relative;
  flex-shrink: 0;
}

.tb-table-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition-fast);
  border: none;
  background: none;
}

.tb-table-btn:hover {
  background: var(--surface-3);
  color: var(--accent);
}

.tbl-picker {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 12px;
  z-index: 500;
  min-width: 230px;
}

.tbl-picker.open {
  display: block;
  animation: dropIn 140ms ease both;
}

.tbl-picker-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 8px;
}

.tbl-picker-grid {
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(8, 22px);
}

.tbl-picker-cell {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tbl-picker-cell.hl {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.tbl-picker-lbl {
  font-size: 11px;
  color: var(--text-2);
  text-align: center;
  margin: 6px 0 4px;
  min-height: 16px;
}

.tbl-picker-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.tbl-picker-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tbl-picker-row input {
  width: 46px;
  padding: 4px 6px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  outline: none;
  text-align: center;
}

.tbl-picker-row input:focus {
  border-color: var(--accent);
}

.tbl-picker-row span {
  font-size: 12px;
  color: var(--text-3);
}

.tbl-picker-row button {
  flex: 1;
  padding: 5px 8px;
  background: var(--accent);
  color: var(--text-on-accent);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.tbl-picker-row button:hover {
  background: var(--accent-dark);
}

#note-editor .nf-table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: var(--font-size-sm);
  font-family: var(--font-ui);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  overflow: hidden;
  table-layout: auto;
  box-shadow: var(--shadow-sm);
}

#note-editor .nf-table td,
#note-editor .nf-table th {
  border: 1px solid var(--border-strong);
  padding: 8px 12px;
  min-width: 80px;
  max-width: 400px;
  vertical-align: middle;
  word-break: break-word;
  outline: none;
  position: relative;
  cursor: cell;
  transition: background var(--transition-fast);
}

#note-editor .nf-table th {
  background: var(--accent-subtle);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--accent-light);
}

#note-editor .nf-table th:hover {
  background: hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) + 8%));
}

#note-editor .nf-table td:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: hsl(var(--accent-h), var(--accent-s), var(--accent-l), 0.08);
  z-index: 3;
}

#note-editor .nf-table td.tbl-selected,
#note-editor .nf-table th.tbl-selected {
  background: hsl(
    var(--accent-h),
    var(--accent-s),
    var(--accent-l),
    0.15
  ) !important;
  outline: 1.5px solid var(--accent);
  outline-offset: -1.5px;
  z-index: 2;
}

#note-editor .nf-table td.tbl-selecting {
  background: hsl(
    var(--accent-h),
    var(--accent-s),
    var(--accent-l),
    0.25
  ) !important;
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

#note-editor .nf-table tr.tbl-total-row td {
  background: var(--accent-subtle);
  font-weight: 700;
  border-top: 2px solid var(--accent);
  color: var(--accent-dark);
}

#note-editor .nf-table th.tbl-col-selected {
  background: hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) + 4%));
  box-shadow: inset 0 0 0 2px var(--accent);
}

#tbl-edit-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 12px;
  margin: 0 0 8px;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#tbl-edit-bar.visible {
  display: flex;
  animation: slideDown 200ms ease both;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tbl-edit-ref {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  min-width: 40px;
  text-align: center;
  background: var(--accent-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.tbl-edit-fx-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  gap: 6px;
  align-items: center;
  position: relative;
}

.tbl-edit-fx-lbl {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

#tbl-edit-input {
  flex: 1;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
}

#tbl-edit-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px
    hsl(var(--accent-h), var(--accent-s), var(--accent-l), 0.12);
}

#tbl-fx-autocomplete {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 50px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 200;
  min-width: 180px;
}

#tbl-fx-autocomplete.visible {
  display: block;
}

.tbl-fx-option {
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition-fast);
}

.tbl-fx-option:hover,
.tbl-fx-option.selected {
  background: var(--accent-subtle);
  color: var(--accent);
}

.tbl-fx-option-name {
  font-weight: 700;
  min-width: 80px;
}

.tbl-fx-option-desc {
  font-size: 11px;
  color: var(--text-3);
}

.tbl-edit-actions {
  display: flex;
  gap: 3px;
  align-items: center;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.tbl-edit-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
}

.tbl-edit-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.tbl-edit-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#csv-input-area {
  width: 100%;
  height: 150px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.5;
}

#csv-input-area:focus {
  border-color: var(--accent);
}

.csv-options {
  display: flex;
  gap: var(--spacing-md);
  margin: var(--spacing-sm) 0;
  flex-wrap: wrap;
  align-items: center;
}

.csv-options label {
  font-size: var(--font-size-sm);
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.csv-options select {
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.csv-options select:focus {
  border-color: var(--accent);
}

/* ============================================================
       FOOTER
    ============================================================ */
#app-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  justify-content: center;
}

.footer-brand {
  font-weight: 600;
  opacity: 0.6;
}

.footer-year::before {
  content: "© ";
}

.footer-year {
  opacity: 0.5;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.footer-link:hover {
  opacity: 1;
  color: var(--accent);
}

/* ── Lang selector ── */
.lang-selector {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.18rem 0.55rem;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.04em;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--accent);
  color: var(--text-on-accent);
}
