/* client success > deals: a deal's group chat, opened under its row, read like a phone's text thread (oliver,
   2026-10-04: "if we can clean this up and make it look more like text messages and stuff, it looks kind of ugly here
   and hard to see"). our team on the right in a soft pink bubble, the brand's people on the left in grey, the student
   on the left in white with a hairline, so the three voices tell apart at a glance. markup: chatPanel in
   ui/deal-plan.js. loaded after the house files so their table and chat rules don't reach in. */

/* the row it opens in stays flat: no hover fill behind the card */
body.balanced-blue.minimal-calm .deal-plan-table tbody tr.deal-plan-chatrow:hover>td,
body.balanced-blue.minimal-calm .deal-plan-table tbody tr.deal-plan-chatrow>td{background:transparent}

/* the card: a hairline, no shadow, its own scroll area. lines up under the student's name and runs to the row's right
   edge (oliver, 2026-10-04: "probabkyl filling out the page a bit more at that point too": it stopped at 720px and
   left an empty band on the right). bubbles stay at most 70% of it */
body.balanced-blue.minimal-calm .deal-thread{
  --thread-us:color-mix(in srgb,var(--accent) 13%,var(--surface));
  --thread-brand:color-mix(in srgb,var(--ink) 6%,var(--surface));
  display:flex;flex-direction:column;max-width:none;margin:2px 0 6px 37px;overflow:hidden;
  border:1px solid var(--line);border-radius:var(--r-card);background:var(--surface);box-shadow:none;
  font-size:14px;line-height:1.45;color:var(--ink);text-align:left;white-space:normal}

/* header: logo, brand, dot + word, when grok read it, then got in / didn't get in / not interested and "open" with
   discord's logo on the right (oliver, 2026-10-05: up here in the bar, not under the box) */
body.balanced-blue.minimal-calm .deal-thread-head{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-height:44px;padding:8px 10px 8px 14px;border-bottom:1px solid var(--line)}
body.balanced-blue.minimal-calm .deal-thread-head strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600;line-height:20px}
body.balanced-blue.minimal-calm .deal-thread-state{--tone:var(--line-strong);display:inline-flex;align-items:center;gap:6px;flex:none;font-size:12.5px;line-height:16px;color:var(--secondary);white-space:nowrap}
body.balanced-blue.minimal-calm .deal-thread-state::before{content:"";flex:none;width:6px;height:6px;border-radius:50%;background:var(--tone)}
body.balanced-blue.minimal-calm .deal-thread-state[data-tone="asked"]{--tone:var(--bad);color:var(--bad-text)}
body.balanced-blue.minimal-calm .deal-thread-state[data-tone="waiting"]{--tone:var(--warn)}
body.balanced-blue.minimal-calm .deal-thread-state[data-tone="on"]{--tone:var(--ok);color:var(--ok-text)}
body.balanced-blue.minimal-calm .deal-thread-state[data-tone="no"]{--tone:var(--quiet)}
body.balanced-blue.minimal-calm .deal-thread-head small{flex:none;font-size:12px;line-height:16px;color:var(--quiet);white-space:nowrap}
body.balanced-blue.minimal-calm .deal-thread-head small:last-child{margin-left:auto}
body.balanced-blue.minimal-calm .deal-thread-tools{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:2px;margin-left:auto}
body.balanced-blue.minimal-calm .deal-thread-tools>.deal-plan-quiet{margin-left:0}
body.balanced-blue.minimal-calm .deal-thread-tools>.chat-open{margin-left:6px}

/* the thread: oldest at the top, opened at the newest (mount scrolls it). up to 560px so more of the chat shows (it was
   420px), less on a short screen so the box and buttons under it still fit */
