/* tickets.css — « Soutien » : the floating « ? », the report dialog, the list and the thread.
   Tokens only: light and dark themes, 390 px phones, no horizontal overflow. */

/* ---- The floating « ? » button ----------------------------------------------- */
.helpbtn {
  position: fixed;
  right: calc(var(--s-4) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
  z-index: calc(var(--z-drawer) - 2);           /* under drawers, dialogs, the palette and toasts; over sticky bars */
  width: 44px; height: 44px; padding: 0; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--r-pill);
  background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow-md, 0 6px 18px rgba(0, 0, 0, .18));
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: .92;
  transition: transform var(--t-fast, .12s), opacity var(--t-fast, .12s), background var(--t-fast, .12s);
}
.helpbtn:hover, .helpbtn:focus-visible { opacity: 1; transform: translateY(-1px); background: var(--accent-soft); outline: none; }
.helpbtn:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.helpbtn[hidden] { display: none; }
.helpbtn__text { display: none; }
.helpbtn svg { width: 20px; height: 20px; }

/* Toasts stack above the button instead of under it. */
body.has-helpbtn .toasts { bottom: calc(var(--s-5) + 52px + env(safe-area-inset-bottom, 0px)); }

/* The sidebar's drawer on phones covers the corner anyway; keep the button off the wallboard and the punch clock. */
body.is-terminal .helpbtn { bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); right: calc(var(--s-3) + env(safe-area-inset-right, 0px)); width: 38px; height: 38px; opacity: .6; }
#app[data-mobilenav="true"] ~ .helpbtn { display: none; }

@media (max-width: 700px) {
  .helpbtn { width: 40px; height: 40px; }
  .helpbtn svg { width: 18px; height: 18px; }
  /* Room under every screen so its last buttons scroll clear of the « ? ». */
  body.has-helpbtn #view { padding-bottom: calc(var(--s-4) + 56px + env(safe-area-inset-bottom, 0px)); }
}
@media print { .helpbtn { display: none !important; } }

/* ---- The report dialog --------------------------------------------------------- */
.tkt-dialog .segmented { display: flex; width: 100%; }
.tkt-dialog .segmented button { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.tkt-dialog .segmented button svg { flex: 0 0 auto; }
.tkt-dialog .field.full { margin-bottom: var(--s-3); }
.tkt-photos .photogrid { margin-top: var(--s-2); }
.tkt-context { margin-top: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-inset, var(--surface-2)); }
.tkt-context > summary { display: flex; align-items: center; gap: 6px; padding: 8px 12px; cursor: pointer; list-style: none; font-size: var(--fs-sm); color: var(--ink-2); font-weight: var(--fw-semi); }
.tkt-context > summary::-webkit-details-marker { display: none; }
.tkt-context > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform var(--t-fast, .12s); }
.tkt-context[open] > summary::after { transform: rotate(-135deg); }
.tkt-context[open] > summary { border-bottom: 1px solid var(--border-subtle); }
.tkt-context .tkt-context__list, .tkt-context p { padding: 0 12px; }
.tkt-context p { padding-bottom: 10px; }
.tkt-context__list { margin: 0; font-size: var(--fs-sm); }
.tkt-context__list dd { overflow-wrap: anywhere; min-width: 0; }
.tkt-errors { margin: 0; padding-left: 16px; display: grid; gap: 3px; font-size: var(--fs-xs); color: var(--danger-ink, var(--danger)); overflow-wrap: anywhere; }

.tkt-kind__short { display: none; }
@media (max-width: 480px) {
  .tkt-dialog .segmented button { font-size: var(--fs-sm); padding-left: 6px; padding-right: 6px; }
  .tkt-kind__long { display: none; }
  .tkt-kind__short { display: inline; }
}

/* ---- The list ------------------------------------------------------------------ */
.tkt { min-width: 0; }
.tkt-table .tkt-title { max-width: 46ch; white-space: normal; line-height: var(--lh-snug); }
.tkt-table .subcell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 3px; }
.tkt-table tr.is-unseen td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tkt-table tr.is-unseen .td-strong { font-weight: var(--fw-bold); }
.tkt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); vertical-align: middle; margin-left: 2px; box-shadow: 0 0 0 3px var(--accent-soft); }
.tkt .filterbar { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); }

/* ---- The thread ------------------------------------------------------------------ */
.tkt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: var(--s-4); align-items: start; }
.tkt-thread { display: grid; gap: var(--s-3); }
.tkt-msg { padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); min-width: 0; }
.tkt-msg--fn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); margin-left: var(--s-6); }
.tkt-msg__who { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: 6px; font-size: var(--fs-sm); }
.tkt-msg__avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; }
.tkt-msg__avatar--fn { background: var(--accent); color: #fff; }
.tkt-msg__text { white-space: pre-line; line-height: var(--lh-normal); color: var(--ink); overflow-wrap: anywhere; }
.tkt-msg--fn .tkt-msg__text { color: var(--ink); }
.tkt-wait { display: flex; align-items: center; gap: 6px; margin: 0; padding: var(--s-2) var(--s-1); }
.tkt-reply { border-top: 1px dashed var(--border-strong, var(--border)); padding-top: var(--s-4); }
.tkt-side .card + .card { margin-top: var(--s-4); }
.tkt-detail .pagehead__title { flex-wrap: wrap; gap: 6px; }
.tkt-detail .pagehead__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

@media (max-width: 900px) {
  .tkt-grid { grid-template-columns: minmax(0, 1fr); }
  .tkt-msg--fn { margin-left: var(--s-3); }
}
@media (max-width: 480px) {
  .tkt-msg { padding: var(--s-3); }
  .tkt-msg--fn { margin-left: 0; }
}
