/* UI repair layer for restored pacodexsupport.com customer service. */
.customer-page .customer-shell {
  min-height: 100svh;
  padding: clamp(14px, 2vw, 30px);
}

.customer-page .customer-frame {
  width: min(100%, 1180px);
  height: min(780px, calc(100svh - clamp(28px, 4vw, 60px)));
  min-height: 600px;
  grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
  border-color: rgba(182, 198, 205, .75);
}

.customer-page .chat-window,
.admin-page .admin-chat {
  min-height: 0;
}

.chat-header {
  min-height: 78px;
  position: relative;
}

.support-close-button,
.mobile-back-button {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: #f7faf9;
  color: #4d5e66;
  cursor: pointer;
}

.support-close-button {
  width: 38px;
  height: 38px;
  margin-left: auto;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(16, 24, 32, .08);
}

.support-close-button:hover {
  color: var(--brand);
  background: #fff;
}

.composer {
  grid-template-columns: minmax(0, 1fr) 104px 120px;
  align-items: end;
}

.composer .image-button {
  color: var(--brand);
  background: #eef8f6;
  border: 1px solid #bddcd8;
  box-shadow: none;
}

.composer button[type="submit"] {
  min-width: 112px;
}

.composer textarea {
  width: 100%;
}

.message {
  min-width: 0;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.read-status,
.edit-message-button {
  border: 0;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--brand);
  background: #e9f6f4;
  font-size: 12px;
}

.edit-message-button {
  cursor: pointer;
}

.chat-image {
  display: block;
  max-width: min(260px, 70vw);
  max-height: 320px;
  border-radius: 8px;
  object-fit: contain;
  cursor: zoom-in;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 16, 22, .78);
}

.image-preview-overlay img {
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

.image-preview-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  font-size: 24px;
  cursor: pointer;
}

.cs-notify-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9998;
  max-width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  color: #fff;
  background: #17212b;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .25);
}

.mobile-back-button {
  display: none;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px;
}

@media (max-width: 820px) {
  .customer-page,
  .customer-page .customer-shell {
    min-height: 100svh;
    padding: 0;
    background: #f4f7f7;
  }

  .customer-page .customer-shell {
    display: block;
    width: 100vw;
    overflow: hidden;
  }

  .customer-page .customer-frame {
    width: 100%;
    max-width: none;
    height: 100svh;
    min-height: 0;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .customer-page .chat-header {
    min-height: 72px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .customer-page .agent-avatar {
    width: 54px;
    height: 54px;
  }

  .customer-page .chat-header h1 {
    font-size: 20px;
  }

  .customer-page .messages {
    min-height: 0;
    padding: 16px;
  }

  .customer-page .composer {
    grid-template-columns: minmax(0, 1fr) 90px 96px;
    gap: 8px;
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .customer-page .composer textarea,
  .customer-page .composer button {
    min-height: 50px;
    border-radius: 8px;
  }

  .customer-page .composer button[type="submit"] {
    min-width: 0;
  }

  .customer-page .message {
    max-width: 78%;
  }
}

@media (max-width: 520px) {
  .customer-page .composer {
    grid-template-columns: minmax(0, 1fr) 82px 86px;
  }

  .customer-page .composer textarea {
    padding: 11px 10px;
  }

  .customer-page .composer button {
    padding-inline: 8px;
  }
}

@media (max-width: 760px) {
  .admin-page .admin-shell {
    height: 100svh;
    min-height: 100svh;
    grid-template-rows: minmax(0, 1fr) !important;
    overflow: hidden;
  }

  .admin-page .sidebar {
    min-height: 0;
    height: 100svh;
    grid-template-rows: auto auto 1fr;
  }

  .admin-page .sidebar-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .admin-page .customer-list {
    max-height: none;
  }

  .admin-page .admin-chat {
    display: none;
    height: 100svh;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .admin-page .mobile-chat-open .sidebar {
    display: none;
  }

  .admin-page .mobile-chat-open .admin-chat {
    display: grid;
  }

  .admin-page .mobile-back-button {
    display: inline-grid;
  }

  .admin-page .info-panel {
    display: none !important;
  }

  .admin-page .conversation-header {
    min-height: 68px;
    height: auto;
    padding: 10px 12px;
  }

  .admin-page .selected-profile img {
    width: 42px;
    height: 42px;
  }

  .admin-page .remark-strip {
    grid-template-columns: minmax(0, 1fr) 86px;
    padding: 8px 10px;
  }

  .admin-page .messages {
    padding: 12px;
  }

  .admin-page .composer {
    grid-template-columns: minmax(0, 1fr) 78px 78px;
    gap: 8px;
    padding: 9px;
  }

  .admin-page .composer button[type="submit"] {
    min-width: 0;
  }
}
