/* Issues (Backorders and the Risk Finder in one list) and the opened item (orders.js, risk-item.js).
   karen-os-design section 0: a row says who, what's wrong, when and one action; the item opens as a pop-up
   with one filled button; red only when a date is missed. My day keeps its compact in-place version. */

/* The ? beside the page title */
.vhead { position: relative; }
details.helpq { align-self: flex-start; margin-left: auto; position: relative; }
details.helpq > summary { list-style: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  display: inline-grid; place-items: center; font: 700 14px var(--font); cursor: pointer; }
details.helpq > summary::-webkit-details-marker { display: none; }
details.helpq > summary:hover { color: var(--ink); border-color: var(--input); }
details.helpq > summary:focus-visible { outline: 2px solid var(--green-700); outline-offset: 2px; }
details.helpq:not([open]) > p { display: none; }
details.helpq[open] > p { position: absolute; right: 0; top: 36px; z-index: 5; width: min(360px, 80vw); margin: 0; padding: 12px 14px; font-size: 14px; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 14px rgba(22, 35, 29, 0.08); color: var(--grey-ink); }

/* The list and page frame are the shared parts (styles.css: .vhead, .search, .tabs, .list, .lrow).
   Only what Issues needs on top of them lives here. */
.oipage > .search { margin-top: -4px; }

/* The pop-up is the shared dialog.pop; this is the opened item inside it */
.ripop { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ripop .pop-ctx + .pop-h { margin-top: -12px; }
.ripop .statusline { margin: -6px 0 0; }
.ripop .ansbox { gap: 12px; }
.ripop .suggest { padding: 0; background: transparent; border: 0; gap: 12px; display: flex; flex-direction: column; }
.ripop .sugrow.pop-go { margin: 0; }
.ripop .pop-more { margin-top: -4px; }
.ripop .fold-body { gap: 14px; }
.ripop .fold-body:empty { display: none; }
.riph3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--grey-ink); }
.riplink { margin: 0; font-size: 14px; }
.ri-dpf { display: flex; flex-direction: column; gap: 6px; }
.ri-dpf > .l { margin: 0; font-size: 13px; font-weight: 600; color: var(--grey-ink); }
.riopen .dpick-in { width: auto; min-width: 160px; }

/* The opened item */
.riopen { min-width: 0; }
#daypanelbody .riopen { display: flex; flex-direction: column; gap: 10px; padding: 0; background: transparent; box-shadow: none; }
.riopen .xhead { position: relative; padding-right: 36px; }
.riopen .xhead .xclose { position: absolute; right: 0; top: -2px; }
.riopen .statusline { margin: 0; font-size: 14px; color: var(--grey-ink); }
.riopen .ansbox { display: flex; flex-direction: column; gap: 10px; border-top: 0; padding-top: 0; }
.riopen .factrow { max-width: 760px; }
.riopen .actform { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.riopen .actform .rowbtns { margin-top: 6px; }
.riopen textarea, .riopen select, .riopen input[type=text], .riopen input[type=email], .riopen input[type=date] {
  font: inherit; font-size: 15px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--input); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink);
  width: 100%; box-sizing: border-box; min-width: 0; }
.riopen textarea { min-height: 72px; resize: vertical; }
.riopen .sugfield input[type=date] { min-width: 150px; }
.riopen fieldset.choices.inline { flex-direction: row; flex-wrap: wrap; gap: 6px 8px; }
.riopen fieldset.choices.inline legend { flex-basis: 100%; }
.riopen .note { margin: 0; font-size: 13px; color: var(--muted); max-width: 68ch; }
.riopen label.l.sr { position: absolute; }
.riopen details.xlines .linelist { margin: 4px 0 0; padding-left: 18px; }