body.balanced-blue.minimal-calm .deal-thread-scroll{max-height:560px;max-height:max(260px,min(560px,calc(100dvh - 340px)));overflow-y:auto;overscroll-behavior:contain;padding:14px 14px 16px;scrollbar-width:thin}
body.balanced-blue.minimal-calm .deal-thread-scroll:focus-visible{outline:2px solid var(--ring);outline-offset:-2px}
body.balanced-blue.minimal-calm .deal-thread-log{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}
/* one person's run of messages sits 4px apart; a new sender starts 12px down with their face and name (oliver,
   2026-10-05: "profile pictures along with the messages"). the face column stays empty down the run so it lines up;
   ours mirror it on the right */
body.balanced-blue.minimal-calm .deal-thread-msg{display:grid;grid-template-columns:28px minmax(0,1fr);column-gap:8px;justify-items:start;align-items:start;min-width:0;margin:12px 0 0}
body.balanced-blue.minimal-calm .deal-thread-msg.is-more{margin-top:4px}
body.balanced-blue.minimal-calm .deal-thread-msg>*{grid-column:2}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="us"]{grid-template-columns:minmax(0,1fr) 28px;justify-items:end}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="us"]>*{grid-column:1}
body.balanced-blue.minimal-calm .deal-thread-msg>.deal-thread-face{grid-row:1/span 2;margin-top:2px}
body.balanced-blue.minimal-calm .deal-thread-msg:not([data-voice="us"])>.deal-thread-face{grid-column:1}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="us"]>.deal-thread-face{grid-column:2}
body.balanced-blue.minimal-calm .deal-thread-face{position:relative;display:grid;place-items:center;width:28px;height:28px;overflow:hidden;border-radius:50%;background:var(--thread-brand);font-size:11.5px;font-weight:600;line-height:1;color:var(--secondary)}
body.balanced-blue.minimal-calm .deal-thread-face img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:var(--surface)}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="student"] .deal-thread-face{box-shadow:inset 0 0 0 1px var(--line)}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="us"] .deal-thread-face{background:var(--thread-us)}
body.balanced-blue.minimal-calm .deal-thread-from{max-width:70%;margin:0 12px 3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:16px;color:var(--secondary)}
body.balanced-blue.minimal-calm .deal-thread-bubble{box-sizing:border-box;max-width:70%;margin:0;padding:8px 12px;border-radius:16px 16px 16px 6px;background:var(--thread-brand);
  font-size:14px;line-height:1.45;color:var(--ink);white-space:pre-line;overflow-wrap:anywhere;word-break:break-word}
/* the corner nearest the sender is squarer, and so is the one joining a run */
body.balanced-blue.minimal-calm .deal-thread-msg.is-more .deal-thread-bubble{border-top-left-radius:6px}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="student"] .deal-thread-bubble{padding:7px 11px;border:1px solid var(--line);background:var(--surface)}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="us"] .deal-thread-bubble{border-radius:16px 16px 6px 16px;background:var(--thread-us)}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="us"].is-more .deal-thread-bubble{border-top-right-radius:6px}
body.balanced-blue.minimal-calm .deal-thread-bubble a{color:inherit;text-decoration:underline;text-decoration-color:color-mix(in srgb,currentColor 40%,transparent);text-underline-offset:2px}
body.balanced-blue.minimal-calm .deal-thread-bubble a:hover{text-decoration-color:currentColor}
/* pictures in a message (oliver, 2026-10-05: "images should load in too"), each opens full size */
body.balanced-blue.minimal-calm .deal-thread-pics{display:flex;flex-wrap:wrap;gap:4px;max-width:70%;margin-top:4px}
body.balanced-blue.minimal-calm .deal-thread-msg[data-voice="us"] .deal-thread-pics{justify-content:flex-end}
body.balanced-blue.minimal-calm .deal-thread-pics a{display:inline-flex;max-width:100%;overflow:hidden;border-radius:12px;outline:1px solid var(--line);outline-offset:-1px;background:var(--soft)}
body.balanced-blue.minimal-calm .deal-thread-pics img{display:block;width:auto;height:auto;max-width:min(240px,100%);max-height:240px}
/* grok's words for discord's look, drawn the way discord shows them (2026-10-06; markup: thread in ui/deal-plan.js):
   the message a reply answers as one quiet line above it, a tag of someone we know as the inbox's small pill
   (.chat-mention, ui/house-success.css), "edited" small under the bubble, a forwarded message in a grey card, and a
   picture grok saw but couldn't copy, or a file, as a small chip */
