/* Notas — sistema de diseño (Minimalism & Swiss, teal + acento naranja) */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #f6fbf9;
  --surface: #ffffff;
  --surface-2: #eef7f4;
  --surface-3: #e3f1ed;
  --text: #10332f;
  --text-muted: #526e69;
  --border: #d5e8e3;
  --border-strong: #b9d8d1;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: #ccfbf1;
  --on-primary: #ffffff;
  --accent: #ea580c;
  --accent-text: #c2410c;
  --accent-soft: #ffedd5;
  --on-accent: #1a0d04;
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --danger-soft: #fee2e2;
  --ring: #0f766e;
  --shadow-sm: 0 1px 2px rgba(16, 51, 47, 0.06);
  --shadow-md: 0 6px 16px rgba(16, 51, 47, 0.08);
  --shadow-lg: 0 20px 40px rgba(16, 51, 47, 0.16);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 340px;
  --bottom-nav-h: 60px;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1514;
  --surface: #10201e;
  --surface-2: #16302c;
  --surface-3: #1d3b36;
  --text: #e6f4f1;
  --text-muted: #9db8b3;
  --border: #24413c;
  --border-strong: #315a53;
  --primary: #2dd4bf;
  --primary-hover: #5eead4;
  --primary-soft: #134e4a;
  --on-primary: #042f2e;
  --accent: #fb923c;
  --accent-text: #fb923c;
  --accent-soft: #431407;
  --on-accent: #1a0d04;
  --danger: #f87171;
  --danger-text: #f87171;
  --danger-soft: #450a0a;
  --ring: #2dd4bf;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.icon {
  display: inline-block;
  flex: none;
  vertical-align: middle;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.8125rem;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: 8px;
}

/* ---------- Botones ---------- */

.btn-primary,
.btn-ghost,
.btn-danger,
.btn-accent,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  transition: background-color 180ms ease, color 180ms ease,
    border-color 180ms ease, box-shadow 180ms ease;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

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

.btn-accent:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

.icon-btn {
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 10px;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn.small {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
}

.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
}

/* ---------- Campos ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 400;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.form-ok {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-card h3 {
  margin-top: 4px;
  font-size: 1rem;
}

.form-card code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.token-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.token-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.token-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.token-rules,
.token-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.token-rule-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.token-rule-add select {
  flex: 1 1 160px;
  width: auto;
  min-width: 0;
}

.token-rule-add .btn-ghost {
  flex: 0 0 auto;
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.875rem;
}

.rule-remove {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.rule-remove:hover {
  background: var(--surface);
  color: var(--text);
}

.token-value {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: vertical;
  overflow-wrap: anywhere;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ---------- Barra de formato ---------- */

.format-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.format-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  transition: background-color 150ms ease, color 150ms ease;
}

.format-btn:hover {
  background: var(--surface-2);
}

.format-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

.format-sep {
  flex: 0 0 auto;
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: var(--border);
}

.fmt-bold {
  font-weight: 800;
}

.fmt-italic {
  font-style: italic;
  font-weight: 700;
}

.fmt-strike {
  text-decoration: line-through;
}

.editor > .format-bar {
  margin-top: 10px;
}

.field > .format-bar {
  margin-top: 2px;
}

