:root {
  color-scheme: light;
  --sand: #cbbba8;
  --sand-dark: #b7a58f;
  --paper: #fffdf9;
  --paper-soft: #f6f1ea;
  --ink: #2e2b28;
  --muted: #756f68;
  --line: #ddd4ca;
  --accent: #ffad24;
  --accent-dark: #dc8211;
  --blue: #2e91c2;
  --green: #20b77e;
  --danger: #b83b36;
  --shadow: 0 18px 48px rgba(66, 53, 39, 0.18);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #bead97;
  color: var(--ink);
}
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, label.file-button { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.home-only, .folder-only, .smart-only { display: none !important; }
.app[data-view="folder"] .folder-only { display: grid !important; }
.app[data-view="smart"] .smart-only { display: inline-flex !important; }

.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 0.69rem; font-weight: 800; letter-spacing: 0.13em; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 14px; width: 100%; }
.status-line { min-height: 1.35em; margin: 12px 0 0; color: var(--muted); font-size: 0.88rem; }

input:not([type="checkbox"]), textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

input:not([type="checkbox"]):focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 173, 36, 0.16); }

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 4px;
}

label { display: grid; gap: 7px; color: var(--muted); font-size: 0.84rem; font-weight: 650; }

label.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  margin: 2px 0 6px;
}

.primary, .secondary, .danger, .file-button {
  min-height: 44px;
  border-radius: 12px;
  padding: 10px 15px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 750;
  text-align: center;
}

.primary { background: linear-gradient(180deg, #ffba3d, var(--accent)); color: #3f2b08; box-shadow: 0 7px 18px rgba(220, 130, 17, 0.2); }
.secondary, .file-button { background: #fff; border-color: var(--line); }
.file-button.disabled { opacity: .58; pointer-events: none; cursor: wait; }
.danger { background: var(--danger); color: #fff; }
.text-button, .danger-text { border: 0; background: none; padding: 8px; cursor: pointer; color: var(--muted); }
.danger-text { color: var(--danger); }
.centered { display: block; margin: 16px auto 90px; }

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.45), transparent 28%),
    radial-gradient(circle at 85% 80%, rgba(117,88,56,.15), transparent 30%),
    var(--sand);
}

.auth-card {
  width: min(100%, 410px);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 28px;
  padding: 32px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 8px 22px rgba(70,52,35,.2); margin-bottom: 20px; }
.auth-card h1 { margin: 0; font-size: 2rem; letter-spacing: -0.04em; }
.auth-card .muted { line-height: 1.45; margin: 8px 0 24px; }
.auth-actions { display: grid; gap: 6px; margin-top: 16px; }

.app {
  width: min(100%, 1180px);
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  background: var(--paper-soft);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  height: auto;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, .93);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: relative;
  z-index: 30;
}

