/* Shared shadcn-svelte style primitives, themed for the local admin palette. */

.admin-cn-dashboard-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.admin-cn-dashboard-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 720px) {
  .admin-cn-dashboard-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.admin-cn-card[data-slot="card"] {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background:
    linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft)), var(--admin-surface);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--inset-highlight);
  position: relative;
  overflow: hidden;
}

.admin-cn-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: flex-start;
  gap: 4px 12px;
  padding: 14px 16px 0;
}

.admin-cn-card-header > [data-slot="card-description"] {
  grid-column: 1;
  grid-row: 1;
}

.admin-cn-card-header > [data-slot="card-title"] {
  grid-column: 1;
  grid-row: 2;
}

.admin-cn-card-header > [data-slot="card-action"] {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: flex-start;
  justify-self: end;
}

.admin-cn-card-header--lead > [data-slot="card-title"] {
  grid-row: 1;
}

.admin-cn-card-header--lead > [data-slot="card-description"] {
  grid-row: 2;
}

.admin-cn-card-description {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--admin-muted);
}

.admin-cn-card-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--admin-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.admin-cn-card-title--section {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
}

.admin-cn-card-skeleton {
  min-height: 132px;
}

.admin-cn-card-skeleton--tall {
  min-height: 0;
}

@media (min-width: 900px) {
  .admin-cn-card-title {
    font-size: 1.65rem;
  }
}

.admin-cn-card-footer {
  padding: 12px 16px 14px;
  margin-top: auto;
  border-top: 1px solid color-mix(in srgb, var(--admin-border) 70%, transparent);
}

.admin-cn-card-footer--stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 13px;
}

.admin-cn-card-footer-primary {
  font-weight: 600;
  color: var(--admin-text);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.admin-cn-card-footer-muted {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.35;
}

.admin-cn-card-content {
  padding: 12px 16px 14px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-cn-card-content--flush {
  padding-top: 4px;
}

.admin-cn-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-surface-2) 88%, var(--admin-bg));
  color: var(--admin-text);
}

.admin-cn-badge :global(svg) {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.admin-cn-badge-outline {
  background: transparent;
  border-color: var(--admin-border);
  color: var(--admin-muted);
}

.admin-cn-badge-destructive {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.admin-cn-badge-success {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success-text);
}

.admin-cn-badge-muted {
  background: color-mix(in srgb, var(--admin-surface-2) 70%, var(--admin-bg));
  color: var(--admin-muted);
}

.ui-spinner,
.telegram-button-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  flex: 0 0 auto;
  animation: ui-spin 0.72s linear infinite;
}

.ui-spinner-sm {
  width: 13px;
  height: 13px;
  border-width: 2px;
}

.ui-spinner-lg {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}

.ui-skeleton,
.admin-skeleton,
.skeleton-line,
.skeleton-dot,
.skeleton-pay-button {
  display: inline-block;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--muted) 10%, transparent),
    color-mix(in srgb, var(--muted) 18%, transparent),
    color-mix(in srgb, var(--muted) 10%, transparent)
  );
  background-size: 220% 100%;
  animation: ui-skeleton-pulse 1.2s ease-in-out infinite;
}

.ui-skeleton {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
}

.ui-skeleton-line,
.admin-skeleton-line,
.skeleton-line {
  width: 100%;
  height: 10px;
  min-height: 0;
  border-radius: 999px;
}

.ui-skeleton-title,
.skeleton-line-title {
  height: 14px;
  min-height: 0;
  width: 72%;
}

.ui-skeleton-short,
.admin-skeleton-line-short,
.skeleton-line-short {
  width: 56%;
}

.ui-skeleton-tiny,
.admin-skeleton-line-tiny,
.skeleton-line-tiny {
  width: 34%;
}

.ui-skeleton-badge,
.admin-skeleton-badge {
  width: 64px;
  height: 18px;
  min-height: 0;
  border-radius: 999px;
}

.ui-skeleton-dot,
.skeleton-dot {
  width: 18px;
  height: 18px;
  min-height: 0;
  border-radius: 999px;
}

@keyframes ui-skeleton-pulse {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent);
}

.textarea::placeholder {
  color: var(--dim);
}