/* ---------- Shell ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 700;
}

.brand:hover {
  text-decoration: none;
}

.header-actions {
  display: flex;
  gap: 2px;
}

.theme-icon {
  display: none;
}

[data-theme-pref="system"] .theme-system,
[data-theme-pref="light"] .theme-light,
[data-theme-pref="dark"] .theme-dark {
  display: inline-flex;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 12px 16px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
}

.search input::placeholder {
  color: var(--text-muted);
}

.search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.search-clear {
  display: inline-flex;
  color: var(--text-muted);
}

.sidebar-shortcuts {
  padding: 0 16px 8px;
}

.sidebar-quick {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.sidebar-quick:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-quick .icon {
  color: var(--primary);
}

.folders {
  max-height: 34vh;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
}

.section-head h2 {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.count {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.folder-tree,
.folder-children {
  margin: 0;
  padding: 0;
  list-style: none;
}

.folder-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.folder-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.folder-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.folder-toggle .icon {
  transition: transform 160ms ease;
}

.folder-toggle[aria-expanded="true"] .icon {
  transform: rotate(90deg);
}

.folder-toggle-spacer {
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding-left: calc(var(--depth, 0) * 14px + 4px);
  border-radius: var(--radius-sm);
}

.folder-row:hover {
  background: var(--surface-2);
}

.folder-row.is-active {
  background: var(--primary-soft);
}

.folder-link {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9375rem;
}

.folder-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-row.is-active .folder-link {
  color: var(--primary);
  font-weight: 600;
}

.folder-menu {
  opacity: 0.45;
}

.folder-row:hover .folder-menu,
.folder-row:focus-within .folder-menu {
  opacity: 1;
}

.folder-empty {
  padding: 8px 12px;
}

.notes-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
}

.note-items {
  flex: 1;
  margin: 0;
  padding: 0 8px 8px;
  overflow-y: auto;
  list-style: none;
}

.note-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.note-item:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.note-item.is-active {
  background: var(--primary-soft);
}

.note-item.is-active .note-title {
  color: var(--primary);
  font-weight: 600;
}

[data-theme="dark"] .note-item.is-active .note-date,
[data-theme="dark"] .note-item.is-active .note-path {
  color: #c9ded9;
}

.note-title {
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-date,
.note-path {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  color: var(--text-muted);
  text-align: center;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-footer form {
  margin: 0;
}

.user {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Workspace y editor ---------- */

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
  background: var(--bg);
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.save-status {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.save-status.is-error {
  color: var(--danger-text);
  font-weight: 600;
}

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

.editor {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 24px clamp(16px, 4vw, 48px) 0;
}

.note-title-input {
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(1.6rem, 2.8vw, 2.15rem);
  font-weight: 700;
  line-height: 1.2;
}

.note-title-input:focus {
  outline: none;
}

.note-title-input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 4px;
  border-radius: 6px;
}

.note-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.editor-panes {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin-top: 12px;
}

.note-content {
  flex: 1;
  width: 100%;
  min-height: 40vh;
  padding: 8px 0 96px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  line-height: 1.7;
  resize: none;
}

.note-content:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 4px;
  border-radius: 6px;
}

.preview {
  flex: 1;
  padding: 8px 0 96px;
  overflow-y: auto;
}

.empty-state {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 24px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state .icon {
  color: var(--primary);
}

.empty-state h1 {
  color: var(--text);
  font-size: 1.5rem;
}

/* ---------- Markdown ---------- */

.prose {
  max-width: 75ch;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin: 1.4em 0 0.5em;
  line-height: 1.25;
}

.prose h1 {
  font-size: 1.6rem;
}

.prose h2 {
  font-size: 1.35rem;
}

.prose h3 {
  font-size: 1.15rem;
}

.prose p {
  margin: 0.8em 0;
}

.prose ul,
.prose ol {
  margin: 0.8em 0;
  padding-left: 1.3em;
}

.prose code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.prose pre {
  padding: 14px;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--surface-2);
}

.prose pre code {
  padding: 0;
  background: transparent;
}

.prose blockquote {
  margin: 1em 0;
  padding-left: 14px;
  border-left: 3px solid var(--primary);
  color: var(--text-muted);
}

.prose table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}

.prose img {
  max-width: 100%;
  height: auto;
}

.prose a {
  text-decoration: underline;
}

/* ---------- Diálogos ---------- */

