/* =============================================================================
   Caderno do projeto (v0.30) — mini player de registros, páginas e notas adesivas.
   Minimizado: cartão no canto (arrastável). Expandido: folha grande sobre a tela.
   ============================================================================= */
.nb-host { position: relative; z-index: 76; }
.nb-host.is-leaving > * { opacity: 0; transform: translateY(8px) scale(.98); transition: opacity 160ms, transform 160ms; }

.nb {
  --nb-paper: #FFFDF6;
  --nb-rule: color-mix(in srgb, #7FA3B5 26%, transparent);
  --nb-margin: color-mix(in srgb, #D0505B 45%, transparent);
  position: fixed; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden;
  background: var(--c-surface); color: var(--c-ink); border: 1px solid var(--c-border);
  box-shadow: 0 26px 60px -22px rgba(6, 24, 28, .5), 0 2px 6px rgba(6, 24, 28, .08);
}
:root[data-theme="dark"] .nb { --nb-paper: #1B2830; --nb-rule: color-mix(in srgb, #7FA3B5 16%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nb { --nb-paper: #1B2830; --nb-rule: color-mix(in srgb, #7FA3B5 16%, transparent); } }

.nb.is-mini {
  z-index: 78; width: min(380px, calc(100vw - 1.5rem)); height: min(520px, calc(100vh - var(--appbar-h, 56px) - 2rem)); border-radius: 18px;
  animation: nb-in 260ms cubic-bezier(.2, .9, .2, 1.1);
  transition: top 220ms cubic-bezier(.2, .8, .2, 1), left 220ms cubic-bezier(.2, .8, .2, 1), right 220ms, bottom 220ms;
}
.nb.is-mini.at-bl { left: calc(var(--sp-4) + var(--rail-w, 0px)); bottom: var(--sp-4); }
.nb.is-mini.at-br { right: var(--sp-4); bottom: calc(var(--sp-4) + 3.9rem); }
.nb.is-mini.at-tl { left: calc(var(--sp-4) + var(--rail-w, 0px)); top: calc(var(--appbar-h) + var(--sp-3)); }
.nb.is-mini.at-tr { right: var(--sp-4); top: calc(var(--appbar-h) + var(--sp-3)); }
.nb.is-mini.is-dragging { transition: none; cursor: grabbing; }
.nb.is-full {
  z-index: 79; inset: clamp(.5rem, 2vh, 1.25rem) clamp(.5rem, 1.6vw, 1.5rem); border-radius: 22px;
  animation: nb-grow 240ms cubic-bezier(.2, .9, .2, 1);
}
.nb-backdrop { position: fixed; inset: 0; z-index: 79; background: rgba(8, 20, 26, .42); backdrop-filter: blur(2px); animation: nb-fade 200ms ease; }
@keyframes nb-in { from { opacity: 0; transform: translateY(16px) scale(.95); } }
@keyframes nb-grow { from { opacity: 0; transform: scale(.97); } }
@keyframes nb-fade { from { opacity: 0; } }

/* ---------------------------------------------------------------- topo */
.nb-head { display: flex; align-items: center; gap: .65rem; padding: .7rem .75rem .55rem .9rem; background: #0C5A63; color: #fff; }
.nb.is-mini .nb-head { cursor: grab; touch-action: none; user-select: none; }
.nb-mark { width: 2rem; height: 2rem; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .16); }
.nb-mark svg { width: 1.1rem; height: 1.1rem; }
.nb-titles { display: grid; min-width: 0; flex: 1; line-height: 1.2; }
.nb-titles strong { font-size: var(--fs-sm); letter-spacing: .01em; }
.nb-project { font-size: var(--fs-xs); color: rgba(255, 255, 255, .78); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-project:hover { color: #fff; text-decoration: underline; }
.nb-save { font-size: .7rem; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.nb-save.is-error { color: #FFD3D7; font-weight: var(--fw-bold); }
.nb-head-actions { display: flex; gap: .2rem; }
.nb-icon-btn { width: 2rem; height: 2rem; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: inherit; cursor: pointer; }
.nb-icon-btn svg { width: 1rem; height: 1rem; }
.nb-head .nb-icon-btn:hover { background: rgba(255, 255, 255, .16); }
.nb-icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nb-icon-btn--sm { width: 1.75rem; height: 1.75rem; color: var(--c-ink-3); }
.nb-icon-btn--sm:hover { background: var(--c-surface-sunken); color: var(--c-ink); }
.nb-icon-btn--sm svg { width: .9rem; height: .9rem; }

.nb-tabs { display: flex; gap: .25rem; padding: .45rem .6rem; border-bottom: 1px solid var(--c-border); background: var(--c-surface-2); }
.nb-tab { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .7rem; border: 0; border-radius: 999px; background: none; color: var(--c-ink-2); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); cursor: pointer; }
.nb-tab svg { width: .95rem; height: .95rem; }
.nb-tab:hover { background: var(--c-surface-sunken); color: var(--c-ink); }
.nb-tab.is-active { background: var(--c-surface); color: var(--c-brand-ink); box-shadow: 0 1px 2px rgba(6, 24, 28, .12), inset 0 0 0 1px var(--c-border); }
.nb-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nb-tab-n { min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem; display: inline-grid; place-items: center; border-radius: 999px; background: var(--c-surface-sunken); font-size: .66rem; color: var(--c-ink-3); }
.nb-tab.is-active .nb-tab-n { background: var(--c-brand-soft); color: var(--c-brand-ink); }
.nb.is-mini .nb-tabs { overflow-x: auto; scrollbar-width: none; }
.nb.is-mini .nb-tab { padding: .35rem .6rem; flex: none; }
.nb.is-mini .nb-tab > svg { display: none; }
.nb.is-mini .nb-save { display: none; }
.nb.is-mini .nb-save.is-error, .nb.is-mini .nb-save.is-saving { display: inline; }

.nb-body { min-height: 0; overflow: auto; padding: var(--sp-4); }
.nb-loading { color: var(--c-ink-3); text-align: center; padding: var(--sp-6) 0; }

/* ---------------------------------------------------------------- registros */
.nb-body--registros { display: grid; align-content: start; gap: var(--sp-4); }
.nb.is-full .nb-body--registros { grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); align-items: start; gap: var(--sp-5); padding: var(--sp-5); }
.nb.is-full .nb-body--registros > .nb-composer { position: sticky; top: 0; }
.nb.is-full .nb-body--registros > .nb-composer textarea { min-height: 12rem; }
.nb-composer { display: grid; gap: .45rem; padding: .6rem; border-radius: 14px; border: 1px solid var(--c-border); background: var(--c-surface-2); }
.nb-composer textarea { resize: vertical; min-height: 4.2rem; border-color: transparent; background: var(--c-surface); }
.nb-composer-foot { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.nb-tip { font-size: .7rem; color: var(--c-ink-3); margin-right: auto; }
.nb-timeline { list-style: none; margin: 0; padding: 0 0 0 .2rem; display: grid; gap: .2rem; position: relative; }
.nb-timeline::before { content: ""; position: absolute; left: 1.15rem; top: .8rem; bottom: .8rem; width: 2px; background: var(--c-border); border-radius: 2px; }
.nb-reg { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .7rem; align-items: start; padding: .55rem .4rem .55rem 0; }
.nb-reg > .avatar { position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--c-surface); }
.nb-reg-main { min-width: 0; display: grid; gap: .2rem; padding: .55rem .75rem; border-radius: 4px 14px 14px 14px; background: var(--c-surface-2); border: 1px solid var(--c-border); }
.nb-reg-meta { display: flex; flex-wrap: wrap; gap: .1rem .5rem; font-size: var(--fs-xs); color: var(--c-ink-3); }
.nb-reg-meta strong { color: var(--c-ink); }
.nb-reg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); line-height: 1.55; }
.nb-reg-actions { display: flex; opacity: 0; transition: opacity 120ms; }
.nb-reg:hover .nb-reg-actions, .nb-reg:focus-within .nb-reg-actions { opacity: 1; }
@media (hover: none) { .nb-reg-actions { opacity: 1; } }
.nb-reg-edit { display: grid; gap: .4rem; }
.nb-reg-edit-actions { display: flex; justify-content: flex-end; gap: .4rem; }

/* ---------------------------------------------------------------- caderno */
.nb-body--caderno { display: grid; gap: var(--sp-3); grid-template-rows: auto minmax(0, 1fr); padding: var(--sp-3); }
.nb.is-full .nb-body--caderno { grid-template-columns: clamp(220px, 18vw, 300px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-4); }
.nb-index { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .5rem; min-height: 0; }
.nb-index-list { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; align-content: start; gap: .15rem; }
.nb-index-item { width: 100%; display: grid; gap: .1rem; padding: .5rem .65rem; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-left: 3px solid transparent; }
.nb-index-item:hover { background: var(--c-surface-2); }
.nb-index-item.is-active { background: var(--c-brand-soft); border-left-color: var(--c-brand); }
.nb-index-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nb-index-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-index-meta { font-size: .7rem; color: var(--c-ink-3); }
.nb-index-mini { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
.nb-index-mini select { width: 100%; }
.nb-newpage { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .45rem .7rem; border-radius: 10px; border: 1px dashed var(--c-border-strong); background: none; color: var(--c-brand-ink); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); cursor: pointer; white-space: nowrap; }
.nb-newpage:hover { background: var(--c-brand-soft); border-style: solid; border-color: transparent; }
.nb-newpage svg { width: .9rem; height: .9rem; }

.nb-sheet { min-height: 0; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); border-radius: 14px; background: var(--nb-paper); border: 1px solid var(--c-border);
  box-shadow: 0 1px 0 var(--c-border), 0 3px 0 -1px var(--nb-paper), 0 4px 0 -1px var(--c-border); }
.nb-sheet-head { display: flex; align-items: center; gap: .4rem; padding: .8rem .8rem 0 3.2rem; }
.nb-sheet-title { flex: 1; min-width: 0; border: 0; background: none; color: var(--c-ink); font: inherit; font-size: 1.25rem; font-weight: var(--fw-bold); letter-spacing: -.01em; padding: .2rem 0; }
.nb.is-mini .nb-sheet-title { font-size: 1.05rem; }
.nb-sheet-title:focus { outline: none; }
.nb-sheet-title::placeholder { color: var(--c-ink-3); font-weight: var(--fw-semibold); }
.nb-sheet-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; padding: .1rem 1rem .5rem 3.2rem; font-size: .72rem; color: var(--c-ink-3); }
.nb-paper { position: relative; min-height: 0; display: grid; }
.nb-paper::before { content: ""; position: absolute; top: 0; bottom: 0; left: 2.4rem; width: 1px; background: var(--nb-margin); pointer-events: none; }
.nb-sheet-body {
  --line: 1.75rem;
  min-height: 12rem; height: 100%; overflow-y: auto; padding: 0 1.1rem 1.5rem 3.2rem; color: var(--c-ink); font: inherit; font-size: var(--fs-sm); line-height: var(--line); outline: none;
  background: transparent repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--nb-rule) calc(var(--line) - 1px), var(--nb-rule) var(--line));
  background-attachment: local; overflow-wrap: anywhere; white-space: pre-wrap;
}
.nb-sheet-body.is-empty::before { content: attr(data-placeholder); position: absolute; color: var(--c-ink-3); pointer-events: none; }
.nb-sheet-body > * { margin: 0; }
.nb-sheet-body b, .nb-sheet-body strong { font-weight: var(--fw-bold); }
.nb-sheet-body i, .nb-sheet-body em { font-style: italic; }
.nb-sheet-body h2, .nb-sheet-body h3 { font-size: 1.12rem; font-weight: var(--fw-bold); line-height: var(--line); letter-spacing: -.01em; color: var(--c-ink); }
.nb-sheet-body ul, .nb-sheet-body ol { padding-left: 1.4rem; }
.nb-sheet-body ul { list-style: disc; }
.nb-sheet-body ol { list-style: decimal; }
.nb-sheet-body ul ul { list-style: circle; }
.nb-sheet-body li::marker { color: var(--c-brand-ink); font-weight: var(--fw-bold); }
.nb-sheet-body blockquote { padding-left: .8rem; border-left: 3px solid var(--c-brand); color: var(--c-ink-2); background: color-mix(in srgb, var(--c-brand) 6%, transparent); }
.nb-sheet-body hr { border: 0; height: var(--line); background: linear-gradient(to bottom, transparent calc(50% - 1px), var(--c-border-strong) calc(50% - 1px), var(--c-border-strong) calc(50% + 1px), transparent calc(50% + 1px)); }
.nb-sheet-body code { padding: 0 .3rem; border-radius: 5px; background: var(--c-surface-sunken); }
.nb-sheet-body:focus { outline: none; }
.nb-sheet:focus-within { border-color: color-mix(in srgb, var(--c-brand) 40%, var(--c-border)); }
.nb-sheet.is-blank { display: grid; place-content: center; justify-items: center; gap: .5rem; padding: var(--sp-6) var(--sp-4); text-align: center; grid-template-rows: none; }
.nb-blank-icon { width: 3.2rem; height: 3.2rem; display: grid; place-items: center; border-radius: 16px; background: var(--c-brand-soft); color: var(--c-brand-ink); transform: rotate(-4deg); }
.nb-blank-icon svg { width: 1.6rem; height: 1.6rem; }
.nb-blank-title { font-weight: var(--fw-bold); font-size: var(--fs-md, 1rem); }
.nb-blank-text { max-width: 30rem; font-size: var(--fs-sm); color: var(--c-ink-2); margin-bottom: .4rem; }

