/* Account & support pages: contact flow (choose type, ticket list, new ticket, ticket thread),
   chat, notifications and the user profile. Tokens and primitives live in theme.css.
   Replaces the old contact.css and calledToIslam/notifications.css. */

/* ==========================================================================
   Shared
   ========================================================================== */
.account-page { background: transparent; }

.contact-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin-bottom: .35rem;
  color: var(--h-muted);
  font-size: .85rem;
}
.contact-breadcrumb a { color: var(--h-muted); text-decoration: none; }
.contact-breadcrumb a:hover { color: var(--h-accent); }
.contact-breadcrumb-sep { color: var(--h-faint); }
.contact-breadcrumb [aria-current] { color: var(--h-gold); font-weight: 600; }

.contact-page-head .page-actions { align-items: center; }
.contact-back-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 42px;
  padding: .45rem .9rem;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-sm);
  background: var(--h-surface);
  color: var(--h-ink-soft);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}
.contact-back-link:hover { border-color: var(--h-line-strong); background: var(--h-surface-soft); color: var(--h-accent-strong); }
.contact-back-link i { color: var(--h-accent); }

.account-page .btn-icon { width: 42px; min-width: 42px; height: 42px; padding: 0; }
.account-page .btn-icon i { font-size: 1.05rem; }

.account-loading {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
  padding: 1.5rem 0;
  color: var(--h-muted);
}
.account-loading .spinner-border { color: var(--h-accent); }
.account-error { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; }
.account-page .empty-state-title { font-family: var(--h-font); font-weight: 600; }

/* Status lifecycle used on the ticket thread */
.status-pill.status-open { background: var(--h-success-soft); color: var(--h-success); }
.status-pill.status-pending { background: var(--h-warning-soft); color: var(--h-warning); }
.status-pill.status-closed { background: var(--h-paper-deep); color: var(--h-muted); }
.ticket-head .status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Scroll regions (ticket table, notification list) */
.support-list-scroll {
  max-height: min(62vh, 640px);
  max-height: min(62dvh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.support-list-scroll:focus-visible,
.ticket-thread:focus-visible { outline: 2px solid var(--h-accent) !important; outline-offset: -2px; }

/* ==========================================================================
   Choose type
   ========================================================================== */
.choose-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.25rem;
}
.choose-type-item { display: flex; min-width: 0; }
.choose-type-card {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
  text-align: start;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.choose-type-card:hover,
.choose-type-card:focus-within { border-color: rgba(14, 106, 100, .35); box-shadow: var(--h-shadow-sm); }
.choose-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 0 1.1rem;
  border: 1px solid var(--h-accent-soft);
  border-radius: var(--h-radius);
  background: var(--h-accent-tint);
  color: var(--h-accent);
  font-size: 1.3rem;
}
.choose-type-title {
  margin: 0 0 .4rem;
  color: var(--h-ink);
  font-family: var(--h-font-display);
  font-size: 1.2rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.choose-type-text {
  margin: 0;
  color: var(--h-muted);
  font-size: .95rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.choose-type-text:empty { display: none; }
.choose-type-action { align-self: flex-start; }
.choose-type-action i { transition: transform .16s ease; }
.choose-type-action:hover i { transform: translateX(-3px); }

/* ==========================================================================
   Ticket list
   ========================================================================== */
.card-table-container {
  overflow: hidden;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
}
.card-table-container table { min-width: 720px; }
.table-custom { --bs-table-bg: transparent; margin: 0; }
.table-custom > thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--h-line);
  background: var(--h-surface-soft);
  color: var(--h-muted);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}
.table-custom > tbody td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--h-line);
  color: var(--h-ink-soft);
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.table-custom > tbody tr:last-child td { border-bottom: 0; }
.table-custom > tbody tr { transition: background-color .16s ease; }
@media (hover: hover) {
  .table-custom > tbody tr:hover { background: var(--h-accent-tint); }
}
.table-custom .ticket-col-type,
.table-custom .ticket-col-status,
.table-custom .ticket-col-date { white-space: nowrap; overflow-wrap: normal; }
.table-custom .ticket-col-subject { width: 30%; }
.table-custom .ticket-col-message { width: 34%; color: var(--h-muted); font-size: .92rem; }
.table-custom .ticket-col-date { color: var(--h-muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.ticket-link { color: var(--h-ink); text-decoration: none; }
.ticket-link strong { font-weight: 600; }
.ticket-link:hover { color: var(--h-accent); }
.ticket-number {
  display: block;
  margin-top: .15rem;
  color: var(--h-faint);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.ticket-type { max-width: 100%; white-space: nowrap; }
.text-truncate-2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* ==========================================================================
   New ticket
   ========================================================================== */
.contact-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  align-items: start;
  gap: 1.5rem;
}
.form-card {
  min-width: 0;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
}
.form-card-title {
  margin: 0 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--h-line);
  color: var(--h-ink);
  font-size: 1.25rem;
}
.form-field { margin-bottom: 1.25rem; }
.form-card textarea.form-control { min-height: 168px; resize: vertical; }
.form-card fieldset:disabled { opacity: .85; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: .5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--h-line);
}
.form-actions .btn { min-width: 120px; }
.contact-alert { margin-bottom: 1.25rem; }

