.notebooks-dialog { width: min(1200px, calc(100vw - 24px)); max-width: 1200px; height: min(850px, calc(100dvh - 32px - var(--app-safe-top, 0px) - var(--app-safe-bottom, 0px))); max-height: calc(100dvh - 32px - var(--app-safe-top, 0px) - var(--app-safe-bottom, 0px)); padding: 0; }
.notebooks-dialog[open] { display: flex; flex-direction: column; }
.notebooks-dialog [hidden] { display: none !important; }
.notebooks-dialog .dialog-head { flex: none; }
.notebooks-intro { margin: 0; padding: 8px 18px 0; font-size: .88rem; color: #526473; }
.notebooks-message { min-height: 1.6em; margin: 0; padding: 4px 18px; font-size: .85rem; }
.notebooks-message[data-type="error"] { color: #b3261e; }
.notebooks-message[data-type="success"] { color: #1a6b4e; }
.notebooks-layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); flex: 1; min-height: 0; border-top: 1px solid #dce3e9; }
.notebooks-sidebar { min-width: 0; padding: 14px 12px; background: #f4f7fa; overflow: auto; border-right: 1px solid #dce3e9; }
.notebooks-sidebar-head, .notebooks-row, .notebooks-collection-head, .notebooks-detail-head { display: flex; align-items: center; gap: 8px; }
.notebooks-sidebar-head { justify-content: space-between; margin-bottom: 12px; }
.notebooks-sidebar-head h3 { margin: 0; font-size: .95rem; }
.notebooks-row { flex-wrap: wrap; }
.notebooks-sidebar button, .notebooks-main button { min-height: 36px; }
.notebooks-sidebar-head button { padding: 6px 10px; }
.notebooks-create-form { display: grid; gap: 8px; margin-bottom: 14px; }
.notebooks-create-form input, .notebooks-search input, .notebooks-entry-fields input, .notebooks-share-form input, .notebooks-share-form select { width: 100%; min-width: 0; }
.notebooks-create-form label, .notebooks-entry-fields label, .notebooks-share-form label { display: grid; gap: 5px; font-size: .85rem; }
#notebooksList { display: grid; gap: 8px; }
.notebooks-notebook-card { display: grid; gap: 4px; min-width: 0; }
.notebooks-notebook { display: grid; gap: 6px; width: 100%; text-align: start; padding: 12px; background: #fff; white-space: normal; overflow-wrap: anywhere; }
.notebooks-notebook span { color: #526473; font-size: .77rem; }
.notebooks-notebook[aria-pressed="true"] { background: #e9f3fc; border-color: #4c83b5; box-shadow: inset 3px 0 #3674ab; }
.notebooks-main { min-width: 0; min-height: 0; overflow: auto; padding: 18px; }
.notebooks-collection-head { justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.notebooks-collection-head h3 { margin: 0 0 4px; overflow-wrap: anywhere; }
.notebooks-muted { color: #586877; font-size: .8rem; margin: 0; }
.notebooks-search { display: flex; gap: 8px; margin-bottom: 16px; }
.notebooks-backup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.notebooks-backup select { width: auto; max-width: 100%; font-size: .82rem; }
.notebooks-backup button { font-size: .82rem; }
.notebooks-search input { flex: 1; }
.notebooks-entries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.notebooks-entry-card-wrap { display: grid; grid-template-rows: 1fr auto; gap: 6px; min-width: 0; }
.notebooks-entry-card { width: 100%; display: flex; flex-direction: column; gap: 9px; min-height: 134px !important; text-align: start; background: #fff; padding: 16px; white-space: normal; overflow-wrap: anywhere; }
.notebooks-entry-card strong { font-size: 1rem; }
.notebooks-entry-card .notebooks-muted { margin-top: auto; }
.notebooks-entry-card:hover, .notebooks-entry-card:focus-visible { border-color: #3674ab; background: #f7fbff; }
.notebooks-excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; font-size: .88rem; font-weight: 400; color: #354757; }
.notebooks-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 18px; }
.notebooks-pagination span { font-size: .8rem; text-align: center; color: #526473; }
.notebooks-empty { padding: 32px 20px; color: #586877; text-align: center; grid-column: 1 / -1; line-height: 1.6; }
.notebooks-sharing { padding: 14px; margin-bottom: 18px; background: #f4f7fa; border: 1px solid #dce3e9; border-radius: 10px; }
.notebooks-sharing h4 { margin: 0 0 6px; }
.notebooks-share-form { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.notebooks-share-form label { flex: 1 1 180px; }
.notebooks-share-form button { flex: 0 1 auto; }
.notebooks-share-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid #dce3e9; padding: 10px 0; }
.notebooks-share-row span { flex: 1 1 180px; overflow-wrap: anywhere; font-size: .85rem; }
.notebooks-share-row select { max-width: 100%; width: auto; }
.notebooks-detail-head { justify-content: space-between; margin-bottom: 16px; }
.notebooks-detail-head .notebooks-muted { flex: 1; overflow-wrap: anywhere; }
#notebooksSave { background: #2d6fa6; border-color: #2d6fa6; color: #fff; }
#notebooksSave:disabled { opacity: .55; }
.notebooks-entry-fields { display: grid; grid-template-columns: minmax(0, 1fr) 165px; gap: 12px; }
#notebooksEntryTitle { font-size: 1.06rem; font-weight: 600; }
.notebooks-entry-meta { padding: 8px 0; min-height: 12px; }
.notebooks-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 10px; border: 1px solid #dce3e9; border-radius: 8px 8px 0 0; background: #fff; }
.notebooks-toolbar button { min-width: 32px; min-height: 32px; }
.notebooks-toolbar img { width: 20px; height: 20px; }
.notebooks-toolbar select { width: auto; max-width: 100%; }
.notebooks-paper-area { padding: 22px; background: #edf1f5; border: 1px solid #dce3e9; border-top: 0; min-height: 340px; }
#notebooksEditor { background: #fff; max-width: 800px; margin: 0 auto; min-height: 300px; font-family: Arial, sans-serif; font-size: 16px; }
#notebooksEditor .ql-editor { min-height: 300px; padding: 35px 45px; line-height: 1.65; }
.notebooks-conflict { padding: 12px; margin-bottom: 12px; border: 1px solid #dda844; border-radius: 8px; background: #fff6dd; }
.notebooks-conflict p { margin: 0 0 8px; font-size: .88rem; }
@media (max-width: 740px) {
  .notebooks-dialog { width: calc(100vw - 12px); margin-top: calc(6px + var(--app-safe-top, 0px)); margin-bottom: calc(6px + var(--app-safe-bottom, 0px)); height: calc(100dvh - 16px - var(--app-safe-top, 0px) - var(--app-safe-bottom, 0px)); max-height: calc(100dvh - 16px - var(--app-safe-top, 0px) - var(--app-safe-bottom, 0px)); }
  .notebooks-intro { font-size: .8rem; padding: 6px 12px 0; }
  .notebooks-message { padding-inline: 12px; }
  .notebooks-layout { display: flex; flex-direction: column; }
  .notebooks-sidebar { flex: none; max-height: 230px; border-right: 0; border-bottom: 1px solid #dce3e9; padding: 10px; }
  .notebooks-sidebar-head { margin-bottom: 8px; }
  #notebooksList { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 3px; }
  .notebooks-notebook-card { flex: 0 0 200px; width: 200px; }
  .notebooks-notebook { width: 100%; padding: 10px; }
  .notebooks-notebook strong { max-height: 2.8em; overflow: hidden; }
  .notebooks-create-form { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
  .notebooks-create-form label { flex: 1 1 100%; }
  .notebooks-create-form input { flex: 1 1 150px; width: auto; }
  .notebooks-main { padding: 12px; flex: 1; }
  .notebooks-entries { grid-template-columns: minmax(0, 1fr); }
  .notebooks-entry-card { min-height: 110px !important; padding: 12px; }
  .notebooks-editing .notebooks-sidebar, .notebooks-editing .notebooks-intro { display: none; }
  .notebooks-entry-fields { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .notebooks-entry-fields label:last-child { max-width: 200px; }
  .notebooks-detail-head { gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
  .notebooks-detail-head .notebooks-muted { font-size: .75rem; }
  .notebooks-paper-area { padding: 8px; }
  #notebooksEditor .ql-editor { padding: 24px 22px; }
  .notebooks-toolbar { padding: 6px; }
}

.notebooks-dialog .notebooks-delete { min-height: 44px; padding: 9px 12px; color: #963c32; background: #fff8f6; border-color: #e8c8c2; white-space: normal; overflow-wrap: anywhere; }
.notebooks-dialog .notebooks-delete:hover { background: #ffefea; border-color: #c67869; }
.notebooks-dialog .notebooks-delete:focus-visible { outline: 3px solid #c98d82; outline-offset: 2px; }
.notebooks-entry-card-wrap > .notebooks-delete { width: 100%; font-size: .82rem; }
