/* Редактор дневника (journal-editor.js). Цвета, шрифт и скругления – только токены дизайн-системы
   (_ds/…/tokens), поэтому светлая и темная темы работают сами. Типографика блоков – как в Editor Kit,
   набор блоков – как в Apple Заметках. */

.je{position:relative;border:1px solid var(--border-default);border-radius:var(--radius-lg);background:var(--bg-surface);display:flex;flex-direction:column;min-width:0}
.je-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:18px 20px 12px}
.je-title{display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.je-date{font-size:22px;letter-spacing:-0.015em;white-space:nowrap}
.je-badge{font-size:12px;line-height:1;padding:5px 9px;border-radius:var(--radius-pill);background:var(--bg-surface-alt);color:var(--text-secondary)}
.je-badge[hidden]{display:none}
.je-status{font-size:13px;color:var(--text-muted);white-space:nowrap}
.je-status.is-unsaved,.je-status.is-saving{color:var(--text-muted)}
.je-status.is-saved::before{content:"✓ ";color:var(--status-ok)}
.je-tabs{display:inline-flex;padding:3px;border-radius:var(--radius-pill);background:var(--bg-surface-alt)}
.je-tabs button{border:0;background:transparent;font:inherit;font-size:13px;color:var(--text-secondary);padding:5px 12px;border-radius:var(--radius-pill);cursor:pointer;transition:background .12s,color .12s}
.je-tabs button[aria-selected="true"]{background:var(--bg-page);color:var(--text-primary);box-shadow:var(--shadow-sm)}

.je-bar{display:flex;align-items:center;gap:2px;padding:6px 14px;border-top:1px solid var(--border-subtle);border-bottom:1px solid var(--border-subtle);overflow-x:auto;scrollbar-width:none;position:sticky;top:0;z-index:2;background:var(--bg-surface)}
.je-bar::-webkit-scrollbar{display:none}
.je .ic{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;display:block}
.je-tb .ic{color:var(--text-secondary)}
.je-tb:hover .ic{color:var(--text-primary)}
.je-tb.is-on .ic{color:var(--text-accent)}
.je-btn .ic{width:15px;height:15px}
.je-sep{flex:none;width:1px;height:18px;background:var(--border-default);margin:0 6px}
.je-tb{flex:none;display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 9px;border:0;border-radius:var(--radius-sm);background:transparent;color:var(--text-secondary);font:inherit;font-size:13px;cursor:pointer;white-space:nowrap;transition:background .12s,color .12s}
.je-tb:hover{background:var(--bg-surface-alt);color:var(--text-primary)}
.je-tb.is-on{background:var(--accent-tint);color:var(--text-accent)}
.je-tb .g{display:inline-flex;align-items:center;justify-content:center;min-width:14px;font-size:13px;line-height:1;color:var(--accent);font-style:normal}
.je-tb .g-it{font-style:italic;font-family:Georgia,serif}
.je-tb .g-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
.je-tb .g-mark{background:color-mix(in srgb,var(--status-warn) 35%,transparent);color:var(--text-primary);border-radius:3px;padding:1px 3px}
.je-tb .g-chk{width:12px;height:12px;min-width:0;border:1.5px solid var(--accent);border-radius:50%;box-sizing:border-box}
.je-tb .sw{width:11px;height:11px;border-radius:3px;border:1.5px solid}
.je-tb .sw-main{border-color:var(--status-info);background:var(--status-info-tint)}
.je-tb .sw-warn{border-color:var(--status-warn);background:var(--status-warn-tint)}
.je-bar.is-md .je-tb[data-cmd="undo"],.je-bar.is-md .je-tb[data-cmd="redo"]{display:none}

.je-canvas{padding:18px 20px 8px}
.je-doc{position:relative;outline:none;min-height:260px;font-size:16px;line-height:1.65;color:var(--text-primary);word-wrap:break-word;caret-color:var(--accent)}
.je-doc[hidden],.je-md[hidden]{display:none}
.je-doc.is-empty::before{content:attr(data-ph);position:absolute;color:var(--text-muted);pointer-events:none}
.je-doc > *:first-child{margin-top:0}
.je-doc p{margin:0;min-height:1.65em}
.je-doc h1{font-size:28px;font-weight:400;letter-spacing:-0.02em;line-height:1.2;margin:18px 0 6px}
.je-doc h2{font-size:22px;font-weight:400;letter-spacing:-0.015em;line-height:1.25;margin:16px 0 4px}
.je-doc h3{font-size:18px;font-weight:500;letter-spacing:-0.01em;line-height:1.3;margin:14px 0 2px}
.je-doc ul,.je-doc ol{margin:4px 0;padding-left:26px}
.je-doc li{margin:2px 0;padding-left:2px}
.je-doc ul:not(.je-chk) > li::marker{color:var(--accent)}
.je-doc ol > li::marker{color:var(--accent);font-variant-numeric:tabular-nums}
.je-doc .je-chk{list-style:none;padding-left:0}
.je-doc .je-chk > li{position:relative;padding-left:30px}
.je-doc .je-chk > li::before{content:"";position:absolute;left:2px;top:.3em;width:18px;height:18px;box-sizing:border-box;border:1.5px solid var(--border-strong);border-radius:50%;cursor:pointer;transition:background .12s,border-color .12s}
.je-doc .je-chk > li[data-checked="1"]::before{background:var(--accent);border-color:var(--accent)}
.je-doc .je-chk > li[data-checked="1"]::after{content:"";position:absolute;left:8.5px;top:calc(.3em + 4px);width:4px;height:8px;border:solid var(--accent-contrast);border-width:0 1.8px 1.8px 0;transform:rotate(45deg);pointer-events:none}
.je-doc .je-chk > li[data-checked="1"]{color:var(--text-muted);text-decoration:line-through;text-decoration-color:var(--border-strong)}
.je-doc blockquote{margin:8px 0;padding:2px 0 2px 16px;border-left:2px solid var(--accent);color:var(--text-secondary)}
.je-doc pre{margin:8px 0;padding:12px 14px;border-radius:var(--radius-md);background:var(--bg-surface-alt);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:14px;line-height:1.55;white-space:pre-wrap;tab-size:2}
.je-doc code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.88em;background:var(--bg-surface-alt);padding:1px 5px;border-radius:4px}
.je-doc mark{background:color-mix(in srgb,var(--status-warn) 30%,transparent);color:inherit;border-radius:2px;padding:0 1px}
.je-doc a{color:var(--text-accent);text-decoration:underline;text-decoration-color:var(--link);text-underline-offset:3px;cursor:text}
.je-doc hr{border:0;border-top:1px solid var(--border-default);margin:16px 0}
.je-doc s,.je-doc strike{text-decoration-color:var(--text-muted)}
.je-callout{display:flex;gap:12px;margin:10px 0;padding:14px 16px;border-radius:var(--radius-md)}
.je-callout strong{display:block;font-weight:500;font-size:15px}
.je-callout p{min-height:0}
.je-callout-mark{flex:none;width:18px;height:18px;margin-top:3px;border-radius:50%;border:1.5px solid;display:inline-flex;align-items:center;justify-content:center;font-size:11px;line-height:1;user-select:none}
.je-callout-main{background:var(--status-info-tint)}
.je-callout-main .je-callout-mark{color:var(--status-info)}
.je-callout-warn{background:var(--status-warn-tint)}
.je-callout-warn .je-callout-mark{color:var(--status-warn)}

