.journal-panel { --journal-ink:#4d3629; --journal-border:#e8d5bb; --journal-cream:#fff8ec; color:var(--journal-ink); }
.journal-head,.journal-actions { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.journal-head h2,.journal-head p { margin:0; }
.journal-status { min-height:1.5em; color:#536237; overflow-wrap:anywhere; }
.journal-error { color:#983728; }
.journal-layout { display:grid; grid-template-columns:minmax(180px,230px) minmax(0,1fr); gap:14px; }
.journal-list,.journal-form,.journal-empty { border:1px solid var(--journal-border); border-radius:12px; background:var(--journal-cream); padding:14px; margin:0; }
.journal-list h3,.journal-form h3 { margin:.3rem 0 .7rem; font-size:1rem; }
.journal-list button { display:grid; text-align:left; width:100%; gap:4px; margin:6px 0; overflow-wrap:anywhere; color:inherit; border-color:var(--journal-border); }
.journal-list button[aria-current=true] { background:#f2e0c4; border-color:#c99062; }
.journal-list button small,.journal-form small { color:#6e5847; }
.journal-form>label { margin:12px 0; }
.journal-meta { display:flex; flex-wrap:wrap; align-items:start; gap:12px; }
.journal-meta fieldset { min-width:0; border:0; padding:0; margin:0; }
.journal-meta button { margin:3px 5px 4px 0; min-height:40px; }
.journal-meta button[aria-pressed=true] { background:#f2e0c4; color:#633215; border-color:#bf8c63; }
.journal-meta button[aria-pressed=true]:disabled { opacity:1; }
.journal-content,.journal-attachments { margin:14px 0; }
.journal-content { display:grid; grid-template-columns:max-content minmax(0,1fr); align-items:start; gap:8px 16px; }
.journal-form .journal-content h3 { margin:11px 0 0; }
.journal-editor-box { min-width:0; border:1px solid var(--journal-border); border-radius:9px; background:#fffdfa; }
.journal-tools {
 display:flex; flex-wrap:wrap; gap:2px; padding:5px 7px;
 border-bottom:1px solid var(--journal-border); border-radius:8px 8px 0 0; background:#f7ebd9;
}
.journal-tools .journal-tool {
 appearance:none; position:relative; display:grid; place-items:center;
 width:34px; min-width:34px; min-height:34px; padding:0; margin:0;
 border:1px solid transparent; border-radius:5px; background:transparent;
 color:var(--journal-ink); font:600 16px/1 system-ui,sans-serif; cursor:pointer;
}
.journal-tools .journal-tool:hover,.journal-tools .journal-tool:focus-within {
 background:#fffdfa; border-color:#d9c5a9;
}
.journal-tools .journal-tool:focus-visible,.journal-tools .journal-color:has(input:focus-visible) {
 outline:2px solid #a75231; outline-offset:0;
}
.journal-tools .journal-color input[type=color] {
 position:absolute; inset:0; width:100%; height:100%; margin:0; padding:0;
 border:0; opacity:0; cursor:pointer;
}
.journal-tools .journal-color:has(input:disabled) { opacity:.5; cursor:default; }
.journal-tool-icon { position:relative; display:inline-block; }
.journal-tool-bold { font-weight:800; }
.journal-tool-heading,.journal-tool-italic { font-family:Georgia,serif; }
.journal-tool-italic { font-style:italic; }
.journal-tool-underline { text-decoration:underline; }
.journal-tool-strike { text-decoration:line-through; }
.journal-tool-code { font:700 13px/1 ui-monospace,monospace; }
.journal-tool-text-color { border-bottom:3px solid var(--journal-color); }
.journal-tool-highlight { padding:2px; background:var(--journal-color); border-bottom:1px solid currentColor; }
.journal-tool-clear {
 width:14px; height:9px; transform:rotate(-40deg); border:1.5px solid currentColor;
 border-radius:2px; background:linear-gradient(90deg,currentColor 0 50%,transparent 50%);
}
.journal-tool-numbered,.journal-tool-bulleted {
 width:18px; height:14px;
 background:linear-gradient(currentColor,currentColor) right 1px top 1px/11px 1.5px no-repeat,
            linear-gradient(currentColor,currentColor) right 1px center/11px 1.5px no-repeat,
            linear-gradient(currentColor,currentColor) right 1px bottom 1px/11px 1.5px no-repeat;
}
.journal-tool-numbered::before,.journal-tool-bulleted::before {
 position:absolute; left:0; top:-1px; white-space:pre;
 font:700 6px/5px system-ui,sans-serif; content:"1\A 2\A 3";
}
.journal-tool-bulleted::before { content:"•\A •\A •"; font-size:8px; }
.journal-tool-table {
 width:16px; height:13px; border:1px solid currentColor;
 background:repeating-linear-gradient(to right,transparent 0 4px,currentColor 4px 5px),
            repeating-linear-gradient(to bottom,transparent 0 3px,currentColor 3px 4px);
}
.journal-tool-link { width:18px; height:13px; transform:rotate(-40deg); }
.journal-tool-link::before,.journal-tool-link::after {
 position:absolute; top:3px; width:10px; height:7px; border:1.5px solid currentColor;
 border-radius:4px; content:"";
}
.journal-tool-link::before { left:0; }
.journal-tool-link::after { right:0; }
.journal-tool-image { width:16px; height:13px; border:1.5px solid currentColor; border-radius:2px; }
.journal-tool-image::before {
 position:absolute; top:2px; left:2px; width:3px; height:3px;
 border-radius:50%; background:currentColor; content:"";
}
.journal-tool-image::after {
 position:absolute; right:1px; bottom:1px; width:10px; height:6px;
 background:currentColor; clip-path:polygon(0 100%,55% 0,100% 100%); content:"";
}
.journal-tool-rule { width:14px; height:2px; background:currentColor; }
.journal-tool-left,.journal-tool-center {
 width:16px; height:12px; background:linear-gradient(currentColor,currentColor) left top/100% 1.5px no-repeat,
                                 linear-gradient(currentColor,currentColor) left bottom/100% 1.5px no-repeat;
}
.journal-tool-left::before,.journal-tool-center::before {
 position:absolute; left:0; top:4px; width:11px; height:1.5px;
 background:currentColor; box-shadow:0 3px currentColor; content:"";
}
.journal-tool-center::before { left:2.5px; }
.journal-editor { min-height:220px; padding:12px; border-radius:8px; overflow-wrap:anywhere; overflow:auto; }
.journal-tools + .journal-editor { border-radius:0 0 8px 8px; }
@media(max-width:850px) {
 .journal-content { grid-template-columns:minmax(0,1fr); }
 .journal-form .journal-content h3 { margin:0; }
 .journal-tools .journal-tool { width:44px; min-width:44px; min-height:44px; }
}
.journal-editor:focus-visible { outline:2px solid #a75231; outline-offset:-2px; }
.journal-editor img { max-width:100%; height:auto; }
.journal-editor table { width:auto; min-width:0; table-layout:auto; }
.journal-editor :is(th,td) { height:auto; padding:6px; border:1px solid var(--journal-border)!important; }
.journal-editor pre { white-space:pre-wrap; }
.journal-editor blockquote { margin:10px 0; padding-inline-start:10px; border-inline-start:3px solid #bb7b55; }
.journal-math { padding:0 6px; }
.journal-attachments ul { margin:8px 0; padding:0; }
.journal-attachments li { display:flex; gap:8px; flex-wrap:wrap; align-items:center; padding:6px 0; border-top:1px solid var(--journal-border); overflow-wrap:anywhere; }
.journal-attachments li a { max-width:100%; overflow-wrap:anywhere; }
.journal-list-toggle { display:none; }
@media(max-width:850px) {
 .journal-layout { grid-template-columns:1fr; }
 .journal-list { display:none; }
 .journal-list.journal-list-open { display:block; }
 .journal-list-toggle { display:inline-block; }
}

.journal-template-dialog { color:#4d3629; border-color:#e8d5bb; background:#fffdfa; }
.journal-template-actions { display:flex; flex-wrap:wrap; gap:8px; margin-block:10px 16px; }
.journal-template-actions a {
  display:inline-flex; align-items:center; min-height:44px; padding:6px 12px;
  border:1px solid #e8d5bb; border-radius:8px; color:#78350f;
  background:#fff8ec; text-decoration:none;
}
.journal-template-actions a:hover { background:#f4eadc; }
.journal-template-upload { margin-block:12px; }
