/* ── Cuadernos (cuadernos.js) ───────────────────────────────────────────── */
.layout.nb-mode { grid-template-columns: 1fr; }
.layout.nb-mode > .side-panel { display: none; }
@media (max-width: 700px) { .layout.nb-mode { grid-template-rows: 1fr; } }

.nb-panel { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); min-height: 0; }
.nb-body { flex: 1; display: flex; min-height: 0; }

/* Lateral: cuadernos + páginas */
.nb-side { width: 250px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.nb-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.nb-side-title { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin: 14px 4px 4px; }
.nb-new { padding: 3px 9px; font-size: 11px; }
.nb-list { display: flex; flex-direction: column; gap: 2px; }
.nb-hint { font-size: 12px; color: var(--muted); padding: 6px 4px; }
.nb-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 7px; color: var(--text); padding: 7px 8px; font: inherit; font-size: 13px; cursor: pointer; }
.nb-item:hover { background: var(--surface2); }
.nb-item.active { background: var(--accent-dim); border-color: var(--accent); }
.nb-item-ic { display: inline-flex; flex-shrink: 0; color: var(--muted); }
.nb-item.active .nb-item-ic { color: var(--accent); }
.nb-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-page { display: flex; align-items: center; border-radius: 6px; }
.nb-page:hover { background: var(--surface2); }
.nb-page.active { background: var(--surface2); box-shadow: inset 2px 0 0 var(--accent); }
.nb-page-title { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-size: 12px; padding: 6px 8px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-page-tools { display: none; gap: 2px; padding-right: 4px; }
.nb-page:hover .nb-page-tools, .nb-page.active .nb-page-tools { display: flex; }
.nb-page-tools button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 4px; }
.nb-page-tools button:hover:not(:disabled) { color: var(--text); background: var(--border); }
.nb-page-tools button:disabled { opacity: .3; cursor: default; }
.nb-add { margin-top: 6px; font-size: 12px; }

