body[data-page="notebook"] main { max-width: 1600px; padding-top: 16px; }
#page-notebook .page-heading { margin-bottom: 12px; gap: 10px; }
#page-notebook h1 { font-size: 28px; margin-bottom: 2px; }
.notebook-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.notebook-search { flex: 1; min-width: 160px; max-width: 360px; }
.notebook-search input { min-height: 40px; padding: 7px 12px; width: 100%; }
.notebook-layout { display: flex; align-items: center; gap: 8px; }
.notebook-layout label { display: flex; align-items: center; gap: 5px; font-size: 13px; margin: 0; white-space: nowrap; }
.notebook-layout select { min-height: 40px; padding: 6px 9px; width: 68px; }
.notebook-layout-hint { font-size: 12px; color: var(--muted); margin-right: auto; }
.notebook-grid { display: grid; grid-template-columns: repeat(var(--memo-columns, 4), minmax(0, 1fr)); gap: 10px; grid-auto-rows: clamp(112px, calc((100dvh - 270px) / var(--memo-rows, 4)), 240px); }
.memo-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.memo-card[data-color="indigo"] { background: #eef0fc; border-color: #d8def5; }
.memo-card[data-color="sand"] { background: #fffae9; border-color: #eee3b9; }
.memo-card[data-color="rose"] { background: #fff2f3; border-color: #f2dbde; }
.memo-open { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; gap: 5px; padding: 12px 12px 0; border: 0; background: transparent; color: var(--ink); text-align: left; overflow: hidden; }
.memo-card-title { font-size: 15px; font-weight: 700; line-height: 1.35; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 100%; flex-shrink: 0; }
.memo-card-body { font-size: 13px; line-height: 1.5; color: #535d74; white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; mask-image: linear-gradient(#000 80%, transparent); width: 100%; }
.memo-open:hover { background: #505bb509; }
.memo-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 3px 10px 5px; color: var(--muted); font-size: 11px; }
.memo-pin { padding: 3px 2px; border: 0; background: none; color: var(--muted); font-size: 11px; min-height: 24px; }
.memo-pin[aria-pressed="true"] { color: var(--primary); font-weight: 700; }
.memo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; border: 1px dashed #d8ddea; border-radius: 12px; background: #ffffff55; color: #737d95; font-size: 12px; }
.memo-empty:hover { border-color: var(--primary); background: var(--accent-soft); color: var(--primary); }
.memo-empty-plus { font-size: 24px; font-weight: 350; line-height: 1.1; }
.memo-no-results { grid-column: 1 / -1; align-self: center; text-align: center; color: var(--muted); }
.notebook-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding-top: 8px; }
.notebook-footer p { margin: 0; max-width: 70%; font-size: 12px; }
.notebook-pagination { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.notebook-pagination button { min-width: 32px; min-height: 32px; padding: 2px 8px; }
#memo-editor { width: min(650px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); overflow-y: auto; }
#memo-editor::backdrop { background: #232b4980; }
.memo-editor-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#memo-form > label { margin: 8px 0 4px; }
#memo-title { min-height: 44px; }
#memo-body { min-height: min(40dvh, 320px); resize: vertical; }
.memo-editor-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0; }
.memo-editor-options label { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.memo-editor-options select { width: auto; min-height: 36px; padding: 5px 10px; }
.memo-editor-options input { width: 17px; height: 17px; accent-color: var(--primary); }
.memo-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
#memo-error { margin: 6px 0 0; color: #a53e37; font-size: 13px; }
.memo-confirmation { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); }
.memo-confirmation p { margin: 0 0 6px; font-size: 13px; }
.memo-confirmation button + button { margin-left: 10px; }
@media (max-width: 900px) { .main-nav { grid-template-columns: repeat(8,minmax(0,1fr)); } }
@media (max-width: 600px) {
  #page-notebook .page-heading { align-items: center; }
  #page-notebook .page-heading .subtitle { font-size: 12px; }
  #page-notebook .page-heading .primary { min-height: 40px; padding: 7px 12px; white-space: nowrap; }
  .notebook-search { flex-basis: 100%; max-width: none; }
  .notebook-toolbar { gap: 6px 12px; }
  .notebook-layout-hint { width: 100%; font-size: 11px; }
  .notebook-grid { gap: 8px; grid-auto-rows: 130px; }
  .notebook-footer p { max-width: 100%; flex-basis: 100%; }
  .memo-open { padding: 10px 10px 0; }
  #memo-editor { padding: 16px; }
  #memo-title, #memo-body { font-size: 16px; }
}
