:root {
  --user-ticket-ink: #1f2937;
  --user-ticket-muted: #667085;
  --user-ticket-border: #e4e7ec;
  --user-ticket-surface: #fff;
  --user-ticket-soft: #f4f7fb;
  --user-ticket-blue: #1677d2;
  --user-ticket-blue-soft: #e8f2ff;
  --user-ticket-green-soft: #eaf8f0;
  --user-ticket-warning-soft: #fff6df;
  --user-ticket-radius: 10px;
  --user-ticket-shadow: 0 8px 24px rgb(31 41 55 / 7%);
}

.v2-ticket-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 40%) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 190px);
}

.v2-ticket-list-pane,
.v2-ticket-detail-pane {
  min-width: 0;
}

.v2-ticket-list-pane .block {
  height: 100%;
  margin-bottom: 0;
}

.v2-ticket-list-pane .ant-table-wrapper {
  overflow-x: auto;
}

.v2-ticket-detail-pane {
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--user-ticket-border);
  border-radius: var(--user-ticket-radius);
  background: var(--user-ticket-surface);
  box-shadow: var(--user-ticket-shadow);
}

.v2-ticket-detail-pane.is-empty {
  display: grid;
  place-items: center;
}

.v2-ticket-detail-shell {
  display: flex;
  min-height: 620px;
  height: 100%;
  flex-direction: column;
}

.v2-ticket-detail-header {
  display: flex;
  min-height: 74px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--user-ticket-border);
  background: var(--user-ticket-surface);
}

.v2-ticket-detail-heading {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.v2-ticket-detail-heading strong {
  overflow: hidden;
  color: var(--user-ticket-ink);
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-ticket-detail-heading span {
  color: var(--user-ticket-muted);
  font-size: 12px;
}

.v2-ticket-detail-status {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.v2-ticket-detail-status.is-pending {
  color: #ad6800;
  background: var(--user-ticket-warning-soft);
}

.v2-ticket-detail-status.is-replied {
  color: #1464b3;
  background: var(--user-ticket-blue-soft);
}

.v2-ticket-detail-status.is-closed {
  color: #18794e;
  background: var(--user-ticket-green-soft);
}

.v2-ticket-back,
.v2-ticket-close,
.v2-ticket-send {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.v2-ticket-back {
  display: none;
  padding: 6px 0;
  color: var(--user-ticket-muted);
  background: transparent;
  white-space: nowrap;
}

.v2-ticket-back:hover {
  color: var(--user-ticket-blue);
}

.v2-ticket-close {
  padding: 7px 11px;
  border: 1px solid var(--user-ticket-border);
  border-radius: 6px;
  color: var(--user-ticket-muted);
  background: var(--user-ticket-surface);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.v2-ticket-close:hover:not(:disabled) {
  border-color: #ffccc7;
  color: #c41d1d;
  background: #fff1f0;
}

.v2-ticket-close:disabled,
.v2-ticket-send:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.v2-ticket-detail-messages {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  padding: 20px;
  background: var(--user-ticket-soft);
  scroll-behavior: smooth;
}

.v2-ticket-message {
  display: flex;
  max-width: 88%;
  flex-direction: column;
  gap: 4px;
}

.v2-ticket-message.is-admin {
  align-self: flex-end;
  align-items: flex-end;
}

.v2-ticket-message.is-user {
  align-self: flex-start;
  align-items: flex-start;
}

.v2-ticket-message-meta {
  padding: 0 4px;
  color: var(--user-ticket-muted);
  font-size: 11px;
}

.v2-ticket-bubble {
  overflow-wrap: anywhere;
  padding: 10px 13px;
  border: 1px solid var(--user-ticket-border);
  border-radius: 12px;
  color: var(--user-ticket-ink);
  background: var(--user-ticket-surface);
  box-shadow: 0 1px 2px rgb(31 41 55 / 5%);
  line-height: 1.65;
  white-space: normal;
}

.v2-ticket-message.is-admin .v2-ticket-bubble {
  border-color: #cfe2f7;
  border-bottom-right-radius: 4px;
  background: var(--user-ticket-blue-soft);
}

.v2-ticket-message.is-user .v2-ticket-bubble {
  border-bottom-left-radius: 4px;
}

.v2-ticket-bubble a {
  overflow-wrap: anywhere;
  color: var(--user-ticket-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.v2-ticket-inline-image {
  display: block;
  margin: 8px 0 2px;
}

.v2-ticket-message-image {
  display: block;
  width: auto;
  max-width: min(100%, 520px);
  max-height: 420px;
  border: 1px solid var(--user-ticket-border);
  border-radius: 6px;
  object-fit: contain;
  background: var(--user-ticket-surface);
}

.v2-ticket-composer {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--user-ticket-border);
  background: var(--user-ticket-surface);
}

.v2-ticket-composer-input {
  min-height: 44px;
  max-height: 150px;
  flex: 1;
  resize: vertical;
  padding: 11px 13px;
  border: 1px solid #cfd6e0;
  border-radius: 6px;
  outline: 0;
  color: var(--user-ticket-ink);
  background: #f9fbfd;
  font: inherit;
  line-height: 1.5;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.v2-ticket-composer-input:focus {
  border-color: var(--user-ticket-blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgb(22 119 210 / 13%);
}

.v2-ticket-send {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 6px;
  color: #fff;
  background: var(--user-ticket-blue);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.v2-ticket-send:hover:not(:disabled) {
  background: #095db1;
  box-shadow: 0 5px 12px rgb(22 119 210 / 20%);
}

.v2-ticket-detail-empty {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-direction: column;
  padding: 30px;
  color: var(--user-ticket-muted);
  text-align: center;
}

.v2-ticket-detail-empty strong {
  color: var(--user-ticket-ink);
  font-size: 16px;
}

.v2-ticket-detail-empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: var(--user-ticket-blue);
  background: var(--user-ticket-blue-soft);
  font-weight: 800;
}

@media (max-width: 1100px) and (min-width: 768px) {
  .v2-ticket-workspace {
    grid-template-columns: minmax(320px, 44%) minmax(0, 1fr);
    gap: 14px;
  }
}

@media (max-width: 767px) {
  .v2-ticket-workspace {
    display: block;
    min-height: 0;
  }

  .v2-ticket-workspace.has-selection .v2-ticket-list-pane {
    display: none;
  }

  .v2-ticket-workspace:not(.has-selection) .v2-ticket-detail-pane {
    display: none;
  }

  .v2-ticket-detail-pane {
    min-height: calc(100vh - 150px);
    border-radius: 8px;
  }

  .v2-ticket-detail-shell {
    min-height: calc(100vh - 150px);
  }

  .v2-ticket-detail-header {
    min-height: 68px;
    padding: 11px 13px;
    gap: 9px;
  }

  .v2-ticket-back {
    display: inline-flex;
    align-items: center;
  }

  .v2-ticket-detail-heading strong {
    font-size: 14px;
  }

  .v2-ticket-detail-status {
    display: none;
  }

  .v2-ticket-detail-messages {
    padding: 15px 12px;
  }

  .v2-ticket-message {
    max-width: 94%;
  }

  .v2-ticket-composer {
    padding: 10px;
  }
}

@media (max-width: 420px) {
  .v2-ticket-detail-header {
    align-items: flex-start;
  }

  .v2-ticket-close {
    padding: 6px 8px;
    font-size: 11px;
  }

  .v2-ticket-composer {
    align-items: stretch;
    flex-direction: column;
  }

  .v2-ticket-send {
    width: 100%;
  }
}
