@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  src: url('MaterialSymbolsOutlined.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg-primary: #121214;
  --bg-sidebar: #1c1c1e;
  --bg-list: #1a1a1c;
  --bg-editor: #161618;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active-subtle: rgba(255, 255, 255, 0.08);
  --bg-input: #28282a;
  --bg-toolbar: #1c1c1e;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-primary: #f5f5f7;
  --text-secondary: #8e8e93;
  --text-tertiary: rgba(255, 255, 255, 0.35);
  --accent: #e5a00d;
  --accent-soft: rgba(229, 160, 13, 0.15);
  --accent-text: #000000;
  --danger: #ff453a;
  --note-active-bg: #d99b26;
  --note-active-title: #000000;
  --note-active-text: #3b2d07;
  --scrollbar-thumb: rgba(255, 255, 255, 0.14);
}

[data-theme="arctic"] {
  --bg-primary: #f2f2f7;
  --bg-sidebar: #f2f2f7;
  --bg-list: #ffffff;
  --bg-editor: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active-subtle: rgba(0, 0, 0, 0.07);
  --bg-input: #e5e5ea;
  --bg-toolbar: #f2f2f7;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: rgba(0, 0, 0, 0.35);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --accent-text: #ffffff;
  --danger: #ff3b30;
  --note-active-bg: #007aff;
  --note-active-title: #ffffff;
  --note-active-text: rgba(255, 255, 255, 0.85);
  --scrollbar-thumb: rgba(0, 0, 0, 0.18);
}

[data-theme="sand"] {
  --bg-primary: #f0ebe0;
  --bg-sidebar: #f0ebe0;
  --bg-list: #faf6ee;
  --bg-editor: #faf6ee;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active-subtle: rgba(0, 0, 0, 0.07);
  --bg-input: #e4ddcf;
  --bg-toolbar: #f0ebe0;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text-primary: #3d3428;
  --text-secondary: #7d705c;
  --text-tertiary: rgba(61, 52, 40, 0.35);
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.12);
  --accent-text: #ffffff;
  --danger: #dc2626;
  --note-active-bg: #b45309;
  --note-active-title: #ffffff;
  --note-active-text: rgba(255, 255, 255, 0.85);
  --scrollbar-thumb: rgba(0, 0, 0, 0.15);
}

[data-theme="forest"] {
  --bg-primary: #0a1210;
  --bg-sidebar: #101c16;
  --bg-list: #0d1712;
  --bg-editor: #0c1410;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active-subtle: rgba(255, 255, 255, 0.08);
  --bg-input: #182720;
  --bg-toolbar: #101c16;
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.15);
  --note-active-bg: #34d399;
  --note-active-title: #052e16;
  --note-active-text: #064e3b;
}

[data-theme="midnight"] {
  --bg-primary: #05080f;
  --bg-sidebar: #0f1523;
  --bg-list: #0b101d;
  --bg-editor: #090e1a;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active-subtle: rgba(255, 255, 255, 0.08);
  --bg-input: #172138;
  --bg-toolbar: #0f1523;
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.15);
  --note-active-bg: #6366f1;
  --note-active-title: #ffffff;
  --note-active-text: rgba(255, 255, 255, 0.85);
}

