/* Spark Agency HR — messages, tickets, linked branches (v50) */
@media screen {
  dialog.hq-pop { width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px #0f2a3655; }
  dialog.hq-pop::backdrop { background: #0f2a36c7; backdrop-filter: blur(4px); }
  dialog.hq-pop[open] { animation: hq-pop 0.4s cubic-bezier(.2,.9,.3,1.2); }
  .hq-pop-head { display: flex; gap: 14px; align-items: center; padding: 22px 24px; background: linear-gradient(135deg, #21345a, #2f5d8a); color: #fff; }
  .hq-pop-head svg { flex: none; color: #9cc8e6; }
  .hq-pop-head small { letter-spacing: 0; text-transform: none; color: #c9dcf0; font-size: 12.5px; }
  .hq-pop-head h2 { margin: 2px 0 0; color: #fff; }
  .hq-pop-body { padding: 20px 24px 6px; font-size: 15.5px; line-height: 1.7; }
  .hq-pop-date { margin: 0; padding: 0 24px; color: #8aa0a6; font-size: 12.5px; }
  .hq-pop-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px 6px; flex-wrap: wrap; }
  .hq-pop-foot button { display: inline-flex; align-items: center; gap: 8px; }
  .hq-pop-note { margin: 0; padding: 0 24px 18px; font-size: 12.5px; text-align: right; }

  .hq-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #e9f0ef; width: max-content; max-width: 100%; overflow-x: auto; margin-bottom: 18px; }
  .hq-tabs button { display: inline-flex; align-items: center; gap: 7px; margin: 0; min-height: 36px; padding: 6px 14px; border: 0; border-radius: 9px; background: transparent; color: #47616b; box-shadow: none; font-weight: 700; white-space: nowrap; }
  .hq-tabs button[aria-selected="true"] { background: #fff; color: #21345a; box-shadow: 0 1px 3px #0f2a361f; }
  .hq-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
  .hq-head h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
  .hq-head p { margin: 0; max-width: 70ch; }
  .hq-head button { display: inline-flex; align-items: center; gap: 8px; }
  .hq-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
  .hq-cols h3 { display: flex; align-items: center; gap: 8px; margin-top: 0; }
  .hq-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: #f2b84b; color: #4a3200; font-size: 12px; }
  .hq-t { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; width: 100%; text-align: left; margin: 0 0 6px; padding: 10px 12px; border: 1px solid #e3ecea; border-radius: 12px; background: #fff; color: inherit; box-shadow: none; font-weight: 400; }
  .hq-t:hover { border-color: #0a9a9c; }
  .hq-t .hq-chip { grid-row: span 2; }
  .hq-t small { letter-spacing: 0; text-transform: none; color: #5b7178; font-size: 12.5px; }
  .hq-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: #eef3f2; color: #5b7178; white-space: nowrap; }
  .hq-chip.warn { background: #fff3d6; color: #8a5a00; }
  .hq-chip.ok { background: #e2f6ef; color: #0d7a5c; }
  .hq-back { margin-bottom: 10px; }
  .hq-thread-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
  .hq-thread-head h2 { margin: 0; }
  .hq-quote { padding: 12px 14px; border-left: 4px solid #4a90bf; background: #f2f7fc; border-radius: 8px; margin: 12px 0; }
  .hq-quote p { margin: 6px 0 0; }
  .hq-msgs { display: grid; gap: 10px; max-height: 52vh; overflow: auto; padding: 8px 2px; }
  .hq-msg { max-width: 78%; padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: #f1f5f5; justify-self: start; }
  .hq-msg.is-mine { justify-self: end; background: #0f2a36; color: #fff; border-radius: 16px 16px 4px 16px; }
  .hq-msg.is-mine small { color: #a9c9cf; }
  .hq-msg.is-sys { justify-self: center; background: transparent; color: #5b7178; font-style: italic; max-width: 100%; }
  .hq-msg small { letter-spacing: 0; text-transform: none; font-size: 11.5px; color: #5b7178; }
  .hq-msg p { margin: 4px 0 0; line-height: 1.55; }
  .hq-reply { display: grid; gap: 8px; margin-top: 12px; }
  .hq-reply textarea { height: auto; }
  .hq-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
  .hq-actions button { display: inline-flex; align-items: center; gap: 7px; }
  dialog.hq-dialog { width: min(560px, calc(100vw - 32px)); border: 0; border-radius: 20px; padding: 0; }
  dialog.hq-dialog.hq-wide { width: min(760px, calc(100vw - 24px)); padding: 18px; }
  dialog.hq-dialog::backdrop { background: #0f2a36b3; backdrop-filter: blur(3px); }
  dialog.hq-dialog[open] { animation: hq-pop 0.3s cubic-bezier(.22,.8,.3,1); }
  .hq-dclose { margin-top: 10px; }
  .hq-form { display: grid; gap: 12px; padding: 22px; }
  .hq-form h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
  .hq-form label { display: grid; gap: 6px; margin: 0; font-weight: 600; }
  .hq-form textarea { height: auto; }
  .panel.hq-form { padding: 22px; }
  .hq-err { margin: 0; color: #b42318; font-weight: 700; }
  .hq-seg { display: flex; gap: 8px; flex-wrap: wrap; }
  .hq-seg label { display: inline-flex !important; align-items: center; gap: 8px; padding: 8px 14px; border: 1.5px solid #d6e2e1; border-radius: 999px; cursor: pointer; }
  .hq-seg label:has(input:checked) { border-color: #21345a; background: #21345a; color: #fff; }
  .hq-seg input { width: auto; margin: 0; display: none; }
  .hq-check { display: flex !important; flex-direction: row; align-items: center; gap: 8px; }
  .hq-check input { width: auto; margin: 0; }
  .hq-tpl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid #eef3f2; }
  .hq-tpl small, .hq-sent small { letter-spacing: 0; text-transform: none; color: #5b7178; font-size: 12.5px; }
  .hq-tpl .link { text-align: left; padding: 0; margin: 0; }
  .hq-x { grid-row: span 2; font-size: 18px; }
  .hq-sent-h { margin-top: 20px; }
  .hq-sent { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid #eef3f2; }
  .hq-links { display: grid; gap: 8px; }
  .hq-link { display: grid !important; grid-template-columns: auto 1fr 40px 1fr; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e3ecea; border-radius: 12px; cursor: pointer; margin: 0; }
  .hq-link input { width: 18px; height: 18px; margin: 0; accent-color: #21345a; }
  .hq-link i { height: 2px; background: repeating-linear-gradient(90deg, #c2d2d0 0 5px, transparent 5px 9px); transition: background 0.3s; }
  .hq-link.is-on { border-color: #21345a; background: #f2f6fb; }
  .hq-link.is-on i { background: #21345a; }
  .hq-chat-head { margin-bottom: 8px; }
  .hq-chat .hq-msgs { min-height: 200px; }
  .hq-portal .hq-t { margin-top: 6px; }
  @keyframes hq-pop { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
  @media (prefers-reduced-motion: reduce) { dialog.hq-pop[open], dialog.hq-dialog[open] { animation: none; } }
}
@media screen { .hq-who-note { margin: -6px 0 0; font-size: 12px; color: #6b7f86; } .hq-who-note:empty { display: none; } }
