/* Email to ticket: the Helpdesk page's Email tab (helpdesk-mail.js). Colours come from style.css. */

.hm-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hm-bar .segmented { margin-bottom: 0; }
.hm-note { font-size: 13px; min-height: 20px; flex: 1; min-width: 180px; }
.segmented em.hm-bad { background: var(--bad-soft); color: var(--bad); }
#hm-done:empty, #hm-waiting[hidden], #hm-history[hidden], #hm-settings[hidden] { display: none; }
.hm-done { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--ok-soft); font-size: 13.5px; }
.hm-done > .icon { color: var(--ok); flex: none; }
.hm-done .grow { flex: 1; min-width: 0; }

/* ---- waiting */
.hm-list { display: grid; gap: 14px; }
.hm-mail { padding: 16px 18px; display: grid; gap: 12px; min-width: 0; }
.hm-head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.hm-head .grow { flex: 1; min-width: 0; }
.hm-head time { flex: none; white-space: nowrap; padding-top: 2px; }
.hm-from { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.hm-from b { overflow-wrap: anywhere; }
.hm-subject { font-size: 15.5px; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; text-transform: none; letter-spacing: 0; color: var(--text); }
.hm-why { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hm-reason { display: inline-flex; align-items: flex-start; gap: 7px; font-size: 13px; color: var(--warn); background: var(--warn-soft); border-radius: 9px; padding: 5px 10px; max-width: 100%; }
.hm-reason .icon { flex: none; margin-top: 2px; }
.hm-why .pill { display: inline-flex; align-items: center; gap: 5px; }
.hm-why .pill .icon.sm { width: 13px; height: 13px; }
.hm-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 13.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; max-height: 13.2em; overflow: hidden; position: relative; }
.hm-text:not(.whole)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.2em; background: linear-gradient(transparent, var(--panel-2)); pointer-events: none; }
.hm-text.whole { max-height: min(60vh, 560px); overflow: auto; }
.hm-text.inbox { max-height: min(56vh, 520px); margin-top: 12px; }
.hm-files { display: flex; gap: 8px; flex-wrap: wrap; }
.hm-left { margin: 0; }
.hm-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hm-actions .spacer { flex: 1; }

/* ---- the dialogs */
dialog.hm-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
dialog.hm-dialog.wide { width: min(820px, calc(100vw - 32px)); }
.hm-about { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); min-width: 0; }
.hm-about .icon { flex: none; margin-top: 3px; color: var(--muted); }
.hm-about .grow { min-width: 0; display: grid; }
.hm-about b, .hm-about .sub { overflow-wrap: anywhere; }
.hm-about .sub { font-size: 12.5px; color: var(--muted); }
fieldset.hm-who { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; min-width: 0; margin: 0; }
fieldset.hm-who legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.hm-choice { display: grid; gap: 8px; min-width: 0; }
.hm-choice > select, .hm-choice > label:not(.check), .hm-choice > p { margin-left: 25px; }
.hm-choice:not(.on) > select, .hm-choice:not(.on) > label:not(.check) { display: none; }
.hm-choice select, .hm-choice input:not([type="radio"]) { width: 100%; min-width: 0; }
.hm-choice > select { width: calc(100% - 25px); }
.hm-results { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.hm-result { display: flex; grid-template-columns: none; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font-weight: 400; cursor: pointer; min-width: 0; }
.hm-result:hover { background: var(--panel-2); }
.hm-result.on { border-color: var(--accent); background: var(--accent-soft); }
.hm-result .grow { flex: 1; min-width: 0; display: grid; }
.hm-result b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-result .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-result input { flex: none; accent-color: var(--accent); }
dialog.hm-dialog input[type="search"] { width: 100%; }

/* ---- history */
.hm-filter { margin-left: auto; }
.hm-row { display: grid; grid-template-columns: 96px minmax(0, 1.2fr) minmax(0, 1.6fr) auto; gap: 14px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.hm-rowhead { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 9px; padding-bottom: 9px; }
.hm-row.failed { background: color-mix(in srgb, var(--bad) 6%, transparent); }
.hm-when { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.hm-what { display: grid; min-width: 0; }
.hm-what b, .hm-what .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-row .sub { font-size: 12.5px; color: var(--muted); }
.hm-outcome { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.hm-outcome .sub { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.hm-do { display: flex; justify-content: flex-end; min-width: 72px; }
.hm-foot { padding: 10px 18px; margin: 0; }

/* ---- settings */
.hm-status { display: grid; gap: 12px; }
.hm-status .hd-flag a { color: inherit; font-weight: 600; }
.hm-form { display: grid; gap: 18px; max-width: 760px; }
.hm-form label.switch { align-items: flex-start; }
.hm-form label.switch .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hm-form .actions { margin-top: 0; min-height: 34px; }
.hm-lead { margin-bottom: 14px; max-width: 860px; }
.hm-domains { display: grid; gap: 8px; }
.hm-domain { display: grid; grid-template-columns: minmax(120px, 240px) minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; min-width: 0; }
.hm-domain .hm-org { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hm-domain input { width: 100%; min-width: 0; }
.hm-domain [role="status"] { grid-column: 2 / -1; }
.hm-domain [role="status"]:empty { display: none; }
.hm-addsender { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hm-addsender input { flex: 1 1 240px; max-width: 340px; min-width: 0; }
.hm-setup { display: grid; gap: 12px; max-width: 900px; line-height: 1.55; }
.hm-setup code { font: 12.5px "Cascadia Mono", Consolas, monospace; background: var(--raised); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.hm-setup .subhead { margin: 8px 0 0; }
.hm-rules { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }

/* ---- on a ticket */
.hm-bymail .icon.sm { width: 13px; height: 13px; }
.hm-wholebtn { margin-top: 8px; justify-self: start; padding-left: 6px; }

@media (max-width: 760px) {
  .hm-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .hm-rowhead { display: none; }
  .hm-when { grid-column: 1 / -1; }
  .hm-outcome { grid-column: 1 / -1; }
  .hm-do { grid-row: 2; grid-column: 2; }
  .hm-domain { grid-template-columns: minmax(0, 1fr) auto; }
  .hm-domain .hm-org { grid-column: 1 / -1; }
  .hm-domain [role="status"] { grid-column: 1 / -1; }
  .hm-actions .spacer { display: none; }
  .hm-actions { justify-content: flex-end; }
  .hm-head time { display: none; }
}
