/* ===== Tickets: estados, personas, conversación, reacciones y adjuntos ===== */
.tk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.tk-layout.staff { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 900px) { .tk-layout, .tk-layout.staff { grid-template-columns: 1fr; } }
.tk-title { font-size: 24px; margin: 8px 0 10px; overflow-wrap: anywhere; }

/* Estado */
.tk-status { --sc: #fb923c; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-weight: 700; font-size: 13px;
  color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--sc) 35%, transparent); white-space: nowrap; }
.tk-status.sm { padding: 2px 9px; font-size: 11.5px; }
.tk-status.abierto { --sc: #fb923c; }
.tk-status.respondido { --sc: #4ade80; }
.tk-status.esperando { --sc: #60a5fa; }
.tk-status.cerrado { --sc: #9a99ab; }

.tk-steps { list-style: none; display: flex; margin: 6px 0 16px; padding: 0; counter-reset: s; }
.tk-steps li { flex: 1; position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); }
.tk-steps li:first-child { border-radius: 10px 0 0 10px; }
.tk-steps li:last-child { border-radius: 0 10px 10px 0; }
.tk-steps li + li { border-left: 0; }
.tk-steps li span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--card2); filter: grayscale(1); opacity: .6; flex: none; }
.tk-steps li.done { color: var(--text); }
.tk-steps li.done span { filter: none; opacity: 1; }
.tk-steps li.on { color: var(--text); background: color-mix(in srgb, var(--accent) 10%, var(--card)); box-shadow: inset 0 -2px 0 var(--accent); }
.tk-steps li.on span { filter: none; opacity: 1; background: color-mix(in srgb, var(--accent) 25%, var(--card2)); }
@media (max-width: 560px) { .tk-steps li { flex-direction: column; text-align: center; gap: 4px; padding: 8px 4px; font-size: 11.5px; } }

/* Creador y asignado */
.tk-people { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
@media (max-width: 560px) { .tk-people { grid-template-columns: 1fr; } }
.tk-person { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.tk-person img { width: 36px; height: 36px; border-radius: 8px; image-rendering: pixelated; flex: none; }
.tk-person small { display: block; font-size: 11px; color: var(--dim, var(--muted)); text-transform: uppercase; letter-spacing: .04em; }
.tk-person b { overflow-wrap: anywhere; }
.tk-person.empty { border-style: dashed; }
.tk-noone { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--card2); color: var(--muted); font-weight: 800; flex: none; }

/* Conversación */
.tk-thread .msg .bubble-wrap { flex: 1; min-width: 0; }
.tk-thread .msg .bubble { white-space: normal; }
.tk-thread .msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-thread .msg { scroll-margin-top: 90px; }
.tk-thread .msg:target .bubble { box-shadow: 0 0 0 2px var(--accent); }
.tk-event { text-align: center; font-size: 12.5px; color: var(--muted); margin: 4px 0 16px; display: flex; align-items: center; gap: 10px; justify-content: center; }
.tk-event::before, .tk-event::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.tk-event span { color: var(--text); }

/* Reacciones */
.reacts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 0 2px; min-height: 28px; }
.react-list { display: contents; }
.react { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--line2, var(--line)); background: var(--card);
  color: var(--text); font: inherit; font-size: 13px; cursor: pointer; transition: transform .12s, border-color .12s, background .12s; }
.react b { font-size: 12px; }
.react:hover { border-color: var(--accent); }
.react.mine { background: color-mix(in srgb, var(--accent) 16%, var(--card)); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.react.pop { animation: reactpop .3s ease; }
@keyframes reactpop { 50% { transform: scale(1.25); } }
.react-pick { position: relative; }
.react-pick summary { list-style: none; display: inline-flex; align-items: center; height: 26px; padding: 0 8px; border-radius: 99px; border: 1px dashed var(--line2, var(--line));
  cursor: pointer; font-size: 13px; opacity: .55; transition: opacity .12s; user-select: none; }
.react-pick summary::-webkit-details-marker { display: none; }
.react-pick summary small { font-weight: 800; margin-left: 1px; }
.msg:hover .react-pick summary, .react-pick[open] summary, .react-pick summary:focus-visible { opacity: 1; }
.react-pick .pick { position: absolute; z-index: 20; bottom: calc(100% + 6px); left: 0; display: flex; gap: 2px; padding: 5px; background: var(--card2); border: 1px solid var(--line2, var(--line));
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pickin .15s ease; }
.react-pick .pick button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; font-size: 19px; cursor: pointer; transition: transform .1s, background .1s; }
.react-pick .pick button:hover { background: var(--card); transform: scale(1.2); }
@keyframes pickin { from { opacity: 0; transform: translateY(4px); } }
@media (hover: none) { .react-pick summary { opacity: 1; } }

/* Adjuntos en los mensajes */
.tk-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tk-att.img { display: block; width: 160px; height: 120px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.tk-att.img img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.tk-att.img:hover img { transform: scale(1.05); }
.tk-att.vid { display: flex; flex-direction: column; gap: 4px; width: min(100%, 420px); }
.tk-att.vid video { width: 100%; max-height: 300px; border-radius: 10px; background: #000; border: 1px solid var(--line); }

/* Zona para adjuntar al escribir */
.att-zone { border: 1px dashed transparent; border-radius: 12px; padding: 4px; margin: -4px; transition: border-color .15s, background .15s; }
.att-zone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.att-list { display: flex; flex-wrap: wrap; gap: 8px; }
.att-list:not(:empty) { margin-top: 10px; }
.att-item { position: relative; width: 96px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line2, var(--line)); background: var(--card2); display: grid; place-items: center; font-size: 26px; }
.att-item img, .att-item video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att-item .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); width: 0; transition: width .15s; }
.att-item.done .bar { display: none; }
.att-item.err { border-color: var(--bad); }
.att-item.err::after { content: '!'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(120, 20, 20, .65); color: #fff; font-weight: 800; }
.att-item .rm { position: absolute; top: 3px; right: 3px; z-index: 2; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 12px; line-height: 22px; padding: 0; }
.att-item .nm { position: absolute; left: 0; right: 0; bottom: 4px; z-index: 1; font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Panel lateral del staff */
.tk-statebtns { display: grid; gap: 6px; }
.tk-statebtns form { margin: 0; }
.tk-statebtn { --sc: #fb923c; width: 100%; text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.tk-statebtn:hover:not(:disabled) { border-color: var(--sc); }
.tk-statebtn.on { background: color-mix(in srgb, var(--sc) 16%, var(--card2)); border-color: var(--sc); color: var(--sc); }
.tk-statebtn:disabled:not(.on) { opacity: .45; cursor: not-allowed; }
.tk-statebtn.respondido { --sc: #4ade80; }
.tk-statebtn.esperando { --sc: #60a5fa; }
.tk-statebtn.cerrado { --sc: #9a99ab; }

/* Visor de imágenes */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lightbox .x { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 18px; cursor: pointer; }