.je-md{display:block;width:100%;box-sizing:border-box;min-height:260px;resize:none;border:0;outline:none;background:transparent;color:var(--text-primary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:14px;line-height:1.7;padding:0;overflow:hidden}

.je-foot{display:flex;align-items:center;gap:10px;padding:8px 14px 12px}
.je-hint{flex:1;min-width:0;font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}
.je-btn{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border:0;border-radius:var(--radius-pill);background:transparent;color:var(--text-secondary);font:inherit;font-size:13px;cursor:pointer;white-space:nowrap;transition:background .12s,color .12s}
.je-btn:hover{background:var(--bg-surface-alt);color:var(--text-primary)}
.je-btn-danger:hover{background:var(--status-danger-tint);color:var(--status-danger)}
.je-btn[hidden]{display:none}

.je-bubble,.je-pop{position:fixed;z-index:60;display:flex;align-items:center;gap:2px;padding:4px;border:1px solid var(--border-default);border-radius:var(--radius-md);background:var(--bg-surface);box-shadow:var(--shadow-pop)}
.je-bubble[hidden],.je-pop[hidden]{display:none}
.je-cite{max-width:240px;padding:0 8px;font-size:12px;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.je-pop{gap:6px;padding:6px}
.je-pop input{width:240px;height:32px;box-sizing:border-box;border:1px solid var(--border-default);border-radius:var(--radius-sm);padding:0 10px;font:inherit;font-size:14px;background:var(--bg-page);color:var(--text-primary);outline:none}
.je-pop input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus)}
.je-pop .je-btn{height:32px}

@media (max-width:760px){
  .je-head{padding:14px 14px 10px}
  .je-date{font-size:19px}
  .je-tabs{order:3;width:100%;justify-content:stretch}
  .je-tabs button{flex:1}
  .je-status{order:2}
  .je-bar{padding:6px 8px}
  .je-tb .l{display:none}
  .je-canvas{padding:14px 14px 6px}
  .je-doc,.je-md{min-height:200px}
  .je-hint{display:none}
  .je-foot{justify-content:space-between}
}