.textarea:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.scroll-area {
  overflow: hidden;
  min-height: 0;
}

.scroll-area--mono {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(
      in srgb,
      var(--admin-muted, var(--muted)) 34%,
      var(--admin-border, var(--border))
    )
    transparent;
}

.scroll-area--mono::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scroll-area--mono::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-area--mono::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(
    in srgb,
    var(--admin-muted, var(--muted)) 34%,
    var(--admin-border, var(--border))
  );
  background-clip: padding-box;
}

.scroll-area--mono::-webkit-scrollbar-thumb:hover {
  background: color-mix(
    in srgb,
    var(--admin-muted, var(--muted)) 48%,
    var(--admin-border, var(--border))
  );
  background-clip: padding-box;
}

.attention-dot {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 13px;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #ff4b4b;
  box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.75);
  animation: attention-pulse 1.6s ease-out infinite;
  transform: translate(50%, -50%);
  pointer-events: none;
}

.attention-dot-inline {
  position: static;
  display: block;
  flex: 0 0 auto;
  transform: none;
}

@keyframes attention-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.75);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(255, 75, 75, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 75, 75, 0);
  }
}

.nav-badge {
  display: inline-grid;
  box-sizing: border-box;
  --numeric-badge-optical-y: 0.5px;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0 6px;
  text-align: center;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum";
}

.numeric-badge-value {
  display: block;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  text-align: center;
  transform: translateY(var(--numeric-badge-optical-y, 0.5px));
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum";
}

@supports (text-box-trim: trim-both) {
  .numeric-badge-value {
    transform: none;
  }
}

.nav-badge-floating {
  position: absolute;
  top: 2px;
  right: 14px;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.support-screen {
  display: grid;
  align-content: start;
  gap: 10px;
}

.support-ticket-screen {
  display: grid;
  align-content: start;
  gap: 12px;
}

.support-overview-card,
.support-list-card,
.support-ticket-card,
.support-conversation-card {
  display: grid;
  min-width: 0;
  gap: 12px;
  overflow: visible;
}

.support-list-card {
  align-content: start;
}

.support-ticket-card .empty-card {
  display: grid;
  min-height: 160px;
  place-items: center;
  text-align: center;
}

.support-conversation-card {
  gap: 12px;
}

.support-heading-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.support-heading-copy {
  min-width: 0;
}

.support-heading-copy h1 {
  margin: 0;
  color: var(--accent);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.16;
}

.support-heading-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.support-heading-icon {
  display: flex;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.support-new-ticket-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft));
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  box-shadow: inset 0 1px 0 var(--inset-highlight);
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.support-new-ticket-button:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--surface-muted) 84%, var(--accent) 8%);
}

.support-new-ticket-button.active {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: color-mix(in srgb, var(--surface-muted) 82%, var(--accent) 12%);
}

.support-new-ticket-button > span:not(.support-new-ticket-icon) {
  min-width: 0;
}

.support-new-ticket-button strong,
.support-new-ticket-button small {
  display: block;
}

.support-new-ticket-button strong {
  font-size: 13px;
  line-height: 1.2;
}

.support-new-ticket-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.support-new-ticket-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-muted));
  color: var(--accent);
}

.support-create-panel,
.ticket-composer,
.support-admin-composer {
  display: grid;
  gap: 10px;
}

.support-create-panel {
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

.support-create-panel-inner {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.support-create-grid,
.ticket-composer-row,
.support-admin-composer-row,
.ticket-badges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.ticket-composer-row,
.support-admin-composer-row,
.ticket-badges {
  display: flex;
}

.support-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.support-field > span,
.support-field > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.support-field > small {
  justify-self: end;
  font-weight: 700;
}

.support-message-input {
  min-height: 128px;
}

.support-submit-button {
  margin-top: 2px;
}

.support-select-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  padding: 0 12px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 color-mix(in srgb, white 5%, transparent);
}

.support-select-trigger:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 72%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.support-select-content {
  z-index: 150;
  width: var(--bits-select-anchor-width, min(250px, calc(100vw - 28px)));
  min-width: min(180px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-3);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
  transform-origin: top left;
  animation: dropdown-enter 0.16s ease-out both;
}

.support-select-viewport {
  max-height: min(240px, 45dvh);
  padding: 6px;
}

.support-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 9px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.support-select-item[data-highlighted] {
  background: var(--surface-hover);
}

.support-select-check {
  opacity: 0;
  color: var(--accent);
}

.support-select-item[data-selected] .support-select-check {
  opacity: 1;
}

.support-status-tabs {
  min-width: 0;
}

.support-status-tabs-list {
  display: flex;
  width: 100%;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  padding: 4px;
  scrollbar-width: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, white 5%, transparent);
}