.info-card {
  position: sticky;
  top: calc(var(--header-height, 52px) + 2rem);
  padding: 1.5rem;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface-soft);
}
.info-card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
  color: var(--h-ink);
  font-family: var(--h-font);
  font-size: 1rem;
  font-weight: 700;
}
.info-card-title i { color: var(--h-gold); }
.info-list { margin: 0; padding: 0; list-style: none; }
.info-list li {
  position: relative;
  padding-inline-start: 1.1rem;
  color: var(--h-ink-soft);
  font-size: .92rem;
  line-height: 1.8;
}
.info-list li + li { margin-top: .75rem; }
.info-list li::before {
  content: "";
  position: absolute;
  top: .7em;
  inset-inline-start: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--h-accent);
}

/* Attachments (Shared/TicketAttachments; contact.js reads .attachments-drop, .is-disabled, .is-dragover) */
.ticket-attachments { margin-bottom: 1.25rem; }
.attachments-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 112px;
  padding: 1.25rem;
  border: 1px dashed var(--h-line-strong);
  border-radius: var(--h-radius);
  background: var(--h-surface-soft);
  color: var(--h-muted);
  font-size: .9rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease;
}
.attachments-drop i { color: var(--h-accent); font-size: 1.5rem; line-height: 1; }
.attachments-drop:hover,
.attachments-drop.is-dragover { border-color: var(--h-accent); background: var(--h-accent-tint); }
.attachments-drop.is-disabled { opacity: .6; cursor: not-allowed; }
.attachments-drop.is-disabled:hover { border-color: var(--h-line-strong); background: var(--h-surface-soft); }
.ticket-upload { position: relative; }
.ticket-upload input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.ticket-upload input:disabled { cursor: not-allowed; }
.ticket-upload:focus-within { border-color: var(--h-accent); box-shadow: var(--h-ring); }
.attachments-hint { display: block; margin-top: .4rem; color: var(--h-muted); font-size: .82rem; }
.attachments-error { margin-top: .5rem; color: var(--h-danger); font-size: .85rem; }
.attachment-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 0; padding: 0; list-style: none; }
.attachment-item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  max-width: 100%;
  min-height: 36px;
  padding-block: .2rem;
  padding-inline: .75rem .25rem;
  border: 1px solid var(--h-line);
  border-radius: 999px;
  background: var(--h-surface);
  color: var(--h-ink-soft);
  font-size: .85rem;
}
.attachment-item > i { color: var(--h-accent); }
.attachment-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--h-muted);
  font-size: .8rem;
  transition: background-color .16s ease, color .16s ease;
}
.attachment-remove:hover:not(:disabled) { background: var(--h-danger-soft); color: var(--h-danger); }
.attachment-remove:disabled { opacity: .5; }

/* ==========================================================================
   Ticket thread (contact.js reads .ticket-thread, .thread-msg-out, .msg-bubble, .msg-time)
   ========================================================================== */
