/* Help requests and files on records. Loaded after app.css and uses its tokens, so an org's accent color applies. */

/* ---------- the Help dialog ---------- */
.help-dialog { padding: 0; border: 0; margin-block-start: 6vh; inline-size: min(720px, 100vw - 24px); max-block-size: 88vh; overflow-y: auto; background: var(--ground); color: var(--ink); box-shadow: var(--shadow-card); }
.help-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.help-box { display: grid; }
.help-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 22px; background: var(--ground-alt); position: sticky; inset-block-start: 0; z-index: 2; }
.help-top h2 { font-size: 18px; }
.help-top .help-x { margin-inline-start: auto; }
.help-body { display: grid; gap: 18px; padding: 20px 22px 24px; }
.help-form { display: grid; gap: 20px; }
.help-form textarea { resize: vertical; min-block-size: 120px; }
.help-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.help-urgency { display: grid; gap: 6px; }
.help-ctx { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-inline-size: 0; }
.help-ctx legend { padding: 0; margin-block-end: 8px; }
.help-ctx-list, .help-files, .help-mine, .convo, .help-history, .docs-list { list-style: none; margin: 0; padding: 0; }
.help-ctx-list li { border-block-start: 1px solid var(--line); }
.help-ctx-list li:last-child { border-block-end: 1px solid var(--line); }
.help-ctx-list .check { display: flex; align-items: start; gap: 12px; padding: 9px 0; font-size: 14px; }
.help-ctx-list .check input { margin-block-start: 2px; flex: none; }
.help-ctx-list .check > span { min-inline-size: 0; overflow-wrap: anywhere; }
.help-ctx-list .lbl { display: inline-block; min-inline-size: 86px; }
.help-ctx-msg { display: block; margin-block-start: 2px; }
.help-attach { display: grid; gap: 8px; }
.help-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 6px 0; border-block-end: 1px solid var(--line); font-size: 14px; }
.help-files li > span:first-child { overflow-wrap: anywhere; font-weight: 600; }
.help-drop, .docs-drop.over { background: var(--ground-alt); }
.help-drop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; }
.help-drop.over, .docs-drop.over { background: var(--band); box-shadow: inset 0 0 0 2px var(--ink); }
.help-drop label.btn, .docs-add { display: inline-flex; }
.help-drop label.btn:focus-within, .docs-add:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }
/* Firstline's phone and how soon it answers: shown for the urgency picked, on the form and once it's sent. */
.help-call { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-block-start: -8px; font-weight: 600; }
.help-call.sent { margin-block-start: 0; }
.help-call .btn { text-decoration: none; }
.help-sent { display: grid; gap: 12px; }
.help-sent h3 { font-size: 24px; font-weight: 600; }
.help-num { font-weight: 600; }
.help-num .mono { font-size: 18px; font-weight: 600; }
.help-mine li { border-block-end: 1px solid var(--line); }
.help-mine a { display: grid; gap: 4px; padding: 12px 8px; color: var(--ink); text-decoration: none; }
.help-mine a:hover { background: var(--band); color: var(--ink); }
.help-mine-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- statuses and urgency ---------- */
.status.h-new::before { background: var(--warn); }
.status.h-open::before { background: var(--ink); }
.status.h-waiting-customer::before { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.status.h-waiting-org::before { background: var(--warn); transform: rotate(45deg); }
.status.h-resolved::before { background: var(--good); }
.chip.h-urgent { background: var(--critical); color: var(--ground); }

/* ---------- a request ---------- */
.help-ticket { display: grid; gap: 20px; min-inline-size: 0; }
.help-ticket .row-end { flex-wrap: nowrap; align-items: start; }
.help-ticket .row-end > :first-child { min-inline-size: 0; overflow-wrap: anywhere; }
.help-ticket .page-head h1 { font-size: 28px; }
.help-ticket .page-head h2 { font-size: 22px; }
.help-modes { display: flex; align-items: center; gap: 10px; }
.help-id { font-size: 0.7em; font-weight: 600; }
.help-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; padding: 14px 16px; background: var(--ground-alt); }
.help-bar label { min-inline-size: 170px; flex: 0 1 200px; }
.help-bar .actions { margin-inline-start: auto; }
.help-trip-open { margin-block-start: 6px; }
.help-bar .saved, .help-bar [data-errfor] { flex-basis: 100%; }
.help-ask p { font-size: 15px; }
.help-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.help-main, .help-side { display: grid; gap: 20px; min-inline-size: 0; }
.help-side section, .help-side .docs { display: grid; gap: 10px; padding-block-end: 20px; border-block-end: 1px solid var(--line); }
.help-side section:last-child { border-block-end: 0; }
.manage-body .help-side section { padding-block-end: 20px; gap: 10px; }
.convo { display: grid; gap: 12px; }
.msg { display: grid; gap: 8px; padding: 14px 16px; background: var(--ground-alt); }
.msg.firstline { background: var(--ground); box-shadow: inset 0 0 0 1px var(--line-strong); }
.msg.internal { background: var(--band); box-shadow: none; }
.msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.msg-head .small { margin-inline-start: auto; }
.msg-text { overflow-wrap: anywhere; }
.msg-files a { font-weight: 600; }
.help-reply { display: grid; gap: 12px; padding-block-start: 4px; }
.help-reply textarea { resize: vertical; }
.help-reply .actions { align-items: end; }
.help-then { display: grid; gap: 6px; min-inline-size: 190px; }
.help-history { display: grid; }
.help-history li { display: grid; gap: 2px; padding: 7px 0; border-block-end: 1px solid var(--line); font-size: 14px; }
.help-history li:last-child { border-block-end: 0; }
.help-table td:first-child { white-space: nowrap; }
.help-table tr.h-unread strong { font-weight: 600; }
.help-filters { gap: 12px 14px; }
.help-status-pick { display: none; }
.subnav .count { margin-inline-start: 8px; }