.support-status-tabs-list::-webkit-scrollbar {
  display: none;
}

.support-status-tabs-trigger {
  appearance: none;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 8px 11px;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.support-status-tabs-trigger b {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-muted) 82%, transparent);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding-inline: 6px;
}

.support-status-tabs-trigger:hover {
  color: var(--text);
}

.support-status-tabs-trigger[data-state="active"] {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.support-status-tabs-trigger[data-state="active"] b {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: color-mix(in srgb, var(--accent) 78%, white);
}

.support-status-tabs-trigger:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.support-list-card .ticket-list {
  display: grid;
  gap: 10px;
}

.support-list-card .empty-card {
  display: grid;
  min-height: 180px;
  place-items: center;
  text-align: center;
}

.support-user-list-skeleton {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.support-user-ticket-skeleton {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  align-items: center;
  gap: 14px;
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 92%, transparent);
  padding: 14px 14px 14px 18px;
}

.support-user-ticket-skeleton-main,
.support-user-ticket-skeleton-side {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.support-user-ticket-skeleton-side {
  justify-items: end;
}

.ticket-list,
.ticket-message-list,
.support-admin-messages,
.support-inbox-list-inner {
  display: grid;
  gap: 10px;
}

.ticket-card {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 92%, transparent);
  color: inherit;
  padding: 14px 14px 14px 18px;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.ticket-card::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 6px;
  width: 3px;
  border-radius: 3px;
  background: var(--ticket-accent, var(--border-strong));
  transition: background 0.16s ease;
}

.ticket-card[data-status="open"],
.ticket-card[data-status="awaiting_admin"] {
  --ticket-accent: var(--accent);
}
.ticket-card[data-status="awaiting_user"] {
  --ticket-accent: var(--info);
}
.ticket-card[data-status="resolved"],
.ticket-card[data-status="closed"] {
  --ticket-accent: color-mix(in srgb, var(--muted) 70%, transparent);
}
.ticket-card[data-priority="urgent"] {
  --ticket-accent: var(--danger);
}

.ticket-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: color-mix(in srgb, var(--panel-2) 86%, var(--accent) 6%);
  box-shadow: var(--shadow-soft);
}

.ticket-card:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.ticket-card-main,
.ticket-card-title,
.ticket-card-side,
.ticket-card-badges,
.ticket-card-meta {
  min-width: 0;
}

.ticket-card-main {
  display: grid;
  gap: 6px;
}

.ticket-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.ticket-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ticket-card-title svg {
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--accent) 72%, var(--muted));
}

.ticket-card-title strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.ticket-card-meta > span + span::before {
  content: "·";
  margin-right: 8px;
  color: color-mix(in srgb, var(--muted) 60%, transparent);
}

.ticket-card-badges,
.ticket-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ticket-status-badge,
.ticket-priority-badge,
.ticket-message-role-badge {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
}

.ticket-status-badge--open,
.ticket-status-badge--awaiting_admin {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: color-mix(in srgb, var(--accent) 80%, white);
}

.ticket-status-badge--awaiting_user {
  border-color: color-mix(in srgb, var(--info) 38%, var(--border));
  background: color-mix(in srgb, var(--info) 14%, transparent);
  color: var(--info-text);
}

.ticket-status-badge--closed,
.ticket-status-badge--resolved {
  border-color: color-mix(in srgb, var(--muted) 24%, var(--border));
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  color: var(--muted);
}

.ticket-priority-badge--normal,
.ticket-priority-badge--low {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
  color: var(--muted);
}

.ticket-priority-badge--high {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning-text);
}

.ticket-priority-badge--urgent {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--border));
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger-text);
}