/* Customer email preview, in the job's brand */
.mailpv { border: 1px solid var(--divider); border-radius: 12px; background: var(--surface); padding: 12px 16px; max-width: 640px; font-size: 14px; line-height: 1.5; }
.mailpv .mpmeta { margin: 0 0 4px; color: var(--grey-ink); font-size: 13px; overflow-wrap: anywhere; }
.mailpv .mpmeta span { display: inline-block; min-width: 56px; color: var(--muted); font-weight: 600; }
.mailpv .mpbody { margin-top: 10px; padding: 12px 14px; border-radius: 10px; border-top: 3px solid #01A3B3; background: #F6F6F6; }
.mailpv.brand-c2u .mpbody { border-top-color: #560F1C; background: #F4F1F1; }
.mailpv.brand-ed .mpbody { border-top-color: #EB6D20; background: #F3F3F5; }
.mailpv .mpbody p { margin: 0 0 10px; overflow-wrap: anywhere; }
.mailpv .mpbody p:last-child { margin-bottom: 0; }
.mailpv .mphigh { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--divider); border-radius: 8px; }
.mailpv .mphigh b { font-size: 18px; color: #017D8A; }
.mailpv.brand-c2u .mphigh b { color: #560D20; }
.mailpv.brand-ed .mphigh b { color: #BE581A; }
.mailpv .mpnote { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* The 10 seconds before it goes */
.countdown { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 0; font-weight: 600; color: var(--ink); }

/* Job notes */
.jobnotes { max-width: 760px; }
.jobnotes h3 { margin: 4px 0 6px; font-size: 14px; font-weight: 700; color: var(--grey-ink); }
.jobnotes h3 small { font-weight: 600; color: var(--muted); }
.notelist { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notelist li { border-left: 3px solid var(--line); padding-left: 10px; min-width: 0; }
.notelist .nhead { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; font-size: 13px; }
.notelist .nhead span { color: var(--muted); }
.notelist .nacts { margin-left: auto; display: inline-flex; gap: 12px; }
.notelist p { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.noteadd { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.noteadd textarea { width: 100%; min-height: 56px; }

@media (max-width: 720px) {
  details.helpq[open] > p { position: static; width: auto; margin-top: 8px; }
  details.helpq { margin-left: 0; }
}
.xnotes { margin-top: 8px; }

/* My day, Next up: compact. One sentence, Karen suggests, quiet links; the rest behind Details */
.riopen.compact { gap: 8px; }
.riopen.compact .ansbox { gap: 6px; padding: 0; }
.riopen.compact .suggest { padding: 4px 0 0; background: transparent; border: 0; gap: 4px; }
.riopen.compact .sughead { margin-bottom: 2px; }
.riopen.compact .xlinks { margin-top: 0; gap: 0 18px; }
.riopen.compact .xlinks .xhand { display: inline-flex; gap: 0 18px; flex-wrap: wrap; }
.riopen.compact .xdetails { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; border-top: 1px solid var(--divider); }
.riopen.compact .sugrow { align-items: center; margin-top: 0; gap: 6px 14px; }
.riopen.compact .sugfield { flex: 0 1 168px; }
.riopen.compact .sugfield .l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
.riopen.compact .sugfield input[type=date] { min-width: 0; min-height: 44px; }
.riopen.compact .sugrow .btn { flex: 1 1 200px; min-height: 44px; }
.riopen.compact .xlinks a, .riopen.compact .xlinks .link { font-size: 14px; font-weight: 600; color: var(--green-700); text-decoration: none; min-height: 32px; }
.riopen.compact .xlinks a:hover, .riopen.compact .xlinks .link:hover { text-decoration: underline; }

/* The close icon is an inline SVG from orders.js; the shared .pop-x expects text */
.ripop .pop-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
/* The date picks sit on their own line above the button, everywhere (My day too) */
.riopen .sugfield.ri-dpf, .riopen.compact .sugfield.ri-dpf { flex: none; max-width: none; }
#needs-asks > .msg:empty, .oipage > .msg:empty { display: none; }
/* Context up front in the pop-up (Finn, 20 Oct 2026): what's at risk, where the job is, the cards */
.ripctx { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; padding: 12px 14px; background: var(--ground); border-radius: var(--r-ctl); }
.ripctx .linelist { margin: 0; padding-left: 18px; font-size: 14px; }
.ripctx .linelist li + li { margin-top: 4px; }
.ripctx .pop-facts.small dd { font-size: 14px; }
.ripctx .hint { margin: 0; }
/* Which PO an issue line is about; an overdue arrival is flagged red (colour is only for something wrong, and the line says "not ticked as arrived") */
.ri-po { font-weight: 700; overflow-wrap: anywhere; }
.ri-po small { font-weight: 400; color: var(--muted); font-size: 13px; }
.ripctx .linelist li.ri-flag { background: var(--red-bg); border-radius: 6px; padding: 4px 8px; }
.ripctx .linelist li.ri-flag .ri-po { color: var(--red); }
.ri-dline { margin-top: 8px; min-height: 44px; align-items: center; }
.ri-dline span { min-width: 0; overflow-wrap: anywhere; }
.ri-dline small { display: block; color: var(--muted); font-size: 13px; }
.ri-dline.late b { color: var(--red); }

/* Issues list in columns (3 Nov 2026): brand, order, customer, issue, job due, action */
.list.oi-cols { --lrow-cols: 30px 84px minmax(120px, 1fr) minmax(0, 2.4fr) 130px 120px; }
.list.oi-cols > .lrow.oihead { cursor: default; padding-top: 8px; padding-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: none; background: transparent; }
.list.oi-cols > .lrow.oihead:hover { background: transparent; }
.oirow > span { min-width: 0; }
.oirow .oi-no { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.oirow .oi-cust { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oirow .oi-why { font-size: 14px; color: var(--grey-ink); }
.oirow .oi-why small { display: block; font-size: 13px; color: var(--muted); }
/* Needs doing in parts, worst first (4 Nov 2026) */
.oi-part + .oi-part { margin-top: 24px; }
.oi-part .hint { margin: 2px 0 10px; }
.oirow .oi-with { color: var(--ink); font-weight: 600; }
.handed-note { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.handed-note q { color: var(--grey-ink); font-style: italic; }
.oirow .oi-due { font-size: 14px; font-weight: 600; color: var(--grey-ink); display: flex; flex-direction: column; }
.oirow .oi-due small { font-size: 12px; font-weight: 500; }
.oirow .oi-due.late { color: var(--red); }
@media (max-width: 760px) {
  .list.oi-cols > .lrow.oihead { display: none; }
  .list.oi-cols > .lrow.oirow { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .oirow .oi-brand { grid-row: 1 / span 3; align-self: start; }
  .oirow .oi-no, .oirow .oi-cust { grid-column: 2; }
  .oirow .oi-no { grid-row: 1; font-size: 13px; }
  .oirow .oi-cust { grid-row: 2; white-space: normal; }
  .oirow .oi-why { grid-column: 2 / -1; grid-row: 3; }
  .oirow .oi-due { grid-column: 3; grid-row: 1; text-align: right; align-items: flex-end; }
  .oirow .lrow-act { grid-column: 3; grid-row: 2; }
}