[data-theme="rosewood"] {
  --bg-primary: #0f0a0b;
  --bg-sidebar: #1e1114;
  --bg-list: #180e10;
  --bg-editor: #140b0d;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active-subtle: rgba(255, 255, 255, 0.08);
  --bg-input: #2a161b;
  --bg-toolbar: #1e1114;
  --accent: #f472b6;
  --accent-soft: rgba(244, 114, 182, 0.15);
  --note-active-bg: #ec4899;
  --note-active-title: #ffffff;
  --note-active-text: rgba(255, 255, 255, 0.85);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, textarea, select, button {
  font-family: inherit;
}

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

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

/* Material Symbols */
.mi {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
.mi.filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.mi-sm { font-size: 18px; }
.mi-xs { font-size: 15px; }

/* ═══ App Layout ═══ */
.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}
.app > .sidebar {
  width: 230px;
  min-width: 230px;
}
.app > .note-list {
  width: 310px;
  min-width: 310px;
}
.app > .editor-pane {
  flex: 1;
  min-width: 0;
}

/* ═══ Left Sidebar ═══ */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
}
.sb-header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}
.sb-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--accent);
}
.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.12s ease;
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: var(--bg-hover);
}
.nav-item.active {
  background: var(--bg-active-subtle);
  color: #ffffff;
  font-weight: 600;
}
.nav-item .f-ic {
  font-size: 18px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: var(--accent);
}
.nav-item.active .f-ic {
  color: var(--accent);
}
.nav-item .cnt {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}
.nav-item.drop-target {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.nav-section-label {
  padding: 12px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 10px 10px;
}
.tag-p {
  padding: 3px 9px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: 0.15s;
}
.tag-p:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.tag-p.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Sidebar Footer (New Folder pinned at bottom) */
.sb-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-sidebar);
}
.btn-new-folder {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.12s;
  text-align: left;
  width: 100%;
}
.btn-new-folder:hover {
  background: var(--bg-hover);
}
.btn-new-folder .mi {
  font-size: 18px;
  color: var(--accent);
}
.nf-input-box {
  display: flex;
  gap: 6px;
  padding: 2px 0 6px;
}
.nf-input-box input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
}
.nf-input-box input:focus {
  border-color: var(--accent);
}
.nf-input-box button {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--accent-text);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