.ticket-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
}
.ticket-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--h-line);
}
.ticket-head-main { min-width: 0; }
.ticket-subject {
  margin: 0 0 .5rem;
  color: var(--h-ink);
  font-size: 1.35rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.ticket-head-status { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; }
.ticket-code { color: var(--h-faint); font-size: .85rem; font-variant-numeric: tabular-nums; }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.ticket-date { color: var(--h-muted); font-size: .88rem; }
.ticket-date i { margin-inline-end: .2rem; color: var(--h-faint); }
.ticket-date bdi { white-space: nowrap; font-variant-numeric: tabular-nums; }

.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: 220px;
  max-height: min(58vh, 620px);
  max-height: min(58dvh, 620px);
  padding: 1.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--h-surface-soft);
  scrollbar-width: thin;
}
.ticket-thread > * { flex-shrink: 0; }

.thread-msg { display: flex; align-items: flex-start; gap: .75rem; }
/* Incoming (support) messages sit on the far side, avatar on the outer edge. */
.thread-msg-in { flex-direction: row-reverse; }
.msg-avatar {
  display: flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--h-paper-deep);
  color: var(--h-muted);
  font-size: 1.05rem;
}
.thread-msg-out .msg-avatar { background: var(--h-accent-soft); color: var(--h-accent); }
.msg-body { min-width: 0; max-width: min(72%, 640px); }
.msg-bubble {
  padding: .75rem 1rem;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius);
  background: var(--h-surface);
  color: var(--h-ink);
  font-size: .97rem;
  line-height: 1.85;
}
.thread-msg-in .msg-bubble { border-start-end-radius: 4px; }
.thread-msg-out .msg-bubble {
  border-color: transparent;
  border-start-start-radius: 4px;
  background: var(--h-accent-soft);
}
.ticket-message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-time {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
  margin-top: .35rem;
  color: var(--h-faint);
  font-size: .78rem;
  white-space: nowrap;
}
.thread-msg-in .msg-time { justify-content: flex-end; }
.msg-sender { min-width: 0; overflow: hidden; color: var(--h-muted); font-weight: 600; text-overflow: ellipsis; }
.msg-time bdi { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* Message attachments (Shared/TicketMessageFiles) */
.file-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.thread-msg-in .file-chips { justify-content: flex-end; }
.file-chips > li { max-width: 100%; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  max-width: 100%;
  min-height: 34px;
  padding: .25rem .8rem;
  border: 1px solid var(--h-line);
  border-radius: 999px;
  background: var(--h-surface);
  color: var(--h-ink-soft);
  font-size: .85rem;
  text-decoration: none;
  transition: border-color .16s ease, color .16s ease;
}
.file-chip i { color: var(--h-accent); }
a.file-chip:hover { border-color: var(--h-accent); color: var(--h-accent-strong); }
.file-chip-name { min-width: 0; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .75rem 1rem;
  border: 1px solid #efdcb4;
  border-radius: var(--h-radius);
  background: var(--h-warning-soft);
  color: var(--h-warning);
  font-size: .92rem;
  font-weight: 600;
  text-align: center;
}

/* Composer: the last band of the card, below the scrolling thread */
.ticket-reply { padding: 1.25rem 1.5rem 1.5rem; border-top: 1px solid var(--h-line); background: var(--h-surface); }
.reply-label { margin-bottom: .6rem; color: var(--h-ink); font-size: .92rem; font-weight: 600; }
.reply-row { display: flex; align-items: flex-end; gap: .75rem; }
.reply-field { flex: 1 1 auto; min-width: 0; }
.reply-field .form-control { min-height: 96px; resize: vertical; }
.reply-row .btn { flex: 0 0 auto; min-height: 46px; white-space: nowrap; }
.reply-closed {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: .85rem 1rem;
  border: 1px dashed var(--h-line-strong);
  border-radius: var(--h-radius);
  background: var(--h-surface-soft);
  color: var(--h-muted);
  font-size: .92rem;
}
.ticket-reply .ticket-attachments { margin: .85rem 0 0; }
.ticket-reply .ticket-attachments .form-label { color: var(--h-muted); font-size: .85rem; }
.ticket-reply .attachments-drop { flex-direction: row; min-height: 0; padding: .6rem 1rem; font-size: .88rem; }
.ticket-reply .attachments-drop i { font-size: 1.15rem; }

/* Close confirmation */
.ticket-close-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(27, 42, 46, .42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.ticket-close-dialog {
  width: min(100%, 420px);
  padding: 1.75rem 1.5rem 1.5rem;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
  box-shadow: var(--h-shadow-lg);
  text-align: center;
  animation: h-modal-enter .18s ease-out;
}
.ticket-close-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--h-danger-soft);
  color: var(--h-danger);
  font-size: 1.35rem;
}
.ticket-close-title { margin: 0 0 .5rem; color: var(--h-ink); font-size: 1.25rem; }
.ticket-close-dialog p { margin: 0 0 1.5rem; color: var(--h-muted); line-height: 1.85; }
.ticket-close-actions { display: flex; justify-content: center; gap: .6rem; }
.ticket-close-actions .btn { min-width: 120px; min-height: 44px; }

