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

:root {
  --bg: #0d0e11;
  --bg2: #13151a;
  --bg3: #1a1d24;
  --bg4: #21252f;
  --line: #2a2e3b;
  --line2: #363b4a;
  --text: #e8eaf0;
  --muted: #5a607a;
  --faint: #3a3f52;
  --accent: #5b8aff;
  --accent2: #7b6ef6;
  --green: #3dd68c;
  --amber: #f5a623;
  --red: #ff5f6d;
  --cyan: #38bdf8;
  --purple: #c084fc;

  --key: #5b8aff;
  --string: #3dd68c;
  --number: #f5a623;
  --bool: #ff5f6d;
  --null: #c084fc;
  --bracket: #5a607a;

  --font-mono: 'JetBrains Mono', monospace;
  --font-ui: 'Syne', sans-serif;

  --r: 6px;
  --r2: 10px;
  --r3: 14px;
}

[data-theme="light"] {
  --bg: #f4f5f9;
  --bg2: #ffffff;
  --bg3: #f0f1f6;
  --bg4: #e8eaf0;
  --line: #dde0eb;
  --line2: #c8ccd8;
  --text: #1a1d2e;
  --muted: #8890aa;
  --faint: #d0d4e0;
  --accent: #3060ff;
  --accent2: #6e52f5;
  --green: #16a34a;
  --amber: #b45309;
  --red: #dc2626;
  --cyan: #0284c7;
  --purple: #9333ea;

  --key: #3060ff;
  --string: #16a34a;
  --number: #b45309;
  --bool: #dc2626;
  --null: #9333ea;
  --bracket: #8890aa;
}

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 32px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1px;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 6px;
  height: 100%;
  align-items: center;
}

/* JSON group: Input + Viewer pill */
.tab-group-json {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 1px;
}

.tab-sep-line {
  width: 1px;
  height: 20px;
  background: var(--line2);
  margin: 0 4px;
  flex-shrink: 0;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  height: 30px;
  white-space: nowrap;
}

/* Tabs inside the JSON group */
.tab-group-json .tab:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.tab-group-json .tab.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Standalone tool tabs (Converter) */
.tab.tab-tool {
  background: none;
  border: 1px solid transparent;
}
.tab.tab-tool:hover {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
  border-color: color-mix(in srgb, var(--amber) 20%, transparent);
}
.tab.tab-tool.active {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}

/* Notes tab — distinct warm green */
.tab.tab-notes {
  background: none;
  border: 1px solid transparent;
}
.tab.tab-notes:hover {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, transparent);
  border-color: color-mix(in srgb, var(--green) 20%, transparent);
}
.tab.tab-notes.active {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

.tab svg { width: 14px; height: 14px; flex-shrink: 0; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover { color: var(--text); border-color: var(--line2); background: var(--bg4); }
.icon-btn svg { width: 15px; height: 15px; }

/* ── LAYOUT ── */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.pane {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.pane.active { display: flex; }

/* ── INPUT PANE ── */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.pane-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { background: var(--bg4); border-color: var(--line2); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { opacity: 0.88; }

.btn.danger {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 30%, transparent);
}
.btn.danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); }

.btn svg { width: 13px; height: 13px; }

.editor-wrap {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
}

.line-nums {
  padding: 16px 0;
  width: 44px;
  min-width: 44px;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--faint);
  text-align: right;
  padding-right: 10px;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}

textarea {
  flex: 1;
  padding: 16px 20px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  border: none;
  outline: none;
  resize: none;
  tab-size: 2;
  caret-color: var(--accent);
}

textarea::placeholder { color: var(--faint); }

.statusbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg2);
  flex-shrink: 0;
}

.stat-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-pill span { color: var(--text); font-weight: 600; }

.action-row {
  padding: 12px 20px;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.err-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
  flex-shrink: 0;
}

.err-bar.show { display: flex; }
.err-bar svg { flex-shrink: 0; }

/* ── DROP ZONE ── */
.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border: 2px dashed var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
  border-radius: 4px;
}

.drop-overlay.show { opacity: 1; }
.drop-label { font-size: 14px; font-weight: 700; color: var(--accent); }

/* ── VIEWER PANE ── */
.viewer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap svg {
  position: absolute;
  left: 9px;
  width: 13px;
  height: 13px;
  color: var(--muted);
  pointer-events: none;
}

.search-inp {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  padding: 5px 9px 5px 30px;
  width: 200px;
  outline: none;
  transition: all 0.15s;
}

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

.search-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding: 0 6px;
  min-width: 50px;
}