.topbar h1 { margin: 0; font-size: 1.28rem; letter-spacing: -.025em; }
.app[data-view="folder"] .topbar,
.app[data-view="smart"] .topbar { color: #fff; border-color: rgba(255,255,255,.2); background: var(--active-folder-color, #258dc2); }
.app[data-view="folder"] .topbar .eyebrow,
.app[data-view="smart"] .topbar .eyebrow { color: rgba(255,255,255,.72); }
.app[data-view="folder"] .topbar .icon-button,
.app[data-view="smart"] .topbar .icon-button { color: #fff; }
.view-folder-icon { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.94); color: #27231f; display: grid; place-items: center; font-size: 1.55rem; box-shadow: 0 3px 10px rgba(50,35,20,.16); }
.view-folder-icon[hidden] { display: none; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  cursor: pointer;
}
.icon-button:hover { background: var(--paper-soft); }

.sync-pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 11px; cursor: pointer; font-size: .78rem; display: flex; gap: 6px; align-items: center; }
#sync-dot { color: var(--green); font-size: .65rem; }
.sync-pill.pending #sync-dot { color: var(--accent-dark); }
.sync-pill.error #sync-dot { color: var(--danger); }

.search-row { height: 62px; display: flex; gap: 8px; align-items: center; padding: 8px 16px; background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 25; }
.search-row input { background: var(--paper-soft); }

.workspace { height: calc(100dvh - 56px - env(safe-area-inset-top, 0px)); display: grid; grid-template-columns: 250px minmax(0, 390px) minmax(420px, 1fr); }
.workspace:has(.editor[hidden]) { grid-template-columns: 250px minmax(0, 1fr); }
.workspace:has(.editor[hidden]) .note-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.search-row:not([hidden]) + .workspace { height: calc(100dvh - 118px - env(safe-area-inset-top, 0px)); }

.sidebar { background: #e9e0d6; border-right: 1px solid var(--line); padding: 14px 10px 90px; overflow-y: auto; }
.sidebar-item { width: 100%; border: 0; background: transparent; border-radius: 11px; padding: 10px 11px; text-align: left; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.sidebar-item small { margin-left: auto; color: var(--muted); }
.sidebar-item.active { background: rgba(255,255,255,.75); font-weight: 750; box-shadow: 0 3px 10px rgba(80,63,45,.08); }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; margin: 20px 8px 7px; color: var(--muted); font-size: .69rem; font-weight: 800; letter-spacing: .1em; }
.sidebar-heading button { border: 0; background: none; font-size: 1.2rem; cursor: pointer; }
.folder-list { display: grid; gap: 3px; }
.folder-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.private-access { margin-top: 7px; color: #6b4a1f; background: rgba(255,255,255,.45); }
.smart-folder-icon { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: #fff; font-size: .86rem; box-shadow: inset 0 1px rgba(255,255,255,.3); }

.content {
  min-width: 0;
  padding-top: 14px;
  padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow-y: auto;
  overflow-x: hidden;
  background: #f2ece5;
  border-right: 1px solid var(--line);
}
.app[data-view="home"] .content {
  background-color: #bead97;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.28), transparent 25%),
    radial-gradient(circle at 85% 40%, rgba(85, 60, 35, 0.08), transparent 30%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 2px),
    repeating-linear-gradient(90deg, rgba(70, 50, 30, 0.025) 0px, rgba(70, 50, 30, 0.025) 1px, transparent 1px, transparent 2px);
}
#home-view {
  width: min(100%, 760px);
  margin: 0 auto;
  overflow-x: hidden;
  padding: 0 0 calc(70px + env(safe-area-inset-bottom, 0px));
}
.home-quick-panel {
  padding: 8px 10px 5px;
  border-radius: 14px;
  background: rgba(90, 72, 52, 0.18);
  margin-bottom: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.quick-note {
  width: 100%;
  min-height: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: #ffffff;
  color: #8c847d;
  text-align: left;
  padding: 0 12px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(50, 35, 20, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}
.quick-note-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.quick-note-icon svg {
  width: 17px;
  height: 17px;
}
.quick-tools {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 5px 2px 1px;
}
.quick-tools button {
  min-width: 0;
  height: 30px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.quick-tools button svg {
  width: 19px;
  height: 19px;
}
.quick-tools button:hover, .quick-tools button:active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin: 19px 4px 9px; }
.section-header h2 { margin: 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.note-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.note-card, .note-row { border: 1px solid #e5ded5; background: var(--paper); cursor: pointer; text-align: left; }
.note-card { min-height: 150px; border-radius: 10px; padding: 12px; overflow: hidden; }
.note-card h3, .note-row h3 { margin: 0 0 7px; font-size: .92rem; line-height: 1.22; }
.note-card p, .note-row p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.38; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.note-card p { -webkit-line-clamp: 6; }
.note-row p { -webkit-line-clamp: 2; }
.note-date { display: block; margin-top: 10px; color: #a19a92; font-size: .66rem; }

.recent-panel {
  padding: 8px 10px 10px;
  border-radius: 14px;
  background: rgba(90, 72, 52, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-bottom: 8px;
}
.recent-tabs {
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 0 2px;
}
.recent-tabs button {
  border: 0;
  padding: 1px 2px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.recent-tabs button.active {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.recent-tabs span { display: none; }
.recent-panel .note-grid {
  display: flex !important;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.recent-panel .note-grid::-webkit-scrollbar { display: none; }
.recent-panel .note-card {
  position: relative;
  flex: 0 0 94px;
  width: 94px;
  height: 98px;
  min-height: 98px;
  max-height: 98px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: #fdfbf7;
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: 0 2px 6px rgba(45, 30, 18, 0.15);
}
.recent-panel .note-card > :not(.note-card-image) { position: relative; z-index: 2; }
.recent-panel .note-card-image { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.recent-panel .note-card.has-image::after { content: ""; position: absolute; z-index: 1; inset: 0; background: linear-gradient(180deg, rgba(25,20,15,.06) 25%, rgba(25,20,15,.72)); }
.recent-panel .note-card.has-image h3, .recent-panel .note-card.has-image p, .recent-panel .note-card.has-image .note-date { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.recent-panel .note-card.has-image h3 { margin-top: 40px; }
.recent-panel .note-card h3 {
  margin: 0 0 3px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #2b2621;
  line-height: 1.15;
  -webkit-line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recent-panel .note-card p {
  margin: 0;
  color: #787067;
  font-size: 0.58rem;
  line-height: 1.2;
  -webkit-line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recent-panel .note-card .note-date {
  display: block;
  margin-top: 3px;
  color: #a8a096;
  font-size: 0.52rem;
}

.folder-grid {
  display: flex;
  gap: 0;
  margin-top: 4px;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
}
.folder-grid::-webkit-scrollbar { display: none; }
.folder-page {
  flex: 0 0 100%;
  min-width: 0;
  padding: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.folder-card {
  position: relative;
  min-height: 52px;
  height: 52px;
  border: 0;
  border-radius: 0 16px 14px 14px;
  color: #fff;
  padding: 4px 18px 4px 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  background: var(--folder-color);
  box-shadow: 0 3px 7px rgba(40, 28, 18, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  margin-top: 5px;
  transition: transform 0.12s ease;
}
.folder-card + .folder-card {
  margin-top: -6px;
}
.folder-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: -8px;
  width: 76px;
  height: 12px;
  background: var(--folder-color);
  border-radius: 12px 12px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.folder-card .folder-icon {
  position: absolute;
  left: 6px;
  top: -6px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  color: #222;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  z-index: 2;
}
.folder-card .folder-icon.plain {
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
  color: #fff;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.folder-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.folder-card small {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.88;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  padding-left: 6px;
}
.folder-pagination {
  min-height: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 6px 0 2px;
}
.folder-pagination button {
  width: 5px;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  transition: transform .16s ease, background .16s ease;
}
.folder-pagination button.active {
  background: #ffffff;
  transform: scale(1.3);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.list-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.list-toolbar select { width: auto; padding: 8px 30px 8px 10px; border-radius: 9px; font-size: .75rem; }
.view-toggle { min-height: 36px; border: 0; border-radius: 9px; padding: 6px 10px; background: rgba(255,255,255,.82); color: var(--muted); font-size: .72rem; font-weight: 750; cursor: pointer; }
.view-toggle span { margin-right: 3px; font-size: 1rem; vertical-align: -1px; }
.folder-quick-bar { --folder-color: #258dc2; display: flex; align-items: center; gap: 10px; margin: -14px -12px 12px; padding: 10px 14px; color: #fff; background: linear-gradient(115deg, color-mix(in srgb, var(--folder-color) 86%, #fff), var(--folder-color)); }
.folder-quick-bar[hidden] { display: none; }
.folder-quick-bar > span { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.92); color: #29241f; font-size: 1.2rem; }
.folder-quick-bar button { flex: 1; min-height: 42px; border: 0; border-radius: 11px; padding: 0 14px; background: rgba(255,255,255,.94); color: #756c63; text-align: left; cursor: pointer; }
.folder-quick-bar button strong { margin-right: 7px; color: var(--accent); font-size: 1.25rem; }
.notes-list { display: grid; gap: 8px; }
.notes-list.grid-view { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.notes-list.list-view { grid-template-columns: 1fr; gap: 8px; }
.notes-list.grid-view .note-card { position: relative; min-height: 140px; aspect-ratio: .76; padding: 8px 7px; border: 0; border-radius: 8px; background: #fdfbf7; box-shadow: 0 2px 7px rgba(53,39,25,.12); display: flex; flex-direction: column; }
.notes-list.grid-view .note-card > :not(.note-card-image) { position: relative; z-index: 2; }
.notes-list.grid-view .note-card-image { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.notes-list.grid-view .note-card.has-image::after { content: ""; position: absolute; z-index: 1; inset: 0; background: linear-gradient(180deg, rgba(25,20,15,.04) 35%, rgba(25,20,15,.76)); }
.notes-list.grid-view .note-card.has-image h3 { margin-top: auto; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.notes-list.grid-view .note-card.has-image p, .notes-list.grid-view .note-card.has-image .note-date { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.note-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(210, 195, 180, 0.45);
  background: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}
.note-row-icon {
  flex: 0 0 20px;
  color: #a89f94;
  font-size: 1.15rem;
  display: grid;
  place-items: center;
}
.note-row-body {
  flex: 1;
  min-width: 0;
}
.note-row-title {
  margin: 0 0 3px;
  font-size: 0.96rem;
  font-weight: 700;
  color: #221d18;
  line-height: 1.25;
  word-break: break-word;
}
.note-row-snippet {
  margin: 0;
  font-size: 0.76rem;
  color: #8c8276;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.note-row-stars {
  color: #ff9800;
  font-size: 0.74rem;
  letter-spacing: 1px;
}
.note-row-thumb {
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  background: #f0ebe4;
  box-shadow: 0 1px 4px rgba(40, 28, 18, 0.12);
  display: grid;
  place-items: center;
}
.note-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.note-row-bookmark {
  flex: 0 0 22px;
  color: #ff9800;
  display: grid;
  place-items: center;
}
.note-swipe { position: relative; min-width: 0; overflow: hidden; border-radius: 10px; background: #e7dfd5; }
.note-swipe > .note-card, .note-swipe > .note-row { position: relative; z-index: 2; width: 100%; height: 100%; transition: transform .22s cubic-bezier(.2,.75,.25,1); }
.note-swipe > .swiping { transition: none; }
.note-swipe.open > .note-card, .note-swipe.open > .note-row { transform: translateX(-168px); }
.note-swipe-actions { position: absolute; z-index: 1; inset: 0 0 0 auto; width: 168px; display: grid; grid-template-columns: repeat(3, 1fr); }
.note-swipe-actions button { border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; }
.note-swipe-actions .mark { background: #d5a02f; }
.note-swipe-actions .move { background: #4c88b9; }
.note-swipe-actions .remove { background: #c94e48; font-size: 1.6rem; }
.notes-list.grid-view .note-swipe { border-radius: 8px; }
.view-enter { animation: view-enter .26s cubic-bezier(.2,.7,.25,1); }
.editor-enter { animation: editor-enter .28s cubic-bezier(.2,.75,.25,1); }
@keyframes view-enter { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes editor-enter { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

.editor {
  min-width: 0;
  background: #faf6f0;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(240, 232, 220, 0.25) 100%),
    repeating-linear-gradient(0deg, rgba(180, 160, 140, 0.08) 0px, rgba(180, 160, 140, 0.08) 1px, transparent 1px, transparent 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.editor-toolbar {
  min-height: calc(48px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
  border-bottom: 1px solid rgba(190, 175, 160, 0.35);
  background: rgba(250, 246, 240, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
}
.editor-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: auto;
  min-height: 38px;
  padding: 0 8px 0 2px;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--accent);
  border: 0;
  background: transparent;
  cursor: pointer;
}
.editor-back-btn svg { width: 22px; height: 22px; }
.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.editor-header-actions .icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: #4a423a;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.editor-header-actions #bookmark-note { font-size: 1.4rem; }
.editor-scroll-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px calc(70px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}
.editor-note-header {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(190, 175, 160, 0.3);
}
.note-display-title {
  margin: 0 0 8px;
  font-size: 1.48rem;
  font-weight: 750;
  line-height: 1.25;
  color: #221e1a;
  letter-spacing: -0.025em;
  word-break: break-word;
}
.note-title-input {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0 0 6px;
  font-size: 1.48rem;
  font-weight: 750;
  line-height: 1.25;
  color: #221e1a;
  background: transparent;
  resize: none;
  font-family: inherit;
}
.note-title-input:focus, .note-edit-body:focus {
  outline: none;
  box-shadow: none;
}
.editor-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: #8c8378;
}
.note-date-text {
  font-size: 0.78rem;
  color: #92887e;
  font-weight: 500;
}
.editor-meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.editor-meta-right select {
  width: auto;
  max-width: 180px;
  padding: 4px 22px 4px 8px;
  background: rgba(225, 215, 200, 0.45);
  border: 0;
  border-radius: 7px;
  font-size: 0.74rem;
  color: #5a5046;
  font-weight: 600;
}
.note-star-rating {
  color: #f5a623;
  font-size: 0.88rem;
  letter-spacing: 1px;
}
.note-reading-body {
  font-size: 1.05rem;
  line-height: 1.68;
  color: #2c2722;
  word-break: break-word;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
  padding: 2px 0 10px;
}
.note-reading-body p {
  margin: 0 0 14px;
}
.note-reading-body a {
  color: #258dc2;
  text-decoration: underline;
  word-break: break-all;
}
.note-edit-body {
  width: 100%;
  min-height: 140px;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 4px 0 14px;
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.68;
  color: #2c2722;
  background: transparent;
}
.note-inline-images {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 12px 0 20px;
}
.note-inline-image-wrapper {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #f0ebe4;
  box-shadow: 0 3px 14px rgba(45, 32, 20, 0.12);
}
.note-inline-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  border-radius: 12px;
}
.editor-image-actions {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.editor-image-actions button { padding: 6px 12px; font-size: 0.75rem; border-radius: 8px; }
.editor-image-actions span { min-width: 0; color: var(--muted); font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-list { max-height: 120px; overflow-x: auto; display: flex; gap: 8px; padding: 6px 0; }
.attachment-item { flex: 0 0 110px; display: grid; gap: 3px; }
.attachment-button { min-width: 110px; height: 80px; border: 1px dashed var(--line); border-radius: 10px; background: var(--paper-soft); padding: 6px; font-size: .7rem; cursor: pointer; overflow: hidden; }
.attachment-button img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.attachment-button:has(img), .note-card-image { cursor: zoom-in; }
.attachment-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.attachment-controls button { height: 24px; padding: 0; border: 0; border-radius: 6px; background: var(--paper-soft); color: var(--muted); font-size: .9rem; cursor: pointer; }
.attachment-controls button:disabled { opacity: .3; cursor: default; }
.attachment-controls button.remove { color: var(--danger); }

.editor-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 620px;
  height: calc(48px + env(safe-area-inset-bottom, 0px));
  padding: 4px 16px env(safe-area-inset-bottom, 0px);
  border-top: 1px solid rgba(190, 175, 160, 0.35);
  background: rgba(250, 246, 240, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 65;
}
.editor-bottom-bar .save-status { color: #8c8378; font-size: 0.74rem; font-weight: 500; }
.editor-bottom-bar .icon-button {
  width: 42px;
  height: 42px;
  font-size: 1.35rem;
  color: #4a423a;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.bottom-nav { display: none; }

dialog { border: 0; padding: 0; border-radius: 22px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(40,32,25,.48); backdrop-filter: blur(3px); }
.image-viewer-dialog { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; padding: calc(58px + env(safe-area-inset-top)) 12px calc(46px + env(safe-area-inset-bottom)); background: rgba(10,10,10,.97); color: #fff; overflow: hidden; }
.image-viewer-dialog::backdrop { background: #000; }
.image-viewer-dialog[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 10px; }
.image-viewer-dialog img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 3px; touch-action: pinch-zoom; }
.image-viewer-close { position: fixed; z-index: 2; top: calc(10px + env(safe-area-inset-top)); right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.image-viewer-nav { position: fixed; z-index: 2; top: 50%; transform: translateY(-50%); width: 44px; height: 58px; border: 0; border-radius: 13px; background: rgba(255,255,255,.14); color: #fff; font-size: 2.4rem; line-height: 1; cursor: pointer; }
.image-viewer-nav.previous { left: 8px; }
.image-viewer-nav.next { right: 8px; }
.image-viewer-footer { width: min(90vw, 720px); display: flex; justify-content: center; gap: 12px; color: rgba(255,255,255,.8); font-size: .75rem; }
.image-viewer-caption { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-viewer-footer span { flex: 0 0 auto; }
.settings-dialog { width: min(92vw, 620px); max-height: 88dvh; overflow-y: auto; }
.dialog-header { position: sticky; top: 0; z-index: 3; background: rgba(255,253,249,.95); display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.dialog-header h2, .confirm-dialog h2 { margin: 0; }
.settings-section { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 8px; font-size: 1rem; }
.settings-section .muted { font-size: .84rem; line-height: 1.45; }
.privacy-note { margin: 10px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.button-row.end { justify-content: flex-end; }
.warning { color: #8b5a17; background: #fff4d8; border-radius: 10px; padding: 10px; font-size: .78rem; line-height: 1.4; }
progress { width: 100%; margin-top: 14px; accent-color: var(--accent); }
.confirm-dialog { width: min(88vw, 420px); padding: 24px; }
.confirm-dialog p { color: var(--muted); line-height: 1.5; }
.move-note-dialog { width: min(88vw, 420px); }
.move-note-dialog form { display: grid; gap: 16px; padding: 24px; }
.move-note-dialog h2 { margin: 0; }
.pin-dialog { width: min(90vw, 420px); }
.pin-dialog form { display: grid; gap: 14px; padding: 24px; }
.pin-dialog h2, .pin-dialog p { margin: 0; }
.pin-dialog label { display: grid; gap: 7px; font-size: .82rem; font-weight: 700; }
.pin-dialog input { text-align: center; font-size: 1.5rem; letter-spacing: .55em; padding-left: calc(14px + .55em); font-variant-numeric: tabular-nums; }
.folder-dialog { width: min(90vw, 440px); max-height: 90dvh; overflow-y: auto; }
.folder-dialog form { display: grid; gap: 18px; padding: 24px; }
.folder-dialog h2 { margin: 2px 0 0; }
.folder-color-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.folder-color-fieldset legend { margin-bottom: 9px; color: var(--muted); font-size: .84rem; font-weight: 650; }
.folder-color-options { display: grid; grid-template-columns: repeat(5, 44px); gap: 10px; }
.folder-color-options > button, .custom-folder-color { width: 44px; height: 44px; padding: 0; border: 3px solid rgba(255,255,255,.95); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--line), 0 3px 8px rgba(55,40,24,.12); cursor: pointer; }
.folder-color-options > button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--accent); }
.custom-folder-color { position: relative; display: grid; place-items: center; overflow: hidden; background: conic-gradient(#f44, #fc3, #4b5, #2ad, #75e, #f48, #f44); color: #fff; }
.custom-folder-color input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.custom-folder-color span { font-size: 1.35rem; text-shadow: 0 1px 3px rgba(0,0,0,.35); pointer-events: none; }
.folder-preview { min-height: 62px; border-radius: 15px; padding: 10px 16px; display: flex; align-items: center; gap: 13px; color: #fff; background: linear-gradient(115deg, color-mix(in srgb, var(--folder-color) 88%, #fff), var(--folder-color)); box-shadow: inset 0 1px rgba(255,255,255,.25), 0 5px 14px rgba(53,39,25,.12); }
.folder-preview span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.94); color: #222; }
.folder-preview strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-icon-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.folder-icon-fieldset legend { margin-bottom: 9px; color: var(--muted); font-size: .84rem; font-weight: 650; }
.folder-icon-options { display: grid; grid-template-columns: repeat(5, 44px); gap: 10px; }
.folder-icon-options button { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 13px; background: #fff; font-size: 1.35rem; cursor: pointer; }
.folder-icon-options button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,173,36,.18); }
.folder-edit-actions { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.folder-edit-actions[hidden] { display: none; }
.folder-order-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.folder-edit-actions .danger { justify-self: start; }
.folder-edit-actions button:disabled { opacity: .38; cursor: default; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(88vw, 520px); border-radius: 999px; padding: 11px 16px; background: #26231f; color: #fff; box-shadow: var(--shadow); font-size: .84rem; }

@media (max-width: 900px) {
  .app {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 620px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .workspace {
    position: absolute;
    top: calc(52px + env(safe-area-inset-top, 0px));
    bottom: calc(50px + env(safe-area-inset-bottom, 20px));
    left: 0;
    right: 0;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }
  .workspace:has(.editor[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .workspace:has(.editor[hidden]) .note-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { position: fixed; z-index: 50; top: calc(52px + env(safe-area-inset-top, 0px)); bottom: 0; left: max(0px, calc(50% - 310px)); width: min(84vw, 320px); transform: translateX(-110%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: 0;
  }
  .app .topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-bottom: 6px;
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
    z-index: 30;
  }
  .app[data-view="home"] .topbar { border-bottom: 0; background: #bead97; display: flex; justify-content: space-between; align-items: center; }
  .app[data-view="home"] .topbar > div:not(.top-actions) { display: none; }
  .app[data-view="home"] #sidebar-toggle { display: none !important; }
  .app[data-view="home"] .top-actions { width: 100%; display: flex; justify-content: space-between; align-items: center; }
  .app[data-view="home"] .home-only { display: inline-flex !important; }
  .app[data-view="home"] #settings-button { order: -1; font-size: 1.45rem; }
  .app[data-view="home"] .home-right-actions { display: flex; align-items: center; gap: 8px; }
  .app[data-view="home"] #sync-button { display: none; }
  .app[data-view="home"] .topbar .icon-button, .app[data-view="home"] .sync-pill { color: rgba(255,255,255,.95); filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
  .app[data-view="home"] .topbar .sync-pill { border-color: transparent; background: transparent; }
  .app[data-view="home"] .content {
    padding-top: 4px;
    padding-bottom: 6px;
    padding-left: 14px;
    padding-right: 14px;
  }
  #home-view {
    width: 100%;
    min-height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .folder-quick-bar { display: none !important; }
  .list-toolbar {
    margin-bottom: 6px;
    gap: 6px;
  }
  .list-toolbar #notes-summary {
    font-size: 0.74rem;
    color: #7d7265;
  }
  .list-toolbar .view-toggle {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 0.68rem;
  }
  .list-toolbar select {
    padding: 4px 22px 4px 8px;
    font-size: 0.68rem;
  }
  .notes-list.grid-view {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .notes-list.grid-view .note-card {
    min-height: 120px;
    aspect-ratio: 0.74;
    padding: 6px 5px;
    border-radius: 7px;
  }
  .search-row {
    position: fixed;
    z-index: 55;
    top: calc(48px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 620px);
    height: 52px;
    padding: 6px 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  }
  .app:not([data-view="home"]) .content {
    padding-top: 8px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 12px;
  }
  .editor { position: fixed; z-index: 60; inset: 0 max(0px, calc(50% - 310px)) 0; width: min(100%, 620px); }
  .mobile-only { display: grid; }
  .bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    height: calc(50px + env(safe-area-inset-bottom, 20px));
    padding-top: 4px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(185, 168, 149, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
  }
  .bottom-nav button {
    border: 0;
    background: transparent;
    color: #65584b;
    font-size: 0.68rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    padding: 0;
  }
  .bottom-nav button span { line-height: 1; }
  .bottom-nav button.active {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
  .bottom-nav button.active svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  }
  .bottom-nav .new-note {
    width: 48px;
    height: 48px;
    align-self: center;
    justify-self: center;
    margin-bottom: 4px;
    border-radius: 50%;
    color: #ffffff;
    background: linear-gradient(180deg, #ffc247, #ff9800);
    box-shadow: 0 3px 12px rgba(220, 130, 0, 0.45);
    display: grid;
    place-items: center;
  }
  .bottom-nav .new-note span { font-size: 1.9rem; font-weight: 700; line-height: 1; }
  .bottom-nav button.syncing-active svg, .sync-pill.syncing-active svg {
    animation: sync-spin 0.85s linear infinite;
    color: #ffad24;
  }
  @keyframes sync-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
}

@media (min-width: 901px) {
  .mobile-only { display: none; }
  #editor[hidden] + * { display: initial; }
}

@media (max-width: 430px) {
  .topbar {
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    padding-bottom: 6px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .app:not([data-view="home"]) .topbar { gap: 6px; }
  .app[data-view="folder"] .topbar { color: #fff; border-color: rgba(255,255,255,.2); background: var(--active-folder-color, #258dc2); }
  .app[data-view="folder"] .topbar .eyebrow { color: rgba(255,255,255,.72); }
  .app:not([data-view="home"]) .topbar > div:not(.top-actions) { min-width: 0; flex: 1 1 auto; }
  .app:not([data-view="home"]) .topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.15rem; }
  .app:not([data-view="home"]) .topbar .eyebrow { margin-bottom: 1px; font-size: .56rem; }
  .app:not([data-view="home"]) .top-actions { flex: 0 0 auto; gap: 2px; }
  .app:not([data-view="home"]) .topbar .icon-button { width: 36px; height: 38px; font-size: 1.12rem; }
  .app:not([data-view="home"]) #sidebar-toggle { width: 36px; height: 38px; font-size: 1.12rem; }
  .app:not([data-view="home"]) .view-folder-icon { width: 40px; height: 40px; flex-basis: 40px; font-size: 1.25rem; }
  .app:not([data-view="home"]) .sync-pill { width: 36px; height: 36px; padding: 0; border-color: rgba(255,255,255,.48); background: rgba(255,255,255,.12); }
  .app[data-view="folder"] #settings-button { display: none; }
  .sync-pill span:last-child { display: none; }
  .sync-pill { width: 38px; height: 38px; justify-content: center; padding: 0; }
  .content {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
  }
  .app[data-view="home"] .content {
    padding-top: 0;
    padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px));
  }
  .list-toolbar { align-items: center; }
  .list-toolbar-actions { gap: 6px; }
  .list-toolbar select { max-width: 135px; padding-left: 8px; font-size: .72rem; }
  .view-toggle { padding-left: 8px; padding-right: 8px; font-size: .72rem; }
  .notes-list.grid-view { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .notes-list.grid-view .note-card { min-height: 125px; padding: 6px 5px; border-radius: 7px; }
  .notes-list.grid-view .note-card h3 { font-size: .66rem; line-height: 1.15; }
  .notes-list.grid-view .note-card p { font-size: .55rem; line-height: 1.18; -webkit-line-clamp: 3; }
  .notes-list.grid-view .note-card.has-image h3 { margin-top: auto; }

  /* Panel nota rápida muy compacto */
  .home-quick-panel {
    margin-bottom: 6px;
    padding: 6px 9px 3px;
    border-radius: 13px;
  }
  .quick-note {
    min-height: 35px;
    height: 35px;
    font-size: 0.88rem;
    border-radius: 8px;
    padding: 0 10px;
    gap: 7px;
  }
  .quick-note-icon svg { width: 16px; height: 16px; }
  .quick-tools { padding-top: 4px; gap: 2px; }
  .quick-tools button { height: 28px; }
  .quick-tools button svg { width: 18px; height: 18px; }

  .app[data-view="home"] .content {
    padding-top: 6px;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-left: 14px;
    padding-right: 14px;
  }

  /* Recientes con tarjetas de proporción idéntica a la original */
  .recent-panel {
    padding: 7px 10px 8px;
    border-radius: 14px;
    margin-bottom: 8px;
  }
  .recent-tabs {
    min-height: 18px;
    margin-bottom: 5px;
    gap: 10px;
  }
  .recent-tabs button {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 1px 2px;
  }
  .recent-panel .note-grid {
    gap: 7px;
    padding-bottom: 2px;
  }
  .recent-panel .note-card {
    flex: 0 0 86px;
    width: 86px;
    height: 100px;
    min-height: 100px;
    max-height: 100px;
    padding: 6px 7px;
    border-radius: 8px;
  }
  .recent-panel .note-card h3 {
    margin-bottom: 2px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.15;
    -webkit-line-clamp: 3;
  }
  .recent-panel .note-card p {
    font-size: 0.56rem;
    line-height: 1.18;
    -webkit-line-clamp: 4;
  }
  .recent-panel .note-card .note-date {
    display: none;
  }
  .recent-panel .note-card.has-image h3 { margin-top: 38px; }

  /* Carpetas amplias, con pestaña y círculos idénticos a la original ocupando la pantalla */
  .folder-grid {
    margin-top: 4px;
    padding: 0;
  }
  .folder-page {
    padding: 8px 0 0;
    gap: 0;
  }
  .folder-card {
    position: relative;
    min-height: 54px;
    height: 54px;
    padding: 4px 18px 4px 72px;
    border-radius: 0 16px 14px 14px;
    margin-top: 6px;
    box-shadow: 0 3px 8px rgba(35, 22, 12, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  .folder-card + .folder-card {
    margin-top: -6px;
  }
  .folder-card::before {
    top: -9px;
    left: 0;
    width: 78px;
    height: 13px;
    border-radius: 14px 14px 0 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }
  .folder-card .folder-icon {
    left: 8px;
    top: -6px;
    width: 54px;
    height: 54px;
    font-size: 1.65rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  }
  .folder-card strong {
    font-size: 1.12rem;
    font-weight: 750;
    letter-spacing: 0.02em;
  }
  .folder-card small {
    font-size: 0.88rem;
    font-weight: 700;
    opacity: 0.92;
  }
  .folder-pagination {
    min-height: 18px;
    padding: 10px 0 2px;
    gap: 7px;
  }
  .folder-pagination button {
    width: 6px;
    height: 6px;
  }
  .folder-pagination button.active {
    width: 7px;
    height: 7px;
  }
  .auth-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