body.balanced-blue.minimal-calm .deal-thread-quote{box-sizing:border-box;max-width:70%;margin:0 12px 3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:16px;color:var(--secondary)}
body.balanced-blue.minimal-calm :is(.deal-thread-bubble,.deal-thread-fwd) .chat-mention{padding:0 2px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
body.balanced-blue.minimal-calm .deal-thread-edited{margin:2px 12px 0;font-size:11px;line-height:14px;color:var(--quiet)}
body.balanced-blue.minimal-calm .deal-thread-fwd{box-sizing:border-box;max-width:70%;margin:4px 0 0;padding:6px 10px;border:1px solid var(--line);border-left:3px solid var(--line-strong);border-radius:6px 12px 12px 6px;background:var(--soft);
  font-size:13px;line-height:1.4;color:var(--secondary);white-space:pre-line;overflow-wrap:anywhere;word-break:break-word}
body.balanced-blue.minimal-calm .deal-thread-fwd small{display:block;margin-bottom:1px;font-size:11px;line-height:14px;color:var(--quiet)}
body.balanced-blue.minimal-calm .deal-thread-fwd p{margin:0}
body.balanced-blue.minimal-calm .deal-thread-fwd a{color:inherit;text-decoration:underline;text-decoration-color:color-mix(in srgb,currentColor 40%,transparent);text-underline-offset:2px}
body.balanced-blue.minimal-calm .deal-thread-attach{box-sizing:border-box;display:inline-block;max-width:70%;margin-top:4px;padding:2px 10px;border:1px dashed var(--line-strong);border-radius:999px;font-size:12px;line-height:18px;color:var(--secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* reactions under an "edited" tag sit just below it instead of over it */
body.balanced-blue.minimal-calm .deal-thread-edited+.deal-thread-reacts{margin-top:2px}
/* reactions sit on the bottom edge of the message they're for, like discord's (oliver, 2026-10-05: not a message of
   their own); one emoji per pill, a count when more than one person used it */
body.balanced-blue.minimal-calm .deal-thread-reacts{position:relative;display:flex;flex-wrap:wrap;gap:4px;margin:-6px 8px 0}
body.balanced-blue.minimal-calm .deal-thread-react{display:inline-flex;align-items:center;gap:3px;min-height:22px;padding:0 7px;border:1px solid var(--line);border-radius:999px;background:var(--surface);font-size:13px;line-height:20px;cursor:default}
body.balanced-blue.minimal-calm .deal-thread-react small{font-size:11.5px;font-weight:500;color:var(--secondary)}
/* a time line after a quiet hour, and the quiet notes (no replies yet, a teammate's outcome note) */
body.balanced-blue.minimal-calm .deal-thread-time{margin:18px 0 2px;text-align:center;font-size:11.5px;line-height:16px;color:var(--quiet)}
body.balanced-blue.minimal-calm .deal-thread-log>li:first-child{margin-top:0}
body.balanced-blue.minimal-calm .deal-thread-time+.deal-thread-msg{margin-top:6px}
body.balanced-blue.minimal-calm .deal-thread-system{margin:14px 0 0;text-align:center;font-size:12.5px;line-height:18px;color:var(--secondary)}

/* the message box (oliver, 2026-10-04: "can you make the ability to send messages in these deal chats here as well like
   the inbox so we can send FUs to CMs"): the inbox's box under the messages. markup: ui/student-outbox.js dealComposer */
body.balanced-blue.minimal-calm .deal-thread-foot{padding:10px 14px;border-top:1px solid var(--line)}
body.balanced-blue.minimal-calm .deal-thread-foot .deal-composer{gap:6px 8px;padding:0;border-top:0}
/* the field reads like the inbox's in the deals tab and in the drawer (whose plain textarea is a tall, draggable one) */
body.balanced-blue.minimal-calm :is(#main,#drawer) .deal-composer textarea.input{min-height:44px;padding:11px 12px;border:1px solid var(--control-border);border-radius:var(--r-card);background:var(--surface);font-size:14px;line-height:21px;resize:none;overflow-y:hidden;scrollbar-width:thin}
body.balanced-blue.minimal-calm :is(#main,#drawer) .deal-composer textarea.input:is(:focus,:focus-visible){outline:none;box-shadow:none;border-color:var(--line-strong)}
body.balanced-blue.minimal-calm :is(#main,#drawer) .deal-composer textarea.input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
body.balanced-blue.minimal-calm :is(#main,#drawer) .deal-composer textarea.input::placeholder{color:var(--secondary)}
body.balanced-blue.minimal-calm .deal-composer .chat-composer-note{margin:0}

/* our message on its way: the inbox's pending bubble, its timer or state under it, faded until it's sent */
body.balanced-blue.minimal-calm .deal-thread-msg[data-outbox]:not([data-outbox="sent"]) .deal-thread-bubble{opacity:.78}
body.balanced-blue.minimal-calm .deal-thread-sending{max-width:70%;margin:3px 12px 0;font-size:11.5px;line-height:16px;color:var(--secondary);text-align:right}
body.balanced-blue.minimal-calm .deal-thread-sending .ful-link{display:inline;min-height:0;padding:0;border:0;background:none;font:inherit;font-weight:500;color:var(--ink);text-decoration:underline;text-decoration-color:color-mix(in srgb,currentColor 35%,transparent);text-underline-offset:2px;cursor:pointer}
body.balanced-blue.minimal-calm .deal-thread-sending .ful-link:hover{text-decoration-color:currentColor}
body.balanced-blue.minimal-calm .deal-thread-msg:is([data-outbox="failed"],[data-stuck]) .deal-thread-bubble{opacity:1;padding:7px 11px;border:1px solid color-mix(in srgb,var(--bad) 30%,transparent);background:var(--bad-wash);color:var(--bad-text)}
body.balanced-blue.minimal-calm .deal-thread-msg:is([data-outbox="failed"],[data-stuck]) .deal-thread-sending{color:var(--bad-text)}

@media(max-width:640px){
  body.balanced-blue.minimal-calm .deal-thread{margin-left:0}
  body.balanced-blue.minimal-calm :is(.deal-thread-bubble,.deal-thread-from,.deal-thread-quote,.deal-thread-fwd,.deal-thread-attach,.deal-thread-pics){max-width:82%}
  body.balanced-blue.minimal-calm .deal-thread-head{padding:8px 6px 8px 10px}
  /* a phone: the buttons take their own row under the name, open at its far end */
  body.balanced-blue.minimal-calm .deal-thread-tools{flex:1 0 100%;justify-content:flex-start;margin-left:-4px}
  body.balanced-blue.minimal-calm .deal-thread-tools>.deal-plan-quiet{padding:4px;white-space:nowrap}
  body.balanced-blue.minimal-calm .deal-thread-tools>.chat-open{margin-left:auto}
  body.balanced-blue.minimal-calm .deal-thread-foot{padding:10px}
  body.balanced-blue.minimal-calm :is(.deal-thread-sending){max-width:82%}
}

/* the same thread in the drawer, opened from a deal card in the inbox's side panel (ui/student-outbox.js openChat): it
   fills the drawer, the messages take the height and the buttons stay at the bottom */
body.balanced-blue.minimal-calm #drawer:has(.deal-chat) .drawer-footer{display:none}
body.balanced-blue.minimal-calm #drawer:has(.deal-chat) .drawer-body{display:flex;flex-direction:column;min-height:0}
body.balanced-blue.minimal-calm .deal-chat{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
/* the drawer is the card here: no second frame, and its title already names the deal, so the head is where it stands */
body.balanced-blue.minimal-calm .deal-chat .deal-thread{flex:1 1 auto;min-height:0;max-width:none;margin:0 -24px -24px;border:0;border-radius:0}
body.balanced-blue.minimal-calm .deal-chat .deal-thread-head{min-height:0;padding:0 24px 12px}
body.balanced-blue.minimal-calm .deal-chat .deal-thread-head>:is(.deal-plan-logo,strong){display:none}
body.balanced-blue.minimal-calm .deal-chat .deal-thread-scroll{flex:1 1 auto;min-height:160px;max-height:min(560px,calc(100dvh - 260px));padding:16px 24px}
body.balanced-blue.minimal-calm .deal-chat .deal-thread-foot{padding:12px 24px}
/* a phone's drawer is the whole screen: the messages take all of it */
@media(max-width:640px){body.balanced-blue.minimal-calm .deal-chat .deal-thread-scroll{max-height:calc(100dvh - 230px)}}

/* ---- inbox side panel: the deal cards (ui/student-outbox.js tracker). oliver, 2026-10-04: "For these boxes here as
   well, 'got in' and 'Didn't get in' and 'Remind', it looks like it's creating too much dead space. The buttons need to
   be more compacted". One row of quiet buttons like the thread's own (no boxes), pulled left so their words line up
   with the name: 187px for all three, which fits under the name in the panel's usual 320px even with a scrollbar
   showing. In the panel's narrowest (280px, a scrollbar showing) the row takes the card's whole width instead, so it
   still never wraps. Loaded after house-success.css, which draws the cards. ---- */
body.balanced-blue.minimal-calm .deal-track-actions{flex-wrap:wrap;gap:0;margin:4px 0 -2px -7px}
body.balanced-blue.minimal-calm .deal-track-actions .ful-link{min-height:26px;padding:0 7px;border:0;border-radius:var(--r-control);background:transparent;font-size:12.5px;font-weight:500;line-height:26px;color:var(--secondary)}
body.balanced-blue.minimal-calm .deal-track-actions .ful-link:hover{background:color-mix(in srgb,var(--ink) 7%,transparent);color:var(--ink);text-decoration:none}
body.balanced-blue.minimal-calm .deal-track-actions .ful-link:focus-visible{outline:2px solid var(--ring);outline-offset:-1px}
body.balanced-blue.minimal-calm .chat-details [data-outbox-tracker]{container-type:inline-size}
@container (max-width:245px){body.balanced-blue.minimal-calm .deal-track-actions{grid-column:1/-1}}

/* and the whole card opens its group chat: the name is the button, stretched over the card; the buttons on the card
   sit above it so they never open it (oliver, 2026-10-04: "you should be able to click on these boxes as well and be
   able to see maybe the group chat") */
body.balanced-blue.minimal-calm .deal-track-row:has(.deal-track-open){position:relative;cursor:pointer;transition:background-color .12s ease}
body.balanced-blue.minimal-calm .deal-track-row:has(.deal-track-open):hover{background:var(--soft)}
body.balanced-blue.minimal-calm .deal-track-row:has(.deal-track-open:focus-visible){outline:2px solid var(--ring);outline-offset:1px}
body.balanced-blue.minimal-calm .deal-track-row .deal-track-open{display:block;min-width:0;margin:0;padding:0;border:0;background:none;font:inherit;font-size:13px;font-weight:500;line-height:20px;color:var(--ink);text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
body.balanced-blue.minimal-calm .deal-track-row .deal-track-open:focus-visible{outline:none}
body.balanced-blue.minimal-calm .deal-track-open::after{content:"";position:absolute;inset:0;border-radius:var(--r-card)}
body.balanced-blue.minimal-calm .deal-track-row:has(.deal-track-open) :is(.deal-track-actions,button.deal-track-state){position:relative;z-index:1}
body.balanced-blue.minimal-calm .deal-track-row:has(.deal-track-open) .deal-track-actions{pointer-events:none}
body.balanced-blue.minimal-calm .deal-track-row:has(.deal-track-open) .deal-track-actions>*{pointer-events:auto}
@media (prefers-reduced-motion:reduce){body.balanced-blue.minimal-calm .deal-track-row:has(.deal-track-open){transition:none}}