.ticket-card-unread {
  display: inline-grid;
  box-sizing: border-box;
  --numeric-badge-optical-y: 0.5px;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0 7px;
  text-align: center;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum";
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}

.ticket-card-unread-dot {
  flex: 0 0 auto;
}

.support-ticket-detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: start;
  margin-bottom: 0;
}

.support-back-button {
  align-self: start;
}

.ticket-detail-title {
  min-width: 0;
}

.ticket-detail-title small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ticket-detail-title h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.18;
}

.support-ticket-detail-header .ticket-badges {
  grid-column: 2;
  justify-content: flex-start;
}

.support-ticket-state-card {
  align-content: stretch;
}

.support-empty-state {
  display: grid;
  grid-column: 1 / -1;
  min-height: 170px;
  place-items: center;
  gap: 9px;
  border: 1px dashed color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  color: var(--text);
  padding: 22px 18px;
  text-align: center;
}

.support-empty-state svg {
  color: var(--accent);
}

.support-empty-state strong {
  font-size: 18px;
  line-height: 1.2;
}

.support-empty-state small {
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.ticket-message-meta time {
  display: block;
  color: var(--muted);
  margin: 0;
}

.support-message-scroll,
.support-admin-message-scroll {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  padding: 14px;
}

.support-ticket-screen .support-message-scroll {
  overflow: visible;
}

.support-conversation-card--loading {
  grid-template-rows: minmax(0, 1fr);
}

.ticket-message-list,
.support-admin-messages {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
}

.ticket-message-list--loading {
  justify-content: flex-end;
  min-height: 100%;
}

.ticket-message-skeleton-row {
  display: grid;
  grid-template-columns: 32px minmax(0, min(72%, 520px));
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.ticket-message-skeleton-row--outgoing {
  grid-template-columns: minmax(0, min(72%, 520px)) 32px;
  justify-content: end;
}

.ticket-message-skeleton-row--outgoing .ui-skeleton-dot {
  grid-column: 2;
  grid-row: 1;
}

.ticket-message-skeleton-row--outgoing .ticket-message-skeleton-content {
  grid-column: 1;
  grid-row: 1;
  justify-items: end;
}

.ticket-message-skeleton-content {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.ticket-message-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-end;
  min-width: 0;
  animation: ticket-message-enter 0.18s ease-out both;
}

.ticket-message-row--outgoing {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.ticket-message-row--outgoing .ticket-message-avatar {
  grid-column: 2;
  grid-row: 1;
}

.ticket-message-row--outgoing .ticket-message-content {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  align-items: flex-end;
}

.ticket-message-row--incoming .ticket-message-content {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  align-items: flex-start;
}

.ticket-message-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-muted) 78%, transparent);
  color: var(--muted);
}

.ticket-message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ticket-message-avatar strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ticket-message-avatar .brand-mark {
  width: 100%;
  height: 100%;
  color: inherit;
  font-size: 22px;
}

.ticket-message-row--admin {
  --ticket-bubble-bg: color-mix(in srgb, var(--info) 14%, var(--panel-2));
  --ticket-bubble-border: color-mix(in srgb, var(--info) 32%, var(--border));
  --ticket-bubble-text: #eaf3ff;
}

.ticket-message-row--user {
  --ticket-bubble-bg: color-mix(in srgb, var(--accent) 18%, var(--panel-2));
  --ticket-bubble-border: color-mix(in srgb, var(--accent) 38%, var(--border));
  --ticket-bubble-text: #f4fff9;
}

.ticket-message-row--system {
  --ticket-bubble-bg: color-mix(in srgb, var(--surface-muted) 72%, var(--panel-2));
  --ticket-bubble-border: var(--border);
  --ticket-bubble-text: var(--text);
}

.ticket-message-row--admin .ticket-message-avatar {
  border-color: color-mix(in srgb, var(--info) 32%, var(--border));
  background: color-mix(in srgb, var(--info) 12%, transparent);
  color: var(--info-text);
}