/* Principal: barra + editor + pie */
.nb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nb-toolbar { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.nb-toolbar .btn { padding: 4px 9px; font-size: 12px; }
.nb-nb-title { background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: text; padding: 2px 4px; border-radius: 5px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-nb-title:hover { background: var(--surface2); }
.nb-kind { font-size: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 1px 7px; }

.nb-main { --nb-desk: #090909; --nb-sheet: #131313; }
/* Toda el área (márgenes incluidos) hace el scroll: la rueda funciona en cualquier punto
   y la barra queda en la orilla derecha. El textarea crece con su contenido (nbAutoGrow). */
.nb-scroll { flex: 1; min-height: 0; overflow-y: auto; background: var(--nb-desk); scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; }
.nb-scroll::-webkit-scrollbar { width: 10px; }
.nb-scroll::-webkit-scrollbar-track { background: transparent; }
.nb-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; border: 2px solid var(--nb-desk); }
.nb-scroll::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }
/* La hoja: tono un poco más claro que la "mesa" de los costados */
.nb-editor { min-height: 100%; display: flex; flex-direction: column; width: 100%; max-width: var(--nb-w, 760px); margin: 0 auto; padding: 22px 36px 0; background: var(--nb-sheet); border-left: 1px solid #1f1f1f; border-right: 1px solid #1f1f1f; transition: max-width .2s; }
.nb-editor.nb-w-full { border-left: 0; border-right: 0; }
.nb-page-head { display: flex; align-items: center; gap: 8px; }
.nb-title-input { flex: 1; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 24px; font-weight: 700; padding: 4px 0 10px; }
.nb-page-del { display: inline-flex; background: none; border: 0; color: var(--muted); cursor: pointer; opacity: .6; padding: 4px; border-radius: 5px; }
.nb-page-del:hover { opacity: 1; color: var(--red); background: var(--surface2); }
.nb-textarea { flex: 0 0 auto; min-height: 60vh; width: 100%; resize: none; overflow: hidden; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: var(--nb-fs, 16px); line-height: 1.75; padding: 4px 0 40px; }
.nb-serif .nb-textarea, .nb-serif .nb-preview, .nb-serif .nb-title-input { font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif; }
.nb-serif .nb-textarea, .nb-serif .nb-preview { font-size: var(--nb-fs, 17px); }
.nb-fs { display: inline-flex; gap: 2px; }
.nb-toolbar .icon-btn { display: inline-flex; align-items: center; }
/* Cursor de escritura: rayita normal en color de acento (el guion bajo se veía muy poco) */
.nb-textarea, .nb-title-input { caret-color: var(--accent); }
.nb-toolbar .btn.active { background: var(--accent-dim); border-color: var(--accent); }

/* Vista Markdown (👁 Ver) */
.nb-preview { flex: 1;color: var(--text); font-size: var(--nb-fs, 16px); line-height: 1.75; padding: 4px 0 40px; overflow-wrap: anywhere; }
.nb-md > :first-child { margin-top: 0; }
.nb-md h1, .nb-md h2, .nb-md h3, .nb-md h4, .nb-md h5, .nb-md h6 { line-height: 1.3; margin: 1.2em 0 .4em; }
.nb-md h1 { font-size: 1.6em; } .nb-md h2 { font-size: 1.35em; } .nb-md h3 { font-size: 1.15em; } .nb-md h4, .nb-md h5, .nb-md h6 { font-size: 1em; }
.nb-md p { margin: 0 0 .8em; }
.nb-md ul, .nb-md ol { margin: 0 0 .8em; padding-left: 1.5em; }
.nb-md li.nb-task { list-style: none; margin-left: -1.3em; }
.nb-md li.nb-task input { margin-right: 4px; cursor: pointer; accent-color: var(--accent); }
.nb-md li.nb-task.done { color: var(--muted); text-decoration: line-through; }
.nb-md blockquote { margin: 0 0 .8em; padding: 2px 0 2px 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.nb-md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--surface2); border-radius: 4px; padding: 1px 5px; }
.nb-md pre { background: var(--surface2); border-radius: 8px; padding: 10px 14px; overflow-x: auto; margin: 0 0 .8em; }
.nb-md pre code { background: none; padding: 0; }
.nb-md hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }
.nb-md a { color: var(--accent); }
.nb-md img { max-width: 100%; border-radius: 6px; }
.nb-md mark { background: rgba(250, 204, 21, .35); color: inherit; border-radius: 2px; }
.nb-md-empty { color: var(--muted); font-style: italic; }
.nb-footer { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 7px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); background: var(--surface); }
.nb-goal { display: inline-flex; align-items: center; gap: 6px; }
.nb-bar { display: inline-block; width: 70px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.nb-bar span { display: block; height: 100%; background: var(--green); transition: width .3s; }
.nb-status { margin-left: auto; color: var(--green); }
.nb-streak { display: inline-flex; align-items: center; gap: 4px; }
.nb-streak svg { width: 13px; height: 13px; color: #f59e0b; }

.nb-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 0 24px; }
.nb-empty-title { font-size: 16px; font-weight: 700; }
.nb-empty-sub { font-size: 13px; color: var(--muted); max-width: 420px; line-height: 1.7; margin-bottom: 8px; }

/* Estantería: tarjetas de cuadernos (vista de entrada) */
.nb-shelf { flex: 1; overflow-y: auto; padding: 24px 28px 40px; }
.nb-shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto 18px; }
.nb-shelf-title { font-size: 20px; font-weight: 700; }
.nb-tabs { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.nb-tab { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.nb-tab:hover { color: var(--text); }
.nb-tab.active { background: var(--accent-dim); color: var(--text); }
.nb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; max-width: 1100px; margin: 0 auto; }
.nb-card { display: flex; flex-direction: column; text-align: left; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; color: var(--text); font: inherit; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.nb-card:hover, .nb-card:focus-visible { transform: translateY(-3px); border-color: var(--nb-c, var(--accent)); box-shadow: 0 8px 24px rgba(0,0,0,.4); outline: none; }
/* Portada tipo libreta: lomo más oscuro a la izquierda */
.nb-card-cover { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 130px; padding: 14px 14px 12px 24px; background: linear-gradient(135deg, var(--nb-c), color-mix(in srgb, var(--nb-c) 60%, #000)); color: #fff; }
.nb-card-cover::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; background: rgba(0,0,0,.28); box-shadow: 1px 0 0 rgba(255,255,255,.12); }
.nb-card-ic { display: inline-flex; opacity: .85; }
.nb-card-ic svg { width: 20px; height: 20px; }
.nb-card-title { font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nb-card-kind { margin-top: auto; align-self: flex-start; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 2px 8px; }
.nb-card-info { display: flex; flex-direction: column; gap: 5px; padding: 10px 14px 12px; font-size: 12px; color: var(--muted); }
.nb-card-meta { color: var(--text); }
.nb-card-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-card-last strong { color: var(--text); font-weight: 600; }
.nb-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.nb-card-goal .nb-bar { width: 100%; }
.nb-card-new { align-items: center; justify-content: center; gap: 6px; min-height: 200px; background: none; border: 2px dashed var(--border); color: var(--muted); font-size: 13px; }
.nb-card-new span { font-size: 30px; line-height: 1; }
.nb-card-new:hover { color: var(--text); border-color: var(--accent); }
.nb-to-shelf { background: none; border: 0; cursor: pointer; font-family: inherit; }
.nb-to-shelf:hover { color: var(--text); }
.nb-toolbar .nb-back { font-size: 16px; line-height: 1; padding: 2px 9px; }

/* Modo enfoque: solo la hoja */
.nb-panel.nb-focus { position: fixed; inset: 0; z-index: 500; }
.nb-panel.nb-focus .nb-side,
.nb-panel.nb-focus .nb-toolbar { display: none; }
.nb-panel.nb-focus .nb-editor { padding-top: 8vh; }
.nb-panel.nb-focus .nb-footer { background: none; border: 0; justify-content: center; opacity: .5; }
body.nb-focus-on header { visibility: hidden; }

@media (max-width: 700px) {
  .nb-body { flex-direction: column; }
  .nb-side { width: auto; max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .nb-editor { padding: 14px 16px 0; border: 0; }
  .nb-width { display: none; }
  .nb-title-input { font-size: 20px; }
  .nb-page-tools { display: flex; }
  .nb-nb-title { max-width: 55vw; }
  .nb-shelf { padding: 16px 16px 32px; }
  .nb-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 12px; }
  .nb-card-cover { min-height: 110px; }
  .nb-card-title { font-size: 14px; }
}