.divider { width: 1px; height: 20px; background: var(--line); flex-shrink: 0; }

.viewer-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--faint);
  text-align: center;
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--muted); }
.empty-state p { font-size: 13px; max-width: 260px; line-height: 1.5; }

/* ── JSON TREE ── (classic icon-tree style) */
.jn { position: relative; }

.jn-row {
  display: flex;
  align-items: center;
  padding: 1px 0;
  min-height: 22px;
  white-space: nowrap;
}

.jn-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); border-radius: 3px; }

/* [-] / [+] toggle button */
.jn-toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px 0 0;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -1px;
  user-select: none;
}
.jn-toggle:hover { color: var(--accent); }

.jn-spacer { display: inline-block; width: 18px; flex-shrink: 0; }

/* colored square type icons */
.jn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 2px;
  font-size: 8px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  margin-right: 5px;
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
}

.jn-icon.ic-obj    { background: #4a6cf7; }
.jn-icon.ic-arr    { background: #4a6cf7; }
.jn-icon.ic-str    { background: #1d9e5e; }
.jn-icon.ic-num    { background: #2563aa; }
.jn-icon.ic-bool-t { background: #d97706; }
.jn-icon.ic-bool-f { background: #b45309; }
.jn-icon.ic-null   { background: #b91c1c; }

.jn-key {
  color: var(--text);
  font-weight: 500;
  margin-right: 0;
}

.jn-sep {
  color: var(--muted);
  margin: 0 5px;
}

.jn-str  { color: var(--string); }
.jn-num  { color: var(--number); }
.jn-bool { color: var(--amber);  font-weight: 600; }
.jn-null { color: var(--red);    font-weight: 600; }

.jn-children {
  padding-left: 18px;
  border-left: 1px dashed var(--line2);
  margin-left: 6px;
}
.jn-children.hidden { display: none; }

.match { background: color-mix(in srgb, var(--amber) 30%, transparent); border-radius: 2px; padding: 0 1px; }
.match.active { background: color-mix(in srgb, var(--amber) 60%, transparent); outline: 1px solid var(--amber); }

/* ── VIEWER STATS ── */
.viewer-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 20px;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg3);
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.type-obj { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 30%, transparent); }
.badge.type-arr { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 30%, transparent); }
.badge.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }

/* ── MODAL ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.overlay.show { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--r3);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 { font-size: 15px; font-weight: 700; }

.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }

.field select, .field input[type=text] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
}

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

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

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

.toggle {
  width: 36px;
  height: 20px;
  background: var(--bg4);
  border: 1px solid var(--line2);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle.on { background: var(--accent); border-color: var(--accent); }

.toggle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle.on::after { left: 18px; }

.copy-field {
  display: flex;
  gap: 6px;
}

.copy-field input {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
}

/* ── TOAST ── */
.toast-rack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--r2);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease forwards;
  pointer-events: auto;
}

.toast.ok { background: #1a3a27; border: 1px solid #2d6645; color: var(--green); }
.toast.err { background: #3a1a1a; border: 1px solid #6d2f2f; color: var(--red); }
.toast.info { background: var(--bg3); border: 1px solid var(--line2); color: var(--text); }

.toast svg { width: 14px; height: 14px; flex-shrink: 0; }

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

/* ── CONTEXT MENU ── */
.ctx-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--r2);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  padding: 4px;
  min-width: 180px;
  font-family: var(--font-ui);
  animation: ctxIn 0.12s ease;
}

@keyframes ctxIn {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.ctx-item:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

.ctx-item svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--muted); }
.ctx-item:hover svg { color: var(--accent); }

.ctx-sep {
  height: 1px;
  background: var(--line);
  margin: 3px 4px;
}

.ctx-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 6px 12px 2px;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── PATH BAR ── */
.path-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  min-height: 30px;
  flex-shrink: 0;
  overflow: hidden;
}

.path-seg { color: var(--accent); }

@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .brand-name { display: none; }
  .viewer-controls { padding: 8px 12px; }
  .viewer-body { padding: 12px; }
  .pane-header { padding: 10px 12px; }
  .statusbar, .viewer-stats { padding: 6px 12px; }
  .search-inp { width: 140px; }
}

@media print {
  .topbar, .pane-header, .statusbar, .viewer-controls, .viewer-stats, .path-bar { display: none !important; }
  .viewer-body { padding: 0; font-size: 11px; }
}

/* ── CONVERTER STYLES ────────────────────── */
.format-select {
  padding: 5px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
}

.format-select:hover {
  background: var(--bg4);
  border-color: var(--line2);
}

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

