/* Daily Life Doc, round 11 (zone E1; the page "Themes and Documents", Parts 6 and 8): the document editor
   (js/docs/doc-edit.js and its neighbours): sections, rows, the AI's changes in place with Accept and Drop, Ask AI
   beside the editor (a column at a computer, a sheet at the foot on a phone). Round 12 (zone DE): templates and
   Review's list gone; the new places and the pink are css/doc-pink.css. Loaded after
   css/doc.css, whose round 10 `.de-*` rules this file overrides where the editor changed. */

/* ---------- 1. The list, the sections ---------- */
.de { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.de-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
/* A long address or a row of chips never widens the list past the phone (round 12: a pasted address did at 340 px). */
.de-b .de-m, .de-s > span { min-width: 0; overflow-wrap: anywhere; }
.de-sh { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: 14px 0 0; }
.de-list > .de-sh:first-child { margin-top: 2px; }
.de-st { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; text-align: left; }
.de-st span { font-size: var(--t-m); font-weight: 600; letter-spacing: -0.005em; color: var(--ink); overflow-wrap: anywhere; }
.de-st small { font-size: var(--t-xs); font-weight: 500; color: var(--ink3); }
.de-st:active { opacity: .6; }
.de-st .de-old { display: inline; font-size: var(--t-s); }
.de-sh.is-new .de-st span::after { content: "New"; margin-left: 8px; padding: 1px 7px; border-radius: 8px; background: var(--good-bg); color: var(--good-d); font-size: var(--t-2xs); font-weight: 600; vertical-align: 2px; }
.de-so { flex-basis: 100%; display: grid; gap: 8px; padding: 10px 12px 6px; border-radius: 18px; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.de-sf { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 12px; font: inherit; font-size: var(--t-s); line-height: 1.45; resize: none; overflow: hidden; }

/* The round mark that picks what Ask AI is about (only with Ask AI on). */
.de-pk { flex: none; display: grid; place-items: center; width: 34px; height: 44px; margin-left: -4px; }
.de-pk i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink3) 45%, transparent); transition: background var(--m-step) ease, box-shadow var(--m-step) ease; }
.de-pk.on i { background: var(--ink); box-shadow: inset 0 0 0 5px var(--ink), inset 0 0 0 9px var(--surface); }
.de-pk:active i { transform: scale(.9); }

/* ---------- 2. A row ---------- */
.de-b { display: flex; align-items: flex-start; gap: 2px; padding: 4px 12px 4px 8px; border-radius: 18px; background: var(--surface); box-shadow: 0 1px 0 var(--line); transition: box-shadow var(--m-step) ease, background var(--m-step) ease; }
.de:not(.is-ask) .de-b { padding-left: 14px; }
.de-b.open { box-shadow: inset 0 0 0 1.5px var(--ink); }
.de-b.picked:not(.open) { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 35%, transparent); }
.de-b.muted .de-s > span { font-style: italic; color: var(--ink2); }
.de-m { flex: 1; min-width: 0; display: grid; gap: 8px; padding: 0 0 4px; }
.de-s { min-height: 44px; padding: 4px 0; }
.de-no { margin-left: 8px; font-weight: 600; color: var(--bad); }
.de-ref { margin: 0; font-size: var(--t-xs); color: var(--ink2); }
.de-b .dx-chips { margin: -2px 0 4px; }
.de-ra { display: flex; align-items: center; gap: 4px; padding-top: 2px; }
.de-ra button { display: grid; place-items: center; min-width: 40px; height: 40px; border-radius: 12px; color: var(--ink2); font-size: var(--t-sm); font-weight: 500; }
.de-ra button svg { width: 15px; height: 15px; }
.de-ra button[data-de="up"] svg, .de-ra button[data-de="sup"] svg { transform: rotate(-90deg); }
.de-ra button[data-de="down"] svg, .de-ra button[data-de="sdown"] svg { transform: rotate(90deg); }
.de-ra button[disabled] { opacity: .3; }
.de-ra button:active { background: var(--soft); }
.de-ra .de-rw { padding: 0 10px; }
.de-ra .quiet { color: var(--ink3); }
.de-sp { flex: 1; }
.de-num { display: grid; grid-template-columns: 1fr 96px; align-items: center; gap: 8px; }
.de-fs select.de-f { appearance: none; -webkit-appearance: none; }

/* A Quiz's questions. */
.de-qzs { display: grid; gap: 12px; }
.de-fs > .de-chip { justify-self: start; }
.de-qz { display: grid; gap: 6px; padding-top: 4px; }
.de-qh { display: flex; align-items: center; justify-content: space-between; }
.de-qx { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink3); }
.de-qx svg { width: 12px; height: 12px; }
.de-ok { display: flex; flex-wrap: wrap; gap: 6px; }
.de-okb { min-height: 34px; padding: 0 12px; border-radius: 17px; background: var(--soft); font-size: var(--t-xs); color: var(--ink2); }
.de-okb.on { background: var(--good-bg); color: var(--good-d); font-weight: 600; }
.de-okb.on::before { content: "✓ "; }