.ticket-message-row--user .ticket-message-avatar {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.ticket-message-row--internal .ticket-message-avatar {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  color: var(--warning-text);
}

.ticket-message-content {
  display: flex;
  width: fit-content;
  max-width: min(82%, 680px);
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.ticket-message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.ticket-message-row--outgoing .ticket-message-meta {
  justify-content: flex-end;
}

.ticket-message-author {
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--muted) 84%, var(--text));
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-message-meta time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ticket-message-bubble {
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--ticket-bubble-border, var(--border));
  border-radius: 14px 14px 14px 4px;
  background: var(--ticket-bubble-bg, color-mix(in srgb, var(--panel-2) 92%, transparent));
  padding: 10px 13px;
  white-space: pre-wrap;
}

.ticket-message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  color: var(--ticket-bubble-text, var(--text));
  font-size: 14px;
  line-height: 1.5;
}

.ticket-message-row--outgoing .ticket-message-bubble {
  border-radius: 14px 14px 4px 14px;
}

.ticket-message-row--internal .ticket-message-bubble {
  --ticket-bubble-bg: color-mix(in srgb, var(--warning) 8%, var(--panel-2));
  --ticket-bubble-border: color-mix(in srgb, var(--warning) 28%, var(--border));
  border-style: dashed;
}

.ticket-composer {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  padding: 12px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.16s ease;
}

.ticket-composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow:
    var(--shadow-soft),
    0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.ticket-composer-textarea {
  min-height: 96px;
  resize: vertical;
}

.ticket-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticket-composer-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.ticket-composer-send {
  min-width: 132px;
}