/* ═══ Middle Column: Notes List ═══ */
.note-list {
  background: var(--bg-list);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.lst-hdr {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  border-bottom: 1px solid var(--border);
}
.lst-search {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.lst-search input {
  width: 100%;
  padding: 7px 28px 7px 32px;
  background: var(--bg-input);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: background 0.15s;
}
.lst-search input::placeholder {
  color: var(--text-secondary);
}
.lst-search input:focus {
  background: rgba(255, 255, 255, 0.09);
}
.lst-search .search-ic {
  position: absolute;
  left: 9px;
  color: var(--text-secondary);
  font-size: 17px;
  pointer-events: none;
}
.lst-search .clr-search {
  position: absolute;
  right: 7px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
}
.btn-empty {
  background: none;
  border: 1px solid var(--danger);
  border-radius: 7px;
  color: var(--danger);
  cursor: pointer;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: 0.15s;
}
.btn-empty:hover {
  background: rgba(255, 69, 58, 0.15);
}

.notes-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.sec-div {
  padding: 10px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sec-div.sec-toggle {
  cursor: pointer;
  user-select: none;
}
.sec-div.sec-toggle:hover {
  color: var(--text-primary);
}
.sec-div .chev {
  font-size: 17px;
  color: var(--text-secondary);
  transition: transform 0.2s;
}
.sec-div.collapsed .chev {
  transform: rotate(-90deg);
}

/* ═══ Apple Notes Cards ═══ */
.n-card {
  margin: 2px 8px;
  padding: 10px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
  border: 1px solid transparent;
}
.n-card:hover {
  background: var(--bg-hover);
}
.n-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}
.n-card-t {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 5px;
}
.n-card.has-lock {
  border-left: 3px solid var(--accent);
}
.n-card-t .lock-ic {
  font-size: 15px;
  color: var(--accent);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.n-card-t .lock-ic.is-unlocked {
  color: #34c759;
}
.n-card-m {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
}
.lock-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 6px;
  border-radius: 6px;
  line-height: 1.2;
  flex-shrink: 0;
}
.lock-chip .mi {
  font-size: 12px;
}
.lock-chip.is-locked {
  background: rgba(229, 160, 13, 0.16);
  color: var(--accent);
  border: 1px solid rgba(229, 160, 13, 0.35);
}
.lock-chip.is-unlocked {
  background: rgba(52, 199, 89, 0.14);
  color: #34c759;
  border: 1px solid rgba(52, 199, 89, 0.3);
}
.n-card-d {
  font-weight: 500;
  flex-shrink: 0;
}
.n-card-x {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.n-card-f {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  line-height: 1.2;
}
.n-card-f .f-ic {
  font-size: 13px;
  color: var(--accent);
}
.n-card-tags {
  margin-top: 4px;
  display: flex;
  gap: 4px;
}
.n-card-tags span {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  font-weight: 500;
}

/* ═══ Selected Note Card (Apple Notes Gold Accent) ═══ */
.n-card.active {
  background: var(--note-active-bg) !important;
  border-color: transparent !important;
}
.n-card.active.has-lock {
  border-left-color: transparent !important;
}
.n-card.active .n-card-t {
  color: var(--note-active-title) !important;
  font-weight: 700;
}
.n-card.active .n-card-t .lock-ic {
  color: var(--note-active-text) !important;
}
.n-card.active .lock-chip.is-locked,
.n-card.active .lock-chip.is-unlocked {
  background: rgba(0, 0, 0, 0.18) !important;
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.25) !important;
}
.n-card.active .n-card-m,
.n-card.active .n-card-d,
.n-card.active .n-card-x {
  color: var(--note-active-text) !important;
}
.n-card.active .n-card-f {
  color: var(--note-active-text) !important;
}
.n-card.active .n-card-f .f-ic {
  color: var(--note-active-text) !important;
}
.n-card.active .n-card-tags span {
  background: rgba(0, 0, 0, 0.15) !important;
  color: #000000 !important;
}

.empty-l {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ═══ Right Pane: Editor ═══ */
.editor-pane {
  background: var(--bg-editor);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
}
.ed-tb {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-editor);
  min-height: 52px;
  user-select: none;
}
.tb {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  transition: 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
}
.tb:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.tb.active {
  background: var(--bg-active-subtle);
  color: var(--accent);
}
.tb.danger-hover:hover {
  color: var(--danger);
  background: rgba(255, 69, 58, 0.12);
}
.tb-aa {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1;
}
.tb-sp {
  flex: 1;
}
.tb-st {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tb-st.saving {
  color: var(--accent);
}
.tb-st .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-secondary);
}
.tb-st.saving .dot {
  background: var(--accent);
  animation: pulse 1s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.top-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 6px;
  transition: transform 0.12s;
  flex-shrink: 0;
}
.top-avatar:hover {
  transform: scale(1.05);
}

/* Editor Container */
.ed-c {
  flex: 1;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}
.ed-c textarea {
  width: 100%;
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 32px 48px;
  font-size: 15px;
  line-height: 1.75;
  resize: none;
  outline: none;
  font-family: inherit;
}
.ed-c textarea::placeholder {
  color: var(--text-tertiary);
}

/* Preview Rendering (Apple Notes Typography) */
.preview {
  padding: 32px 48px;
  line-height: 1.75;
  font-size: 15px;
  color: #e5e5ea;
  max-width: 820px;
}
.preview h1 {
  font-size: 28px;
  margin: 0.2em 0 0.4em;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}
.preview h2 {
  font-size: 21px;
  margin: 0.8em 0 0.3em;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: #f5f5f7;
}
.preview h3 {
  font-size: 15.5px;
  margin: 0.6em 0 0.25em;
  font-weight: 600;
  color: var(--text-secondary);
}
.preview code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.preview a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.preview img {
  max-width: 100%;
  border-radius: 8px;
  margin: 12px 0;
}
.preview del {
  opacity: 0.45;
}
.preview blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--text-secondary);
  margin: 10px 0;
}

/* Checklists & Bullets in Preview */
.cl-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0;
  line-height: 1.6;
}
.cl-box {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 3px;
  transition: 0.15s;
}
.cl-box.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #000000;
}
.cl-box.checked .mi {
  font-size: 13px;
  font-weight: bold;
}
.cl-item.checked .cl-text {
  text-decoration: line-through;
  opacity: 0.55;
}
.bullet-item {
  display: flex;
  gap: 8px;
  margin: 3px 0;
  line-height: 1.6;
}
.bullet-dot {
  color: var(--accent);
  font-weight: bold;
}