/* ==========================================================================
   Chat
   ========================================================================== */
.chat-page-card {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  height: min(70vh, 720px);
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
}
.chat-sidebar { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-inline-end: 1px solid var(--h-line); }
.chat-sidebar-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--h-line); }
.chat-sidebar-title { margin: 0; color: var(--h-ink); font-size: 1.15rem; }
.chat-sidebar-empty { padding: 2.5rem 1.25rem; color: var(--h-muted); font-size: .92rem; text-align: center; }
.chat-sidebar-empty i { display: block; margin-bottom: .5rem; color: var(--h-faint); font-size: 1.9rem; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-placeholder {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: var(--h-surface-soft);
  color: var(--h-muted);
  text-align: center;
}
.chat-placeholder-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--h-accent-soft);
  color: var(--h-accent);
  font-size: 1.6rem;
}
.chat-placeholder-title { margin: 0 0 .35rem; color: var(--h-ink); font-size: 1.25rem; }
.chat-placeholder p { max-width: 42ch; margin: 0; }
.chat-composer { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--h-line); }
.chat-composer .form-control { flex: 1 1 auto; min-width: 0; }
.chat-composer .btn-icon { width: 46px; min-width: 46px; height: 46px; }

/* ==========================================================================
   Notifications
   ========================================================================== */
.notification-center { width: 100%; }
.notification-unread-summary {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .5rem;
  padding: .2rem .75rem;
  border-radius: 999px;
  background: var(--h-accent-tint);
  color: var(--h-accent-strong);
  font-size: .85rem;
  font-weight: 600;
}
.notification-status-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--h-faint); }
.notification-unread-summary .notification-status-dot,
.notification-message.unread .notification-status-dot { background: var(--h-accent); }

