.notebook-actionbar,.library-page-tools{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.notebook-actionbar button,.library-page-tools button{min-height:42px;padding:8px 13px;border:1px solid #bbae98;border-radius:9px;background:#faf5ea;color:#514432;font:inherit;font-size:13px}.notebook-actionbar button:hover{background:#ece4d1}.notebook-tools-dialog{width:min(940px,calc(100vw - 26px));max-height:calc(100dvh - 36px);padding:0;border:1px solid #c9b99c;border-radius:18px;background:#fbf8ef;color:#514432;box-shadow:0 24px 90px #342f2540}.tools-dialog-header{position:sticky;top:0;z-index:2;background:#fbf8ef;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:20px 24px;border-bottom:1px solid #dfd6c6}.tools-dialog-header h2{font:26px Georgia,serif;margin:0}.tools-dialog-header button{min-height:44px}.tools-dialog-body{padding:20px 24px;overflow:auto}.tools-hint{font-size:14px;line-height:1.6;color:#746755}.tools-dialog-body button,.tools-dialog-body select{min-height:42px}.tools-dialog-body select{max-width:100%;padding:8px;border:1px solid #c5b79c;border-radius:8px;background:#fffaf1}.page-overview{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:18px}.page-overview-card{padding:10px;background:#eee7d8;border-radius:10px;min-width:0}.page-preview-button{width:100%;border:0;background:transparent;color:inherit;cursor:pointer;text-align:left}.page-preview-button>span{display:block;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px 0}.page-miniature{position:relative;aspect-ratio:.75;background:repeating-linear-gradient(#fffdf5,#fffdf5 19px,#ddd5c2 20px);overflow:hidden;padding:15px;box-shadow:0 2px 8px #43352020;font:11px Georgia,serif}.page-miniature>small{display:block;color:#827356}.page-miniature>strong{display:block;font-size:14px;margin:8px 0}.page-miniature>p{white-space:pre-wrap;overflow-wrap:anywhere;font-size:10px;line-height:2}.mini-sticker{position:absolute;width:40px;height:40px;transform:translate(-50%,-50%)}.mini-sticker>*{max-width:100%;max-height:100%}.mini-photo{position:absolute;width:50px;max-height:70px;object-fit:contain;right:5%;bottom:8%}.mini-widget{display:inline-block;background:#e2e9e2;margin:3px;padding:3px;font-size:9px}.page-card-actions{display:grid;grid-template-columns:1fr 1fr;gap:5px}.page-card-actions button{font-size:11px;padding:6px}.template-options,.widget-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin-top:18px}.template-options button,.widget-options button{min-height:90px;text-align:left;padding:20px;background:linear-gradient(145deg,#fffdf5,#e9e5d6);border:1px solid #cdbfa4;border-radius:10px;font:20px Georgia,serif}.template-options button:hover,.widget-options button:hover{border-color:#738575;background:#e5ecdf}.page-template-host{position:absolute;z-index:3;pointer-events:auto;overflow:hidden;line-height:1.4;font:14px system-ui;color:#514432}.page-template-host[hidden]{display:none}.template-grid{height:100%;display:grid;gap:10px}.template-columns{grid-template-columns:repeat(3,minmax(0,1fr))}.template-weekly{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr))}.template-business{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr))}.template-gratitude,.template-reading{grid-template-rows:repeat(3,minmax(0,1fr))}.template-field{display:flex;flex-direction:column;gap:5px;min-height:0;min-width:0;margin:0;padding:10px;background:#fffcf0c9;border:1px solid #b6ac9580;border-radius:8px}.template-field>span{font-size:12px;font-weight:600;color:#6b705b}.template-field textarea{flex:1;min-height:0;min-width:0;width:100%;resize:none;padding:4px;border:0;border-radius:0;outline-offset:1px;background:transparent;color:inherit;font:15px/1.5 Georgia,serif;box-sizing:border-box}.template-timetable{height:100%;display:grid;grid-template-columns:25px repeat(5,minmax(0,1fr));grid-template-rows:35px repeat(6,minmax(0,1fr));gap:4px}.template-timetable .template-field{padding:4px;border-radius:4px}.template-timetable .template-field>span{display:none}.template-timetable textarea{font-size:12px;padding:2px}.timetable-heading{font-size:10px;overflow-wrap:anywhere;align-self:center;text-align:center}.timetable-period{align-self:center;text-align:center;font-size:11px}.template-export-value{font:15px/1.5 Georgia,serif;white-space:pre-wrap;overflow-wrap:anywhere;flex:1;min-height:0}.template-timetable .template-export-value{font-size:11px}.writer-count{position:absolute;bottom:38px;left:50%;transform:translateX(-50%);font:11px system-ui;color:#8b7a60;z-index:5;pointer-events:none}.page-widget-host{position:absolute;inset:0;pointer-events:none;z-index:12}.page-widget{position:absolute;pointer-events:auto;background:#f5f2e8;border:1px solid #b8bba8;border-radius:13px;box-shadow:0 5px 13px #302d2220;color:#415247;font:13px system-ui;touch-action:none;user-select:none;overflow:hidden}.page-widget:focus,.page-widget:focus-within{outline:2px solid #829a80;outline-offset:3px}.widget-drag{cursor:grab;background:#dde5d7;padding:7px 8px;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:5px;font-size:11px;min-height:38px}.widget-controls{display:flex;gap:2px}.widget-controls button{padding:0;width:27px;height:29px;min-height:0;border:0;border-radius:5px;background:#f5f8ef;color:inherit;font-size:14px;cursor:pointer}.widget-time{display:block;font:clamp(22px,4vw,34px)/1.2 Georgia,serif;text-align:center;padding:16px 4px;font-variant-numeric:tabular-nums}.widget-timer-actions{display:flex;justify-content:center;gap:7px;padding:0 10px 12px}.widget-timer-actions button{min-height:36px;padding:5px 9px;border:1px solid #b6bba8;border-radius:6px;font-size:11px;background:#fcfaf1;color:inherit}.widget-duration{display:flex;justify-content:center;align-items:center;gap:4px;font-size:10px;padding:0 6px 10px}.widget-duration input{width:54px;padding:3px;background:#fffdf4;border:1px solid #bac0b1;border-radius:5px;color:inherit;min-width:0}.widget-calendar-nav{display:flex;align-items:center;justify-content:space-between;padding:4px}.widget-calendar-nav strong{font-size:12px}.widget-calendar-nav button{height:32px;width:30px;background:transparent;border:0;font-size:22px;color:inherit}.widget-calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;padding:5px 8px 10px;text-align:center}.widget-calendar-grid small{font-size:9px;padding:3px 0}.widget-calendar-grid button{background:transparent;border:0;border-radius:50%;aspect-ratio:1;color:inherit;font:11px system-ui;min-width:0;min-height:0;padding:3px}.widget-calendar-grid button.is-today{box-shadow:inset 0 0 0 1px #789276}.widget-calendar-grid button[aria-pressed=true]{background:#667e63;color:white}.page-widget button:disabled{opacity:.55}.page-readonly-note{padding:12px 16px;border-radius:9px;background:#e9eddf;color:#56634c;font-size:14px}.version-row,.trash-row,.shared-update-row{display:flex;flex-direction:column;gap:8px;padding:17px 0;border-bottom:1px solid #e1d8c7;overflow-wrap:anywhere}.version-row small{color:#776b55}.version-row p,.trash-row p{margin:0;white-space:pre-wrap;max-height:130px;overflow:auto;font-size:14px}.version-row button,.trash-row button,.shared-update-row button{align-self:flex-start}.updates-toggle{display:flex;align-items:center;gap:10px;margin-bottom:20px}.updates-toggle input{width:20px;height:20px}.focus-status{display:none}.editor-focus #app>header,.editor-focus .editor-heading,.editor-focus .toolbar,.editor-focus #tablet-toolbar,.editor-focus #notebook-actionbar,.editor-focus #sticker-panel,.editor-focus .page-readonly-note{display:none!important}.editor-focus #app{padding-top:55px}.editor-focus .focus-status{display:flex;position:fixed;top:0;left:0;right:0;z-index:80;align-items:center;justify-content:center;gap:24px;padding:8px;background:#f4f0e6ed;backdrop-filter:blur(10px);font-size:12px}.focus-status button{min-height:38px}.editor-focus .journal-viewport{margin-top:10px}.paper[data-readonly=true] .placed-sticker,.paper[data-readonly=true] .placed-photo{cursor:default}.paper.is-exporting .page-widget{box-shadow:0 3px 8px #302d2220}.paper[data-template=writer] #writing{max-width:100%;font-family:Georgia,serif}.notebook-tools-dialog::backdrop{background:#302e265c}#sharing-role{max-width:160px;min-height:44px}.sharing-form{flex-wrap:wrap}@media(max-width:600px){.tools-dialog-header{padding:15px}.tools-dialog-header h2{font-size:22px}.tools-dialog-body{padding:15px}.page-overview{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.page-overview-card{padding:6px}.page-card-actions{grid-template-columns:1fr}.page-miniature{padding:8px}.page-miniature>p{font-size:8px}.template-field{padding:6px;gap:3px}.template-field>span{font-size:10px}.template-field textarea{font-size:13px}.template-grid{gap:6px}.template-timetable{gap:2px}.template-timetable textarea{font-size:10px}.template-timetable .template-field{padding:1px}.timetable-heading{font-size:9px}.notebook-actionbar{gap:5px}.notebook-actionbar button{font-size:11px;padding:7px 9px}.widget-controls button{width:27px;height:31px}.notebook-tools-dialog{margin-top:18px}}
/* Keep the existing full-width dialog-button style out of compact toolbars. */
.notebook-actionbar>button,.library-page-tools>button,.notebook-tools-dialog .secondary,.focus-status>button{width:auto;margin:0;display:inline-flex;align-items:center;justify-content:center}.tools-dialog-header button{flex:none;padding:8px 14px}.page-widget button{margin:0;display:inline-flex;align-items:center;justify-content:center}.widget-timer-actions button{width:auto}.page-widget .widget-controls button{width:27px}.library-page-tools{padding:10px 24px}.page-widget-host .page-widget:focus-within{z-index:2}.template-field textarea{overflow-wrap:anywhere}
@media(max-width:650px){.paper:not(.is-exporting) .template-field>span{font-size:calc(11px * var(--phone-format-scale,1));line-height:1.2}.paper:not(.is-exporting) .template-field textarea{font-size:calc(15px * var(--phone-format-scale,1));line-height:1.35}.paper:not(.is-exporting) .template-timetable textarea{font-size:calc(12px * var(--phone-format-scale,1))}.paper:not(.is-exporting) .timetable-heading,.paper:not(.is-exporting) .timetable-period{font-size:calc(10px * var(--phone-format-scale,1));line-height:1.1}}
@media(max-width:650px){.paper:not(.is-exporting) .page-widget .widget-drag{gap:4px}.paper:not(.is-exporting) .page-widget .widget-drag>span{flex-basis:100%;font-size:calc(12px * var(--phone-format-scale,1))}.paper:not(.is-exporting) .page-widget .widget-controls{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));width:100%;gap:2px}.paper:not(.is-exporting) .page-widget .widget-controls button{width:100%;min-width:0;min-height:calc(42px * var(--phone-format-scale,1));height:calc(42px * var(--phone-format-scale,1));font-size:calc(16px * var(--phone-format-scale,1))}}
.page-card-options summary{cursor:pointer;min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:6px;padding:0 8px;border:1px solid #d2c3aa;border-radius:7px;color:#62533e;font:12px system-ui;list-style:none}.page-card-options summary::-webkit-details-marker{display:none}.page-card-options summary::after{content:'+';font-size:18px}.page-card-options[open] summary::after{content:'−'}.page-card-options[open] .page-card-actions{margin-top:6px}.page-preview-button[aria-current=page] .page-miniature{outline:2px solid #788164;outline-offset:2px}.page-card-options summary:focus-visible,.page-preview-button:focus-visible{outline:2px solid #788164;outline-offset:2px}
/* Template miniatures reuse the same grids as the editable page. */
.template-options{grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch}.template-options .template-option{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:12px;min-width:0;padding:14px;text-align:left}.template-option-name{font:19px/1.25 Georgia,serif;min-height:2.5em}.template-thumbnail{display:block;width:100%;aspect-ratio:.8;overflow:hidden;pointer-events:none;text-align:left;box-shadow:0 3px 9px #493e2825;border:1px solid #d7ccb5;border-radius:3px;background:#fbf7eb;color:#514432}.template-thumbnail-page{height:100%;padding:9px;box-sizing:border-box;display:flex;flex-direction:column;gap:8px}.template-preview-brand{font:6px system-ui;letter-spacing:1px;color:#96866b}.template-preview-title{font:12px/1.2 Georgia,serif;font-weight:normal;border-bottom:1px solid #c7bca4;padding:1px 0 6px;min-height:2.4em}.template-thumbnail .template-grid,.template-thumbnail .template-timetable{flex:1;min-height:0;height:auto;gap:4px}.template-thumbnail .template-field{border-radius:3px;padding:4px;gap:3px;overflow:hidden;background:#fffdf3}.template-thumbnail .template-field>span{font:7px/1.2 system-ui;overflow-wrap:anywhere}.template-preview-value{font:8px/1.5 Georgia,serif;white-space:pre-wrap;overflow-wrap:anywhere;background:repeating-linear-gradient(transparent 0 12px,#c7bca438 12px 13px);flex:1;min-height:0}.template-thumbnail .template-timetable{grid-template-columns:12px repeat(5,minmax(0,1fr));grid-template-rows:23px repeat(6,minmax(0,1fr));gap:2px}.template-thumbnail .timetable-heading,.template-thumbnail .timetable-period{font-size:6px}.template-thumbnail .template-timetable .template-field{padding:2px}.template-thumbnail .template-timetable .template-preview-value{font-size:6px}.template-preview-prose{flex:1;font:10px/1.8 Georgia,serif;display:flex;flex-direction:column}.template-preview-lines{flex:1;background:repeating-linear-gradient(transparent 0 17px,#c7bca455 17px 18px);margin-top:4px}.template-option-apply{font:12px system-ui;color:#516444;text-align:center;padding-top:2px}.page-nav{flex-wrap:wrap}.page-nav .page-delete-action{margin-left:4px;padding:8px 11px;border:1px solid #bb987680;border-radius:5px;min-height:44px}.page-nav .page-delete-action:hover{background:#b4775933}.page-nav .page-delete-action:disabled{opacity:.45;cursor:default}@media(max-width:650px){.template-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.template-options .template-option{padding:9px;gap:8px}.template-option-name{font-size:15px}.template-thumbnail-page{padding:6px;gap:5px}.template-preview-title{font-size:10px}.template-thumbnail .template-field{padding:3px}.template-thumbnail .template-field>span{font-size:6px}.template-preview-value{font-size:7px}.template-option-apply{font-size:10px}.page-nav{gap:8px}.page-nav .page-delete-action{margin-left:0;font-size:11px}}

.template-thumbnail{max-width:180px;align-self:center}
/* Templates are the writable page surface. Media must stay visible and
   selectable above it, including before the first pen contact. */
.paper .page-template-host{z-index:1}

/* Compact library navigation on phones. */
@media(max-width:650px){
  #library{overflow-x:clip}
  #library .intro{min-height:0;padding:19px 18px 17px;overflow:hidden}
  #library .intro h1{font-size:38px;line-height:1.05;margin:5px 0}
  #library .intro p{font-size:16px;line-height:1.25;margin:5px 0 12px;max-width:75%}
  #library .intro .primary{min-height:44px;font-size:14px}
  #library .intro-flower{right:0;top:20px;opacity:.4}
  #library .library-bar{padding:10px 15px}
  #library .journal-search{padding:8px 13px}
  #library .library-page-tools{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:6px;margin:0;padding:5px 12px 8px;scrollbar-width:none}
  #library .library-page-tools::-webkit-scrollbar{display:none}
  #library .library-page-tools button{flex:none;min-height:40px;padding:7px 10px;font-size:11px}
}