/* ---------- 3. The AI's changes in the document ---------- */
.de-b.chg { padding: 10px 12px 8px 14px; }
/* Round 12 (zone DE): a change of Ask AI is pink in the hand edit too, as in the draft (css/doc-pink.css). */
.de-b.chg { background: color-mix(in srgb, var(--care) 45%, var(--surface)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--care-d) 40%, transparent); }
.de-b.chg.open { box-shadow: inset 0 0 0 1.5px var(--care-d); }
.de-b.chg.t-removed { background: color-mix(in srgb, var(--care) 25%, var(--surface)); }
.de-b.chg.t-removed .de-cw { opacity: .6; }
.de-cw { display: grid; gap: 4px; font-size: var(--t-sm); line-height: 1.5; color: var(--ink); }
.de-k { font-size: var(--t-2xs); font-weight: 600; color: var(--ink3); text-transform: none; }
.de-old { display: block; color: var(--ink3); text-decoration-thickness: 1px; }
.de-new { display: grid; gap: 2px; }
.de-new ins { text-decoration: none; background: color-mix(in srgb, var(--good-bg) 80%, transparent); border-radius: 4px; padding: 0 3px; margin-left: -3px; }
.de-cb { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.de-tag { flex: none; padding: 2px 8px; border-radius: 8px; font-size: var(--t-2xs); font-weight: 600; background: var(--surface); color: var(--ink2); }
.de-tag.t-new { background: var(--surface); color: var(--care-d); }
.de-why { flex: 1; min-width: 0; font-size: var(--t-xs); color: var(--ink2); }
.de-acc, .de-drop { flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; font-size: var(--t-sm); font-weight: 600; transition: opacity var(--m-press) ease; }
.de-acc { background: var(--ink); color: var(--on-ink); }
.de-drop { background: var(--soft); color: var(--ink2); }
.de-acc:active, .de-drop:active { opacity: .6; }
.de-all { position: sticky; top: -6px; z-index: 3; display: flex; align-items: center; gap: 8px; margin: 0 -4px 6px; padding: 8px 6px 8px 12px; border-radius: 18px; background: color-mix(in srgb, var(--bg) 96%, transparent); box-shadow: 0 6px 16px -12px rgba(0, 0, 0, .3); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.de-all[hidden] { display: none; }
.de-all span { flex: 1; font-size: var(--t-sm); font-weight: 600; color: var(--ink); }

/* ---------- 4. The foot: + Block, + Section ---------- */
.de-foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.de-ft { display: flex; gap: 8px; }
.de-plus { min-height: 42px; padding: 0 16px; border-radius: 21px; background: var(--soft); font-size: var(--t-sm); font-weight: 600; color: var(--ink2); transition: opacity var(--m-press) ease; }
.de-plus[aria-expanded="true"] { background: var(--ink); color: var(--on-ink); }
.de-plus:active { opacity: .6; }
.de-foot .de-chips { padding: 2px 0 4px; }

/* ---------- 5. Ask AI: a sheet at the foot on a phone ---------- */
.dcp-ai[hidden] { display: none; }
.dcp-ai { position: sticky; bottom: -96px; z-index: 4; margin: auto calc(-1 * var(--gut)) 0; padding: 18px 10px 12px; background: linear-gradient(transparent, var(--bg) 18px); }
.da { display: grid; gap: 8px; padding: 10px 12px 10px; border-radius: 22px; background: var(--surface); box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(0, 0, 0, .35); }
.dcp-ai.has-th .da { max-height: 56dvh; overflow-y: auto; scrollbar-width: none; }
.da-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.da-h b { font-size: var(--t-s); font-weight: 600; }
.da-th { display: grid; gap: 6px; }
.da-th[hidden], .da-chips[hidden] { display: none; }
.da-me { justify-self: end; max-width: 88%; padding: 8px 12px; border-radius: 16px 16px 6px 16px; background: var(--tint-team); font-size: var(--t-sm); line-height: 1.45; }
.da-steps { margin: 0; font-size: var(--t-2xs); line-height: 1.5; color: var(--ink3); }
.da-res { margin: 0; font-size: var(--t-sm); color: var(--ink); }
.da-res .quiet.link { min-height: 28px; font-size: var(--t-sm); }
.da-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 0 2px; }
.da-chip { flex: none; min-height: 34px; padding: 0 12px; border-radius: 17px; background: var(--soft); font-size: var(--t-xs); font-weight: 500; color: var(--ink2); white-space: nowrap; transition: opacity var(--m-press) ease; }
.da-chip:active { opacity: .6; }
.da-chip[disabled] { opacity: .45; }
.da-chip.da-rv { color: var(--ink); font-weight: 600; }
.dcp-ai .da-h { display: none; } /* the head row (Ask AI, Review) only in the column at a computer */
.da-about[hidden] { display: none; }
.da-about { display: flex; align-items: center; gap: 4px; min-height: 24px; font-size: var(--t-xs); color: var(--ink2); }
.da-about span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-x { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--ink3); }
.da-x svg { width: 11px; height: 11px; }
.da-box { margin: 0 -4px -2px; }

