/*
 * Daily Life Doc, round 12 (zone E): the care team's Today editor (js/home/home-edit.js and its neighbours): the bar
 * Edit · + Block · Look · Ask AI, the Edit marks on each block (name, grey line, grip, the rules' pink lines), the
 * Fixed mark on the top, Ask AI's pink changes with Accept · Edit · Drop, the block's sheet, + Block, the Look sheet,
 * and Ask AI beside the view at a computer or at the foot on a phone. One type scale (the --t-* tokens), pink = the
 * care team's tokens (--care, --care-d, --tint-team). Every change moves (DD.motion); reduce motion drops it.
 */

/* The bar */
.he-bar { display: flex; gap: 6px; padding: 4px; margin: 0 0 4px; border-radius: 16px; background: var(--soft); }
.he-b { flex: 1; min-width: 0; height: 40px; border-radius: 12px; font-size: var(--t-s); font-weight: 600; color: var(--ink2); white-space: nowrap;
  transition: background-color var(--m-step) ease, color var(--m-step) ease, transform var(--m-press) var(--ease-out); }
.he-b:active { transform: scale(.97); }
.he-b[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.he-b-ai { color: var(--care-d); }

/* Edit: the blocks get their name and grey line; the top is marked Fixed */
.he-fixed { margin: 0 0 6px 4px; font-size: var(--t-xs); font-weight: 700; color: var(--ink2); }
.he-editing .home-top { outline: 1.5px dashed var(--line); outline-offset: 3px; border-radius: 22px; }
.he-editing .hb { outline: 1.5px dashed var(--line); outline-offset: 3px; cursor: pointer; transition: outline-color var(--m-step) ease, transform var(--m-press) var(--ease-out); }
.he-editing .hb:hover { outline-color: var(--ink3); }
.he-tag { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 12px 6px 4px; font-size: var(--t-xs); line-height: 1.35; }
.he-name { font-weight: 700; color: var(--ink); }
.he-grey { flex: 1 1 180px; min-width: 0; color: var(--ink2); overflow-wrap: anywhere; }
.he-grey.is-mis { color: var(--red); font-weight: 600; }
.he-grip { flex: none; align-self: center; width: 28px; height: 28px; margin-right: 2px; border-radius: 8px; cursor: grab; touch-action: none;
  background: radial-gradient(circle, var(--ink3) 1.3px, transparent 1.6px) 0 0 / 7px 7px; background-origin: content-box; padding: 7px 6px; opacity: .7; }
.he-dragging { z-index: 5; box-shadow: 0 18px 30px -16px var(--shadow); transition: none !important; }
.he-rules { flex-basis: 100%; display: flex; flex-direction: column; gap: 2px; }
.he-rule { align-self: flex-start; padding: 2px 8px; border-radius: 8px; font-size: var(--t-xs); font-weight: 500; color: var(--care-d); background: var(--tint-team); text-align: left; }
.he-rrow { display: flex; flex-direction: column; gap: 2px; margin: -2px 0 6px 34px; }
.home[data-side="care"] .hb-misfit { outline: 1.5px solid color-mix(in srgb, var(--red) 55%, transparent); outline-offset: 3px; }

/* Ask AI's change, pink on its block, before Accept */
.home[data-side="care"] .hb-pink { outline: 2px solid color-mix(in srgb, var(--care-d) 45%, transparent); outline-offset: 3px; animation: he-pink-in 320ms ease both; }
.home[data-side="care"] .hb-pink-remove > :not(.he-pend):not(.he-tag) { opacity: .45; }
@keyframes he-pink-in { from { outline-color: transparent; } }
.he-pend, .he-lookp { margin: 8px 0 0; padding: 10px 12px 12px; border-radius: 16px; background: var(--tint-team); }
.he-lookp { margin: 0 0 4px; }
.he-pw { font-size: var(--t-sm); font-weight: 600; color: var(--care-d); line-height: 1.4; overflow-wrap: anywhere; }
.he-pwhy { margin-top: 2px; font-size: var(--t-xs); color: var(--ink2); }
.he-pend .cn, .he-lookp .cn { margin-top: 6px; }
.he-pa { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.he-pb { min-width: 72px; height: 36px; padding: 0 14px; border-radius: 11px; font-size: var(--t-s); font-weight: 600; background: var(--surface); color: var(--ink);
  transition: transform var(--m-press) var(--ease-out), opacity var(--m-step) ease; }
.he-pb.ink { background: var(--ink); color: var(--on-ink); }
.he-pb:active { transform: scale(.97); }
.he-pb:disabled { opacity: .5; }

/* The sheets: one block, + Block, Look */
.he-lab { margin: 16px 0 6px; font-size: var(--t-xs); font-weight: 600; color: var(--ink2); }
.he-lab:first-child, .he-cn + .he-lab { margin-top: 2px; }
.he-seg { display: flex; }
.he-seg .seg-o { flex: 1; }
.seg-o[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.he-lines { display: flex; flex-direction: column; }
.he-opt { justify-content: space-between; min-height: 48px; }
.he-opt small { flex: none; font-size: var(--t-xs); color: var(--ink2); }
.he-opt[aria-pressed="true"] span { font-weight: 700; }
.he-opt[aria-pressed="true"]::after { content: ''; flex: none; width: 9px; height: 5px; margin: 0 4px 3px 0; border: solid var(--ink); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.he-f { width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; font: inherit; font-size: var(--t-m); color: var(--ink); resize: vertical; }
.he-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.he-acts .btn { flex: 1 1 auto; }
.he-rm { color: var(--red); }
.he-cn:empty { display: none; }
.he-cn { margin-bottom: 10px; }
.he-for { margin-bottom: 4px; }
.he-add-list > .he-lab:first-child { margin-top: 14px; }
.he-for-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.he-for-row .chip-o { flex: none; }
.chip-o[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
/* Round 12 (fixer FE): a block's content by hand: the picture, Upload, Make with AI, the picture made in pink */
.hm-pic:empty { display: none; }
.hm-img { display: block; width: 100%; max-width: 280px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; background: var(--tint); }
.hm-acts { margin-top: 10px; }
.hm-ask { margin-top: 12px; }
.hm-pend { margin-top: 12px; padding: 12px; border-radius: 16px; background: var(--tint-team); }
.hm-pend .im-box { max-width: 280px; }
.hm-aud:empty { display: none; }
.he-add-o { justify-content: space-between; min-height: 60px; }
.he-add-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.he-add-t b { font-size: var(--t-m); font-weight: 600; }
.he-add-t small { font-size: var(--t-xs); font-weight: 400; color: var(--ink2); }
.he-none { padding: 18px 2px; }
.he-sws { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.he-sw, .he-ch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 16px; font-size: var(--t-xs); font-weight: 600; color: var(--ink2);
  box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow var(--m-step) ease, transform var(--m-press) var(--ease-out); }
.he-sw[aria-pressed="true"], .he-ch[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.he-sw-c { width: 44px; height: 30px; border-radius: 10px; background: var(--sw-bg); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.he-sw-c i { width: 14px; height: 14px; border-radius: 50%; background: var(--sw-dot); }
.he-chs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.he-ch-fig { display: block; width: 52px; height: 52px; }

/* The card in the chat */
.tc-ops { margin: 2px 0 6px 18px; font-size: var(--t-s); line-height: 1.5; }

/* Ask AI: at the foot of the page on a phone, after the blocks and never over them (fixer FE, WALK-1 #12: a sticky box
   with its band hid a third of the patient's view and the Edit bar), the newest ask only; beside the view at a computer */
.he-ai { position: relative; margin: 20px 0 0; padding: 0; }
.he-ai-box { display: grid; gap: 6px; padding: 10px 10px 10px 12px; border-radius: 20px; background: var(--surface); pointer-events: auto;
  box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(0, 0, 0, .35); }
.he-ai-h { display: none; font-size: var(--t-s); font-weight: 600; color: var(--care-d); }
.he-ai-log { display: grid; gap: 10px; max-height: 40dvh; overflow-y: auto; scrollbar-width: none; }
.he-ai-log:empty { display: none; }
.he-ai-e { display: grid; gap: 4px; min-width: 0; }
.he-ai-e:not(.is-last), .he-ai-e.is-settled { display: none; }
.he-ai-e .he-ai-q, .he-ai-e .he-ai-c:not(.he-ai-chat) { display: none; } /* on a phone: the short line and the Could not lines only */
.he-ai-sum { font-size: var(--t-sm); font-weight: 500; color: var(--care-d); }
.he-ai-q { justify-self: end; max-width: 88%; padding: 6px 12px; border-radius: 14px; font-size: var(--t-sm); color: var(--care-d); background: var(--tint-team); overflow-wrap: anywhere; }
.he-ai-w { font-size: var(--t-sm); color: var(--ink2); }
.he-ai-c { font-size: var(--t-sm); color: var(--ink2); overflow-wrap: anywhere; text-align: left; }
.he-ai-c.is-open { color: var(--care-d); font-weight: 500; }
.he-ai-chat { display: flex; align-items: center; min-height: 36px; }
.he-ai-f { display: flex; align-items: flex-end; gap: 8px; }
.he-ai-in { flex: 1; min-width: 0; min-height: 40px; max-height: 132px; padding: 9px 14px; border: 0; border-radius: 20px; background: var(--soft); font: inherit; font-size: var(--t-m); color: var(--ink); resize: none; }
.he-ai-go { flex: none; margin-bottom: 2px; }
.he-ai-go:disabled { opacity: .35; animation: none; }
.he-foot:empty { display: none; }
.he-foot { display: flex; flex-direction: column; align-items: flex-start; padding: 12px 4px 0; }
.he-foot .tp-h { margin-bottom: 2px; }

@media (min-width: 1100px) {
  .phone.is-wide[data-wide="today"] .home.he-on { display: grid; grid-template-columns: minmax(0, 600px) 380px; column-gap: 36px; justify-content: center; align-content: start; }
  .phone.is-wide[data-wide="today"] .home.he-on > * { grid-column: 1; }
  .phone.is-wide[data-wide="today"] .home.he-on > .he-ai { grid-column: 2; grid-row: 1 / span 6; align-self: start; position: sticky; top: 4px; bottom: auto; margin: 0; padding: 0; background: none; }
  .phone.is-wide[data-wide="today"] .he-ai-box { padding: 14px 16px 12px; }
  .phone.is-wide[data-wide="today"] .he-ai-h { display: block; }
  .phone.is-wide[data-wide="today"] .he-ai-e:not(.is-last), .phone.is-wide[data-wide="today"] .he-ai-e.is-settled { display: grid; }
  .phone.is-wide[data-wide="today"] .he-ai-e .he-ai-q, .phone.is-wide[data-wide="today"] .he-ai-e .he-ai-c:not(.he-ai-chat) { display: block; }
  .phone.is-wide[data-wide="today"] .he-ai-sum { display: none; }
  .phone.is-wide[data-wide="today"] .he-ai-log { max-height: calc(100dvh - 220px); }
  /* Fixer FE (WALK-1 #6): a block's sheet and the Look stand in the right column, over Ask AI, with no dark cover:
     the block it edits stays in sight and every change shows on it at once; another block can be tapped. */
  .phone.is-wide[data-wide="today"] #sheet.he-side { left: calc(50% + 128px); right: auto; width: 380px; top: auto; bottom: 16px; height: auto;
    max-height: calc(100% - 32px); border-radius: 24px; box-shadow: 0 1px 0 var(--line), 0 18px 48px -20px rgba(0, 0, 0, .45); transform: translateY(calc(100% + 24px)); }
  .phone.is-wide[data-wide="today"] #sheet.he-side.on { transform: none; }
  .phone.is-wide[data-wide="today"]:has(#sheet.he-side.on) .scrim { opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) { .hb-pink { animation: none; } .he-b, .he-pb, .he-sw, .he-ch { transition: none; } }