/* ---------------------------------------------------------------- notas adesivas */
.nb-board { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); align-items: stretch; }
.nb.is-full .nb-board { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); padding: var(--sp-2); }
.nb-sticky, .nb-sticky-new { --st: #FFE99A; --st-ink: #4A3B00; position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .5rem; min-height: 9.5rem; padding: .9rem .85rem .6rem;
  border-radius: 3px 3px 14px 3px; background: var(--st); color: var(--st-ink); box-shadow: 0 1px 1px rgba(0, 0, 0, .06), 0 8px 18px -10px rgba(40, 30, 0, .45); }
.nb-sticky { transform: rotate(-.8deg); transition: transform 160ms ease, box-shadow 160ms ease; }
.nb-sticky:nth-child(3n) { transform: rotate(.9deg); }
.nb-sticky:nth-child(4n+1) { transform: rotate(-.3deg); }
.nb-sticky:hover, .nb-sticky:focus-within { transform: rotate(0) translateY(-2px); box-shadow: 0 2px 2px rgba(0, 0, 0, .06), 0 16px 26px -12px rgba(40, 30, 0, .5); }
.c-amarelo { --st: #FFE99A; --st-ink: #4A3B00; }
.c-verde { --st: #C9F0CF; --st-ink: #12401C; }
.c-azul { --st: #CBE5FF; --st-ink: #0F3354; }
.c-rosa { --st: #FFD3E2; --st-ink: #5A1430; }
.c-roxo { --st: #E2D6FF; --st-ink: #301B63; }
.c-laranja { --st: #FFD8B5; --st-ink: #5A2A00; }
.nb-sticky-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; line-height: 1.45; font-weight: var(--fw-medium); padding-right: 1.4rem; }
.nb-sticky-foot { display: flex; align-items: center; justify-content: space-between; gap: .3rem; font-size: .68rem; opacity: .8; }
.nb-sticky .nb-icon-btn--sm { color: inherit; width: 1.5rem; height: 1.5rem; }
.nb-sticky .nb-icon-btn--sm:hover { background: rgba(0, 0, 0, .08); }
.nb-sticky-actions { display: flex; opacity: 0; transition: opacity 120ms; }
.nb-sticky:hover .nb-sticky-actions, .nb-sticky:focus-within .nb-sticky-actions { opacity: 1; }
@media (hover: none) { .nb-sticky-actions { opacity: 1; } }
.nb-pin { position: absolute; top: .4rem; right: .4rem; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .45; cursor: pointer; }
.nb-pin svg { width: .9rem; height: .9rem; }
.nb-pin:hover:not(:disabled) { opacity: 1; background: rgba(0, 0, 0, .08); }
.nb-pin.is-on { opacity: 1; color: #fff; background: #C2416B; box-shadow: 0 2px 4px rgba(90, 20, 48, .35); }
.nb-pin:focus-visible { outline: none; box-shadow: var(--focus-ring); opacity: 1; }
.nb-sticky-edit, .nb-sticky-input { width: 100%; resize: none; border: 0; background: rgba(255, 255, 255, .45); border-radius: 6px; padding: .35rem .45rem; color: inherit; font: inherit; font-size: .95rem; line-height: 1.45; }
.nb-sticky-input { background: transparent; padding: 0; }
.nb-sticky-input::placeholder { color: inherit; opacity: .55; }
.nb-sticky-edit:focus, .nb-sticky-input:focus { outline: none; }
.nb-sticky-new { border: 2px dashed color-mix(in srgb, var(--st-ink) 25%, transparent); box-shadow: none; }
.nb-sticky-new:focus-within { border-style: solid; }
.nb-sticky-new-foot { display: flex; align-items: center; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
.nb-swatches { display: flex; gap: .25rem; }
.nb-swatch { width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .14); background: var(--st); cursor: pointer; padding: 0; }
.nb-swatch.is-on { border-color: var(--st-ink); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.nb-swatch:focus-visible { outline: none; box-shadow: var(--focus-ring); }

@media (max-width: 720px) {
  .nb.is-full { inset: .5rem; border-radius: 16px; }
  .nb.is-full .nb-body--caderno { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .nb.is-full .nb-index-list { max-height: 7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .nb, .nb-backdrop, .nb-sticky { animation: none; transition: none; }
  .nb-sticky, .nb-sticky:nth-child(n) { transform: none; }
}

/* v0.32 — barra de formatação do caderno */
.nb-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem; margin: 0 .8rem .45rem 3rem; padding: .25rem; border-radius: 11px; background: var(--c-surface-2); border: 1px solid var(--c-border); justify-self: start; }
.nb-tool { min-width: 2rem; height: 2rem; display: grid; place-items: center; padding: 0 .35rem; border: 0; border-radius: 8px; background: none; color: var(--c-ink-2); font: inherit; font-size: .95rem; cursor: pointer; }
.nb-tool svg { width: 1.05rem; height: 1.05rem; }
.nb-tool:hover { background: var(--c-surface); color: var(--c-ink); }
.nb-tool:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nb-tool.is-on { background: var(--c-brand-soft); color: var(--c-brand-ink); }
.nb-tool.is-b span { font-weight: 800; }
.nb-tool.is-i span { font-style: italic; font-family: Georgia, serif; font-weight: 700; }
.nb-tool.is-s span { text-decoration: line-through; font-weight: 700; }
.nb-tool.is-h span { font-weight: 800; font-size: 1.05rem; }
.nb-tools-sep { width: 1px; height: 1.2rem; margin: 0 .25rem; background: var(--c-border-strong); }
.nb.is-mini .nb-tools { margin-left: .8rem; }
.nb-reg-text { font-size: var(--fs-sm); }