.notification-messages-container {
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
}
.notification-message {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--h-line);
}
.notification-message:last-child { border-bottom: 0; }
.notification-message.unread { background: var(--h-accent-tint); }
.notification-message.unread::before {
  content: "";
  position: absolute;
  inset-block: .9rem;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--h-accent);
}
.notification-entry-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--h-radius);
  background: var(--h-accent-soft);
  color: var(--h-accent);
  font-size: 1.15rem;
}
.notification-message.read .notification-entry-icon { background: var(--h-paper); color: var(--h-faint); }
.notification-message-details { min-width: 0; }
.notification-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin-bottom: .3rem; }
.notification-entry-title {
  margin: 0;
  color: var(--h-ink);
  font-family: var(--h-font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.notification-message.read .notification-entry-title { color: var(--h-ink-soft); font-weight: 600; }
.notification-read-state { display: inline-flex; align-items: center; gap: .35rem; color: var(--h-faint); font-size: .75rem; }
.notification-message.unread .notification-read-state { color: var(--h-accent-strong); font-weight: 600; }
.notification-description,
.notification-additional-details {
  max-width: 75ch;
  margin: 0 0 .4rem;
  color: var(--h-ink-soft);
  font-size: .93rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.notification-additional-details { color: var(--h-muted); font-size: .88rem; }
.notification-message.read .notification-description { color: var(--h-muted); }
.notification-ticket-reference { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; color: var(--h-muted); font-size: .82rem; }
.notification-ticket-reference i { color: var(--h-faint); }
.notification-ticket-reference bdi { color: var(--h-ink); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.notification-message-aside { display: grid; justify-items: end; gap: .6rem; min-width: 140px; }
.notification-date { display: grid; justify-items: end; gap: .1rem; color: var(--h-muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.notification-time { display: inline-flex; align-items: center; gap: .3rem; color: var(--h-faint); }
.notification-message-control { display: flex; align-items: center; gap: .5rem; }
.notification-open-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 36px;
  padding: 0 .75rem;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-sm);
  background: var(--h-surface);
  color: var(--h-accent);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .16s ease, background-color .16s ease;
}
.notification-open-link i { transition: transform .16s ease; }
.notification-open-link:hover { border-color: var(--h-accent); color: var(--h-accent-strong); }
.notification-open-link:hover i { transform: translateX(-3px); }
.notification-read-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--h-line-strong);
  border-radius: var(--h-radius-sm);
  background: var(--h-surface);
  color: var(--h-accent);
  font-size: 1.1rem;
  transition: border-color .16s ease, background-color .16s ease;
}
.notification-read-button:hover:not(:disabled) { border-color: var(--h-accent); background: var(--h-accent-soft); }
.notification-read-button:disabled { opacity: .6; cursor: wait; }

/* ==========================================================================
   User profile
   ========================================================================== */
.profile-identity { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.profile-head-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 3px solid var(--h-surface);
  border-radius: 50%;
  background: var(--h-accent-soft);
  box-shadow: 0 0 0 1px var(--h-line);
  color: var(--h-accent);
  font-size: 2rem;
}
.profile-identity-text { min-width: 0; }
.profile-head-name,
.profile-head-email { margin: 0; overflow-wrap: anywhere; }
.profile-head-name { color: var(--h-ink-soft); font-size: 1.05rem; font-weight: 600; }
.profile-head-email { color: var(--h-muted); font-size: .9rem; text-align: right; }
.profile-head-name:empty,
.profile-head-email:empty { display: none; }

.profile-card {
  max-width: 820px;
  overflow: hidden;
  border: 1px solid var(--h-line);
  border-radius: var(--h-radius-lg);
  background: var(--h-surface);
}
.profile-section { padding: 1.5rem 1.75rem; }
.profile-section + .profile-section { border-top: 1px solid var(--h-line); }
.profile-photo { display: flex; align-items: center; gap: 1.25rem; }
.profile-photo-preview {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px dashed var(--h-line-strong);
  border-radius: 50%;
  background: var(--h-surface-soft);
  color: var(--h-faint);
  font-size: 1.4rem;
}
.profile-photo-body { min-width: 0; }
.profile-photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.profile-photo-name { color: var(--h-muted); font-size: .85rem; overflow-wrap: anywhere; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.profile-field-wide { grid-column: 1 / -1; }
.profile-field .form-label { display: block; }
.profile-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  background: var(--h-surface-soft);
}
.profile-footer .alert { flex: 1 1 260px; }
.profile-footer .btn { min-width: 160px; }

/* ==========================================================================
   Tablet
   ========================================================================== */
@media (max-width: 991px) {
  .contact-form-layout { grid-template-columns: minmax(0, 1fr); }
  .info-card { position: static; }
}

/* ==========================================================================
   Phone (<768px); mobile-app.css owns the shell, these override its contact rules
   ========================================================================== */
@media (max-width: 767px) {
  .account-page .page-head { gap: .75rem 1rem; margin-bottom: 1rem; padding-bottom: .9rem; }
  .account-page .page-title { font-size: 1.5rem; }
  .account-page .btn-icon { width: 46px; min-width: 46px; height: 46px; }

  /* Back link leads the head; actions take a full row. */
  .contact-page-head { align-items: stretch; }
  .contact-page-head > div:first-child { flex: 1 1 100%; }
  .contact-page-head .page-actions { flex: 1 1 100%; }
  .contact-page-head .page-actions .btn-primary { flex: 1 1 auto; }
  .contact-page-head .page-back { order: -1; justify-content: space-between; }
  .contact-back-link {
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--h-accent);
    font-size: .92rem;
  }

  /* Choose type */
  .choose-type-grid { gap: 12px; }
  .choose-type-card { gap: 1rem; padding: 18px; border-radius: var(--h-radius-lg); }
  .choose-type-icon { width: 44px; height: 44px; margin-bottom: .8rem; border-radius: var(--h-radius); }
  .choose-type-title { margin-bottom: .3rem; font-size: 1.1rem; }
  .choose-type-action { align-self: stretch; }

  /* Ticket list: rows become stacked cards */
  .card-table-container { overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .card-table-container .table-responsive,
  .support-list-scroll { max-height: none; overflow: visible; }
  .card-table-container table { min-width: 0; }
  .table-custom thead { display: none; }
  .table-custom { display: block; width: 100%; }
  .table-custom > tbody { display: grid; gap: 12px; }
  .table-custom > tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "type status" "subject subject" "message message" "date date";
    gap: .5rem .75rem;
    padding: 16px;
    border: 1px solid var(--h-line);
    border-radius: var(--h-radius-lg);
    background: var(--h-surface);
  }
  .table-custom > tbody td,
  .table-custom > tbody tr:last-child td { width: auto; padding: 0; border: 0; }
  .table-custom td::before { content: none; }
  .table-custom .ticket-col-type { grid-area: type; min-width: 0; }
  .table-custom .ticket-col-status { grid-area: status; justify-self: end; }
  .table-custom .ticket-col-subject { grid-area: subject; }
  .table-custom .ticket-col-message { grid-area: message; }
  .table-custom .ticket-col-date { grid-area: date; font-size: .82rem; }
  .ticket-type { white-space: normal; }
  .ticket-link { display: inline-block; font-size: 1.02rem; line-height: 1.6; }

  /* New ticket */
  .form-card,
  .info-card { padding: 18px; border-radius: var(--h-radius-lg); }
  .form-card-title { margin-bottom: 1.1rem; padding-bottom: .8rem; font-size: 1.15rem; }
  .form-actions .btn { flex: 1 1 0; min-width: 0; }
  .attachment-item { min-height: 44px; }
  .attachment-remove { width: 40px; height: 40px; }

  /* Ticket thread: the page scrolls, not the thread */
  .ticket-card { border-radius: var(--h-radius-lg); }
  .ticket-head { padding: 16px; }
  .ticket-subject { font-size: 1.2rem; }
  .ticket-meta { gap: .5rem .75rem; }
  .ticket-date { flex: 1 1 100%; order: -1; }
  .ticket-thread {
    min-height: 0;
    max-height: none;
    padding: 16px 12px;
    overflow: visible;
    overscroll-behavior: auto;
  }
  .thread-msg { gap: .5rem; }
  .msg-avatar { flex-basis: 32px; width: 32px; height: 32px; font-size: .95rem; }
  .msg-body { max-width: calc(100% - 40px - 1.5rem); }
  .msg-bubble { padding: .65rem .85rem; font-size: .95rem; }
  .file-chip { min-height: 40px; }
  .ticket-reply { padding: 16px; }
  .reply-row { flex-direction: column; align-items: stretch; }
  .reply-row .btn { width: 100%; }
  .ticket-close-actions .btn { flex: 1 1 0; min-width: 0; }

  /* Chat */
  .chat-page-card { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .chat-sidebar { border-inline-end: 0; border-bottom: 1px solid var(--h-line); }
  .chat-sidebar-empty { padding: 1.5rem 1rem; }
  .chat-main { min-height: 340px; }
  .chat-composer { padding: 12px; }

  /* Notifications */
  .notification-messages-container { overflow: hidden; }
  .notification-message { grid-template-columns: 38px minmax(0, 1fr); gap: .75rem; padding: 14px 16px; }
  .notification-entry-icon { width: 38px; height: 38px; font-size: 1rem; }
  .notification-message-aside {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    padding-top: .75rem;
    border-top: 1px solid var(--h-line);
  }
  .notification-date { justify-items: start; }
  .notification-open-link,
  .notification-read-button { min-height: 44px; }
  .notification-read-button { width: 44px; }

  /* Profile */
  .profile-identity { gap: .9rem; }
  .profile-head-avatar { width: 56px; height: 56px; font-size: 1.5rem; }
  .profile-card { border-radius: var(--h-radius-lg); }
  .profile-section { padding: 18px 16px; }
  .profile-photo { align-items: flex-start; gap: 1rem; }
  .profile-photo-preview { width: 52px; height: 52px; font-size: 1.2rem; }
  .profile-fields { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .profile-footer .btn { flex: 1 1 100%; }
}

@media (hover: none) {
  .choose-type-action:hover i,
  .notification-open-link:hover i { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-close-dialog { animation: none; }
  .choose-type-action i,
  .notification-open-link i { transition: none; }
}