.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.dialog-wide {
  width: min(780px, calc(100vw - 32px));
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.history-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 60vh;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.history-item:hover {
  background: var(--surface-2);
}

.history-item.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.history-date {
  font-size: 0.875rem;
  font-weight: 600;
}

.history-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.history-preview {
  max-height: 280px;
  padding: 12px;
  overflow: auto;
  border-radius: 10px;
  background: var(--surface-2);
}

.history-preview pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog::backdrop {
  background: rgba(4, 20, 18, 0.55);
  backdrop-filter: blur(2px);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.dialog-form header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dialog-form h2 {
  font-size: 1.125rem;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.spacer {
  flex: 1;
}

/* ---------- Navegación inferior ---------- */

.bottom-nav {
  display: none;
}

/* ---------- Login ---------- */

.login-page {
  display: grid;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
}

.login-shell {
  display: grid;
  width: 100%;
  place-items: center;
}

.login-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(420px, 100%);
  padding: clamp(24px, 5vw, 36px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-size: 1.125rem;
  font-weight: 700;
}

.login-card h1 {
  font-size: 1.75rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.login-form .btn-primary {
  width: 100%;
}

.theme-login {
  position: absolute;
  top: 12px;
  right: 12px;
}

.login-foot {
  margin-top: 4px;
  text-align: center;
}

/* ---------- Recordatorios ---------- */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-bar h1 {
  flex: 1;
  font-size: 1.125rem;
  text-align: center;
}

.page-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 32px) calc(var(--bottom-nav-h) + 32px);
}

.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-card h2 {
  font-size: 1.125rem;
}

.form-card .btn-primary {
  align-self: flex-start;
}

.reminders ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reminder-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 44px;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.reminder-item.is-done {
  opacity: 0.65;
}

.reminder-item.is-done .reminder-title {
  text-decoration: line-through;
}

.reminder-check {
  width: 22px;
  height: 22px;
  margin: 11px;
  accent-color: var(--primary);
}

.reminder-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.reminder-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.reminder-body {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.reminder-body p {
  margin: 0;
}

.reminder-body p + p {
  margin-top: 0.35em;
}

.reminder-body strong,
.reminder-body b {
  color: var(--text);
  font-weight: 700;
}

.reminder-body h1,
.reminder-body h2,
.reminder-body h3 {
  margin: 0.3em 0 0.15em;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.3;
}

.reminder-body ul,
.reminder-body ol {
  margin: 0.2em 0;
  padding-left: 1.2em;
}

.reminder-body code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.reminder-body pre {
  padding: 8px 10px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--surface-2);
}

.reminder-body pre code {
  padding: 0;
  background: transparent;
}

.reminder-body blockquote {
  margin: 0.3em 0;
  padding-left: 10px;
  border-left: 2px solid var(--primary);
}

.reminder-body a {
  text-decoration: underline;
}

.reminder-due {
  color: var(--text-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.reminder-due.is-overdue {
  color: var(--accent-text);
  font-weight: 700;
}

.reminder-delete {
  justify-self: end;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  :root {
    --sidebar-w: 300px;
  }
}

@media (min-width: 1440px) {
  :root {
    --sidebar-w: 380px;
  }
}

@media (max-width: 900px) {
  .app {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: 100dvh;
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 8px);
    border-right: 0;
  }

  .workspace {
    display: none;
    min-height: 100dvh;
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 8px);
  }

  body.note-open .sidebar {
    display: none;
  }

  body.note-open .workspace {
    display: flex;
  }

  .sidebar-shortcuts {
    display: none;
  }

  .folders {
    max-height: none;
    overflow: visible;
  }

  .notes-list,
  .note-items {
    overflow: visible;
  }

  .editor {
    padding: 12px 16px 0;
  }

  .editor-bar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .note-content {
    min-height: 55vh;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    background: var(--surface);
  }

  .bottom-nav a {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--bottom-nav-h);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
  }

  .bottom-nav a:hover {
    background: var(--surface-2);
    text-decoration: none;
  }

  .bottom-nav a.is-active {
    color: var(--primary);
  }

  .page-main {
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 24px);
  }
}

@media (max-width: 600px) {
  .reminder-item {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .reminder-due {
    grid-column: 2;
    grid-row: 2;
    white-space: normal;
  }

  .reminder-delete {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .form-card .btn-primary {
    width: 100%;
  }

  .editor-actions .btn-ghost span {
    display: none;
  }
}

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