/* Editing in place (static/edit.js, crm/web/pages/inline.py). The theme's variables are app.css's. */

/* a value that edits on a double-click says so on hover and on focus */
[data-inline] { cursor: text; border-radius: var(--radius-sm); outline-offset: 2px; transition: background-color 0.12s; }
[data-inline]:hover { background: var(--accent-wash); box-shadow: 0 0 0 3px var(--accent-wash); }
[data-inline]:focus-visible { outline: 2px solid var(--accent); }

/* formatted notes: paragraphs, lists and links, not the raw text's line breaks */
.rich { white-space: normal; overflow-wrap: anywhere; }
.rich p { margin: 0 0 0.45em; }
.rich p:last-child, .rich ul:last-child, .rich ol:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 0.2em 0 0.45em; padding-left: 1.4em; }
.rich li { margin: 0.1em 0; }
.rich a { color: var(--accent-ink); text-decoration: underline; }

/* pain, objection and next step, each a block of its own under the text */
.note-block { display: grid; grid-template-columns: 7.5em 1fr; gap: 10px; margin: 6px 0 0; font-size: 0.92rem; padding: 2px 4px; }
.note-label { color: var(--muted); }
.due-chip { color: var(--muted); white-space: nowrap; }

/* "+ Pain": what is not there yet, shown on the item's hover or when focus is in it (always on a touch
   screen); out of the layout otherwise, so an item without it takes no blank line */
.inline-add { display: none; font: inherit; font-size: 0.8rem; color: var(--muted); background: none; border: 1px dashed var(--hairline); border-radius: 999px; padding: 1px 9px; margin: 6px 6px 0 0; cursor: pointer; }
.inline-add:hover, .inline-add:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
.event:hover .inline-add, .event:focus-within .inline-add, .step:hover .inline-add, .inline-add:focus { display: inline-block; }
@media (hover: none) { .inline-add { display: inline-block; } }
.inline-note { margin: 4px 0 0; font-size: 0.85rem; color: var(--warning-ink); }

/* the editor, in the value's place */
.inline-form { display: block; margin: 6px 0; padding: 10px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-wash); }
.inline-step + .inline-form, .step .inline-form { flex: 1 1 100%; }
.inline-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.inline-input { width: 100%; box-sizing: border-box; font: inherit; }
textarea.inline-input { resize: vertical; min-height: 2.4em; overflow: hidden; }
.rich-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 6px; }
.rich-btn { font: inherit; font-size: 0.82rem; min-width: 2.2em; padding: 3px 8px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--page); color: var(--ink); cursor: pointer; }
.rich-btn:hover { border-color: var(--baseline); }
/* the box grows with the text and can be pulled taller: no small fixed window */
.rich-editor { min-height: 6em; max-height: 70vh; overflow: auto; resize: vertical; padding: 8px 10px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--page); line-height: 1.5; }
.rich-editor:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.inline-due { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 8px 0 0; font-size: 0.88rem; }
.inline-due .chip { cursor: pointer; border: 1px solid var(--hairline); }
.inline-due .chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.inline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 0; }
.inline-form .form-error:empty { display: none; }
@media (max-width: 560px) { .note-block { grid-template-columns: 1fr; gap: 0; } }