/* ---------- files on a record ---------- */
.docs { display: grid; gap: 10px; min-inline-size: 0; }
.docs-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.docs-drop { display: grid; }
.docs-drop.over { padding: 8px; }
.docs-empty { padding: 12px; background: var(--ground-alt); }
.panel .docs-empty, .help-side .docs-empty { background: var(--ground); }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 12px; align-items: center; padding: 10px 0; border-block-end: 1px solid var(--line); }
.doc-main { display: grid; gap: 2px; min-inline-size: 0; }
.doc-name { font-weight: 600; overflow-wrap: anywhere; }
.doc-row progress { inline-size: 100%; block-size: 6px; accent-color: var(--red); }
.status.doc-ready::before { background: var(--good); }
.status.doc-rejected::before { background: var(--critical); }
.status.doc-waiting::before, .status.doc-working::before { background: var(--warn); transform: rotate(45deg); }
.docs-note { padding: 10px 12px; background: var(--ground-alt); color: var(--ink); }
.panel .docs-note { background: var(--ground); }

@media (max-width: 1080px) {
  .help-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .help-dialog { margin: 0; inline-size: 100vw; max-inline-size: 100vw; block-size: 100dvh; max-block-size: 100dvh; }
  .help-top { padding: 12px 16px; }
  .help-top .seg { order: 3; inline-size: 100%; }
  .help-body { padding: 16px; }
  .help-row { grid-template-columns: minmax(0, 1fr); }
  .help-bar label { flex: 1 1 100%; }
  .help-bar .actions { margin-inline-start: 0; }
  .doc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .doc-row .status { grid-column: 1; grid-row: 2; justify-self: start; }
  .doc-row > :last-child { grid-column: 2; grid-row: 1 / span 2; }
  .msg-head .small { margin-inline-start: 0; inline-size: 100%; }
  .help-call .btn { inline-size: 100%; justify-content: center; }
  .help-urgency .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .help-modes .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1; }
  .help-status-seg { display: none; }
  .help-status-pick { display: grid; flex: 1 1 100%; }
  .help-table thead { display: none; }
  .help-table tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 0; border-block-end: 1px solid var(--line); }
  .help-table tbody td { padding: 0; border: 0; }
  .help-table tbody td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .help-table tbody td.hide-sm { display: none; }
  .help-table tbody td:has(.status) { justify-self: end; }
}