.request-summary {
  display: flex;
  gap: 20px;
  padding: 10px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-label {
  color: var(--muted);
  font-weight: 600;
}

.summary-value {
  color: var(--accent);
  font-weight: 500;
}

.converter-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.converter-input,
.converter-output {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.converter-input {
  border-right: 1px solid var(--line);
}

.converter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.converter-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--line2);
  background: var(--bg4);
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

.code-output {
  flex: 1;
  padding: 16px 20px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
  overflow: auto;
  white-space: pre;
}

.code-output code {
  font-family: inherit;
}

/* Syntax highlighting */
.code-keyword { color: #ff79c6; }
.code-string { color: var(--green); }
.code-number { color: var(--amber); }
.code-comment { color: var(--muted); font-style: italic; }
.code-function { color: #50fa7b; }
.code-variable { color: var(--cyan); }
.code-operator { color: var(--purple); }

/* ═══════════════════════════════════════════
   NOTES PANE
═══════════════════════════════════════════ */

#pane-notes { overflow: hidden; }

.notes-layout {
  display: flex;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.notes-sidebar {
  width: 240px;
  min-width: 200px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  flex-shrink: 0;
  overflow: hidden;
}

.notes-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.notes-sidebar-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.notes-sidebar-title svg { width: 13px; height: 13px; }

.notes-new-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg3);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.notes-new-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.notes-new-btn svg { width: 14px; height: 14px; }

.notes-search-wrap {
  position: relative;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.notes-search-wrap svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  color: var(--muted);
  pointer-events: none;
}
.notes-search-inp {
  width: 100%;
  padding: 5px 8px 5px 28px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.notes-search-inp:focus { border-color: var(--accent); }

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px;
}

.notes-empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}
.notes-empty-list svg { width: 32px; height: 32px; opacity: 0.4; }

/* Note item in list */
.note-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  border: 1px solid transparent;
}
.note-item:hover { background: var(--bg3); }
.note-item.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

.note-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.note-item-icon.lang-python   { background: #1a3a2a; color: #3dd68c; border: 1px solid #2d6645; }
.note-item-icon.lang-javascript { background: #332d0a; color: #f5c518; border: 1px solid #665a14; }
.note-item-icon.lang-sql      { background: #0a2040; color: #38bdf8; border: 1px solid #1a4a80; }
.note-item-icon.lang-json     { background: #2a1a3a; color: #c084fc; border: 1px solid #5a2a80; }
.note-item-icon.lang-bash     { background: #1a1a2a; color: #a78bfa; border: 1px solid #3a2a6a; }
.note-item-icon.lang-html     { background: #3a1a0a; color: #fb923c; border: 1px solid #7a3a14; }
.note-item-icon.lang-css      { background: #0a1a3a; color: #60a5fa; border: 1px solid #1a3a7a; }
.note-item-icon.lang-text     { background: var(--bg4); color: var(--muted); border: 1px solid var(--line); }

.note-item-meta { flex: 1; min-width: 0; }
.note-item-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item.active .note-item-name { color: var(--accent); }
.note-item-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}

.notes-sidebar-foot {
  padding: 10px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.notes-sidebar-foot .btn { width: 100%; justify-content: center; font-size: 11px; }

/* ── EDITOR AREA ── */
.notes-editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* TOOLBAR */
.notes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 10px;
  flex-wrap: wrap;
}

.notes-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.notes-filename-inp {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  outline: none;
  padding: 2px 0;
  width: 200px;
  transition: border-color 0.15s;
}
.notes-filename-inp:focus { border-color: var(--accent); }
.notes-filename-inp::placeholder { color: var(--faint); }

.notes-lang-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--bg4);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.notes-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.notes-lang-select {
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
}
.notes-lang-select:hover { border-color: var(--line2); }
.notes-lang-select:focus { border-color: var(--accent); }

.notes-mode-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.notes-mode-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg3);
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.notes-mode-btn:first-child { border-right: 1px solid var(--line); }
.notes-mode-btn svg { width: 12px; height: 12px; }
.notes-mode-btn:hover { color: var(--text); background: var(--bg4); }
.notes-mode-btn.active { background: color-mix(in srgb, var(--accent) 15%, var(--bg3)); color: var(--accent); }

/* EDIT MODE */
.notes-edit-mode {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notes-edit-mode .editor-wrap { flex: 1; }
.notes-edit-mode textarea {
  font-size: 13.5px;
  line-height: 1.75;
  tab-size: 4;
}

/* VIEW MODE */
.notes-view-mode {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notes-view-mode.hidden { display: none; }
.notes-view-wrap {
  display: flex;
  flex: 1;
  overflow: auto;
}

.notes-highlighted {
  flex: 1;
  margin: 0;
  padding: 16px 20px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
  overflow: visible;
  white-space: pre;
  tab-size: 4;
}
.notes-highlighted code { font-family: inherit; }

/* EMPTY STATE */
.notes-editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--faint);
}
.notes-editor-empty h3 { font-size: 16px; font-weight: 700; color: var(--muted); }
.notes-editor-empty p  { font-size: 13px; max-width: 260px; text-align: center; line-height: 1.5; }
.notes-empty-icon svg  { width: 52px; height: 52px; opacity: 0.2; }

/* STATUSBAR */
.notes-statusbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg2);
  flex-shrink: 0;
}
.notes-saved-indicator {
  margin-left: auto;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.notes-saved-indicator.saved { color: var(--green); }
.notes-saved-indicator.unsaved { color: var(--amber); }

/* ── SYNTAX HIGHLIGHT TOKENS ── */
/* shared base */
.hl-kw   { color: #ff79c6; font-weight: 600; }   /* keywords        */
.hl-kw2  { color: #bd93f9; font-weight: 600; }   /* keyword2 / type */
.hl-fn   { color: #50fa7b; }                      /* function names  */
.hl-str  { color: #f1fa8c; }                      /* strings         */
.hl-str2 { color: #e9f97a; }                      /* template/raw str*/
.hl-num  { color: #bd93f9; }                      /* numbers         */
.hl-cmt  { color: #636f88; font-style: italic; }  /* comments        */
.hl-op   { color: #ff79c6; }                      /* operators       */
.hl-cls  { color: #8be9fd; font-weight: 600; }    /* class names     */
.hl-dec  { color: #ffb86c; }                      /* decorators      */
.hl-tag  { color: #ff79c6; }                      /* HTML tags       */
.hl-attr { color: #50fa7b; }                      /* HTML attrs      */
.hl-val  { color: #f1fa8c; }                      /* HTML attr vals  */
.hl-sel  { color: #8be9fd; }                      /* CSS selector    */
.hl-prop { color: #50fa7b; }                      /* CSS property    */
.hl-unit { color: #bd93f9; }                      /* CSS units/vals  */

/* SQL specific */
.hl-sql-kw  { color: #ff79c6; font-weight: 700; text-transform: uppercase; }
.hl-sql-fn  { color: #50fa7b; }
.hl-sql-tbl { color: #8be9fd; }
.hl-sql-str { color: #f1fa8c; }
.hl-sql-num { color: #bd93f9; }
.hl-sql-cmt { color: #636f88; font-style: italic; }
.hl-sql-op  { color: #ffb86c; }

/* Light theme overrides for syntax */
[data-theme="light"] .hl-kw   { color: #c92c6d; }
[data-theme="light"] .hl-kw2  { color: #7c3aed; }
[data-theme="light"] .hl-fn   { color: #0f7a3c; }
[data-theme="light"] .hl-str  { color: #b45309; }
[data-theme="light"] .hl-str2 { color: #9a3e00; }
[data-theme="light"] .hl-num  { color: #6d28d9; }
[data-theme="light"] .hl-cmt  { color: #94a3b8; }
[data-theme="light"] .hl-op   { color: #c92c6d; }
[data-theme="light"] .hl-cls  { color: #0369a1; }
[data-theme="light"] .hl-dec  { color: #c2410c; }
[data-theme="light"] .hl-tag  { color: #c92c6d; }
[data-theme="light"] .hl-attr { color: #0f7a3c; }
[data-theme="light"] .hl-val  { color: #b45309; }
[data-theme="light"] .hl-sel  { color: #0369a1; }
[data-theme="light"] .hl-prop { color: #0f7a3c; }
[data-theme="light"] .hl-unit { color: #6d28d9; }
[data-theme="light"] .hl-sql-kw  { color: #c92c6d; }
[data-theme="light"] .hl-sql-fn  { color: #0f7a3c; }
[data-theme="light"] .hl-sql-tbl { color: #0369a1; }
[data-theme="light"] .hl-sql-str { color: #b45309; }
[data-theme="light"] .hl-sql-num { color: #6d28d9; }
[data-theme="light"] .hl-sql-cmt { color: #94a3b8; }
[data-theme="light"] .hl-sql-op  { color: #c2410c; }

@media (max-width: 640px) {
  .notes-sidebar { width: 180px; min-width: 160px; }
  .notes-filename-inp { width: 120px; }
  .notes-toolbar { padding: 8px; gap: 6px; }
}