/* DF2: on a phone Ask AI is one closed bar (the field) until tapped (js/docs/doc-ask-ai.js `is-shut`). */
@media (max-width: 1099px) {
  .dcp-ai.is-shut .da-th, .dcp-ai.is-shut .da-chips, .dcp-ai.is-shut .da-about { display: none; }
  .dcp-ai.is-shut .da { max-height: none; padding-top: 6px; padding-bottom: 6px; }
}
/* DF2 (DESIGN-1 32): the circles that pick a section or a block for Ask AI show only while Ask AI is open, while
   something is picked, or under the pointer at a computer; hidden they take no tap. */
.dcp .de-pk { opacity: 0; pointer-events: none; transition: opacity var(--m-step) ease; }
.dcp.is-asking .de-pk, .dcp.has-pick .de-pk, .de-pk.on, .de-pk:focus-visible { opacity: 1; pointer-events: auto; }
/* FR2 (REVIEW 10): at a computer Ask AI is a column that stays open, so a circle stands only on the picked block and
   under the pointer, never an empty circle on every section and block after an ask. */
@media (min-width: 1100px) and (hover: hover) {
  .dcp.is-asking .de-pk:not(.on), .dcp.has-pick .de-pk:not(.on) { opacity: 0; pointer-events: none; }
}
@media (hover: hover) {
  .dcp .de-sh:hover .de-pk, .dcp .de-b:hover .de-pk { opacity: 1; pointer-events: auto; }
}

/* ---------- 6. Ask AI as a column at a computer ---------- */
@media (min-width: 1100px) {
  .phone.is-wide[data-wide="document"] .dcp.has-ai { display: grid; grid-template-columns: minmax(0, 720px) 360px; column-gap: 36px; justify-content: center; align-content: start; }
  .phone.is-wide[data-wide="document"] .dcp.has-ai > * { grid-column: 1; }
  .phone.is-wide[data-wide="document"] .dcp.has-ai > .dcp-ai { grid-column: 2; grid-row: 1 / span 12; align-self: start; position: sticky; top: 4px; bottom: auto; margin: 0; padding: 0; background: none; }
  .phone.is-wide[data-wide="document"] .dcp-ai .da { max-height: calc(100dvh - 140px); overflow-y: auto; padding: 14px 16px 12px; }
  .phone.is-wide[data-wide="document"] .da-chips { flex-wrap: wrap; overflow: visible; }
  .phone.is-wide[data-wide="document"] .da-chip.da-rv { display: none; }
  .phone.is-wide[data-wide="document"] .dcp-ai .da-h { display: flex; }
}

/* Write / Fit / Keep: three small segments (a section's controls). */
.de-fill { display: inline-flex; justify-self: start; gap: 2px; padding: 2px; border-radius: 14px; background: var(--soft); }
.de-fb { display: inline-grid; place-items: center; min-height: 32px; padding: 0 12px; border-radius: 12px; font-size: var(--t-xs); font-weight: 600; color: var(--ink2); transition: background var(--m-step) ease, color var(--m-step) ease; }
.de-fb.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

@media (prefers-reduced-motion: reduce) {
  .de-b, .de-pk i, .de-fb, .de-acc, .de-drop, .de-plus, .da-chip { transition: none; }
}

/* Nothing wider than the page at 340 px: the chips scroll inside their own row, and a long row of Versions ("Care
   team · From Ask AI: make the steps shorter") wraps. */
.da > *, .de-m, .de-cw { min-width: 0; }
.dcp-vers .nw { white-space: normal; }

/* ---------- DESIGN-1 finding 55 (fixer FD): Edit keeps each block as the patient sees it ---------- */
/* A grey line with the block's name over the block drawn as the patient reads it (as Today's Edit); the drawn block
   takes no taps of its own: a tap anywhere on it opens the hand edit. */
.de-look { display: grid; gap: 6px; padding: 8px 0 4px; text-align: left; cursor: pointer; }
.de-look:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 10px; }
.de-gl { font-size: var(--t-xs); font-weight: 600; line-height: 18px; color: var(--ink3); letter-spacing: .01em; }
.de-view { pointer-events: none; min-width: 0; overflow-wrap: anywhere; }
.de-view > .dk, .de-view > section, .de-view > figure, .de-view > a { margin: 0; }
.de-view .dk-pic img { max-height: 240px; width: auto; max-width: 100%; }
.de-sum { margin: 0; font-size: var(--t-s); color: var(--ink2); }
.de-b:not(.open) .de-look:active { opacity: .7; }
