/* Tickets : liste, création, chat */

.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 12px 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  transition: border-color 150ms;
}
.ticket-card:hover { border-color: var(--border-strong); }
.ticket-card .ref { font-weight: 700; color: var(--text-strong); }
.ticket-card .who { font-size: 12px; color: var(--text-muted); }
.ticket-card .meta { font-size: 11px; color: var(--text-muted); }
.ticket-card .badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* Chat */
.chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chat-header {
  position: sticky;
  top: 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  z-index: 2;
}
.chat-header .ref-line {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.chat-header .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--border-strong);
}
.chat-bubble .who {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.chat-bubble .time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}
.chat-bubble.mine { align-self: flex-end; background: var(--bg-2); }
.chat-bubble.other { align-self: flex-start; background: var(--bg-3); }
.chat-bubble.system {
  align-self: center;
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}
.chat-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.chat-attachments .thumb {
  width: 80px; height: 80px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
}
.chat-attachments .thumb img { width: 100%; height: 100%; object-fit: cover; }
.chat-attachments .file {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  font-size: 11px;
  border-radius: 3px;
}

.chat-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-footer .actions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-footer textarea {
  width: 100%;
  min-height: 60px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  border-radius: 3px;
  resize: vertical;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  padding: 16px;
}
.lightbox img { max-width: 100%; max-height: 90vh; object-fit: contain; }
.lightbox .close {
  position: absolute; top: 16px; right: 16px;
  color: var(--text-strong); font-size: 24px; cursor: pointer;
}

/* Desktop : split-view chat */
@media (min-width: 1024px) {
  .chat-view-split {
    display: grid;
    grid-template-columns: 1fr 280px;
    flex: 1;
    min-height: 0;
  }
  .chat-view-split .chat-side {
    border-left: 1px solid var(--border);
    padding: 16px;
    background: var(--bg-2);
    overflow-y: auto;
  }
}

/* Form ticket */
.ticket-create-form .field { margin-bottom: 16px; }
