/* Shared detail presentation for internal and external tickets. */
.ticket-detail {
  --ticket-padding: clamp(16px, 2vw, 24px);
  --ticket-label: color-mix(in srgb, var(--text) 72%, var(--surface));
  min-width: 0;
}
.ticket-detail .page-title { margin: 28px 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.ticket-detail .page-title h1 { font-size: clamp(24px, 2.4vw, 34px); font-weight: 600; line-height: 1.25; letter-spacing: -.6px; overflow-wrap: anywhere; margin-bottom: 8px; }
.ticket-readonly { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 20px; }
.ticket-readonly em { font-style: italic; }
.ticket-properties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; margin: 0 0 28px; padding: 0; }
.ticket-property { display: grid; grid-template-columns: minmax(100px, 34%) minmax(0, 1fr); gap: 12px; align-content: start; border-bottom: 1px solid var(--line); padding: 10px 0; min-width: 0; }
.ticket-property dt { color: var(--ticket-label); font-size: 12px; font-weight: 600; padding-top: 2px; overflow-wrap: anywhere; }
.ticket-property dd { margin: 0; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.ticket-property-item { display: block; }
.ticket-property-item + .ticket-property-item { margin-top: 4px; }
.ticket-reference-type { color: var(--ticket-label); font-size: 12px; margin-right: 5px; }
.ticket-status-label { display: inline-block; max-width: 100%; padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 3px; color: var(--accent); background: var(--tint); font-size: 12px; font-weight: 650; }
.ticket-detail h2 { font-size: 15px; font-weight: 650; line-height: 1.4; margin: 0; }
.ticket-description-panel { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 3px; background: var(--surface); margin: 0 0 28px; padding: var(--ticket-padding); box-shadow: 0 2px 8px #00000005; min-width: 0; }
.ticket-description-panel h2 { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ticket-description-panel .ticket-description { margin: 18px 0 0; line-height: 1.75; }
.ticket-detail .ticket-note-form { margin: 0 0 32px; }
.ticket-detail .ticket-note-form > label { font-size: 13px; gap: 9px; }
.ticket-detail .ticket-note-form textarea { background: var(--surface); border-radius: 3px; min-height: 100px; }
.ticket-detail .ticket-note-actions > button { border-radius: 3px; }
.ticket-history-section { border-top: 1px solid var(--line); padding-top: 22px; margin-bottom: 24px; }
.ticket-history-section > h2 { margin-bottom: 22px; }
.ticket-detail .ticket-timeline { list-style: none; padding: 0 0 0 20px; margin: 0 0 0 5px; border-left: 1px solid var(--line); }
.ticket-detail .ticket-timeline > li { position: relative; margin: 0 0 14px; }
.ticket-detail .ticket-timeline > li:before { content: ''; position: absolute; left: -25px; top: 20px; width: 9px; height: 9px; border: 2px solid var(--accent); border-radius: 50%; background: var(--bg); }
.ticket-detail .ticket-history-entry { border: 1px solid var(--line); border-radius: 3px; padding: 14px 18px; background: var(--surface); }
.ticket-detail .ticket-history-entry header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; opacity: 1; }
.ticket-history-entry header > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; min-width: 0; overflow-wrap: anywhere; }
.ticket-history-entry time, .ticket-history-event { color: var(--ticket-label); font-size: 12px; }
.ticket-history-entry time { font-variant-numeric: tabular-nums; }
.ticket-history-entry .ticket-text { font-size: 14px; margin: 12px 0 0; line-height: 1.65; }
.ticket-detail .ticket-timeline .ticket-internal { border-left: 3px solid #be8b31; }
.ticket-private-label { color: var(--ticket-label); font-size: 11px; border: 1px solid var(--line); padding: 0 5px; border-radius: 2px; }
.ticket-history-changes { margin-top: 12px; font-size: 13px; }
.ticket-history-changes summary { cursor: pointer; font-weight: 550; color: var(--accent); width: fit-content; }
.ticket-history-changes summary span { color: var(--ticket-label); font-weight: 400; }
.ticket-history-changes dl { margin: 10px 0 0; }
.ticket-history-changes dl > div { display: grid; grid-template-columns: minmax(100px, 20%) minmax(0, 1fr); gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.ticket-history-changes dt { font-weight: 550; overflow-wrap: anywhere; }
.ticket-history-changes dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; min-width: 0; }
.ticket-history-changes dd > span { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.ticket-change-before, .ticket-change-arrow { color: var(--ticket-label); }
.ticket-history-empty, .ticket-history-remote { font-size: 13px; color: var(--ticket-label); margin: 0; }
.ticket-history-remote { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 3px; }
.ticket-history-remote a { display: inline-block; font-weight: 600; margin-left: 8px; }
@media (max-width: 760px) {
  .ticket-properties { grid-template-columns: 1fr; }
  .ticket-property { grid-template-columns: minmax(100px, 32%) minmax(0, 1fr); }
  .ticket-history-changes dl > div { grid-template-columns: 1fr; gap: 3px; }
  .ticket-detail .ticket-history-entry { padding: 12px; }
  .ticket-detail .ticket-note-actions { grid-template-columns: 1fr; }
  .ticket-detail .ticket-note-actions > button, .ticket-detail .ticket-note-actions > label { grid-column: 1; }
}