.support-messages-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@keyframes ticket-message-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 1024px) {
  .support-screen {
    min-height: calc(100dvh - 74px);
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 12px;
  }

  .support-ticket-screen {
    height: calc(100dvh - 68px);
    min-height: 0;
    max-height: calc(100dvh - 68px);
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 14px;
    overflow: hidden;
    padding-bottom: 0;
  }

  .support-overview-card,
  .support-list-card,
  .support-ticket-card,
  .support-conversation-card {
    gap: 14px;
  }

  .support-list-card {
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
  }

  .support-ticket-list-scroll {
    min-height: 0;
    height: 100%;
  }

  .support-list-card .ticket-list,
  .support-user-list-skeleton {
    align-content: start;
    padding-right: 4px;
  }

  .support-list-card .support-empty-state {
    width: min(100%, 430px);
    min-height: 220px;
    height: auto;
    align-self: center;
    justify-self: center;
  }

  .support-heading-row {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .support-heading-icon {
    width: 46px;
    height: 46px;
  }

  .support-new-ticket-button {
    min-height: 62px;
    padding: 10px 12px;
  }

  .support-create-panel-inner {
    padding: 14px;
  }

  .support-status-tabs-trigger {
    flex: 1 1 0;
    text-align: center;
  }

  .ticket-card {
    min-height: 84px;
    padding: 16px 16px 16px 20px;
  }

  .ticket-card-title strong {
    font-size: 15.5px;
  }

  .support-ticket-detail-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-bottom: 0;
  }

  .support-ticket-detail-header .ticket-badges {
    grid-column: 3;
    justify-content: flex-end;
  }

  .support-ticket-screen > .support-ticket-state-card {
    min-height: calc(100dvh - 74px);
  }

  .support-conversation-card {
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    overflow: hidden;
  }

  .support-conversation-card--loading {
    grid-template-rows: minmax(0, 1fr);
  }

  .support-ticket-screen .support-message-scroll {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    padding: 20px;
    scrollbar-width: thin;
  }

  .support-ticket-screen .ticket-message-list {
    min-height: 100%;
    justify-content: flex-end;
  }

  .support-ticket-screen .support-messages-empty {
    min-height: 0;
    height: 100%;
  }

  .support-ticket-screen .ticket-composer {
    padding: 14px;
  }

  .support-ticket-screen .ticket-composer-textarea {
    min-height: 92px;
  }

  .ticket-message-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .ticket-message-row--outgoing {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .ticket-message-avatar {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 520px) {
  .support-screen {
    padding-bottom: calc(var(--bottom-nav-height) + var(--bottom-nav-offset) + 24px);
  }

  .support-ticket-screen {
    height: calc(100dvh - max(16px, env(safe-area-inset-top)) - 48px);
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 10px;
    overflow: hidden;
    padding-bottom: calc(
      var(--bottom-nav-height) + max(var(--bottom-nav-offset), env(safe-area-inset-bottom)) + 12px
    );
  }

  .support-ticket-screen > .support-ticket-state-card {
    min-height: 100%;
  }

  .support-ticket-screen .support-conversation-card {
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    overflow: hidden;
  }

  .support-ticket-screen .support-conversation-card--loading {
    grid-template-rows: minmax(0, 1fr);
  }

  .support-new-ticket-button {
    min-height: 58px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    padding: 9px 10px;
  }

  .support-new-ticket-icon {
    width: 38px;
    height: 38px;
  }

  .support-create-grid {
    grid-template-columns: 1fr;
  }

  .support-message-input {
    height: 108px;
    min-height: 108px;
  }

  .support-status-tabs-list {
    display: flex;
    width: 100%;
    overflow-x: auto;
  }

  .support-status-tabs-trigger {
    flex: 0 0 auto;
    padding-inline: 10px;
    white-space: nowrap;
    line-height: 1;
  }

  .support-empty-state {
    min-height: 190px;
  }

  .support-user-ticket-skeleton {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
    padding: 14px;
  }

  .support-user-ticket-skeleton-side {
    grid-auto-flow: column;
    justify-content: start;
    justify-items: start;
  }

  .ticket-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 14px 14px 14px 18px;
  }

  .ticket-card-main {
    gap: 5px;
  }

  .ticket-card-title strong {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 14.5px;
  }

  .ticket-card-side {
    align-items: flex-end;
    gap: 6px;
  }

  .ticket-card-badges {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }

  .support-ticket-detail-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 10px;
  }

  .support-ticket-detail-header .ticket-badges {
    grid-column: 2;
    justify-content: flex-start;
  }

  .support-back-button {
    width: fit-content;
  }

  .support-ticket-detail-header .ticket-detail-title h1 {
    font-size: 17px;
    line-height: 1.18;
  }

  .support-message-scroll,
  .support-admin-message-scroll {
    max-height: none !important;
    overflow: visible;
    padding: 12px 10px;
  }

  .support-ticket-screen .support-message-scroll {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    padding: 10px;
  }

  .support-ticket-screen .ticket-message-list {
    min-height: 100%;
    justify-content: flex-end;
  }

  .support-ticket-screen .support-messages-empty {
    min-height: 0;
    height: 100%;
  }

  .ticket-message-list,
  .support-admin-messages {
    gap: 14px;
  }

  .ticket-message-row {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
  }

  .ticket-message-row--outgoing {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .ticket-message-row--outgoing .ticket-message-avatar {
    grid-column: 2;
  }

  .ticket-message-row--outgoing .ticket-message-content {
    grid-column: 1;
    justify-self: end;
    align-items: flex-end;
  }

  .ticket-message-row--incoming .ticket-message-content {
    grid-column: 2;
    justify-self: start;
  }

  .ticket-message-content {
    max-width: min(86%, calc(100vw - 80px));
  }

  .ticket-message-avatar {
    width: 32px;
    height: 32px;
  }

  .ticket-message-avatar .brand-mark {
    font-size: 18px;
  }

  .ticket-message-bubble {
    width: fit-content;
    border-radius: 14px 14px 14px 4px;
    padding: 9px 11px;
  }

  .ticket-message-row--outgoing .ticket-message-bubble {
    border-radius: 14px 14px 4px 14px;
  }

  .ticket-message-bubble p {
    font-size: 13.5px;
    line-height: 1.45;
  }

  .ticket-composer-textarea {
    min-height: 76px;
  }

  .support-ticket-screen .ticket-composer {
    gap: 6px;
    padding: 9px 10px;
  }

  .support-ticket-screen .ticket-composer-textarea {
    height: 56px;
    min-height: 56px;
  }

  .ticket-composer-row {
    align-items: center;
    flex-direction: row;
  }

  .ticket-composer-send {
    width: auto;
    min-width: 108px;
    padding-inline: 14px;
  }
}

@media (max-width: 520px) {
  .support-new-ticket-button strong,
  .ticket-card-title strong,
  .ticket-detail-title h1 {
    letter-spacing: 0;
  }
}