.ed-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  gap: 12px;
}
.ed-empty .mi {
  font-size: 48px;
  opacity: 0.25;
}
.ed-empty p {
  font-size: 14px;
}
.btn-cr {
  margin-top: 4px;
  padding: 8px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: 0.15s;
}
.btn-cr:hover {
  background: var(--accent);
  color: var(--accent-text);
}

/* Lock overlay */
.lock-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-editor);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}
.lock-overlay .lock-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(229, 160, 13, 0.12);
  border: 1px solid rgba(229, 160, 13, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.lock-overlay .lock-icon-circle .mi {
  font-size: 32px;
  color: var(--accent);
  opacity: 1;
}
.lock-overlay h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.lock-overlay p {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin: 0;
}
.lock-overlay input {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  width: 240px;
  text-align: center;
  margin-top: 4px;
}
.lock-overlay input:focus {
  border-color: var(--accent);
}
.lock-overlay button {
  padding: 9px 24px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.lock-overlay button:hover {
  filter: brightness(1.1);
}
.lock-overlay .lock-err {
  color: var(--danger);
  font-size: 12px;
  min-height: 16px;
}

/* Editor Lock Banner (when unlocked) */
.ed-lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  margin-bottom: 14px;
  background: rgba(229, 160, 13, 0.1);
  border: 1px solid rgba(229, 160, 13, 0.25);
  border-radius: 8px;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
}
.ed-lock-tag {
  display: flex;
  align-items: center;
  gap: 7px;
}
.ed-lock-tag .mi {
  font-size: 17px;
}
.btn-lock-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(229, 160, 13, 0.2);
  color: var(--accent);
  border: 1px solid rgba(229, 160, 13, 0.45);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-lock-action:hover {
  background: var(--accent);
  color: #000000;
}
.btn-lock-action .mi {
  font-size: 13px;
}

/* Popover Menus (Aa format, Share, Profile) */
.popover-menu {
  position: absolute;
  top: 54px;
  background: var(--bg-list);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 6px;
  z-index: 200;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  min-width: 210px;
}
.popover-item {
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: 0.1s;
}
.popover-item:hover {
  background: var(--bg-hover);
}
.popover-item.danger {
  color: var(--danger);
}
.popover-item .mi {
  font-size: 18px;
}
.popover-sep {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}
.popover-title {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Aa Format Popover */
.format-popover {
  right: 180px;
  width: 240px;
}
.fp-headings {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.fp-headings button {
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.fp-headings button:hover {
  background: var(--bg-hover);
}
.fp-title-lg { font-size: 18px; font-weight: 700; }
.fp-title-md { font-size: 15px; font-weight: 600; }
.fp-title-sm { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.fp-row-btns {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: var(--bg-input);
  border-radius: 8px;
  margin: 4px 6px;
  justify-content: space-around;
}
.fp-row-btns button {
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-row-btns button:hover {
  background: var(--bg-hover);
}

/* Profile Popover */
.user-popover {
  right: 14px;
  min-width: 240px;
}
.user-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px;
}
.user-info-row .u-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.user-info-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.theme-dots-row {
  display: flex;
  gap: 8px;
  padding: 6px 12px 8px;
}
.th-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}
.th-dot:hover {
  transform: scale(1.15);
}
.th-dot.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--bg-primary);
}

/* ═══ Login Screen ═══ */
.login-w {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
}
.login-c {
  width: 100%;
  max-width: 360px;
  background: var(--bg-list);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 40px 30px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.login-c h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 10px 0 4px;
  color: var(--accent);
}
.login-c .sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}
.login-c input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  transition: 0.2s;
}
.login-c input:focus {
  border-color: var(--accent);
}
.login-c .btn-s {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: 0.15s;
}
.login-c .btn-s:hover {
  filter: brightness(1.1);
}
.login-c .tgl {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 16px;
  cursor: pointer;
  transition: 0.15s;
}
.login-c .tgl:hover {
  color: var(--accent);
}
.lg-err {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-list);
  border: 1px solid var(--border-strong);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--accent);
  z-index: 1000;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  animation: ts 0.3s ease;
  backdrop-filter: blur(20px);
}
@keyframes ts {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Context menu */
.ctx-menu {
  position: fixed;
  z-index: 300;
  background: var(--bg-list);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 5px;
  min-width: 180px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px);
}
.ctx-item {
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.1s;
}
.ctx-item:hover {
  background: var(--bg-hover);
}
.ctx-item.danger {
  color: var(--danger);
}
.ctx-item .mi {
  font-size: 18px;
}
.ctx-sub {
  padding: 5px 12px 3px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Password Dialog */
.pw-dialog {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}
.pw-card {
  background: var(--bg-list);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 28px 24px;
  width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.pw-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.pw-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.pw-card input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  text-align: center;
  margin-bottom: 12px;
}
.pw-card input:focus {
  border-color: var(--accent);
}
.pw-card .pw-btns {
  display: flex;
  gap: 8px;
}
.pw-card .pw-btns button {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pw-card .pw-ok {
  background: var(--accent);
  color: var(--accent-text);
}
.pw-card .pw-cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
}
.pw-card .pw-err {
  color: var(--danger);
  font-size: 12px;
  min-height: 16px;
  margin-bottom: 8px;
}
.pw-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(229, 160, 13, 0.15);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.pw-header-icon .mi {
  font-size: 26px;
}
.pw-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.pw-btn-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pw-btn-choice:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}
.pw-btn-choice.danger:hover {
  border-color: var(--danger);
  background: rgba(255, 69, 58, 0.08);
}
.pw-btn-choice .mi {
  font-size: 20px;
  color: var(--accent);
  flex-shrink: 0;
}
.pw-btn-choice.danger .mi {
  color: var(--danger);
}
.pw-btn-choice strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.pw-btn-choice small {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.lock-nav-ic {
  color: var(--accent) !important;
}

/* Upload progress */
.upload-progress {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: var(--bg-list);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
}
.upload-progress .mi {
  font-size: 16px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile */
.mob-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
}
.mob-overlay.open {
  display: flex;
}
.mob-overlay .bdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.mob-overlay .sb-drawer {
  position: relative;
  width: 82%;
  max-width: 290px;
  height: 100%;
  z-index: 101;
}
.hamburger, .back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

@media(max-width: 860px) {
  .app { flex-direction: column; }
  .app > .sidebar { display: none; }
  .app > .note-list { width: 100%; min-width: 100%; flex: 1; }
  .app > .note-list.hidden { display: none; }
  .app > .editor-pane { width: 100%; flex: 1; }
  .app > .editor-pane.hidden { display: none; }
  .hamburger { display: flex; }
  .back-btn { display: flex; }
  .format-popover { right: 50px; }
}

/* Drag over on editor */
.ed-c.drag-over::after {
  content: 'Suelta la imagen aquí';
  position: absolute;
  inset: 0;
  background: var(--accent-soft);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--accent);
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
}

/* ═══ Trash List & Editor ═══ */
.trash-card {
  margin: 2px 8px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: 0.12s;
  position: relative;
}
.trash-card:hover {
  background: var(--bg-hover);
}
.trash-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.trash-actions button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: 0.15s;
}
.trash-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.trash-actions button.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255, 69, 58, 0.12);
}
.trash-actions button .mi {
  font-size: 15px;
}
.trash-info {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.trash-info .mi {
  font-size: 40px;
  opacity: 0.3;
}

/* Override browser autofill yellow backgrounds */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
}

input:autofill {
  background-color: var(--bg-input) !important;
  color: var(--text-primary) !important;
}
